From: Arnd Bergmann <arnd@arndb.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jaswinder Singh Rajput <jaswinder@kernel.org>,
Ingo Molnar <mingo@elte.hu>, x86 maintainers <x86@kernel.org>,
Sam Ravnborg <sam@ravnborg.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/5 -tip] x86: move common typedefs to asm/posix_types.h
Date: Thu, 18 Jun 2009 15:10:26 +0200 [thread overview]
Message-ID: <200906181510.27464.arnd@arndb.de> (raw)
In-Reply-To: <20090618115101.GA1671@infradead.org>
On Thursday 18 June 2009, Christoph Hellwig wrote:
>
> On Thu, Jun 18, 2009 at 02:11:24PM +0530, Jaswinder Singh Rajput wrote:
> >
> > Move common typedefs to asm/posix_types.h for easy maintenance
>
> I think at this point it would be cleaner to also move the differing
> ones into asm/posix_types.h so that there's just one file to look at for
> the types.
Agreed.
Because of the new asm-gneeric headers, you can also
#include <asm-generic/posix_types.h> for any of the default types and
only override the ones that are x86-specific.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/arch/x86/include/asm/posix_types.h b/arch/x86/include/asm/posix_types.h
dissimilarity index 94%
index bb7133d..980736c 100644
--- a/arch/x86/include/asm/posix_types.h
+++ b/arch/x86/include/asm/posix_types.h
@@ -1,13 +1,88 @@
-#ifdef __KERNEL__
-# ifdef CONFIG_X86_32
-# include "posix_types_32.h"
-# else
-# include "posix_types_64.h"
-# endif
-#else
-# ifdef __i386__
-# include "posix_types_32.h"
-# else
-# include "posix_types_64.h"
-# endif
-#endif
+#ifndef _ASM_X86_POSIX_TYPES_H
+#define _ASM_X86_POSIX_TYPES_H
+
+#ifdef __x86_64__
+/*
+ * These types are different on x86_64 from the asm-generic version
+ */
+#define __kernel_old_uid_t __kernel_old_uid_t
+typedef unsigned short __kernel_old_uid_t;
+typedef unsigned short __kernel_old_gid_t;
+
+#define __kernel_old_dev_t __kernel_old_dev_t
+typedef unsigned long __kernel_old_dev_t;
+
+#else
+/*
+ * These types are different on x86_32 from the asm-generic version
+ */
+#define __kernel_mode_t __kernel_mode_t
+typedef unsigned short __kernel_mode_t;
+
+#define __kernel_nlink_t __kernel_nlink_t
+typedef unsigned short __kernel_nlink_t;
+
+#define __kernel_ipc_pid_t __kernel_ipc_pid_t
+typedef unsigned short __kernel_ipc_pid_t;
+
+#define __kernel_uid_t __kernel_uid_t
+typedef unsigned short __kernel_uid_t;
+typedef unsigned short __kernel_gid_t;
+
+#define __kernel_uid32_t __kernel_uid32_t
+typedef unsigned int __kernel_uid32_t;
+typedef unsigned int __kernel_gid32_t;
+
+#define __kernel_old_uid_t __kernel_old_uid_t
+typedef unsigned short __kernel_old_uid_t;
+typedef unsigned short __kernel_old_gid_t;
+
+#define __kernel_old_dev_t __kernel_old_dev_t
+typedef unsigned short __kernel_old_dev_t;
+
+#endif
+
+#include <asm-generic/posix_types.h>
+
+#if defined(__KERNEL__)
+#ifndef CONFIG_X86_64
+
+#undef __FD_SET
+#define __FD_SET(fd,fdsetp) \
+ asm volatile("btsl %1,%0": \
+ "+m" (*(__kernel_fd_set *)(fdsetp)) \
+ : "r" ((int)(fd)))
+
+#undef __FD_CLR
+#define __FD_CLR(fd,fdsetp) \
+ asm volatile("btrl %1,%0": \
+ "+m" (*(__kernel_fd_set *)(fdsetp)) \
+ : "r" ((int) (fd)))
+
+#undef __FD_ISSET
+#define __FD_ISSET(fd,fdsetp) \
+ (__extension__ \
+ ({ \
+ unsigned char __result; \
+ asm volatile("btl %1,%2 ; setb %0" \
+ : "=q" (__result) \
+ : "r" ((int)(fd)), \
+ "m" (*(__kernel_fd_set *)(fdsetp))); \
+ __result; \
+}))
+
+#undef __FD_ZERO
+#define __FD_ZERO(fdsetp) \
+do { \
+ int __d0, __d1; \
+ asm volatile("cld ; rep ; stosl" \
+ : "=m" (*(__kernel_fd_set *)(fdsetp)), \
+ "=&c" (__d0), "=&D" (__d1) \
+ : "a" (0), "1" (__FDSET_LONGS), \
+ "2" ((__kernel_fd_set *)(fdsetp)) \
+ : "memory"); \
+} while (0)
+#endif /* CONFIG_X86_64 */
+#endif /* defined(__KERNEL__) */
+
+#endif /* _ASM_X86_POSIX_TYPES_H */
next prev parent reply other threads:[~2009-06-18 13:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-18 8:39 [GIT-PULL -tip][PATCH 0/5 -tip] x86: headers fixes Jaswinder Singh Rajput
2009-06-18 8:40 ` [PATCH 1/5 -tip] x86: asm/posix_types.h common for kernel and user space Jaswinder Singh Rajput
2009-06-18 8:41 ` [PATCH 2/5 -tip] x86: move common typedefs to asm/posix_types.h Jaswinder Singh Rajput
2009-06-18 8:41 ` [PATCH 3/5 -tip] x86: asm/unistd.h common for kernel and user space Jaswinder Singh Rajput
2009-06-18 8:42 ` [PATCH 4/5 -tip] x86: asm/termios.h remove irrelevant comment for userspace Jaswinder Singh Rajput
2009-06-18 8:43 ` [PATCH 5/5 -tip] x86: asm/types.h " Jaswinder Singh Rajput
2009-06-18 11:51 ` [PATCH 2/5 -tip] x86: move common typedefs to asm/posix_types.h Christoph Hellwig
2009-06-18 13:10 ` Arnd Bergmann [this message]
2009-06-18 13:47 ` Jaswinder Singh Rajput
2009-06-18 17:43 ` [GIT-PULL -tip V2][PATCH 0/4 -tip] x86: headers fixes Jaswinder Singh Rajput
2009-06-18 17:44 ` [PATCH 1/4 -tip V2] x86: unification of posix_types.h Jaswinder Singh Rajput
2009-06-18 17:45 ` [PATCH 2/4 -tip V2] x86: asm/unistd.h common for kernel and user space Jaswinder Singh Rajput
2009-06-18 17:45 ` [PATCH 3/4 -tip V2] x86: asm/termios.h remove irrelevant comment for userspace Jaswinder Singh Rajput
2009-06-18 17:46 ` [PATCH 4/4 -tip V2] x86: asm/types.h " Jaswinder Singh Rajput
2009-06-20 20:46 ` [PATCH -tip RESEND] " Jaswinder Singh Rajput
2009-06-20 20:46 ` [PATCH -tip RESEND] x86: asm/termios.h " Jaswinder Singh Rajput
2009-06-20 20:49 ` Arnd Bergmann
2009-06-20 20:45 ` [PATCH -tip RESEND] x86: asm/unistd.h common for kernel and user space Jaswinder Singh Rajput
2009-06-20 21:15 ` Jaswinder Singh Rajput
2009-06-20 20:44 ` [PATCH -tip RESEND] x86: unification of posix_types.h Jaswinder Singh Rajput
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=200906181510.27464.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=hch@infradead.org \
--cc=jaswinder@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sam@ravnborg.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.