| Top | 
| StoragedState * | storaged_state_new () | 
| void | storaged_state_start_cleanup () | 
| void | storaged_state_stop_cleanup () | 
| void | storaged_state_check () | 
| StoragedDaemon * | storaged_state_get_daemon () | 
| void | storaged_state_add_mounted_fs () | 
| gchar * | storaged_state_find_mounted_fs () | 
| void | storaged_state_add_unlocked_luks () | 
| dev_t | storaged_state_find_unlocked_luks () | 
| void | storaged_state_add_loop () | 
| gboolean | storaged_state_has_loop () | 
| void | storaged_state_add_mdraid () | 
| gboolean | storaged_state_has_mdraid () | 
This type is used for recording actions done by users and cleaning up when devices set up via the storaged interfaces are removed while still in use - for example, a USB stick being yanked.
The following files are used:
Table 3. Persistent information and state
| File | Usage | 
|---|---|
/run/storaged/mounted-fs | 
          A serialized 'a{sa{sv}}' GVariant mapping from the
          mount point (e.g. /media/EOS_DIGITAL) into a set of details.
          Known details include
          block-device
          (of type 't') that is the dev_t
          for the mounted device,
          mounted-by-uid
          (of type 'u') that is the uid_t
          of the user who mounted the device, and
          fstab-mount
          (of type 'b') that is TRUE
          if the device was mounted via an entry in /etc/fstab.
         | 
/run/storaged/unlocked-luks | 
          A serialized 'a{ta{sv}}' GVariant mapping from the
          dev_t of the clear-text device (e.g. /dev/dm-0) into a set of details.
          Known details include
          crypto-device
          (of type 't') that is the dev_t
          for the crypto-text device,
          dm-uuid
          (of type 'ay') that is the device mapper UUID
          for the clear-text device and
          unlocked-by-uid
          (of type 'u') that is the uid_t
          of the user who unlocked the device.
         | 
/run/storaged/loop | 
          A serialized 'a{sa{sv}}' GVariant mapping from the
          loop device name (e.g. /dev/loop0) into a set of details.
          Known details include
          backing-file
          (of type 'ay') for the name of the backing file and
          backing-file-device
          (of type 't') for the dev_t
          for of the device holding the backing file (or 0 if unknown) and
          setup-by-uid
          (of type 'u') that is the uid_t
          of the user who set up the loop device.
         | 
/run/storaged/mdraid | 
          A serialized 'a{ta{sv}}' GVariant mapping from the
          dev_t of the raid device (e.g. /dev/md127) into a set of details.
          Known details include
          started-by-uid
          (of type 'u') that is the uid_t
          of the user who started the array.
         | 
Cleaning up is implemented by running a thread (to ensure that
actions are serialized) that checks all data in the files mentioned
above and cleans up the entry in question by e.g. unmounting a
filesystem, removing a mount point or tearing down a device-mapper
device when needed. The clean-up thread itself needs to be manually
kicked using e.g. storaged_state_check() from suitable places in
the StoragedDaemon and StoragedProvider implementations.
Since cleaning up is only necessary when a device has been removed without having been properly stopped or shut down, the fact that it was cleaned up is logged to ensure that the information is brought to the attention of the system administrator.
StoragedState *
storaged_state_new (StoragedDaemon *daemon);
Creates a new StoragedState object.
void
storaged_state_start_cleanup (StoragedState *state);
Starts the clean-up thread.
The clean-up thread will hold a reference to state
 for as long as
it's running - use storaged_state_stop_cleanup() to stop it.
void
storaged_state_stop_cleanup (StoragedState *state);
Stops the clean-up thread. Blocks the calling thread until it has stopped.
void
storaged_state_check (StoragedState *state);
Causes the clean-up thread for state
 to check if anything should be cleaned up.
This can be called from any thread and will not block the calling thread.
StoragedDaemon *
storaged_state_get_daemon (StoragedState *state);
Gets the daemon used by state
.
void storaged_state_add_mounted_fs (StoragedState *state,const gchar *mount_point,dev_t block_device,uid_t uid,gboolean fstab_mount);
Adds a new entry to the
/run/storaged/mounted-fs file.
gchar * storaged_state_find_mounted_fs (StoragedState *state,dev_t block_device,uid_t *out_uid,gboolean *out_fstab_mount);
Gets the mount point for block_device
, if it exists in the
/run/storaged/mounted-fs file.
void storaged_state_add_unlocked_luks (StoragedState *state,dev_t cleartext_device,dev_t crypto_device,const gchar *dm_uuid,uid_t uid);
Adds a new entry to the
/run/storaged/unlocked-luks file.
dev_t storaged_state_find_unlocked_luks (StoragedState *state,dev_t crypto_device,uid_t *out_uid);
Gets the clear-text device for crypto_device
, if it exists in the
/run/storaged/unlocked-luks file.
void storaged_state_add_loop (StoragedState *state,const gchar *device_file,const gchar *backing_file,dev_t backing_file_device,uid_t uid);
Adds a new entry to the /run/storaged/loop
file.
gboolean storaged_state_has_loop (StoragedState *state,const gchar *device_file,uid_t *out_uid);
Checks if device_file
 is set up via storaged.
void storaged_state_add_mdraid (StoragedState *state,dev_t raid_device,uid_t uid);
Adds a new entry to the /run/storaged/mdraid
file.
gboolean storaged_state_has_mdraid (StoragedState *state,dev_t raid_device,uid_t *out_uid);
Checks if raid_device
 is set up via storaged.
typedef struct _StoragedState StoragedState;
The StoragedState structure contains only private data and should only be accessed using the provided API.
“daemon” property“daemon” StoragedDaemon *
The StoragedDaemon object.
Flags: Read / Write / Construct Only