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
dd8d5509
Unverified
Commit
dd8d5509
authored
Oct 27, 2020
by
Christian Brauner
Committed by
GitHub
Oct 27, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3564 from Drachenfels-GmbH/fixes
lxccontainer: fix lxc_config_item_is_supported
parents
c8fe1155
6eb516a7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
1 deletion
+21
-1
confile.c
src/lxc/confile.c
+12
-0
confile.h
src/lxc/confile.h
+3
-0
lxccontainer.c
src/lxc/lxccontainer.c
+1
-1
get_item.c
src/tests/get_item.c
+5
-0
No files found.
src/lxc/confile.c
View file @
dd8d5509
...
@@ -278,6 +278,18 @@ static struct lxc_config_t config_jump_table[] = {
...
@@ -278,6 +278,18 @@ static struct lxc_config_t config_jump_table[] = {
static
const
size_t
config_jump_table_size
=
sizeof
(
config_jump_table
)
/
sizeof
(
struct
lxc_config_t
);
static
const
size_t
config_jump_table_size
=
sizeof
(
config_jump_table
)
/
sizeof
(
struct
lxc_config_t
);
struct
lxc_config_t
*
lxc_get_config_exact
(
const
char
*
key
)
{
size_t
i
;
for
(
i
=
0
;
i
<
config_jump_table_size
;
i
++
)
if
(
!
strcmp
(
config_jump_table
[
i
].
name
,
key
))
return
&
config_jump_table
[
i
];
return
NULL
;
}
struct
lxc_config_t
*
lxc_get_config
(
const
char
*
key
)
struct
lxc_config_t
*
lxc_get_config
(
const
char
*
key
)
{
{
size_t
i
;
size_t
i
;
...
...
src/lxc/confile.h
View file @
dd8d5509
...
@@ -45,6 +45,9 @@ struct new_config_item {
...
@@ -45,6 +45,9 @@ struct new_config_item {
};
};
/* Get the jump table entry for the given configuration key. */
/* Get the jump table entry for the given configuration key. */
__hidden
extern
struct
lxc_config_t
*
lxc_get_config_exact
(
const
char
*
key
);
/* Get the jump table entry if entry name is a prefix of the given configuration key. */
__hidden
extern
struct
lxc_config_t
*
lxc_get_config
(
const
char
*
key
);
__hidden
extern
struct
lxc_config_t
*
lxc_get_config
(
const
char
*
key
);
/* List all available config items. */
/* List all available config items. */
...
...
src/lxc/lxccontainer.c
View file @
dd8d5509
...
@@ -5749,7 +5749,7 @@ free_ct_name:
...
@@ -5749,7 +5749,7 @@ free_ct_name:
bool
lxc_config_item_is_supported
(
const
char
*
key
)
bool
lxc_config_item_is_supported
(
const
char
*
key
)
{
{
return
!!
lxc_get_config
(
key
);
return
!!
lxc_get_config
_exact
(
key
);
}
}
bool
lxc_has_api_extension
(
const
char
*
extension
)
bool
lxc_has_api_extension
(
const
char
*
extension
)
...
...
src/tests/get_item.c
View file @
dd8d5509
...
@@ -600,6 +600,11 @@ int main(int argc, char *argv[])
...
@@ -600,6 +600,11 @@ int main(int argc, char *argv[])
goto
out
;
goto
out
;
}
}
if
(
lxc_config_item_is_supported
(
"lxc.arch.nonsense"
))
{
fprintf
(
stderr
,
"%d: failed to detect
\"
lxc.arch.nonsense
\"
as unsupported configuration item
\n
"
,
__LINE__
);
goto
out
;
}
if
(
c
->
set_config_item
(
c
,
"lxc.notaconfigkey"
,
"invalid"
))
{
if
(
c
->
set_config_item
(
c
,
"lxc.notaconfigkey"
,
"invalid"
))
{
fprintf
(
stderr
,
"%d: Managed to set
\"
lxc.notaconfigkey
\"\n
"
,
__LINE__
);
fprintf
(
stderr
,
"%d: Managed to set
\"
lxc.notaconfigkey
\"\n
"
,
__LINE__
);
goto
out
;
goto
out
;
...
...
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