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
1d8d3676
Unverified
Commit
1d8d3676
authored
Feb 02, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: add lxc.namespace.clone
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
b074bbf1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
+59
-0
conf.h
src/lxc/conf.h
+1
-0
confile.c
src/lxc/confile.c
+58
-0
No files found.
src/lxc/conf.h
View file @
1d8d3676
...
...
@@ -405,6 +405,7 @@ struct lxc_conf {
struct
lxc_cgroup
cgroup_meta
;
struct
{
int
ns_clone
;
char
*
ns_share
[
LXC_NS_MAX
];
};
...
...
src/lxc/confile.c
View file @
1d8d3676
...
...
@@ -107,6 +107,7 @@ lxc_config_define(monitor);
lxc_config_define
(
mount
);
lxc_config_define
(
mount_auto
);
lxc_config_define
(
mount_fstab
);
lxc_config_define
(
namespace_clone
);
lxc_config_define
(
namespace_share
);
lxc_config_define
(
net
);
lxc_config_define
(
net_flags
);
...
...
@@ -191,6 +192,7 @@ static struct lxc_config_t config[] = {
{
"lxc.mount.auto"
,
false
,
set_config_mount_auto
,
get_config_mount_auto
,
clr_config_mount_auto
,
},
{
"lxc.mount.entry"
,
false
,
set_config_mount
,
get_config_mount
,
clr_config_mount
,
},
{
"lxc.mount.fstab"
,
false
,
set_config_mount_fstab
,
get_config_mount_fstab
,
clr_config_mount_fstab
,
},
{
"lxc.namespace.clone"
,
false
,
set_config_namespace_clone
,
get_config_namespace_clone
,
clr_config_namespace_clone
,
},
{
"lxc.namespace.share"
,
false
,
set_config_namespace_share
,
get_config_namespace_share
,
clr_config_namespace_share
,
},
/* [START]: REMOVE IN LXC 3.0 */
...
...
@@ -2180,6 +2182,36 @@ static int set_config_uts_name(const char *key, const char *value,
return
0
;
}
static
int
set_config_namespace_clone
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
char
*
ns
,
*
nsptr
,
*
token
;
int
cloneflag
=
0
;
char
*
saveptr
=
NULL
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_namespace_clone
(
key
,
lxc_conf
,
data
);
ns
=
strdup
(
value
);
if
(
!
ns
)
return
-
1
;
nsptr
=
ns
;
for
(;
(
token
=
strtok_r
(
nsptr
,
"
\t
"
,
&
saveptr
));
nsptr
=
NULL
)
{
token
+=
lxc_char_left_gc
(
token
,
strlen
(
token
));
token
[
lxc_char_right_gc
(
token
,
strlen
(
token
))]
=
'\0'
;
cloneflag
=
lxc_namespace_2_cloneflag
(
token
);
if
(
cloneflag
<
0
)
{
free
(
ns
);
return
-
EINVAL
;
}
lxc_conf
->
ns_clone
|=
cloneflag
;
}
free
(
ns
);
return
0
;
}
static
int
set_config_namespace_share
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
...
...
@@ -3614,6 +3646,25 @@ static int get_config_noop(const char *key, char *retv, int inlen,
return
0
;
}
static
int
get_config_namespace_clone
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
i
,
len
;
int
fulllen
=
0
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
for
(
i
=
0
;
i
<
LXC_NS_MAX
;
i
++
)
{
if
(
c
->
ns_clone
&
ns_info
[
i
].
clone_flag
)
strprint
(
retv
,
inlen
,
"%s
\n
"
,
ns_info
[
i
].
proc_name
);
}
return
fulllen
;
}
static
int
get_config_namespace_share
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
...
...
@@ -4024,6 +4075,13 @@ static inline int clr_config_noop(const char *key, struct lxc_conf *c,
return
0
;
}
static
int
clr_config_namespace_clone
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
lxc_conf
->
ns_clone
=
0
;
return
0
;
}
static
int
clr_config_namespace_share
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
...
...
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