summaryrefslogtreecommitdiff
path: root/src/nspawn
diff options
context:
space:
mode:
authorQuentin Deslandes <qd@naccy.de>2022-09-05 15:42:48 +0100
committerQuentin Deslandes <qd@naccy.de>2022-09-05 15:49:26 +0100
commit1aa18710aff992832cf901c943a21715ee5e65e6 (patch)
tree39cdc4042eef9a08088eafe6b7719c73343d5f50 /src/nspawn
parent11749b6108a942f8c301cb7718fa30436a55f923 (diff)
downloadsystemd-1aa18710aff992832cf901c943a21715ee5e65e6.tar.gz
nspawn: rename RemountIdmapFlags enum to RemountIdmapping
This enum should be used to define various idmapping modes for bind mounts which might be incompatible. Changing its name and the values name to reflect that.
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn-mount.c18
-rw-r--r--src/nspawn/nspawn.c2
2 files changed, 10 insertions, 10 deletions
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c
index d5af73a3cd..5d37204f6c 100644
--- a/src/nspawn/nspawn-mount.c
+++ b/src/nspawn/nspawn-mount.c
@@ -708,10 +708,10 @@ int mount_all(const char *dest,
return 0;
}
-static int parse_mount_bind_options(const char *options, unsigned long *mount_flags, char **mount_opts, bool *idmapped) {
+static int parse_mount_bind_options(const char *options, unsigned long *mount_flags, char **mount_opts, RemountIdmapping *idmapping) {
unsigned long flags = *mount_flags;
char *opts = NULL;
- bool flag_idmapped = *idmapped;
+ RemountIdmapping new_idmapping = *idmapping;
int r;
assert(options);
@@ -730,16 +730,16 @@ static int parse_mount_bind_options(const char *options, unsigned long *mount_fl
else if (streq(word, "norbind"))
flags &= ~MS_REC;
else if (streq(word, "idmap"))
- flag_idmapped = true;
+ new_idmapping = REMOUNT_IDMAPPING_HOST_ROOT;
else if (streq(word, "noidmap"))
- flag_idmapped = false;
+ new_idmapping = REMOUNT_IDMAPPING_NONE;
else
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Invalid bind mount option: %s", word);
}
*mount_flags = flags;
- *idmapped = flag_idmapped;
+ *idmapping = new_idmapping;
/* in the future mount_opts will hold string options for mount(2) */
*mount_opts = opts;
@@ -751,13 +751,13 @@ static int mount_bind(const char *dest, CustomMount *m, uid_t uid_shift, uid_t u
unsigned long mount_flags = MS_BIND | MS_REC;
struct stat source_st, dest_st;
int r;
- bool idmapped = false;
+ RemountIdmapping idmapping = REMOUNT_IDMAPPING_NONE;
assert(dest);
assert(m);
if (m->options) {
- r = parse_mount_bind_options(m->options, &mount_flags, &mount_opts, &idmapped);
+ r = parse_mount_bind_options(m->options, &mount_flags, &mount_opts, &idmapping);
if (r < 0)
return r;
}
@@ -815,8 +815,8 @@ static int mount_bind(const char *dest, CustomMount *m, uid_t uid_shift, uid_t u
return log_error_errno(r, "Read-only bind mount failed: %m");
}
- if (idmapped) {
- r = remount_idmap(where, uid_shift, uid_range, REMOUNT_IDMAP_HOST_ROOT);
+ if (idmapping != REMOUNT_IDMAPPING_NONE) {
+ r = remount_idmap(where, uid_shift, uid_range, idmapping);
if (r < 0)
return log_error_errno(r, "Failed to map ids for bind mount %s: %m", where);
}
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index ca87bffd0b..6316c03916 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -3806,7 +3806,7 @@ static int outer_child(
IN_SET(arg_userns_ownership, USER_NAMESPACE_OWNERSHIP_MAP, USER_NAMESPACE_OWNERSHIP_AUTO) &&
arg_uid_shift != 0) {
- r = remount_idmap(directory, arg_uid_shift, arg_uid_range, REMOUNT_IDMAP_HOST_ROOT);
+ r = remount_idmap(directory, arg_uid_shift, arg_uid_range, REMOUNT_IDMAPPING_HOST_ROOT);
if (r == -EINVAL || ERRNO_IS_NOT_SUPPORTED(r)) {
/* This might fail because the kernel or file system doesn't support idmapping. We
* can't really distinguish this nicely, nor do we have any guarantees about the