nikademus79 / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

Add mount options support to disk_partitions #209

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
psutil.get_parititions() is very useful, but it doesn't tell you if the 
filesystem is read-only, which is available from the mount options.  This is 
available via the mntent structure, but it's not piped through all the way to 
the python tuples.

This feature request is for adding support to read filesystem options.

Thanks! 

Original issue reported on code.google.com by phi...@cloudera.com on 16 Sep 2011 at 7:53

GoogleCodeExporter commented 8 years ago
Those options are not standardized, therefore I can't think of a consistent API 
to provide them all.
Some examples:

rw,mode=0755
rw,noexec,nosuid,gid=5,mode=0620
rw,nosuid,nodev,user=giampaolo
rw,nosuid,nodev,allow_other,blksize=4096,default_permissions

Maybe you meant to provide permissions only ('r', 'w', 'rw')?

Original comment by g.rodola on 19 Sep 2011 at 6:23

GoogleCodeExporter commented 8 years ago
I just need permissions in my case, but even if they're not standardized, 
they're always a list of strings, with their meaning depending on the 
filesystem type.

Original comment by phi...@cloudera.com on 19 Sep 2011 at 6:30

GoogleCodeExporter commented 8 years ago

Original comment by g.rodola on 22 Oct 2011 at 11:50

GoogleCodeExporter commented 8 years ago
Looking back at this I think it's a nice idea to provide the raw option string 
because despite not being standardized it's very easy to parse.
By using your use case as an example, one might do:

>>> read_only = 'rw' not in opts.split(',')

I'll see what we can do on Windows.
If we're able to determine partition permissions we can at least return "r" or 
"rw" to emulate the UNIX behavior. If we can't we'll just return an empty 
string.

Original comment by g.rodola on 19 Apr 2012 at 7:02

GoogleCodeExporter commented 8 years ago
Linux and FreeBSD implementation committed as r1288 and r1289.

Original comment by g.rodola on 20 Apr 2012 at 3:13

GoogleCodeExporter commented 8 years ago
OSX implementation committed in r1290.

Original comment by g.rodola on 20 Apr 2012 at 3:53

GoogleCodeExporter commented 8 years ago
Windows implementation committed as r1306.
"fstype" now reflects the real filesystem type (e.g. "NTFS", "FAT") and 
"options" field is filled with drive permissions ("rw" or "ro") and drive type 
("fixed", "removable", "cdrom", etc...) as a comma separated string.

Original comment by g.rodola on 4 May 2012 at 6:12

GoogleCodeExporter commented 8 years ago
0.5.0 is finally out. Closing out as fixed.

Original comment by g.rodola on 27 Jun 2012 at 6:54

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Updated csets after the SVN -> Mercurial migration:
r1288 == revision 529a8c73abb9
r1290 == revision fed730fd4549
r1306 == revision d635682f575f

Original comment by g.rodola on 2 Mar 2013 at 12:03