}
d->backing_file = TAKE_PTR(backing_file);
+ d->backing_inode = st.st_ino;
+ d->backing_devno = st.st_dev;
log_debug("Successfully acquired %s, devno=%u:%u, nr=%i, diskseq=%" PRIu64,
d->node,
_cleanup_close_ int fd = -EBADF, lock_fd = -EBADF;
_cleanup_free_ char *node = NULL, *backing_file = NULL;
+ dev_t devnum, backing_devno = 0;
struct loop_info64 info;
+ ino_t backing_inode = 0;
uint64_t diskseq = 0;
LoopDevice *d;
const char *s;
- dev_t devnum;
int r, nr = -1;
assert(dev);
if (!backing_file)
return -ENOMEM;
}
+
+ backing_devno = info.lo_device;
+ backing_inode = info.lo_inode;
}
r = fd_get_diskseq(fd, &diskseq);
.node = TAKE_PTR(node),
.dev = sd_device_ref(dev),
.backing_file = TAKE_PTR(backing_file),
+ .backing_inode = backing_inode,
+ .backing_devno = backing_devno,
.relinquished = true, /* It's not ours, don't try to destroy it when this object is freed */
.devno = devnum,
.diskseq = diskseq,
unsigned n_ref;
int fd;
int lock_fd;
- int nr; /* The loopback device index (i.e. 4 for /dev/loop4); if this object encapsulates a non-loopback block device, set to -1 */
- dev_t devno;
+ int nr; /* The loopback device index (i.e. 4 for /dev/loop4); if this object encapsulates a non-loopback block device, set to -1 */
+ dev_t devno; /* The loopback device's own dev_t */
char *node;
sd_device *dev;
char *backing_file;
bool relinquished;
+ 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 */
uint64_t uevent_seqnum_not_before; /* uevent sequm right before we attached the loopback device, or UINT64_MAX if we don't know */
usec_t timestamp_not_before; /* CLOCK_MONOTONIC timestamp taken immediately before attaching the loopback device, or USEC_INFINITY if we don't know */