FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Development

 
 
LinkBack Thread Tools
 
Old 08-03-2008, 11:17 AM
"Ahmed Kamal"
 
Default python modules for handling disks and filesystems

Hi everyone,
I am working on some python code for an upstream project and I will
need to handle disks and filesystems. i.e. "mounting", "umounting",
"querying whether a directory is a mount point", "getting a file
system size" and such ...
Does such a module exist, or do I run shells commands and parse ?

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 08-03-2008, 04:54 PM
Michael Stone
 
Default python modules for handling disks and filesystems

Ahmed,

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.

http://dev.laptop.org/git?p=users/mstone/security;a=blob;f=rainbow/rainbow/util.py;hb=cli
(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
D-Bus.

Regards,

Michael

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
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 

Thread Tools




All times are GMT. The time now is 10:44 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org