udev: re-introduce symlinks for loopback block device

But the directories are changed from /dev/loop/by-ref/ -> /dev/disk/by-loop-ref/
and /dev/loop/by-inode/ -> /dev/disk/by-loop-inode/.
As /dev/loop/ is used by losetup command for other purpose.
See issue #28475.

This effectively reverts commits 9915cc6086,
5022fab15f, and
c0d998248e.
This commit is contained in:
Yu Watanabe
2023-08-10 07:05:47 +09:00
parent 4051fc1d54
commit 7a05926fbe
5 changed files with 81 additions and 2 deletions
+5 -1
View File
@@ -1156,7 +1156,11 @@ int loop_device_set_filename(LoopDevice *d, const char *name) {
/* Sets the .lo_file_name of the loopback device. This is supposed to contain the path to the file
* backing the block device, but is actually just a free-form string you can pass to the kernel. Most
* tools that actually care for the backing file path use the sysfs attribute file loop/backing_file
* which is a kernel generated string, subject to file system namespaces and such. */
* which is a kernel generated string, subject to file system namespaces and such.
*
* .lo_file_name is useful since userspace can select it freely when creating a loopback block
* device, and we can use it for /dev/disk/by-loop-ref/ symlinks, and similar, so that apps can
* recognize their own loopback files. */
if (name && strlen(name) >= sizeof(info.lo_file_name))
return -ENOBUFS;