summaryrefslogtreecommitdiff
path: root/mkfs.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-07-28 01:47:40 +0200
committerDavid Sterba <dsterba@suse.com>2016-07-28 14:08:30 +0200
commit5407ee85fcaba91c9a0207ffad97a9b8b1c45c8c (patch)
tree8b9e427c1995e4dbea858746dbe5a7a33875953d /mkfs.c
parent9c92c4eb92c41860819a5c9e25972451541f1b02 (diff)
btrfs-progs: refactor and extend btrfs_prepare_device arguments
The message about discard is printed unconditionally and does not conform to the --quite option eg. in mkfs. Consolidate the operation flags into one argument and add support for verbosity. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'mkfs.c')
-rw-r--r--mkfs.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/mkfs.c b/mkfs.c
index 9b9fe4c6..f30f0574 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1636,8 +1636,11 @@ int main(int argc, char **argv)
strerror(errno));
exit(1);
}
- ret = btrfs_prepare_device(fd, file, zero_end, &dev_block_count,
- block_count, discard);
+ ret = btrfs_prepare_device(fd, file, &dev_block_count,
+ block_count,
+ (zero_end ? PREP_DEVICE_ZERO_END : 0) |
+ (discard ? PREP_DEVICE_DISCARD : 0) |
+ (verbose ? PREP_DEVICE_VERBOSE : 0));
if (ret) {
close(fd);
exit(1);
@@ -1767,8 +1770,11 @@ int main(int argc, char **argv)
close(fd);
continue;
}
- ret = btrfs_prepare_device(fd, file, zero_end, &dev_block_count,
- block_count, discard);
+ ret = btrfs_prepare_device(fd, file, &dev_block_count,
+ block_count,
+ (verbose ? PREP_DEVICE_VERBOSE : 0) |
+ (zero_end ? PREP_DEVICE_ZERO_END : 0) |
+ (discard ? PREP_DEVICE_DISCARD : 0));
if (ret) {
close(fd);
exit(1);