StoragedLinuxDriveObject

StoragedLinuxDriveObject — Object representing a drive on Linux

Functions

Properties

StoragedDaemon * daemon Read / Write / Construct Only
StoragedLinuxDevice * device Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── GDBusObjectSkeleton
        ╰── StoragedObjectSkeleton
            ╰── StoragedLinuxDriveObject

Implemented Interfaces

StoragedLinuxDriveObject implements GDBusObject and StoragedObject.

Description

Object corresponding to a drive on Linux.

Functions

storaged_linux_drive_object_new ()

StoragedLinuxDriveObject *
storaged_linux_drive_object_new (StoragedDaemon *daemon,
                                 StoragedLinuxDevice *device);

Create a new drive object.

Parameters

daemon

A StoragedDaemon.

 

device

The StoragedLinuxDevice for the sysfs block device.

 

Returns

A StoragedLinuxDriveObject object or NULL if device does not represent a drive. Free with g_object_unref().


storaged_linux_drive_object_uevent ()

void
storaged_linux_drive_object_uevent (StoragedLinuxDriveObject *object,
                                    const gchar *action,
                                    StoragedLinuxDevice *device);

Updates all information on interfaces on drive .

Parameters

object

A StoragedLinuxDriveObject.

 

action

Uevent action or NULL

 

device

A StoragedLinuxDevice device object or NULL if the device hasn't changed.

 

storaged_linux_drive_object_get_daemon ()

StoragedDaemon *
storaged_linux_drive_object_get_daemon
                               (StoragedLinuxDriveObject *object);

Gets the daemon used by object .

Parameters

Returns

A StoragedDaemon. Do not free, the object is owned by object .


storaged_linux_drive_object_get_block ()

StoragedLinuxBlockObject *
storaged_linux_drive_object_get_block (StoragedLinuxDriveObject *object,
                                       gboolean get_hw);

Gets a StoragedLinuxBlockObject representing a block device associated with object .

Parameters

object

A StoragedLinuxDriveObject.

 

get_hw

If the drive is multipath, set to TRUE to get a path device instead of the multipath device.

 

Returns

A StoragedLinuxBlockObject or NULL. The returned object must be freed with g_object_unref().


storaged_linux_drive_object_get_device ()

StoragedLinuxDevice *
storaged_linux_drive_object_get_device
                               (StoragedLinuxDriveObject *object,
                                gboolean get_hw);

Gets one of the StoragedLinuxDevice object associated with object .

If get_hw is TRUE and object represents a multipath device then one of the paths is returned rather than the multipath device. This is useful if you e.g. need to configure the physical hardware.

Parameters

object

A StoragedLinuxDriveObject.

 

get_hw

If the drive is multipath, set to TRUE to get a path device instead of the multipath device.

 

Returns

A StoragedLinuxDevice or NULL. The returned object must be freed with g_object_unref().


storaged_linux_drive_object_get_devices ()

GList *
storaged_linux_drive_object_get_devices
                               (StoragedLinuxDriveObject *object);

Gets the current StoragedLinuxDevice objects associated with object .

Parameters

Returns

A list of StoragedLinuxDevice objects. Free each element with g_object_unref(), then free the list with g_list_free().


storaged_linux_drive_object_get_siblings ()

GList *
storaged_linux_drive_object_get_siblings
                               (StoragedLinuxDriveObject *object);

Gets the siblings for object , if any.

Parameters

Returns

A list of StoragedLinuxDriveObject instances. The returned list should be freed with g_list_free() after each element has been freed with g_object_unref().

[transfer full][element-type StoragedLinuxDriveObject]


storaged_linux_drive_object_housekeeping ()

gboolean
storaged_linux_drive_object_housekeeping
                               (StoragedLinuxDriveObject *object,
                                guint secs_since_last,
                                GCancellable *cancellable,
                                GError **error);

Called periodically (every ten minutes or so) to perform housekeeping tasks such as refreshing ATA SMART data.

The function runs in a dedicated thread and is allowed to perform blocking I/O.

Long-running tasks should periodically check cancellable to see if they have been cancelled.

Parameters

object

A StoragedLinuxDriveObject.

 

secs_since_last

Number of seconds sincex the last housekeeping or 0 if the first housekeeping ever.

 

cancellable

A GCancellable or NULL.

 

error

Return location for error or NULL.

 

Returns

TRUE if the operation succeeded, FALSE if error is set.


storaged_linux_drive_object_is_not_in_use ()

gboolean
storaged_linux_drive_object_is_not_in_use
                               (StoragedLinuxDriveObject *object,
                                GCancellable *cancellable,
                                GError **error);

Checks if the drive represented by object is in use and sets error if so.

Parameters

object

A StoragedLinuxDriveObject.

 

cancellable

A GCancellable or NULL.

[allow-none]

error

A GError or NULL.

 

Returns

TRUE if object is not is use, FALSE if error is set.

Types and Values

StoragedLinuxDriveObject

typedef struct _StoragedLinuxDriveObject StoragedLinuxDriveObject;

The StoragedLinuxDriveObject structure contains only private data and should only be accessed using the provided API.

Property Details

The “daemon” property

  “daemon”                   StoragedDaemon *

The StoragedDaemon the object is for.

Flags: Read / Write / Construct Only


The “device” property

  “device”                   StoragedLinuxDevice *

The StoragedLinuxDevice for the object. Connect to the “notify” signal to get notified whenever this is updated.

Flags: Write / Construct Only