mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-04-29 02:06:07 +00:00
confile: split mount options into flags and data
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
8ce1abc28a
commit
3437f95c47
@ -150,14 +150,18 @@ struct lxc_tty_info {
|
|||||||
* optionals pivot_root, rootfs mount paths
|
* optionals pivot_root, rootfs mount paths
|
||||||
* @path : the rootfs source (directory or device)
|
* @path : the rootfs source (directory or device)
|
||||||
* @mount : where it is mounted
|
* @mount : where it is mounted
|
||||||
* @options : mount options
|
|
||||||
* @bev_type : optional backing store type
|
* @bev_type : optional backing store type
|
||||||
|
* @options : mount options
|
||||||
|
* @mountflags : the portion of @options that are flags
|
||||||
|
* @data : the porition of @options that are not flags
|
||||||
*/
|
*/
|
||||||
struct lxc_rootfs {
|
struct lxc_rootfs {
|
||||||
char *path;
|
char *path;
|
||||||
char *mount;
|
char *mount;
|
||||||
char *options;
|
|
||||||
char *bdev_type;
|
char *bdev_type;
|
||||||
|
char *options;
|
||||||
|
unsigned long mountflags;
|
||||||
|
char *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2143,7 +2143,32 @@ static int set_config_rootfs_mount(const char *key, const char *value,
|
|||||||
static int set_config_rootfs_options(const char *key, const char *value,
|
static int set_config_rootfs_options(const char *key, const char *value,
|
||||||
struct lxc_conf *lxc_conf, void *data)
|
struct lxc_conf *lxc_conf, void *data)
|
||||||
{
|
{
|
||||||
return set_config_string_item(&lxc_conf->rootfs.options, value);
|
int ret;
|
||||||
|
unsigned long mflags = 0, pflags = 0;
|
||||||
|
char *mdata = NULL, *opts = NULL;
|
||||||
|
struct lxc_rootfs *rootfs = &lxc_conf->rootfs;
|
||||||
|
|
||||||
|
ret = parse_mntopts(value, &mflags, &mdata);
|
||||||
|
if (ret < 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
ret = parse_propagationopts(value, &pflags);
|
||||||
|
if (ret < 0) {
|
||||||
|
free(mdata);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = set_config_string_item(&opts, value);
|
||||||
|
if (ret < 0) {
|
||||||
|
free(mdata);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
rootfs->mountflags = mflags | pflags;
|
||||||
|
rootfs->options = opts;
|
||||||
|
rootfs->data = mdata;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_config_uts_name(const char *key, const char *value,
|
static int set_config_uts_name(const char *key, const char *value,
|
||||||
@ -3964,6 +3989,10 @@ static inline int clr_config_rootfs_options(const char *key, struct lxc_conf *c,
|
|||||||
{
|
{
|
||||||
free(c->rootfs.options);
|
free(c->rootfs.options);
|
||||||
c->rootfs.options = NULL;
|
c->rootfs.options = NULL;
|
||||||
|
|
||||||
|
free(c->rootfs.data);
|
||||||
|
c->rootfs.data = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user