btrfs-progs: corrupt-block: update help text

The help text is out of sync with many options, lacking the long
options, required arguments or mistakenly requiring arguments when the
value is read from another one.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2022-07-27 23:30:24 +02:00
parent b4c8b9054d
commit 468ad6b9b8

View File

@ -86,26 +86,49 @@ static int debug_corrupt_block(struct extent_buffer *eb,
static void print_usage(int ret)
{
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 <u64,u8,u64> Corrupt the given key (must also specify -f for the field and optionally -r for the root)\n");
printf("\t-f The field in the item to corrupt\n");
printf("\t-I <u64,u8,u64> Corrupt an item corresponding to the passed key triplet (must also specify the field, or a (bytes, offset, value) tuple to corrupt and root for the item)\n");
printf("\t-D <u64,u8,u64> Corrupt a dir item corresponding to the passed key triplet, must also specify a field\n");
printf("\t-d <u64,u8,u64> Delete item corresponding to passed key triplet\n");
printf("\t-r Operate on this root\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");
printf("\t--block-group OFFSET corrupt the given block group\n");
printf("\t--value VALUE Value to use for corrupting item data\n");
printf("\t--offset OFFSET Offset to use for corrupting item data\n");
printf("\n");
printf("Corrupt data structures on a btrfs filesystem. For testing only!\n");
printf("\n");
printf(" -l EXTENT\n");
printf(" --logical EXTENT logical extent to be corrupted\n");
printf(" -c COPY\n");
printf(" --copy COPY copy of the extent to be corrupted (usually 1 or 2, default: 0)\n");
printf(" -b COUNT\n");
printf(" --bytes COUNT number of bytes to be corrupted\n");
printf(" -e\n");
printf(" --extent-record corrupt the extent\n");
printf(" -E\n");
printf(" --extent-tree corrupt the whole extent tree\n");
printf(" -u\n");
printf(" --chunk-record corrupt the given chunk\n");
printf(" -U\n");
printf(" --chunk-tree corrupt the whole whole chunk tree\n");
printf(" -i INODE\n");
printf(" --inode INODE inode number to corrupt (must also specify the field to corrupt)\n");
printf(" -x EXTENT\n");
printf(" --file-extent EXTENT file extent item to corrupt (must also specify -i for the inode and -f for the field to corrupt)\n");
printf(" -m BLOCK\n");
printf(" --metadata-block BLOCK\n");
printf(" metadata block to corrupt (must also specify -f for the field to corrupt)\n");
printf(" -k\n");
printf(" --keys corrupt block keys (set by --logical)\n");
printf(" -K <u64,u8,u64>\n");
printf(" --key <u64,u8,u64> corrupt the given key (must also specify -f for the field and optionally -r for the root)\n");
printf(" -f FIELD\n");
printf(" --field FIELD field name in the item to corrupt\n");
printf(" -I\n");
printf(" --item corrupt an item corresponding to the passed key triplet (must also specify the field, or a (bytes, offset, value) tuple to corrupt and root for the item)\n");
printf(" -D\n");
printf(" --dir-item corrupt a dir item corresponding to the passed key triplet, must also specify a field\n");
printf(" -d\n");
printf(" --delete delete item corresponding to passed key triplet\n");
printf(" -r\n");
printf(" --root operate on this root\n");
printf(" -C BYTENR\n");
printf(" --csum BYTENR delete a csum for the specified bytenr. When used with -b it'll delete that many bytes, otherwise it's just sectorsize\n");
printf(" --block-group OFFSET corrupt the given block group\n");
printf(" --value VALUE value to use for corrupting item data\n");
printf(" --offset OFFSET offset to use for corrupting item data\n");
exit(ret);
}