StoragedDaemon

StoragedDaemon — Main daemon object

Synopsis

                    StoragedDaemon;
StoragedDaemon *    storaged_daemon_new                 (GDBusConnection *connection,
                                                         gboolean disable_modules,
                                                         gboolean force_load_modules,
                                                         gboolean uninstalled);
GDBusConnection *   storaged_daemon_get_connection      (StoragedDaemon *daemon);
GDBusObjectManagerServer * storaged_daemon_get_object_manager
                                                        (StoragedDaemon *daemon);
StoragedMountMonitor * storaged_daemon_get_mount_monitor
                                                        (StoragedDaemon *daemon);
StoragedFstabMonitor * storaged_daemon_get_fstab_monitor
                                                        (StoragedDaemon *daemon);
StoragedCrypttabMonitor * storaged_daemon_get_crypttab_monitor
                                                        (StoragedDaemon *daemon);
StoragedLinuxProvider * storaged_daemon_get_linux_provider
                                                        (StoragedDaemon *daemon);
PolkitAuthority *   storaged_daemon_get_authority       (StoragedDaemon *daemon);
StoragedState *     storaged_daemon_get_state           (StoragedDaemon *daemon);
StoragedObject *    (*StoragedDaemonWaitFunc)           (StoragedDaemon *daemon,
                                                         gpointer user_data);
StoragedObject *    storaged_daemon_wait_for_object_sync
                                                        (StoragedDaemon *daemon,
                                                         StoragedDaemonWaitFunc wait_func,
                                                         gpointer user_data,
                                                         GDestroyNotify user_data_free_func,
                                                         guint timeout_seconds,
                                                         GError **error);
GList *             storaged_daemon_get_objects         (StoragedDaemon *daemon);
StoragedObject *    storaged_daemon_find_object         (StoragedDaemon *daemon,
                                                         const gchar *object_path);
StoragedObject *    storaged_daemon_find_block          (StoragedDaemon *daemon,
                                                         dev_t block_device_number);
StoragedObject *    storaged_daemon_find_block_by_device_file
                                                        (StoragedDaemon *daemon,
                                                         const gchar *device_file);
StoragedObject *    storaged_daemon_find_block_by_sysfs_path
                                                        (StoragedDaemon *daemon,
                                                         const gchar *sysfs_path);
StoragedBaseJob *   storaged_daemon_launch_simple_job   (StoragedDaemon *daemon,
                                                         StoragedObject *object,
                                                         const gchar *job_operation,
                                                         uid_t job_started_by_uid,
                                                         GCancellable *cancellable);
StoragedBaseJob *   storaged_daemon_launch_spawned_job  (StoragedDaemon *daemon,
                                                         StoragedObject *object,
                                                         const gchar *job_operation,
                                                         uid_t job_started_by_uid,
                                                         GCancellable *cancellable,
                                                         uid_t run_as_uid,
                                                         uid_t run_as_euid,
                                                         const gchar *input_string,
                                                         const gchar *command_line_format,
                                                         ...);
gboolean            storaged_daemon_launch_spawned_job_sync
                                                        (StoragedDaemon *daemon,
                                                         StoragedObject *object,
                                                         const gchar *job_operation,
                                                         uid_t job_started_by_uid,
                                                         GCancellable *cancellable,
                                                         uid_t run_as_uid,
                                                         uid_t run_as_euid,
                                                         gint *out_status,
                                                         gchar **out_message,
                                                         const gchar *input_string,
                                                         const gchar *command_line_format,
                                                         ...);
StoragedBaseJob *   storaged_daemon_launch_threaded_job (StoragedDaemon *daemon,
                                                         StoragedObject *object,
                                                         const gchar *job_operation,
                                                         uid_t job_started_by_uid,
                                                         StoragedThreadedJobFunc job_func,
                                                         gpointer user_data,
                                                         GDestroyNotify user_data_free_func,
                                                         GCancellable *cancellable);
gboolean            storaged_daemon_get_disable_modules (StoragedDaemon *daemon);
gboolean            storaged_daemon_get_force_load_modules
                                                        (StoragedDaemon *daemon);
StoragedModuleManager * storaged_daemon_get_module_manager
                                                        (StoragedDaemon *daemon);

Object Hierarchy

  GObject
   +----StoragedDaemon

Properties

  "connection"               GDBusConnection*      : Read / Write / Construct Only
  "disable-modules"          gboolean              : Read / Write / Construct Only
  "force-load-modules"       gboolean              : Read / Write / Construct Only
  "mount-monitor"            StoragedMountMonitor*  : Read
  "object-manager"           GDBusObjectManagerServer*  : Read
  "uninstalled"              gboolean              : Read / Write / Construct Only

