1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-17 06:04:07 +03:00

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().
This commit is contained in:
Lennart Poettering 2023-12-04 18:02:45 +01:00
parent c961a8c605
commit 6bc201343f
2 changed files with 3 additions and 0 deletions

View File

@ -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;

View File

@ -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 */