def main(): import sys fs = ocfs2.Filesystem(sys.argv[1]) dentries = [] def walk(dentry, offset, blocksize): dentries.append(dentry) fs.dir_iterate(walk) try: dentry = dentries[int(sys.argv[2])] except (IndexError, ValueError): try: dentry = dentries[0] except IndexError: return dinode = fs.read_cached_inode(dentry.inode) for field_type in fields: field = field_type(dentry, dinode) print '%s: %s' % (field.label, field.text)
def __init__(self, device=None): VolumeLabel.__init__(self) try: fs = ocfs2.Filesystem(device) self.set_text(fs.fs_super.s_label) except ocfs2.error: pass
def get_ocfs2_id(device): try: fs = ocfs2.Filesystem(device) super = fs.fs_super label = super.s_label uuid = super.uuid_unparsed except ocfs2.error: label = uuid = None return (label, uuid)
def refresh(self): self.cleanup() self.store.clear() self.fs = None if self.device: try: self.fs = ocfs2.Filesystem(self.device) except ocfs2.error: self.make_error_node() if self.fs: self.add_level() else: self.make_empty_node()
def __init__(self, device=None): gtk.Table.__init__(self, rows=5, columns=2) set_props(self, row_spacing=4, column_spacing=4, border_width=4) fs = super = dinode = None if device: try: fs = ocfs2.Filesystem(device) super = fs.fs_super blkno = fs.lookup_system_inode( ocfs2.GLOBAL_BITMAP_SYSTEM_INODE) dinode = fs.read_cached_inode(blkno) except ocfs2.error: pass for row, field_type in enumerate(fields): field = field_type(fs, super, dinode) label = gtk.Label(field.label + ':') set_props(label, xalign=1.0) self.attach(label, 0, 1, row, row + 1, xoptions=gtk.FILL, yoptions=gtk.FILL) label = gtk.Label(field.text) set_props(label, xalign=0.0) self.attach(label, 1, 2, row, row + 1, xoptions=gtk.FILL, yoptions=gtk.FILL)
def __init__(self, device=None): NumSlots.__init__(self) fs = ocfs2.Filesystem(device) self.set_range(fs.fs_super.s_max_slots, ocfs2.MAX_SLOTS)