btrfs-progs: drop verbosity parameter from btrfs_open_fd2()

All calls now pass true, drop the parameter.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2024-02-20 12:38:36 +01:00
parent 9b5f104558
commit 221114c36f
5 changed files with 13 additions and 13 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, true, false, false);
fd = btrfs_open_fd2(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], true, defrag_open_mode == O_RDWR, false);
fd = btrfs_open_fd2(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, true, open_flags == O_RDWR, false);
fd = btrfs_open_fd2(object, open_flags == O_RDWR, false);
if (fd < 0) {
ret = fd;
goto out;

View File

@ -188,29 +188,29 @@ out:
*
* Return the file descriptor or -errno.
*/
int btrfs_open_fd2(const char *path, bool verbose, bool read_write, bool dir_only)
int btrfs_open_fd2(const char *path, bool read_write, bool dir_only)
{
struct statfs stfs;
struct stat st;
int ret;
if (stat(path, &st) < 0) {
error_on(verbose, "cannot access '%s': %m", path);
error("cannot access '%s': %m", path);
return -errno;
}
if (dir_only && !S_ISDIR(st.st_mode)) {
error_on(verbose, "not a directory: %s", path);
error("not a directory: %s", path);
return -ENOTDIR;
}
if (statfs(path, &stfs) < 0) {
error_on(verbose, "cannot access '%s': %m", path);
error("cannot access '%s': %m", path);
return -errno;
}
if (stfs.f_type != BTRFS_SUPER_MAGIC) {
error_on(verbose, "not a btrfs filesystem: %s", path);
error("not a btrfs filesystem: %s", path);
return -EINVAL;
}
@ -220,7 +220,7 @@ int btrfs_open_fd2(const char *path, bool verbose, bool read_write, bool dir_onl
ret = open(path, O_RDWR);
if (ret < 0) {
error_on(verbose, "cannot access '%s': %m", path);
error("cannot access '%s': %m", path);
ret = -errno;
}
@ -229,12 +229,12 @@ int btrfs_open_fd2(const char *path, bool verbose, bool read_write, bool dir_onl
int btrfs_open_file_or_dir_fd(const char *path)
{
return btrfs_open_fd2(path, true, true, false);
return btrfs_open_fd2(path, true, false);
}
int btrfs_open_dir_fd(const char *path)
{
return btrfs_open_fd2(path, true, true, true);
return btrfs_open_fd2(path, true, true);
}
/*
@ -254,7 +254,7 @@ int btrfs_open_mnt_fd(const char *path)
error("'%s' is not a mounted btrfs device", path);
return -EINVAL;
}
ret = btrfs_open_fd2(mp, true, true, true);
ret = btrfs_open_fd2(mp, true, true);
} else {
ret = btrfs_open_dir_fd(path);
}

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 verbose, bool read_write, bool dir_only);
int btrfs_open_fd2(const char *path, bool read_write, bool dir_only);
int btrfs_open_file_or_dir_fd(const char *path);
int btrfs_open_dir_fd(const char *path);
int btrfs_open_mnt_fd(const char *path);