crash.subsystem.filesystem.xfs module

The crash.subsystem.filesystem.xfs module offers helpers to work with XFS file systems.

class crash.subsystem.filesystem.xfs.XFS[source]

Bases: object

XFS File system state class. Not meant to be instantiated directly.

classmethod detect_ail_version(gdbtype: gdb.Type) → None[source]

Detect what version of the ail structure is in use

Linux v4.17 renamed the xfs_ail members to use ail_* instead of xa_* except for xa_ail which was renamed to ail_head.

Meant to be used as a TypeCallback.

Parameters:gdbtype – The struct xfs_ail type.
classmethod get_ail_head(ail: gdb.Value) → gdb.Value[source]
class crash.subsystem.filesystem.xfs.XFSBufBioDecoder(bio: gdb.Value)[source]

Bases: crash.subsystem.storage.decoders.Decoder

Decodes a bio with an xfsbuf ->bi_end_io

Parameters:bio – The struct bio to decode. The value must be of type struct bio.
xfsbuf

The xfsbuf structure. It is of type struct xfs_buf *.

Type:gdb.Value
devname

The string representation of the device name

Type:str
interpret() → None[source]

Interpret the xfsbuf bio to populate its attributes

class crash.subsystem.filesystem.xfs.XFSBufDecoder(xfsbuf: gdb.Value)[source]

Bases: crash.subsystem.storage.decoders.Decoder

Decodes a struct xfs_buf into human-readable form

crash.subsystem.filesystem.xfs.is_xfs_inode(vfs_inode: gdb.Value) → bool[source]

Tests whether a generic struct inode belongs to XFS

Parameters:vfs_inode – The struct inode to test whether it belongs to XFS. The value must be of type struct inode.
Returns:Whether the inode belongs to XFS
Return type:bool
Raises:gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.is_xfs_super(super_block: gdb.Value) → bool[source]

Tests whether a struct super_block belongs to XFS.

Parameters:super_block – The struct super_block to test. The value must be of type struct super_block.
Returns:Whether the super_block belongs to XFS
Return type:bool
Raises:gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.item_to_buf_log_item(item: gdb.Value) → gdb.Value[source]

Converts an xfs_log_item to an xfs_buf_log_item

Parameters:

item – The log item to convert. The value must be of type struct xfs_log_item.

Returns:

The converted log item. The value will be of type struct xfs_buf_log_item.

Return type:

gdb.Value

Raises:
  • InvalidArgumentError – The type of log item is not XFS_LI_BUF
  • gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.item_to_dquot_log_item(item: gdb.Value) → gdb.Value[source]

Converts an xfs_log_item to an xfs_dquot_log_item

Parameters:

item – The log item to convert. The value must of of type struct xfs_log_item.

Returns:

The converted log item. The value will be of type struct xfs_dquot_log_item.

Return type:

gdb.Value

Raises:
  • InvalidArgumentError – The type of log item is not XFS_LI_DQUOT
  • gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.item_to_efd_log_item(item: gdb.Value) → gdb.Value[source]

Converts an xfs_log_item to an xfs_efd_log_item

Parameters:
  • item – The log item to convert. The value must of of type
  • xfs_log_item. (struct) –
Returns:

The converted log item. The value will be of type struct xfs_efd_log_item.

Return type:

gdb.Value

Raises:
  • InvalidArgumentError – The type of log item is not XFS_LI_EFD
  • gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.item_to_efi_log_item(item: gdb.Value) → gdb.Value[source]

Converts an xfs_log_item to an xfs_efi_log_item

Parameters:

item – The log item to convert. The value must of of type struct xfs_log_item.

Returns:

The converted log item. The value will be of type struct xfs_efi_log_item.

Return type:

gdb.Value

Raises:
  • InvalidArgumentError – The type of log item is not XFS_LI_EFI
  • gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.item_to_inode_log_item(item: gdb.Value) → gdb.Value[source]

Converts an xfs_log_item to an xfs_inode_log_item

Parameters:

item – The log item to convert. The value must of of type struct xfs_log_item.

Returns:

The converted log item. The value will be of type struct xfs_inode_log_item.

Return type:

gdb.Value

Raises:
  • InvalidArgumentError – The type of log item is not XFS_LI_INODE
  • gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.item_to_quotaoff_log_item(item: gdb.Value) → gdb.Value[source]

Converts an xfs_log_item to an xfs_quotaoff_log_item

