btrfs-progs: print help test to stdout

Signed-off-by: David Sterba <dsterba@suse.com>
master
David Sterba 2016-09-03 20:30:50 +02:00
parent f919530b3a
commit 57d1cbd867
6 changed files with 45 additions and 53 deletions

View File

@ -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 "
"<num>,<num>,<num> (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 <num>,<num>,<num> (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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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[])