Commit Graph

14 Commits (master)

Author SHA1 Message Date
Johannes Thumshirn c04bcdcacc btrfs-progs: move crc32c implementation to crypto/
With the introduction of xxhash64 to btrfs-progs we created a crypto/
directory for all the hashes used in btrfs (although no
cryptographically secure hash is there yet).

Move the crc32c implementation from kernel-lib/ to crypto/ as well so we
have all hashes consolidated.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-18 19:20:02 +01:00
Rosen Penev 5d72055066 btrfs-progs: Fix printf formats
Discovered with cppcheck. Fix signed/unsigned int mismatches, sizeof and
long formats.

Pull-request: #197
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-10-14 17:31:05 +02:00
David Sterba 94fced6353 btrfs-progs: build: drop kernel-lib from -I and update paths
Include the files by full path to avoid any confusion in case of
potentially duplicate names.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:04 +02:00
David Sterba c07960c8be btrfs-progs: move utils.[ch] to common/
Update include paths and remove some duplicates.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:04 +02:00
David Sterba 4ac63ccbd8 btrfs-progs: help: don't print usage on wrong argument counts
The error message about the unsatisfied argument count is scrolled away
by the full usage string dump. This is not considered a good usability
practice.

This commit switches all direct usage -> return patterns, where the
argument check has no other constraint, eg. dependency on an option.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-05 12:57:56 +01:00
Satoru Takeuchi 97198cd75e btrfs-progs: btrfs-crc: make argc check more strict
Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 14:49:43 +02:00
Satoru Takeuchi ff6fe039d3 btrfs-progs: btrfs-crc: improve usage message
- If -c is set, filename argument is ignored.
- Describe about -h option

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 14:49:43 +02:00
Satoru Takeuchi 9e4e17f361 btrfs-progs: btrfs-crc: print usage on receiving invalid arguments
Usage is only printed if -h option is set. However it's nice to
do it when wrong option is set or the number of argument is wrong.

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 14:49:42 +02:00
Satoru Takeuchi af4fe0551f btrfs-progs: btrfs-crc: fix build error
Remove the following build error.

   ====================================
   $ make btrfs-crc
       [CC]     btrfs-crc.o
       [LD]     btrfs-crc
   btrfs-crc.o: In function `usage':
   /home/sat/src/btrfs-progs/btrfs-crc.c:26: multiple definition of `usage'
   help.o:/home/sat/src/btrfs-progs/help.c:125: first defined here
   collect2: error: ld returned 1 exit status
   Makefile:294: recipe for target 'btrfs-crc' failed
   make: *** [btrfs-crc] Error 1
   =====================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 14:49:42 +02:00
Qu Wenruo 2171228b20 btrfs-progs: Use new random number API
Replace old and not so informal srand()/rand() calls to new random
number API.

Including btrfs-corrupt-block(main user), btrfs-image and btrfs-crc.

Some tests like dir-test/random-test/quick-test is not modified.
As random-test itself can't even pass build.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-06-03 14:49:42 +02:00
Gui Hecheng f1672e50c7 btrfs-progs: use check_argc_* to check arg number for all tools
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>
2014-08-22 15:07:02 +02:00
David Sterba 309e50c763 btrfs-progs: Fix getopt on arm/ppc platforms
(same as commit bb0eabc383)
There, 'char' is unsigned, so once assigned '-1' from getopt, it gets
the value 255. Then, it compared to '-1' gives false.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-08-09 14:32:34 +02:00
Stefan Behrens b0d43ad859 Btrfs-progs: btrfs-crc: support specifying checksum in hex
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
2013-04-23 19:10:12 +02:00
Jan Schmidt 08fecd7658 Btrfs-progs: add btrfs-crc tool
This tool can be used to compute btrfs' style crc32c checksums for filenames
as done by the kernel. Additionally, there is -c mode to do a brute force
search for file names with a given checksum.

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
2013-04-09 18:43:32 +02:00