summaryrefslogtreecommitdiff
path: root/btrfs-show-super.c
Commit message (Collapse)AuthorAge
* btrfs-show-super: don't try to print not-superblocksEric Sandeen2014-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we point btrfs-show-super at a not-btrfs-device and try to print all superblocks, bad things are apt to happen: superblock: bytenr=274877906944, device=/dev/sdc2 --------------------------------------------------------- btrfs-show-super: ctree.h:1984: btrfs_super_csum_size: \ Assertion `!(t >= (sizeof(btrfs_csum_sizes) / sizeof((btrfs_csum_sizes)[0])))' failed. csum 0xAborted Don't try to print superblocks that don't look like superblocks, and add an "-f" (force) option to try anyway, if the user really wants to give it a shot. Fix some spelling & capitalization while we're at it. The manpage says that if any problem happens, 1 will be returned, but that's already not true today LOL, so I didn't bother to make it true when we detect bad sb magic, either... I figure it's worth continuing and trying all superblocks in case just one has a corrupt magic. Signed-off-by: Eric Sandeen <sandeen@redhat.com> [renamed -f to -F due to clash with existing option, converted relevant docs to asciidoc] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add sys_chunk_array and backup roots info to show-superGui Hecheng2014-08-22
| | | | | | | | | Add sys chunk array and backup roots info if the new option '-f' if specified. This may be useful for debugging sys_chunk related issues. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: switch to arg_strtou64() part3Wang Shilong2014-03-21
| | | | | | | | | Switch to new helper arg_strtou64(), also check if user assign a valid super copy. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: define BTRFS_UUID_UNPARSE_SIZE for uuid unparse buf sizeAnand Jain2014-01-31
| | | | | | | | | we use 37 as the allocation size to hold the uuid_unparse, here it defines BTRFS_UUID_UNPARSE_SIZE for the same. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: remove variable length stack arraysZach Brown2013-09-03
| | | | | | | | | | | | | sparse hates variable length array definitions on the stack: btrfs-show-super.c:155:21: warning: Variable length array is used. And it's right to. They're a fragile construct that doesn't handle bad input well at all. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: Cleanup for using BTRFS_SETGET_STACK instead of raw convertQu Wenruo2013-08-09
| | | | | | | | | | | | Some codes still use the cpu_to_lexx instead of the BTRFS_SETGET_STACK_FUNCS declared in ctree.h. Also added some BTRFS_SETGET_STACK_FUNCS for btrfs_header and btrfs_super. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: add uuid_tree_gen field to btrfs-show-superStefan Behrens2013-08-09
| | | | | | Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: don't call close on error fdEric Sandeen2013-02-27
| | | | | | | In the error case where fd < 0, close(fd) is the wrong thing to do. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
* btrfs-progs: treat super.magic as an le64Zach Brown2013-02-05
| | | | | | | | | | | | The super block magic is a le64 whose value looks like an unterminated string in memory. The lack of null termination leads to clumsy use of string functions and causes static analysis tools to warn that the string will be unterminated. So let's just treat it as the le64 that it is. Endian wrappers are used on the constant so that they're compiled into run-time constants. Signed-off-by: Zach Brown <zab@redhat.com>
* btrfs-progs: Add btrfs-show-superStefan Behrens2013-01-23
Just a small program to print the fields of a super block. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>