UDisksLinuxDriveAta: UDisks Reference Manual

## UDisksLinuxDriveAta UDisksLinuxDriveAta — Linux implementation of UDisksDriveAta |

## Functions

UDisksDriveAta * | udisks_linux_drive_ata_new ()
gboolean | udisks_linux_drive_ata_update ()
gboolean | udisks_linux_drive_ata_refresh_smart_sync ()
gboolean | udisks_linux_drive_ata_smart_selftest_sync ()
void | udisks_linux_drive_ata_apply_configuration ()
gboolean | udisks_linux_drive_ata_secure_erase_sync ()
gboolean | udisks_linux_drive_ata_get_pm_state ()
#define | UDISKS_LINUX_DRIVE_ATA_IS_AWAKE()

## Types and Values

| UDisksLinuxDriveAta

## Object Hierarchy

        GObject
        ╰── GDBusInterfaceSkeleton
            ╰── UDisksDriveAtaSkeleton
                ╰── UDisksLinuxDriveAta

## Implemented Interfaces

UDisksLinuxDriveAta implements GDBusInterface and UDisksDriveAta.

## Description

This type provides an implementation of the UDisksDriveAta interface on Linux.

## Functions

### udisks_linux_drive_ata_new ()

    UDisksDriveAta *
    udisks_linux_drive_ata_new (void);

Creates a new UDisksLinuxDriveAta instance.

#### Returns

A new UDisksLinuxDriveAta. Free with `g_object_unref()`.

### udisks_linux_drive_ata_update ()

    gboolean
    udisks_linux_drive_ata_update (UDisksLinuxDriveAta *drive,
                                   UDisksLinuxDriveObject *object);

Updates the interface.

#### Parameters

drive | A UDisksLinuxDriveAta. |
object | The enclosing UDisksLinuxDriveObject instance. |

#### Returns

`TRUE` if configuration has changed, `FALSE` otherwise.

### udisks_linux_drive_ata_refresh_smart_sync ()

    gboolean
    udisks_linux_drive_ata_refresh_smart_sync
                                   (UDisksLinuxDriveAta *drive,
                                    gboolean nowakeup,
                                    const gchar *simulate_path,
                                    GCancellable *cancellable,
                                    GError **error);

Synchronously refreshes ATA S.M.A.R.T. data on `drive` using one of the physical drives associated with it. The calling thread is blocked until the data has been obtained.

If `nowake` is `TRUE` and the disk is in a sleep state this fails with `UDISKS_ERROR_WOULD_WAKEUP`.

This may only be called if `drive` has been associated with a UDisksLinuxDriveObject instance.

This method may be called from any thread.

#### Parameters

drive | The UDisksLinuxDriveAta to refresh. |
nowakeup | If `TRUE`, will not wake up the disk if asleep. |
simulate_path | If not `NULL`, the path of a file with a libatasmart blob to use. |
cancellable | A GCancellable or `NULL`. |
error | Return location for error. |

#### Returns

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

### udisks_linux_drive_ata_smart_selftest_sync ()

    gboolean
    udisks_linux_drive_ata_smart_selftest_sync
                                   (UDisksLinuxDriveAta *drive,
                                    const gchar *type,
                                    GCancellable *cancellable,
                                    GError **error);

Starts (or aborts) a SMART self-test on `drive` . Valid values for `type` includes 'short', 'extended', 'conveyance' and 'abort'.

The calling thread is blocked while sending the command to the drive but will return immediately after the drive acknowledges the command.

#### Parameters

drive | A UDisksLinuxDriveAta. |
type | The type of selftest to run. |
cancellable | A GCancellable that can be used to cancel the operation or `NULL`. | [allow-none]
error | Return location for error or `NULL`. |

#### Returns

`TRUE` if the operation succeed, `FALSE` if `error` is set.

### udisks_linux_drive_ata_apply_configuration ()

    void
    udisks_linux_drive_ata_apply_configuration
                                   (UDisksLinuxDriveAta *drive,
                                    UDisksLinuxDevice *device,
                                    GVariant *configuration);

Spawns a thread to apply `configuration` to `drive` , if any. Does not wait for the thread to terminate.

#### Parameters

drive | A UDisksLinuxDriveAta. |
device | A UDisksLinuxDevice |
configuration | The configuration to apply. |

### udisks_linux_drive_ata_secure_erase_sync ()

    gboolean
    udisks_linux_drive_ata_secure_erase_sync
                                   (UDisksLinuxDriveAta *drive,
                                    uid_t caller_uid,
                                    gboolean enhanced,
                                    GError **error);

Performs an ATA Secure Erase opeartion. Blocks the calling thread until the operation completes.

This operation may take a very long time (hours) to complete.

#### Parameters

drive | A UDisksLinuxDriveAta. |
caller_uid | The unix user if of the caller requesting the operation. |
enhanced | `TRUE` to use the enhanced version of the ATA secure erase command. |
error | Return location for error or `NULL`. |

#### Returns

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

### udisks_linux_drive_ata_get_pm_state ()

    gboolean
    udisks_linux_drive_ata_get_pm_state (UDisksLinuxDriveAta *drive,
                                         GError **error,
                                         guchar *pm_state);

Get the current power mode state.

The format of `pm_state` is the result obtained from sending the ATA command `CHECK POWER MODE` to the drive.

Known values include:

- `0x00`: Device is in PM2: Standby state.

- `0x40`: Device is in the PM0: Active state, the NV Cache power mode is enabled, and the spindle is spun down or spinning down.

- `0x41`: Device is in the PM0: Active state, the NV Cache power mode is enabled, and the spindle is spun up or spinning up.

- `0x80`: Device is in PM1: Idle state.

- `0xff`: Device is in the PM0: Active state or PM1: Idle State.

Typically user interfaces will report "Drive is spun down" if `pm_state` is 0x00 and "Drive is spun up" otherwise.

#### Parameters

drive | A UDisksLinuxDriveAta. |
error | Return location for error. |
pm_state | Return location for the current power state value. |

#### Returns

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

### UDISKS_LINUX_DRIVE_ATA_IS_AWAKE()

    #define         UDISKS_LINUX_DRIVE_ATA_IS_AWAKE(pm_state) (pm_state >= 0x41)

Decodes the power state value as returned by udisks_linux_drive_ata_get_pm_state.

#### Parameters

pm_state | The power state value. |

#### Returns

`TRUE` when the drive is awake, `FALSE` when sleeping.

## Types and Values

### UDisksLinuxDriveAta

    typedef struct _UDisksLinuxDriveAta UDisksLinuxDriveAta;

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