diff options
author | Goffredo Baroncelli <kreijack@inwind.it> | 2024-02-08 21:19:24 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-02-20 12:19:14 +0100 |
commit | cafef4184022be97d1040c0afaf04ff3251c0e20 (patch) | |
tree | d0229ae08a8fa3cf5566db37acbf0200d83b5e11 | |
parent | 50770da81ecdca5811a608ea60a98cde16d5be19 (diff) | |
download | btrfs-progs-cafef4184022be97d1040c0afaf04ff3251c0e20.tar.gz |
btrfs-progs: replace btrfs_open_file_or_dir with btrfs_open_file_or_dir_fd
For historical reasons the helpers [btrfs_]open_dir... return also
the 'DIR *dirstream' value when a directory is opened.
However this is never used. So avoid calling diropen() and return
only the fd.
Replace btrfs_open_file_or_dir() with btrfs_open_file_or_dir_fd()
removing any references to the unused/useless dirstream variables.
Signed-off-by: Goffredo Baroncelli <kreijack@libero.it>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | cmds/inspect.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cmds/inspect.c b/cmds/inspect.c index 86023270..4d4e24d2 100644 --- a/cmds/inspect.c +++ b/cmds/inspect.c @@ -369,14 +369,13 @@ static int cmd_inspect_rootid(const struct cmd_struct *cmd, int ret; int fd = -1; u64 rootid; - DIR *dirstream = NULL; clean_args_no_options(cmd, argc, argv); if (check_argc_exact(argc - optind, 1)) return 1; - fd = btrfs_open_file_or_dir(argv[optind], &dirstream, 1); + fd = btrfs_open_file_or_dir_fd(argv[optind]); if (fd < 0) { ret = -ENOENT; goto out; @@ -391,7 +390,7 @@ static int cmd_inspect_rootid(const struct cmd_struct *cmd, pr_verbose(LOG_DEFAULT, "%llu\n", rootid); out: - close_file_or_dir(fd, dirstream); + close(fd); return !!ret; } |