Commit bde1597d authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Andrew Morton

radix-tree: move declarations to header

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.

[zhangpeng.00@bytedance.com: fix building radix tree test suite]
  Link: https://lkml.kernel.org/r/20230521095450.21332-1-zhangpeng.00@bytedance.com
Link: https://lkml.kernel.org/r/20230516194212.548910-1-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarPeng Zhang <zhangpeng.00@bytedance.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 2f012f2b
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/xarray.h> #include <linux/xarray.h>
#include "radix-tree.h"
/* /*
* Radix tree node cache. * Radix tree node cache.
*/ */
......
// 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);
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/xarray.h> #include <linux/xarray.h>
#include "radix-tree.h"
/* /*
* Coding conventions in this file: * Coding conventions in this file:
* *
...@@ -247,10 +249,6 @@ void *xas_load(struct xa_state *xas) ...@@ -247,10 +249,6 @@ void *xas_load(struct xa_state *xas)
} }
EXPORT_SYMBOL_GPL(xas_load); 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) #define XA_RCU_FREE ((struct xarray *)1)
static void xa_node_free(struct xa_node *node) static void xa_node_free(struct xa_node *node)
......
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
CFLAGS += -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address \ CFLAGS += -I. -I../../include -I../../../lib -g -Og -Wall \
-fsanitize=undefined -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined
LDFLAGS += -fsanitize=address -fsanitize=undefined LDFLAGS += -fsanitize=address -fsanitize=undefined
LDLIBS+= -lpthread -lurcu LDLIBS+= -lpthread -lurcu
TARGETS = main idr-test multiorder xarray maple TARGETS = main idr-test multiorder xarray maple
...@@ -49,6 +49,7 @@ $(OFILES): Makefile *.h */*.h generated/map-shift.h generated/bit-length.h \ ...@@ -49,6 +49,7 @@ $(OFILES): Makefile *.h */*.h generated/map-shift.h generated/bit-length.h \
../../../include/linux/xarray.h \ ../../../include/linux/xarray.h \
../../../include/linux/maple_tree.h \ ../../../include/linux/maple_tree.h \
../../../include/linux/radix-tree.h \ ../../../include/linux/radix-tree.h \
../../../lib/radix-tree.h \
../../../include/linux/idr.h ../../../include/linux/idr.h
radix-tree.c: ../../../lib/radix-tree.c radix-tree.c: ../../../lib/radix-tree.c
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment