From c30726873b03eb01e308b321e39861f4738fd280 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Sun, 11 Aug 2019 23:12:51 +0200
Subject: [PATCH 2/2] WIP __boolean_t removal

---
 lib/libdevinfo/devinfo.c        | 3 ++-
 lib/libdevinfo/devinfo_var.h    | 3 ---
 sys/cpu/x86_64/include/stdint.h | 5 -----
 sys/net/netmsg.h                | 4 +---
 sys/net/radix.h                 | 9 ++++-----
 sys/net/route.h                 | 2 +-
 sys/sys/objcache.h              | 4 ++--
 sys/sys/systimer.h              | 8 --------
 sys/sys/types.h                 | 7 ++++---
 usr.bin/fstat/hammer.c          | 4 ++--
 usr.bin/fstat/hammer2.c         | 4 ++--
 usr.bin/fstat/tmpfs.c           | 4 ++--
 usr.bin/netstat/route.c         | 4 ++--
 usr.sbin/newsyslog/newsyslog.c  | 4 +---
 14 files changed, 23 insertions(+), 42 deletions(-)

diff --git a/lib/libdevinfo/devinfo.c b/lib/libdevinfo/devinfo.c
index ffcc2bb473..f94dc1bcac 100644
--- a/lib/libdevinfo/devinfo.c
+++ b/lib/libdevinfo/devinfo.c
@@ -25,7 +25,6 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/lib/libdevinfo/devinfo.c,v 1.9 2006/07/17 09:33:24 stefanf Exp $
- * $DragonFly: src/lib/libdevinfo/devinfo.c,v 1.1 2008/09/30 12:20:29 hasso Exp $
  */
 
 /*
@@ -61,6 +60,8 @@
  * this library through a variety of interfaces.
  */
 
+#define _KERNEL_STRUCTURES
+
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/sysctl.h>
diff --git a/lib/libdevinfo/devinfo_var.h b/lib/libdevinfo/devinfo_var.h
index 5189d12bb7..0c4b451eb8 100644
--- a/lib/libdevinfo/devinfo_var.h
+++ b/lib/libdevinfo/devinfo_var.h
@@ -25,11 +25,8 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/lib/libdevinfo/devinfo_var.h,v 1.3 2003/02/17 18:56:00 imp Exp $
- * $DragonFly: src/lib/libdevinfo/devinfo_var.h,v 1.1 2008/09/30 12:20:29 hasso Exp $
  */
 
-#define _KERNEL_STRUCTURES
-
 #include <sys/rman.h>
 #include <sys/bus.h>
 
diff --git a/sys/cpu/x86_64/include/stdint.h b/sys/cpu/x86_64/include/stdint.h
index d22509e26e..60be7fe741 100644
--- a/sys/cpu/x86_64/include/stdint.h
+++ b/sys/cpu/x86_64/include/stdint.h
@@ -52,11 +52,6 @@ typedef	short		__int16_t;
 typedef	unsigned short	__uint16_t;
 typedef	int		__int32_t;
 typedef	unsigned int	__uint32_t;
-#if defined(__cplusplus) || __STDC_VERSION__ < 199901L && !__GNUC_PREREQ__(3, 0)
-typedef	int		__boolean_t;
-#else
-typedef	_Bool		__boolean_t;
-#endif
 
 #ifdef __LP64__
 typedef	long		__int64_t;
diff --git a/sys/net/netmsg.h b/sys/net/netmsg.h
index b3f1787427..ed776e064a 100644
--- a/sys/net/netmsg.h
+++ b/sys/net/netmsg.h
@@ -26,8 +26,6 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $DragonFly: src/sys/net/netmsg.h,v 1.10 2008/10/27 02:56:30 sephe Exp $
  */
 
 #ifndef _NET_NETMSG_H_
@@ -110,7 +108,7 @@ struct netmsg_pr_timeout {
 };
 
 struct netmsg_so_notify;
