summaryrefslogtreecommitdiff
path: root/btrfs-select-super.c
Commit message (Collapse)AuthorAge
* btrfs-progs: convert strerror to implicit %mDavid Sterba2018-10-31
| | | | | | | | | | | | | | | Similar to the changes where strerror(errno) was converted, continue with the remaining cases where the argument was stored in another variable. The savings in object size are about 4500 bytes: $ size btrfs.old btrfs.new text data bss dec hex filename 805055 24248 19748 849051 cf49b btrfs.old 804527 24248 19748 848523 cf28b btrfs.new Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Refactor write_all_supers and its callers to use btrfs_fs_infoQu Wenruo2017-07-12
| | | | | Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> 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: print help test to stdoutDavid Sterba2016-09-05
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: utils: switch more error messages to common helpersDavid Sterba2016-03-14
| | | | | | Functions relatd to device changes/status/open, mount checks. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: unify argc min/max checkingDavid Sterba2016-03-14
| | | | | | We don't want to modify argc. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: unify naming of argc and argvDavid Sterba2016-03-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Add missing close_ctree to btrfs-select-super.cZhao Lei2015-11-02
| | | | | | | Add missing close_ctree() to btrfs-select-super.c to avoid memory leak. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Add all missing btrfs_close_all_devices to standalone toolsZhao Lei2015-11-02
| | | | | | | | This patch add all missing btrfs_close_all_devices() to standalone tools in btrfs progs, to avoid memory leak. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: autoconf: use standard PACKAGE_* macrosKarel Zak2015-01-28
| | | | | | | | | | | | | - use standard PACKAGE_{NAME,VERSION,STRING,URL,...} autoconf macros rather than homemade BTRFS_BUILD_VERSION - don't #include version.h, now the file is necessary for library API only Note that "btrfs version" returns "btrfs-progs <version>" instead of the original confusing "btrfs <version>". Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: drop feature defines from C files, in favour of CFLAGS definesDimitri John Ledkov2015-01-27
| | | | | | | | | | | | | | | | | | | | | | glibc 2.10+ (5+ years old) enables all the desired features: _XOPEN_SOURCE 700, __XOPEN2K8, POSIX_C_SOURCE, DEFAULT_SOURCE; with a single _GNU_SOURCE define in the makefile alone. For portability to other libc implementations (e.g. dietlibc) _XOPEN_SOURCE=700 is also defined. This also resolves Debian bug report filed by Michael Tautschnig - "Inconsistent use of _XOPEN_SOURCE results in conflicting declarations". Whilst I was not able to reproduce the results, the reported fact is that _XOPEN_SOURCE set to 500 in one set of files (e.g. cmds-filesystem.c) generates/defines different struct stat from other files (cmds-replace.c). This patch thus cleans up all feature defines, and sets them at a consistent level. Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=747969 Signed-off-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use check_argc_* to check arg number for all toolsGui Hecheng2014-08-22
| | | | | | | | | | | | Since this patch: btrfs-progs: move the check_argc_* functions into utils.c All tools including the independent tools(e.g. btrfs-image, btrfs-convert) can share the convenience of the check_argc_* functions, so this patch adopt the argc check functions globally. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix compiler warningChristian Hesse2014-08-22
| | | | | | | | | | gcc 4.9.0 gives a warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘u64’ Using %llu and casting to unsigned long long (same as bytenr) fixes this. Signed-off-by: Christian Hesse <mail@eworm.de> 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: btrfs-select-super output is confusing when it failsAnand Jain2013-04-23
| | | | | | | | | | | | | | | Trivial patch: ./btrfs-progs/btrfs-select-super -s 0 /dev/sdc using SB copy 0, bytenr 65536 No valid Btrfs found on /dev/sdc Open ctree failed The line 'using..' is confusing which gives an indication that command is successful This patch will avoid that when command fails Signed-off-by: Anand Jain <anand.jain@oracle.com>
* btrfs-progs: Handle errors returned from open_ctreeDanny Kukawka2013-01-21
| | | | | Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfsck: decode error properlySergei Trofimovich2011-10-25
| | | | | | | | | | | | | | | check_mounted() returns kernel-style negative errors. Patch drops sign for strerror(). Before the patch: check_mounted(): Could not open /dev/sdb2 Could not check mount status: Unknown error 18446744073709551603 After the patch: check_mounted(): Could not open /dev/sdb2 Could not check mount status: Permission denied Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Btrfs-progs: add a btrfs-select-super command to overwrite the superChris Mason2011-10-25
Btrfs stores multiple copies of the superblock, and for common power-failure crashes where barriers were not in use, one of the super copies is often valid while the first copy is not. This adds a btrfs-select-super -s N /dev/xxx command, which can overwrite all the super blocks with a copy that you have already determined is valid with btrfsck -s Signed-off-by: Chris Mason <chris.mason@oracle.com>