Description

Object holding all global state.

Details

StoragedDaemon

typedef struct _StoragedDaemon StoragedDaemon;

The StoragedDaemon structure contains only private data and should only be accessed using the provided API.


storaged_daemon_new ()

StoragedDaemon *    storaged_daemon_new                 (GDBusConnection *connection,
                                                         gboolean disable_modules,
                                                         gboolean force_load_modules,
                                                         gboolean uninstalled);

Create a new daemon object for exporting objects on connection.

connection :

A GDBusConnection.

disable_modules :

Indicates whether modules should never be activated.

force_load_modules :

Activate modules on startup (for debugging purposes).

uninstalled :

Loads modules from the build directory (for debugging purposes).

Returns :

A StoragedDaemon object. Free with g_object_unref().

storaged_daemon_get_connection ()

GDBusConnection *   storaged_daemon_get_connection      (StoragedDaemon *daemon);

Gets the D-Bus connection used by daemon.

daemon :

A StoragedDaemon.

Returns :

A GDBusConnection. Do not free, the object is owned by daemon.

storaged_daemon_get_object_manager ()

GDBusObjectManagerServer * storaged_daemon_get_object_manager
                                                        (StoragedDaemon *daemon);

Gets the D-Bus object manager used by daemon.

daemon :

A StoragedDaemon.

Returns :

A GDBusObjectManagerServer. Do not free, the object is owned by daemon.

storaged_daemon_get_mount_monitor ()

StoragedMountMonitor * storaged_daemon_get_mount_monitor
                                                        (StoragedDaemon *daemon);

Gets the mount monitor used by daemon.

daemon :

A StoragedDaemon

Returns :

A StoragedMountMonitor. Do not free, the object is owned by daemon.

storaged_daemon_get_fstab_monitor ()

StoragedFstabMonitor * storaged_daemon_get_fstab_monitor
                                                        (StoragedDaemon *daemon);

Gets the fstab monitor used by daemon.

daemon :

A StoragedDaemon

Returns :

A StoragedFstabMonitor. Do not free, the object is owned by daemon.

storaged_daemon_get_crypttab_monitor ()

StoragedCrypttabMonitor * storaged_daemon_get_crypttab_monitor
                                                        (StoragedDaemon *daemon);

Gets the crypttab monitor used by daemon.

daemon :

A StoragedDaemon

Returns :

A StoragedCrypttabMonitor. Do not free, the object is owned by daemon.

storaged_daemon_get_linux_provider ()

StoragedLinuxProvider * storaged_daemon_get_linux_provider
                                                        (StoragedDaemon *daemon);

Gets the Linux Provider, if any.

daemon :

A StoragedDaemon.

Returns :

A StoragedLinuxProvider or NULL. Do not free, the object is owned by daemon.

storaged_daemon_get_authority ()

PolkitAuthority *   storaged_daemon_get_authority       (StoragedDaemon *daemon);

Gets the PolicyKit authority used by daemon.

daemon :

A StoragedDaemon.

Returns :

A PolkitAuthority instance or NULL if the polkit authority is not available. Do not free, the object is owned by daemon.

storaged_daemon_get_state ()

StoragedState *     storaged_daemon_get_state           (StoragedDaemon *daemon);

Gets the state object used by daemon.

daemon :

A StoragedDaemon.

Returns :

A StoragedState instance. Do not free, the object is owned by daemon.

StoragedDaemonWaitFunc ()

StoragedObject *    (*StoragedDaemonWaitFunc)           (StoragedDaemon *daemon,
                                                         gpointer user_data);

Type for callback function used with storaged_daemon_wait_for_object_sync().

daemon :

A StoragedDaemon.

user_data :

The gpointer passed to storaged_daemon_wait_for_object_sync().

Returns :

NULL if the object to wait for was not found, otherwise a full reference to a StoragedObject. [transfer full]

storaged_daemon_wait_for_object_sync ()

StoragedObject *    storaged_daemon_wait_for_object_sync
                                                        (StoragedDaemon *daemon,
                                                         StoragedDaemonWaitFunc wait_func,
                                                         gpointer user_data,
                                                         GDestroyNotify user_data_free_func,
                                                         guint timeout_seconds,
                                                         GError **error);

Blocks the calling thread until an object picked by wait_func is available or until timeout_seconds has passed (in which case the function fails with STORAGED_ERROR_TIMED_OUT).

