]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
storage: keep a reference to lxc_rootfs in lxc_storage
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 17 Mar 2021 10:03:04 +0000 (11:03 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 21 Apr 2021 08:05:59 +0000 (10:05 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/storage/storage.c
src/lxc/storage/storage.h

index b613f888dec5835208ad99d79931e3d734c09e3d..4a6de6118616af875825ca9aa51dbbe8f541976a 100644 (file)
@@ -598,14 +598,13 @@ struct lxc_storage *storage_init(struct lxc_conf *conf)
        if (!q)
                return NULL;
 
-       bdev = malloc(sizeof(struct lxc_storage));
+       bdev = zalloc(sizeof(struct lxc_storage));
        if (!bdev)
                return NULL;
 
-       memset(bdev, 0, sizeof(struct lxc_storage));
-
-       bdev->ops = q->ops;
-       bdev->type = q->name;
+       bdev->ops       = q->ops;
+       bdev->type      = q->name;
+       bdev->rootfs    = &conf->rootfs;
 
        if (mntopts)
                bdev->mntopts = strdup(mntopts);
index ed369ec3610437d4a54d771d4d7f9317880076d2..91e08b7fcc94fd70e1548dc360b36e4c6214434f 100644 (file)
@@ -15,6 +15,7 @@
 #endif
 
 #include "compiler.h"
+#include "conf.h"
 
 #ifndef MS_DIRSYNC
 #define MS_DIRSYNC 128
@@ -87,6 +88,7 @@ struct lxc_storage {
        /* index for the connected nbd device. */
        int nbd_idx;
        int flags;
+       struct lxc_rootfs *rootfs;
 };
 
 /**