From: Thomas Weißschuh Date: Wed, 16 Apr 2025 09:53:36 +0000 (+0200) Subject: lib/loopdev: clarify comment about device and backing file modes X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c6fc8252299fd4a8b1b02f936ac9dcc7521bd595;p=thirdparty%2Futil-linux.git lib/loopdev: clarify comment about device and backing file modes If either the backing file or ioctl loop device are opened read-only the kernel will silently downgrade the resulting loop device to read-only. Adapt the comment to this. Signed-off-by: Thomas Weißschuh --- diff --git a/lib/loopdev.c b/lib/loopdev.c index 11bbc1869..f2931552c 100644 --- a/lib/loopdev.c +++ b/lib/loopdev.c @@ -1418,12 +1418,9 @@ int loopcxt_setup_device(struct loopdev_cxt *lc) do { errno = 0; - /* For the ioctls, it's enough to use O_RDONLY, but udevd - * monitor devices by inotify, and udevd needs IN_CLOSE_WRITE - * event to trigger probing of the new device. - * - * The mode used for the device does not have to match the mode - * used for the backing file. + /* For the ioctls, it's enough to use O_RDONLY for a read-only + * loop device, but udevd monitor devices by inotify, and udevd + * needs IN_CLOSE_WRITE event to trigger probing of the new device. */ dev_fd = __loopcxt_get_fd(lc, O_RDWR); if (dev_fd >= 0 || lc->control_ok == 0)