From 79defd88334c1a596e9ceb35af0aa400b66a9ac1 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 17 Mar 2021 11:03:04 +0100 Subject: [PATCH] storage: keep a reference to lxc_rootfs in lxc_storage Signed-off-by: Christian Brauner --- src/lxc/storage/storage.c | 9 ++++----- src/lxc/storage/storage.h | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) 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; }; /** -- 2.47.2