From: Lennart Poettering Date: Mon, 4 Dec 2023 17:02:45 +0000 (+0100) Subject: loop-util: remember if we created the LoopDevice X-Git-Tag: v256-rc1~1490^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6bc201343fea0d01b96eac37c46dd12b2a3dfab4;p=thirdparty%2Fsystemd.git loop-util: remember if we created the LoopDevice Let's store in a bool whether a LoopDevice object was created via loop_device_open() or loop_device_make(). --- diff --git a/src/shared/loop-util.c b/src/shared/loop-util.c index c337e881fe2..8434587286c 100644 --- a/src/shared/loop-util.c +++ b/src/shared/loop-util.c @@ -427,6 +427,7 @@ static int loop_configure( .timestamp_not_before = timestamp, .sector_size = c->block_size, .device_size = device_size, + .created = true, }; *ret = TAKE_PTR(d); @@ -989,6 +990,7 @@ int loop_device_open( .timestamp_not_before = USEC_INFINITY, .sector_size = sector_size, .device_size = device_size, + .created = false, }; *ret = d; diff --git a/src/shared/loop-util.h b/src/shared/loop-util.h index 194e7f78d4e..94357bba717 100644 --- a/src/shared/loop-util.h +++ b/src/shared/loop-util.h @@ -22,6 +22,7 @@ struct LoopDevice { sd_device *dev; char *backing_file; bool relinquished; + bool created; /* If we created the device */ dev_t backing_devno; /* The backing file's dev_t */ ino_t backing_inode; /* The backing file's ino_t */ uint64_t diskseq; /* Block device sequence number, monothonically incremented by the kernel on create/attach, or 0 if we don't know */