mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 13:47:41 +00:00
conf: switch to parse_mount_attrs() even for legacy mount()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
6b48a57529
commit
2ff1170b42
@ -2331,43 +2331,6 @@ int parse_mount_attrs(struct lxc_mount_options *opts, const char *mntopts)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_propagationopt(char *opt, unsigned long *flags)
|
|
||||||
{
|
|
||||||
struct mount_opt *mo;
|
|
||||||
|
|
||||||
/* If opt is found in propagation_opt, set or clear flags. */
|
|
||||||
for (mo = &propagation_opt[0]; mo->name != NULL; mo++) {
|
|
||||||
if (!strnequal(opt, mo->name, strlen(mo->name)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (mo->clear)
|
|
||||||
*flags &= ~mo->legacy_flag;
|
|
||||||
else
|
|
||||||
*flags |= mo->legacy_flag;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int parse_propagationopts(const char *mntopts, unsigned long *pflags)
|
|
||||||
{
|
|
||||||
__do_free char *s = NULL;
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
if (!mntopts)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
s = strdup(mntopts);
|
|
||||||
if (!s)
|
|
||||||
return log_error_errno(-ENOMEM, errno, "Failed to allocate memory");
|
|
||||||
|
|
||||||
*pflags = 0L;
|
|
||||||
lxc_iterate_parts(p, s, ",")
|
|
||||||
parse_propagationopt(p, pflags);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void null_endofword(char *word)
|
static void null_endofword(char *word)
|
||||||
{
|
{
|
||||||
while (*word && *word != ' ' && *word != '\t')
|
while (*word && *word != ' ' && *word != '\t')
|
||||||
@ -2619,7 +2582,6 @@ static inline int mount_entry_on_generic(struct mntent *mntent,
|
|||||||
const char *lxc_path)
|
const char *lxc_path)
|
||||||
{
|
{
|
||||||
__do_free char *mntdata = NULL;
|
__do_free char *mntdata = NULL;
|
||||||
unsigned long mntflags = 0, pflags = 0;
|
|
||||||
char *rootfs_path = NULL;
|
char *rootfs_path = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
bool dev, optional, relative;
|
bool dev, optional, relative;
|
||||||
@ -2655,16 +2617,20 @@ static inline int mount_entry_on_generic(struct mntent *mntent,
|
|||||||
if (!is_empty_string(opts.userns_path))
|
if (!is_empty_string(opts.userns_path))
|
||||||
return systrace_ret(0, "Skipping idmapped mount entry");
|
return systrace_ret(0, "Skipping idmapped mount entry");
|
||||||
|
|
||||||
ret = parse_propagationopts(mntent->mnt_opts, &pflags);
|
ret = parse_mount_attrs(&opts, mntent->mnt_opts);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = parse_mntopts_legacy(mntent->mnt_opts, &mntflags, &mntdata);
|
ret = mount_entry(mntent->mnt_fsname,
|
||||||
if (ret < 0)
|
path,
|
||||||
return ret;
|
mntent->mnt_type,
|
||||||
|
opts.mnt_flags,
|
||||||
ret = mount_entry(mntent->mnt_fsname, path, mntent->mnt_type, mntflags,
|
opts.prop_flags,
|
||||||
pflags, mntdata, optional, dev, relative, rootfs_path);
|
opts.data,
|
||||||
|
optional,
|
||||||
|
dev,
|
||||||
|
relative,
|
||||||
|
rootfs_path);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user