radix-tree: move declarations to header
Subsystems (3)
PATCH 1/1 radix-tree: move declarations to header
From: Arnd Bergmann <[email protected]>
The xarray.c file contains the only call to radix_tree_node_rcu_free(), and it comes with its own extern declaration for it. This means the function definition causes a missing-prototype warning:
lib/radix-tree.c:288:6: error: no previous prototype for 'radix_tree_node_rcu_free' [-Werror=missing-prototypes]
Instead, move the declaration for this function to a new header that can be included by both, and do the same for the radix_tree_node_cachep variable that has the same underlying problem but does not cause a warning with gcc.
--- lib/radix-tree.c | 2 ++ lib/radix-tree.h | 8 ++++++++ lib/xarray.c | 6 ++---- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 lib/radix-tree.h
lib/radix-tree.c +2 -0
@@ -27,6 +27,8 @@#include <linux/string.h> #include <linux/xarray.h> +#include "radix-tree.h" +/* * Radix tree node cache. */
lib/radix-tree.h new file +8 -0
@@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* radix-tree helpers that are only shared with xarray */ + +struct kmem_cache ; +struct rcu_head ; + +extern struct kmem_cache *radix_tree_node_cachep; +extern void radix_tree_node_rcu_free (struct rcu_head *head);
lib/xarray.c +2 -4
@@ -12,6 +12,8 @@#include <linux/slab.h> #include <linux/xarray.h> +#include "radix-tree.h" +/* * Coding conventions in this file: *
@@ -247,10 +249,6 @@ void *xas_load(struct xa_state *xas) }EXPORT_SYMBOL_GPL (xas_load); -/* Move the radix tree node cache here */ -extern struct kmem_cache *radix_tree_node_cachep; -extern void radix_tree_node_rcu_free (struct rcu_head *head); -#define XA_RCU_FREE ((struct xarray *)1)static void xa_node_free (struct xa_node *node)
Signature · 1 line
2.39.2
PATCH 1/1 radix tree test suite: Fix building radix tree test suite.
The build of radix tree test suite failed due to a new internal header file added to radix-tree.c. Adding the header directory in the Makefile fixes it.
--- tools/testing/radix-tree/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/radix-tree/Makefile +3 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 -CFLAGS += -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address \ - -fsanitize=undefined +CFLAGS += -I. -I../../include -I../../../lib -g -Og -Wall \ + -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined LDFLAGS += -fsanitize=address -fsanitize=undefined LDLIBS+= -lpthread -lurcu TARGETS = main idr-test multiorder xarray maple
@@ -49,6 +49,7 @@ $(OFILES): Makefile *.h */*.h generated/map-shift.h generated/bit-length.h \ ../../../include/linux/xarray.h \ ../../../include/linux/maple_tree.h \ ../../../include/linux/radix-tree.h \ + ../../../lib/radix-tree.h \ ../../../include/linux/idr.h radix-tree.c: ../../../lib/radix-tree.c
Signature · 1 line
2.20.1
Andrew Morton
maintainerRe: [PATCH] radix tree test suite: Fix building radix tree test suite.
Quoted 3 lines · On Sun, 21 May 2023 17:54:50 +0800 Peng Zhang <[email protected]>…
The build of radix tree test suite failed due to a new internal header file added to
radix-tree.c. Adding the header directory in theMakefilefixes it.
Thanks, I queued this as a fix against "radix-tree: move declarations to header".