nspawn: split out VolatileMode definitions
This moves the VolatileMode enum and its helper functions to src/shared/. This is useful to then reuse them to implement systemd.volatile= in a later commit.
This commit is contained in:
@@ -1349,21 +1349,3 @@ fail:
|
||||
(void) rmdir(template);
|
||||
return r;
|
||||
}
|
||||
|
||||
VolatileMode volatile_mode_from_string(const char *s) {
|
||||
int b;
|
||||
|
||||
if (isempty(s))
|
||||
return _VOLATILE_MODE_INVALID;
|
||||
|
||||
b = parse_boolean(s);
|
||||
if (b > 0)
|
||||
return VOLATILE_YES;
|
||||
if (b == 0)
|
||||
return VOLATILE_NO;
|
||||
|
||||
if (streq(s, "state"))
|
||||
return VOLATILE_STATE;
|
||||
|
||||
return _VOLATILE_MODE_INVALID;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "cgroup-util.h"
|
||||
#include "volatile-util.h"
|
||||
|
||||
typedef enum MountSettingsMask {
|
||||
MOUNT_FATAL = 1 << 0, /* if set, a mount error is considered fatal */
|
||||
@@ -32,14 +33,6 @@ typedef enum MountSettingsMask {
|
||||
Works only if MOUNT_APPLY_APIVFS_RO is also set. */
|
||||
} MountSettingsMask;
|
||||
|
||||
typedef enum VolatileMode {
|
||||
VOLATILE_NO,
|
||||
VOLATILE_YES,
|
||||
VOLATILE_STATE,
|
||||
_VOLATILE_MODE_MAX,
|
||||
_VOLATILE_MODE_INVALID = -1
|
||||
} VolatileMode;
|
||||
|
||||
typedef enum CustomMountType {
|
||||
CUSTOM_MOUNT_BIND,
|
||||
CUSTOM_MOUNT_TMPFS,
|
||||
@@ -77,5 +70,3 @@ int mount_custom(const char *dest, CustomMount *mounts, unsigned n, bool userns,
|
||||
|
||||
int setup_volatile(const char *directory, VolatileMode mode, bool userns, uid_t uid_shift, uid_t uid_range, const char *selinux_apifs_context);
|
||||
int setup_volatile_state(const char *directory, VolatileMode mode, bool userns, uid_t uid_shift, uid_t uid_range, const char *selinux_apifs_context);
|
||||
|
||||
VolatileMode volatile_mode_from_string(const char *s);
|
||||
|
||||
Reference in New Issue
Block a user