Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
a31c061c
Commit
a31c061c
authored
Aug 27, 2015
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #634 from alkino/config_mount
Split handle of lxc.mount* with 3 functions
parents
66b62e24
70f55bfd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
30 deletions
+6
-30
confile.c
src/lxc/confile.c
+6
-30
No files found.
src/lxc/confile.c
View file @
a31c061c
...
@@ -67,6 +67,8 @@ static int config_idmap(const char *, const char *, struct lxc_conf *);
...
@@ -67,6 +67,8 @@ static int config_idmap(const char *, const char *, struct lxc_conf *);
static
int
config_loglevel
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_loglevel
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_logfile
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_logfile
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_mount
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_mount
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_mount_auto
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_fstab
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs_mount
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs_mount
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs_options
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs_options
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
...
@@ -119,7 +121,9 @@ static struct lxc_config_t config[] = {
...
@@ -119,7 +121,9 @@ static struct lxc_config_t config[] = {
{
"lxc.id_map"
,
config_idmap
},
{
"lxc.id_map"
,
config_idmap
},
{
"lxc.loglevel"
,
config_loglevel
},
{
"lxc.loglevel"
,
config_loglevel
},
{
"lxc.logfile"
,
config_logfile
},
{
"lxc.logfile"
,
config_logfile
},
{
"lxc.mount"
,
config_mount
},
{
"lxc.mount.entry"
,
config_mount
},
{
"lxc.mount.auto"
,
config_mount_auto
},
{
"lxc.mount"
,
config_fstab
},
{
"lxc.rootfs.mount"
,
config_rootfs_mount
},
{
"lxc.rootfs.mount"
,
config_rootfs_mount
},
{
"lxc.rootfs.options"
,
config_rootfs_options
},
{
"lxc.rootfs.options"
,
config_rootfs_options
},
{
"lxc.rootfs"
,
config_rootfs
},
{
"lxc.rootfs"
,
config_rootfs
},
...
@@ -1507,7 +1511,7 @@ static int config_mount_auto(const char *key, const char *value,
...
@@ -1507,7 +1511,7 @@ static int config_mount_auto(const char *key, const char *value,
{
"cgroup-full:mixed"
,
LXC_AUTO_CGROUP_MASK
,
LXC_AUTO_CGROUP_FULL_MIXED
},
{
"cgroup-full:mixed"
,
LXC_AUTO_CGROUP_MASK
,
LXC_AUTO_CGROUP_FULL_MIXED
},
{
"cgroup-full:ro"
,
LXC_AUTO_CGROUP_MASK
,
LXC_AUTO_CGROUP_FULL_RO
},
{
"cgroup-full:ro"
,
LXC_AUTO_CGROUP_MASK
,
LXC_AUTO_CGROUP_FULL_RO
},
{
"cgroup-full:rw"
,
LXC_AUTO_CGROUP_MASK
,
LXC_AUTO_CGROUP_FULL_RW
},
{
"cgroup-full:rw"
,
LXC_AUTO_CGROUP_MASK
,
LXC_AUTO_CGROUP_FULL_RW
},
/* NB: For adding anything that is
t
just a single on/off, but has
/* NB: For adding anything that is just a single on/off, but has
* no options: keep mask and flag identical and just define the
* no options: keep mask and flag identical and just define the
* enum value as an unused bit so far
* enum value as an unused bit so far
*/
*/
...
@@ -1553,40 +1557,12 @@ static int config_mount_auto(const char *key, const char *value,
...
@@ -1553,40 +1557,12 @@ static int config_mount_auto(const char *key, const char *value,
return
ret
;
return
ret
;
}
}
/*
* TODO
* This fn is handling lxc.mount, lxc.mount.entry, and lxc.mount.auto.
* It should probably be split into 3 separate functions indexed by
* the config[] entries at top.
*/
static
int
config_mount
(
const
char
*
key
,
const
char
*
value
,
static
int
config_mount
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
)
struct
lxc_conf
*
lxc_conf
)
{
{
char
*
fstab_token
=
"lxc.mount"
;
char
*
token
=
"lxc.mount.entry"
;
char
*
auto_token
=
"lxc.mount.auto"
;
char
*
subkey
;
char
*
mntelem
;
char
*
mntelem
;
struct
lxc_list
*
mntlist
;
struct
lxc_list
*
mntlist
;
subkey
=
strstr
(
key
,
token
);
if
(
!
subkey
)
{
subkey
=
strstr
(
key
,
auto_token
);
if
(
!
subkey
)
{
subkey
=
strstr
(
key
,
fstab_token
);
if
(
!
subkey
)
return
-
1
;
return
config_fstab
(
key
,
value
,
lxc_conf
);
}
return
config_mount_auto
(
key
,
value
,
lxc_conf
);
}
/* At this point we definitely have key = lxc.mount.entry */
if
(
!
value
||
strlen
(
value
)
==
0
)
if
(
!
value
||
strlen
(
value
)
==
0
)
return
lxc_clear_mount_entries
(
lxc_conf
);
return
lxc_clear_mount_entries
(
lxc_conf
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment