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
2494c5ca
Commit
2494c5ca
authored
May 16, 2017
by
Serge Hallyn
Committed by
GitHub
May 16, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1565 from brauner/2017-05-15/clear_all_config_items
conf{,ile}: allow to clear all config items
parents
e863f869
78625a5e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
1 deletion
+82
-1
conf.c
src/lxc/conf.c
+79
-0
conf.h
src/lxc/conf.h
+1
-0
confile.c
src/lxc/confile.c
+2
-1
No files found.
src/lxc/conf.c
View file @
2494c5ca
...
@@ -4937,3 +4937,82 @@ struct lxc_list *sort_cgroup_settings(struct lxc_list* cgroup_settings)
...
@@ -4937,3 +4937,82 @@ struct lxc_list *sort_cgroup_settings(struct lxc_list* cgroup_settings)
return
result
;
return
result
;
}
}
int
lxc_clear_simple_config_item
(
struct
lxc_conf
*
c
,
const
char
*
key
)
{
if
(
strcmp
(
key
,
"lxc.utsname"
)
==
0
)
{
free
(
c
->
utsname
);
c
->
utsname
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.arch"
)
==
0
)
{
c
->
personality
=
-
1
;
}
else
if
(
strcmp
(
key
,
"lxc.haltsignal"
)
==
0
)
{
c
->
haltsignal
=
0
;
}
else
if
(
strcmp
(
key
,
"lxc.rebootsignal"
)
==
0
)
{
c
->
rebootsignal
=
0
;
}
else
if
(
strcmp
(
key
,
"lxc.stopsignal"
)
==
0
)
{
c
->
stopsignal
=
0
;
}
else
if
(
strcmp
(
key
,
"lxc.init_cmd"
)
==
0
)
{
free
(
c
->
init_cmd
);
c
->
init_cmd
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.init_uid"
)
==
0
)
{
c
->
init_uid
=
0
;
}
else
if
(
strcmp
(
key
,
"lxc.init_gid"
)
==
0
)
{
c
->
init_gid
=
0
;
}
else
if
(
strcmp
(
key
,
"lxc.ephemeral"
)
==
0
)
{
c
->
ephemeral
=
0
;
}
else
if
(
strcmp
(
key
,
"lxc.console.logfile"
)
==
0
)
{
free
(
c
->
console
.
log_path
);
c
->
console
.
log_path
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.console"
)
==
0
)
{
free
(
c
->
console
.
path
);
c
->
console
.
path
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.tty"
)
==
0
)
{
c
->
tty
=
0
;
}
else
if
(
strcmp
(
key
,
"lxc.devttydir"
)
==
0
)
{
free
(
c
->
ttydir
);
c
->
ttydir
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.autodev"
)
==
0
)
{
c
->
autodev
=
1
;
}
else
if
(
strcmp
(
key
,
"lxc.kmsg"
)
==
0
)
{
c
->
kmsg
=
0
;
}
else
if
(
strcmp
(
key
,
"lxc.mount"
)
==
0
)
{
free
(
c
->
fstab
);
c
->
fstab
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.rootfs"
)
==
0
)
{
free
(
c
->
rootfs
.
path
);
c
->
rootfs
.
path
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.rootfs.mount"
)
==
0
)
{
free
(
c
->
rootfs
.
mount
);
c
->
rootfs
.
mount
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.rootfs.options"
)
==
0
)
{
free
(
c
->
rootfs
.
options
);
c
->
rootfs
.
options
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.rootfs.backend"
)
==
0
)
{
free
(
c
->
rootfs
.
bdev_type
);
c
->
rootfs
.
bdev_type
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.aa_profile"
)
==
0
)
{
free
(
c
->
lsm_aa_profile
);
c
->
lsm_aa_profile
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.aa_allow_incomplete"
)
==
0
)
{
c
->
lsm_aa_allow_incomplete
=
0
;
}
else
if
(
strcmp
(
key
,
"lxc.se_context"
)
==
0
)
{
free
(
c
->
lsm_se_context
);
c
->
lsm_se_context
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.seccomp"
)
==
0
)
{
free
(
c
->
seccomp
);
c
->
seccomp
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.loglevel"
)
==
0
)
{
c
->
loglevel
=
LXC_LOG_PRIORITY_NOTSET
;
}
else
if
(
strcmp
(
key
,
"lxc.logfile"
)
==
0
)
{
free
(
c
->
logfile
);
c
->
logfile
=
NULL
;
}
else
if
(
strcmp
(
key
,
"lxc.monitor.unshare"
)
==
0
)
{
c
->
monitor_unshare
=
0
;
}
else
if
(
strcmp
(
key
,
"lxc.pts"
)
==
0
)
{
c
->
pts
=
0
;
}
else
{
return
-
1
;
}
return
0
;
}
src/lxc/conf.h
View file @
2494c5ca
...
@@ -453,6 +453,7 @@ extern int lxc_clear_groups(struct lxc_conf *c);
...
@@ -453,6 +453,7 @@ extern int lxc_clear_groups(struct lxc_conf *c);
extern
int
lxc_clear_environment
(
struct
lxc_conf
*
c
);
extern
int
lxc_clear_environment
(
struct
lxc_conf
*
c
);
extern
int
lxc_clear_limits
(
struct
lxc_conf
*
c
,
const
char
*
key
);
extern
int
lxc_clear_limits
(
struct
lxc_conf
*
c
,
const
char
*
key
);
extern
int
lxc_delete_autodev
(
struct
lxc_handler
*
handler
);
extern
int
lxc_delete_autodev
(
struct
lxc_handler
*
handler
);
extern
int
lxc_clear_simple_config_item
(
struct
lxc_conf
*
c
,
const
char
*
key
);
extern
int
do_rootfs_setup
(
struct
lxc_conf
*
conf
,
const
char
*
name
,
extern
int
do_rootfs_setup
(
struct
lxc_conf
*
conf
,
const
char
*
name
,
const
char
*
lxcpath
);
const
char
*
lxcpath
);
...
...
src/lxc/confile.c
View file @
2494c5ca
...
@@ -2874,7 +2874,8 @@ int lxc_clear_config_item(struct lxc_conf *c, const char *key)
...
@@ -2874,7 +2874,8 @@ int lxc_clear_config_item(struct lxc_conf *c, const char *key)
return
lxc_clear_idmaps
(
c
);
return
lxc_clear_idmaps
(
c
);
else
if
(
strncmp
(
key
,
"lxc.limit"
,
9
)
==
0
)
else
if
(
strncmp
(
key
,
"lxc.limit"
,
9
)
==
0
)
return
lxc_clear_limits
(
c
,
key
);
return
lxc_clear_limits
(
c
,
key
);
return
-
1
;
return
lxc_clear_simple_config_item
(
c
,
key
);
}
}
/*
/*
...
...
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