Top | ![]() |
![]() |
![]() |
![]() |
#define | STORAGED_MAJOR_VERSION |
#define | STORAGED_MINOR_VERSION |
#define | STORAGED_MICRO_VERSION |
StoragedClient | |
StoragedPartitionTypeInfo | |
enum | StoragedPartitionTypeInfoFlags |
GBoxed ╰── StoragedPartitionTypeInfo GFlags ╰── StoragedPartitionTypeInfoFlags GObject ╰── StoragedClient
#define STORAGED_CHECK_VERSION(major,minor,micro)
Macro to check against the version of the libstoraged library that is being compiled against.
void storaged_client_new (GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously gets a StoragedClient. When the operation is
finished, callback
will be invoked in the
StoragedClient * storaged_client_new_finish (GAsyncResult *res
,GError **error
);
Finishes an operation started with storaged_client_new()
.
StoragedClient * storaged_client_new_sync (GCancellable *cancellable
,GError **error
);
Synchronously gets a StoragedClient for the local system.
StoragedObject * storaged_client_get_object (StoragedClient *client
,const gchar *object_path
);
Convenience function for looking up an StoragedObject for object_path
.
A StoragedObject corresponding to
object_path
or NULL
if not found. The returned object must be
freed with g_object_unref()
.
[transfer full]
StoragedObject * storaged_client_peek_object (StoragedClient *client
,const gchar *object_path
);
Like storaged_client_get_object()
but doesn't increase the reference
count on the returned StoragedObject.
client
was constructed. Use storaged_client_get_object()
if on another thread.GDBusObjectManager *
storaged_client_get_object_manager (StoragedClient *client
);
Gets the GDBusObjectManager used by client
.
StoragedManager *
storaged_client_get_manager (StoragedClient *client
);
Gets the StoragedManager interface on the well-known
/org/storaged/Storaged/Manager
object.
A StoragedManager or NULL
if the storaged
daemon is not currently running. Do not free, the instance is owned
by client
.
[transfer none]
void
storaged_client_settle (StoragedClient *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
storaged_client_queue_changed (StoragedClient *client
);
Queues up a “changed” signal and rate-limit it. See the documentation for the “changed” property for more information.
Since: 2.1
GList * storaged_client_get_jobs_for_object (StoragedClient *client
,StoragedObject *object
);
Gets all the StoragedJob instances that reference object
, if any.
A list of StoragedJob 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 StoragedJob]
gchar * storaged_client_get_job_description (StoragedClient *client
,StoragedJob *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.
StoragedBlock * storaged_client_get_block_for_dev (StoragedClient *client
,dev_t block_device_number
);
Gets the StoragedBlock corresponding to block_device_number
, if any.
GList * storaged_client_get_block_for_label (StoragedClient *client
,const gchar *label
);
Gets all the StoragedBlock instances with the given label, if any.
A list of StoragedBlock 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 StoragedBlock]
GList * storaged_client_get_block_for_uuid (StoragedClient *client
,const gchar *uuid
);
Gets all the StoragedBlock instances with the given uuid, if any.
A list of StoragedBlock 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 StoragedBlock]
StoragedBlock * storaged_client_get_block_for_drive (StoragedClient *client
,StoragedDrive *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 |
||
drive |
||
get_physical |
|
A StoragedBlock or NULL
if the requested
kind of block device is not available - use g_object_unref()
to
free the returned object.
[transfer full]
StoragedDrive * storaged_client_get_drive_for_block (StoragedClient *client
,StoragedBlock *block
);
Gets the StoragedDrive that block
belongs to, if any.
A StoragedDrive or NULL
if there is no
StoragedDrive for block
- free the returned object with
g_object_unref()
.
[transfer full]
StoragedBlock * storaged_client_get_cleartext_block (StoragedClient *client
,StoragedBlock *block
);
If block
is an unlocked encrypted device, gets the cleartext device.
StoragedPartitionTable * storaged_client_get_partition_table (StoragedClient *client
,StoragedPartition *partition
);
Gets the StoragedPartitionTable corresponding to partition
.
StoragedLoop * storaged_client_get_loop_for_block (StoragedClient *client
,StoragedBlock *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 * storaged_client_get_partitions (StoragedClient *client
,StoragedPartitionTable *table
);
Gets all partitions of table
.
A list of StoragedPartition 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 StoragedPartition]
GList * storaged_client_get_drive_siblings (StoragedClient *client
,StoragedDrive *drive
);
Gets all siblings for drive
.
A list of StoragedDrive 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 StoragedDrive]
Since: 2.1
StoragedBlock * storaged_client_get_block_for_mdraid (StoragedClient *client
,StoragedMDRaid *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
storaged_client_get_all_blocks_for_mdraid()
to get all RAID devices.
Since: 2.1
GList * storaged_client_get_all_blocks_for_mdraid (StoragedClient *client
,StoragedMDRaid *raid
);
Gets all RAID devices (e.g. /dev/md0
and /dev/md1
) for raid
.
This is usually only useful in split-brain
situations — see storaged_client_get_block_for_mdraid()
for
an example — and is normally used only to convey the problem in an
user interface.
A list of StoragedBlock 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 StoragedBlock]
Since: 2.1
GList * storaged_client_get_members_for_mdraid (StoragedClient *client
,StoragedMDRaid *raid
);
Gets the physical block devices that are part of raid
.
A list of StoragedBlock 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 StoragedBlock]
Since: 2.1
StoragedMDRaid * storaged_client_get_mdraid_for_block (StoragedClient *client
,StoragedBlock *block
);
Gets the StoragedMDRaid that block
is the block device for, if any.
A StoragedMDRaid or NULL
if there is no
StoragedMDRaid for block
or block
is not a MD-RAID block
device. Free the returned object with g_object_unref()
.
[transfer full]
Since: 2.1
StoragedObjectInfo * storaged_client_get_object_info (StoragedClient *client
,StoragedObject *object
);
Gets information about a StoragedObject instance that is suitable to present in an user interface. Information is returned in the StoragedObjectInfo object and is localized.
Since: 2.1
void storaged_client_get_drive_info (StoragedClient *client
,StoragedDrive *drive
,gchar **out_name
,gchar **out_description
,GIcon **out_drive_icon
,gchar **out_media_description
,GIcon **out_media_icon
);
storaged_client_get_drive_info
has been deprecated since version 2.1 and should not be used in newly-written code.
Use storaged_client_get_object_info()
instead.
Gets information about a StoragedDrive object that is suitable to present in an user interface. The returned strings are localized.
client |
||
drive |
||
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 * storaged_client_get_partition_info (StoragedClient *client
,StoragedPartition *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 * storaged_client_get_size_for_display (StoragedClient *client
,guint64 size
,gboolean use_pow2
,gboolean long_string
);
Utility function to get a human-readable string that represents size
.
gchar * storaged_client_get_id_for_display (StoragedClient *client
,const gchar *usage
,const gchar *type
,const gchar *version
,gboolean long_string
);
Gets a human readable localized string for usage
, type
and version
.
gchar * storaged_client_get_media_compat_for_display (StoragedClient *client
,const gchar * const *media_compat
);
Gets a human-readable string of the media described by
media_compat
. The returned information is localized.
void
storaged_partition_type_info_free (StoragedPartitionTypeInfo *info
);
Frees info
.
GList * storaged_client_get_partition_type_infos (StoragedClient *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 |
||
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
StoragedPartitionTypeInfo instances. The returned list should be freed
with g_list_free()
after freeing each element with storaged_partition_type_info_free()
.
[transfer full][element-type StoragedPartitionTypeInfo]
const gchar ** storaged_client_get_partition_table_subtypes (StoragedClient *client
,const gchar *partition_table_type
);
Gets all known subtypes for partition_table_type
.
const gchar * storaged_client_get_partition_type_for_display (StoragedClient *client
,const gchar *partition_table_type
,const gchar *partition_type
);
Gets a human readable localized string for partiton_table_type
and partition_type
.
const gchar * storaged_client_get_partition_type_and_subtype_for_display (StoragedClient *client
,const gchar *partition_table_type
,const gchar *partition_table_subtype
,const gchar *partition_type
);
Like storaged_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 |
||
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 * storaged_client_get_partition_table_type_for_display (StoragedClient *client
,const gchar *partition_table_type
);
Gets a human readable localized string for partition_table_type
.
const gchar * storaged_client_get_partition_table_subtype_for_display (StoragedClient *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
.
#define STORAGED_MAJOR_VERSION 2
The major version of the libstoraged header files.
#define STORAGED_MINOR_VERSION 5
The minor version of the libstoraged header files.
#define STORAGED_MICRO_VERSION 3
The micro version of the libstoraged header files.
typedef struct _StoragedClient StoragedClient;
The StoragedClient 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; StoragedPartitionTypeInfoFlags flags; } StoragedPartitionTypeInfo;
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. |
||
Flags from the StoragedPartitionTypeInfoFlags 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” StoragedManager *
The StoragedManager interface on the well-known
/org/storaged/Storaged/Manager
object
Flags: Read
“object-manager”
property “object-manager” GDBusObjectManager *
The GDBusObjectManager used by the StoragedClient instance.
Flags: Read
“changed”
signalvoid user_function (StoragedClient *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 storaged_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