core: add generic "clean" operation to units
This adds basic infrastructure to implement a "clean" operation for unit types. This "clean" operation is supposed to remove on-disk resources of units, and is supposed to be used in a later commit to clean our RuntimeDirectory=, StateDirectory= and so on of service units. Later commits will open this up to the bus, and hook up service units with this. This also adds a new generic ActiveState called UNIT_MAINTENANCE. It's supposed to cover all kinds of "maintainance" state of units. Specifically, this is supposed to cover the "cleaning" operations later added for service units which might take a bit of time. This high-level, generic, abstract state is called UNIT_MAINTENANCE instead of the more specific "UNIT_CLEANING", since I think this should be kept open for different operations possibly later on that could be nicely subsumed under this (for example, maybe a recursive chown()ing operation could be covered by this, and similar).
This commit is contained in:
@@ -132,6 +132,19 @@ typedef struct ExecDirectory {
|
||||
mode_t mode;
|
||||
} ExecDirectory;
|
||||
|
||||
typedef enum ExecCleanMask {
|
||||
/* In case you wonder why the bitmask below doesn't use "directory" in its name: we want to keep this
|
||||
* generic so that .timer timestamp files can nicely be covered by this too, and similar. */
|
||||
EXEC_CLEAN_RUNTIME = 1U << EXEC_DIRECTORY_RUNTIME,
|
||||
EXEC_CLEAN_STATE = 1U << EXEC_DIRECTORY_STATE,
|
||||
EXEC_CLEAN_CACHE = 1U << EXEC_DIRECTORY_CACHE,
|
||||
EXEC_CLEAN_LOGS = 1U << EXEC_DIRECTORY_LOGS,
|
||||
EXEC_CLEAN_CONFIGURATION = 1U << EXEC_DIRECTORY_CONFIGURATION,
|
||||
EXEC_CLEAN_NONE = 0,
|
||||
EXEC_CLEAN_ALL = (1U << _EXEC_DIRECTORY_TYPE_MAX) - 1,
|
||||
_EXEC_CLEAN_MASK_INVALID = -1,
|
||||
} ExecCleanMask;
|
||||
|
||||
/* Encodes configuration parameters applied to invoked commands. Does not carry runtime data, but only configuration
|
||||
* changes sourced from unit files and suchlike. ExecContext objects are usually embedded into Unit objects, and do not
|
||||
* change after being loaded. */
|
||||
|
||||
Reference in New Issue
Block a user