From: Christian Brauner Date: Thu, 26 Aug 2021 08:25:48 +0000 (+0200) Subject: rootfs: remove "options" member X-Git-Tag: lxc-5.0.0~102^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e73af35bbac645b4d1b8d5f5037863a1d49b6cce;p=thirdparty%2Flxc.git rootfs: remove "options" member Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 11f42714b..4b7a73286 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -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); diff --git a/src/lxc/conf.h b/src/lxc/conf.h index 7a63acffc..4e31c55d7 100644 --- a/src/lxc/conf.h +++ b/src/lxc/conf.h @@ -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) diff --git a/src/lxc/confile.c b/src/lxc/confile.c index d9d3e45df..d0b891d2d 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -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; diff --git a/src/lxc/storage/storage.c b/src/lxc/storage/storage.c index f1bea3e30..a8c4be5f3 100644 --- a/src/lxc/storage/storage.c +++ b/src/lxc/storage/storage.c @@ -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);