Commit Graph

7 Commits

Author SHA1 Message Date
David Sterba
2f297355c9 libbtrfs: remove unneeded includes from kerncompat.h
Signed-off-by: David Sterba <dsterba@suse.com>
2024-08-14 23:58:53 +02:00
David Sterba
9b5ae7c6d7 libbtrfs: drop BUILD_ASSERT macros
The BUILD_ASSERT macro checks what _Static_assert can do. Remove it as
it's not really used in ioctl.h as it defines a stub. The assertions
still remain in the code outside of libbtrfs, we can delete it here as
the API is frozen and won't be changed.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-08-14 23:58:51 +02:00
David Sterba
e4afa23863 libbtrfs: remove error reporting from kerncomat.h
The stack trace and BUG_ON related reporting was inherited from the
tools, this should not be part of libbtrfs and was not intended to be
exported.

BUG() is still in used in ctree.h and send-utils.c so replace it with a
bare error report and remove the rest.

Keep __always_inline as it's needed for Musl.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-08-14 23:58:49 +02:00
David Sterba
2830e84135 libbtrfs: remove unused definitions from kerncompat.h
There are many definitions of types etc that are not used in libbtrfs
but used to be in other code before the separation. Remove it as it's
not meant to be exported.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-08-14 23:58:44 +02:00
David Sterba
a0ff3f19af libbtrfs: use unsigned types for bit shifts
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>
2024-03-12 22:03:36 +01:00
Josef Bacik
228aa34f10 btrfs-progs: sync messages.[ch] from the kernel
These are the printk helpers from the kernel.  There were a few
modifications, the hi-lights are

- We do not have fs_info::fs_state, so that needed to be removed.
- We do not have discard.h sync'ed yet, so that dependency was dropped.
- Anything related to struct super_block was commented out.
- The transaction abort had to be modified to fit with the current
  btrfs-progs code.
- Added a btrfs_no_printk() helper to common/messages.* so that the
  print statements still worked.
- The 32bit limit checkers are not needed so are behind __KERNEL__

Additionally there were kerncompat.h changes that needed to be made to
handle the dependencies properly.  Those are easier to spot.

Any function that needed to be modified has a MODIFIED tag in the
comment section with a list of things that were changed.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 18:02:28 +02:00
David Sterba
e8d8949d38 btrfs-progs: libbtrfs: use own copy of kerncompat.h
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>
2023-01-04 16:52:57 +01:00