rootfs: remove "options" member

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2021-08-26 10:25:48 +02:00
parent 091f611c7c
commit e73af35bba
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D
4 changed files with 8 additions and 10 deletions

View File

@ -512,7 +512,7 @@ int lxc_storage_prepare(struct lxc_conf *conf)
if (!rootfs->storage)
return log_error(-1, "Failed to mount rootfs \"%s\" onto \"%s\" with options \"%s\"",
rootfs->path, rootfs->mount,
rootfs->options ? rootfs->options : "(null)");
rootfs->mnt_opts.raw_options ? rootfs->mnt_opts.raw_options : "(null)");
return 0;
}
@ -1425,11 +1425,11 @@ static int lxc_mount_rootfs(struct lxc_rootfs *rootfs)
if (ret < 0)
return log_error(-1, "Failed to mount rootfs \"%s\" onto \"%s\" with options \"%s\"",
rootfs->path, rootfs->mount,
rootfs->options ? rootfs->options : "(null)");
rootfs->mnt_opts.raw_options ? rootfs->mnt_opts.raw_options : "(null)");
DEBUG("Mounted rootfs \"%s\" onto \"%s\" with options \"%s\"",
rootfs->path, rootfs->mount,
rootfs->options ? rootfs->options : "(null)");
rootfs->mnt_opts.raw_options ? rootfs->mnt_opts.raw_options : "(null)");
rootfs->dfd_mnt = open_at(-EBADF, rootfs->mount, PROTECT_OPATH_DIRECTORY, PROTECT_LOOKUP_ABSOLUTE_XDEV, 0);
if (rootfs->dfd_mnt < 0)
@ -4791,7 +4791,6 @@ void lxc_conf_free(struct lxc_conf *conf)
lxc_terminal_conf_free(&conf->console);
free(conf->rootfs.mount);
free(conf->rootfs.bdev_type);
free(conf->rootfs.options);
free(conf->rootfs.path);
put_lxc_rootfs(&conf->rootfs, true);
free(conf->logfile);

View File

@ -218,6 +218,7 @@ struct lxc_mount_options {
unsigned long prop_flags;
char *data;
struct lxc_mount_attr attr;
char *raw_options;
};
/* Defines a structure to store the rootfs location, the
@ -226,7 +227,6 @@ struct lxc_mount_options {
* @mount : where it is mounted
* @buf : static buffer to construct paths
* @bev_type : optional backing store type
* @options : mount options
* @managed : whether it is managed by LXC
* @dfd_mnt : fd for @mount
* @dfd_dev : fd for /dev of the container
@ -245,7 +245,6 @@ struct lxc_rootfs {
char buf[PATH_MAX];
char *bdev_type;
char *options;
bool managed;
struct lxc_mount_options mnt_opts;
struct lxc_storage *storage;
@ -613,6 +612,7 @@ static inline void put_lxc_mount_options(struct lxc_mount_options *mnt_opts)
mnt_opts->prop_flags = 0;
free_disarm(mnt_opts->data);
free_disarm(mnt_opts->raw_options);
}
static inline void put_lxc_rootfs(struct lxc_rootfs *rootfs, bool unpin)

View File

@ -2784,7 +2784,7 @@ static int set_config_rootfs_options(const char *key, const char *value,
if (ret < 0)
return ret_errno(EINVAL);
rootfs->options = move_ptr(raw_options);
rootfs->mnt_opts.raw_options = move_ptr(raw_options);
return 0;
}
@ -4169,7 +4169,7 @@ static int get_config_rootfs_mount(const char *key, char *retv, int inlen,
static int get_config_rootfs_options(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
return lxc_get_conf_str(retv, inlen, c->rootfs.options);
return lxc_get_conf_str(retv, inlen, c->rootfs.mnt_opts.raw_options);
}
static int get_config_uts_name(const char *key, char *retv, int inlen,
@ -4976,7 +4976,6 @@ static inline int clr_config_rootfs_mount(const char *key, struct lxc_conf *c,
static inline int clr_config_rootfs_options(const char *key, struct lxc_conf *c,
void *data)
{
free_disarm(c->rootfs.options);
put_lxc_mount_options(&c->rootfs.mnt_opts);
return 0;

View File

@ -606,7 +606,7 @@ struct lxc_storage *storage_init(struct lxc_conf *conf)
const struct lxc_storage_type *q;
const char *src = conf->rootfs.path;
const char *dst = conf->rootfs.mount;
const char *mntopts = conf->rootfs.options;
const char *mntopts = conf->rootfs.mnt_opts.raw_options;
BUILD_BUG_ON(LXC_STORAGE_INTERNAL_OVERLAY_RESTORE <= LXC_CLONE_MAXFLAGS);