![]() |
![]() |
![]() |
Disk Utility Library Reference Manual | ![]() |
---|---|---|---|---|
struct GduActivatableDrive; enum GduActivableDriveKind; enum GduActivableDriveSlaveState; gboolean gdu_activatable_drive_has_slave (GduActivatableDrive *activatable_drive, GduDevice *device); GList* gdu_activatable_drive_get_slaves (GduActivatableDrive *activatable_drive); GduDevice* gdu_activatable_drive_get_first_slave (GduActivatableDrive *activatable_drive); int gdu_activatable_drive_get_num_slaves (GduActivatableDrive *activatable_drive); int gdu_activatable_drive_get_num_ready_slaves (GduActivatableDrive *activatable_drive); GduActivableDriveKind gdu_activatable_drive_get_kind (GduActivatableDrive *activatable_drive); gboolean gdu_activatable_drive_is_activated (GduActivatableDrive *activatable_drive); gboolean gdu_activatable_drive_can_activate (GduActivatableDrive *activatable_drive); gboolean gdu_activatable_drive_can_activate_degraded (GduActivatableDrive *activatable_drive); void gdu_activatable_drive_activate (GduActivatableDrive *activatable_drive, GduActivatableDriveActivationFunc callback, gpointer user_data); void gdu_activatable_drive_deactivate (GduActivatableDrive *activatable_drive, GduActivatableDriveDeactivationFunc callback, gpointer user_data); GduActivableDriveSlaveState gdu_activatable_drive_get_slave_state (GduActivatableDrive *activatable_drive, GduDevice *slave);
The GduActivatableDrive class represents drives that are built from one or more underlying block devices. This includes things like RAID arrays and LVM devices.
An activatable drive is typically added to GduPool as soon as a
component device that is part of the abstraction is available. The
drive can be started (gdu_activatable_drive_activate()
) and stopped
(gdu_activatable_drive_deactivate()
) and one can query the state
of the underlying components (gdu_activatable_drive_get_slave_state()
).
See the documentation for GduPresentable for the big picture.
typedef enum { GDU_ACTIVATABLE_DRIVE_KIND_LINUX_MD, } GduActivableDriveKind;
The type of activatable drive.
typedef enum { GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_RUNNING, GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_RUNNING_SYNCING, GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_RUNNING_HOT_SPARE, GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_READY, GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_NOT_FRESH, } GduActivableDriveSlaveState;
State for slaves of an activatable drive.
The drive is activated and the slave is part of it. | |
The drive is activated and the slave is part of the array but is in the process of being synced into the array (e.g. it was recently added). | |
The drive is activated and the slave is a hot spare ready to kick in if a drive fails. | |
The drive is not activated and the slave, compared to other slaves, is a valid member of the array. | |
Either the drive is not activated but the slave, compared to other slaves, is not valid since other slaves have higher event numbers / more recent usage dates / etc. Otherwise, if the drive is activated, slaves with this type have valid meta-data (e.g. uuid) but is not part of the array (typically happens if the wire connecting the slave was temporarily disconnected). |
gboolean gdu_activatable_drive_has_slave (GduActivatableDrive *activatable_drive, GduDevice *device);
Checks if device
is a component of activatable_drive
.
|
A GduActivatableDrive. |
|
A GduDevice. |
Returns : |
TRUE only if slave is a component of activatable_drive .
|
GList* gdu_activatable_drive_get_slaves (GduActivatableDrive *activatable_drive);
Gets all slaves of activatable_drive
.
|
A GduActivatableDrive. |
Returns : |
A GList of GduDevice objects. Caller must free this list (and call g_object_unref() on all elements).
|
GduDevice* gdu_activatable_drive_get_first_slave (GduActivatableDrive *activatable_drive);
Gets the first slave of activatable_drive
.
|
A GduActivatableDrive. |
Returns : |
A GduDevice or NULL if there are no slaves. Caller must free this object with g_object_unref() .
|
int gdu_activatable_drive_get_num_slaves (GduActivatableDrive *activatable_drive);
Gets the total number of slaves of activatable_drive
.
|
A GduActivatableDrive. |
Returns : |
The number of slaves of activatable_drive .
|
int gdu_activatable_drive_get_num_ready_slaves (GduActivatableDrive *activatable_drive);
Gets the number of fresh/ready (See
GDU_ACTIVATABLE_DRIVE_SLAVE_STATE_READY) slaves of
activatable_drive
.
|
A GduActivatableDrive. |
Returns : |
The number of fresh/ready slaves of activatable_drive .
|
GduActivableDriveKind gdu_activatable_drive_get_kind (GduActivatableDrive *activatable_drive);
Gets the type of activatable drive.
|
A GduActivatableDrive. |
Returns : |
A value from the GduActivatableKind enumeration. |
gboolean gdu_activatable_drive_is_activated (GduActivatableDrive *activatable_drive);
Checks if activatable_drive
is already activated.
|
A GduActivatableDrive. |
Returns : |
TRUE only if activatable_drive is activated.
|
gboolean gdu_activatable_drive_can_activate (GduActivatableDrive *activatable_drive);
Check if activatable_drive
can be activated in non-degraded
mode. See also gdu_activatable_drive_can_activate_degraded()
.
|
A GduActivatableDrive. |
Returns : |
TRUE only if it can be activated. If activatable_drive
is already activated this function returns FALSE.
|
gboolean gdu_activatable_drive_can_activate_degraded (GduActivatableDrive *activatable_drive);
Check if activatable_drive
can be activated in degraded mode. See
also gdu_activatable_drive_can_activate()
.
|
A GduActivatableDrive. |
Returns : |
TRUE only if it can be activated in degraded mode. If
activatable_drive is already activated or can be activated in
non-degraded mode, this function returns FALSE.
|
void gdu_activatable_drive_activate (GduActivatableDrive *activatable_drive, GduActivatableDriveActivationFunc callback, gpointer user_data);
Activates activatable_drive
.
|
A GduActivatableDrive. |
|
Callback function. |
|
User data. |
void gdu_activatable_drive_deactivate (GduActivatableDrive *activatable_drive, GduActivatableDriveDeactivationFunc callback, gpointer user_data);
Deactivates activatable_drive
.
|
A GduActivatableDrive. |
|
Callback function. |
|
User data. |
GduActivableDriveSlaveState gdu_activatable_drive_get_slave_state (GduActivatableDrive *activatable_drive, GduDevice *slave);
Gets the state of slave
of activatable_drive
.
|
A GduActivatableDrive. |
|
A GduDevice. |
Returns : |
A value from GduActivatableDriveSlaveState for slave .
|