From 4bfbbd74a8206fc222ca8b3ee874a963ee6900e0 Mon Sep 17 00:00:00 2001
From: asomers <asomers@FreeBSD.org>
Date: Fri, 21 Jun 2019 21:50:14 +0000
Subject: [PATCH] Reduce namespace pollution from r349233

Define __daddr_t in _types.h and use it in filio.h

Reported by:	ian, bde
Reviewed by:	ian, imp, cem
MFC after:	2 weeks
MFC-With:	349233
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20715
---
 sys/sys/_types.h |  1 +
 sys/sys/filio.h  | 12 ++++++------
 sys/sys/types.h  |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/sys/sys/_types.h b/sys/sys/_types.h
index 22a37c53389a..020ba025ea98 100644
--- a/sys/sys/_types.h
+++ b/sys/sys/_types.h
@@ -68,6 +68,7 @@ typedef	unsigned int	__useconds_t;	/* microseconds (unsigned) */
 typedef	int		__cpuwhich_t;	/* which parameter for cpuset. */
 typedef	int		__cpulevel_t;	/* level parameter for cpuset. */
 typedef int		__cpusetid_t;	/* cpuset identifier. */
+typedef __int64_t	__daddr_t;	/* bwrite(3), FIOBMAP2, etc */
 
 /*
  * Unusual type definitions.
diff --git a/sys/sys/filio.h b/sys/sys/filio.h
index e85db9cff4d1..c5cf3d4432e9 100644
--- a/sys/sys/filio.h
+++ b/sys/sys/filio.h
@@ -40,7 +40,7 @@
 #ifndef	_SYS_FILIO_H_
 #define	_SYS_FILIO_H_
 
-#include <sys/types.h>
+#include <sys/_types.h>
 #include <sys/ioccom.h>
 
 /* Generic file-descriptor ioctl's. */
@@ -64,12 +64,12 @@ struct fiodgname_arg {
 #define	FIOSEEKDATA	_IOWR('f', 97, off_t)	/* SEEK_DATA */
 #define	FIOSEEKHOLE	_IOWR('f', 98, off_t)	/* SEEK_HOLE */
 struct fiobmap2_arg {
-	int64_t	bn;
-	int	runp;
-	int	runb;
+	__daddr_t	bn;
+	int		runp;
+	int		runb;
 };
-/* Get the file's bmap info for the logical block bn */
-#define FIOBMAP2	_IOWR('f', 99, struct fiobmap2_arg)
+/* Get the file's bmap info for the logical block bn. */
+#define	FIOBMAP2	_IOWR('f', 99, struct fiobmap2_arg)
 
 #ifdef _KERNEL
 #ifdef COMPAT_FREEBSD32
diff --git a/sys/sys/types.h b/sys/sys/types.h
index 39d8d63262e8..c3ece22e58b8 100644
--- a/sys/sys/types.h
+++ b/sys/sys/types.h
@@ -101,7 +101,7 @@ typedef	__clockid_t	clockid_t;
 #endif
 
 typedef	__critical_t	critical_t;	/* Critical section value */
-typedef	__int64_t	daddr_t;	/* disk address */
+typedef	__daddr_t	daddr_t;	/* disk address */
 
 #ifndef _DEV_T_DECLARED
 typedef	__dev_t		dev_t;		/* device number or struct cdev */