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
17ed13a3
Commit
17ed13a3
authored
Sep 14, 2012
by
Serge Hallyn
Committed by
Stéphane Graber
Nov 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support individual hook types in clear_config_item
Without this patch, only clear_config_item("lxc.hook") works. Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
f6144ed4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
9 deletions
+22
-9
conf.c
src/lxc/conf.c
+19
-6
conf.h
src/lxc/conf.h
+1
-1
confile.c
src/lxc/confile.c
+2
-2
No files found.
src/lxc/conf.c
View file @
17ed13a3
...
@@ -2542,18 +2542,31 @@ int lxc_clear_mount_entries(struct lxc_conf *c)
...
@@ -2542,18 +2542,31 @@ int lxc_clear_mount_entries(struct lxc_conf *c)
return
0
;
return
0
;
}
}
int
lxc_clear_hooks
(
struct
lxc_conf
*
c
)
int
lxc_clear_hooks
(
struct
lxc_conf
*
c
,
char
*
key
)
{
{
struct
lxc_list
*
it
;
struct
lxc_list
*
it
;
bool
all
=
false
,
done
=
false
;
char
*
k
=
key
+
9
;
int
i
;
int
i
;
if
(
strcmp
(
key
,
"lxc.hook"
)
==
0
)
all
=
true
;
for
(
i
=
0
;
i
<
NUM_LXC_HOOKS
;
i
++
)
{
for
(
i
=
0
;
i
<
NUM_LXC_HOOKS
;
i
++
)
{
lxc_list_for_each
(
it
,
&
c
->
hooks
[
i
])
{
if
(
all
||
strcmp
(
k
,
lxchook_names
[
i
])
==
0
)
{
lxc_list_del
(
it
);
lxc_list_for_each
(
it
,
&
c
->
hooks
[
i
])
{
free
(
it
->
elem
);
lxc_list_del
(
it
);
free
(
it
);
free
(
it
->
elem
);
free
(
it
);
}
done
=
true
;
}
}
}
}
if
(
!
done
)
{
ERROR
(
"Invalid hook key: %s"
,
key
);
return
-
1
;
}
return
0
;
return
0
;
}
}
...
@@ -2572,7 +2585,7 @@ void lxc_conf_free(struct lxc_conf *conf)
...
@@ -2572,7 +2585,7 @@ void lxc_conf_free(struct lxc_conf *conf)
#endif
#endif
lxc_clear_config_caps
(
conf
);
lxc_clear_config_caps
(
conf
);
lxc_clear_cgroups
(
conf
,
"lxc.cgroup"
);
lxc_clear_cgroups
(
conf
,
"lxc.cgroup"
);
lxc_clear_hooks
(
conf
);
lxc_clear_hooks
(
conf
,
"lxc.hook"
);
lxc_clear_mount_entries
(
conf
);
lxc_clear_mount_entries
(
conf
);
free
(
conf
);
free
(
conf
);
}
}
src/lxc/conf.h
View file @
17ed13a3
...
@@ -262,7 +262,7 @@ extern int lxc_clear_nic(struct lxc_conf *c, char *key);
...
@@ -262,7 +262,7 @@ extern int lxc_clear_nic(struct lxc_conf *c, char *key);
extern
int
lxc_clear_config_caps
(
struct
lxc_conf
*
c
);
extern
int
lxc_clear_config_caps
(
struct
lxc_conf
*
c
);
extern
int
lxc_clear_cgroups
(
struct
lxc_conf
*
c
,
char
*
key
);
extern
int
lxc_clear_cgroups
(
struct
lxc_conf
*
c
,
char
*
key
);
extern
int
lxc_clear_mount_entries
(
struct
lxc_conf
*
c
);
extern
int
lxc_clear_mount_entries
(
struct
lxc_conf
*
c
);
extern
int
lxc_clear_hooks
(
struct
lxc_conf
*
c
);
extern
int
lxc_clear_hooks
(
struct
lxc_conf
*
c
,
char
*
key
);
/*
/*
* Configure the container from inside
* Configure the container from inside
...
...
src/lxc/confile.c
View file @
17ed13a3
...
@@ -1568,8 +1568,8 @@ int lxc_clear_config_item(struct lxc_conf *c, char *key)
...
@@ -1568,8 +1568,8 @@ int lxc_clear_config_item(struct lxc_conf *c, char *key)
return
lxc_clear_cgroups
(
c
,
key
);
return
lxc_clear_cgroups
(
c
,
key
);
else
if
(
strcmp
(
key
,
"lxc.mount.entries"
)
==
0
)
else
if
(
strcmp
(
key
,
"lxc.mount.entries"
)
==
0
)
return
lxc_clear_mount_entries
(
c
);
return
lxc_clear_mount_entries
(
c
);
else
if
(
str
cmp
(
key
,
"lxc.hook"
)
==
0
)
else
if
(
str
ncmp
(
key
,
"lxc.hook"
,
8
)
==
0
)
return
lxc_clear_hooks
(
c
);
return
lxc_clear_hooks
(
c
,
key
);
return
-
1
;
return
-
1
;
}
}
...
...
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