Let's store this away. It's useful when matching up mounts (i.e. struct
stat's .st_dev field) with loopback devices.
.nr = nr,
.node = TAKE_PTR(loopdev),
.relinquished = true, /* It's not allocated by us, don't destroy it when this object is freed */
+ .devno = st.st_rdev,
};
*ret = d;
UINT64_C(240) * USEC_PER_MSEC * n_attempts/64));
}
+ if (fstat(loop_with_fd, &st) < 0)
+ return -errno;
+ assert(S_ISBLK(st.st_mode));
+
d = new(LoopDevice, 1);
if (!d)
return -ENOMEM;
.fd = TAKE_FD(loop_with_fd),
.node = TAKE_PTR(loopdev),
.nr = nr,
+ .devno = st.st_rdev,
};
*ret = d;
struct LoopDevice {
int fd;
int nr;
+ dev_t devno;
char *node;
bool relinquished;
};