From: Christian Brauner Date: Wed, 17 Mar 2021 10:03:04 +0000 (+0100) Subject: storage: keep a reference to lxc_rootfs in lxc_storage X-Git-Tag: lxc-5.0.0~197^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79defd88334c1a596e9ceb35af0aa400b66a9ac1;p=thirdparty%2Flxc.git storage: keep a reference to lxc_rootfs in lxc_storage Signed-off-by: Christian Brauner --- diff --git a/src/lxc/storage/storage.c b/src/lxc/storage/storage.c index b613f888d..4a6de6118 100644 --- a/src/lxc/storage/storage.c +++ b/src/lxc/storage/storage.c @@ -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); diff --git a/src/lxc/storage/storage.h b/src/lxc/storage/storage.h index ed369ec36..91e08b7fc 100644 --- a/src/lxc/storage/storage.h +++ b/src/lxc/storage/storage.h @@ -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; }; /**