From 57d1cbd867311d99a2ae5e3cdcffd04460ec372a Mon Sep 17 00:00:00 2001 From: David Sterba Date: Sat, 3 Sep 2016 20:30:50 +0200 Subject: [PATCH] btrfs-progs: print help test to stdout Signed-off-by: David Sterba --- btrfs-corrupt-block.c | 44 ++++++++++++++++++------------------------- btrfs-image.c | 22 +++++++++++----------- btrfs-map-logical.c | 10 +++++----- btrfs-select-super.c | 4 ++-- btrfs-zero-log.c | 2 +- btrfstune.c | 16 ++++++++-------- 6 files changed, 45 insertions(+), 53 deletions(-) diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c index a488e479..789cbc70 100644 --- a/btrfs-corrupt-block.c +++ b/btrfs-corrupt-block.c @@ -103,32 +103,24 @@ static int debug_corrupt_block(struct extent_buffer *eb, static void print_usage(int ret) { - fprintf(stderr, "usage: btrfs-corrupt-block [options] device\n"); - fprintf(stderr, "\t-l Logical extent to be corrupted\n"); - fprintf(stderr, "\t-c Copy of the extent to be corrupted" - " (usually 1 or 2, default: 0)\n"); - fprintf(stderr, "\t-b Number of bytes to be corrupted\n"); - fprintf(stderr, "\t-e Extent to be corrupted\n"); - fprintf(stderr, "\t-E The whole extent tree to be corrupted\n"); - fprintf(stderr, "\t-u Given chunk item to be corrupted\n"); - fprintf(stderr, "\t-U The whole chunk tree to be corrupted\n"); - fprintf(stderr, "\t-i The inode item to corrupt (must also specify " - "the field to corrupt)\n"); - fprintf(stderr, "\t-x The file extent item to corrupt (must also " - "specify -i for the inode and -f for the field to corrupt)\n"); - fprintf(stderr, "\t-m The metadata block to corrupt (must also " - "specify -f for the field to corrupt)\n"); - fprintf(stderr, "\t-K The key to corrupt in the format " - ",, (must also specify -f for the field)\n"); - fprintf(stderr, "\t-f The field in the item to corrupt\n"); - fprintf(stderr, "\t-I An item to corrupt (must also specify the field " - "to corrupt and a root+key for the item)\n"); - fprintf(stderr, "\t-D Corrupt a dir item, must specify key and field\n"); - fprintf(stderr, "\t-d Delete this item (must specify -K)\n"); - fprintf(stderr, "\t-r Operate on this root (only works with -d)\n"); - fprintf(stderr, "\t-C Delete a csum for the specified bytenr. When " - "used with -b it'll delete that many bytes, otherwise it's " - "just sectorsize\n"); + printf("usage: btrfs-corrupt-block [options] device\n"); + printf("\t-l Logical extent to be corrupted\n"); + printf("\t-c Copy of the extent to be corrupted (usually 1 or 2, default: 0)\n"); + printf("\t-b Number of bytes to be corrupted\n"); + printf("\t-e Extent to be corrupted\n"); + printf("\t-E The whole extent tree to be corrupted\n"); + printf("\t-u Given chunk item to be corrupted\n"); + printf("\t-U The whole chunk tree to be corrupted\n"); + printf("\t-i The inode item to corrupt (must also specify the field to corrupt)\n"); + printf("\t-x The file extent item to corrupt (must also specify -i for the inode and -f for the field to corrupt)\n"); + printf("\t-m The metadata block to corrupt (must also specify -f for the field to corrupt)\n"); + printf("\t-K The key to corrupt in the format ,, (must also specify -f for the field)\n"); + printf("\t-f The field in the item to corrupt\n"); + printf("\t-I An item to corrupt (must also specify the field to corrupt and a root+key for the item)\n"); + printf("\t-D Corrupt a dir item, must specify key and field\n"); + printf("\t-d Delete this item (must specify -K)\n"); + printf("\t-r Operate on this root (only works with -d)\n"); + printf("\t-C Delete a csum for the specified bytenr. When used with -b it'll delete that many bytes, otherwise it's just sectorsize\n"); exit(ret); } diff --git a/btrfs-image.c b/btrfs-image.c index af5437b4..3039c0c1 100644 --- a/btrfs-image.c +++ b/btrfs-image.c @@ -2716,17 +2716,17 @@ out: static void print_usage(int ret) { - fprintf(stderr, "usage: btrfs-image [options] source target\n"); - fprintf(stderr, "\t-r \trestore metadump image\n"); - fprintf(stderr, "\t-c value\tcompression level (0 ~ 9)\n"); - fprintf(stderr, "\t-t value\tnumber of threads (1 ~ 32)\n"); - fprintf(stderr, "\t-o \tdon't mess with the chunk tree when restoring\n"); - fprintf(stderr, "\t-s \tsanitize file names, use once to just use garbage, use twice if you want crc collisions\n"); - fprintf(stderr, "\t-w \twalk all trees instead of using extent tree, do this if your extent tree is broken\n"); - fprintf(stderr, "\t-m \trestore for multiple devices\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "\tIn the dump mode, source is the btrfs device and target is the output file (use '-' for stdout).\n"); - fprintf(stderr, "\tIn the restore mode, source is the dumped image and target is the btrfs device/file.\n"); + printf("usage: btrfs-image [options] source target\n"); + printf("\t-r \trestore metadump image\n"); + printf("\t-c value\tcompression level (0 ~ 9)\n"); + printf("\t-t value\tnumber of threads (1 ~ 32)\n"); + printf("\t-o \tdon't mess with the chunk tree when restoring\n"); + printf("\t-s \tsanitize file names, use once to just use garbage, use twice if you want crc collisions\n"); + printf("\t-w \twalk all trees instead of using extent tree, do this if your extent tree is broken\n"); + printf("\t-m \trestore for multiple devices\n"); + printf("\n"); + printf("\tIn the dump mode, source is the btrfs device and target is the output file (use '-' for stdout).\n"); + printf("\tIn the restore mode, source is the dumped image and target is the btrfs device/file.\n"); exit(ret); } diff --git a/btrfs-map-logical.c b/btrfs-map-logical.c index f421a50f..f3be1ea8 100644 --- a/btrfs-map-logical.c +++ b/btrfs-map-logical.c @@ -193,11 +193,11 @@ static int write_extent_content(struct btrfs_fs_info *fs_info, int out_fd, static void print_usage(void) __attribute__((noreturn)); static void print_usage(void) { - fprintf(stderr, "usage: btrfs-map-logical [options] device\n"); - fprintf(stderr, "\t-l Logical extent to map\n"); - fprintf(stderr, "\t-c Copy of the extent to read (usually 1 or 2)\n"); - fprintf(stderr, "\t-o Output file to hold the extent\n"); - fprintf(stderr, "\t-b Number of bytes to read\n"); + printf("usage: btrfs-map-logical [options] device\n"); + printf("\t-l Logical extent to map\n"); + printf("\t-c Copy of the extent to read (usually 1 or 2)\n"); + printf("\t-o Output file to hold the extent\n"); + printf("\t-b Number of bytes to read\n"); exit(1); } diff --git a/btrfs-select-super.c b/btrfs-select-super.c index 4f4ec0b6..7e96dc0b 100644 --- a/btrfs-select-super.c +++ b/btrfs-select-super.c @@ -32,8 +32,8 @@ static void print_usage(void) { - fprintf(stderr, "usage: btrfs-select-super -s number dev\n"); - fprintf(stderr, "%s\n", PACKAGE_STRING); + printf("usage: btrfs-select-super -s number dev\n"); + printf("\t-s super copy of superbloc to overwrite the primary one (values: 1, 2)\n"); exit(1); } diff --git a/btrfs-zero-log.c b/btrfs-zero-log.c index f5ca9fcf..44293998 100644 --- a/btrfs-zero-log.c +++ b/btrfs-zero-log.c @@ -27,7 +27,7 @@ __attribute__((noreturn)) static void print_usage(void) { - fprintf(stderr, "usage: btrfs-zero-log dev\n"); + printf("usage: btrfs-zero-log dev\n"); exit(1); } diff --git a/btrfstune.c b/btrfstune.c index 93b25e8c..b824f2b8 100644 --- a/btrfstune.c +++ b/btrfstune.c @@ -376,14 +376,14 @@ out: static void print_usage(void) { - fprintf(stderr, "usage: btrfstune [options] device\n"); - fprintf(stderr, "\t-S value\tpositive value will enable seeding, zero to disable, negative is not allowed\n"); - fprintf(stderr, "\t-r \t\tenable extended inode refs\n"); - fprintf(stderr, "\t-x \t\tenable skinny metadata extent refs\n"); - fprintf(stderr, "\t-n \t\tenable no-holes feature (more efficient sparse file representation)\n"); - fprintf(stderr, "\t-f \t\tforce to do dangerous operation, make sure that you are aware of the dangers\n"); - fprintf(stderr, "\t-u \t\tchange fsid, use a random one\n"); - fprintf(stderr, "\t-U UUID\t\tchange fsid to UUID\n"); + printf("usage: btrfstune [options] device\n"); + printf("\t-S value\tpositive value will enable seeding, zero to disable, negative is not allowed\n"); + printf("\t-r \t\tenable extended inode refs\n"); + printf("\t-x \t\tenable skinny metadata extent refs\n"); + printf("\t-n \t\tenable no-holes feature (more efficient sparse file representation)\n"); + printf("\t-f \t\tforce to do dangerous operation, make sure that you are aware of the dangers\n"); + printf("\t-u \t\tchange fsid, use a random one\n"); + printf("\t-U UUID\t\tchange fsid to UUID\n"); } int main(int argc, char *argv[])