]> git.ipfire.org Git - thirdparty/systemd.git/commit
mountpoint-util: add new helper name_to_handle_at_try_fid()
authorLennart Poettering <lennart@poettering.net>
Tue, 25 Jun 2024 10:41:03 +0000 (12:41 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 1 Jul 2024 13:45:15 +0000 (15:45 +0200)
commit81995fbb9640a20010a8a4648db3e3c4882f2bdf
tree5944631abafa59c0e90b36f99da53b85c7bd9c08
parent6fba9a28b99dd6d12c12eaa3c84c3f8a1e54e4b0
mountpoint-util: add new helper name_to_handle_at_try_fid()

Newer kernels support a new flag for name_to_handle_at(): AT_HANDLE_FID.
This flag is supposed to return an identifier for an inode that we can
use for checking inode identity. It's supposed to be a replacement for
checking .st_ino which doesn't work anymore today because inode numbers
are no longer unique on file systems (not on overlayfs, and not on btrfs
for example). Hence, be a good citizen and add infrastructure to support
AT_HANDLE_FID. Unfortunately that doesn't work for old kernels, hence
add a fallback logic: if we can use the flag, use it. If we cannot use
name_to_handle_at() without it, which might give us a good ID too. But
of course tha tcan fail as well, which callers have to check.
src/basic/missing_fcntl.h
src/basic/mountpoint-util.c
src/basic/mountpoint-util.h