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
6e74f4f2
Unverified
Commit
6e74f4f2
authored
Jun 01, 2017
by
Christian Brauner
Committed by
Stéphane Graber
Jul 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: performance tweaks
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
5eaf72cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
confile.c
src/lxc/confile.c
+19
-14
No files found.
src/lxc/confile.c
View file @
6e74f4f2
...
@@ -1261,7 +1261,7 @@ static int set_config_hooks(const char *key, const char *value,
...
@@ -1261,7 +1261,7 @@ static int set_config_hooks(const char *key, const char *value,
if
(
config_value_empty
(
value
))
if
(
config_value_empty
(
value
))
return
lxc_clear_hooks
(
lxc_conf
,
key
);
return
lxc_clear_hooks
(
lxc_conf
,
key
);
if
(
strcmp
(
key
,
"lxc.
hook"
)
==
0
)
{
if
(
strcmp
(
key
+
4
,
"
hook"
)
==
0
)
{
ERROR
(
"lxc.hook cannot take a value"
);
ERROR
(
"lxc.hook cannot take a value"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1271,23 +1271,23 @@ static int set_config_hooks(const char *key, const char *value,
...
@@ -1271,23 +1271,23 @@ static int set_config_hooks(const char *key, const char *value,
return
-
1
;
return
-
1
;
}
}
if
(
strcmp
(
key
,
"lxc.hook.
pre-start"
)
==
0
)
if
(
strcmp
(
key
+
9
,
"
pre-start"
)
==
0
)
return
add_hook
(
lxc_conf
,
LXCHOOK_PRESTART
,
copy
);
return
add_hook
(
lxc_conf
,
LXCHOOK_PRESTART
,
copy
);
else
if
(
strcmp
(
key
,
"lxc.hook.
pre-mount"
)
==
0
)
else
if
(
strcmp
(
key
+
9
,
"
pre-mount"
)
==
0
)
return
add_hook
(
lxc_conf
,
LXCHOOK_PREMOUNT
,
copy
);
return
add_hook
(
lxc_conf
,
LXCHOOK_PREMOUNT
,
copy
);
else
if
(
strcmp
(
key
,
"lxc.hook.
autodev"
)
==
0
)
else
if
(
strcmp
(
key
+
9
,
"
autodev"
)
==
0
)
return
add_hook
(
lxc_conf
,
LXCHOOK_AUTODEV
,
copy
);
return
add_hook
(
lxc_conf
,
LXCHOOK_AUTODEV
,
copy
);
else
if
(
strcmp
(
key
,
"lxc.hook.
mount"
)
==
0
)
else
if
(
strcmp
(
key
+
9
,
"
mount"
)
==
0
)
return
add_hook
(
lxc_conf
,
LXCHOOK_MOUNT
,
copy
);
return
add_hook
(
lxc_conf
,
LXCHOOK_MOUNT
,
copy
);
else
if
(
strcmp
(
key
,
"lxc.hook.
start"
)
==
0
)
else
if
(
strcmp
(
key
+
9
,
"
start"
)
==
0
)
return
add_hook
(
lxc_conf
,
LXCHOOK_START
,
copy
);
return
add_hook
(
lxc_conf
,
LXCHOOK_START
,
copy
);
else
if
(
strcmp
(
key
,
"lxc.hook.
stop"
)
==
0
)
else
if
(
strcmp
(
key
+
9
,
"
stop"
)
==
0
)
return
add_hook
(
lxc_conf
,
LXCHOOK_STOP
,
copy
);
return
add_hook
(
lxc_conf
,
LXCHOOK_STOP
,
copy
);
else
if
(
strcmp
(
key
,
"lxc.hook.
post-stop"
)
==
0
)
else
if
(
strcmp
(
key
+
9
,
"
post-stop"
)
==
0
)
return
add_hook
(
lxc_conf
,
LXCHOOK_POSTSTOP
,
copy
);
return
add_hook
(
lxc_conf
,
LXCHOOK_POSTSTOP
,
copy
);
else
if
(
strcmp
(
key
,
"lxc.hook.
clone"
)
==
0
)
else
if
(
strcmp
(
key
+
9
,
"
clone"
)
==
0
)
return
add_hook
(
lxc_conf
,
LXCHOOK_CLONE
,
copy
);
return
add_hook
(
lxc_conf
,
LXCHOOK_CLONE
,
copy
);
else
if
(
strcmp
(
key
,
"lxc.hook.
destroy"
)
==
0
)
else
if
(
strcmp
(
key
+
9
,
"
destroy"
)
==
0
)
return
add_hook
(
lxc_conf
,
LXCHOOK_DESTROY
,
copy
);
return
add_hook
(
lxc_conf
,
LXCHOOK_DESTROY
,
copy
);
SYSERROR
(
"Unknown key: %s"
,
key
);
SYSERROR
(
"Unknown key: %s"
,
key
);
...
@@ -1324,6 +1324,11 @@ static int set_config_pts(const char *key, const char *value,
...
@@ -1324,6 +1324,11 @@ static int set_config_pts(const char *key, const char *value,
return
0
;
return
0
;
}
}
/* We only need to check whether the first byte of the key after the lxc.start.
* prefix matches our expectations since they fortunately all start with a
* different letter. If anything was wrong with the key we would have already
* noticed when the callback was called.
*/
static
int
set_config_start
(
const
char
*
key
,
const
char
*
value
,
static
int
set_config_start
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
)
struct
lxc_conf
*
lxc_conf
)
{
{
...
@@ -1331,7 +1336,7 @@ static int set_config_start(const char *key, const char *value,
...
@@ -1331,7 +1336,7 @@ static int set_config_start(const char *key, const char *value,
is_empty
=
config_value_empty
(
value
);
is_empty
=
config_value_empty
(
value
);
if
(
strcmp
(
key
,
"lxc.start.auto"
)
==
0
)
{
if
(
*
(
key
+
10
)
==
'a'
)
{
/* lxc.start.auto */
/* Set config value to default. */
/* Set config value to default. */
if
(
is_empty
)
{
if
(
is_empty
)
{
lxc_conf
->
start_auto
=
0
;
lxc_conf
->
start_auto
=
0
;
...
@@ -1346,7 +1351,7 @@ static int set_config_start(const char *key, const char *value,
...
@@ -1346,7 +1351,7 @@ static int set_config_start(const char *key, const char *value,
return
-
1
;
return
-
1
;
return
0
;
return
0
;
}
else
if
(
strcmp
(
key
,
"lxc.start.delay"
)
==
0
)
{
}
else
if
(
*
(
key
+
10
)
==
'd'
)
{
/* lxc.start.delay */
/* Set config value to default. */
/* Set config value to default. */
if
(
is_empty
)
{
if
(
is_empty
)
{
lxc_conf
->
start_delay
=
0
;
lxc_conf
->
start_delay
=
0
;
...
@@ -1355,7 +1360,7 @@ static int set_config_start(const char *key, const char *value,
...
@@ -1355,7 +1360,7 @@ static int set_config_start(const char *key, const char *value,
/* Parse new config value. */
/* Parse new config value. */
return
lxc_safe_uint
(
value
,
&
lxc_conf
->
start_delay
);
return
lxc_safe_uint
(
value
,
&
lxc_conf
->
start_delay
);
}
else
if
(
strcmp
(
key
,
"lxc.start.order"
)
==
0
)
{
}
else
if
(
*
(
key
+
10
)
==
'o'
)
{
/* lxc.start.order */
/* Set config value to default. */
/* Set config value to default. */
if
(
is_empty
)
{
if
(
is_empty
)
{
lxc_conf
->
start_order
=
0
;
lxc_conf
->
start_order
=
0
;
...
@@ -1380,7 +1385,7 @@ static int set_config_monitor(const char *key, const char *value,
...
@@ -1380,7 +1385,7 @@ static int set_config_monitor(const char *key, const char *value,
}
}
/* Parse new config value. */
/* Parse new config value. */
if
(
strcmp
(
key
,
"lxc.monitor.
unshare"
)
==
0
)
if
(
strcmp
(
key
+
12
,
"
unshare"
)
==
0
)
return
lxc_safe_uint
(
value
,
&
lxc_conf
->
monitor_unshare
);
return
lxc_safe_uint
(
value
,
&
lxc_conf
->
monitor_unshare
);
SYSERROR
(
"Unknown key: %s"
,
key
);
SYSERROR
(
"Unknown key: %s"
,
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