UDisksLinuxDriveObject

UDisksLinuxDriveObject — Object representing a drive on Linux

Synopsis

                    UDisksLinuxDriveObject;
UDisksLinuxDriveObject * udisks_linux_drive_object_new  (UDisksDaemon *daemon,
                                                         UDisksLinuxDevice *device);
void                udisks_linux_drive_object_uevent    (UDisksLinuxDriveObject *object,
                                                         const gchar *action,
                                                         UDisksLinuxDevice *device);
UDisksDaemon *      udisks_linux_drive_object_get_daemon
                                                        (UDisksLinuxDriveObject *object);
UDisksLinuxBlockObject * udisks_linux_drive_object_get_block
                                                        (UDisksLinuxDriveObject *object,
                                                         gboolean get_hw);
UDisksLinuxDevice * udisks_linux_drive_object_get_device
                                                        (UDisksLinuxDriveObject *object,
                                                         gboolean get_hw);
GList *             udisks_linux_drive_object_get_devices
                                                        (UDisksLinuxDriveObject *object);
GList *             udisks_linux_drive_object_get_siblings
                                                        (UDisksLinuxDriveObject *object);
gboolean            udisks_linux_drive_object_housekeeping
                                                        (UDisksLinuxDriveObject *object,
                                                         guint secs_since_last,
                                                         GCancellable *cancellable,
                                                         GError **error);
gboolean            udisks_linux_drive_object_is_not_in_use
                                                        (UDisksLinuxDriveObject *object,
                                                         GCancellable *cancellable,
                                                         GError **error);

Object Hierarchy

  GObject
   +----GDBusObjectSkeleton
         +----UDisksObjectSkeleton
               +----UDisksLinuxDriveObject

Implemented Interfaces

UDisksLinuxDriveObject implements GDBusObject and UDisksObject.

Properties

  "daemon"                   UDisksDaemon*         : Read / Write / Construct Only
  "device"                   UDisksLinuxDevice*    : Write / Construct Only

Description

Object corresponding to a drive on Linux.

Details

UDisksLinuxDriveObject

typedef struct _UDisksLinuxDriveObject UDisksLinuxDriveObject;

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


udisks_linux_drive_object_new ()

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

Create a new drive object.

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.

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.

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.

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.

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.

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.

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.

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.

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.

Property Details

The "daemon" property

  "daemon"                   UDisksDaemon*         : Read / Write / Construct Only

The UDisksDaemon the object is for.


The "device" property

  "device"                   UDisksLinuxDevice*    : Write / Construct Only

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