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_device for which to return the name. The value must be of type struct 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 device that is embedded in a struct gendisk back to the struct gendisk.

Parameters:dev – A struct device contained within a struct gendisk. The value must be of type struct 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 device that is embedded in a struct hd_struct back to the struct hd_struct.

Parameters:dev – A struct device embedded within a struct hd_struct. The value must be of type struct device.
Returns:The converted struct hd_struct. The value is of type struct 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_type that will be used to match and filter. Typically the values associated with the disk_type or part_type gdb.Symbol.

Yields:

gdb.Value – The next block device that matches the subtype. The value is of type struct gendisk or struct hd_struct.

Raises:
  • RuntimeError – An unknown device type was encountered during iteration.
  • TypeError – The provided subtype was not of struct device_type or struct 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 gendisk or struct hd_struct for which to return the name. The value must be of type struct gendisk or struct hd_struct.
Returns:The name of the block device
Return type:str
Raises:InvalidArgumentError – gendisk does not describe a struct gendisk or struct hd_struct
crash.subsystem.storage.gendisk_to_dev(gendisk: gdb.Value) → gdb.Value[source]

Converts a struct gendisk that embeds a struct device to the struct device.

Parameters:dev – A struct gendisk that embeds a struct device. The value must be of type struct device.
Returns:The converted struct device. The value is of type struct 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 inode for which to return the associated block device. The value must be of type struct inode.
Returns:The struct block_device associated with the provided struct inode. The value is of type struct 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 inode for which to return the associated block device. The value must be of type struct inode.
Returns:The struct block_device associated with the provided struct inode. The value is of type struct block_device.
Return type:gdb.Value
Raises:InvalidArgumentError – inode does not describe a block device
crash.subsystem.storage.is_bdev_inode(inode: gdb.Value) → bool[source]

Tests whether the provided struct inode describes a block device

This method evaluates the inode and returns True or False, depending on whether the inode describes a block device.

Parameters:bdev – The struct inode to test whether it describes a block device. The value must be of type struct inode.
Returns:True if the inode describes a block device, False otherwise.
Return type:bool
crash.subsystem.storage.part_to_dev(part: gdb.Value) → gdb.Value[source]

Converts a struct hd_struct that embeds a struct device to the struct device.

Parameters:dev – A struct hd_struct that embeds a struct device. The value must be of type struct device.
Returns:The converted struct device. The value is of type struct device.
Return type:gdb.Value