I'm not aware of an agreed-upon solution to your problem but,
fortunately, there are many ways to approach your request. How important
is portability to you?
Anyway, here are two thoughts:
a) You might consider wrapping the appropriate syscalls or libc
functions with ctypes, e.g.
(MIT-licensed; very non-portable, but effective where it works)
Beware that calling sys_mount directly through glibc's mount will not
update /etc/mtab. This means that the 'mounted filesystems list' listed
by the 'mount' executable will not coincide with the contents of
/proc/mounts. Also beware of people who use Linux's mount-point
namespaces via unshare() or clone() w/ the CLONE_NEWNS flag.
(Naturally, other mechanisms for wrapping C functions into Python will
permit you to achieve similar ends.)
b) Talk to some system service or executable that already knows how to
deal with mounting; e.g. the 'mount' binary via subprocess or HAL over
P.S. - If you do find a standard way to accomplish this, please speak
up. I certainly could use one.
fedora-devel-list mailing list