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
6afd673f
Unverified
Commit
6afd673f
authored
May 31, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxccontainer: switch api to new clearer callbacks
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
973082f5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
confile.c
src/lxc/confile.c
+5
-10
confile.h
src/lxc/confile.h
+1
-1
lxccontainer.c
src/lxc/lxccontainer.c
+13
-3
No files found.
src/lxc/confile.c
View file @
6afd673f
...
@@ -1040,7 +1040,7 @@ static int set_config_network_ipv4(const char *key, const char *value,
...
@@ -1040,7 +1040,7 @@ static int set_config_network_ipv4(const char *key, const char *value,
char
*
addr
=
NULL
,
*
bcast
=
NULL
,
*
prefix
=
NULL
;
char
*
addr
=
NULL
,
*
bcast
=
NULL
,
*
prefix
=
NULL
;
if
(
config_value_empty
(
value
))
if
(
config_value_empty
(
value
))
return
lxc_clear_config_item
(
lxc_conf
,
key
);
return
clr_config_network_item
(
key
,
lxc_conf
);
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
if
(
!
netdev
)
if
(
!
netdev
)
...
@@ -1169,7 +1169,7 @@ static int set_config_network_ipv6(const char *key, const char *value,
...
@@ -1169,7 +1169,7 @@ static int set_config_network_ipv6(const char *key, const char *value,
char
*
slash
,
*
valdup
,
*
netmask
;
char
*
slash
,
*
valdup
,
*
netmask
;
if
(
config_value_empty
(
value
))
if
(
config_value_empty
(
value
))
return
lxc_clear_config_item
(
lxc_conf
,
key
);
return
clr_config_network_item
(
key
,
lxc_conf
);
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
if
(
!
netdev
)
if
(
!
netdev
)
...
@@ -2128,7 +2128,7 @@ static int set_config_fstab(const char *key, const char *value,
...
@@ -2128,7 +2128,7 @@ static int set_config_fstab(const char *key, const char *value,
struct
lxc_conf
*
lxc_conf
)
struct
lxc_conf
*
lxc_conf
)
{
{
if
(
config_value_empty
(
value
))
{
if
(
config_value_empty
(
value
))
{
lxc_clear_config_item
(
lxc_conf
,
key
);
clr_config_fstab
(
key
,
lxc_conf
);
return
-
1
;
return
-
1
;
}
}
...
@@ -2452,7 +2452,7 @@ static int set_config_includefiles(const char *key, const char *value,
...
@@ -2452,7 +2452,7 @@ static int set_config_includefiles(const char *key, const char *value,
{
{
/* Set config value to default. */
/* Set config value to default. */
if
(
config_value_empty
(
value
))
{
if
(
config_value_empty
(
value
))
{
lxc_clear_config_item
(
lxc_conf
,
key
);
clr_config_includefiles
(
key
,
lxc_conf
);
return
0
;
return
0
;
}
}
...
@@ -2511,7 +2511,7 @@ static int set_config_utsname(const char *key, const char *value,
...
@@ -2511,7 +2511,7 @@ static int set_config_utsname(const char *key, const char *value,
struct
utsname
*
utsname
;
struct
utsname
*
utsname
;
if
(
config_value_empty
(
value
))
{
if
(
config_value_empty
(
value
))
{
lxc_clear_config_item
(
lxc_conf
,
key
);
clr_config_utsname
(
key
,
lxc_conf
);
return
0
;
return
0
;
}
}
...
@@ -2771,11 +2771,6 @@ static inline int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen,
...
@@ -2771,11 +2771,6 @@ static inline int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen,
return
snprintf
(
retv
,
inlen
,
"%d"
,
v
);
return
snprintf
(
retv
,
inlen
,
"%d"
,
v
);
}
}
int
lxc_clear_config_item
(
struct
lxc_conf
*
c
,
const
char
*
key
)
{
return
0
;
}
/* Write out a configuration file. */
/* Write out a configuration file. */
void
write_config
(
FILE
*
fout
,
struct
lxc_conf
*
c
)
void
write_config
(
FILE
*
fout
,
struct
lxc_conf
*
c
)
{
{
...
...
src/lxc/confile.h
View file @
6afd673f
...
@@ -38,7 +38,7 @@ struct lxc_config_t {
...
@@ -38,7 +38,7 @@ struct lxc_config_t {
char
*
name
;
char
*
name
;
config_set_cb
set
;
config_set_cb
set
;
config_get_cb
get
;
config_get_cb
get
;
config_clr_cb
cl
ea
r
;
config_clr_cb
clr
;
};
};
extern
struct
lxc_config_t
*
lxc_getconfig
(
const
char
*
key
);
extern
struct
lxc_config_t
*
lxc_getconfig
(
const
char
*
key
);
...
...
src/lxc/lxccontainer.c
View file @
6afd673f
...
@@ -1676,17 +1676,27 @@ static void do_clear_unexp_config_line(struct lxc_conf *conf, const char *key)
...
@@ -1676,17 +1676,27 @@ static void do_clear_unexp_config_line(struct lxc_conf *conf, const char *key)
WARN
(
"Error clearing configuration for %s"
,
key
);
WARN
(
"Error clearing configuration for %s"
,
key
);
}
}
static
bool
do_lxcapi_clear_config_item
(
struct
lxc_container
*
c
,
const
char
*
key
)
static
bool
do_lxcapi_clear_config_item
(
struct
lxc_container
*
c
,
const
char
*
key
)
{
{
int
ret
;
int
ret
=
1
;
struct
lxc_config_t
*
config
;
if
(
!
c
||
!
c
->
lxc_conf
)
if
(
!
c
||
!
c
->
lxc_conf
)
return
false
;
return
false
;
if
(
container_mem_lock
(
c
))
if
(
container_mem_lock
(
c
))
return
false
;
return
false
;
ret
=
lxc_clear_config_item
(
c
->
lxc_conf
,
key
);
config
=
lxc_getconfig
(
key
);
/* Verify that the config key exists and that it has a callback
* implemented.
*/
if
(
config
&&
config
->
clr
)
ret
=
config
->
clr
(
key
,
c
->
lxc_conf
);
if
(
!
ret
)
if
(
!
ret
)
do_clear_unexp_config_line
(
c
->
lxc_conf
,
key
);
do_clear_unexp_config_line
(
c
->
lxc_conf
,
key
);
container_mem_unlock
(
c
);
container_mem_unlock
(
c
);
return
ret
==
0
;
return
ret
==
0
;
}
}
...
...
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