![]() |
![]() |
![]() |
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
); 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_jobs_for_object (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_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 1
The major version of the libudisks2 header files.
#define UDISKS_MINOR_VERSION 97
The minor version of the libudisks2 header files.
#define UDISKS_MICRO_VERSION 0
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. |
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. |
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_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]
|
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
);
Gets information about a UDisksDrive object that is suitable to present in an user interface. The returned strings are localized.
If there is no media in drive
, then out_media_icon
is set to the
same value as out_drive_icon
.
If the drive
doesn't support removable media or if no media is
available, then NULL
is always returned for out_media_description
and out_media_icon
.
If the HintName
and/or
HintIconName
properties on the block device for drive
are set (see udisks(8)),
their values are returned in the drive and media
description and icon (e.g. out_description
, out_drive_icon
, out_media_description
and out_media_icon
).
The returned data is best described by example:
Device / Media | name | description | icon | media_description | media_icon |
---|---|---|---|---|---|
USB Thumb Drive | Kingston DataTraveler 2.0 | 4.0 GB Thumb Drive | media-removable | NULL | NULL |
Internal System Disk (Hard Disk) | ST3320620AS | 320 GB Hard Disk | drive-harddisk | NULL | NULL |
Internal System Disk (Solid State) | INTEL SSDSA2MH080G1GC | 80 GB Disk | drive-harddisk | NULL | NULL |
Optical Drive (empty) | LITE-ON DVDRW SOHW-812S | CD/DVD Drive | drive-optical | NULL | NULL |
Optical Drive (with CD-ROM data disc) | LITE-ON DVDRW SOHW-812S | CD/DVD Drive | drive-optical | CD-ROM Disc | media-optical-cd-rom |
Optical Drive (with mixed disc) | LITE-ON DVDRW SOHW-812S | CD/DVD Drive | drive-optical | Audio/Data CD-ROM Disc | media-optical-cd-rom |
Optical Drive (with audio disc) | LITE-ON DVDRW SOHW-812S | CD/DVD Drive | drive-optical | Audio Disc | media-optical-cd-audio |
Optical Drive (with DVD-ROM disc) | LITE-ON DVDRW SOHW-812S | CD/DVD Drive | drive-optical | DVD-ROM Disc | media-optical-dvd-rom |
Optical Drive (with blank DVD-R disc) | LITE-ON DVDRW SOHW-812S | CD/DVD Drive | drive-optical | Blank DVD-R Disc | media-optical-dvd-r |
External USB Hard Disk | WD 2500JB External | 250 GB Hard Disk | drive-harddisk-usb | NULL | NULL |
USB Compact Flash Reader (without media) | BELKIN USB 2 HS-CF | Compact Flash Drive | drive-removable-media-flash-cf | NULL | NULL |
USB Compact Flash Reader (with media) | BELKIN USB 2 HS-CF | Compact Flash Drive | drive-removable-media-flash-cf | Compact Flash media | media-flash-cf |
|
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.
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. |
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_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. |