UDisksLinuxDevice

UDisksLinuxDevice — Low-level devices on Linux

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── UDisksLinuxDevice

Description

Types and functions used to record information obtained from the udev database as well as by probing the device.

Functions

udisks_linux_device_new_sync ()

UDisksLinuxDevice *
udisks_linux_device_new_sync (GUdevDevice *udev_device,
                              GUdevClient *udev_client);

Creates a new UDisksLinuxDevice from udev_device which includes probing the device for more information, if applicable.

The calling thread may be blocked for a non-trivial amount of time while the probing is underway.

Parameters

udev_device

A GUdevDevice.

 

udev_client

A GUdevClient.

 

Returns

A UDisksLinuxDevice.


udisks_linux_device_reprobe_sync ()

gboolean
udisks_linux_device_reprobe_sync (UDisksLinuxDevice *device,
                                  GUdevClient *udev_client,
                                  GCancellable *cancellable,
                                  GError **error);

Forcibly reprobe information on device . The calling thread may be blocked for a non-trivial amount of time while the probing is underway.

Probing is dm-multipath aware in which case an active path is looked up and udev attributes are fetched from there.

Parameters

device

A UDisksLinuxDevice.

 

udev_client

A GUdevClient.

 

cancellable

A GCancellable or NULL.

[allow-none]

error

Return location for error or NULL.

 

Returns

TRUE if reprobing succeeded, FALSE otherwise.


udisks_linux_device_read_sysfs_attr ()

gchar *
udisks_linux_device_read_sysfs_attr (UDisksLinuxDevice *device,
                                     const gchar *attr,
                                     GError **error);

Read a sysfs attribute within the device sysfs hierarchy. The attr can be a path relative to the device base sysfs path.

Parameters

device

A UDisksLinuxDevice.

 

attr

Attribute name (a path).

 

error

Return location for error or NULL.

 

Returns

Attribute contents or NULL if unavailable. Free with g_free().

[transfer full]


udisks_linux_device_read_sysfs_attr_as_int ()

gint
udisks_linux_device_read_sysfs_attr_as_int
                               (UDisksLinuxDevice *device,
                                const gchar *attr,
                                GError **error);

Read a sysfs attribute within the device sysfs hierarchy. The attr can be a path relative to the device base sysfs path.

Parameters

device

A UDisksLinuxDevice.

 

attr

Attribute name (a path).

 

error

Return location for error or NULL.

 

Returns

Numerical attribute value or 0 on error.


udisks_linux_device_read_sysfs_attr_as_uint64 ()

guint64
udisks_linux_device_read_sysfs_attr_as_uint64
                               (UDisksLinuxDevice *device,
                                const gchar *attr,
                                GError **error);

Read a sysfs attribute within the device sysfs hierarchy. The attr can be a path relative to the device base sysfs path.

Parameters

device

A UDisksLinuxDevice.

 

attr

Attribute name (a path).

 

error

Return location for error or NULL.

 

Returns

Numerical attribute value or 0 on error.


udisks_linux_device_subsystem_is_nvme ()

gboolean
udisks_linux_device_subsystem_is_nvme (UDisksLinuxDevice *device);

Walks up the device hierarchy and checks if device is part of a NVMe topology.

Parameters

device

A UDisksLinuxDevice.

 

Returns

TRUE in case of a NVMe device, FALSE otherwise.


udisks_linux_device_nvme_is_fabrics ()

gboolean
udisks_linux_device_nvme_is_fabrics (UDisksLinuxDevice *device);

Determines whether device is a NVMe over Fabrics device.

Parameters

device

A UDisksLinuxDevice.

 

Returns

TRUE in case of a NVMeoF device, FALSE otherwise.


udisks_linux_device_is_dm_multipath ()

gboolean
udisks_linux_device_is_dm_multipath (UDisksLinuxDevice *device);

Parameters

device

A UDisksLinuxDevice.

 

Returns

TRUE if device represents a dm-multipath block device, FALSE otherwise.


udisks_linux_device_is_mpath_device_path ()

gboolean
udisks_linux_device_is_mpath_device_path
                               (UDisksLinuxDevice *device);

Parameters

device

A UDisksLinuxDevice.

 

Returns

TRUE if device is an I/O path that is part of a dm-multipath device, FALSE otherwise.

Types and Values

UDisksLinuxDevice

typedef struct {
  GUdevDevice *udev_device;
  guchar *ata_identify_device_data;
  guchar *ata_identify_packet_device_data;
  BDNVMEControllerInfo *nvme_ctrl_info;
  BDNVMENamespaceInfo *nvme_ns_info;
} UDisksLinuxDevice;

Object containing information about a device on Linux. This is essentially an instance of GUdevDevice plus additional data - such as ATA IDENTIFY data - obtained via probing the device at discovery and uevent "change" time.

Members

GUdevDevice *udev_device;

A GUdevDevice.

 

guchar *ata_identify_device_data;

512-byte array containing the result of the IDENTIFY DEVICE command or NULL.

 

guchar *ata_identify_packet_device_data;

512-byte array containing the result of the IDENTIFY PACKET DEVICE command or NULL.

 

BDNVMEControllerInfo *nvme_ctrl_info;

A BDNVMEControllerInfo data in case of a NVMe Controller.

 

BDNVMENamespaceInfo *nvme_ns_info;

A BDNVMENamespaceInfo data in case of a NVMe Namespace.