GduDrive

GduDrive — Drives

Synopsis

                    GduDrivePrivate;
                    GduDrive;
gboolean            gdu_drive_is_active                 (GduDrive *drive);
gboolean            gdu_drive_is_activatable            (GduDrive *drive);
gboolean            gdu_drive_can_deactivate            (GduDrive *drive);
gboolean            gdu_drive_can_activate              (GduDrive *drive,
                                                         gboolean *out_degraded);
void                gdu_drive_activate                  (GduDrive *drive,
                                                         GduDriveActivateFunc callback,
                                                         gpointer user_data);
void                gdu_drive_deactivate                (GduDrive *drive,
                                                         GduDriveDeactivateFunc callback,
                                                         gpointer user_data);
gboolean            gdu_drive_has_unallocated_space     (GduDrive *drive,
                                                         gboolean *out_whole_disk_is_unitialized,
                                                         guint64 *out_largest_segment,
                                                         GduPresentable **out_presentable);

Object Hierarchy

  GObject
   +----GduDrive
         +----GduLinuxMdDrive

Implemented Interfaces

GduDrive implements GduPresentable.

Description

The GduDrive class represents drives attached to the system. Normally, objects of this class corresponds 1:1 to physical drives (hard disks, optical drives, card readers etc.) attached to the system. However, it can also relate to software abstractions such as a Linux md Software RAID array and similar things.

See the documentation for GduPresentable for the big picture.

Details

GduDrivePrivate

typedef struct _GduDrivePrivate GduDrivePrivate;


GduDrive

typedef struct _GduDrive GduDrive;


gdu_drive_is_active ()

gboolean            gdu_drive_is_active                 (GduDrive *drive);

drive :

Returns :


gdu_drive_is_activatable ()

gboolean            gdu_drive_is_activatable            (GduDrive *drive);

drive :

Returns :


gdu_drive_can_deactivate ()

gboolean            gdu_drive_can_deactivate            (GduDrive *drive);

drive :

Returns :


gdu_drive_can_activate ()

gboolean            gdu_drive_can_activate              (GduDrive *drive,
                                                         gboolean *out_degraded);

Checks if drive can be activated. If this function returns TRUE, out_degraded will be set to whether the drive will be started in degraded mode (e.g. starting a mirror RAID array with only one component available).

drive :

A GduDrive.

out_degraded :

NULL or return location for whether the drive will be degraded if activated.

Returns :

TRUE if drive can be activated (and out_degraded will be set), FALSE otherwise.

gdu_drive_activate ()

void                gdu_drive_activate                  (GduDrive *drive,
                                                         GduDriveActivateFunc callback,
                                                         gpointer user_data);

drive :

callback :

user_data :


gdu_drive_deactivate ()

void                gdu_drive_deactivate                (GduDrive *drive,
                                                         GduDriveDeactivateFunc callback,
                                                         gpointer user_data);

drive :

callback :

user_data :


gdu_drive_has_unallocated_space ()

gboolean            gdu_drive_has_unallocated_space     (GduDrive *drive,
                                                         gboolean *out_whole_disk_is_unitialized,
                                                         guint64 *out_largest_segment,
                                                         GduPresentable **out_presentable);

This method computes the largest contigious free block of unallocated space on drive.

If drive uses removable media and there is no media inserted, FALSE is returned.

If drive appears to be completely uninitialized (such as a hard disk full of zeros), out_whole_disk_is_unitialized is set to TRUE, the size of the media/disk is returned in out_largest_segment and TRUE is returned. Note that this can also happen if drive contains signatures unknown to the operating system so be careful.

If the disk is partitioned and unallocated space exists but no more partitions can be created (due to e.g. four primary partitions on a MBR partitioned disk), this method returns FALSE but out_largest_segment will be set to a non-zero value.

Additionally, out_presentable will be set to either a GduVolumeHole (if the disk is partitioned and has free space) or the GduDrive (if the disk is uninitialized).

drive :

A GduDrive.

out_whole_disk_is_unitialized :

Return location for whether drive is uninitialized or NULL.

out_largest_segment :

Return location biggest contigious free block of drive or NULL.

out_presentable :

Return location for the presentable that represents free space or NULL. Free with g_object_unref().

Returns :

TRUE if drive has unallocated space, FALSE otherwise.