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:
@@ -39,6 +39,7 @@
|
||||
bool is_name_to_handle_at_fatal_error(int err);
|
||||
|
||||
int name_to_handle_at_loop(int fd, const char *path, struct file_handle **ret_handle, int *ret_mnt_id, int flags);
|
||||
int name_to_handle_at_try_fid(int fd, const char *path, struct file_handle **ret_handle, int *ret_mnt_id, int flags);
|
||||
|
||||
bool file_handle_equal(const struct file_handle *a, const struct file_handle *b);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user