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
bfd77214
Commit
bfd77214
authored
Apr 02, 2016
by
Serge Hallyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a lxc.rootfs.bdev option (not yet honored)
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
55c91e83
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
0 deletions
+34
-0
bdev.c
src/lxc/bdev/bdev.c
+15
-0
bdev.h
src/lxc/bdev/bdev.h
+2
-0
conf.c
src/lxc/conf.c
+1
-0
conf.h
src/lxc/conf.h
+2
-0
confile.c
src/lxc/confile.c
+14
-0
No files found.
src/lxc/bdev/bdev.c
View file @
bfd77214
...
@@ -954,3 +954,18 @@ static bool unpriv_snap_allowed(struct bdev *b, const char *t, bool snap,
...
@@ -954,3 +954,18 @@ static bool unpriv_snap_allowed(struct bdev *b, const char *t, bool snap,
return
true
;
return
true
;
return
false
;
return
false
;
}
}
bool
is_valid_bdev_type
(
const
char
*
type
)
{
if
(
strcmp
(
type
,
"dir"
)
==
0
||
strcmp
(
type
,
"btrfs"
)
==
0
||
strcmp
(
type
,
"aufs"
)
==
0
||
strcmp
(
type
,
"loop"
)
==
0
||
strcmp
(
type
,
"lvm"
)
==
0
||
strcmp
(
type
,
"nbd"
)
==
0
||
strcmp
(
type
,
"ovl"
)
==
0
||
strcmp
(
type
,
"rbd"
)
==
0
||
strcmp
(
type
,
"zfs"
)
==
0
)
return
true
;
return
false
;
}
src/lxc/bdev/bdev.h
View file @
bfd77214
...
@@ -146,4 +146,6 @@ bool rootfs_is_blockdev(struct lxc_conf *conf);
...
@@ -146,4 +146,6 @@ bool rootfs_is_blockdev(struct lxc_conf *conf);
bool
attach_block_device
(
struct
lxc_conf
*
conf
);
bool
attach_block_device
(
struct
lxc_conf
*
conf
);
void
detach_block_device
(
struct
lxc_conf
*
conf
);
void
detach_block_device
(
struct
lxc_conf
*
conf
);
bool
is_valid_bdev_type
(
const
char
*
type
);
#endif // __LXC_BDEV_H
#endif // __LXC_BDEV_H
src/lxc/conf.c
View file @
bfd77214
...
@@ -4142,6 +4142,7 @@ void lxc_conf_free(struct lxc_conf *conf)
...
@@ -4142,6 +4142,7 @@ void lxc_conf_free(struct lxc_conf *conf)
free
(
conf
->
console
.
log_path
);
free
(
conf
->
console
.
log_path
);
free
(
conf
->
console
.
path
);
free
(
conf
->
console
.
path
);
free
(
conf
->
rootfs
.
mount
);
free
(
conf
->
rootfs
.
mount
);
free
(
conf
->
rootfs
.
bdev
);
free
(
conf
->
rootfs
.
options
);
free
(
conf
->
rootfs
.
options
);
free
(
conf
->
rootfs
.
path
);
free
(
conf
->
rootfs
.
path
);
free
(
conf
->
logfile
);
free
(
conf
->
logfile
);
...
...
src/lxc/conf.h
View file @
bfd77214
...
@@ -220,11 +220,13 @@ struct lxc_console {
...
@@ -220,11 +220,13 @@ struct lxc_console {
* @path : the rootfs source (directory or device)
* @path : the rootfs source (directory or device)
* @mount : where it is mounted
* @mount : where it is mounted
* @options : mount options
* @options : mount options
* @bev : optional backing store type
*/
*/
struct
lxc_rootfs
{
struct
lxc_rootfs
{
char
*
path
;
char
*
path
;
char
*
mount
;
char
*
mount
;
char
*
options
;
char
*
options
;
char
*
bdev
;
};
};
/*
/*
...
...
src/lxc/confile.c
View file @
bfd77214
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
#include "parse.h"
#include "parse.h"
#include "config.h"
#include "config.h"
#include "confile.h"
#include "confile.h"
#include "bdev/bdev.h"
#include "utils.h"
#include "utils.h"
#include "log.h"
#include "log.h"
#include "conf.h"
#include "conf.h"
...
@@ -72,6 +73,7 @@ static int config_fstab(const char *, const char *, struct lxc_conf *);
...
@@ -72,6 +73,7 @@ static int config_fstab(const char *, const char *, struct lxc_conf *);
static
int
config_rootfs
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs_mount
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs_mount
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs_options
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs_options
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_rootfs_bdev
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_pivotdir
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_pivotdir
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_utsname
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_utsname
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_hook
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
lxc_conf
);
static
int
config_hook
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
lxc_conf
);
...
@@ -130,6 +132,7 @@ static struct lxc_config_t config[] = {
...
@@ -130,6 +132,7 @@ static struct lxc_config_t config[] = {
{
"lxc.mount"
,
config_fstab
},
{
"lxc.mount"
,
config_fstab
},
{
"lxc.rootfs.mount"
,
config_rootfs_mount
},
{
"lxc.rootfs.mount"
,
config_rootfs_mount
},
{
"lxc.rootfs.options"
,
config_rootfs_options
},
{
"lxc.rootfs.options"
,
config_rootfs_options
},
{
"lxc.rootfs.bdev"
,
config_rootfs_bdev
},
{
"lxc.rootfs"
,
config_rootfs
},
{
"lxc.rootfs"
,
config_rootfs
},
{
"lxc.pivotdir"
,
config_pivotdir
},
{
"lxc.pivotdir"
,
config_pivotdir
},
{
"lxc.utsname"
,
config_utsname
},
{
"lxc.utsname"
,
config_utsname
},
...
@@ -1853,6 +1856,17 @@ static int config_rootfs_options(const char *key, const char *value,
...
@@ -1853,6 +1856,17 @@ static int config_rootfs_options(const char *key, const char *value,
return
config_string_item
(
&
lxc_conf
->
rootfs
.
options
,
value
);
return
config_string_item
(
&
lxc_conf
->
rootfs
.
options
,
value
);
}
}
static
int
config_rootfs_bdev
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
)
{
if
(
!
is_valid_bdev_type
(
value
))
{
ERROR
(
"Bad bdev type for %s: %s"
,
key
,
value
);
return
-
1
;
}
return
config_string_item
(
&
lxc_conf
->
rootfs
.
bdev
,
value
);
}
static
int
config_pivotdir
(
const
char
*
key
,
const
char
*
value
,
static
int
config_pivotdir
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
)
struct
lxc_conf
*
lxc_conf
)
{
{
...
...
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