return true;
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;
+}
#include "parse.h"
#include "config.h"
#include "confile.h"
+#include "bdev/bdev.h"
#include "utils.h"
#include "log.h"
#include "conf.h"
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_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_utsname(const char *, const char *, struct lxc_conf *);
static int config_hook(const char *, const char *, struct lxc_conf *lxc_conf);
{ "lxc.mount", config_fstab },
{ "lxc.rootfs.mount", config_rootfs_mount },
{ "lxc.rootfs.options", config_rootfs_options },
+ { "lxc.rootfs.bdev", config_rootfs_bdev },
{ "lxc.rootfs", config_rootfs },
{ "lxc.pivotdir", config_pivotdir },
{ "lxc.utsname", config_utsname },
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,
struct lxc_conf *lxc_conf)
{