]> git.ipfire.org Git - thirdparty/systemd.git/commit
dissect: allow setting "lo_file_name" field of loopback block devices
authorLennart Poettering <lennart@poettering.net>
Mon, 6 Mar 2023 11:00:45 +0000 (12:00 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 9 Mar 2023 15:41:23 +0000 (16:41 +0100)
commit236d1fa210839eafe03250214f708667c20ddb7f
treef506d069128cad5f75d7ef8ba97861e97fc3c06d
parent07d6072e0ea25e6047007bca53b329b03c76db43
dissect: allow setting "lo_file_name" field of loopback block devices

When attaching a loopback file this allows us to set an explicit name
for it. This is useful since it allows a caller to pre-select a string
that is directly attached to the loopback file. Via udev rules we'l
later make the device accessible through this name.

Note that "lo_file_name" is supposed to carry a file name of the backing
file, but the kernel actually does not care or enforce any of that, it
just stores the filename and returns it later. This makes it so useful,
as userspace has total control of that field.

"lo_file_name" should not be confused with the sysattr
"loop/backing_file" which is actually maintained by the kernel itself,
and always shows the file to the backing inode without userspace having
direct control over the returned string. Because the sysattr is
generated by the kernel it is subject to file system namespacing and
everything, while "lo_file_name" is not, it's really just a string
passed through the kernel.
man/systemd-dissect.xml
src/dissect/dissect.c