git: dddafa8d25c6 - main - netlink: make test-includes happy by hiding most of the header contents under _KERNEL.

From: Alexander V. Chernikov <melifaro_at_FreeBSD.org>
Date: Sat, 01 Oct 2022 17:03:30 UTC
The branch main has been updated by melifaro:

URL: https://cgit.FreeBSD.org/src/commit/?id=dddafa8d25c6ba57c64c0363d8a4791470d465e0

commit dddafa8d25c6ba57c64c0363d8a4791470d465e0
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2022-10-01 17:01:53 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2022-10-01 17:01:53 +0000

    netlink: make test-includes happy by hiding most of the header
     contents under _KERNEL.
---
 sys/netlink/netlink_ctl.h            | 2 ++
 sys/netlink/netlink_debug.h          | 3 +++
 sys/netlink/netlink_generic.h        | 2 ++
 sys/netlink/netlink_message_parser.h | 2 ++
 sys/netlink/netlink_message_writer.h | 2 ++
 sys/netlink/netlink_var.h            | 3 +++
 6 files changed, 14 insertions(+)

diff --git a/sys/netlink/netlink_ctl.h b/sys/netlink/netlink_ctl.h
index fb5a8b30e0aa..1310a5a5493a 100644
--- a/sys/netlink/netlink_ctl.h
+++ b/sys/netlink/netlink_ctl.h
@@ -28,6 +28,7 @@
 #ifndef _NETLINK_NETLINK_CTL_H_
 #define _NETLINK_NETLINK_CTL_H_
 
+#ifdef _KERNEL
 /*
  * This file provides headers for the public KPI of the netlink
  * subsystem
@@ -100,3 +101,4 @@ uint32_t genl_register_group(const char *family_name, const char *group_name);
 uint32_t nlp_get_pid(const struct nlpcb *nlp);
 
 #endif
+#endif
diff --git a/sys/netlink/netlink_debug.h b/sys/netlink/netlink_debug.h
index 6ff6811c6a5a..5d8fe0352a79 100644
--- a/sys/netlink/netlink_debug.h
+++ b/sys/netlink/netlink_debug.h
@@ -31,6 +31,8 @@
 #ifndef _NETLINK_NETLINK_DEBUG_H_
 #define	_NETLINK_NETLINK_DEBUG_H_
 
+#ifdef _KERNEL
+
 #define	_DEBUG_SYSCTL_OID	_net_netlink_debug
 #include <net/route/route_debug.h>
 
@@ -79,4 +81,5 @@ SYSCTL_DECL(_net_netlink_debug);
 
 
 
+#endif
 #endif
diff --git a/sys/netlink/netlink_generic.h b/sys/netlink/netlink_generic.h
index 9b411a67ab2a..f88b6b5f5429 100644
--- a/sys/netlink/netlink_generic.h
+++ b/sys/netlink/netlink_generic.h
@@ -31,6 +31,8 @@
 #ifndef _NETLINK_NETLINK_GENERIC_H_
 #define	_NETLINK_NETLINK_GENERIC_H_
 
+#include <netlink/netlink.h>
+
 /* Base header for all of the relevant messages */
 struct genlmsghdr {
 	uint8_t		cmd;		/* CTRL_CMD_ */
diff --git a/sys/netlink/netlink_message_parser.h b/sys/netlink/netlink_message_parser.h
index 06a6788b7de5..2f802b0961ad 100644
--- a/sys/netlink/netlink_message_parser.h
+++ b/sys/netlink/netlink_message_parser.h
@@ -28,6 +28,7 @@
 #ifndef _NETLINK_NETLINK_MESSAGE_PARSER_H_
 #define _NETLINK_NETLINK_MESSAGE_PARSER_H_
 
+#ifdef _KERNEL
 /*
  * It is not meant to be included directly
  */
@@ -268,3 +269,4 @@ nl_parse_nlmsg(struct nlmsghdr *hdr, const struct nlhdr_parser *parser,
 }
 
 #endif
+#endif
diff --git a/sys/netlink/netlink_message_writer.h b/sys/netlink/netlink_message_writer.h
index 95f6dd8e6da0..424983282e59 100644
--- a/sys/netlink/netlink_message_writer.h
+++ b/sys/netlink/netlink_message_writer.h
@@ -29,6 +29,7 @@
 #ifndef _NETLINK_NETLINK_MESSAGE_WRITER_H_
 #define _NETLINK_NETLINK_MESSAGE_WRITER_H_
 
+#ifdef _KERNEL
 /*
  * It is not meant to be included directly
  */
@@ -248,3 +249,4 @@ nlattr_add_string(struct nl_writer *nw, int attrtype, const char *str)
 
 
 #endif
+#endif
diff --git a/sys/netlink/netlink_var.h b/sys/netlink/netlink_var.h
index 40d3870fd795..130f3d40a1a3 100644
--- a/sys/netlink/netlink_var.h
+++ b/sys/netlink/netlink_var.h
@@ -28,6 +28,8 @@
 #ifndef _NETLINK_NETLINK_VAR_H_
 #define _NETLINK_NETLINK_VAR_H_
 
+#ifdef _KERNEL
+
 #include <sys/ck.h>
 #include <sys/epoch.h>
 #include <sys/sysctl.h>
@@ -140,3 +142,4 @@ int nl_receive_async(struct mbuf *m, struct socket *so);
 void nl_process_receive_locked(struct nlpcb *nlp);
 
 #endif
+#endif