![]() |
![]() |
![]() |
UDisks Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
#define UDISKS_MAJOR_VERSION #define UDISKS_MINOR_VERSION #define UDISKS_MICRO_VERSION #define UDISKS_CHECK_VERSION (major, minor, micro) UDisksClient; void udisks_client_new (GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); UDisksClient * udisks_client_new_finish (GAsyncResult *res
,GError **error
); UDisksClient * udisks_client_new_sync (GCancellable *cancellable
,GError **error
); UDisksObject * udisks_client_get_object (UDisksClient *client
,const gchar *object_path
); UDisksObject * udisks_client_peek_object (UDisksClient *client
,const gchar *object_path
); GDBusObjectManager * udisks_client_get_object_manager (UDisksClient *client
); UDisksManager * udisks_client_get_manager (UDisksClient *client
); void udisks_client_settle (UDisksClient *client
); void udisks_client_queue_changed (UDisksClient *client
); GList * udisks_client_get_jobs_for_object (UDisksClient *client
,UDisksObject *object
); gchar * udisks_client_get_job_description (UDisksClient *client
,UDisksJob *job
); UDisksBlock * udisks_client_get_block_for_dev (UDisksClient *client
,dev_t block_device_number
); GList * udisks_client_get_block_for_label (UDisksClient *client
,const gchar *label
); GList * udisks_client_get_block_for_uuid (UDisksClient *client
,const gchar *uuid
); UDisksBlock * udisks_client_get_block_for_drive (UDisksClient *client
,UDisksDrive *drive
,gboolean get_physical
); UDisksDrive * udisks_client_get_drive_for_block (UDisksClient *client
,UDisksBlock *block
); UDisksBlock * udisks_client_get_cleartext_block (UDisksClient *client
,UDisksBlock *block
); UDisksPartitionTable * udisks_client_get_partition_table (UDisksClient *client
,UDisksPartition *partition
); UDisksLoop * udisks_client_get_loop_for_block (UDisksClient *client
,UDisksBlock *block
); GList * udisks_client_get_partitions (UDisksClient *client
,UDisksPartitionTable *table
); GList * udisks_client_get_drive_siblings (UDisksClient *client
,UDisksDrive *drive
); UDisksBlock * udisks_client_get_block_for_mdraid (UDisksClient *client
,UDisksMDRaid *raid
); GList * udisks_client_get_all_blocks_for_mdraid (UDisksClient *client
,UDisksMDRaid *raid
); GList * udisks_client_get_members_for_mdraid (UDisksClient *client
,UDisksMDRaid *raid
); UDisksMDRaid * udisks_client_get_mdraid_for_block (UDisksClient *client
,UDisksBlock *block
); UDisksObjectInfo * udisks_client_get_object_info (UDisksClient *client
,UDisksObject *object
); void udisks_client_get_drive_info (UDisksClient *client
,UDisksDrive *drive
,gchar **out_name
,gchar **out_description
,GIcon **out_drive_icon
,gchar **out_media_description
,GIcon **out_media_icon
); gchar * udisks_client_get_partition_info (UDisksClient *client
,UDisksPartition *partition
); gchar * udisks_client_get_size_for_display (UDisksClient *client
,guint64 size
,gboolean use_pow2
,gboolean long_string
); gchar * udisks_client_get_id_for_display (UDisksClient *client
,const gchar *usage
,const gchar *type
,const gchar *version
,gboolean long_string
); gchar * udisks_client_get_media_compat_for_display (UDisksClient *client
,const gchar * const *media_compat
); UDisksPartitionTypeInfo; enum UDisksPartitionTypeInfoFlags; void udisks_partition_type_info_free (UDisksPartitionTypeInfo *info
); GList * udisks_client_get_partition_type_infos (UDisksClient *client
,const gchar *partition_table_type
,const gchar *partition_table_subtype
); const gchar ** udisks_client_get_partition_table_subtypes (UDisksClient *client
,const gchar *partition_table_type
); const gchar * udisks_client_get_partition_type_for_display (UDisksClient *client
,const gchar *partition_table_type
,const gchar *partition_type
); const gchar * udisks_client_get_partition_type_and_subtype_for_display (UDisksClient *client
,const gchar *partition_table_type
,const gchar *partition_table_subtype
,const gchar *partition_type
); const gchar * udisks_client_get_partition_table_type_for_display (UDisksClient *client
,const gchar *partition_table_type
); const gchar * udisks_client_get_partition_table_subtype_for_display (UDisksClient *client
,const gchar *partition_table_type
,const gchar *partition_table_subtype
);
GObject +----UDisksClient
GBoxed +----UDisksPartitionTypeInfo
GFlags +----UDisksPartitionTypeInfoFlags
#define UDISKS_MAJOR_VERSION 2
The major version of the libudisks2 header files.
#define UDISKS_MINOR_VERSION 1
The minor version of the libudisks2 header files.
#define UDISKS_MICRO_VERSION 1
The micro version of the libudisks2 header files.
#define UDISKS_CHECK_VERSION(major,minor,micro)
Macro to check against the version of the libudisks2 library that is being compiled against.
|
The major version to check for. |
|
the minor version to check for. |
|
The micro version to check for. |
Returns : |
TRUE if the version of the libudisks2 header files is the
same as or newer than the passed in version. |
typedef struct _UDisksClient UDisksClient;
The UDisksClient structure contains only private data and should only be accessed using the provided API.
void udisks_client_new (GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously gets a UDisksClient. When the operation is
finished, callback
will be invoked in the
|
A GCancellable or NULL . |
|
Function that will be called when the result is ready. |
|
Data to pass to callback . |
UDisksClient * udisks_client_new_finish (GAsyncResult *res
,GError **error
);
Finishes an operation started with udisks_client_new()
.
|
A GAsyncResult. |
|
Return location for error or NULL . |
Returns : |
A UDisksClient or NULL if error is set. Free with
g_object_unref() when done with it. |
UDisksClient * udisks_client_new_sync (GCancellable *cancellable
,GError **error
);
Synchronously gets a UDisksClient for the local system.
|
A GCancellable or NULL . [allow-none]
|
|
Return location for error or NULL . [allow-none]
|
Returns : |
A UDisksClient or NULL if error is set. Free with
g_object_unref() when done with it. |
UDisksObject * udisks_client_get_object (UDisksClient *client
,const gchar *object_path
);
Convenience function for looking up an UDisksObject for object_path
.
|
A UDisksClient. |
|
Object path. |
Returns : |
A UDisksObject corresponding to
object_path or NULL if not found. The returned object must be
freed with g_object_unref() . [transfer full]
|
UDisksObject * udisks_client_peek_object (UDisksClient *client
,const gchar *object_path
);
Like udisks_client_get_object()
but doesn't increase the reference
count on the returned UDisksObject.
client
was constructed. Use udisks_client_get_object()
if on another thread.
|
A UDisksClient. |
|
Object path. |
Returns : |
A UDisksObject corresponding to
object_path or NULL if not found. [transfer none]
|
GDBusObjectManager * udisks_client_get_object_manager (UDisksClient *client
);
Gets the GDBusObjectManager used by client
.
|
A UDisksClient. |
Returns : |
A GDBusObjectManager. Do not free, the
instance is owned by client . [transfer none]
|
UDisksManager * udisks_client_get_manager (UDisksClient *client
);
Gets the UDisksManager interface on the well-known
/org/freedesktop/UDisks2/Manager
object.
|
A UDisksClient. |
Returns : |
A UDisksManager or NULL if the udisksd
daemon is not currently running. Do not free, the instance is owned
by client . [transfer none]
|
void udisks_client_settle (UDisksClient *client
);
Blocks until all pending D-Bus messages have been delivered. Also emits the (rate-limited) "changed" signal if changes are currently pending.
This is useful in two situations: 1. when using synchronous method calls since e.g. D-Bus signals received while waiting for the reply are queued up and dispatched after the synchronous call ends; and 2. when using asynchronous calls where the return value references a newly created object (such as the Manager.LoopSetup() method).
|
A UDisksClient. |
void udisks_client_queue_changed (UDisksClient *client
);
Queues up a "changed" signal and rate-limit it. See the documentation for the "changed" property for more information.
|
A UDisksClient. |
Since 2.1
GList * udisks_client_get_jobs_for_object (UDisksClient *client
,UDisksObject *object
);
Gets all the UDisksJob instances that reference object
, if any.
|
A UDisksClient. |
|
A UDisksObject. |
Returns : |
A list of UDisksJob 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 UDisksJob]
|
gchar * udisks_client_get_job_description (UDisksClient *client
,UDisksJob *job
);
Gets a human-readable and localized text string describing the
operation of job
.
For known job types, see the documentation for the Job:Operation D-Bus property.
|
A UDisksClient. |
|
A UDisksJob. |
Returns : |
A string that should be freed with g_free() . |
UDisksBlock * udisks_client_get_block_for_dev (UDisksClient *client
,dev_t block_device_number
);
Gets the UDisksBlock corresponding to block_device_number
, if any.
|
A UDisksClient. |
|
A dev_t to get a UDisksBlock for. [type guint64] |
Returns : |
A UDisksBlock or NULL if not found. [transfer full]
|
GList * udisks_client_get_block_for_label (UDisksClient *client
,const gchar *label
);
Gets all the UDisksBlock instances with the given label, if any.
|
A UDisksClient. |
|
The label. |
Returns : |
A list of UDisksBlock 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 UDisksBlock]
|
GList * udisks_client_get_block_for_uuid (UDisksClient *client
,const gchar *uuid
);
Gets all the UDisksBlock instances with the given uuid, if any.
|
A UDisksClient. |
|
The uuid. |
Returns : |
A list of UDisksBlock 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 UDisksBlock]
|
UDisksBlock * udisks_client_get_block_for_drive (UDisksClient *client
,UDisksDrive *drive
,gboolean get_physical
);
Gets a block device corresponding to drive
. The returned block
device, if any, is for the whole disk drive, e.g. a partition block
device is never returned.
Set get_physical
to TRUE
if you need a block device that you can
send low-level SCSI commands with (for multipath, this returns one
of the physical paths). Set it to FALSE
if you need a block device
that you can read/write data with (for multipath, this returns the
mapped device).
|
A UDisksClient. |
|
A UDisksDrive. |
|
TRUE to get a physical device, FALSE to get the logical device. |
Returns : |
A UDisksBlock or NULL if the requested
kind of block device is not available - use g_object_unref() to
free the returned object. [transfer full]
|
UDisksDrive * udisks_client_get_drive_for_block (UDisksClient *client
,UDisksBlock *block
);
Gets the UDisksDrive that block
belongs to, if any.
|
A UDisksClient. |
|
A UDisksBlock. |
Returns : |
A UDisksDrive or NULL if there is no
UDisksDrive for block - free the returned object with
g_object_unref() . [transfer full]
|
UDisksBlock * udisks_client_get_cleartext_block (UDisksClient *client
,UDisksBlock *block
);
If block
is an unlocked encrypted device, gets the cleartext device.
|
A UDisksClient. |
|
A UDisksBlock. |
Returns : |
A UDisksBlock or NULL . Free with
g_object_unref() when done with it. [transfer full]
|
UDisksPartitionTable * udisks_client_get_partition_table (UDisksClient *client
,UDisksPartition *partition
);
Gets the UDisksPartitionTable corresponding to partition
.
|
A UDisksClient. |
|
A UDisksPartition. |
Returns : |
A UDisksPartitionTable. Free with g_object_unref() . [transfer full]
|
UDisksLoop * udisks_client_get_loop_for_block (UDisksClient *client
,UDisksBlock *block
);
Gets the corresponding loop interface for block
.
This only works if block
itself is a loop device or a partition of
a loop device.
|
A UDisksClient. |
|
A UDisksBlock. |
Returns : |
A UDisksLoop or NULL . Free with g_object_unref() . [transfer full]
|
GList * udisks_client_get_partitions (UDisksClient *client
,UDisksPartitionTable *table
);
Gets all partitions of table
.
|
A UDisksClient. |
|
A UDisksPartitionTable. |
Returns : |
A list of UDisksPartition 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 UDisksPartition]
|
GList * udisks_client_get_drive_siblings (UDisksClient *client
,UDisksDrive *drive
);
Gets all siblings for drive
.
|
A UDisksClient |
|
A UDisksDrive. |
Returns : |
A list of UDisksDrive 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 UDisksDrive]
|
Since 2.1
UDisksBlock * udisks_client_get_block_for_mdraid (UDisksClient *client
,UDisksMDRaid *raid
);
Gets the RAID device (e.g. /dev/md0
) for raid
.
In the case of a split-brain
syndrome, it is undefined which RAID device is
returned. For example this can happen if
/dev/sda
and /dev/sdb
are
components of a two-disk RAID-1 and /dev/md0
and /dev/md1
are two degraded arrays, each one
using exactly one of the two devices. Use
udisks_client_get_all_blocks_for_mdraid()
to get all RAID devices.
|
A UDisksClient. |
|
A UDisksMDRaid. |
Returns : |
A UDisksBlock or NULL if no RAID device is running. [transfer full]
|
Since 2.1
GList * udisks_client_get_all_blocks_for_mdraid (UDisksClient *client
,UDisksMDRaid *raid
);
Gets all RAID devices (e.g. /dev/md0
and /dev/md1
) for raid
.
This is usually only useful in split-brain
situations — see udisks_client_get_block_for_mdraid()
for
an example — and is normally used only to convey the problem in an
user interface.
|
A UDisksClient. |
|
A UDisksMDRaid. |
Returns : |
A list of UDisksBlock 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 UDisksBlock]
|
Since 2.1
GList * udisks_client_get_members_for_mdraid (UDisksClient *client
,UDisksMDRaid *raid
);
Gets the physical block devices that are part of raid
.
|
A UDisksClient. |
|
A UDisksMDRaid. |
Returns : |
A list of UDisksBlock 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 UDisksBlock]
|
Since 2.1
UDisksMDRaid * udisks_client_get_mdraid_for_block (UDisksClient *client
,UDisksBlock *block
);
Gets the UDisksMDRaid that block
is the block device for, if any.
|
A UDisksClient. |
|
A UDisksBlock. |
Returns : |
A UDisksMDRaid or NULL if there is no
UDisksMDRaid for block or block is not a MD-RAID block
device. Free the returned object with g_object_unref() . [transfer full]
|
Since 2.1
UDisksObjectInfo * udisks_client_get_object_info (UDisksClient *client
,UDisksObject *object
);
Gets information about a UDisksObject instance that is suitable to present in an user interface. Information is returned in the UDisksObjectInfo object and is localized.
|
A UDisksClient. |
|
A UDisksObject. |
Returns : |
A UDisksObjectInfo instance that should be freed with g_object_unref() . [transfer full]
|
Since 2.1
void udisks_client_get_drive_info (UDisksClient *client
,UDisksDrive *drive
,gchar **out_name
,gchar **out_description
,GIcon **out_drive_icon
,gchar **out_media_description
,GIcon **out_media_icon
);
udisks_client_get_drive_info
has been deprecated since version 2.1 and should not be used in newly-written code. Use udisks_client_get_object_info()
instead.
Gets information about a UDisksDrive object that is suitable to present in an user interface. The returned strings are localized.
|
A UDisksClient. |
|
A UDisksDrive. |
|
Return location for name or NULL . [out][allow-none]
|
|
Return location for description or NULL . [out][allow-none]
|
|
Return location for icon representing the drive or NULL . [out][allow-none]
|
|
Return location for description of the media or NULL . [out][allow-none]
|
|
Return location for icon representing the media or NULL . [out][allow-none]
|
gchar * udisks_client_get_partition_info (UDisksClient *client
,UDisksPartition *partition
);
Gets information about partition
that is suitable to present in an
user interface in a single line of text.
The returned string is localized and includes things like the partition type, flags (if any) and name (if any).
|
A UDisksClient. |
|
# UDisksPartition. |
Returns : |
A string that should be freed with g_free() . [transfer full]
|
gchar * udisks_client_get_size_for_display (UDisksClient *client
,guint64 size
,gboolean use_pow2
,gboolean long_string
);
Utility function to get a human-readable string that represents size
.
|
A UDisksClient. |
|
Size in bytes |
|
Whether power-of-two units should be used instead of power-of-ten units. |
|
Whether to produce a long string. |
Returns : |
A string that should be freed with g_free() . |
gchar * udisks_client_get_id_for_display (UDisksClient *client
,const gchar *usage
,const gchar *type
,const gchar *version
,gboolean long_string
);
Gets a human readable localized string for usage
, type
and version
.
|
A UDisksClient. |
|
Usage id e.g. "filesystem" or "crypto". |
|
Type e.g. "ext4" or "crypto_LUKS" |
|
Version. |
|
Whether to produce a long string. |
Returns : |
A string that should be freed with g_free() . |
gchar * udisks_client_get_media_compat_for_display (UDisksClient *client
,const gchar * const *media_compat
);
Gets a human-readable string of the media described by
media_compat
. The returned information is localized.
|
A UDisksClient. |
|
An array of media types. |
Returns : |
A string that should be freed with g_free() or NULL if
unknown. |
typedef struct { const gchar *table_type; const gchar *table_subtype; const gchar *type; UDisksPartitionTypeInfoFlags flags; } UDisksPartitionTypeInfo;
Detailed information about a partition type.
table_subtype
is used to break the set of partition types for
table_type
into a logical subsets. It is typically only used in
user interfaces where the partition type is selected.
This struct may grow in the future without it being considered an ABI break.
A partition table type e.g. 'dos' or 'gpt' | |
A partition table sub-type. | |
A partition type. | |
UDisksPartitionTypeInfoFlags |
Flags from the UDisksPartitionTypeInfoFlags enumeration. |
typedef enum { UDISKS_PARTITION_TYPE_INFO_FLAGS_NONE = 0, UDISKS_PARTITION_TYPE_INFO_FLAGS_SWAP = (1<<0), UDISKS_PARTITION_TYPE_INFO_FLAGS_RAID = (1<<1), UDISKS_PARTITION_TYPE_INFO_FLAGS_HIDDEN = (1<<2), UDISKS_PARTITION_TYPE_INFO_FLAGS_CREATE_ONLY = (1<<3), UDISKS_PARTITION_TYPE_INFO_FLAGS_SYSTEM = (1<<4) } UDisksPartitionTypeInfoFlags;
Flags describing a partition type.
No flags set. | |
Partition type is used for swap. | |
Partition type is used for RAID/LVM or similar. | |
Partition type indicates the partition is hidden (e.g. 'dos' type 0x1b "Hidden W95 FAT32"). Note that this is not the same as user-toggleable attributs/flags for a partition. | |
Partition type can only be used when creating a partition and e.g. should not be selectable in a "change partition type" user interface (e.g. 'dos' type 0x05, 0x0f and 0x85 for extended partitions). | |
Partition type indicates the partition is part of the system / bootloader (e.g. 'dos' types 0xee, 0xff, 'gpt' types for 'EFI System partition' and 'BIOS Boot partition'). |
void udisks_partition_type_info_free (UDisksPartitionTypeInfo *info
);
Frees info
.
|
A UDisksPartitionTypeInfo. |
GList * udisks_client_get_partition_type_infos (UDisksClient *client
,const gchar *partition_table_type
,const gchar *partition_table_subtype
);
Gets information about all known partition types for partition_table_type
and partition_table_subtype
.
|
A UDisksClient. |
|
A partition table type e.g. 'dos' or 'gpt'. |
|
A partition table subtype or NULL to get all known types. [allow-none]
|
Returns : |
A list of
UDisksPartitionTypeInfo instances. The returned list should be freed
with g_list_free() after freeing each element with udisks_partition_type_info_free() . [transfer full][element-type UDisksPartitionTypeInfo]
|
const gchar ** udisks_client_get_partition_table_subtypes (UDisksClient *client
,const gchar *partition_table_type
);
Gets all known subtypes for partition_table_type
.
|
A UDisksClient. |
|
A partition table type e.g. 'dos' or 'gpt'. |
Returns : |
A NULL -terminated array of
strings. Only the container should be freed with g_free() . [transfer container]
|
const gchar * udisks_client_get_partition_type_for_display (UDisksClient *client
,const gchar *partition_table_type
,const gchar *partition_type
);
Gets a human readable localized string for partiton_table_type
and partition_type
.
|
A UDisksClient. |
|
A partitioning type e.g. 'dos' or 'gpt'. |
|
A partition type. |
Returns : |
A description of partition_type or NULL if unknown. |
const gchar * udisks_client_get_partition_type_and_subtype_for_display (UDisksClient *client
,const gchar *partition_table_type
,const gchar *partition_table_subtype
,const gchar *partition_type
);
Like udisks_client_get_partition_type_for_display()
but also takes
the partition table subtype into account, if available. This is
useful in scenarios where different subtypes is using the same
partition type.
|
A UDisksClient. |
|
A partitioning type e.g. 'dos' or 'gpt'. |
|
A partitioning subtype or NULL . |
|
A partition type. |
Returns : |
A description of partition_type or NULL if unknown. |
Since 2.1.1
const gchar * udisks_client_get_partition_table_type_for_display (UDisksClient *client
,const gchar *partition_table_type
);
Gets a human readable localized string for partition_table_type
.
|
A UDisksClient. |
|
A partition table type e.g. 'dos' or 'gpt'. |
Returns : |
A description of partition_table_type or NULL . |
const gchar * udisks_client_get_partition_table_subtype_for_display (UDisksClient *client
,const gchar *partition_table_type
,const gchar *partition_table_subtype
);
Gets a human readable localized string for partition_table_type
and partition_table_subtype
.
|
A UDisksClient. |
|
A partition table type e.g. 'dos' or 'gpt'. |
|
A partition table type e.g. 'dos' or 'gpt'. |
Returns : |
A description of partition_table_type and partition_table_subtype or NULL . |
"manager"
property"manager" UDisksManager* : Read
The UDisksManager interface on the well-known
/org/freedesktop/UDisks2/Manager
object
"object-manager"
property "object-manager" GDBusObjectManager* : Read
The GDBusObjectManager used by the UDisksClient instance.
"changed"
signalvoid user_function (UDisksClient *client,
gpointer user_data) : Run Last
This signal is emitted either when an object or interface is added or removed a when property has changed. Additionally, multiple received signals are coalesced into a single signal that is rate-limited to fire at most every 100ms.
Note that calling udisks_client_settle()
will cause this signal
to fire if any changes are outstanding.
For greater detail, connect to the "object-added", "object-removed", "interface-added", "interface-removed", "interface-proxy-properties-changed" and signals on the "object-manager" object.
|
A UDisksClient. |
|
user data set when the signal handler was connected. |