Note that wait_func will be called from time to time - for example if there is a device event.

daemon :

A StoragedDaemon.

wait_func :

Function to check for desired object.

user_data :

User data to pass to wait_func.

user_data_free_func :

Function to free user_data or NULL. [allow-none]

timeout_seconds :

Maximum time to wait for the object (in seconds) or 0 to never wait.

error :

Return location for error or NULL. [allow-none]

Returns :

The object picked by wait_func or NULL if error is set. [transfer full]

storaged_daemon_get_objects ()

GList *             storaged_daemon_get_objects         (StoragedDaemon *daemon);

Gets all D-Bus objects exported by daemon.

daemon :

A StoragedDaemon.

Returns :

A list of StoragedObject instaces. The returned list should be freed with g_list_free() after each element has been freed with g_object_unref(). [transfer full][element-type StoragedObject]

storaged_daemon_find_object ()

StoragedObject *    storaged_daemon_find_object         (StoragedDaemon *daemon,
                                                         const gchar *object_path);

Finds an exported object with the object path given by object_path.

daemon :

A StoragedDaemon.

object_path :

A dev_t with the device number to find.

Returns :

A StoragedObject or NULL if not found. Free with g_object_unref(). [transfer full]

storaged_daemon_find_block ()

StoragedObject *    storaged_daemon_find_block          (StoragedDaemon *daemon,
                                                         dev_t block_device_number);

Finds a block device with the number given by block_device_number.

daemon :

A StoragedDaemon.

block_device_number :

A dev_t with the device number to find.

Returns :

A StoragedObject or NULL if not found. Free with g_object_unref(). [transfer full]

storaged_daemon_find_block_by_device_file ()

StoragedObject *    storaged_daemon_find_block_by_device_file
                                                        (StoragedDaemon *daemon,
                                                         const gchar *device_file);

Finds a block device with device file given by device_file.

daemon :

A StoragedDaemon.

device_file :

A device file.

Returns :

A StoragedObject or NULL if not found. Free with g_object_unref(). [transfer full]

storaged_daemon_find_block_by_sysfs_path ()

StoragedObject *    storaged_daemon_find_block_by_sysfs_path
                                                        (StoragedDaemon *daemon,
                                                         const gchar *sysfs_path);

Finds a block device with a sysfs path given by sysfs_path.

daemon :

A StoragedDaemon.

sysfs_path :

A sysfs path.

Returns :

A StoragedObject or NULL if not found. Free with g_object_unref(). [transfer full]

storaged_daemon_launch_simple_job ()

StoragedBaseJob *   storaged_daemon_launch_simple_job   (StoragedDaemon *daemon,
                                                         StoragedObject *object,
                                                         const gchar *job_operation,
                                                         uid_t job_started_by_uid,
                                                         GCancellable *cancellable);

Launches a new simple job.

The job is started immediately - When the job is done, call storaged_simple_job_complete() on the returned object. Long-running jobs should periodically check cancellable to see if they have been cancelled.

The returned object will be exported on the bus until the "completed" signal is emitted on the object. It is not valid to use the returned object after this signal fires.

daemon :

A StoragedDaemon.

object :

A StoragedObject to add to the job or NULL. [allow-none]

job_operation :

The operation for the job.

job_started_by_uid :

The user who started the job.

cancellable :

A GCancellable or NULL.

Returns :

A StoragedSimpleJob object. Do not free, the object belongs to manager.

storaged_daemon_launch_spawned_job ()

StoragedBaseJob *   storaged_daemon_launch_spawned_job  (StoragedDaemon *daemon,
                                                         StoragedObject *object,
                                                         const gchar *job_operation,
                                                         uid_t job_started_by_uid,
                                                         GCancellable *cancellable,
                                                         uid_t run_as_uid,
                                                         uid_t run_as_euid,
                                                         const gchar *input_string,
                                                         const gchar *command_line_format,
                                                         ...);

Launches a new job for command_line_format.

The job is started immediately - connect to the "spawned-job-completed" or "completed" signals to get notified when the job is done.

The returned object will be exported on the bus until the "completed" signal is emitted on the object. It is not valid to use the returned object after this signal fires.

daemon :

A StoragedDaemon.

object :

A StoragedObject to add to the job or NULL. [allow-none]

job_operation :

The operation for the job.

job_started_by_uid :

The user who started the job.

cancellable :

A GCancellable or NULL.

run_as_uid :

The uid_t to run the command as.

run_as_euid :

The effective uid_t to run the command as.

input_string :

A string to write to stdin of the spawned program or NULL.

command_line_format :

printf()-style format for the command line to spawn.

... :

Arguments for command_line_format.

Returns :

A StoragedSpawnedJob object. Do not free, the object belongs to manager.

storaged_daemon_launch_spawned_job_sync ()

gboolean            storaged_daemon_launch_spawned_job_sync
                                                        (StoragedDaemon *daemon,
                                                         StoragedObject *object,
                                                         const gchar *job_operation,
                                                         uid_t job_started_by_uid,
                                                         GCancellable *cancellable,
                                                         uid_t run_as_uid,
                                                         uid_t run_as_euid,
                                                         gint *out_status,
                                                         gchar **out_message,
                                                         const gchar *input_string,
                                                         const gchar *command_line_format,
                                                         ...);

Like storaged_daemon_launch_spawned_job() but blocks the calling thread until the job completes.

daemon :

A StoragedDaemon.

object :

A StoragedObject to add to the job or NULL. [allow-none]

job_operation :

The operation for the job.

job_started_by_uid :

The user who started the job.

cancellable :

A GCancellable or NULL.

run_as_uid :

The uid_t to run the command as.

run_as_euid :

The effective uid_t to run the command as.

input_string :

A string to write to stdin of the spawned program or NULL.

out_status :

Return location for the status parameter of the "spawned-job-completed" signal.

out_message :

Return location for the message parameter of the "completed" signal.

command_line_format :

printf()-style format for the command line to spawn.

... :

Arguments for command_line_format.

Returns :

The success parameter of the "completed" signal.

storaged_daemon_launch_threaded_job ()

StoragedBaseJob *   storaged_daemon_launch_threaded_job (StoragedDaemon *daemon,
                                                         StoragedObject *object,
                                                         const gchar *job_operation,
                                                         uid_t job_started_by_uid,
                                                         StoragedThreadedJobFunc job_func,
                                                         gpointer user_data,
                                                         GDestroyNotify user_data_free_func,
                                                         GCancellable *cancellable);

Launches a new job by running job_func in a new dedicated thread.

The job is started immediately - connect to the "threaded-job-completed" or "completed" signals to get notified when the job is done.

Long-running jobs should periodically check cancellable to see if they have been cancelled.

The returned object will be exported on the bus until the "completed" signal is emitted on the object. It is not valid to use the returned object after this signal fires.

daemon :

A StoragedDaemon.

object :

A StoragedObject to add to the job or NULL. [allow-none]

job_operation :

The operation for the job.

job_started_by_uid :

The user who started the job.

job_func :

The function to run in another thread.

user_data :

User data to pass to job_func.

user_data_free_func :

Function to free user_data with or NULL.

cancellable :

A GCancellable or NULL.

Returns :

A StoragedThreadedJob object. Do not free, the object belongs to manager.

storaged_daemon_get_disable_modules ()

gboolean            storaged_daemon_get_disable_modules (StoragedDaemon *daemon);

Gets daemon setting whether modules should never be loaded.

daemon :

A StoragedDaemon.

Returns :

TRUE if --disable-modules commandline switch has been specified.

storaged_daemon_get_force_load_modules ()

gboolean            storaged_daemon_get_force_load_modules
                                                        (StoragedDaemon *daemon);

Gets daemon setting whether modules should be activated upon start.

daemon :

A StoragedDaemon.

Returns :

TRUE if --force-load-modules commandline switch has been specified.

storaged_daemon_get_module_manager ()

StoragedModuleManager * storaged_daemon_get_module_manager
                                                        (StoragedDaemon *daemon);

Gets the module manager used by daemon.

daemon :

A StoragedDaemon.

Returns :

A StoragedModuleManager. Do not free, the object is owned by daemon.

Property Details

The "connection" property

  "connection"               GDBusConnection*      : Read / Write / Construct Only

The GDBusConnection the daemon is for.


The "disable-modules" property

  "disable-modules"          gboolean              : Read / Write / Construct Only

Whether modules should be disabled

Default value: FALSE


The "force-load-modules" property

  "force-load-modules"       gboolean              : Read / Write / Construct Only

Whether modules should be activated upon startup

Default value: FALSE


The "mount-monitor" property

  "mount-monitor"            StoragedMountMonitor*  : Read

The StoragedMountMonitor used by the daemon


The "object-manager" property

  "object-manager"           GDBusObjectManagerServer*  : Read

The GDBusObjectManager used by the daemon


The "uninstalled" property

  "uninstalled"              gboolean              : Read / Write / Construct Only

Loads modules from the build directory.

Default value: FALSE