UDisksLinuxDriveObject: UDisks Reference Manual

## UDisksLinuxDriveObject UDisksLinuxDriveObject — Object representing a drive on Linux |

## Functions

UDisksLinuxDriveObject * | udisks_linux_drive_object_new ()
void | udisks_linux_drive_object_uevent ()
UDisksDaemon * | udisks_linux_drive_object_get_daemon ()
UDisksLinuxBlockObject * | udisks_linux_drive_object_get_block ()
UDisksLinuxDevice * | udisks_linux_drive_object_get_device ()
GList * | udisks_linux_drive_object_get_devices ()
GList * | udisks_linux_drive_object_get_siblings ()
gboolean | udisks_linux_drive_object_housekeeping ()
gboolean | udisks_linux_drive_object_is_not_in_use ()

## Properties

UDisksDaemon * | daemon | Read / Write / Construct Only
UDisksLinuxDevice * | device | Write / Construct Only

## Types and Values

| UDisksLinuxDriveObject

## Object Hierarchy

        GObject
        ╰── GDBusObjectSkeleton
            ╰── UDisksObjectSkeleton
                ╰── UDisksLinuxDriveObject

## Implemented Interfaces

UDisksLinuxDriveObject implements GDBusObject and UDisksObject.

## Description

Object corresponding to a drive on Linux.

## Functions

### udisks_linux_drive_object_new ()

    UDisksLinuxDriveObject *
    udisks_linux_drive_object_new (UDisksDaemon *daemon,
                                   UDisksLinuxDevice *device);

Create a new drive object.

#### Parameters

daemon | A UDisksDaemon. |
device | The UDisksLinuxDevice for the sysfs block device. |

#### Returns

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

### udisks_linux_drive_object_uevent ()

    void
    udisks_linux_drive_object_uevent (UDisksLinuxDriveObject *object,
                                      const gchar *action,
                                      UDisksLinuxDevice *device);

Updates all information on interfaces on `drive` .

#### Parameters

object | A UDisksLinuxDriveObject. |
action | Uevent action or `NULL` |
device | A UDisksLinuxDevice device object or `NULL` if the device hasn't changed. |

### udisks_linux_drive_object_get_daemon ()

    UDisksDaemon *
    udisks_linux_drive_object_get_daemon (UDisksLinuxDriveObject *object);

Gets the daemon used by `object` .

#### Parameters

object | A UDisksLinuxDriveObject. |

#### Returns

A UDisksDaemon. Do not free, the object is owned by `object` .

### udisks_linux_drive_object_get_block ()

    UDisksLinuxBlockObject *
    udisks_linux_drive_object_get_block (UDisksLinuxDriveObject *object,
                                         gboolean get_hw);

Gets a UDisksLinuxBlockObject representing a block device associated with `object` .

#### Parameters

object | A UDisksLinuxDriveObject. |
get_hw | If the drive is multipath, set to `TRUE` to get a path device instead of the multipath device. |

#### Returns

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

### udisks_linux_drive_object_get_device ()

    UDisksLinuxDevice *
    udisks_linux_drive_object_get_device (UDisksLinuxDriveObject *object,
                                          gboolean get_hw);

Gets one of the UDisksLinuxDevice 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 UDisksLinuxDriveObject. |
get_hw | If the drive is multipath, set to `TRUE` to get a path device instead of the multipath device. |

#### Returns

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

### udisks_linux_drive_object_get_devices ()

    GList *
    udisks_linux_drive_object_get_devices (UDisksLinuxDriveObject *object);

Gets the current UDisksLinuxDevice objects associated with `object` .

#### Parameters

object | A UDisksLinuxDriveObject. |

#### Returns

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

### udisks_linux_drive_object_get_siblings ()

    GList *
    udisks_linux_drive_object_get_siblings
                                   (UDisksLinuxDriveObject *object);

Gets the siblings for `object` , if any.

#### Parameters

object | A UDisksLinuxDriveObject. |

#### Returns

A list of UDisksLinuxDriveObject 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 UDisksLinuxDriveObject]

### udisks_linux_drive_object_housekeeping ()

    gboolean
    udisks_linux_drive_object_housekeeping
                                   (UDisksLinuxDriveObject *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 UDisksLinuxDriveObject. |
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.

### udisks_linux_drive_object_is_not_in_use ()

    gboolean
    udisks_linux_drive_object_is_not_in_use
                                   (UDisksLinuxDriveObject *object,
                                    GCancellable *cancellable,
                                    GError **error);

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

#### Parameters

object | A UDisksLinuxDriveObject. |
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

### UDisksLinuxDriveObject

    typedef struct _UDisksLinuxDriveObject UDisksLinuxDriveObject;

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

## Property Details

### The `“daemon”` property

      “daemon”                   UDisksDaemon *

The UDisksDaemon the object is for.

Owner: UDisksLinuxDriveObject

Flags: Read / Write / Construct Only

### The `“device”` property

      “device”                   UDisksLinuxDevice *

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

Owner: UDisksLinuxDriveObject

Flags: Write / Construct Only