| | |
- FileSystemInfo
- TableEntry
class FileSystemInfo |
| |
Represents a table of information about file system entries |
| |
Methods defined here:
- __init__(self, mounted_only=0)
- If mounted_only is true, it will use the output from 'mount'
instead of the file /etc/fstab. This will give you a list of
currently mounted devices rather than the full list.
- __str__(self)
- Returns a list of all entries, similar to the default output of
'mount'
- get(self, **queries)
- Lets you query the table entries. For example:
get(filesystem='reiserfs') will return all devices of
type reiserfs
get(options='defaults', pass_number=0) will return all
devices with default options and a pass number of 0.
get() will return all entries.
Here are some examples from my box:
>>> fsi = FileSystemInfo(mounted_only=1)
>>> fsi.get()
[<TableEntry: /dev/hda1 on / (reiserfs with rw)>, <TableEntry: none on /dev/pts (devpts with rw,gid=5,mode=620)>, <TableEntry: none on /proc (proc with rw)>, <TableEntry: /dev/hde on /mnt/dvd (iso9660 with ro,nosuid,nodev)>, <TableEntry: /dev/scd0 on /mnt/cdr (iso9660 with ro,nosuid,nodev)>, <TableEntry: /dev/hdd on /mnt/vibes (iso9660 with ro,nosuid,nodev)>]
>>> fsi.get(filesystem='iso9660')
[<TableEntry: /dev/hde on /mnt/dvd (iso9660 with ro,nosuid,nodev)>, <TableEntry: /dev/scd0 on /mnt/cdr (iso9660 with ro,nosuid,nodev)>, <TableEntry: /dev/hdd on /mnt/vibes (iso9660 with ro,nosuid,nodev)>]
>>> fsi.get(mount_point='/mnt/cdr')
[<TableEntry: /dev/scd0 on /mnt/cdr (iso9660 with ro,nosuid,nodev)>]
- refresh(self)
- Refresh the entries from fstab or mount.
Data and non-method functions defined here:
- __doc__ = 'Represents a table of information about file system entries'
- __module__ = 'MtPython'
|
class TableEntry |
| |
A specific entry from fstab or mount |
| |
Methods defined here:
- __init__(self, spec, file, vfstype, mntopts, freq=0, passno=0)
- The parameters are described well in fstab(5). Mount options
are described in mount(8). I have created some more user
friendly aliases. Here are the attributes and their aliases:
spec device
file mount_path
vfstype filesystem
mntopts options
freq dump
passno pass_number
- __repr__(self)
- String representation of data, in standard repr style
- __str__(self)
- String representation of data
- get_options_dict(self)
- Returns a dictionary of options for this entry. If the option
is not in the form key=value, the entry will be set to {entry : 1}
unless the entry starts with 'no', in which case, the opposite of
will be set to 0:
gid=5,mode=620,ro,nosuid will turn into
{'gid' : 5, 'mode' : 620, 'ro' : 1, 'suid' : 0}
Data and non-method functions defined here:
- __doc__ = 'A specific entry from fstab or mount'
- __module__ = 'MtPython'
| |