Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

netlink: create a new header for internal genetlink symbols

There are things in linux/genetlink.h which are only used
under net/netlink/. Move them to a new local header.
A new header with just 2 externs isn't great, but alternative
would be to include af_netlink.h in genetlink.c which feels
even worse.

Link: https://lore.kernel.org/r/20240329175710.291749-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+14 -6
-5
include/linux/genetlink.h
··· 4 4 5 5 #include <uapi/linux/genetlink.h> 6 6 7 - 8 7 /* All generic netlink requests are serialized by a global lock. */ 9 8 extern void genl_lock(void); 10 9 extern void genl_unlock(void); 11 - 12 - /* for synchronisation between af_netlink and genetlink */ 13 - extern atomic_t genl_sk_destructing_cnt; 14 - extern wait_queue_head_t genl_sk_destructing_waitq; 15 10 16 11 #define MODULE_ALIAS_GENL_FAMILY(family)\ 17 12 MODULE_ALIAS_NET_PF_PROTO_NAME(PF_NETLINK, NETLINK_GENERIC, "-family-" family)
+1 -1
net/netlink/af_netlink.c
··· 59 59 #include <linux/rhashtable.h> 60 60 #include <asm/cacheflush.h> 61 61 #include <linux/hash.h> 62 - #include <linux/genetlink.h> 63 62 #include <linux/net_namespace.h> 64 63 #include <linux/nospec.h> 65 64 #include <linux/btf_ids.h> ··· 72 73 #include <trace/events/netlink.h> 73 74 74 75 #include "af_netlink.h" 76 + #include "genetlink.h" 75 77 76 78 struct listeners { 77 79 struct rcu_head rcu;
+2
net/netlink/genetlink.c
··· 22 22 #include <net/sock.h> 23 23 #include <net/genetlink.h> 24 24 25 + #include "genetlink.h" 26 + 25 27 static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */ 26 28 static DECLARE_RWSEM(cb_lock); 27 29
+11
net/netlink/genetlink.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef __NET_GENETLINK_H 3 + #define __NET_GENETLINK_H 4 + 5 + #include <linux/wait.h> 6 + 7 + /* for synchronisation between af_netlink and genetlink */ 8 + extern atomic_t genl_sk_destructing_cnt; 9 + extern wait_queue_head_t genl_sk_destructing_waitq; 10 + 11 + #endif /* __LINUX_GENERIC_NETLINK_H */