Skip to content

Conversation

stkw0
Copy link

@stkw0 stkw0 commented Nov 25, 2024

This patch force using the included kerncompat.h header file. Because btrfs-progs removed a bunch of declarations from the header files it fails to compile if kerncompat.h from btrfs-progs is used. See next error log.

In file included from compsize.c:17:
radix-tree.h:51:9: error: unknown type name ‘gfp_t’
   51 |         gfp_t                   gfp_mask;
      |         ^~~~~
radix-tree.h:78:24: error: unknown type name ‘gfp_t’
   78 | int radix_tree_preload(gfp_t gfp_mask);
      |                        ^~~~~
radix-tree.h: In function ‘radix_tree_preload_end’:
radix-tree.h:94:9: error: implicit declaration of function ‘preempt_enable’ [-Wimplicit-function-declaration]
   94 |         preempt_enable();
      |         ^~~~~~~~~~~~~~
compsize.c: In function ‘parse_file_extent_item’:
compsize.c:163:10: error: implicit declaration of function ‘IS_ALIGNED’ [-Wimplicit-function-declaration]
  163 |     if (!IS_ALIGNED(disk_bytenr, 1 << 12))
      |          ^~~~~~~~~~
compsize.c:167:5: error: implicit declaration of function ‘radix_tree_preload’; did you mean ‘radix_tree_preload_end’? [-Wimplicit-function-declaration]
  167 |     radix_tree_preload(GFP_KERNEL);
      |     ^~~~~~~~~~~~~~~~~~
      |     radix_tree_preload_end
compsize.c:167:24: error: ‘GFP_KERNEL’ undeclared (first use in this function); did you mean ‘SI_KERNEL’?
  167 |     radix_tree_preload(GFP_KERNEL);
      |                        ^~~~~~~~~~
      |                        SI_KERNEL
compsize.c:167:24: note: each undeclared identifier is reported only once for each function it appears in
compsize.c: In function ‘do_file’:
compsize.c:194:13: error: ‘errno’ undeclared (first use in this function)
  194 |         if (errno == ENOTTY)
      |             ^~~~~
compsize.c:19:1: note: ‘errno’ is defined in header ‘<errno.h>’; this is probably fixable by adding ‘#include <errno.h>’
   18 | #include "endianness.h"
  +++ |+#include <errno.h>
   19 | 
compsize.c:194:22: error: ‘ENOTTY’ undeclared (first use in this function); did you mean ‘N_TTY’?
  194 |         if (errno == ENOTTY)
      |                      ^~~~~~
      |                      N_TTY
compsize.c: In function ‘do_recursive_search’:
compsize.c:246:17: error: ‘errno’ undeclared (first use in this function)
  246 |             if (errno == ELOOP    // symlink
      |                 ^~~~~
compsize.c:246:17: note: ‘errno’ is defined in header ‘<errno.h>’; this is probably fixable by adding ‘#include <errno.h>’
compsize.c:246:26: error: ‘ELOOP’ undeclared (first use in this function)
  246 |             if (errno == ELOOP    // symlink
      |                          ^~~~~
compsize.c:247:26: error: ‘ENXIO’ undeclared (first use in this function)
  247 |              || errno == ENXIO    // some device nodes
      |                          ^~~~~
compsize.c:248:26: error: ‘ENODEV’ undeclared (first use in this function); did you mean ‘NODEV’?
  248 |              || errno == ENODEV   // /dev/ptmx
      |                          ^~~~~~
      |                          NODEV
compsize.c:249:26: error: ‘ENOMEDIUM’ undeclared (first use in this function)
  249 |              || errno == ENOMEDIUM// more device nodes
      |                          ^~~~~~~~~
compsize.c:250:26: error: ‘ENOENT’ undeclared (first use in this function)
  250 |              || errno == ENOENT)  // something just deleted
      |                          ^~~~~~
compsize.c:252:31: error: ‘EACCES’ undeclared (first use in this function)
  252 |             else if (errno == EACCES)

This is a minimal patch which may be superseded by #53

wszqkzqk added a commit to lcpu-club/loongarch-packages that referenced this pull request Dec 3, 2024
* Apply
kilobyte/compsize#54
to fix build with current btrfs-progs

Signed-off-by: Zhou Qiankang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant