From 3c8200302ba517c0a0dc597e1ce0e7a13e58c60e Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 20 Feb 2024 12:59:29 +0100 Subject: [PATCH] btrfs-progs: rename btrfs_open_fd2() to btrfs_open_path() Use a more descriptive name, the interface is generic so it should use the generic term for file/directory. Signed-off-by: David Sterba --- cmds/filesystem-du.c | 2 +- cmds/filesystem.c | 2 +- cmds/property.c | 2 +- common/open-utils.c | 6 +++--- common/open-utils.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmds/filesystem-du.c b/cmds/filesystem-du.c index 0ec877cd..87b85a37 100644 --- a/cmds/filesystem-du.c +++ b/cmds/filesystem-du.c @@ -456,7 +456,7 @@ static int du_add_file(const char *filename, int dirfd, ret = sprintf(pathp, "/%s", filename); pathp += ret; - fd = btrfs_open_fd2(path, false, false); + fd = btrfs_open_path(path, false, false); if (fd < 0) { ret = fd; goto out; diff --git a/cmds/filesystem.c b/cmds/filesystem.c index 7ca48dbe..c9930a02 100644 --- a/cmds/filesystem.c +++ b/cmds/filesystem.c @@ -1150,7 +1150,7 @@ static int cmd_filesystem_defrag(const struct cmd_struct *cmd, struct stat st; int defrag_err = 0; - fd = btrfs_open_fd2(argv[i], defrag_open_mode == O_RDWR, false); + fd = btrfs_open_path(argv[i], defrag_open_mode == O_RDWR, false); if (fd < 0) { ret = fd; goto next; diff --git a/cmds/property.c b/cmds/property.c index 0969d58b..ec611c46 100644 --- a/cmds/property.c +++ b/cmds/property.c @@ -179,7 +179,7 @@ static int prop_compression(enum prop_object_type type, char *xattr_name = NULL; int open_flags = value ? O_RDWR : O_RDONLY; - fd = btrfs_open_fd2(object, open_flags == O_RDWR, false); + fd = btrfs_open_path(object, open_flags == O_RDWR, false); if (fd < 0) { ret = fd; goto out; diff --git a/common/open-utils.c b/common/open-utils.c index e09b9446..95294f63 100644 --- a/common/open-utils.c +++ b/common/open-utils.c @@ -188,7 +188,7 @@ out: * * Return the file descriptor or -errno. */ -int btrfs_open_fd2(const char *path, bool read_write, bool dir_only) +int btrfs_open_path(const char *path, bool read_write, bool dir_only) { struct statfs stfs; struct stat st; @@ -229,13 +229,13 @@ int btrfs_open_fd2(const char *path, bool read_write, bool dir_only) int btrfs_open_file_or_dir(const char *path) { - return btrfs_open_fd2(path, true, false); + return btrfs_open_path(path, true, false); } /* Open the path for write and check that it's a directory. */ int btrfs_open_dir(const char *path) { - return btrfs_open_fd2(path, true, true); + return btrfs_open_path(path, true, true); } /* diff --git a/common/open-utils.h b/common/open-utils.h index e5775b8f..04fd8eb1 100644 --- a/common/open-utils.h +++ b/common/open-utils.h @@ -29,7 +29,7 @@ int check_mounted_where(int fd, const char *file, char *where, int size, int check_mounted(const char* file); int get_btrfs_mount(const char *dev, char *mp, size_t mp_size); -int btrfs_open_fd2(const char *path, bool read_write, bool dir_only); +int btrfs_open_path(const char *path, bool read_write, bool dir_only); int btrfs_open_file_or_dir(const char *path); int btrfs_open_dir(const char *path); int btrfs_open_mnt(const char *path);