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
9e8be781
Commit
9e8be781
authored
Jan 09, 2014
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add lxc.default_config to LXC's own config
Signed-off-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
Acked-by:
Serge E. Hallyn
<
serge.hallyn@ubuntu.com
>
parent
2b425d51
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
utils.c
src/lxc/utils.c
+16
-1
No files found.
src/lxc/utils.c
View file @
9e8be781
...
@@ -245,6 +245,7 @@ static const char *lxc_global_config_value(const char *option_name)
...
@@ -245,6 +245,7 @@ static const char *lxc_global_config_value(const char *option_name)
{
"lxc.lvm_thin_pool"
,
DEFAULT_THIN_POOL
},
{
"lxc.lvm_thin_pool"
,
DEFAULT_THIN_POOL
},
{
"lxc.zfsroot"
,
DEFAULT_ZFSROOT
},
{
"lxc.zfsroot"
,
DEFAULT_ZFSROOT
},
{
"lxc.lxcpath"
,
NULL
},
{
"lxc.lxcpath"
,
NULL
},
{
"lxc.default_config"
,
NULL
},
{
"lxc.cgroup.pattern"
,
DEFAULT_CGROUP_PATTERN
},
{
"lxc.cgroup.pattern"
,
DEFAULT_CGROUP_PATTERN
},
{
"lxc.cgroup.use"
,
NULL
},
{
"lxc.cgroup.use"
,
NULL
},
{
NULL
,
NULL
},
{
NULL
,
NULL
},
...
@@ -257,6 +258,7 @@ static const char *lxc_global_config_value(const char *option_name)
...
@@ -257,6 +258,7 @@ static const char *lxc_global_config_value(const char *option_name)
static
const
char
*
values
[
sizeof
(
options
)
/
sizeof
(
options
[
0
])]
=
{
0
};
static
const
char
*
values
[
sizeof
(
options
)
/
sizeof
(
options
[
0
])]
=
{
0
};
#endif
#endif
char
*
user_config_path
=
NULL
;
char
*
user_config_path
=
NULL
;
char
*
user_default_config_path
=
NULL
;
char
*
user_lxc_path
=
NULL
;
char
*
user_lxc_path
=
NULL
;
if
(
geteuid
()
>
0
)
{
if
(
geteuid
()
>
0
)
{
...
@@ -265,13 +267,16 @@ static const char *lxc_global_config_value(const char *option_name)
...
@@ -265,13 +267,16 @@ static const char *lxc_global_config_value(const char *option_name)
user_home
=
"/"
;
user_home
=
"/"
;
user_config_path
=
malloc
(
sizeof
(
char
)
*
(
22
+
strlen
(
user_home
)));
user_config_path
=
malloc
(
sizeof
(
char
)
*
(
22
+
strlen
(
user_home
)));
user_default_config_path
=
malloc
(
sizeof
(
char
)
*
(
26
+
strlen
(
user_home
)));
user_lxc_path
=
malloc
(
sizeof
(
char
)
*
(
19
+
strlen
(
user_home
)));
user_lxc_path
=
malloc
(
sizeof
(
char
)
*
(
19
+
strlen
(
user_home
)));
sprintf
(
user_config_path
,
"%s/.config/lxc/lxc.conf"
,
user_home
);
sprintf
(
user_config_path
,
"%s/.config/lxc/lxc.conf"
,
user_home
);
sprintf
(
user_default_config_path
,
"%s/.config/lxc/default.conf"
,
user_home
);
sprintf
(
user_lxc_path
,
"%s/.local/share/lxc/"
,
user_home
);
sprintf
(
user_lxc_path
,
"%s/.local/share/lxc/"
,
user_home
);
}
}
else
{
else
{
user_config_path
=
strdup
(
LXC_GLOBAL_CONF
);
user_config_path
=
strdup
(
LXC_GLOBAL_CONF
);
user_default_config_path
=
strdup
(
LXC_DEFAULT_CONFIG
);
user_lxc_path
=
strdup
(
LXCPATH
);
user_lxc_path
=
strdup
(
LXCPATH
);
}
}
...
@@ -286,6 +291,7 @@ static const char *lxc_global_config_value(const char *option_name)
...
@@ -286,6 +291,7 @@ static const char *lxc_global_config_value(const char *option_name)
}
}
if
(
!
(
*
ptr
)[
0
])
{
if
(
!
(
*
ptr
)[
0
])
{
free
(
user_config_path
);
free
(
user_config_path
);
free
(
user_default_config_path
);
free
(
user_lxc_path
);
free
(
user_lxc_path
);
errno
=
EINVAL
;
errno
=
EINVAL
;
return
NULL
;
return
NULL
;
...
@@ -293,6 +299,7 @@ static const char *lxc_global_config_value(const char *option_name)
...
@@ -293,6 +299,7 @@ static const char *lxc_global_config_value(const char *option_name)
if
(
values
[
i
])
{
if
(
values
[
i
])
{
free
(
user_config_path
);
free
(
user_config_path
);
free
(
user_default_config_path
);
free
(
user_lxc_path
);
free
(
user_lxc_path
);
return
values
[
i
];
return
values
[
i
];
}
}
...
@@ -332,14 +339,22 @@ static const char *lxc_global_config_value(const char *option_name)
...
@@ -332,14 +339,22 @@ static const char *lxc_global_config_value(const char *option_name)
if
(
!*
p
)
if
(
!*
p
)
continue
;
continue
;
values
[
i
]
=
copy_global_config_value
(
p
);
values
[
i
]
=
copy_global_config_value
(
p
);
free
(
user_default_config_path
);
free
(
user_lxc_path
);
free
(
user_lxc_path
);
goto
out
;
goto
out
;
}
}
}
}
/* could not find value, use default */
/* could not find value, use default */
if
(
strcmp
(
option_name
,
"lxc.lxcpath"
)
==
0
)
if
(
strcmp
(
option_name
,
"lxc.lxcpath"
)
==
0
)
{
values
[
i
]
=
user_lxc_path
;
values
[
i
]
=
user_lxc_path
;
free
(
user_default_config_path
);
}
else
if
(
strcmp
(
option_name
,
"lxc.default_config"
)
==
0
)
{
values
[
i
]
=
user_default_config_path
;
free
(
user_lxc_path
);
}
else
{
else
{
free
(
user_default_config_path
);
free
(
user_lxc_path
);
free
(
user_lxc_path
);
values
[
i
]
=
(
*
ptr
)[
1
];
values
[
i
]
=
(
*
ptr
)[
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