mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-04 11:51:42 +00:00
btrfs-progs: fi show: remove stray newline in filesystem show
Remove last newline in the output of 'btrfs filesystem show', keep the line between two filesystems so the devices are visually grouped togehter. Pull-request: #866 Author: Matt Langford <github@matt.boats> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
7c3b897803
commit
4331bfb011
@ -365,7 +365,6 @@ static void print_one_uuid(struct btrfs_fs_devices *fs_devices,
|
||||
if (devs_found < total) {
|
||||
pr_verbose(LOG_DEFAULT, "\t*** Some devices missing\n");
|
||||
}
|
||||
pr_verbose(LOG_DEFAULT, "\n");
|
||||
}
|
||||
|
||||
/* adds up all the used spaces as reported by the space info ioctl
|
||||
@ -431,7 +430,6 @@ static int print_one_fs(struct btrfs_ioctl_fs_info_args *fs_info,
|
||||
free(canonical_path);
|
||||
}
|
||||
|
||||
pr_verbose(LOG_DEFAULT, "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -481,6 +479,10 @@ static int btrfs_scan_kernel(void *search, unsigned unit_mode)
|
||||
|
||||
fd = open(mnt->mnt_dir, O_RDONLY);
|
||||
if ((fd != -1) && !get_df(fd, &space_info_arg)) {
|
||||
/* Put space between filesystem entries for readability. */
|
||||
if (found != 0)
|
||||
pr_verbose(LOG_DEFAULT, "\n");
|
||||
|
||||
print_one_fs(&fs_info_arg, dev_info_arg,
|
||||
space_info_arg, label, unit_mode);
|
||||
free(space_info_arg);
|
||||
@ -757,6 +759,7 @@ static int cmd_filesystem_show(const struct cmd_struct *cmd,
|
||||
char uuid_buf[BTRFS_UUID_UNPARSED_SIZE];
|
||||
unsigned unit_mode;
|
||||
int found = 0;
|
||||
bool needs_newline = false;
|
||||
|
||||
unit_mode = get_unit_mode_from_arg(&argc, argv, 0);
|
||||
|
||||
@ -845,6 +848,12 @@ static int cmd_filesystem_show(const struct cmd_struct *cmd,
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* The above call will return 0 if it found anything, in those cases we
|
||||
* need an extra newline below.
|
||||
*/
|
||||
needs_newline = !ret;
|
||||
|
||||
/* shows mounted only */
|
||||
if (where == BTRFS_SCAN_MOUNTED)
|
||||
goto out;
|
||||
@ -882,8 +891,14 @@ devs_only:
|
||||
goto out;
|
||||
}
|
||||
|
||||
list_for_each_entry(fs_devices, &all_uuids, fs_list)
|
||||
list_for_each_entry(fs_devices, &all_uuids, fs_list) {
|
||||
/* Put space between filesystem entries for readability. */
|
||||
if (needs_newline)
|
||||
pr_verbose(LOG_DEFAULT, "\n");
|
||||
|
||||
print_one_uuid(fs_devices, unit_mode);
|
||||
needs_newline = true;
|
||||
}
|
||||
|
||||
if (search && !found) {
|
||||
error("not a valid btrfs filesystem: %s", search);
|
||||
|
Loading…
Reference in New Issue
Block a user