[PATCH 7/8] posix_types.h: add __kernel_uintptr_t to UAPI posix_types.h

From: Masahiro Yamada
Date: Mon Apr 04 2022 - 02:20:55 EST


This will allow us to replace uintptr_t with __kernel_uintptr_t in
exported headers. I think this is acceptable because we already have
__kernel_ptrdiff_t.

Define __kernel_uintptr_t in the same ways as __kernel_ptrdiff_t
but with 'unsigned' qualifier.

Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
---

arch/h8300/include/uapi/asm/posix_types.h | 1 +
arch/s390/include/uapi/asm/posix_types.h | 2 ++
arch/sparc/include/uapi/asm/posix_types.h | 1 +
arch/xtensa/include/uapi/asm/posix_types.h | 1 +
include/linux/types.h | 2 +-
include/uapi/asm-generic/posix_types.h | 2 ++
tools/arch/h8300/include/asm/bitsperlong.h | 1 +
7 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/h8300/include/uapi/asm/posix_types.h b/arch/h8300/include/uapi/asm/posix_types.h
index 3efc9dd59476..9728120c6742 100644
--- a/arch/h8300/include/uapi/asm/posix_types.h
+++ b/arch/h8300/include/uapi/asm/posix_types.h
@@ -7,6 +7,7 @@
typedef unsigned long __kernel_size_t;
typedef long __kernel_ssize_t;
typedef long __kernel_ptrdiff_t;
+typedef unsigned long __kernel_uintptr_t;

#include <asm-generic/posix_types.h>

diff --git a/arch/s390/include/uapi/asm/posix_types.h b/arch/s390/include/uapi/asm/posix_types.h
index 1913613e71b6..2c700a44bf83 100644
--- a/arch/s390/include/uapi/asm/posix_types.h
+++ b/arch/s390/include/uapi/asm/posix_types.h
@@ -34,6 +34,7 @@ typedef unsigned short __kernel_ipc_pid_t;
typedef unsigned short __kernel_uid_t;
typedef unsigned short __kernel_gid_t;
typedef int __kernel_ptrdiff_t;
+typedef unsigned int __kernel_uintptr_t;

#else /* __s390x__ */

@@ -43,6 +44,7 @@ typedef int __kernel_ipc_pid_t;
typedef unsigned int __kernel_uid_t;
typedef unsigned int __kernel_gid_t;
typedef long __kernel_ptrdiff_t;
+typedef unsigned long __kernel_uintptr_t;
typedef unsigned long __kernel_sigset_t; /* at least 32 bits */

#endif /* __s390x__ */
diff --git a/arch/sparc/include/uapi/asm/posix_types.h b/arch/sparc/include/uapi/asm/posix_types.h
index f139e0048628..402e1656e3b5 100644
--- a/arch/sparc/include/uapi/asm/posix_types.h
+++ b/arch/sparc/include/uapi/asm/posix_types.h
@@ -35,6 +35,7 @@ struct __kernel_old_timeval {
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef long int __kernel_ptrdiff_t;
+typedef unsigned long __kernel_uintptr_t;
#define __kernel_size_t __kernel_size_t

typedef unsigned short __kernel_ipc_pid_t;
diff --git a/arch/xtensa/include/uapi/asm/posix_types.h b/arch/xtensa/include/uapi/asm/posix_types.h
index 1dc67592881f..5ba366f6c789 100644
--- a/arch/xtensa/include/uapi/asm/posix_types.h
+++ b/arch/xtensa/include/uapi/asm/posix_types.h
@@ -26,6 +26,7 @@ typedef unsigned short __kernel_ipc_pid_t;
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef long __kernel_ptrdiff_t;
+typedef unsigned long __kernel_uintptr_t;
#define __kernel_size_t __kernel_size_t

typedef unsigned short __kernel_old_uid_t;
diff --git a/include/linux/types.h b/include/linux/types.h
index ea8cf60a8a79..a54335007fe2 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -34,7 +34,7 @@ typedef __kernel_gid32_t gid_t;
typedef __kernel_uid16_t uid16_t;
typedef __kernel_gid16_t gid16_t;

-typedef unsigned long uintptr_t;
+typedef __kernel_uintptr_t uintptr_t;

#ifdef CONFIG_HAVE_UID16
/* This is defined by include/asm-{arch}/posix_types.h */
diff --git a/include/uapi/asm-generic/posix_types.h b/include/uapi/asm-generic/posix_types.h
index b5f7594eee7a..4a7c5b852e38 100644
--- a/include/uapi/asm-generic/posix_types.h
+++ b/include/uapi/asm-generic/posix_types.h
@@ -68,10 +68,12 @@ typedef unsigned int __kernel_old_dev_t;
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
+typedef unsigned int __kernel_uintptr_t;
#else
typedef __kernel_ulong_t __kernel_size_t;
typedef __kernel_long_t __kernel_ssize_t;
typedef __kernel_long_t __kernel_ptrdiff_t;
+typedef __kernel_ulong_t __kernel_uintptr_t;
#endif
#endif

diff --git a/tools/arch/h8300/include/asm/bitsperlong.h b/tools/arch/h8300/include/asm/bitsperlong.h
index fa1508337ffc..fea7dc923006 100644
--- a/tools/arch/h8300/include/asm/bitsperlong.h
+++ b/tools/arch/h8300/include/asm/bitsperlong.h
@@ -10,6 +10,7 @@
typedef unsigned long __kernel_size_t;
typedef long __kernel_ssize_t;
typedef long __kernel_ptrdiff_t;
+typedef unsigned long __kernel_uintptr_t;
#endif

#endif /* __ASM_H8300_BITS_PER_LONG */
--
2.32.0