Top |
#define | UDISKS_MAJOR_VERSION |
#define | UDISKS_MINOR_VERSION |
#define | UDISKS_MICRO_VERSION |
UDisksClient | |
UDisksPartitionTypeInfo | |
enum | UDisksPartitionTypeInfoFlags |
GBoxed ╰── UDisksPartitionTypeInfo GFlags ╰── UDisksPartitionTypeInfoFlags GObject ╰── UDisksClient
#define UDISKS_CHECK_VERSION(major,minor,micro)
Macro to check against the version of the libudisks2 library that is being compiled against.
major |
The major version to check for. |
|
minor |
the minor version to check for. |
|
micro |
The micro version to check for. |
TRUE
if the version of the libudisks2 header files is the
same as or newer than the passed in version.
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
cancellable |
A GCancellable or |
|
callback |
Function that will be called when the result is ready. |
|
user_data |
Data to pass to |
UDisksClient * udisks_client_new_finish (GAsyncResult *res
,GError **error
);
Finishes an operation started with udisks_client_new()
.
UDisksClient * udisks_client_new_sync (GCancellable *cancellable
,GError **error
);
Synchronously gets a UDisksClient for the local system.
cancellable |
A GCancellable or |
[allow-none] |
error |
Return location for error or |
[allow-none] |
UDisksObject * udisks_client_get_object (UDisksClient *client
,const gchar *object_path
);
Convenience function for looking up an UDisksObject for object_path
.
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.GDBusObjectManager *
udisks_client_get_object_manager (UDisksClient *client
);
Gets the GDBusObjectManager used by client
.
UDisksManager *
udisks_client_get_manager (UDisksClient *client
);
Gets the UDisksManager interface on the well-known
/org/freedesktop/UDisks2/Manager
object.
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
when using asynchronous calls where the return value references a newly created object (such as the Manager.LoopSetup() method).
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.
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 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:OperationD-Bus property.
UDisksBlock * udisks_client_get_block_for_dev (UDisksClient *client
,dev_t block_device_number
);
Gets the UDisksBlock corresponding to block_device_number
, if any.
client |
A UDisksClient. |
|
block_device_number |
A dev_t to get a UDisksBlock for. |
[type guint64] |
GList * udisks_client_get_block_for_label (UDisksClient *client
,const gchar *label
);
Gets all the UDisksBlock instances with the given label, if any.
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 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).
client |
A UDisksClient. |
|
drive |
A UDisksDrive. |
|
get_physical |
|
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 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.
UDisksPartitionTable * udisks_client_get_partition_table (UDisksClient *client
,UDisksPartition *partition
);
Gets the UDisksPartitionTable corresponding to partition
.
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.
GList * udisks_client_get_partitions (UDisksClient *client
,UDisksPartitionTable *table
);
Gets all partitions of table
.
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 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.
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 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 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 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.
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.
client |
A UDisksClient. |
|
drive |
A UDisksDrive. |
|
out_name |
Return location for name or |
[out][allow-none] |
out_description |
Return location for description or |
[out][allow-none] |
out_drive_icon |
Return location for icon representing the drive or |
[out][allow-none] |
out_media_description |
Return location for description of the media or |
[out][allow-none] |
out_media_icon |
Return location for icon representing the media or |
[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).
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
.
client |
A UDisksClient. |
|
size |
Size in bytes |
|
use_pow2 |
Whether power-of-two units should be used instead of power-of-ten units. |
|
long_string |
Whether to produce a long string. |
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
.
client |
A UDisksClient. |
|
usage |
Usage id e.g. "filesystem" or "crypto". |
|
type |
Type e.g. "ext4" or "crypto_LUKS" |
|
version |
Version. |
|
long_string |
Whether to produce a long string. |
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.
void
udisks_partition_type_info_free (UDisksPartitionTypeInfo *info
);
Frees info
.
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
.
client |
A UDisksClient. |
|
partition_table_type |
A partition table type e.g. 'dos' or 'gpt'. |
|
partition_table_subtype |
A partition table subtype or |
[allow-none] |
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
.
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
.
client |
A UDisksClient. |
|
partition_table_type |
A partitioning type e.g. 'dos' or 'gpt'. |
|
partition_type |
A 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
);
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.
client |
A UDisksClient. |
|
partition_table_type |
A partitioning type e.g. 'dos' or 'gpt'. |
|
partition_table_subtype |
A partitioning subtype or |
|
partition_type |
A partition type. |
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
.
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
.
client |
A UDisksClient. |
|
partition_table_type |
A partition table type e.g. 'dos' or 'gpt'. |
|
partition_table_subtype |
A partition table type e.g. 'dos' or 'gpt'. |
#define UDISKS_MAJOR_VERSION 2
The major version of the libudisks2 header files.
#define UDISKS_MINOR_VERSION 7
The minor version of the libudisks2 header files.
#define UDISKS_MICRO_VERSION 4
The micro version of the libudisks2 header files.
typedef struct _UDisksClient UDisksClient;
The UDisksClient structure contains only private data and should only be accessed using the provided API.
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.
const gchar * |
A partition table type e.g. 'dos' or 'gpt' |
|
const gchar * |
A partition table sub-type. |
|
const gchar * |
A partition type. |
|
UDisksPartitionTypeInfoFlags |
Flags from the UDisksPartitionTypeInfoFlags enumeration. |
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'). |
“manager”
property“manager” UDisksManager *
The UDisksManager interface on the well-known
/org/freedesktop/UDisks2/Manager
object
Flags: Read
“object-manager”
property“object-manager” GDBusObjectManager *
The GDBusObjectManager used by the UDisksClient instance.
Flags: Read
“changed”
signalvoid user_function (UDisksClient *client, gpointer user_data)
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.
Flags: Run Last