storage: pass down storage type

The configuration file parser now already detects the storage type so spare the work and pass it down to the storage drivers. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com> Signed-off-by: 's avatarAdrian Reber <areber@redhat.com>
parent 693dbdb9
...@@ -213,17 +213,27 @@ static const struct lxc_storage_type bdevs[] = { ...@@ -213,17 +213,27 @@ static const struct lxc_storage_type bdevs[] = {
static const size_t numbdevs = sizeof(bdevs) / sizeof(struct lxc_storage_type); static const size_t numbdevs = sizeof(bdevs) / sizeof(struct lxc_storage_type);
static const struct lxc_storage_type *get_storage_by_name(const char *name) static const struct lxc_storage_type *get_storage_by_name(const char *name,
const char *type)
{ {
int ret;
size_t i, cmplen; size_t i, cmplen;
cmplen = strcspn(name, ":"); if (type)
cmplen = strlen(type);
else
cmplen = strcspn(name, ":");
if (cmplen == 0) if (cmplen == 0)
return NULL; return NULL;
for (i = 0; i < numbdevs; i++) for (i = 0; i < numbdevs; i++) {
if (strncmp(bdevs[i].name, name, cmplen) == 0) if (type)
ret = strncmp(bdevs[i].name, type, cmplen);
else
ret = strncmp(bdevs[i].name, name, cmplen);
if (ret == 0)
break; break;
}
if (i == numbdevs) if (i == numbdevs)
return NULL; return NULL;
...@@ -238,7 +248,7 @@ const struct lxc_storage_type *storage_query(struct lxc_conf *conf, ...@@ -238,7 +248,7 @@ const struct lxc_storage_type *storage_query(struct lxc_conf *conf,
size_t i; size_t i;
const struct lxc_storage_type *bdev; const struct lxc_storage_type *bdev;
bdev = get_storage_by_name(src); bdev = get_storage_by_name(src, conf->rootfs.bdev_type);
if (bdev) if (bdev)
return bdev; return bdev;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment