Per-directory cflags and libs can be now defined as:
btrfs-DIRNAME-cflags
btrfs-DIRNAME-libs
and will be newly used for all DIRNAME/*.[ch] files.
Signed-off-by: David Sterba <dsterba@suse.com>
Introduce send-dump.[ch] which implements a new btrfs_send_ops to
exam and output all operations inside a send stream.
It has a better output format than the old and no longer compilable
send-test tool, but still tries to be script friendly.
Provides the basis for later "inspect-internal dump-send" command.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ drop escaping call from __print_dump for now, drop gcc warning tweaks,
replace empty format strings with NULL ]
Signed-off-by: David Sterba <dsterba@suse.com>
The static variant of the test was broken, but not really used anyway.
Use the right compilation and linking flags.
Signed-off-by: David Sterba <dsterba@suse.com>
Our library-test dynamically linked binary was not using the built
libbtrfs. To fix that, use -rpath.
Reported-by: Mike Gilbert <floppymaster@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
If there's a system provided libbtrfs.0, it will be used for the
library-test build and could miss linker errors, as reported.
Reported-by: Mike Gilbert <floppymaster@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Add test for linkage error of lookup_path_rootid. The built binary has
to be run to catch also run-time errors.
Signed-off-by: David Sterba <dsterba@suse.com>
Add new keyword to dump the log file after any test fails. Can be useful
for remote analysis of test failures.
Signed-off-by: David Sterba <dsterba@suse.com>
Since new "receive --dump" has better output and structure, it's time
to remove old and function-weak send-test tool.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This allows us to put raid5 codes into that file other than creating a
new raid5.c.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Add another target that'll use default compiler options, eg. if we don't
know the bitness of the architecture or gcc does not recognize the
-m32/-m64 options.
Signed-off-by: David Sterba <dsterba@suse.com>
Enhance the test to verify ioctl uniqueness, compare the defined values
against the hardcoded expected values, and take care of the 32bit/64bit
compatibility workarounds.
Signed-off-by: David Sterba <dsterba@suse.com>
Temporarily make the build checks optional. The structure sizes could
change on arches due to alignment requirements or padding inserted into
the structures. We need more extensive tests to make sure we'd not break
ioctls.
Signed-off-by: David Sterba <dsterba@suse.com>
Add --with-convert[=VALUE] option to configure. Accepts ext2, auto, yes,
or no, but will be extended to more in the future. The configure-time
defines are not used in the code, ext2 is built-in unconditionally.
Signed-off-by: David Sterba <dsterba@suse.com>
The standalone tools are built from pattern rules, add support for
per-tool cflaags, like btrfs_something_clfags.
Signed-off-by: David Sterba <dsterba@suse.com>
Add options to show file and line or stack trace for error/warning
messages that use the common helpers. Possible to let any error stop
execution for ease of analysis and debugging.
Signed-off-by: David Sterba <dsterba@suse.com>
Add an easy way to build a debugging version, without optimizations and
with debugging info by default. Any overrides can be done via
DEBUG_CFLAGS that are added on top of the defaults. Can be combined with
V, C or W options.
Usage:
$ make D=1
Signed-off-by: David Sterba <dsterba@suse.com>
Systemd's btrfs rule runs btrfs dev ready on each device
as it's discovered. The btrfs command is executed as a builtin
command via an IMPORT{builtin} rule, which means it gets
executed at rule evaluation time, not rule execution time. That
means that the device mapper links haven't been setup yet and the only
nodes that can be depended upon are /dev/dm-#. That we see
/dev/mapper/name names in /proc/mounts is only because we replace the
device name we have cached with the one passed in via mount. If
we have a multi-device file system and the primary device is removed,
the remaining devices will show /dev/dm-#. In addition, if the
udev rule is executed again by someone generating a change event (e.g.
partprobe), the names are also replaced by the /dev/dm-# names.
This patch adds a new rule that adds a run rule that calls btrfs dev
ready again using the device mapper links once they're created.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
$ make clean
$ make btrfs-debug-tree
will fail because the dependency from $(btrfs_debug_tree_objects) is
missing. The variable standalone_deps magically collects all the deps
and will build them in advance. The simple fix to use the existing
substitution based on $@ does not work for pattern rules, as Noah found
out.
Reported-by: Noah Massey <noah.massey@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
commit b5e7979 "btrfs-progs: build: extend per-binary objects" allows
the standalone utilities to link against object files shared with the
main binary. However, the btrfs-*.static targets need to be adjusted
to build against the static versions of the common files.
Signed-off-by: Noah Massey <noah.massey@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
'btrfs du' differs from regular du in that it will work to resolve which
blocks are shared between files in its list. This gives the user a more
accurate bytecount from which they can make decisions regarding management
of their file space.
We still print a total number of bytes counted (like regular du), but also
print the number of bytes which were found to have been shared amongst the
file set provided. From there it becomes trivial to calculate how much space
is exclusively owned.
Signed-off-by: Mark Fasheh <mfasheh@suse.de>
[ rename files to reflect the filesystem command group, add GPL v2
file headers ]
Signed-off-by: David Sterba <dsterba@suse.com>
The standalone utilities could share object files with the main utility,
add a way to specify additional object files in a similar way to the
extra libs. The variable name must match the binary plus _objects
suffix and s/-/_/ .
Signed-off-by: David Sterba <dsterba@suse.com>
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>
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>
install -D does not create the last component, so this failed if
$(DESTDIR)$(bindir) did not already exist.
There's no need for a loop here since install accepts multiple source
arguments.
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: David Sterba <dsterba@suse.com>
Change in "btrfs-progs: introduce helper for parsing args without
options" added a dependency on help.o that was duplicated for the static
build.
Signed-off-by: Noah Massey <noah.massey@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
All commands should support the "--" option separator. This is
transparently handled by getopt, but we don't use that everywhere.
Introduce a helper for commands that take no options (just the path).
The object file dependencies need to be adjusted a bit.
Signed-off-by: David Sterba <dsterba@suse.com>
This reuses the existing code for checking the free space cache, we just
need to load the free space tree. While we do that, we check a couple of
invariants on the free space tree itself. This requires pulling in some
code from the kernel to exclude the super stripes.
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
When I run sparse checking it gives the following error:
$ make C=1 V=1
gcc -MM -MG -MF cmds-fi-usage.o.d -MT cmds-fi-usage.o -MT \
cmds-fi-usage.static.o -MT cmds-fi-usage.o.d -g -O1 -Wall \
-D_FORTIFY_SOURCE=2 -include config.h -DBTRFS_FLAT_INCLUDES \
-D_XOPEN_SOURCE=700 -fno-strict-aliasing -fPIC cmds-fi-usage.c
[SP] ctree.c
sparse -g -O1 -Wall -D_FORTIFY_SOURCE=2 -include config.h \
-DBTRFS_FLAT_INCLUDES -D_XOPEN_SOURCE=700 -fno-strict-aliasing -fPIC \
-include -D__CHECKER__ -D__CHECK_ENDIAN__ -Wbitwise -Wuninitialized \
-Wshadow -Wundef -U_FORTIFY_SOURCE ctree.c
builtin:1:15: error: unable to open '-D__CHECKER__'
Makefile:177: recipe for target 'ctree.o' failed
make: *** [ctree.o] Error 1
It means '$(check_defs)' is passed to sparse as NULL and looks
'$(check_defs)'should be assigned before assigning '$(CHECKER_FLAGS)'.
BTW, I'm not familiar with make tool so there could be some my
misunderstanding and better solution.
Signed-off-by: Byongho Lee <bhlee.kernel@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>