Пример #1
0
 def interpret(self) -> None:
     """Interprets a direct i/o bio to populate its attributes"""
     # pylint: disable=attribute-defined-outside-init
     self.dio = self.bio['bi_private'].cast(self._types.dio_p_type)
     self.fstype = super_fstype(self.dio['inode']['i_sb'])
     self.dev = block_device_name(self.dio['inode']['i_sb']['s_bdev'])
     self.offset = self.dio['block_in_file'] << self.dio['blkbits']
Пример #2
0
 def test_inode_on_bdev_fs_inode(self):
     bdev_sb = self.get_blockdev_superblock()
     inode = self.get_filesystem_inode()
     self.assertTrue(type(inode) is gdb.Value)
     self.assertTrue(inode.type == self.inode_type)
     bdev = storage.inode_on_bdev(inode)
     self.assertTrue(type(bdev) is gdb.Value)
     self.assertTrue(bdev.type == self.block_device_type)
     self.assertFalse(inode['i_sb'] == bdev_sb)
     self.assertFalse(fs.super_fstype(inode['i_sb']) == "bdev")
Пример #3
0
def mount_fstype(mnt: gdb.Value) -> str:
    """
    Returns the file system type of the mount

    Args:
        mnt: The :ref:`mount structure <mount_structure>` for which to
            return the file system type

    Returns:
        :obj:`str`: The file system type of the mount in string form
    """
    return super_fstype(mount_super(mnt))
Пример #4
0
 def list_btrfs(self, args: argparse.Namespace) -> None:
     print_header = True
     count = 0
     for sb in for_each_super_block():
         if super_fstype(sb) == "btrfs":
             if args.m:
                 u = btrfs_metadata_uuid(sb)
                 which_fsid = "METADATA UUID"
             else:
                 u = btrfs_fsid(sb)
                 which_fsid = "FSID"
             if print_header:
                 print("SUPER BLOCK\t\tDEVICE\t\t{}".format(which_fsid))
                 print_header = False
             print("{}\t{}\t\t{}".format(sb.address, sb['s_id'].string(),
                                         u))
             count += 1
     if count == 0:
         print("No btrfs file systems were mounted.")
Пример #5
0
 def mount_fstype(cls, mnt):
     return super_fstype(cls.mount_super(mnt))
Пример #6
0
    def get_filesystem_inode(self):
        for sb in fs.for_each_super_block():
            if fs.super_fstype(sb) != "bdev":
                return sb['s_root']['d_inode'].dereference()

        raise RuntimeError("No file system supers?")
Пример #7
0
 def interpret(self) -> None:
     """Interpret the multipage bio to populate its attributes"""
     # pylint: disable=attribute-defined-outside-init
     self.inode = self.bio['bi_io_vec'][0]['bv_page']['mapping']['host']
     self.fstype = super_fstype(self.inode['i_sb'])
Пример #8
0
 def mount_fstype(cls, mnt):
     return super_fstype(cls.mount_super(mnt))