-typedef __boolean_t (*msg_predicate_fn_t)(struct netmsg_so_notify *);
+typedef boolean_t (*msg_predicate_fn_t)(struct netmsg_so_notify *);
 
 struct netmsg_so_notify {
 	struct netmsg_base	base;
diff --git a/sys/net/radix.h b/sys/net/radix.h
index bd2e134b56..008835cb8b 100644
--- a/sys/net/radix.h
+++ b/sys/net/radix.h
@@ -28,7 +28,6 @@
  *
  *	@(#)radix.h	8.2 (Berkeley) 10/31/94
  * $FreeBSD: src/sys/net/radix.h,v 1.16.2.1 2000/05/03 19:17:11 wollman Exp $
- * $DragonFly: src/sys/net/radix.h,v 1.12 2006/09/05 03:48:12 dillon Exp $
  */
 
 #ifndef _NET_RADIX_H_
@@ -176,16 +175,15 @@ struct radix_node_head {
 #ifndef _KERNEL
 #define R_Malloc(p, t, n) (p = (t) malloc((n)))
 #define Free(p) free(p);
-#else
+#else /* _KERNEL */
 #define R_Malloc(p, t, n) (p = (t) kmalloc((n), M_RTABLE, M_INTWAIT | M_NULLOK))
 #define Free(p) kfree(p, M_RTABLE);
-#endif
 
 void			 rn_init (void);
 int			 rn_inithead (void **, struct radix_node_head *, int);
 struct radix_node_head	*rn_cpumaskhead(int cpu);
-__boolean_t		 rn_refines (char *, char *);
-struct radix_node	*rn_addmask (char *, __boolean_t, int,
+boolean_t		 rn_refines (char *, char *);
+struct radix_node	*rn_addmask (char *, boolean_t, int,
 				     struct radix_node_head *),
 			*rn_addroute (char *, char *, struct radix_node_head *,
 				      struct radix_node [2]),
@@ -193,5 +191,6 @@ struct radix_node	*rn_addmask (char *, __boolean_t, int,
 			*rn_lookup (char *key, char *mask,
 				    struct radix_node_head *head),
 			*rn_match (char *, struct radix_node_head *);
+#endif /* !_KERNEL */
 
 #endif /* _NET_RADIX_H_ */
diff --git a/sys/net/route.h b/sys/net/route.h
index ade7258ee9..a16cd74263 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -354,7 +354,7 @@ void	 rtalloc (struct route *);
 void	 rtalloc_ign (struct route *, u_long);
 
 struct rtentry *
-	 _rtlookup (struct sockaddr *, __boolean_t, u_long);
+	 _rtlookup (struct sockaddr *, boolean_t, u_long);
 #define		RTL_REPORTMSG	TRUE
 #define		RTL_DONTREPORT	FALSE
 
diff --git a/sys/sys/objcache.h b/sys/sys/objcache.h
index 8f334ba3f0..42e57f492b 100644
--- a/sys/sys/objcache.h
+++ b/sys/sys/objcache.h
@@ -44,7 +44,7 @@
 
 #define OC_MFLAGS	0x0000ffff	/* same as malloc flags */
 
-typedef __boolean_t (objcache_ctor_fn)(void *obj, void *privdata, int ocflags);
+typedef boolean_t (objcache_ctor_fn)(void *obj, void *privdata, int ocflags);
 typedef void (objcache_dtor_fn)(void *obj, void *privdata);
 
 /*
@@ -76,7 +76,7 @@ void	 objcache_put(struct objcache *oc, void *obj);
 void	 objcache_dtor(struct objcache *oc, void *obj);
 void	 objcache_populate_linear(struct objcache *oc, void *elts, int nelts,
 				  int size);
-__boolean_t objcache_reclaimlist(struct objcache *oc[], int nlist, int ocflags);
+boolean_t objcache_reclaimlist(struct objcache *oc[], int nlist, int ocflags);
 void	 objcache_destroy(struct objcache *oc);
 
 #endif	/* !_KERNEL */
diff --git a/sys/sys/systimer.h b/sys/sys/systimer.h
index a8d830120e..65c75ae4cc 100644
--- a/sys/sys/systimer.h
+++ b/sys/sys/systimer.h
@@ -32,8 +32,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
- * $DragonFly: src/sys/sys/systimer.h,v 1.13 2007/04/30 06:57:36 dillon Exp $
  */
 
 #ifndef _SYS_SYSTIMER_H_
@@ -48,12 +46,6 @@
 #include <sys/queue.h>
 #endif
 
-/* XXX fix sys/kinfo.h */
-#ifndef __BOOLEAN_T_DEFINED__
-#define __BOOLEAN_T_DEFINED__
-typedef	__boolean_t	boolean_t;
-#endif
-
 struct intrframe;
 
 typedef __uint32_t	sysclock_t;
diff --git a/sys/sys/types.h b/sys/sys/types.h
index 54495f7d9f..25fcab432b 100644
--- a/sys/sys/types.h
+++ b/sys/sys/types.h
@@ -140,9 +140,10 @@ typedef	int		mqd_t;		/* message queue descriptor */
 
 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
 
-#ifndef __BOOLEAN_T_DEFINED__
-#define	__BOOLEAN_T_DEFINED__
-typedef	__boolean_t	boolean_t;
+#if defined(__cplusplus) || __STDC_VERSION__ < 199901L && !__GNUC_PREREQ__(3, 0)
+typedef	int		boolean_t;
+#else
+typedef	_Bool		boolean_t;
 #endif
 
 typedef	u_int64_t	uoff_t;
diff --git a/usr.bin/fstat/hammer.c b/usr.bin/fstat/hammer.c
index 95c9f4a254..99efc4e82a 100644
--- a/usr.bin/fstat/hammer.c
+++ b/usr.bin/fstat/hammer.c
@@ -29,6 +29,8 @@
  * SUCH DAMAGE.
  */
 
+#define _KERNEL_STRUCTURES
+
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -36,12 +38,10 @@
 #include <kvm.h>
 #include <stdio.h>
 
-#define _KERNEL_STRUCTURES
 #include <sys/vnode.h>
 #include <sys/mount.h>
 #include <stddef.h>
 #include <vfs/hammer/hammer.h>
-#undef _KERNEL_STRUCTURES
 
 #include "fstat.h"
 
diff --git a/usr.bin/fstat/hammer2.c b/usr.bin/fstat/hammer2.c
index 26919777d4..7d31b22189 100644
--- a/usr.bin/fstat/hammer2.c
+++ b/usr.bin/fstat/hammer2.c
@@ -29,6 +29,8 @@
  * SUCH DAMAGE.
  */
 
+#define _KERNEL_STRUCTURES
+
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -36,13 +38,11 @@
 #include <kvm.h>
 #include <stdio.h>
 
-#define _KERNEL_STRUCTURES
 #include <sys/vnode.h>
 #include <sys/mount.h>
 #include <stddef.h>
 #include <vfs/hammer2/hammer2.h>
 #include <vfs/hammer2/hammer2_disk.h>
-#undef _KERNEL_STRUCTURES
 
 #include "fstat.h"
 
diff --git a/usr.bin/fstat/tmpfs.c b/usr.bin/fstat/tmpfs.c
index 6e8b60df56..0a08a15a27 100644
--- a/usr.bin/fstat/tmpfs.c
+++ b/usr.bin/fstat/tmpfs.c
@@ -29,6 +29,8 @@
  * SUCH DAMAGE.
  */
 
+#define _KERNEL_STRUCTURES
+
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -36,10 +38,8 @@
 #include <kvm.h>
 #include <stdio.h>
 
-#define _KERNEL_STRUCTURES
 #include <sys/vnode.h>
 #include <vfs/tmpfs/tmpfs.h>
-#undef _KERNEL_STRUCTURES
 
 #include "fstat.h"
 
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 2cca3293a1..69d760f09e 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -30,6 +30,8 @@
  * $FreeBSD: src/usr.bin/netstat/route.c,v 1.41.2.14 2002/07/17 02:22:22 kbyanc Exp $
  */
 
+#define _KERNEL_STRUCTURES
+
 #include <sys/kinfo.h>
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -37,9 +39,7 @@
 
 #include <net/ethernet.h>
 #include <net/if.h>
-#define _KERNEL_STRUCTURES
 #include <net/if_var.h>		/* for struct ifnet */
-#undef _KERNEL_STRUCTURES
 #include <net/if_dl.h>
 #include <net/if_types.h>
 #include <net/route.h>
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index 946d7a3a92..3fe50c781f 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -54,12 +54,10 @@
  * specified number of backup files around.
  */
 
-#define	OSF
-
+#include <sys/user.h>
 #include <sys/param.h>
 #include <sys/queue.h>
 #include <sys/stat.h>
-#include <sys/user.h>
 #include <sys/wait.h>
 
 #include <assert.h>
-- 
2.22.0

