Re: [PATCH v1 1/1] radix-tree: Replace kernel.h with the necessary inclusions

From: Andy Shevchenko
Date: Wed Nov 17 2021 - 07:55:23 EST


On Wed, Nov 17, 2021 at 03:01:12PM +0800, Li Wang wrote:

Thanks for the report! And do not top post next time, please.

> This patch breaks the radix tree test building.

Yes and no. The dirty tricks with kernel headers that tools/ do is what has
been revealed by this patch.

> # make -C tools/testing/radix-tree/
> make: Entering directory '/root/linux-5.16-rc1/tools/testing/radix-tree'
> cc -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address
> -fsanitize=undefined -c -o main.o main.c
> In file included from ./linux/../../../../include/linux/radix-tree.h:14,
> from ./linux/radix-tree.h:5,
> from main.c:10:
> ./linux/lockdep.h:7:38: error: unknown type name ‘spinlock_t’; did you mean
> ‘clock_t’?
> 7 | static inline void lockdep_set_class(spinlock_t *lock,
> | ^~~~~~~~~~
> | clock_t
> In file included from ./linux/radix-tree.h:5,
> from main.c:10:
> ./linux/../../../../include/linux/radix-tree.h:15:10: fatal error:
> linux/math.h: No such file or directory
> 15 | #include <linux/math.h>
> | ^~~~~~~~~~~~~~
> compilation terminated.
> make: *** [<builtin>: main.o] Error 1
> make: Leaving directory '/root/linux-5.16-rc1/tools/testing/radix-tree'

So, add that header to the bunch of others in the tools/

Something like this? (not even compile-tested)

diff --git a/tools/testing/radix-tree/Makefile b/tools/testing/radix-tree/Makefile
index aa6abfe0749c..fa66853416d5 100644
--- a/tools/testing/radix-tree/Makefile
+++ b/tools/testing/radix-tree/Makefile
@@ -40,6 +40,7 @@ $(OFILES): Makefile *.h */*.h generated/map-shift.h \
../../include/asm/*.h \
../../../include/linux/xarray.h \
../../../include/linux/radix-tree.h \
+ ../../../include/linux/math.h \
../../../include/linux/idr.h

radix-tree.c: ../../../lib/radix-tree.c


--
With Best Regards,
Andy Shevchenko