summaryrefslogtreecommitdiff
path: root/cmds-inspect-dump-super.c
Commit message (Collapse)AuthorAge
* btrfs-progs: remove BTRFS_CRC32_SIZE definitionMisono, Tomohiro2018-03-30
| | | | | | | | | | The kernel code no longer has BTRFS_CRC32_SIZE and only uses btrfs_csum_sizes[]. So, update the progs code as well. Suggested-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-super: Don't verify csum if csum type or size is unknownQu Wenruo2018-03-30
| | | | | | Reported-by: Ken Swenson <flat@imo.uto.moe> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: treewide: Replace strerror(errno) with %m.Rosen Penev2018-01-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As btrfs is specific to Linux, %m can be used instead of strerror(errno) in format strings. This has some size reduction benefits for embedded systems. glibc, musl, and uclibc-ng all support %m as a modifier to printf. A quick glance at the BIONIC libc source indicates that it has support for %m as well. BSDs and Windows do not but I do believe them to be beyond the scope of btrfs-progs. Compiled sizes on Ubuntu 16.04: Before: 3916512 btrfs 233688 libbtrfs.so.0.1 4899 bcp 2367672 btrfs-convert 2208488 btrfs-corrupt-block 13302 btrfs-debugfs 2152160 btrfs-debug-tree 2136024 btrfs-find-root 2287592 btrfs-image 2144600 btrfs-map-logical 2130760 btrfs-select-super 2152608 btrfstune 2131760 btrfs-zero-log 2277752 mkfs.btrfs 9166 show-blocks After: 3908744 btrfs 233256 libbtrfs.so.0.1 4899 bcp 2366560 btrfs-convert 2207432 btrfs-corrupt-block 13302 btrfs-debugfs 2151104 btrfs-debug-tree 2134968 btrfs-find-root 2281864 btrfs-image 2143536 btrfs-map-logical 2129704 btrfs-select-super 2151552 btrfstune 2130696 btrfs-zero-log 2276272 mkfs.btrfs 9166 show-blocks Total savings: 23928 (24 kilo)bytes Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Add zstd supportNick Terrell2017-09-25
| | | | | | | | | | | | | | | | Adds zstd support to the btrfs program. An optional dependency on libzstd >= 1.0.0 is added. Autoconf accepts `--enable-zstd' or `--disable-zstd' and defaults to detecting if libzstd is present using `pkg-config'. The patch is also available in my fork of btrfs-progs [1], which passes Travis-CI with the new tests. The prebuilt binary is available there. I haven't updated Android.mk. [1] https://github.com/terrelln/btrfs-progs/tree/devel Signed-off-by: Nick Terrell <terrelln@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: rename item callbacks to match the key nameDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-super: add missing long option bytenr to getoptMisono, Tomohiro2017-08-24
| | | | | | | This fixes "btrfs inspect-internal dump-super --bytenr" Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: move command definitions to commands.hDavid Sterba2017-08-24
| | | | | | | There are some trivial helpers, we can group the command declarations in one place. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove deprecated leafsize usageQu Wenruo2017-07-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | Leafsize is deprecated for a long time, and kernel has already updated ctree.h to rename sb->leafsize to sb->__unused_leafsize. This patch will remove normal users of leafsize: 1) Remove leafsize member from btrfs_root structure Now only root->nodesize and root->sectorisze. No longer root->leafsize. 2) Remove @leafsize parameter from btrfs_setup_root() function Since no root->leafsize, no need for @leafsize parameter. The remaining user of leafsize will be: 1) btrfs inspect-internal dump-super Reformat the "leafsize" output to "leafsize (deprecated)" and use le32_to_cpu() to do the cast manually. 2) mkfs We still need to set sb->__unused_leafsize to nodesize. Do the manual cast too. 3) convert Same as mkfs, these two superblock setup should be merged later Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
* btrfs-progs: print-tree: add validation to print_chunkLu Fengqi2017-04-20
| | | | | | | | | | | In print_chunk, validate the value of uuid_offset when read the dev_uuid of stripe. Was triggered by misc-test/015-dump-super-garbage running indefinetelly. Issue: #37 Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-super: check array_size in print_sys_chunk_arrayLu Fengqi2017-04-20
| | | | | | | | Without validation of array_size, the dump-super may lead to a bad memory access. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: remove unused argument from btrfs_csum_dataDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: move help defines to own headerDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: format FREE_SPACE_TREE{,_VALID} nicely in dump-superOmar Sandoval2016-11-23
| | | | | Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-super: print chunks after validationDavid Sterba2016-10-05
| | | | | | | The fuzz test 005-simple-dump-super hits a crash, because we print the chunks too early. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: change btrfs_csum_final result param type to u8Domagoj Tršan2016-10-03
| | | | | Signed-off-by: Domagoj Tršan <domagoj.trsan@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-super: switch to common message helpersDavid Sterba2016-10-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-super: changes in options to specify superblocksDavid Sterba2016-09-21
| | | | | | | | | | | | Some tools (check, select-super, dump-super) can use the alternate superblocks, but the options are not consistent. To make it less confusing, change the meaning of option -s in 'dump-super' to specify the superblock copy, instead of taking the offset. Though this is a change in UI, the old usage is detected and the result would be the same, no breakage in existing scripts. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-super: detect invalid checksum typeDavid Sterba2016-09-05
| | | | | | | | | The helper btrfs_super_csum_size unconditionally bugs on a bogus value, the dump-super is supposed to dump even corrupted superblocks so this must not happen here. Group the checsum values in the output and be more robust agains garbage values. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: drop permission arg from non-creating openDavid Sterba2016-09-05
| | | | | | The permissions do not make sense without O_CREATE mode. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-super: add more long optionsDavid Sterba2016-03-15
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-super: switch to getopt_longDavid Sterba2016-03-15
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: switch more error messages to common helpersDavid Sterba2016-03-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: introduce inspect-internal dump-superAlexander Fougner2016-03-14
The long-term plan is to merge the features of standalone tools into the btrfs binary, reducing the number of shipped binaries. Signed-off-by: Alexander Fougner <fougner89@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>