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
f6815906
Unverified
Commit
f6815906
authored
Mar 17, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: add first, trivial support for idmapped mounts
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
0b932f9d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
conf.c
src/lxc/conf.c
+19
-2
conf.h
src/lxc/conf.h
+3
-1
No files found.
src/lxc/conf.c
View file @
f6815906
...
...
@@ -98,6 +98,10 @@
#include <../include/prlimit.h>
#endif
#ifndef HAVE_STRLCPY
#include "include/strlcpy.h"
#endif
lxc_log_define
(
conf
,
lxc
);
/*
...
...
@@ -2095,6 +2099,7 @@ const char *lxc_mount_options_info[LXC_MOUNT_MAX] = {
"create=file"
,
"optional"
,
"relative"
,
"idmap="
,
};
/* Remove "optional", "create=dir", and "create=file" from mntopt */
...
...
@@ -2103,7 +2108,8 @@ void parse_lxc_mntopts(struct lxc_mount_options *opts, char *mnt_opts)
for
(
size_t
i
=
LXC_MOUNT_CREATE_DIR
;
i
<
LXC_MOUNT_MAX
;
i
++
)
{
const
char
*
opt_name
=
lxc_mount_options_info
[
i
];
char
*
p
,
*
p2
;
size_t
len
;
char
*
idmap_path
,
*
p
,
*
p2
;
p
=
strstr
(
mnt_opts
,
opt_name
);
if
(
!
p
)
...
...
@@ -2122,9 +2128,20 @@ void parse_lxc_mntopts(struct lxc_mount_options *opts, char *mnt_opts)
case
LXC_MOUNT_RELATIVE
:
opts
->
relative
=
1
;
break
;
case
LXC_MOUNT_IDMAP
:
p2
=
p
;
p2
+=
STRLITERALLEN
(
"idmap="
);
idmap_path
=
strchrnul
(
p2
,
','
);
len
=
strlcpy
(
opts
->
userns_path
,
p2
,
idmap_path
-
p2
+
1
);
if
(
len
>=
sizeof
(
opts
->
userns_path
))
WARN
(
"Excessive idmap path length for
\"
idmap=<path>
\"
LXC specific mount option"
);
else
TRACE
(
"Parse LXC specific mount option
\"
idmap=%s
\"
"
,
opts
->
userns_path
);
break
;
default:
WARN
(
"Unknown LXC specific mount option"
);
continue
;
break
;
}
p2
=
strchr
(
p
,
','
);
...
...
src/lxc/conf.h
View file @
f6815906
...
...
@@ -186,7 +186,8 @@ typedef enum lxc_mount_options_t {
LXC_MOUNT_CREATE_FILE
=
1
,
LXC_MOUNT_OPTIONAL
=
2
,
LXC_MOUNT_RELATIVE
=
3
,
LXC_MOUNT_MAX
=
4
,
LXC_MOUNT_IDMAP
=
4
,
LXC_MOUNT_MAX
=
5
,
}
lxc_mount_options_t
;
__hidden
extern
const
char
*
lxc_mount_options_info
[
LXC_MOUNT_MAX
];
...
...
@@ -196,6 +197,7 @@ struct lxc_mount_options {
int
create_file
:
1
;
int
optional
:
1
;
int
relative
:
1
;
char
userns_path
[
PATH_MAX
];
};
/* Defines a structure to store the rootfs location, the
...
...
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