![]() |
![]() |
![]() |
UDisks Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
gchar * udisks_decode_udev_string (const gchar *str
); void udisks_safe_append_to_object_path (GString *str
,const gchar *s
); guint64 udisks_daemon_util_block_get_size (GUdevDevice *device
,gboolean *out_media_available
,gboolean *out_media_change_detected
); gchar * udisks_daemon_util_resolve_link (const gchar *path
,const gchar *name
); gchar ** udisks_daemon_util_resolve_links (const gchar *path
,const gchar *dir_name
); gboolean udisks_daemon_util_check_authorization_sync (UDisksDaemon *daemon
,UDisksObject *object
,const gchar *action_id
,GVariant *options
,const gchar *message
,GDBusMethodInvocation *invocation
); gboolean udisks_daemon_util_get_caller_uid_sync (UDisksDaemon *daemon
,GDBusMethodInvocation *invocation
,GCancellable *cancellable
,uid_t *out_uid
,gid_t *out_gid
,gchar **out_user_name
,GError **error
); gboolean udisks_daemon_util_get_caller_pid_sync (UDisksDaemon *daemon
,GDBusMethodInvocation *invocation
,GCancellable *cancellable
,pid_t *out_pid
,GError **error
); gboolean udisks_daemon_util_setup_by_user (UDisksDaemon *daemon
,UDisksObject *object
,uid_t user
); gpointer udisks_daemon_util_dup_object (gpointer interface_
,GError **error
); gchar * udisks_daemon_util_escape (const gchar *str
); gchar * udisks_daemon_util_escape_and_quote (const gchar *str
);
gchar * udisks_decode_udev_string (const gchar *str
);
Unescapes sequences like \x20 to " " and ensures the returned string is valid UTF-8.
If the string is not valid UTF-8, try as hard as possible to convert to UTF-8.
If NULL
is passed, then NULL
is returned.
See udev_util_encode_string()
in libudev/libudev-util.c in the udev
tree for what kinds of strings can be used.
void udisks_safe_append_to_object_path (GString *str
,const gchar *s
);
Appends s
to str
in a way such that only characters that can be
used in a D-Bus object path will be used. E.g. a character not in
[A-Z][a-z][0-9]_
will be escaped as _HEX where
HEX is a two-digit hexadecimal number.
Note that his mapping is not bijective - e.g. you cannot go back to the original string.
|
A GString to append to. |
|
A UTF-8 string. |
guint64 udisks_daemon_util_block_get_size (GUdevDevice *device
,gboolean *out_media_available
,gboolean *out_media_change_detected
);
Gets the size of the device
top-level block device, checking for media in the process
|
A GUdevDevice for a top-level block device. |
|
Return location for whether media is available or NULL . [out]
|
|
Return location for whether media change is detected or NULL . [out]
|
Returns : |
The size of device or 0 if no media is available or if unknown.
|
gchar * udisks_daemon_util_resolve_link (const gchar *path
,const gchar *name
);
Resolves the symlink path
/name
.
gchar ** udisks_daemon_util_resolve_links (const gchar *path
,const gchar *dir_name
);
Resolves all symlinks in path
/dir_name
. This can be used to
easily walk e.g. holders or slaves of block devices.
|
A path |
|
Name of a directory in path holding symlinks.
|
Returns : |
An array of canonicalized absolute pathnames. Free with g_strfreev() .
|
gboolean udisks_daemon_util_check_authorization_sync (UDisksDaemon *daemon
,UDisksObject *object
,const gchar *action_id
,GVariant *options
,const gchar *message
,GDBusMethodInvocation *invocation
);
Checks if the caller represented by invocation
is authorized for
the action identified by action_id
, optionally displaying message
if authentication is needed. Additionally, if the caller is not
authorized, the appropriate error is already returned to the caller
via invocation
.
The calling thread is blocked for the duration of the
authentication which may be a very long time unless
auth_no_user_interaction
is TRUE
.
The follow variables can be used in message
- udisks2.device - If object
has a UDisksBlock interface, this property is set to the value of the "preferred-device" property.
|
A UDisksDaemon. |
|
The GDBusObject that the call is on or NULL . [allow-none]
|
|
The action id to check for. |
|
A GVariant to check for the auth.no_user_interaction option or NULL . [allow-none]
|
|
The message to convey (use N_). |
|
The invocation to check for. |
Returns : |
TRUE if caller is authorized, FALSE if not.
|
gboolean udisks_daemon_util_get_caller_uid_sync (UDisksDaemon *daemon
,GDBusMethodInvocation *invocation
,GCancellable *cancellable
,uid_t *out_uid
,gid_t *out_gid
,gchar **out_user_name
,GError **error
);
Gets the UNIX user id (and possibly group id and user name) of the
peer represented by invocation
.
|
A UDisksDaemon. |
|
A GDBusMethodInvocation. |
|
A GCancellable or NULL . [allow-none]
|
|
Return location for resolved uid or NULL . [out]
|
|
Return location for resolved gid or NULL . [out][allow-none]
|
|
Return location for resolved user name or NULL . [out][allow-none]
|
|
Return location for error. |
Returns : |
TRUE if the user id (and possibly group id) was obtained, FALSE otherwise
|
gboolean udisks_daemon_util_get_caller_pid_sync (UDisksDaemon *daemon
,GDBusMethodInvocation *invocation
,GCancellable *cancellable
,pid_t *out_pid
,GError **error
);
Gets the UNIX process id of the peer represented by invocation
.
|
A UDisksDaemon. |
|
A GDBusMethodInvocation. |
|
A GCancellable or NULL . [allow-none]
|
|
Return location for resolved pid or NULL . [out]
|
|
Return location for error. |
Returns : |
TRUE if the process id was obtained, FALSE otherwise
|
gboolean udisks_daemon_util_setup_by_user (UDisksDaemon *daemon
,UDisksObject *object
,uid_t user
);
Checks whether the device represented by object
(if any) has been
setup by user
.
|
A UDisksDaemon. |
|
The GDBusObject that the call is on or NULL .
|
|
The user in question. |
Returns : |
TRUE if object has been set-up by user , FALSE if not.
|
gpointer udisks_daemon_util_dup_object (gpointer interface_
,GError **error
);
Gets the enclosing UDisksObject for interface
, if any.
|
A GDBusInterface-derived instance. [type GDBusInterface] |
|
NULL , or an unset GError to set if the return value is NULL .
|
Returns : |
Either NULL or a
UDisksObject-derived instance that must be released with
g_object_unref() . [transfer full][type UDisksObject]
|
gchar * udisks_daemon_util_escape (const gchar *str
);
Escapes double-quotes (") and back-slashes (\) in a string using back-slash (\).
|
The string to escape. |
Returns : |
The escaped string. Free with g_free() .
|
gchar * udisks_daemon_util_escape_and_quote (const gchar *str
);
Like udisks_daemon_util_escape()
but also wraps the result in
double-quotes.
|
The string to escape. |
Returns : |
The double-quoted and escaped string. Free with g_free() .
|