Same fix a previous commit, unaligned access on strict alignment hosts
could produce wrong results (reported on send/receive and arm5). As
libbtrfs has own copy of the code fix it here too, replacing leXX_to_cpu
with get_unaligned_leXX where appropriate. This means any access to raw
buffers that get cast to a structure.
Issue: #770
Signed-off-by: David Sterba <dsterba@suse.com>
Bit shifts should be done on unsigned type as a matter of good practice
to avoid any problems with bit overflowing to the sign bit.
Signed-off-by: David Sterba <dsterba@suse.com>
We're keeping a libbtrfs compatible kerncompat.h around to make it
easier to modify the rest of btrfs-progs. Unfortunately we also use
some of kernel-lib in libbtrfs, and those also include kerncompat.h.
Those getting included first means we'll pull include/kerncompat.h
instead of libbtrfs/kerncompat.h, which will mess things up.
Fix this by making sure we include our local copy of kerncompat.h first
before we include any other header in btrfs-progs.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Add a copy from v6.0.2 of kerncompat.h for libbtrfs to avoid accidental
build breakage as it's a public header and until now also shared with
the rest of btrfs-progs code.
Signed-off-by: David Sterba <dsterba@suse.com>
We're going to sync btrfs.h into btrfs-progs from the kernel, however
libbtrfs still needs ioctl.h. To deal with this copy ioctl.h into
libbtrfs, and update that code to use the local copy and update the
libbtrfs headers list to use this copy.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
We return __u16 in the kernel, as this is actually the size of
btrfs_qgroup_level. Adjust the existing helpers and update all the
callers to deal with the new size appropriately. This will make syncing
the kernel code cleaner.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Kernel function name is btrfs_qgroup_subvolid so rename it in progs. The
libbtrfs can't API be changed without versioning so at least add the new
helper.
Signed-off-by: David Sterba <dsterba@suse.com>
The radix-tree is not used in userspace code. In kernel it's for
tracking unpersisted and in-memory structures and has been replaced by
the xarray.
Signed-off-by: David Sterba <dsterba@suse.com>
Let libbtrfs use own copy of the exported header files to avoid
potential breakage when syncing with kernel headers and also to remove
declarations that are not used by userspace. The send.h is frozen to
support protocol v1.
Signed-off-by: David Sterba <dsterba@suse.com>