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
6ecf51af
Commit
6ecf51af
authored
Aug 06, 2015
by
Nicolas Cornu
Committed by
Stéphane Graber
Aug 27, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor and factorize mount entries
Signed-off-by:
Nicolas Cornu
<
ncornu@aldebaran.com
>
parent
9308363b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
43 deletions
+13
-43
conf.c
src/lxc/conf.c
+13
-43
No files found.
src/lxc/conf.c
View file @
6ecf51af
...
...
@@ -1836,14 +1836,15 @@ static int mount_entry_create_dir_file(const struct mntent *mntent,
return
ret
;
}
static
inline
int
mount_entry_on_systemfs
(
struct
mntent
*
mntent
)
static
inline
int
mount_entry_on_generic
(
struct
mntent
*
mntent
,
const
char
*
path
)
{
unsigned
long
mntflags
;
char
*
mntdata
;
int
ret
;
bool
optional
=
hasmntopt
(
mntent
,
"optional"
)
!=
NULL
;
ret
=
mount_entry_create_dir_file
(
mntent
,
mntent
->
mnt_dir
);
ret
=
mount_entry_create_dir_file
(
mntent
,
path
);
cull_mntent_opt
(
mntent
);
...
...
@@ -1852,25 +1853,27 @@ static inline int mount_entry_on_systemfs(struct mntent *mntent)
return
-
1
;
}
ret
=
mount_entry
(
mntent
->
mnt_fsname
,
mntent
->
mnt_dir
,
mnt
ent
->
mnt_type
,
mnt
flags
,
mntdata
,
optional
);
ret
=
mount_entry
(
mntent
->
mnt_fsname
,
path
,
mntent
->
mnt_type
,
mntflags
,
mntdata
,
optional
);
free
(
mntdata
);
return
ret
;
}
static
inline
int
mount_entry_on_systemfs
(
struct
mntent
*
mntent
)
{
return
mount_entry_on_generic
(
mntent
,
mntent
->
mnt_dir
);
}
static
int
mount_entry_on_absolute_rootfs
(
struct
mntent
*
mntent
,
const
struct
lxc_rootfs
*
rootfs
,
const
char
*
lxc_name
)
{
char
*
aux
;
char
path
[
MAXPATHLEN
];
unsigned
long
mntflags
;
char
*
mntdata
;
int
r
,
ret
=
0
,
offset
;
const
char
*
lxcpath
;
bool
optional
=
hasmntopt
(
mntent
,
"optional"
)
!=
NULL
;
lxcpath
=
lxc_global_config_value
(
"lxc.lxcpath"
);
if
(
!
lxcpath
)
{
...
...
@@ -1894,7 +1897,7 @@ skipvarlib:
aux
=
strstr
(
mntent
->
mnt_dir
,
rootfs
->
path
);
if
(
!
aux
)
{
WARN
(
"ignoring mount point '%s'"
,
mntent
->
mnt_dir
);
goto
ou
t
;
return
re
t
;
}
offset
=
strlen
(
rootfs
->
path
);
...
...
@@ -1904,36 +1907,17 @@ skipabs:
aux
+
offset
);
if
(
r
<
0
||
r
>=
MAXPATHLEN
)
{
WARN
(
"pathnme too long for '%s'"
,
mntent
->
mnt_dir
);
ret
=
-
1
;
goto
out
;
}
ret
=
mount_entry_create_dir_file
(
mntent
,
path
);
cull_mntent_opt
(
mntent
);
if
(
parse_mntopts
(
mntent
->
mnt_opts
,
&
mntflags
,
&
mntdata
)
<
0
)
{
free
(
mntdata
);
return
-
1
;
}
ret
=
mount_entry
(
mntent
->
mnt_fsname
,
path
,
mntent
->
mnt_type
,
mntflags
,
mntdata
,
optional
);
free
(
mntdata
);
out:
return
ret
;
return
mount_entry_on_generic
(
mntent
,
path
);
}
static
int
mount_entry_on_relative_rootfs
(
struct
mntent
*
mntent
,
const
char
*
rootfs
)
{
char
path
[
MAXPATHLEN
];
unsigned
long
mntflags
;
char
*
mntdata
;
int
ret
;
bool
optional
=
hasmntopt
(
mntent
,
"optional"
)
!=
NULL
;
/* relative to root mount point */
ret
=
snprintf
(
path
,
sizeof
(
path
),
"%s/%s"
,
rootfs
,
mntent
->
mnt_dir
);
...
...
@@ -1942,21 +1926,7 @@ static int mount_entry_on_relative_rootfs(struct mntent *mntent,
return
-
1
;
}
ret
=
mount_entry_create_dir_file
(
mntent
,
path
);
cull_mntent_opt
(
mntent
);
if
(
parse_mntopts
(
mntent
->
mnt_opts
,
&
mntflags
,
&
mntdata
)
<
0
)
{
free
(
mntdata
);
return
-
1
;
}
ret
=
mount_entry
(
mntent
->
mnt_fsname
,
path
,
mntent
->
mnt_type
,
mntflags
,
mntdata
,
optional
);
free
(
mntdata
);
return
ret
;
return
mount_entry_on_generic
(
mntent
,
path
);
}
static
int
mount_file_entries
(
const
struct
lxc_rootfs
*
rootfs
,
FILE
*
file
,
...
...
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