From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Arnd Bergmann <arnd@arndb.de>, "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
x86@kernel.org, linux-arch@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] uapi: introduce __kernel_uapi_size_t
Date: Fri, 3 Mar 2017 03:59:30 +0300 [thread overview]
Message-ID: <20170303005930.GA10283@altlinux.org> (raw)
In-Reply-To: <20170302003356.GD27132@altlinux.org>
__kernel_uapi_size_t is a pure UAPI type, in defined(__KERNEL__) code
it's always the same as __kernel_size_t.
It's also the same as __kernel_size_t on all architectures except x32
where sizeof(size_t) < sizeof(__kernel_size_t).
__kernel_uapi_size_t can be used as a size_t replacement in UAPI
headers, e.g. in cases when size_t might differ from __kernel_size_t.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
include/uapi/asm-generic/posix_types.h | 10 ++++++++++
arch/x86/include/uapi/asm/posix_types_x32.h | 3 +++
2 files changed, 13 insertions(+)
diff --git a/include/uapi/asm-generic/posix_types.h b/include/uapi/asm-generic/posix_types.h
index fe74fcc..e93c324 100644
--- a/include/uapi/asm-generic/posix_types.h
+++ b/include/uapi/asm-generic/posix_types.h
@@ -74,6 +74,16 @@ typedef __kernel_long_t __kernel_ptrdiff_t;
#endif
#endif
+/*
+ * __kernel_uapi_size_t is a pure UAPI type, in defined(__KERNEL__) code
+ * it's always the same as __kernel_size_t.
+ * __kernel_uapi_size_t can be used as a size_t replacement in UAPI headers,
+ * e.g. in cases when size_t might differ from __kernel_size_t.
+ */
+#ifndef __kernel_uapi_size_t
+typedef __kernel_size_t __kernel_uapi_size_t;
+#endif
+
#ifndef __kernel_fsid_t
typedef struct {
int val[2];
diff --git a/arch/x86/include/uapi/asm/posix_types_x32.h b/arch/x86/include/uapi/asm/posix_types_x32.h
index 85f9bda..0e36e67 100644
--- a/arch/x86/include/uapi/asm/posix_types_x32.h
+++ b/arch/x86/include/uapi/asm/posix_types_x32.h
@@ -14,6 +14,9 @@ typedef long long __kernel_long_t;
typedef unsigned long long __kernel_ulong_t;
#define __kernel_long_t __kernel_long_t
+typedef unsigned int __kernel_uapi_size_t;
+#define __kernel_uapi_size_t __kernel_uapi_size_t
+
#include <asm/posix_types_64.h>
#endif /* _ASM_X86_POSIX_TYPES_X32_H */
--
ldv
next prev parent reply other threads:[~2017-03-03 1:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-26 1:01 [PATCH] uapi: fix asm/signal.h userspace compilation errors Dmitry V. Levin
2017-02-26 1:01 ` Dmitry V. Levin
2017-03-01 16:20 ` Arnd Bergmann
2017-03-01 16:20 ` Arnd Bergmann
2017-03-02 0:20 ` [PATCH v2] " Dmitry V. Levin
2017-03-02 0:20 ` Dmitry V. Levin
2017-03-02 15:22 ` [PATCH] " Carlos O'Donell
2017-03-02 15:22 ` Carlos O'Donell
2017-03-02 15:48 ` Dmitry V. Levin
2017-03-02 15:48 ` Dmitry V. Levin
2017-03-04 1:23 ` Carlos O'Donell
2017-03-04 1:23 ` Carlos O'Donell
2017-03-06 15:10 ` Carlos O'Donell
2017-03-06 15:10 ` Carlos O'Donell
[not found] ` <20170302001853.GA27097@altlinux.org>
[not found] ` <D0D3BAFB-0556-4DBB-898C-A42719BA07BE@zytor.com>
[not found] ` <20170302003356.GD27132@altlinux.org>
2017-03-03 0:59 ` Dmitry V. Levin [this message]
2021-12-28 15:54 ` [PATCH v3] " Dmitry V. Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170303005930.GA10283@altlinux.org \
--to=ldv@altlinux.org \
--cc=arnd@arndb.de \
--cc=hpa@zytor.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).