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.
This commit is contained in:
@@ -92,3 +92,7 @@
|
||||
#define RAW_O_LARGEFILE 00100000
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AT_HANDLE_FID
|
||||
#define AT_HANDLE_FID AT_REMOVEDIR
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user