mountpoint-util: rename fd_is_mount_point() to is_mount_point_at()

fd_* functions in our codebase usually mean fd-specific operations,
while this one actually takes openat()-style params. Rename it
accordingly hence.
This commit is contained in:
Mike Yuan
2025-01-20 21:53:43 +01:00
parent e2f97c790e
commit 7ce2c1bb5f
12 changed files with 37 additions and 37 deletions

View File

@@ -212,7 +212,7 @@ bool file_handle_equal(const struct file_handle *a, const struct file_handle *b)
return memcmp_nn(a->f_handle, a->handle_bytes, b->f_handle, b->handle_bytes) == 0;
}
int fd_is_mount_point(int fd, const char *filename, int flags) {
int is_mount_point_at(int fd, const char *filename, int flags) {
bool fd_is_self;
int r;
@@ -376,7 +376,7 @@ int path_is_mount_point_full(const char *path, const char *root, int flags) {
if (path_equal(path, "/"))
return 1;
/* we need to resolve symlinks manually, we can't just rely on fd_is_mount_point() to do that for us;
/* we need to resolve symlinks manually, we can't just rely on is_mount_point_at() to do that for us;
* if we have a structure like /bin -> /usr/bin/ and /usr is a mount point, then the parent that we
* look at needs to be /usr, not /. */
if (FLAGS_SET(flags, AT_SYMLINK_FOLLOW)) {
@@ -391,7 +391,7 @@ int path_is_mount_point_full(const char *path, const char *root, int flags) {
if (fd < 0)
return fd;
return fd_is_mount_point(fd, last_path_component(path), flags);
return is_mount_point_at(fd, last_path_component(path), flags);
}
int path_get_mnt_id_at_fallback(int dir_fd, const char *path, int *ret) {

View File

@@ -49,7 +49,7 @@ static inline int path_get_mnt_id(const char *path, int *ret) {
return path_get_mnt_id_at(AT_FDCWD, path, ret);
}
int fd_is_mount_point(int fd, const char *filename, int flags);
int is_mount_point_at(int fd, const char *filename, int flags);
int path_is_mount_point_full(const char *path, const char *root, int flags);
static inline int path_is_mount_point(const char *path) {
return path_is_mount_point_full(path, NULL, 0);

View File

@@ -384,7 +384,7 @@ int recurse_dir(
if (sx_valid && FLAGS_SET(sx.stx_attributes_mask, STATX_ATTR_MOUNT_ROOT))
is_mount = FLAGS_SET(sx.stx_attributes, STATX_ATTR_MOUNT_ROOT);
else {
r = fd_is_mount_point(dir_fd, de->entries[i]->d_name, 0);
r = is_mount_point_at(dir_fd, de->entries[i]->d_name, 0);
if (r < 0)
log_debug_errno(r, "Failed to determine whether %s is a submount, assuming not: %m", p);