Parameters:

item – The log item to convert. The value must be of type struct xfs_log_item.

Returns:

The converted log item. The value will be of type struct xfs_quotaoff_log_item

Return type:

gdb.Value

Raises:
  • InvalidArgumentError – The type of log item is not XFS_LI_QUOTAOFF
  • gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.xfs_for_each_ail_entry(ail: gdb.Value) → Iterable[gdb.Value][source]

Iterates over the XFS Active Item Log and returns each item

Parameters:ail – The XFS AIL to iterate. The value must be of type struct xfs_ail.
Yields:gdb.Value – A log item from the AIL. Each value will be of type struct xfs_log_item.
Raises:gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.xfs_for_each_ail_log_item(mp: gdb.Value) → Iterable[gdb.Value][source]

Iterates over the XFS Active Item Log and returns each item

Parameters:mp – The XFS mount to iterate. The value must be of type struct xfs_mount.
Yields:gdb.Value – A log item from AIL owned by this mount. The value will be of type struct xfs_log_item.
Raises:gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.xfs_for_each_ail_log_item_typed(mp: gdb.Value) → Iterable[gdb.Value][source]

Iterates over the XFS Active Item Log and returns each item, resolved to the specific type.

Parameters:

mp – The XFS mount to iterate. The value must be of type struct xfs_mount.

Yields:

gdb.Value – Depending on type, the value will be any of the following types:

  • struct xfs_buf_log_item_type
  • struct xfs_inode_log_item_type
  • struct xfs_efi_log_item_type
  • struct xfs_efd_log_item_type
  • struct xfs_dq_logitem
  • int (for UNLINK item)
Raises:

gdb.NotAvailableError – The target value was not available.

crash.subsystem.filesystem.xfs.xfs_format_xfsbuf(buf: gdb.Value) → str[source]

Returns a human-readable format of struct xfs_buf

Parameters:buf – The struct xfs_buf to decode. The value must be of type struct xfs_buf.
Returns:
The human-readable representation of the
struct xfs_buf.
Return type:str
Raises:gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.xfs_inode(vfs_inode: gdb.Value, force: bool = False) → gdb.Value[source]

Converts a VFS inode to a xfs inode

This method converts a struct inode to a struct xfs_inode.

Parameters:
  • vfs_inode – The struct inode to convert to a struct xfs_inode The value must be of type struct inode.
  • force – ignore type checking
Returns:

The converted struct xfs_inode. The value will be of type struct xfs_inode.

Return type:

gdb.Value

Raises:
  • TypeError – The inode does not belong to xfs
  • gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.xfs_log_item_typed(item: gdb.Value) → gdb.Value[source]

Returns the log item converted from the generic type to the actual type

Parameters:

item – The struct xfs_log_item to convert. The value must be of type struct xfs_log_item.

Returns:

Depending on type, the value will be any of the following types:

  • struct xfs_buf_log_item_type
  • struct xfs_inode_log_item_type
  • struct xfs_efi_log_item_type
  • struct xfs_efd_log_item_type
  • struct xfs_dq_logitem
  • int (for XFS_LI_IUNLINK item)

Return type:

gdb.Value

Raises:
  • RuntimeError – An unexpected item type was encountered
  • gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.xfs_mount(sb: gdb.Value, force: bool = False) → gdb.Value[source]

Converts a VFS superblock to a xfs mount

This method converts a struct super_block to a struct xfs_mount *

Parameters:

super_block – The struct super_block to convert to a struct xfs_fs_info. The value must be of type struct super_block.

Returns:

The converted struct xfs_mount. The value will be of type struct xfs_mount *.

Return type:

gdb.Value

Raises:
  • InvalidArgumentError – The struct super_block does not belong to xfs
  • gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.xfs_mount_flags(mp: gdb.Value) → str[source]

Return the XFS-internal mount flags in string form

Parameters:mp – The struct xfs_mount for the file system. The value must be of type struct xfs_mount.
Returns:The mount flags in string form
Return type:str
Raises:gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.xfs_mount_uuid(mp: gdb.Value) → uuid.UUID[source]

Return the UUID for an XFS file system in string form

Parameters:mp – The struct xfs_mount for the file system. The value must be of type struct xfs_mount.
Returns:The Python UUID object that describes the xfs UUID
Return type:uuid.UUID
Raises:gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.xfs.xfs_mount_version(mp: gdb.Value) → int[source]