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 <dsterba@suse.com>
This commit is contained in:
David Sterba 2024-02-20 12:59:29 +01:00
parent 7b9a3669e1
commit 3c8200302b
5 changed files with 7 additions and 7 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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);
}
/*

View file

@ -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);