[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200906181510.27464.arnd@arndb.de>
Date: Thu, 18 Jun 2009 15:10:26 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Christoph Hellwig <hch@...radead.org>
Cc: Jaswinder Singh Rajput <jaswinder@...nel.org>,
Ingo Molnar <mingo@...e.hu>, x86 maintainers <x86@...nel.org>,
Sam Ravnborg <sam@...nborg.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/5 -tip] x86: move common typedefs to asm/posix_types.h
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@...db.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 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists