x86: use asm-generic headers where possible
PATCH 1/5 x86: add copies of some headers to convert to asm-generic
In reply to Arnd BergmannJust an intermediate step to make reviewing easier. These files are identical copies of the existing headers.
--- arch/x86/include/asm/generic-mman.h | 20 +++++++ arch/x86/include/asm/generic-module.h | 80 ++++++++++++++++++++++++++++ arch/x86/include/asm/generic-scatterlist.h | 33 +++++++++++ arch/x86/include/asm/generic-types.h | 30 ++++++++++ arch/x86/include/asm/generic-ucontext.h | 18 ++++++ 5 files changed, 181 insertions(+), 0 deletions(-) create mode 100644 arch/x86/include/asm/generic-mman.h create mode 100644 arch/x86/include/asm/generic-module.h create mode 100644 arch/x86/include/asm/generic-scatterlist.h create mode 100644 arch/x86/include/asm/generic-types.h create mode 100644 arch/x86/include/asm/generic-ucontext.h
arch/x86/include/asm/generic-mman.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef _ASM_X86_MMAN_H +#define _ASM_X86_MMAN_H + +#include <asm-generic/mman-common.h> + +#define MAP_32BIT 0x40/* only give out 32bit addresses */ + +#define MAP_GROWSDOWN 0x0100/* stack-like segment */ +#define MAP_DENYWRITE 0x0800/* ETXTBSY */ +#define MAP_EXECUTABLE 0x1000/* mark it as an executable */ +#define MAP_LOCKED 0x2000/* pages are locked */ +#define MAP_NORESERVE 0x4000/* don't check for reservations */ +#define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_STACK 0x20000/* give out an address that is best suited for process/thread stacks */ + +#define MCL_CURRENT 1/* lock all current mappings */ +#define MCL_FUTURE 2/* lock all future mappings */ + +#endif /* _ASM_X86_MMAN_H */
arch/x86/include/asm/generic-module.h new file +80 -0
80 lines not on this page · raw message
arch/x86/include/asm/generic-scatterlist.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef _ASM_X86_SCATTERLIST_H +#define _ASM_X86_SCATTERLIST_H + +#include <asm/types.h> + +struct scatterlist { +#ifdef CONFIG_DEBUG_SG +unsigned long sg_magic; +#endif +unsigned long page_link; +unsigned int offset; +unsigned int length; +dma_addr_t dma_address; +unsigned int dma_length; +}; + +#define ARCH_HAS_SG_CHAIN +#define ISA_DMA_THRESHOLD (0x00ffffff) + +/* +* These macros should be used after a pci_map_sg call has been done +* to get bus addresses of each of the SG entries and their lengths. +* You should only work with the number of sg entries pci_map_sg +* returns. +*/ +#define sg_dma_address (sg) ((sg)->dma_address) +#ifdef CONFIG_X86_32 +# define sg_dma_len (sg) ((sg)->length) +#else +# define sg_dma_len (sg) ((sg)->dma_length) +#endif + +#endif /* _ASM_X86_SCATTERLIST_H */
arch/x86/include/asm/generic-types.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef _ASM_X86_TYPES_H +#define _ASM_X86_TYPES_H + +#include <asm-generic/int-ll64.h> + +#ifndef __ASSEMBLY__ + +typedef unsigned short umode_t ; + +#endif /* __ASSEMBLY__ */ + +/* +* These aren't exported outside the kernel to avoid name space clashes +*/ +#ifdef __KERNEL__ + +#ifndef __ASSEMBLY__ + +typedef u64 dma64_addr_t ; +#if defined(CONFIG_X86_64 ) || defined(CONFIG_HIGHMEM64G ) +/* DMA addresses come in 32-bit and 64-bit flavours. */ +typedef u64 dma_addr_t ; +#else +typedef u32 dma_addr_t ; +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __KERNEL__ */ + +#endif /* _ASM_X86_TYPES_H */
arch/x86/include/asm/generic-ucontext.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef _ASM_X86_UCONTEXT_H +#define _ASM_X86_UCONTEXT_H + +#define UC_FP_XSTATE 0x1/* indicates the presence of extended state +* information in the memory layout pointed +* by the fpstate pointer in the ucontext's +* sigcontext struct (uc_mcontext). +*/ + +struct ucontext { +unsigned long uc_flags; +struct ucontext *uc_link; +stack_t uc_stack; +struct sigcontext uc_mcontext; +sigset_t uc_sigmask;/* mask last for extensibility */ +}; + +#endif /* _ASM_X86_UCONTEXT_H */
Signature · 1 line
1.6.3.1
PATCH 4/5 x86: convert termios.h to the asm-generic version
In reply to Arnd BergmannThis patch turned out more controversial than expected and may get dropped in the future. I'm including it for reference anyway.
The user_termio_to_kernel_termios and kernel_termios_to_user_termio functions on x86 are lacking error checking from get_user and are not portable to big-endian systems, so the asm-generic header has to differ in this regard.
--- arch/x86/include/asm/termios.h | 86 +++++++++++++++++++++++++++++----------- 1 files changed, 63 insertions(+), 23 deletions(-)
arch/x86/include/asm/termios.h +63 -23
@@ -1,5 +1,12 @@ -#ifndef _ASM_X86_TERMIOS_H -#define _ASM_X86_TERMIOS_H +#ifndef _ASM_GENERIC_TERMIOS_H +#define _ASM_GENERIC_TERMIOS_H +/* +* Most architectures have straight copies of the x86 code, with +* varying levels of bug fixes on top. Usually it's a good idea +* to use this generic version instead, but be careful to avoid +* ABI changes. +* New architectures should not provide their own version. +*/ #include <asm/termbits.h> #include <asm/ioctls.h>
@@ -54,37 +61,57 @@ struct termio {/* * Translate a "termio" structure into a "termios". Ugh. */ -#define SET_LOW_TERMIOS_BITS (termios, termio, x) { \ - unsigned short __tmp; \ - get_user(__tmp,&(termio)->x); \ - *(unsigned short *) &(termios)->x = __tmp; \ -} -static inline int user_termio_to_kernel_termios (struct ktermios *termios, -struct termio __user *termio) +const struct termio __user *termio) { -SET_LOW_TERMIOS_BITS (termios, termio, c_iflag); -SET_LOW_TERMIOS_BITS (termios, termio, c_oflag); -SET_LOW_TERMIOS_BITS (termios, termio, c_cflag); -SET_LOW_TERMIOS_BITS (termios, termio, c_lflag); -get_user (termios->c_line, &termio->c_line); -return copy_from_user (termios->c_cc, termio->c_cc,NCC ); +unsigned short tmp; + +if (get_user (tmp, &termio->c_iflag) <0 ) + goto fault; + termios->c_iflag = (0xffff0000 & termios->c_iflag) | tmp; + +if (get_user (tmp, &termio->c_oflag) <0 ) + goto fault; + termios->c_oflag = (0xffff0000 & termios->c_oflag) | tmp; + +if (get_user (tmp, &termio->c_cflag) <0 ) + goto fault; + termios->c_cflag = (0xffff0000 & termios->c_cflag) | tmp; + +if (get_user (tmp, &termio->c_lflag) <0 ) + goto fault; + termios->c_lflag = (0xffff0000 & termios->c_lflag) | tmp; + +if (get_user (termios->c_line, &termio->c_line) <0 ) + goto fault; + +if (copy_from_user (termios->c_cc, termio->c_cc,NCC ) !=0 ) + goto fault; + +return 0 ; + + fault: +return -EFAULT ; }/* * Translate a "termios" structure into a "termio". Ugh. */ static inline int kernel_termios_to_user_termio (struct termio __user *termio, -struct ktermios *termios) +struct ktermios *termios) { -put_user ((termios)->c_iflag, &(termio)->c_iflag); -put_user ((termios)->c_oflag, &(termio)->c_oflag); -put_user ((termios)->c_cflag, &(termio)->c_cflag); -put_user ((termios)->c_lflag, &(termio)->c_lflag); -put_user ((termios)->c_line, &(termio)->c_line); -return copy_to_user ((termio)->c_cc, (termios)->c_cc,NCC ); +if (put_user (termios->c_iflag, &termio->c_iflag) <0 || +put_user (termios->c_oflag, &termio->c_oflag) <0 || +put_user (termios->c_cflag, &termio->c_cflag) <0 || +put_user (termios->c_lflag, &termio->c_lflag) <0 || +put_user (termios->c_line, &termio->c_line) <0 || +copy_to_user (termio->c_cc, termios->c_cc,NCC ) !=0 ) +return -EFAULT ; + +return 0 ; } +#ifdef TCGETS2 static inline int user_termios_to_kernel_termios (struct ktermios *k,struct termios2 __user *u) {
@@ -108,7 +135,20 @@ static inline int kernel_termios_to_user_termios_1(struct termios __user *u, {return copy_to_user (u, k,sizeof (struct termios )); } +#else /* TCGETS2 */ +static inline int user_termios_to_kernel_termios (struct ktermios *k, +struct termios __user *u) +{ +return copy_from_user (k, u,sizeof (struct termios )); +} + +static inline int kernel_termios_to_user_termios (struct termios __user *u, +struct ktermios *k) +{ +return copy_to_user (u, k,sizeof (struct termios )); +} +#endif /* TCGETS2 */ #endif /* __KERNEL__ */ -#endif /* _ASM_X86_TERMIOS_H */ +#endif /* _ASM_GENERIC_TERMIOS_H */
Signature · 1 line
1.6.3.1
PATCH 2/5 x86: convert trivial headers to asm-generic version
In reply to Arnd BergmannFor these nine header files, the asm-generic version should be semantically identical to what is in x86. Change the contents to be binary identical, for better review.
--- arch/x86/include/asm/ioctls.h | 40 +++++++++++++++++++++++++++----------- arch/x86/include/asm/ipcbuf.h | 15 +++++++++---- arch/x86/include/asm/msgbuf.h | 30 ++++++++++++++++++---------- arch/x86/include/asm/param.h | 8 ++++-- arch/x86/include/asm/shmbuf.h | 28 +++++++++++++++++--------- arch/x86/include/asm/socket.h | 10 ++++---- arch/x86/include/asm/sockios.h | 6 ++-- arch/x86/include/asm/termbits.h | 8 +++--- 8 files changed, 92 insertions(+), 53 deletions(-)
arch/x86/include/asm/ioctls.h +28 -12
@@ -1,12 +1,23 @@ -#ifndef _ASM_X86_IOCTLS_H -#define _ASM_X86_IOCTLS_H +#ifndef __ASM_GENERIC_IOCTLS_H +#define __ASM_GENERIC_IOCTLS_H -#include <asm/ioctl.h> +#include <linux/ioctl.h> + +/* +* These are the most common definitions for tty ioctl numbers. +* Most of them do not use the recommended _IOC(), but there is +* probably some source code out there hardcoding the number, +* so we might as well use them for all new platforms. +* +* The architectures that use different values here typically +* try to be compatible with some Unix variants for the same +* architecture. +*/ /* 0x54 is just a magic number to make these relatively unique ('T') */ #define TCGETS 0x5401 -#define TCSETS 0x5402/* Clashes with SNDCTL_TMR_START sound ioctl */ +#define TCSETS 0x5402#define TCSETSW 0x5403#define TCSETSF 0x5404#define TCGETA 0x5405
@@ -43,7 +54,6 @@#define TIOCSETD 0x5423#define TIOCGETD 0x5424#define TCSBRKP 0x5425/* Needed for POSIX tcsendbreak() */ -/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */ #define TIOCSBRK 0x5427/* BSD compatibility */ #define TIOCCBRK 0x5428/* BSD compatibility */ #define TIOCGSID 0x5429/* Return the session ID of FD */
@@ -53,8 +63,7 @@#define TCSETSF2 _IOW('T', 0x2D, struct termios2)#define TIOCGRS485 0x542E#define TIOCSRS485 0x542F -#define TIOCGPTN _IOR('T', 0x30, unsigned int) -/* Get Pty Number (of pty-mux device) */ +#define TIOCGPTN _IOR('T', 0x30, unsigned int)/* Get Pty Number (of pty-mux device) */ #define TIOCSPTLCK _IOW('T', 0x31, int)/* Lock/unlock Pty */ #define TCGETX 0x5432/* SYS5 TCGETX compatibility */ #define TCSETX 0x5433
@@ -76,9 +85,16 @@#define TIOCMIWAIT 0x545C/* wait for a change on serial input line(s) */ #define TIOCGICOUNT 0x545D/* read serial port inline interrupt counts */ -#define TIOCGHAYESESP 0x545E/* Get Hayes ESP configuration */ -#define TIOCSHAYESESP 0x545F/* Set Hayes ESP configuration */ -#define FIOQSIZE 0x5460 + +/* +* some architectures define FIOQSIZE as 0x545E, which is used for +* TIOCGHAYESESP on others +*/ +#ifndef FIOQSIZE +# define TIOCGHAYESESP 0x545E/* Get Hayes ESP configuration */ +# define TIOCSHAYESESP 0x545F/* Set Hayes ESP configuration */ +# define FIOQSIZE 0x5460 +#endif /* Used for packet mode */ #define TIOCPKT_DATA 0
@@ -89,6 +105,6 @@#define TIOCPKT_NOSTOP 16#define TIOCPKT_DOSTOP 32 -#define TIOCSER_TEMT 0x01/* Transmitter physically empty */ +#define TIOCSER_TEMT 0x01/* Transmitter physically empty */ -#endif /* _ASM_X86_IOCTLS_H */ +#endif /* __ASM_GENERIC_IOCTLS_H */
arch/x86/include/asm/ipcbuf.h +10 -5
@@ -1,13 +1,18 @@ -#ifndef _ASM_X86_IPCBUF_H -#define _ASM_X86_IPCBUF_H +#ifndef __ASM_GENERIC_IPCBUF_H +#define __ASM_GENERIC_IPCBUF_H/* -* The ipc64_perm structure for x86 architecture. +* The generic ipc64_perm structure: * Note extra padding because this structure is passed back and forth * between kernel and user space. * +* ipc64_perm was originally meant to be architecture specific, but +* everyone just ended up making identical copies without specific +* optimizations, so we may just as well all use the same one. +* * Pad space is left for: -* - 32-bit mode_t and seq +* - 32-bit mode_t on architectures that only had 16 bit +* - 32-bit seq * - 2 miscellaneous 32-bit values */
@@ -25,4 +30,4 @@ struct ipc64_perm { unsigned long __unused2; }; -#endif /* _ASM_X86_IPCBUF_H */ +#endif /* __ASM_GENERIC_IPCBUF_H */
arch/x86/include/asm/msgbuf.h +19 -11
@@ -1,30 +1,38 @@ -#ifndef _ASM_X86_MSGBUF_H -#define _ASM_X86_MSGBUF_H +#ifndef __ASM_GENERIC_MSGBUF_H +#define __ASM_GENERIC_MSGBUF_H +#include <asm/bitsperlong.h> /* - * The msqid64_ds structure for i386 architecture. + * generic msqid64_ds structure. + * * Note extra padding because this structure is passed back and forth * between kernel and user space. * - * Pad space on i386 is left for: + * msqid64_ds was originally meant to be architecture specific, but + * everyone just ended up making identical copies without specific + * optimizations, so we may just as well all use the same one. + * + * 64 bit architectures typically define a 64 bit __kernel_time_t, + * so they do not need the first three padding words. + * On big-endian systems, the padding is in the wrong place. + * + * Pad space is left for: * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values - * - * Pad space on x8664 is left for: - * - 2 miscellaneous 64-bit values */ + struct msqid64_ds { struct ipc64_perm msg_perm; __kernel_time_t msg_stime; /* last msgsnd time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused1; #endif __kernel_time_t msg_rtime; /* last msgrcv time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused2; #endif __kernel_time_t msg_ctime; /* last change time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused3; #endif unsigned long msg_cbytes; /* current number of bytes on queue */
@@ -36,4 +44,4 @@ struct msqid64_ds { unsigned long __unused5; }; -#endif /* _ASM_X86_MSGBUF_H */ +#endif /* __ASM_GENERIC_MSGBUF_H */
arch/x86/include/asm/param.h +5 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_X86_PARAM_H -#define _ASM_X86_PARAM_H +#ifndef __ASM_GENERIC_PARAM_H +#define __ASM_GENERIC_PARAM_H#ifdef __KERNEL__# define HZ CONFIG_HZ/* Internal kernel timer frequency */
@@ -11,7 +11,9 @@#define HZ 100#endif +#ifndef EXEC_PAGESIZE #define EXEC_PAGESIZE 4096 +#endif #ifndef NOGROUP #define NOGROUP (-1)
@@ -19,4 +21,4 @@#define MAXHOSTNAMELEN 64/* max length of hostname */ -#endif /* _ASM_X86_PARAM_H */ +#endif /* __ASM_GENERIC_PARAM_H */
arch/x86/include/asm/shmbuf.h +18 -10
@@ -1,32 +1,40 @@ -#ifndef _ASM_X86_SHMBUF_H -#define _ASM_X86_SHMBUF_H +#ifndef __ASM_GENERIC_SHMBUF_H +#define __ASM_GENERIC_SHMBUF_H + +#include <asm/bitsperlong.h> /* * The shmid64_ds structure for x86 architecture. * Note extra padding because this structure is passed back and forth * between kernel and user space. * - * Pad space on 32 bit is left for: + * shmid64_ds was originally meant to be architecture specific, but + * everyone just ended up making identical copies without specific + * optimizations, so we may just as well all use the same one. + * + * 64 bit architectures typically define a 64 bit __kernel_time_t, + * so they do not need the first two padding words. + * On big-endian systems, the padding is in the wrong place. + * + * + * Pad space is left for: * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values - * - * Pad space on 64 bit is left for: - * - 2 miscellaneous 64-bit values */ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ size_t shm_segsz; /* size of segment (bytes) */ __kernel_time_t shm_atime; /* last attach time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused1; #endif __kernel_time_t shm_dtime; /* last detach time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused2; #endif __kernel_time_t shm_ctime; /* last change time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused3; #endif __kernel_pid_t shm_cpid; /* pid of creator */
@@ -48,4 +56,4 @@ struct shminfo64 { unsigned long __unused4; }; -#endif /* _ASM_X86_SHMBUF_H */ +#endif /* __ASM_GENERIC_SHMBUF_H */
arch/x86/include/asm/socket.h +5 -5
@@ -1,5 +1,5 @@ -#ifndef _ASM_X86_SOCKET_H -#define _ASM_X86_SOCKET_H +#ifndef __ASM_GENERIC_SOCKET_H +#define __ASM_GENERIC_SOCKET_H#include <asm/sockios.h>
@@ -38,8 +38,8 @@#define SO_BINDTODEVICE 25/* Socket filtering */ -#define SO_ATTACH_FILTER 26 -#define SO_DETACH_FILTER 27 +#define SO_ATTACH_FILTER 26 +#define SO_DETACH_FILTER 27#define SO_PEERNAME 28#define SO_TIMESTAMP 29
@@ -57,4 +57,4 @@#define SO_TIMESTAMPING 37#define SCM_TIMESTAMPING SO_TIMESTAMPING -#endif /* _ASM_X86_SOCKET_H */ +#endif /* __ASM_GENERIC_SOCKET_H */
arch/x86/include/asm/sockios.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_X86_SOCKIOS_H -#define _ASM_X86_SOCKIOS_H +#ifndef __ASM_GENERIC_SOCKIOS_H +#define __ASM_GENERIC_SOCKIOS_H/* Socket-level I/O control calls. */ #define FIOSETOWN 0x8901
@@ -10,4 +10,4 @@#define SIOCGSTAMP 0x8906/* Get stamp (timeval) */ #define SIOCGSTAMPNS 0x8907/* Get stamp (timespec) */ -#endif /* _ASM_X86_SOCKIOS_H */ +#endif /* __ASM_GENERIC_SOCKIOS_H */
arch/x86/include/asm/termbits.h +4 -4
@@ -1,5 +1,5 @@ -#ifndef _ASM_X86_TERMBITS_H -#define _ASM_X86_TERMBITS_H +#ifndef __ASM_GENERIC_TERMBITS_H +#define __ASM_GENERIC_TERMBITS_H#include <linux/posix_types.h>
@@ -140,7 +140,7 @@ struct ktermios {#define HUPCL 0002000#define CLOCAL 0004000#define CBAUDEX 0010000 -#define BOTHER 0010000/* non standard rate */ +#define BOTHER 0010000#define B57600 0010001#define B115200 0010002#define B230400 0010003
@@ -195,4 +195,4 @@ struct ktermios {#define TCSADRAIN 1#define TCSAFLUSH 2 -#endif /* _ASM_X86_TERMBITS_H */ +#endif /* __ASM_GENERIC_TERMBITS_H */
Signature · 1 line
1.6.3.1
PATCH 5/5 x86: remove all now-duplicate header files
In reply to Arnd BergmannAll files that have been made identical to the asm-generic version in the previous patches can now be removed, guaranteeing that this does not introduce semantic changes.
--- arch/x86/include/asm/generic-mman.h | 18 --- arch/x86/include/asm/generic-module.h | 22 --- arch/x86/include/asm/generic-scatterlist.h | 43 ------ arch/x86/include/asm/generic-types.h | 42 ------ arch/x86/include/asm/generic-ucontext.h | 12 -- arch/x86/include/asm/ioctls.h | 111 +--------------- arch/x86/include/asm/ipcbuf.h | 34 +----- arch/x86/include/asm/mman.h | 2 +- arch/x86/include/asm/module.h | 2 +- arch/x86/include/asm/msgbuf.h | 48 +------- arch/x86/include/asm/param.h | 25 +---- arch/x86/include/asm/scatterlist.h | 2 +- arch/x86/include/asm/shmbuf.h | 60 +-------- arch/x86/include/asm/socket.h | 61 +--------- arch/x86/include/asm/sockios.h | 14 +-- arch/x86/include/asm/termbits.h | 199 +--------------------------- arch/x86/include/asm/termios.h | 155 +--------------------- arch/x86/include/asm/types.h | 2 +- arch/x86/include/asm/ucontext.h | 2 +- 19 files changed, 14 insertions(+), 840 deletions(-) delete mode 100644 arch/x86/include/asm/generic-mman.h delete mode 100644 arch/x86/include/asm/generic-module.h delete mode 100644 arch/x86/include/asm/generic-scatterlist.h delete mode 100644 arch/x86/include/asm/generic-types.h delete mode 100644 arch/x86/include/asm/generic-ucontext.h
rewrite arch/x86/include/asm/ioctls.h (100%)
rewrite arch/x86/include/asm/ipcbuf.h (100%)
rewrite arch/x86/include/asm/msgbuf.h (100%)
rewrite arch/x86/include/asm/param.h (100%)
rewrite arch/x86/include/asm/shmbuf.h (100%)
rewrite arch/x86/include/asm/socket.h (100%)
rewrite arch/x86/include/asm/termbits.h (100%)
rewrite arch/x86/include/asm/termios.h (100%)
arch/x86/include/asm/generic-mman.h deleted +0 -18
@@ -1,18 +0,0 @@ -#ifndef __ASM_GENERIC_MMAN_H -#define __ASM_GENERIC_MMAN_H - -#include <asm-generic/mman-common.h> - -#define MAP_GROWSDOWN 0x0100/* stack-like segment */ -#define MAP_DENYWRITE 0x0800/* ETXTBSY */ -#define MAP_EXECUTABLE 0x1000/* mark it as an executable */ -#define MAP_LOCKED 0x2000/* pages are locked */ -#define MAP_NORESERVE 0x4000/* don't check for reservations */ -#define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x10000/* do not block on IO */ -#define MAP_STACK 0x20000/* give out an address that is best suited for process/thread stacks */ - -#define MCL_CURRENT 1/* lock all current mappings */ -#define MCL_FUTURE 2/* lock all future mappings */ - -#endif /* __ASM_GENERIC_MMAN_H */
arch/x86/include/asm/generic-module.h deleted +0 -22
@@ -1,22 +0,0 @@ -#ifndef __ASM_GENERIC_MODULE_H -#define __ASM_GENERIC_MODULE_H - -/* -* Many architectures just need a simple module -* loader without arch specific data. -*/ -struct mod_arch_specific -{ -}; - -#ifdef CONFIG_64BIT -#define Elf_Shdr Elf64_Shdr -#define Elf_Sym Elf64_Sym -#define Elf_Ehdr Elf64_Ehdr -#else -#define Elf_Shdr Elf32_Shdr -#define Elf_Sym Elf32_Sym -#define Elf_Ehdr Elf32_Ehdr -#endif - -#endif /* __ASM_GENERIC_MODULE_H */
arch/x86/include/asm/generic-scatterlist.h deleted +0 -43
43 lines not on this page · raw message
arch/x86/include/asm/generic-types.h deleted +0 -42
42 lines not on this page · raw message
arch/x86/include/asm/generic-ucontext.h deleted +0 -12
@@ -1,12 +0,0 @@ -#ifndef __ASM_GENERIC_UCONTEXT_H -#define __ASM_GENERIC_UCONTEXT_H - -struct ucontext { -unsigned long uc_flags; -struct ucontext *uc_link; -stack_t uc_stack; -struct sigcontext uc_mcontext; -sigset_t uc_sigmask;/* mask last for extensibility */ -}; - -#endif /* __ASM_GENERIC_UCONTEXT_H */
arch/x86/include/asm/ioctls.h +1 -110
111 lines not on this page · raw message
arch/x86/include/asm/ipcbuf.h +1 -33
@@ -1,33 +1 @@ -#ifndef __ASM_GENERIC_IPCBUF_H -#define __ASM_GENERIC_IPCBUF_H - -/* -* The generic ipc64_perm structure: -* Note extra padding because this structure is passed back and forth -* between kernel and user space. -* -* ipc64_perm was originally meant to be architecture specific, but -* everyone just ended up making identical copies without specific -* optimizations, so we may just as well all use the same one. -* -* Pad space is left for: -* - 32-bit mode_t on architectures that only had 16 bit -* - 32-bit seq -* - 2 miscellaneous 32-bit values -*/ - -struct ipc64_perm { -__kernel_key_t key; -__kernel_uid32_t uid; -__kernel_gid32_t gid; -__kernel_uid32_t cuid; -__kernel_gid32_t cgid; -__kernel_mode_t mode; -unsigned short __pad1; -unsigned short seq; -unsigned short __pad2; -unsigned long __unused1; -unsigned long __unused2; -}; - -#endif /* __ASM_GENERIC_IPCBUF_H */ +#include <asm-generic/ipcbuf.h>
arch/x86/include/asm/mman.h +1 -1
@@ -3,6 +3,6 @@#define MAP_32BIT 0x40/* only give out 32bit addresses */ -#include <asm/generic-mman.h> +#include <asm-generic/mman.h> #endif /* _ASM_X86_MMAN_H */
arch/x86/include/asm/module.h +1 -1
@@ -1,7 +1,7 @@#ifndef _ASM_X86_MODULE_H#define _ASM_X86_MODULE_H -#include <asm/generic-module.h> +#include <asm-generic/module.h> #ifdef CONFIG_X86_64 /* X86_64 does not define MODULE_PROC_FAMILY */
arch/x86/include/asm/msgbuf.h +1 -47
48 lines not on this page · raw message
arch/x86/include/asm/param.h +1 -24
@@ -1,24 +1 @@ -#ifndef __ASM_GENERIC_PARAM_H -#define __ASM_GENERIC_PARAM_H - -#ifdef __KERNEL__ -# define HZ CONFIG_HZ/* Internal kernel timer frequency */ -# define USER_HZ 100/* some user interfaces are */ -# define CLOCKS_PER_SEC (USER_HZ)/* in "ticks" like times() */ -#endif - -#ifndef HZ -#define HZ 100 -#endif - -#ifndef EXEC_PAGESIZE -#define EXEC_PAGESIZE 4096 -#endif - -#ifndef NOGROUP -#define NOGROUP (-1) -#endif - -#define MAXHOSTNAMELEN 64/* max length of hostname */ - -#endif /* __ASM_GENERIC_PARAM_H */ +#include <asm-generic/param.h>
arch/x86/include/asm/scatterlist.h +1 -1
@@ -3,6 +3,6 @@#define ISA_DMA_THRESHOLD (0x00ffffff) -#include <asm/generic-scatterlist.h> +#include <asm-generic/scatterlist.h> #endif /* _ASM_X86_SCATTERLIST_H */
arch/x86/include/asm/shmbuf.h +1 -59
60 lines not on this page · raw message
arch/x86/include/asm/socket.h +1 -60
61 lines not on this page · raw message
arch/x86/include/asm/sockios.h +1 -13
@@ -1,13 +1 @@ -#ifndef __ASM_GENERIC_SOCKIOS_H -#define __ASM_GENERIC_SOCKIOS_H - -/* Socket-level I/O control calls. */ -#define FIOSETOWN 0x8901 -#define SIOCSPGRP 0x8902 -#define FIOGETOWN 0x8903 -#define SIOCGPGRP 0x8904 -#define SIOCATMARK 0x8905 -#define SIOCGSTAMP 0x8906/* Get stamp (timeval) */ -#define SIOCGSTAMPNS 0x8907/* Get stamp (timespec) */ - -#endif /* __ASM_GENERIC_SOCKIOS_H */ +#include <asm-generic/sockios.h>
arch/x86/include/asm/termbits.h +1 -198
199 lines not on this page · raw message
arch/x86/include/asm/termios.h +1 -154
155 lines not on this page · raw message
arch/x86/include/asm/types.h +1 -1
@@ -3,7 +3,7 @@#define dma_addr_t dma_addr_t -#include <asm/generic-types.h> +#include <asm-generic/types.h> #ifdef __KERNEL__#ifndef __ASSEMBLY__
arch/x86/include/asm/ucontext.h +1 -1
@@ -7,6 +7,6 @@* sigcontext struct (uc_mcontext). */ -#include <asm/generic-ucontext.h> +#include <asm-generic/ucontext.h> #endif /* _ASM_X86_UCONTEXT_H */
Signature · 1 line
1.6.3.1
cover x86: use asm-generic headers where possible
I did not get any feedback on this the last time I sent it, but now these patches actually apply to the mainline kernel so it's possible to apply them.
I've split the series up into five patches for easier review. Each step should show clearly that no semantic changes are introduced, with the exception of termios.h, which was discussed earlier.
I have also checked that the resulting object code is the same, again with the exception of termios.h, because that fixes a small bug.
Arnd Bergmann (5):
x86: add copies of some headers to convert to asm-generic
x86: convert trivial headers to asm-generic version
x86: convert almost generic headers to asm-generic version
x86: convert termios.h to the asm-generic version
x86: remove all now-duplicate header files
arch/x86/include/asm/ioctls.h | 95 +----------------- arch/x86/include/asm/ipcbuf.h | 29 +----- arch/x86/include/asm/mman.h | 28 ++---- arch/x86/include/asm/module.h | 13 +-- arch/x86/include/asm/msgbuf.h | 40 +------- arch/x86/include/asm/param.h | 23 +---- arch/x86/include/asm/scatterlist.h | 41 ++------ arch/x86/include/asm/shmbuf.h | 52 +--------- arch/x86/include/asm/socket.h | 61 +----------- arch/x86/include/asm/sockios.h | 14 +--- arch/x86/include/asm/termbits.h | 199 +----------------------------------- arch/x86/include/asm/termios.h | 115 +-------------------- arch/x86/include/asm/types.h | 12 +-- arch/x86/include/asm/ucontext.h | 8 +-- 14 files changed, 29 insertions(+), 701 deletions(-)
rewrite arch/x86/include/asm/ioctls.h (100%)
rewrite arch/x86/include/asm/ipcbuf.h (100%)
rewrite arch/x86/include/asm/mman.h (82%)
rewrite arch/x86/include/asm/msgbuf.h (100%)
rewrite arch/x86/include/asm/param.h (100%)
rewrite arch/x86/include/asm/scatterlist.h (82%)
rewrite arch/x86/include/asm/shmbuf.h (100%)
rewrite arch/x86/include/asm/socket.h (100%)
rewrite arch/x86/include/asm/termbits.h (100%)
rewrite arch/x86/include/asm/termios.h (100%)
PATCH 3/5 x86: convert almost generic headers to asm-generic version
In x86, mman.h, module.h, scatterlist.h, types.h and ucontext.h can use the asm-generic version by just defining the x86 specific parts locally and falling back on the generic code for the common bits.
This patch illustrates the differences between the x86 and asm-generic versions by changing a file that is initially identical to the x86 version to one that is identical to the asm-generic version.
--- arch/x86/include/asm/generic-mman.h | 8 +-- arch/x86/include/asm/generic-module.h | 102 ++++++---------------------- arch/x86/include/asm/generic-scatterlist.h | 34 ++++++--- arch/x86/include/asm/generic-types.h | 32 ++++++--- arch/x86/include/asm/generic-ucontext.h | 30 +++----- arch/x86/include/asm/mman.h | 28 ++------ arch/x86/include/asm/module.h | 13 +--- arch/x86/include/asm/scatterlist.h | 41 ++--------- arch/x86/include/asm/types.h | 12 +--- arch/x86/include/asm/ucontext.h | 8 +-- 10 files changed, 101 insertions(+), 207 deletions(-)
rewrite arch/x86/include/asm/generic-module.h (99%) rewrite arch/x86/include/asm/generic-ucontext.h (61%) rewrite arch/x86/include/asm/mman.h (82%) rewrite arch/x86/include/asm/scatterlist.h (82%)
arch/x86/include/asm/generic-mman.h +3 -5
@@ -1,10 +1,8 @@ -#ifndef _ASM_X86_MMAN_H -#define _ASM_X86_MMAN_H +#ifndef __ASM_GENERIC_MMAN_H +#define __ASM_GENERIC_MMAN_H#include <asm-generic/mman-common.h> -#define MAP_32BIT 0x40/* only give out 32bit addresses */ -#define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */ #define MAP_EXECUTABLE 0x1000/* mark it as an executable */
@@ -17,4 +15,4 @@#define MCL_CURRENT 1/* lock all current mappings */ #define MCL_FUTURE 2/* lock all future mappings */ -#endif /* _ASM_X86_MMAN_H */ +#endif /* __ASM_GENERIC_MMAN_H */
arch/x86/include/asm/generic-module.h +22 -80
102 lines not on this page · raw message
arch/x86/include/asm/generic-scatterlist.h +22 -12
@@ -1,7 +1,7 @@ -#ifndef _ASM_X86_SCATTERLIST_H -#define _ASM_X86_SCATTERLIST_H +#ifndef __ASM_GENERIC_SCATTERLIST_H +#define __ASM_GENERIC_SCATTERLIST_H -#include <asm/types.h> +#include <linux/types.h> struct scatterlist { #ifdef CONFIG_DEBUG_SG
@@ -14,20 +14,30 @@ struct scatterlist { unsigned int dma_length; }; -#define ARCH_HAS_SG_CHAIN -#define ISA_DMA_THRESHOLD (0x00ffffff) -/* -* These macros should be used after a pci_map_sg call has been done +* These macros should be used after a dma_map_sg call has been done * to get bus addresses of each of the SG entries and their lengths. * You should only work with the number of sg entries pci_map_sg -* returns. +* returns, or alternatively stop on the first sg_dma_len(sg) which +* is 0. */ #define sg_dma_address (sg) ((sg)->dma_address) -#ifdef CONFIG_X86_32 -# define sg_dma_len (sg) ((sg)->length) +#ifndef sg_dma_len +/* +* Normally, you have an iommu on 64 bit machines, but not on 32 bit +* machines. Architectures that are differnt should override this. +*/ +#if __BITS_PER_LONG ==64 +#define sg_dma_len (sg) ((sg)->dma_length)#else -# define sg_dma_len (sg) ((sg)->dma_length) +#define sg_dma_len (sg) ((sg)->length) +#endif /* 64 bit */ +#endif /* sg_dma_len */ + +#ifndef ISA_DMA_THRESHOLD +#define ISA_DMA_THRESHOLD (~0UL)#endif -#endif /* _ASM_X86_SCATTERLIST_H */ +#define ARCH_HAS_SG_CHAIN + +#endif /* __ASM_GENERIC_SCATTERLIST_H */
arch/x86/include/asm/generic-types.h +22 -10
@@ -1,6 +1,9 @@ -#ifndef _ASM_X86_TYPES_H -#define _ASM_X86_TYPES_H - +#ifndef _ASM_GENERIC_TYPES_H +#define _ASM_GENERIC_TYPES_H +/* +* int-ll64 is used practically everywhere now, +* so use it as a reasonable default. +*/ #include <asm-generic/int-ll64.h> #ifndef __ASSEMBLY__
@@ -13,18 +16,27 @@ typedef unsigned short umode_t;* These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ -#ifndef __ASSEMBLY__ - -typedef u64 dma64_addr_t ; -#if defined(CONFIG_X86_64 ) || defined(CONFIG_HIGHMEM64G ) -/* DMA addresses come in 32-bit and 64-bit flavours. */ +/* +* DMA addresses may be very different from physical addresses +* and pointers. i386 and powerpc may have 64 bit DMA on 32 bit +* systems, while sparc64 uses 32 bit DMA addresses for 64 bit +* physical addresses. +* This default defines dma_addr_t to have the same size as +* phys_addr_t, which is the most common way. +* Do not define the dma64_addr_t type, which never really +* worked. +*/ +#ifndef dma_addr_t +#ifdef CONFIG_PHYS_ADDR_T_64BIT typedef u64 dma_addr_t ;#else typedef u32 dma_addr_t ; -#endif +#endif /* CONFIG_PHYS_ADDR_T_64BIT */ +#endif /* dma_addr_t */ #endif /* __ASSEMBLY__ */ +#endif /* __KERNEL__ */ -#endif /* _ASM_X86_TYPES_H */ +#endif /* _ASM_GENERIC_TYPES_H */
arch/x86/include/asm/generic-ucontext.h +12 -18
@@ -1,18 +1,12 @@ -#ifndef _ASM_X86_UCONTEXT_H -#define _ASM_X86_UCONTEXT_H - -#define UC_FP_XSTATE 0x1/* indicates the presence of extended state -* information in the memory layout pointed -* by the fpstate pointer in the ucontext's -* sigcontext struct (uc_mcontext). -*/ - -struct ucontext { -unsigned long uc_flags; -struct ucontext *uc_link; -stack_t uc_stack; -struct sigcontext uc_mcontext; -sigset_t uc_sigmask;/* mask last for extensibility */ -}; - -#endif /* _ASM_X86_UCONTEXT_H */ +#ifndef __ASM_GENERIC_UCONTEXT_H +#define __ASM_GENERIC_UCONTEXT_H + +struct ucontext { +unsigned long uc_flags; +struct ucontext *uc_link; +stack_t uc_stack; +struct sigcontext uc_mcontext; +sigset_t uc_sigmask;/* mask last for extensibility */ +}; + +#endif /* __ASM_GENERIC_UCONTEXT_H */
arch/x86/include/asm/mman.h +8 -20
@@ -1,20 +1,8 @@ -#ifndef _ASM_X86_MMAN_H -#define _ASM_X86_MMAN_H - -#include <asm-generic/mman-common.h> - -#define MAP_32BIT 0x40/* only give out 32bit addresses */ - -#define MAP_GROWSDOWN 0x0100/* stack-like segment */ -#define MAP_DENYWRITE 0x0800/* ETXTBSY */ -#define MAP_EXECUTABLE 0x1000/* mark it as an executable */ -#define MAP_LOCKED 0x2000/* pages are locked */ -#define MAP_NORESERVE 0x4000/* don't check for reservations */ -#define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x10000/* do not block on IO */ -#define MAP_STACK 0x20000/* give out an address that is best suited for process/thread stacks */ - -#define MCL_CURRENT 1/* lock all current mappings */ -#define MCL_FUTURE 2/* lock all future mappings */ - -#endif /* _ASM_X86_MMAN_H */ +#ifndef _ASM_X86_MMAN_H +#define _ASM_X86_MMAN_H + +#define MAP_32BIT 0x40/* only give out 32bit addresses */ + +#include <asm/generic-mman.h> + +#endif /* _ASM_X86_MMAN_H */
arch/x86/include/asm/module.h +1 -12
@@ -1,18 +1,7 @@#ifndef _ASM_X86_MODULE_H#define _ASM_X86_MODULE_H -/* x86_32/64 are simple */ -struct mod_arch_specific {}; - -#ifdef CONFIG_X86_32 -# define Elf_Shdr Elf32_Shdr -# define Elf_Sym Elf32_Sym -# define Elf_Ehdr Elf32_Ehdr -#else -# define Elf_Shdr Elf64_Shdr -# define Elf_Sym Elf64_Sym -# define Elf_Ehdr Elf64_Ehdr -#endif +#include <asm/generic-module.h> #ifdef CONFIG_X86_64 /* X86_64 does not define MODULE_PROC_FAMILY */
arch/x86/include/asm/scatterlist.h +8 -33
41 lines not on this page · raw message
arch/x86/include/asm/types.h +2 -10
@@ -1,19 +1,11 @@#ifndef _ASM_X86_TYPES_H#define _ASM_X86_TYPES_H -#include <asm-generic/int-ll64.h> +#define dma_addr_t dma_addr_t -#ifndef __ASSEMBLY__ - -typedef unsigned short umode_t ; +#include <asm/generic-types.h> -#endif /* __ASSEMBLY__ */ - -/* -* These aren't exported outside the kernel to avoid name space clashes -*/ #ifdef __KERNEL__ -#ifndef __ASSEMBLY__typedef u64 dma64_addr_t ;
arch/x86/include/asm/ucontext.h +1 -7
@@ -7,12 +7,6 @@* sigcontext struct (uc_mcontext). */ -struct ucontext { -unsigned long uc_flags; -struct ucontext *uc_link; -stack_t uc_stack; -struct sigcontext uc_mcontext; -sigset_t uc_sigmask;/* mask last for extensibility */ -}; +#include <asm/generic-ucontext.h> #endif /* _ASM_X86_UCONTEXT_H */
Signature · 1 line
1.6.3.1
[tip:x86/asm-generic] x86: add copies of some headers to convert to asm-generic
In reply to Arnd BergmannCommit-ID: 4adc667593f83a18a8e54ce94f250fd166a272ac Gitweb: http://git.kernel.org/tip/4adc667593f83a18a8e54ce94f250fd166a272ac Author: Arnd Bergmann <[email protected]> AuthorDate: Thu, 18 Jun 2009 21:48:16 +0200 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 18 Jun 2009 14:39:40 -0700
x86: add copies of some headers to convert to asm-generic
Just an intermediate step to make reviewing easier. These files are identical copies of the existing headers.
LKML-Reference: <[email protected]>
---
arch/x86/include/asm/{mman.h => generic-mman.h} | 0
.../x86/include/asm/{module.h => generic-module.h} | 0
.../asm/{scatterlist.h => generic-scatterlist.h} | 0
arch/x86/include/asm/{types.h => generic-types.h} | 0
.../include/asm/{ucontext.h => generic-ucontext.h} | 0
5 files changed, 0 insertions(+), 0 deletions(-)arch/x86/include/asm/generic-mman.h renamed from arch/x86/include/asm/mman.h +0 -0
arch/x86/include/asm/generic-module.h renamed from arch/x86/include/asm/module.h +0 -0
arch/x86/include/asm/generic-scatterlist.h renamed from arch/x86/include/asm/scatterlist.h +0 -0
arch/x86/include/asm/generic-types.h renamed from arch/x86/include/asm/types.h +0 -0
arch/x86/include/asm/generic-ucontext.h renamed from arch/x86/include/asm/ucontext.h +0 -0
[tip:x86/asm-generic] x86: convert trivial headers to asm-generic version
In reply to Arnd BergmannCommit-ID: 7bfd124d6dae7d394e73753300594a81a022fe7d Gitweb: http://git.kernel.org/tip/7bfd124d6dae7d394e73753300594a81a022fe7d Author: Arnd Bergmann <[email protected]> AuthorDate: Thu, 18 Jun 2009 21:48:17 +0200 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 18 Jun 2009 14:39:47 -0700
x86: convert trivial headers to asm-generic version
For these nine header files, the asm-generic version should be semantically identical to what is in x86. Change the contents to be binary identical, for better review.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/ioctls.h | 40 +++++++++++++++++++++++++++----------- arch/x86/include/asm/ipcbuf.h | 15 +++++++++---- arch/x86/include/asm/msgbuf.h | 30 ++++++++++++++++++---------- arch/x86/include/asm/param.h | 8 ++++-- arch/x86/include/asm/shmbuf.h | 28 +++++++++++++++++--------- arch/x86/include/asm/socket.h | 10 ++++---- arch/x86/include/asm/sockios.h | 6 ++-- arch/x86/include/asm/termbits.h | 8 +++--- 8 files changed, 92 insertions(+), 53 deletions(-)
arch/x86/include/asm/ioctls.h +28 -12
@@ -1,12 +1,23 @@ -#ifndef _ASM_X86_IOCTLS_H -#define _ASM_X86_IOCTLS_H +#ifndef __ASM_GENERIC_IOCTLS_H +#define __ASM_GENERIC_IOCTLS_H -#include <asm/ioctl.h> +#include <linux/ioctl.h> + +/* +* These are the most common definitions for tty ioctl numbers. +* Most of them do not use the recommended _IOC(), but there is +* probably some source code out there hardcoding the number, +* so we might as well use them for all new platforms. +* +* The architectures that use different values here typically +* try to be compatible with some Unix variants for the same +* architecture. +*/ /* 0x54 is just a magic number to make these relatively unique ('T') */ #define TCGETS 0x5401 -#define TCSETS 0x5402/* Clashes with SNDCTL_TMR_START sound ioctl */ +#define TCSETS 0x5402#define TCSETSW 0x5403#define TCSETSF 0x5404#define TCGETA 0x5405
@@ -43,7 +54,6 @@#define TIOCSETD 0x5423#define TIOCGETD 0x5424#define TCSBRKP 0x5425/* Needed for POSIX tcsendbreak() */ -/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */ #define TIOCSBRK 0x5427/* BSD compatibility */ #define TIOCCBRK 0x5428/* BSD compatibility */ #define TIOCGSID 0x5429/* Return the session ID of FD */
@@ -53,8 +63,7 @@#define TCSETSF2 _IOW('T', 0x2D, struct termios2)#define TIOCGRS485 0x542E#define TIOCSRS485 0x542F -#define TIOCGPTN _IOR('T', 0x30, unsigned int) -/* Get Pty Number (of pty-mux device) */ +#define TIOCGPTN _IOR('T', 0x30, unsigned int)/* Get Pty Number (of pty-mux device) */ #define TIOCSPTLCK _IOW('T', 0x31, int)/* Lock/unlock Pty */ #define TCGETX 0x5432/* SYS5 TCGETX compatibility */ #define TCSETX 0x5433
@@ -76,9 +85,16 @@#define TIOCMIWAIT 0x545C/* wait for a change on serial input line(s) */ #define TIOCGICOUNT 0x545D/* read serial port inline interrupt counts */ -#define TIOCGHAYESESP 0x545E/* Get Hayes ESP configuration */ -#define TIOCSHAYESESP 0x545F/* Set Hayes ESP configuration */ -#define FIOQSIZE 0x5460 + +/* +* some architectures define FIOQSIZE as 0x545E, which is used for +* TIOCGHAYESESP on others +*/ +#ifndef FIOQSIZE +# define TIOCGHAYESESP 0x545E/* Get Hayes ESP configuration */ +# define TIOCSHAYESESP 0x545F/* Set Hayes ESP configuration */ +# define FIOQSIZE 0x5460 +#endif /* Used for packet mode */ #define TIOCPKT_DATA 0
@@ -89,6 +105,6 @@#define TIOCPKT_NOSTOP 16#define TIOCPKT_DOSTOP 32 -#define TIOCSER_TEMT 0x01/* Transmitter physically empty */ +#define TIOCSER_TEMT 0x01/* Transmitter physically empty */ -#endif /* _ASM_X86_IOCTLS_H */ +#endif /* __ASM_GENERIC_IOCTLS_H */
arch/x86/include/asm/ipcbuf.h +10 -5
@@ -1,13 +1,18 @@ -#ifndef _ASM_X86_IPCBUF_H -#define _ASM_X86_IPCBUF_H +#ifndef __ASM_GENERIC_IPCBUF_H +#define __ASM_GENERIC_IPCBUF_H/* -* The ipc64_perm structure for x86 architecture. +* The generic ipc64_perm structure: * Note extra padding because this structure is passed back and forth * between kernel and user space. * +* ipc64_perm was originally meant to be architecture specific, but +* everyone just ended up making identical copies without specific +* optimizations, so we may just as well all use the same one. +* * Pad space is left for: -* - 32-bit mode_t and seq +* - 32-bit mode_t on architectures that only had 16 bit +* - 32-bit seq * - 2 miscellaneous 32-bit values */
@@ -25,4 +30,4 @@ struct ipc64_perm { unsigned long __unused2; }; -#endif /* _ASM_X86_IPCBUF_H */ +#endif /* __ASM_GENERIC_IPCBUF_H */
arch/x86/include/asm/msgbuf.h +19 -11
@@ -1,30 +1,38 @@ -#ifndef _ASM_X86_MSGBUF_H -#define _ASM_X86_MSGBUF_H +#ifndef __ASM_GENERIC_MSGBUF_H +#define __ASM_GENERIC_MSGBUF_H +#include <asm/bitsperlong.h> /* - * The msqid64_ds structure for i386 architecture. + * generic msqid64_ds structure. + * * Note extra padding because this structure is passed back and forth * between kernel and user space. * - * Pad space on i386 is left for: + * msqid64_ds was originally meant to be architecture specific, but + * everyone just ended up making identical copies without specific + * optimizations, so we may just as well all use the same one. + * + * 64 bit architectures typically define a 64 bit __kernel_time_t, + * so they do not need the first three padding words. + * On big-endian systems, the padding is in the wrong place. + * + * Pad space is left for: * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values - * - * Pad space on x8664 is left for: - * - 2 miscellaneous 64-bit values */ + struct msqid64_ds { struct ipc64_perm msg_perm; __kernel_time_t msg_stime; /* last msgsnd time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused1; #endif __kernel_time_t msg_rtime; /* last msgrcv time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused2; #endif __kernel_time_t msg_ctime; /* last change time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused3; #endif unsigned long msg_cbytes; /* current number of bytes on queue */
@@ -36,4 +44,4 @@ struct msqid64_ds { unsigned long __unused5; }; -#endif /* _ASM_X86_MSGBUF_H */ +#endif /* __ASM_GENERIC_MSGBUF_H */
arch/x86/include/asm/param.h +5 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_X86_PARAM_H -#define _ASM_X86_PARAM_H +#ifndef __ASM_GENERIC_PARAM_H +#define __ASM_GENERIC_PARAM_H#ifdef __KERNEL__# define HZ CONFIG_HZ/* Internal kernel timer frequency */
@@ -11,7 +11,9 @@#define HZ 100#endif +#ifndef EXEC_PAGESIZE #define EXEC_PAGESIZE 4096 +#endif #ifndef NOGROUP #define NOGROUP (-1)
@@ -19,4 +21,4 @@#define MAXHOSTNAMELEN 64/* max length of hostname */ -#endif /* _ASM_X86_PARAM_H */ +#endif /* __ASM_GENERIC_PARAM_H */
arch/x86/include/asm/shmbuf.h +18 -10
@@ -1,32 +1,40 @@ -#ifndef _ASM_X86_SHMBUF_H -#define _ASM_X86_SHMBUF_H +#ifndef __ASM_GENERIC_SHMBUF_H +#define __ASM_GENERIC_SHMBUF_H + +#include <asm/bitsperlong.h> /* * The shmid64_ds structure for x86 architecture. * Note extra padding because this structure is passed back and forth * between kernel and user space. * - * Pad space on 32 bit is left for: + * shmid64_ds was originally meant to be architecture specific, but + * everyone just ended up making identical copies without specific + * optimizations, so we may just as well all use the same one. + * + * 64 bit architectures typically define a 64 bit __kernel_time_t, + * so they do not need the first two padding words. + * On big-endian systems, the padding is in the wrong place. + * + * + * Pad space is left for: * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values - * - * Pad space on 64 bit is left for: - * - 2 miscellaneous 64-bit values */ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ size_t shm_segsz; /* size of segment (bytes) */ __kernel_time_t shm_atime; /* last attach time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused1; #endif __kernel_time_t shm_dtime; /* last detach time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused2; #endif __kernel_time_t shm_ctime; /* last change time */ -#ifdef __i386__ +#if __BITS_PER_LONG != 64 unsigned long __unused3; #endif __kernel_pid_t shm_cpid; /* pid of creator */
@@ -48,4 +56,4 @@ struct shminfo64 { unsigned long __unused4; }; -#endif /* _ASM_X86_SHMBUF_H */ +#endif /* __ASM_GENERIC_SHMBUF_H */
arch/x86/include/asm/socket.h +5 -5
@@ -1,5 +1,5 @@ -#ifndef _ASM_X86_SOCKET_H -#define _ASM_X86_SOCKET_H +#ifndef __ASM_GENERIC_SOCKET_H +#define __ASM_GENERIC_SOCKET_H#include <asm/sockios.h>
@@ -38,8 +38,8 @@#define SO_BINDTODEVICE 25/* Socket filtering */ -#define SO_ATTACH_FILTER 26 -#define SO_DETACH_FILTER 27 +#define SO_ATTACH_FILTER 26 +#define SO_DETACH_FILTER 27#define SO_PEERNAME 28#define SO_TIMESTAMP 29
@@ -57,4 +57,4 @@#define SO_TIMESTAMPING 37#define SCM_TIMESTAMPING SO_TIMESTAMPING -#endif /* _ASM_X86_SOCKET_H */ +#endif /* __ASM_GENERIC_SOCKET_H */
arch/x86/include/asm/sockios.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_X86_SOCKIOS_H -#define _ASM_X86_SOCKIOS_H +#ifndef __ASM_GENERIC_SOCKIOS_H +#define __ASM_GENERIC_SOCKIOS_H/* Socket-level I/O control calls. */ #define FIOSETOWN 0x8901
@@ -10,4 +10,4 @@#define SIOCGSTAMP 0x8906/* Get stamp (timeval) */ #define SIOCGSTAMPNS 0x8907/* Get stamp (timespec) */ -#endif /* _ASM_X86_SOCKIOS_H */ +#endif /* __ASM_GENERIC_SOCKIOS_H */
arch/x86/include/asm/termbits.h +4 -4
@@ -1,5 +1,5 @@ -#ifndef _ASM_X86_TERMBITS_H -#define _ASM_X86_TERMBITS_H +#ifndef __ASM_GENERIC_TERMBITS_H +#define __ASM_GENERIC_TERMBITS_H#include <linux/posix_types.h>
@@ -140,7 +140,7 @@ struct ktermios {#define HUPCL 0002000#define CLOCAL 0004000#define CBAUDEX 0010000 -#define BOTHER 0010000/* non standard rate */ +#define BOTHER 0010000#define B57600 0010001#define B115200 0010002#define B230400 0010003
@@ -195,4 +195,4 @@ struct ktermios {#define TCSADRAIN 1#define TCSAFLUSH 2 -#endif /* _ASM_X86_TERMBITS_H */ +#endif /* __ASM_GENERIC_TERMBITS_H */
[tip:x86/asm-generic] x86: convert almost generic headers to asm-generic version
In reply to Arnd BergmannCommit-ID: 06f5013aa8eb5895ced2c71d13f5114103605555 Gitweb: http://git.kernel.org/tip/06f5013aa8eb5895ced2c71d13f5114103605555 Author: Arnd Bergmann <[email protected]> AuthorDate: Thu, 18 Jun 2009 21:48:18 +0200 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 18 Jun 2009 14:39:53 -0700
x86: convert almost generic headers to asm-generic version
In x86, mman.h, module.h, scatterlist.h, types.h and ucontext.h can use the asm-generic version by just defining the x86 specific parts locally and falling back on the generic code for the common bits.
This patch illustrates the differences between the x86 and asm-generic versions by changing a file that is initially identical to the x86 version to one that is identical to the asm-generic version.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/generic-mman.h | 8 +-- arch/x86/include/asm/generic-module.h | 92 +++++---------------------- arch/x86/include/asm/generic-scatterlist.h | 34 +++++++---- arch/x86/include/asm/generic-types.h | 32 +++++++--- arch/x86/include/asm/generic-ucontext.h | 12 +--- arch/x86/include/asm/mman.h | 14 +---- arch/x86/include/asm/module.h | 13 +---- arch/x86/include/asm/scatterlist.h | 27 +-------- arch/x86/include/asm/types.h | 12 +--- arch/x86/include/asm/ucontext.h | 8 +-- 10 files changed, 73 insertions(+), 179 deletions(-)
arch/x86/include/asm/generic-mman.h +3 -5
@@ -1,10 +1,8 @@ -#ifndef _ASM_X86_MMAN_H -#define _ASM_X86_MMAN_H +#ifndef __ASM_GENERIC_MMAN_H +#define __ASM_GENERIC_MMAN_H#include <asm-generic/mman-common.h> -#define MAP_32BIT 0x40/* only give out 32bit addresses */ -#define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */ #define MAP_EXECUTABLE 0x1000/* mark it as an executable */
@@ -17,4 +15,4 @@#define MCL_CURRENT 1/* lock all current mappings */ #define MCL_FUTURE 2/* lock all future mappings */ -#endif /* _ASM_X86_MMAN_H */ +#endif /* __ASM_GENERIC_MMAN_H */
arch/x86/include/asm/generic-module.h +17 -75
97 lines not on this page · raw message
arch/x86/include/asm/generic-scatterlist.h +22 -12
@@ -1,7 +1,7 @@ -#ifndef _ASM_X86_SCATTERLIST_H -#define _ASM_X86_SCATTERLIST_H +#ifndef __ASM_GENERIC_SCATTERLIST_H +#define __ASM_GENERIC_SCATTERLIST_H -#include <asm/types.h> +#include <linux/types.h> struct scatterlist { #ifdef CONFIG_DEBUG_SG
@@ -14,20 +14,30 @@ struct scatterlist { unsigned int dma_length; }; -#define ARCH_HAS_SG_CHAIN -#define ISA_DMA_THRESHOLD (0x00ffffff) -/* -* These macros should be used after a pci_map_sg call has been done +* These macros should be used after a dma_map_sg call has been done * to get bus addresses of each of the SG entries and their lengths. * You should only work with the number of sg entries pci_map_sg -* returns. +* returns, or alternatively stop on the first sg_dma_len(sg) which +* is 0. */ #define sg_dma_address (sg) ((sg)->dma_address) -#ifdef CONFIG_X86_32 -# define sg_dma_len (sg) ((sg)->length) +#ifndef sg_dma_len +/* +* Normally, you have an iommu on 64 bit machines, but not on 32 bit +* machines. Architectures that are differnt should override this. +*/ +#if __BITS_PER_LONG ==64 +#define sg_dma_len (sg) ((sg)->dma_length)#else -# define sg_dma_len (sg) ((sg)->dma_length) +#define sg_dma_len (sg) ((sg)->length) +#endif /* 64 bit */ +#endif /* sg_dma_len */ + +#ifndef ISA_DMA_THRESHOLD +#define ISA_DMA_THRESHOLD (~0UL)#endif -#endif /* _ASM_X86_SCATTERLIST_H */ +#define ARCH_HAS_SG_CHAIN + +#endif /* __ASM_GENERIC_SCATTERLIST_H */
arch/x86/include/asm/generic-types.h +22 -10
@@ -1,6 +1,9 @@ -#ifndef _ASM_X86_TYPES_H -#define _ASM_X86_TYPES_H - +#ifndef _ASM_GENERIC_TYPES_H +#define _ASM_GENERIC_TYPES_H +/* +* int-ll64 is used practically everywhere now, +* so use it as a reasonable default. +*/ #include <asm-generic/int-ll64.h> #ifndef __ASSEMBLY__
@@ -13,18 +16,27 @@ typedef unsigned short umode_t;* These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ -#ifndef __ASSEMBLY__ - -typedef u64 dma64_addr_t ; -#if defined(CONFIG_X86_64 ) || defined(CONFIG_HIGHMEM64G ) -/* DMA addresses come in 32-bit and 64-bit flavours. */ +/* +* DMA addresses may be very different from physical addresses +* and pointers. i386 and powerpc may have 64 bit DMA on 32 bit +* systems, while sparc64 uses 32 bit DMA addresses for 64 bit +* physical addresses. +* This default defines dma_addr_t to have the same size as +* phys_addr_t, which is the most common way. +* Do not define the dma64_addr_t type, which never really +* worked. +*/ +#ifndef dma_addr_t +#ifdef CONFIG_PHYS_ADDR_T_64BIT typedef u64 dma_addr_t ;#else typedef u32 dma_addr_t ; -#endif +#endif /* CONFIG_PHYS_ADDR_T_64BIT */ +#endif /* dma_addr_t */ #endif /* __ASSEMBLY__ */ +#endif /* __KERNEL__ */ -#endif /* _ASM_X86_TYPES_H */ +#endif /* _ASM_GENERIC_TYPES_H */
arch/x86/include/asm/generic-ucontext.h +3 -9
@@ -1,11 +1,5 @@ -#ifndef _ASM_X86_UCONTEXT_H -#define _ASM_X86_UCONTEXT_H - -#define UC_FP_XSTATE 0x1 /* indicates the presence of extended state - * information in the memory layout pointed - * by the fpstate pointer in the ucontext's - * sigcontext struct (uc_mcontext). - */ +#ifndef __ASM_GENERIC_UCONTEXT_H +#define __ASM_GENERIC_UCONTEXT_H struct ucontext { unsigned long uc_flags;
@@ -15,4 +9,4 @@ struct ucontext { sigset_t uc_sigmask; /* mask last for extensibility */ }; -#endif /* _ASM_X86_UCONTEXT_H */ +#endif /* __ASM_GENERIC_UCONTEXT_H */
arch/x86/include/asm/mman.h +1 -13
@@ -1,20 +1,8 @@#ifndef _ASM_X86_MMAN_H#define _ASM_X86_MMAN_H -#include <asm-generic/mman-common.h> -#define MAP_32BIT 0x40/* only give out 32bit addresses */ -#define MAP_GROWSDOWN 0x0100/* stack-like segment */ -#define MAP_DENYWRITE 0x0800/* ETXTBSY */ -#define MAP_EXECUTABLE 0x1000/* mark it as an executable */ -#define MAP_LOCKED 0x2000/* pages are locked */ -#define MAP_NORESERVE 0x4000/* don't check for reservations */ -#define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x10000/* do not block on IO */ -#define MAP_STACK 0x20000/* give out an address that is best suited for process/thread stacks */ - -#define MCL_CURRENT 1/* lock all current mappings */ -#define MCL_FUTURE 2/* lock all future mappings */ +#include <asm/generic-mman.h> #endif /* _ASM_X86_MMAN_H */
arch/x86/include/asm/module.h +1 -12
@@ -1,18 +1,7 @@#ifndef _ASM_X86_MODULE_H#define _ASM_X86_MODULE_H -/* x86_32/64 are simple */ -struct mod_arch_specific {}; - -#ifdef CONFIG_X86_32 -# define Elf_Shdr Elf32_Shdr -# define Elf_Sym Elf32_Sym -# define Elf_Ehdr Elf32_Ehdr -#else -# define Elf_Shdr Elf64_Shdr -# define Elf_Sym Elf64_Sym -# define Elf_Ehdr Elf64_Ehdr -#endif +#include <asm/generic-module.h> #ifdef CONFIG_X86_64 /* X86_64 does not define MODULE_PROC_FAMILY */
arch/x86/include/asm/scatterlist.h +1 -26
@@ -1,33 +1,8 @@#ifndef _ASM_X86_SCATTERLIST_H#define _ASM_X86_SCATTERLIST_H -#include <asm/types.h> - -struct scatterlist { -#ifdef CONFIG_DEBUG_SG -unsigned long sg_magic; -#endif -unsigned long page_link; -unsigned int offset; -unsigned int length; -dma_addr_t dma_address; -unsigned int dma_length; -}; - -#define ARCH_HAS_SG_CHAIN #define ISA_DMA_THRESHOLD (0x00ffffff) -/* -* These macros should be used after a pci_map_sg call has been done -* to get bus addresses of each of the SG entries and their lengths. -* You should only work with the number of sg entries pci_map_sg -* returns. -*/ -#define sg_dma_address (sg) ((sg)->dma_address) -#ifdef CONFIG_X86_32 -# define sg_dma_len (sg) ((sg)->length) -#else -# define sg_dma_len (sg) ((sg)->dma_length) -#endif +#include <asm/generic-scatterlist.h> #endif /* _ASM_X86_SCATTERLIST_H */
arch/x86/include/asm/types.h +2 -10
@@ -1,19 +1,11 @@#ifndef _ASM_X86_TYPES_H#define _ASM_X86_TYPES_H -#include <asm-generic/int-ll64.h> +#define dma_addr_t dma_addr_t -#ifndef __ASSEMBLY__ - -typedef unsigned short umode_t ; +#include <asm/generic-types.h> -#endif /* __ASSEMBLY__ */ - -/* -* These aren't exported outside the kernel to avoid name space clashes -*/ #ifdef __KERNEL__ -#ifndef __ASSEMBLY__typedef u64 dma64_addr_t ;
arch/x86/include/asm/ucontext.h +1 -7
@@ -7,12 +7,6 @@* sigcontext struct (uc_mcontext). */ -struct ucontext { -unsigned long uc_flags; -struct ucontext *uc_link; -stack_t uc_stack; -struct sigcontext uc_mcontext; -sigset_t uc_sigmask;/* mask last for extensibility */ -}; +#include <asm/generic-ucontext.h> #endif /* _ASM_X86_UCONTEXT_H */
[tip:x86/asm-generic] x86: convert termios.h to the asm-generic version
In reply to Arnd BergmannCommit-ID: 69d5ffdaad7b77b97229b55c36afb20e5bebd29e Gitweb: http://git.kernel.org/tip/69d5ffdaad7b77b97229b55c36afb20e5bebd29e Author: Arnd Bergmann <[email protected]> AuthorDate: Thu, 18 Jun 2009 21:48:19 +0200 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 18 Jun 2009 14:39:58 -0700
x86: convert termios.h to the asm-generic version
This patch turned out more controversial than expected and may get dropped in the future. I'm including it for reference anyway.
The user_termio_to_kernel_termios and kernel_termios_to_user_termio functions on x86 are lacking error checking from get_user and are not portable to big-endian systems, so the asm-generic header has to differ in this regard.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/termios.h | 86 +++++++++++++++++++++++++++++----------- 1 files changed, 63 insertions(+), 23 deletions(-)
arch/x86/include/asm/termios.h +63 -23
@@ -1,5 +1,12 @@ -#ifndef _ASM_X86_TERMIOS_H -#define _ASM_X86_TERMIOS_H +#ifndef _ASM_GENERIC_TERMIOS_H +#define _ASM_GENERIC_TERMIOS_H +/* +* Most architectures have straight copies of the x86 code, with +* varying levels of bug fixes on top. Usually it's a good idea +* to use this generic version instead, but be careful to avoid +* ABI changes. +* New architectures should not provide their own version. +*/ #include <asm/termbits.h> #include <asm/ioctls.h>
@@ -54,37 +61,57 @@ struct termio {/* * Translate a "termio" structure into a "termios". Ugh. */ -#define SET_LOW_TERMIOS_BITS (termios, termio, x) { \ - unsigned short __tmp; \ - get_user(__tmp,&(termio)->x); \ - *(unsigned short *) &(termios)->x = __tmp; \ -} -static inline int user_termio_to_kernel_termios (struct ktermios *termios, -struct termio __user *termio) +const struct termio __user *termio) { -SET_LOW_TERMIOS_BITS (termios, termio, c_iflag); -SET_LOW_TERMIOS_BITS (termios, termio, c_oflag); -SET_LOW_TERMIOS_BITS (termios, termio, c_cflag); -SET_LOW_TERMIOS_BITS (termios, termio, c_lflag); -get_user (termios->c_line, &termio->c_line); -return copy_from_user (termios->c_cc, termio->c_cc,NCC ); +unsigned short tmp; + +if (get_user (tmp, &termio->c_iflag) <0 ) + goto fault; + termios->c_iflag = (0xffff0000 & termios->c_iflag) | tmp; + +if (get_user (tmp, &termio->c_oflag) <0 ) + goto fault; + termios->c_oflag = (0xffff0000 & termios->c_oflag) | tmp; + +if (get_user (tmp, &termio->c_cflag) <0 ) + goto fault; + termios->c_cflag = (0xffff0000 & termios->c_cflag) | tmp; + +if (get_user (tmp, &termio->c_lflag) <0 ) + goto fault; + termios->c_lflag = (0xffff0000 & termios->c_lflag) | tmp; + +if (get_user (termios->c_line, &termio->c_line) <0 ) + goto fault; + +if (copy_from_user (termios->c_cc, termio->c_cc,NCC ) !=0 ) + goto fault; + +return 0 ; + + fault: +return -EFAULT ; }/* * Translate a "termios" structure into a "termio". Ugh. */ static inline int kernel_termios_to_user_termio (struct termio __user *termio, -struct ktermios *termios) +struct ktermios *termios) { -put_user ((termios)->c_iflag, &(termio)->c_iflag); -put_user ((termios)->c_oflag, &(termio)->c_oflag); -put_user ((termios)->c_cflag, &(termio)->c_cflag); -put_user ((termios)->c_lflag, &(termio)->c_lflag); -put_user ((termios)->c_line, &(termio)->c_line); -return copy_to_user ((termio)->c_cc, (termios)->c_cc,NCC ); +if (put_user (termios->c_iflag, &termio->c_iflag) <0 || +put_user (termios->c_oflag, &termio->c_oflag) <0 || +put_user (termios->c_cflag, &termio->c_cflag) <0 || +put_user (termios->c_lflag, &termio->c_lflag) <0 || +put_user (termios->c_line, &termio->c_line) <0 || +copy_to_user (termio->c_cc, termios->c_cc,NCC ) !=0 ) +return -EFAULT ; + +return 0 ; } +#ifdef TCGETS2 static inline int user_termios_to_kernel_termios (struct ktermios *k,struct termios2 __user *u) {
@@ -108,7 +135,20 @@ static inline int kernel_termios_to_user_termios_1(struct termios __user *u, {return copy_to_user (u, k,sizeof (struct termios )); } +#else /* TCGETS2 */ +static inline int user_termios_to_kernel_termios (struct ktermios *k, +struct termios __user *u) +{ +return copy_from_user (k, u,sizeof (struct termios )); +} + +static inline int kernel_termios_to_user_termios (struct termios __user *u, +struct ktermios *k) +{ +return copy_to_user (u, k,sizeof (struct termios )); +} +#endif /* TCGETS2 */ #endif /* __KERNEL__ */ -#endif /* _ASM_X86_TERMIOS_H */ +#endif /* _ASM_GENERIC_TERMIOS_H */
[tip:x86/asm-generic] x86: remove all now-duplicate header files
In reply to Arnd BergmannCommit-ID: 73a2d096fdf23aa841f7595d114a11ec85a85e4d Gitweb: http://git.kernel.org/tip/73a2d096fdf23aa841f7595d114a11ec85a85e4d Author: Arnd Bergmann <[email protected]> AuthorDate: Thu, 18 Jun 2009 21:48:20 +0200 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 18 Jun 2009 14:40:03 -0700
x86: remove all now-duplicate header files
All files that have been made identical to the asm-generic version in the previous patches can now be removed, guaranteeing that this does not introduce semantic changes.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/generic-mman.h | 18 --- arch/x86/include/asm/generic-module.h | 22 --- arch/x86/include/asm/generic-scatterlist.h | 43 ------ arch/x86/include/asm/generic-types.h | 42 ------ arch/x86/include/asm/generic-ucontext.h | 12 -- arch/x86/include/asm/ioctls.h | 111 +--------------- arch/x86/include/asm/ipcbuf.h | 34 +----- arch/x86/include/asm/mman.h | 2 +- arch/x86/include/asm/module.h | 2 +- arch/x86/include/asm/msgbuf.h | 48 +------- arch/x86/include/asm/param.h | 25 +---- arch/x86/include/asm/scatterlist.h | 2 +- arch/x86/include/asm/shmbuf.h | 60 +-------- arch/x86/include/asm/socket.h | 61 +--------- arch/x86/include/asm/sockios.h | 14 +-- arch/x86/include/asm/termbits.h | 199 +--------------------------- arch/x86/include/asm/termios.h | 155 +--------------------- arch/x86/include/asm/types.h | 2 +- arch/x86/include/asm/ucontext.h | 2 +- 19 files changed, 14 insertions(+), 840 deletions(-)
arch/x86/include/asm/generic-mman.h deleted +0 -18
@@ -1,18 +0,0 @@ -#ifndef __ASM_GENERIC_MMAN_H -#define __ASM_GENERIC_MMAN_H - -#include <asm-generic/mman-common.h> - -#define MAP_GROWSDOWN 0x0100/* stack-like segment */ -#define MAP_DENYWRITE 0x0800/* ETXTBSY */ -#define MAP_EXECUTABLE 0x1000/* mark it as an executable */ -#define MAP_LOCKED 0x2000/* pages are locked */ -#define MAP_NORESERVE 0x4000/* don't check for reservations */ -#define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x10000/* do not block on IO */ -#define MAP_STACK 0x20000/* give out an address that is best suited for process/thread stacks */ - -#define MCL_CURRENT 1/* lock all current mappings */ -#define MCL_FUTURE 2/* lock all future mappings */ - -#endif /* __ASM_GENERIC_MMAN_H */
arch/x86/include/asm/generic-module.h deleted +0 -22
@@ -1,22 +0,0 @@ -#ifndef __ASM_GENERIC_MODULE_H -#define __ASM_GENERIC_MODULE_H - -/* -* Many architectures just need a simple module -* loader without arch specific data. -*/ -struct mod_arch_specific -{ -}; - -#ifdef CONFIG_64BIT -#define Elf_Shdr Elf64_Shdr -#define Elf_Sym Elf64_Sym -#define Elf_Ehdr Elf64_Ehdr -#else -#define Elf_Shdr Elf32_Shdr -#define Elf_Sym Elf32_Sym -#define Elf_Ehdr Elf32_Ehdr -#endif - -#endif /* __ASM_GENERIC_MODULE_H */
arch/x86/include/asm/generic-scatterlist.h deleted +0 -43
43 lines not on this page · raw message
arch/x86/include/asm/generic-types.h deleted +0 -42
42 lines not on this page · raw message
arch/x86/include/asm/generic-ucontext.h deleted +0 -12
@@ -1,12 +0,0 @@ -#ifndef __ASM_GENERIC_UCONTEXT_H -#define __ASM_GENERIC_UCONTEXT_H - -struct ucontext { -unsigned long uc_flags; -struct ucontext *uc_link; -stack_t uc_stack; -struct sigcontext uc_mcontext; -sigset_t uc_sigmask;/* mask last for extensibility */ -}; - -#endif /* __ASM_GENERIC_UCONTEXT_H */
arch/x86/include/asm/ioctls.h +1 -110
111 lines not on this page · raw message
arch/x86/include/asm/ipcbuf.h +1 -33
@@ -1,33 +1 @@ -#ifndef __ASM_GENERIC_IPCBUF_H -#define __ASM_GENERIC_IPCBUF_H - -/* -* The generic ipc64_perm structure: -* Note extra padding because this structure is passed back and forth -* between kernel and user space. -* -* ipc64_perm was originally meant to be architecture specific, but -* everyone just ended up making identical copies without specific -* optimizations, so we may just as well all use the same one. -* -* Pad space is left for: -* - 32-bit mode_t on architectures that only had 16 bit -* - 32-bit seq -* - 2 miscellaneous 32-bit values -*/ - -struct ipc64_perm { -__kernel_key_t key; -__kernel_uid32_t uid; -__kernel_gid32_t gid; -__kernel_uid32_t cuid; -__kernel_gid32_t cgid; -__kernel_mode_t mode; -unsigned short __pad1; -unsigned short seq; -unsigned short __pad2; -unsigned long __unused1; -unsigned long __unused2; -}; - -#endif /* __ASM_GENERIC_IPCBUF_H */ +#include <asm-generic/ipcbuf.h>
arch/x86/include/asm/mman.h +1 -1
@@ -3,6 +3,6 @@#define MAP_32BIT 0x40/* only give out 32bit addresses */ -#include <asm/generic-mman.h> +#include <asm-generic/mman.h> #endif /* _ASM_X86_MMAN_H */
arch/x86/include/asm/module.h +1 -1
@@ -1,7 +1,7 @@#ifndef _ASM_X86_MODULE_H#define _ASM_X86_MODULE_H -#include <asm/generic-module.h> +#include <asm-generic/module.h> #ifdef CONFIG_X86_64 /* X86_64 does not define MODULE_PROC_FAMILY */
arch/x86/include/asm/msgbuf.h +1 -47
48 lines not on this page · raw message
arch/x86/include/asm/param.h +1 -24
@@ -1,24 +1 @@ -#ifndef __ASM_GENERIC_PARAM_H -#define __ASM_GENERIC_PARAM_H - -#ifdef __KERNEL__ -# define HZ CONFIG_HZ/* Internal kernel timer frequency */ -# define USER_HZ 100/* some user interfaces are */ -# define CLOCKS_PER_SEC (USER_HZ)/* in "ticks" like times() */ -#endif - -#ifndef HZ -#define HZ 100 -#endif - -#ifndef EXEC_PAGESIZE -#define EXEC_PAGESIZE 4096 -#endif - -#ifndef NOGROUP -#define NOGROUP (-1) -#endif - -#define MAXHOSTNAMELEN 64/* max length of hostname */ - -#endif /* __ASM_GENERIC_PARAM_H */ +#include <asm-generic/param.h>
arch/x86/include/asm/scatterlist.h +1 -1
@@ -3,6 +3,6 @@#define ISA_DMA_THRESHOLD (0x00ffffff) -#include <asm/generic-scatterlist.h> +#include <asm-generic/scatterlist.h> #endif /* _ASM_X86_SCATTERLIST_H */
arch/x86/include/asm/shmbuf.h +1 -59
60 lines not on this page · raw message
arch/x86/include/asm/socket.h +1 -60
61 lines not on this page · raw message
arch/x86/include/asm/sockios.h +1 -13
@@ -1,13 +1 @@ -#ifndef __ASM_GENERIC_SOCKIOS_H -#define __ASM_GENERIC_SOCKIOS_H - -/* Socket-level I/O control calls. */ -#define FIOSETOWN 0x8901 -#define SIOCSPGRP 0x8902 -#define FIOGETOWN 0x8903 -#define SIOCGPGRP 0x8904 -#define SIOCATMARK 0x8905 -#define SIOCGSTAMP 0x8906/* Get stamp (timeval) */ -#define SIOCGSTAMPNS 0x8907/* Get stamp (timespec) */ - -#endif /* __ASM_GENERIC_SOCKIOS_H */ +#include <asm-generic/sockios.h>
arch/x86/include/asm/termbits.h +1 -198
199 lines not on this page · raw message
arch/x86/include/asm/termios.h +1 -154
155 lines not on this page · raw message
arch/x86/include/asm/types.h +1 -1
@@ -3,7 +3,7 @@#define dma_addr_t dma_addr_t -#include <asm/generic-types.h> +#include <asm-generic/types.h> #ifdef __KERNEL__#ifndef __ASSEMBLY__
arch/x86/include/asm/ucontext.h +1 -1
@@ -7,6 +7,6 @@* sigcontext struct (uc_mcontext). */ -#include <asm/generic-ucontext.h> +#include <asm-generic/ucontext.h> #endif /* _ASM_X86_UCONTEXT_H */
Hello Arnd,
Quoted 9 lines · Arnd Bergmann
I did not get any feedback on this the last time I sent it, but now these patches actually apply to the mainline kernel so it's possible to apply them.
I've split the series up into five patches for easier review. Each step should show clearly that no semantic changes are introduced, with the exception of
termios.h, which was discussed earlier.
Nice work.
IMHO, if you provide above steps for each file for all architecture then it shows clearly how generic that file is and no one should have any objection as long as nothing breaks and because of generic percentage (percentage above 70 % will be better one). And collect acks from maintainers and send pull request to Linus.
If you also provide complete diff, then it looks much better.
And if you need my help just ping me :-)
Thanks,
--
JSR