crash.subsystem.storage package¶
-
crash.subsystem.storage.block_device_name(bdev: gdb.Value) → str[source]¶ Returns the name of the provided block device.
This method evaluates the block device and returns the name, including partition number, if applicable.
Parameters: bdev – A struct block_devicefor which to return the name. The value must be of typestruct block_device.Returns: The name of the block device Return type: str
-
crash.subsystem.storage.dev_to_gendisk(dev: gdb.Value) → gdb.Value[source]¶ Converts a
struct devicethat is embedded in astruct gendiskback to thestruct gendisk.Parameters: dev – A struct devicecontained within astruct gendisk. The value must be of typestruct device.Returns: The converted gendisk. The value is of type struct gendisk.Return type: gdb.Value
-
crash.subsystem.storage.dev_to_part(dev: gdb.Value) → gdb.Value[source]¶ Converts a
struct devicethat is embedded in astruct hd_structback to thestruct hd_struct.Parameters: dev – A struct deviceembedded within astruct hd_struct. The value must be of typestruct device.Returns: The converted struct hd_struct. The value is of typestruct hd_struct.Return type: gdb.Value
-
crash.subsystem.storage.for_each_block_device(subtype: gdb.Value = None) → Iterable[gdb.Value][source]¶ Iterates over each block device registered with the block class.
This method iterates over the block_class klist and yields every member found. The members are either struct gendisk or struct hd_struct, depending on whether it describes an entire disk or a partition, respectively.
The members can be filtered by providing a subtype, which corresponds to a the the type field of the struct device.
Parameters: subtype (optional) – The
struct device_typethat will be used to match and filter. Typically the values associated with thedisk_typeorpart_typegdb.Symbol.Yields: gdb.Value– The next block device that matches the subtype. The value is of typestruct gendiskorstruct hd_struct.Raises: RuntimeError– An unknown device type was encountered during iteration.TypeError– The provided subtype was not ofstruct device_typeorstruct device type *
-
crash.subsystem.storage.for_each_disk() → Iterable[gdb.Value][source]¶ Iterates over each block device registered with the block class that corresponds to an entire disk.
This is an alias for for_each_block_device(
disk_type)
-
crash.subsystem.storage.gendisk_name(gendisk: gdb.Value) → str[source]¶ Returns the name of the provided block device.
This method evaluates the block device and returns the name, including partition number, if applicable.
Parameters: gendisk – A struct gendiskorstruct hd_structfor which to return the name. The value must be of typestruct gendiskorstruct hd_struct.Returns: The name of the block device Return type: strRaises: InvalidArgumentError– gendisk does not describe astruct gendiskorstruct hd_struct
-
crash.subsystem.storage.gendisk_to_dev(gendisk: gdb.Value) → gdb.Value[source]¶ Converts a
struct gendiskthat embeds astruct deviceto thestruct device.Parameters: dev – A struct gendiskthat embeds astruct device. The value must be of typestruct device.Returns: The converted struct device. The value is of typestruct device.Return type: gdb.Value
-
crash.subsystem.storage.inode_on_bdev(inode: gdb.Value) → gdb.Value[source]¶ Returns the block device associated with this inode.
If the inode describes a block device, return that block device. Otherwise, return the block device, if any, associated with the inode’s super block.
Parameters: inode – The struct inodefor which to return the associated block device. The value must be of typestruct inode.Returns: The struct block_deviceassociated with the providedstruct inode. The value is of typestruct inode.Return type: gdb.Value
-
crash.subsystem.storage.inode_to_block_device(inode: gdb.Value) → gdb.Value[source]¶ Returns the block device associated with this inode.
If the inode describes a block device, return that block device. Otherwise, raise InvalidArgumentError.
Parameters: inode – The struct inodefor which to return the associated block device. The value must be of typestruct inode.Returns: The struct block_deviceassociated with the providedstruct inode. The value is of typestruct block_device.Return type: gdb.ValueRaises: InvalidArgumentError– inode does not describe a block device
-
crash.subsystem.storage.is_bdev_inode(inode: gdb.Value) → bool[source]¶ Tests whether the provided
struct inodedescribes a block deviceThis method evaluates the inode and returns
TrueorFalse, depending on whether the inode describes a block device.Parameters: bdev – The struct inodeto test whether it describes a block device. The value must be of typestruct inode.Returns: Trueif the inode describes a block device,Falseotherwise.Return type: bool
-
crash.subsystem.storage.part_to_dev(part: gdb.Value) → gdb.Value[source]¶ Converts a
struct hd_structthat embeds astruct deviceto thestruct device.Parameters: dev – A struct hd_structthat embeds astruct device. The value must be of typestruct device.Returns: The converted struct device. The value is of typestruct device.Return type: gdb.Value