From: Arnd Bergmann <arnd@arndb.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Woodhouse <dwmw2@infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Dave Airlie <airlied@linux.ie>,
linux-arch@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] Introduce compat_u64 and compat_s64 types
Date: Fri, 15 Jun 2007 11:31:37 +0200 [thread overview]
Message-ID: <200706151131.38429.arnd@arndb.de> (raw)
In-Reply-To: <200706151128.39566.arnd@arndb.de>
One common problem with 32 bit system call and ioctl emulation
is the different alignment rules between i386 and 64 bit machines.
A number of drivers work around this by marking the compat
structures as 'attribute((packed))', which is not the right
solution because it breaks all the non-x86 architectures that
want to use the same compat code.
Hopefully, this patch improves the situation, it introduces two
new types, compat_u64 and compat_s64. These are defined on all
architectures to have the same size and alignment as the 32 bit
version of u64 and s64.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
See the discussions about 'Re: drm: fix radeon setparam on
32/64 bit systems.' and 'diskquota: 32bit quota tools on
64bit architectures' about where this comes from.
Index: linux-2.6/include/asm-ia64/compat.h
===================================================================
--- linux-2.6.orig/include/asm-ia64/compat.h
+++ linux-2.6/include/asm-ia64/compat.h
@@ -31,8 +31,10 @@ typedef s32 compat_timer_t;
typedef s32 compat_int_t;
typedef s32 compat_long_t;
+typedef s64 __attribute__((aligned(4))) compat_s64;
typedef u32 compat_uint_t;
typedef u32 compat_ulong_t;
+typedef u64 __attribute__((aligned(4))) compat_u64;
struct compat_timespec {
compat_time_t tv_sec;
Index: linux-2.6/include/asm-mips/compat.h
===================================================================
--- linux-2.6.orig/include/asm-mips/compat.h
+++ linux-2.6/include/asm-mips/compat.h
@@ -37,8 +37,10 @@ typedef s32 compat_key_t;
typedef s32 compat_int_t;
typedef s32 compat_long_t;
+typedef s64 compat_s64;
typedef u32 compat_uint_t;
typedef u32 compat_ulong_t;
+typedef u64 compat_u64;
struct compat_timespec {
compat_time_t tv_sec;
Index: linux-2.6/include/asm-parisc/compat.h
===================================================================
--- linux-2.6.orig/include/asm-parisc/compat.h
+++ linux-2.6/include/asm-parisc/compat.h
@@ -31,8 +31,10 @@ typedef s32 compat_timer_t;
typedef s32 compat_int_t;
typedef s32 compat_long_t;
+typedef s64 compat_s64;
typedef u32 compat_uint_t;
typedef u32 compat_ulong_t;
+typedef u64 compat_u64;
struct compat_timespec {
compat_time_t tv_sec;
Index: linux-2.6/include/asm-powerpc/compat.h
===================================================================
--- linux-2.6.orig/include/asm-powerpc/compat.h
+++ linux-2.6/include/asm-powerpc/compat.h
@@ -33,8 +33,10 @@ typedef s32 compat_timer_t;
typedef s32 compat_int_t;
typedef s32 compat_long_t;
+typedef s64 compat_s64;
typedef u32 compat_uint_t;
typedef u32 compat_ulong_t;
+typedef u64 compat_u64;
struct compat_timespec {
compat_time_t tv_sec;
Index: linux-2.6/include/asm-s390/compat.h
===================================================================
--- linux-2.6.orig/include/asm-s390/compat.h
+++ linux-2.6/include/asm-s390/compat.h
@@ -60,8 +60,10 @@ typedef s32 compat_timer_t;
typedef s32 compat_int_t;
typedef s32 compat_long_t;
+typedef s64 compat_s64;
typedef u32 compat_uint_t;
typedef u32 compat_ulong_t;
+typedef u64 compat_u64;
struct compat_timespec {
compat_time_t tv_sec;
Index: linux-2.6/include/asm-sparc64/compat.h
===================================================================
--- linux-2.6.orig/include/asm-sparc64/compat.h
+++ linux-2.6/include/asm-sparc64/compat.h
@@ -31,8 +31,10 @@ typedef s32 compat_timer_t;
typedef s32 compat_int_t;
typedef s32 compat_long_t;
+typedef s64 compat_s64;
typedef u32 compat_uint_t;
typedef u32 compat_ulong_t;
+typedef u64 compat_u64;
struct compat_timespec {
compat_time_t tv_sec;
Index: linux-2.6/include/asm-x86_64/compat.h
===================================================================
--- linux-2.6.orig/include/asm-x86_64/compat.h
+++ linux-2.6/include/asm-x86_64/compat.h
@@ -33,8 +33,10 @@ typedef s32 compat_key_t;
typedef s32 compat_int_t;
typedef s32 compat_long_t;
+typedef s64 __attribute__((aligned(4))) compat_s64;
typedef u32 compat_uint_t;
typedef u32 compat_ulong_t;
+typedef u64 __attribute__((aligned(4))) compat_u64;
struct compat_timespec {
compat_time_t tv_sec;
next parent reply other threads:[~2007-06-15 9:32 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200706150159.l5F1xNgM000459@hera.kernel.org>
[not found] ` <1181897905.26853.66.camel@localhost.localdomain>
[not found] ` <200706151128.39566.arnd@arndb.de>
2007-06-15 9:31 ` Arnd Bergmann [this message]
2007-06-15 9:55 ` [PATCH] Introduce compat_u64 and compat_s64 types David Miller
2007-06-15 11:55 ` Andi Kleen
2007-06-15 12:00 ` David Woodhouse
2007-06-15 12:38 ` Andi Kleen
2007-06-15 12:03 ` Arnd Bergmann
2007-06-15 12:40 ` Andi Kleen
2007-06-15 12:47 ` David Woodhouse
2007-06-15 13:19 ` Benjamin Herrenschmidt
2007-06-15 12:09 ` David Howells
2007-06-15 12:43 ` Andi Kleen
2007-06-15 12:54 ` Alan Cox
2007-06-15 12:54 ` Andi Kleen
2007-06-15 13:15 ` Alan Cox
2007-06-15 13:27 ` Andi Kleen
2007-06-15 13:32 ` David Woodhouse
2007-06-15 20:50 ` Robin Getz
2007-06-15 21:22 ` Andi Kleen
2007-06-16 8:31 ` David Woodhouse
2007-06-15 13:00 ` David Woodhouse
2007-06-15 12:11 ` Matthew Wilcox
2007-06-15 12:38 ` David Woodhouse
2007-06-15 12:42 ` Arnd Bergmann
2007-06-15 13:45 ` Matthew Wilcox
2007-06-15 13:52 ` Arnd Bergmann
2007-06-15 23:54 ` Benjamin Herrenschmidt
2007-06-15 13:16 ` Benjamin Herrenschmidt
2007-06-16 9:38 ` David Woodhouse
2007-06-16 10:26 ` Arnd Bergmann
2007-06-16 11:21 ` Arnd Bergmann
2007-06-16 11:34 ` David Woodhouse
2007-06-16 13:56 ` Matthew Wilcox
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=200706151131.38429.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=airlied@linux.ie \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=dwmw2@infradead.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.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).