UDisksLinuxBlockObject: UDisks Reference Manual

## UDisksLinuxBlockObject UDisksLinuxBlockObject — Object representing a block device on Linux. |

## Functions

UDisksLinuxBlockObject * | udisks_linux_block_object_new ()
void | udisks_linux_block_object_uevent ()
UDisksDaemon * | udisks_linux_block_object_get_daemon ()
UDisksLinuxDevice * | udisks_linux_block_object_get_device ()
gchar * | udisks_linux_block_object_get_device_file ()
dev_t | udisks_linux_block_object_get_device_number ()
void | udisks_linux_block_object_trigger_uevent ()
gboolean | udisks_linux_block_object_trigger_uevent_sync ()
void | udisks_linux_block_object_reread_partition_table ()
gboolean | udisks_linux_block_object_contains_filesystem ()
void | udisks_linux_block_object_lock_for_cleanup ()
gboolean | udisks_linux_block_object_try_lock_for_cleanup ()
void | udisks_linux_block_object_release_cleanup_lock ()

## Properties

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

## Types and Values

| UDisksLinuxBlockObject

## Object Hierarchy

        GObject
        ╰── GDBusObjectSkeleton
            ╰── UDisksObjectSkeleton
                ╰── UDisksLinuxBlockObject

## Implemented Interfaces

UDisksLinuxBlockObject implements GDBusObject and UDisksObject.

## Description

Object corresponding to a block device on Linux.

## Functions

### udisks_linux_block_object_new ()

    UDisksLinuxBlockObject *
    udisks_linux_block_object_new (UDisksDaemon *daemon,
                                   UDisksLinuxDevice *device);

Create a new block object.

#### Parameters

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

#### Returns

A UDisksLinuxBlockObject object. Free with `g_object_unref()`.

### udisks_linux_block_object_uevent ()

    void
    udisks_linux_block_object_uevent (UDisksLinuxBlockObject *object,
                                      const gchar *action,
                                      UDisksLinuxDevice *device);

Updates all information on interfaces on `object` as a result of incoming uevent processing.

#### Parameters

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

### udisks_linux_block_object_get_daemon ()

    UDisksDaemon *
    udisks_linux_block_object_get_daemon (UDisksLinuxBlockObject *object);

Gets the daemon used by `object` .

#### Parameters

object | A UDisksLinuxBlockObject. |

#### Returns

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

### udisks_linux_block_object_get_device ()

    UDisksLinuxDevice *
    udisks_linux_block_object_get_device (UDisksLinuxBlockObject *object);

Gets the current UDisksLinuxDevice for `object` . Connect to “notify” to track changes to the “device” property.

#### Parameters

object | A UDisksLinuxBlockObject. |

#### Returns

A UDisksLinuxDevice. Free with `g_object_unref()`.

### udisks_linux_block_object_get_device_file ()

    gchar *
    udisks_linux_block_object_get_device_file
                                   (UDisksLinuxBlockObject *object);

Gets the device path for this object (eg. /dev/sda1).

#### Parameters

object | A UDisksLinuxBlockObject. |

#### Returns

A device path. Free with `g_free()`.

### udisks_linux_block_object_get_device_number ()

    dev_t
    udisks_linux_block_object_get_device_number
                                   (UDisksLinuxBlockObject *object);

Gets the device number for this object.

#### Parameters

object | A UDisksLinuxBlockObject. |

#### Returns

A dev_t device number or zero in case of an error.

### udisks_linux_block_object_trigger_uevent ()

    void
    udisks_linux_block_object_trigger_uevent
                                   (UDisksLinuxBlockObject *object);

Triggers a 'change' uevent in the kernel.

Refer to `udisks_daemon_util_trigger_uevent()` for detailed description.

#### Parameters

object | A UDisksLinuxBlockObject. |

### udisks_linux_block_object_trigger_uevent_sync ()

    gboolean
    udisks_linux_block_object_trigger_uevent_sync
                                   (UDisksLinuxBlockObject *object,
                                    guint timeout_seconds);

Triggers a 'change' uevent in the kernel and waits until it's received and processed through the uevent queue.

This is a convenient wrapper around `udisks_daemon_util_trigger_uevent_sync()`. Refer to this function for detailed documentation.

#### Parameters

object | A UDisksLinuxBlockObject. |
timeout_seconds | Maximum time to wait for the uevent (in seconds). |

#### Returns

`TRUE` if the uevent has been successfully received, `FALSE` otherwise or when the kernel version is too old.

### udisks_linux_block_object_reread_partition_table ()

    void
    udisks_linux_block_object_reread_partition_table
                                   (UDisksLinuxBlockObject *object);

Requests the kernel to re-read the partition table for `object` .

The events from any change this may cause will bubble up from the kernel through the udev stack and will eventually be received by the udisks daemon process itself. This method does not wait for the event to be received.

#### Parameters

object | A UDisksLinuxBlockObject. |

### udisks_linux_block_object_contains_filesystem ()

    gboolean
    udisks_linux_block_object_contains_filesystem
                                   (UDisksObject *object);

Check whether filesystem has been detected on the block device.

#### Parameters

object | A UDisksLinuxBlockObject. |

#### Returns

`TRUE` if the block device contains filesystem, `FALSE` otherwise.

### udisks_linux_block_object_lock_for_cleanup ()

    void
    udisks_linux_block_object_lock_for_cleanup
                                   (UDisksLinuxBlockObject *object);

Acquires the "cleanup" lock of the block device `object` . Typically used to signal the cleanup thread that the block device is busy.

#### Parameters

object | A UDisksLinuxBlockObject. |

### udisks_linux_block_object_try_lock_for_cleanup ()

    gboolean
    udisks_linux_block_object_try_lock_for_cleanup
                                   (UDisksLinuxBlockObject *object);

Attempts to lock the block device `object` for cleanup. Typically used by the cleanup thread to check whether the block device is busy and cleanup can be performed.

#### Parameters

object | A UDisksLinuxBlockObject. |

#### Returns

`TRUE` if lock has been acquired, `FALSE` when the block device is busy.

### udisks_linux_block_object_release_cleanup_lock ()

    void
    udisks_linux_block_object_release_cleanup_lock
                                   (UDisksLinuxBlockObject *object);

Releases a lock previously acquired by `udisks_linux_block_object_lock_for_cleanup()`.

#### Parameters

object | A UDisksLinuxBlockObject. |

## Types and Values

### UDisksLinuxBlockObject

    typedef struct _UDisksLinuxBlockObject UDisksLinuxBlockObject;

The UDisksLinuxBlockObject 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: UDisksLinuxBlockObject

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: UDisksLinuxBlockObject

Flags: Read / Write / Construct Only