diff options
Diffstat (limited to 'include')
139 files changed, 2310 insertions, 5675 deletions
diff --git a/include/asm-alpha/byteorder.h b/include/asm-alpha/byteorder.h index a753084ce..b8afddcd5 100644 --- a/include/asm-alpha/byteorder.h +++ b/include/asm-alpha/byteorder.h @@ -1,36 +1,13 @@ #ifndef _ALPHA_BYTEORDER_H #define _ALPHA_BYTEORDER_H -#undef ntohl -#undef ntohs -#undef htonl -#undef htons - -#ifndef __LITTLE_ENDIAN -#define __LITTLE_ENDIAN 1234 -#endif - -#ifndef __LITTLE_ENDIAN_BITFIELD -#define __LITTLE_ENDIAN_BITFIELD -#endif - -extern unsigned int ntohl(unsigned int); -extern unsigned short int ntohs(unsigned short int); -extern unsigned int htonl(unsigned int); -extern unsigned short int htons(unsigned short int); - -extern unsigned int __ntohl(unsigned int); -extern unsigned short int __ntohs(unsigned short int); +#include <asm/types.h> #ifdef __GNUC__ -extern unsigned int __constant_ntohl(unsigned int); -extern unsigned short int __constant_ntohs(unsigned short int); - -extern __inline__ unsigned int -__ntohl(unsigned int x) +static __inline__ __const__ __u32 ___arch__swab32(__u32 x) { - unsigned int t1, t2, t3; + __u64 t1, t2, t3; /* Break the final or's out of the block so that gcc can schedule them at will. Further, use add not or so that @@ -51,17 +28,10 @@ __ntohl(unsigned int x) return t3 + t2 + t1; } -#define __constant_ntohl(x) \ - ((unsigned int)((((x) & 0x000000ff) << 24) | \ - (((x) & 0x0000ff00) << 8) | \ - (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0xff000000) >> 24))) - -extern __inline__ unsigned short int -__ntohs(unsigned short int x) +static __inline__ __const__ __u16 ___arch__swab16(__u16 x) { - unsigned short int t1, t2; - + __u64 t1, t2; + __asm__( "insbl %2,1,%1 # %1 = bb00\n\t" "extbl %2,1,%0 # %0 = 00aa" @@ -70,99 +40,13 @@ __ntohs(unsigned short int x) return t1 | t2; } -#define __constant_ntohs(x) \ -((unsigned short int)((((x) & 0x00ff) << 8) | \ - (((x) & 0xff00) >> 8))) - -#define __htonl(x) __ntohl(x) -#define __htons(x) __ntohs(x) -#define __constant_htonl(x) __constant_ntohl(x) -#define __constant_htons(x) __constant_ntohs(x) - -#ifdef __OPTIMIZE__ -# define ntohl(x) \ -(__builtin_constant_p((long)(x)) ? \ - __constant_ntohl((x)) : \ - __ntohl((x))) -# define ntohs(x) \ -(__builtin_constant_p((short)(x)) ? \ - __constant_ntohs((x)) : \ - __ntohs((x))) -# define htonl(x) \ -(__builtin_constant_p((long)(x)) ? \ - __constant_htonl((x)) : \ - __htonl((x))) -# define htons(x) \ -(__builtin_constant_p((short)(x)) ? \ - __constant_htons((x)) : \ - __htons((x))) -#endif /* __OPTIMIZE__ */ +#define __arch__swab32(x) ___arch__swab32(x) +#define __arch__swab16(x) ___arch__swab16(x) #endif /* __GNUC__ */ -#ifdef __KERNEL__ - -/* - * In-kernel byte order macros to handle stuff like - * byte-order-dependent filesystems etc. - */ -#define cpu_to_le32(x) (x) -#define cpu_to_le16(x) (x) - -#define cpu_to_be32(x) htonl((x)) -#define cpu_to_be16(x) htons((x)) - -/* The same, but returns converted value from the location pointer by addr. */ -extern __inline__ __u16 cpu_to_le16p(__u16 *addr) -{ - return cpu_to_le16(*addr); -} - -extern __inline__ __u32 cpu_to_le32p(__u32 *addr) -{ - return cpu_to_le32(*addr); -} - -extern __inline__ __u16 cpu_to_be16p(__u16 *addr) -{ - return cpu_to_be16(*addr); -} - -extern __inline__ __u32 cpu_to_be32p(__u32 *addr) -{ - return cpu_to_be32(*addr); -} - -/* The same, but do the conversion in situ, ie. put the value back to addr. */ -#define cpu_to_le16s(x) do { } while (0) -#define cpu_to_le32s(x) do { } while (0) - -extern __inline__ void cpu_to_be16s(__u16 *addr) -{ - *addr = cpu_to_be16(*addr); -} - -extern __inline__ void cpu_to_be32s(__u32 *addr) -{ - *addr = cpu_to_be32(*addr); -} - -/* Convert from specified byte order, to CPU byte order. */ -#define le16_to_cpu(x) cpu_to_le16(x) -#define le32_to_cpu(x) cpu_to_le32(x) -#define be16_to_cpu(x) cpu_to_be16(x) -#define be32_to_cpu(x) cpu_to_be32(x) - -#define le16_to_cpup(x) cpu_to_le16p(x) -#define le32_to_cpup(x) cpu_to_le32p(x) -#define be16_to_cpup(x) cpu_to_be16p(x) -#define be32_to_cpup(x) cpu_to_be32p(x) - -#define le16_to_cpus(x) cpu_to_le16s(x) -#define le32_to_cpus(x) cpu_to_le32s(x) -#define be16_to_cpus(x) cpu_to_be16s(x) -#define be32_to_cpus(x) cpu_to_be32s(x) +#define __BYTEORDER_HAS_U64__ -#endif /* __KERNEL__ */ +#include <linux/byteorder/little_endian.h> #endif /* _ALPHA_BYTEORDER_H */ diff --git a/include/asm-alpha/ioctls.h b/include/asm-alpha/ioctls.h index 0337b92b3..203bde501 100644 --- a/include/asm-alpha/ioctls.h +++ b/include/asm-alpha/ioctls.h @@ -85,6 +85,7 @@ #define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x5429 /* Return the session ID of FD */ #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 diff --git a/include/asm-alpha/posix_types.h b/include/asm-alpha/posix_types.h index 92855e8bc..b98290660 100644 --- a/include/asm-alpha/posix_types.h +++ b/include/asm-alpha/posix_types.h @@ -20,6 +20,7 @@ typedef unsigned long __kernel_size_t; typedef long __kernel_ssize_t; typedef long __kernel_ptrdiff_t; typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; typedef int __kernel_daddr_t; typedef char * __kernel_caddr_t; diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h index 17674b56d..47f1bf4f6 100644 --- a/include/asm-alpha/processor.h +++ b/include/asm-alpha/processor.h @@ -25,6 +25,10 @@ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ +typedef struct { + unsigned long seg; +} mm_segment_t; + struct thread_struct { /* the fields below are used by PALcode and must match struct pcb: */ unsigned long ksp; @@ -44,9 +48,10 @@ struct thread_struct { /* bit 1..5: IEEE_TRAP_ENABLE bits (see fpu.h) */ /* bit 6..8: UAC bits (see sysinfo.h) */ /* bit 17..21: IEEE_STATUS_MASK bits (see fpu.h) */ + /* bit 63: die_if_kernel recursion lock */ unsigned long flags; /* perform syscall argument validation (get/set_fs) */ - unsigned long fs; + mm_segment_t fs; }; #define INIT_MMAP { &init_mm, 0xfffffc0000000000, 0xfffffc0010000000, \ @@ -57,7 +62,7 @@ struct thread_struct { 0, 0, 0, \ 0, 0, 0, \ 0, \ - 0 \ + KERNEL_DS \ } #include <asm/ptrace.h> diff --git a/include/asm-alpha/sigcontext.h b/include/asm-alpha/sigcontext.h index 916955f4b..323cdb026 100644 --- a/include/asm-alpha/sigcontext.h +++ b/include/asm-alpha/sigcontext.h @@ -3,7 +3,7 @@ struct sigcontext { /* - * what should we have here? I'd probably better use the same + * What should we have here? I'd probably better use the same * stack layout as OSF/1, just in case we ever want to try * running their binaries.. * @@ -28,7 +28,7 @@ struct sigcontext { unsigned long sc_fp_trap_pc; unsigned long sc_fp_trigger_sum; unsigned long sc_fp_trigger_inst; - unsigned long sc_retcode[2]; }; + #endif diff --git a/include/asm-alpha/signal.h b/include/asm-alpha/signal.h index ecccdd3e8..06c3bb7e3 100644 --- a/include/asm-alpha/signal.h +++ b/include/asm-alpha/signal.h @@ -1,10 +1,33 @@ #ifndef _ASMAXP_SIGNAL_H #define _ASMAXP_SIGNAL_H -typedef unsigned long sigset_t; /* at least 32 bits */ +#include <linux/types.h> + +/* Avoid too many header ordering problems. */ +struct siginfo; + +#ifdef __KERNEL__ +/* Digital Unix defines 64 signals. Most things should be clean enough + to redefine this at will, if care is taken to make libc match. */ + +#define _NSIG 64 +#define _NSIG_BPW 64 +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) + +typedef unsigned long old_sigset_t; /* at least 32 bits */ + +typedef struct { + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +#define NSIG 32 +typedef unsigned long sigset_t; + +#endif /* __KERNEL__ */ -#define _NSIG 32 -#define NSIG _NSIG /* * Linux/AXP has different signal numbers that Linux/i386: I'm trying @@ -46,23 +69,36 @@ typedef unsigned long sigset_t; /* at least 32 bits */ #define SIGPWR SIGINFO #define SIGIOT SIGABRT +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX (_NSIG-1) + /* - * sa_flags values: SA_STACK is not currently supported, but will allow the - * usage of signal stacks by using the (now obsolete) sa_restorer field in - * the sigaction structure as a stack pointer. This is now possible due to - * the changes in signal handling. LBT 010493. + * SA_FLAGS values: + * + * SA_ONSTACK is not currently supported, but will allow sigaltstack(2). * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_SHIRQ flag is for shared interrupt support on PCI and EISA. + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_RESETHAND clears the handler when the signal is delivered. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_NODEFER prevents the current signal from being masked in the handler. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. */ -#define SA_NOCLDSTOP 0x00000004 -#define SA_STACK 0x00000001 +#define SA_ONSTACK 0x00000001 #define SA_RESTART 0x00000002 -#define SA_INTERRUPT 0x20000000 -#define SA_NOMASK 0x00000008 -#define SA_ONESHOT 0x00000010 -#define SA_SHIRQ 0x00000020 +#define SA_NOCLDSTOP 0x00000004 +#define SA_NODEFER 0x00000008 +#define SA_RESETHAND 0x00000010 +#define SA_NOCLDWAIT 0x00000020 /* not supported yet */ +#define SA_SIGINFO 0x00000040 + +#define SA_ONESHOT SA_RESETHAND +#define SA_NOMASK SA_NODEFER +#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ #ifdef __KERNEL__ /* @@ -70,12 +106,13 @@ typedef unsigned long sigset_t; /* at least 32 bits */ * irq handling routines. * * SA_INTERRUPT is also used by the irq handling routines. + * SA_SHIRQ is for shared interrupt support on PCI and EISA. */ -#define SA_PROBE SA_ONESHOT -#define SA_SAMPLE_RANDOM SA_RESTART +#define SA_PROBE SA_ONESHOT +#define SA_SAMPLE_RANDOM SA_RESTART +#define SA_SHIRQ 0x40000000 #endif - #define SIG_BLOCK 1 /* for blocking signals */ #define SIG_UNBLOCK 2 /* for unblocking signals */ #define SIG_SETMASK 3 /* for setting the signal mask */ @@ -87,11 +124,38 @@ typedef void (*__sighandler_t)(int); #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ +#ifdef __KERNEL__ +struct osf_sigaction { + __sighandler_t sa_handler; + old_sigset_t sa_mask; + int sa_flags; +}; + +struct sigaction { + __sighandler_t sa_handler; + unsigned long sa_flags; + sigset_t sa_mask; /* mask last for extensibility */ +}; + +struct k_sigaction { + struct sigaction sa; + void (*ka_restorer)(void); +}; +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + struct sigaction { __sighandler_t sa_handler; sigset_t sa_mask; - unsigned int sa_flags; + int sa_flags; }; +#endif /* __KERNEL__ */ + +typedef struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; #ifdef __KERNEL__ #include <asm/sigcontext.h> diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h index 3b9c1dc18..bbaf9b6c4 100644 --- a/include/asm-alpha/socket.h +++ b/include/asm-alpha/socket.h @@ -37,12 +37,17 @@ #define SO_PASSCRED 17 #define SO_PEERCRED 18 +#define SO_BINDTODEVICE 25 + +#define SO_BINDTODEVICE 25 /* Security levels - as per NRL IPv6 - don't actually do anything */ #define SO_SECURITY_AUTHENTICATION 19 #define SO_SECURITY_ENCRYPTION_TRANSPORT 20 #define SO_SECURITY_ENCRYPTION_NETWORK 21 +#define SO_BINDTODEVICE 22 + /* Socket types. */ #define SOCK_STREAM 1 /* stream (connection) socket */ #define SOCK_DGRAM 2 /* datagram (conn.less) socket */ diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h index cde066b66..1a1fb246f 100644 --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h @@ -52,6 +52,8 @@ extern void wrusp(unsigned long); extern unsigned long rdusp(void); extern unsigned long rdmces (void); extern void wrmces (unsigned long); +extern unsigned long whami(void); +extern void wripir(unsigned long); #define halt() __asm__ __volatile__ ("call_pal %0" : : "i" (PAL_halt) : "memory") @@ -119,11 +121,13 @@ do { \ #define __cli() setipl(7) #define __sti() setipl(0) #define __save_flags(flags) do { (flags) = getipl(); } while (0) +#define __save_and_cli(flags) do { (flags) = swpipl(7); } while (0) #define __restore_flags(flags) setipl(flags) #define cli() setipl(7) #define sti() setipl(0) #define save_flags(flags) do { (flags) = getipl(); } while (0) +#define save_and_cli(flags) do { (flags) = swpipl(7); } while (0) #define restore_flags(flags) setipl(flags) /* diff --git a/include/asm-alpha/uaccess.h b/include/asm-alpha/uaccess.h index a76b1fc38..5ab23c062 100644 --- a/include/asm-alpha/uaccess.h +++ b/include/asm-alpha/uaccess.h @@ -17,23 +17,18 @@ * For historical reasons, these macros are grossly misnamed. */ -#define KERNEL_DS (0UL) -#define USER_DS (-0x40000000000UL) +#define KERNEL_DS ((mm_segment_t) { 0UL }) +#define USER_DS ((mm_segment_t) { -0x40000000000UL }) #define VERIFY_READ 0 #define VERIFY_WRITE 1 #define get_fs() (current->tss.fs) #define get_ds() (KERNEL_DS) +#define set_fs(x) (current->tss.fs = (x)) -/* Our scheme relies on all bits being preserved. Trap those evil - Intellists in their plot to use unsigned short. */ +#define segment_eq(a,b) ((a).seg == (b).seg) -extern unsigned long __bad_fs_size(void); - -#define set_fs(x) (current->tss.fs = \ - sizeof(x) == sizeof(unsigned long) ? (x) \ - : __bad_fs_size()) /* * Is a address valid? This does a straighforward calculation rather @@ -45,12 +40,11 @@ extern unsigned long __bad_fs_size(void); * - AND "addr+size" doesn't have any high-bits set * - OR we are in kernel mode. */ -#define __access_ok(addr,size,mask) \ - (((mask) & (addr | size | (addr+size))) == 0) -#define __access_mask get_fs() +#define __access_ok(addr,size,segment) \ + (((segment).seg & (addr | size | (addr+size))) == 0) #define access_ok(type,addr,size) \ - __access_ok(((unsigned long)(addr)),(size),__access_mask) + __access_ok(((unsigned long)(addr)),(size),get_fs()) extern inline int verify_area(int type, const void * addr, unsigned long size) { @@ -70,9 +64,9 @@ extern inline int verify_area(int type, const void * addr, unsigned long size) * (b) require any knowledge of processes at this stage */ #define put_user(x,ptr) \ - __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)),__access_mask) + __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)),get_fs()) #define get_user(x,ptr) \ - __get_user_check((x),(ptr),sizeof(*(ptr)),__access_mask) + __get_user_check((x),(ptr),sizeof(*(ptr)),get_fs()) /* * The "__xxx" versions do not do address space checking, useful when @@ -125,11 +119,11 @@ extern void __get_user_unknown(void); __gu_err; \ }) -#define __get_user_check(x,ptr,size,mask) \ +#define __get_user_check(x,ptr,size,segment) \ ({ \ long __gu_err = -EFAULT, __gu_val = 0; \ const __typeof__(*(ptr)) *__gu_addr = (ptr); \ - if (__access_ok((long)__gu_addr,size,mask)) { \ + if (__access_ok((long)__gu_addr,size,segment)) { \ __gu_err = 0; \ switch (size) { \ case 1: __get_user_8(__gu_addr); break; \ @@ -238,11 +232,11 @@ extern void __put_user_unknown(void); __pu_err; \ }) -#define __put_user_check(x,ptr,size,mask) \ +#define __put_user_check(x,ptr,size,segment) \ ({ \ long __pu_err = -EFAULT; \ __typeof__(*(ptr)) *__pu_addr = (ptr); \ - if (__access_ok((long)__pu_addr,size,mask)) { \ + if (__access_ok((long)__pu_addr,size,segment)) { \ __pu_err = 0; \ switch (size) { \ case 1: __put_user_8(x,__pu_addr); break; \ @@ -391,7 +385,7 @@ extern void __copy_user(void); register void * __cu_to __asm__("$6") = (to); \ register const void * __cu_from __asm__("$7") = (from); \ register long __cu_len __asm__("$0") = (n); \ - if (__access_ok(((long)(v)),__cu_len,__access_mask)) { \ + if (__access_ok(((long)(v)),__cu_len,get_fs())) { \ __asm__ __volatile__( \ "jsr $28,(%3),__copy_user" \ : "=r" (__cu_len), "=r" (__cu_from), "=r" (__cu_to) \ @@ -412,23 +406,34 @@ if (copy_from_user(to,from,n)) \ return retval; \ }) -extern void __clear_user(void); +extern void __do_clear_user(void); + +#define __clear_user(to,n) \ +({ \ + register void * __cl_to __asm__("$6") = (to); \ + register long __cl_len __asm__("$0") = (n); \ + __asm__ __volatile__( \ + "jsr $28,(%2),__do_clear_user" \ + : "=r"(__cl_len), "=r"(__cl_to) \ + : "r"(__do_clear_user), "0"(__cl_len), "1"(__cl_to) \ + : "$1","$2","$3","$4","$5","$28","memory"); \ + __cl_len; \ +}) #define clear_user(to,n) \ ({ \ register void * __cl_to __asm__("$6") = (to); \ register long __cl_len __asm__("$0") = (n); \ - if (__access_ok(((long)__cl_to),__cl_len,__access_mask)) { \ + if (__access_ok(((long)__cl_to),__cl_len,get_fs())) { \ __asm__ __volatile__( \ - "jsr $28,(%2),__clear_user" \ + "jsr $28,(%2),__do_clear_user" \ : "=r"(__cl_len), "=r"(__cl_to) \ - : "r"(__clear_user), "0"(__cl_len), "1"(__cl_to)\ + : "r"(__do_clear_user), "0"(__cl_len), "1"(__cl_to)\ : "$1","$2","$3","$4","$5","$28","memory"); \ } \ __cl_len; \ }) - /* Returns: -EFAULT if exception before terminator, N if the entire buffer filled, else strlen. */ @@ -439,7 +444,7 @@ extern long __strncpy_from_user(char *__to, const char *__from, long __to_len); char * __sfu_to = (to); \ const char * __sfu_from = (from); \ long __sfu_ret = -EFAULT; \ - if (__access_ok(((long)__sfu_from),0,__access_mask)) \ + if (__access_ok(((long)__sfu_from),0,get_fs())) \ __sfu_ret = __strncpy_from_user(__sfu_to,__sfu_from,(n)); \ __sfu_ret; \ }) diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h index b33e93d4e..44855135e 100644 --- a/include/asm-alpha/unistd.h +++ b/include/asm-alpha/unistd.h @@ -156,7 +156,7 @@ #define __NR_osf_pid_block 153 /* not implemented */ #define __NR_osf_pid_unblock 154 /* not implemented */ -#define __NR_sigaction 156 +#define __NR_osf_sigaction 156 #define __NR_osf_sigwaitprim 157 /* not implemented */ #define __NR_osf_nfssvc 158 /* not implemented */ #define __NR_osf_getdirentries 159 @@ -288,6 +288,14 @@ #define __NR_prctl 348 #define __NR_pread 349 #define __NR_pwrite 350 +#define __NR_rt_sigreturn 351 +#define __NR_rt_sigaction 352 +#define __NR_rt_sigprocmask 353 +#define __NR_rt_sigpending 354 +#define __NR_rt_sigtimedwait 355 +#define __NR_rt_sigqueueinfo 356 +#define __NR_rt_sigsuspend 357 + #if defined(__LIBRARY__) && defined(__GNUC__) diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h index 5690c46e2..fd1d75beb 100644 --- a/include/asm-i386/atomic.h +++ b/include/asm-i386/atomic.h @@ -17,7 +17,7 @@ * on us. We need to use _exactly_ the address the user gave us, * not some alias that contains the same information. */ -#define __atomic_fool_gcc(x) (*(struct { int a[100]; } *)x) +#define __atomic_fool_gcc(x) (*(volatile struct { int a[100]; } *)x) #ifdef __SMP__ typedef struct { volatile int counter; } atomic_t; diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index ee24aa79f..3b31d4f57 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h @@ -20,11 +20,26 @@ #endif /* + * Function prototypes to keep gcc -Wall happy + */ +extern void set_bit(int nr, volatile void * addr); +extern void clear_bit(int nr, volatile void * addr); +extern void change_bit(int nr, volatile void * addr); +extern int test_and_set_bit(int nr, volatile void * addr); +extern int test_and_clear_bit(int nr, volatile void * addr); +extern int test_and_change_bit(int nr, volatile void * addr); +extern int __constant_test_bit(int nr, const volatile void * addr); +extern int __test_bit(int nr, volatile void * addr); +extern int find_first_zero_bit(void * addr, unsigned size); +extern int find_next_zero_bit (void * addr, int size, int offset); +extern unsigned long ffz(unsigned long word); + +/* * Some hacks to defeat gcc over-optimizations.. */ struct __dummy { unsigned long a[100]; }; -#define ADDR (*(struct __dummy *) addr) -#define CONST_ADDR (*(const struct __dummy *) addr) +#define ADDR (*(volatile struct __dummy *) addr) +#define CONST_ADDR (*(volatile const struct __dummy *) addr) extern __inline__ void set_bit(int nr, volatile void * addr) { diff --git a/include/asm-i386/byteorder.h b/include/asm-i386/byteorder.h index ef55ae3ca..51d66f8fc 100644 --- a/include/asm-i386/byteorder.h +++ b/include/asm-i386/byteorder.h @@ -1,36 +1,16 @@ #ifndef _I386_BYTEORDER_H #define _I386_BYTEORDER_H -#undef ntohl -#undef ntohs -#undef htonl -#undef htons +#include <asm/types.h> -#ifndef __LITTLE_ENDIAN -#define __LITTLE_ENDIAN 1234 -#endif - -#ifndef __LITTLE_ENDIAN_BITFIELD -#define __LITTLE_ENDIAN_BITFIELD -#endif +#ifdef __GNUC__ /* For avoiding bswap on i386 */ #ifdef __KERNEL__ #include <linux/config.h> #endif -extern unsigned long int ntohl(unsigned long int); -extern unsigned short int ntohs(unsigned short int); -extern unsigned long int htonl(unsigned long int); -extern unsigned short int htons(unsigned short int); - -extern __inline__ unsigned long int __ntohl(unsigned long int); -extern __inline__ unsigned short int __ntohs(unsigned short int); -extern __inline__ unsigned long int __constant_ntohl(unsigned long int); -extern __inline__ unsigned short int __constant_ntohs(unsigned short int); - -extern __inline__ unsigned long int -__ntohl(unsigned long int x) +static __inline__ __const__ __u32 ___arch__swab32(__u32 x) { #if defined(__KERNEL__) && !defined(CONFIG_M386) __asm__("bswap %0" : "=r" (x) : "0" (x)); @@ -40,115 +20,28 @@ __ntohl(unsigned long int x) "xchgb %b0,%h0" /* swap higher bytes */ :"=q" (x) : "0" (x)); -#endif +#endif return x; } -#define __constant_ntohl(x) \ - ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \ - (((unsigned long int)(x) & 0x0000ff00U) << 8) | \ - (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \ - (((unsigned long int)(x) & 0xff000000U) >> 24))) - -extern __inline__ unsigned short int -__ntohs(unsigned short int x) +static __inline__ __const__ __u16 ___arch__swab16(__u16 x) { - __asm__("xchgb %b0,%h0" /* swap bytes */ - : "=q" (x) - : "0" (x)); - return x; + __asm__("xchgb %b0,%h0" /* swap bytes */ \ + : "=q" (x) \ + : "0" (x)); \ + return x; } -#define __constant_ntohs(x) \ - ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \ - (((unsigned short int)(x) & 0xff00) >> 8))) \ - -#define __htonl(x) __ntohl(x) -#define __htons(x) __ntohs(x) -#define __constant_htonl(x) __constant_ntohl(x) -#define __constant_htons(x) __constant_ntohs(x) +#define __arch__swab32(x) ___arch__swab32(x) +#define __arch__swab16(x) ___arch__swab16(x) -#ifdef __OPTIMIZE__ -# define ntohl(x) \ -(__builtin_constant_p((long)(x)) ? \ - __constant_ntohl((x)) : \ - __ntohl((x))) -# define ntohs(x) \ -(__builtin_constant_p((short)(x)) ? \ - __constant_ntohs((x)) : \ - __ntohs((x))) -# define htonl(x) \ -(__builtin_constant_p((long)(x)) ? \ - __constant_htonl((x)) : \ - __htonl((x))) -# define htons(x) \ -(__builtin_constant_p((short)(x)) ? \ - __constant_htons((x)) : \ - __htons((x))) +#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) +# define __BYTEORDER_HAS_U64__ +# define __SWAB_64_THRU_32__ #endif -#ifdef __KERNEL__ -/* - * In-kernel byte order macros to handle stuff like - * byte-order-dependent filesystems etc. - */ -#define cpu_to_le32(x) (x) -#define cpu_to_le16(x) (x) - -#define cpu_to_be32(x) htonl((x)) -#define cpu_to_be16(x) htons((x)) - -/* The same, but returns converted value from the location pointer by addr. */ -extern __inline__ __u16 cpu_to_le16p(__u16 *addr) -{ - return cpu_to_le16(*addr); -} - -extern __inline__ __u32 cpu_to_le32p(__u32 *addr) -{ - return cpu_to_le32(*addr); -} - -extern __inline__ __u16 cpu_to_be16p(__u16 *addr) -{ - return cpu_to_be16(*addr); -} +#endif /* __GNUC__ */ -extern __inline__ __u32 cpu_to_be32p(__u32 *addr) -{ - return cpu_to_be32(*addr); -} - -/* The same, but do the conversion in situ, ie. put the value back to addr. */ -#define cpu_to_le16s(x) do { } while (0) -#define cpu_to_le32s(x) do { } while (0) - -extern __inline__ void cpu_to_be16s(__u16 *addr) -{ - *addr = cpu_to_be16(*addr); -} +#include <linux/byteorder/little_endian.h> -extern __inline__ void cpu_to_be32s(__u32 *addr) -{ - *addr = cpu_to_be32(*addr); -} - -/* Convert from specified byte order, to CPU byte order. */ -#define le16_to_cpu(x) cpu_to_le16(x) -#define le32_to_cpu(x) cpu_to_le32(x) -#define be16_to_cpu(x) cpu_to_be16(x) -#define be32_to_cpu(x) cpu_to_be32(x) - -#define le16_to_cpup(x) cpu_to_le16p(x) -#define le32_to_cpup(x) cpu_to_le32p(x) -#define be16_to_cpup(x) cpu_to_be16p(x) -#define be32_to_cpup(x) cpu_to_be32p(x) - -#define le16_to_cpus(x) cpu_to_le16s(x) -#define le32_to_cpus(x) cpu_to_le32s(x) -#define be16_to_cpus(x) cpu_to_be16s(x) -#define be32_to_cpus(x) cpu_to_be32s(x) - -#endif /* __KERNEL__ */ - -#endif +#endif /* _I386_BYTEORDER_H */ diff --git a/include/asm-i386/delay.h b/include/asm-i386/delay.h index ebd9f9d93..2166c4c6d 100644 --- a/include/asm-i386/delay.h +++ b/include/asm-i386/delay.h @@ -12,7 +12,7 @@ extern void __const_udelay(unsigned long usecs); extern void __delay(unsigned long loops); #define udelay(n) (__builtin_constant_p(n) ? \ - __const_udelay((n) * 0x10c6) : \ + __const_udelay((n) * 0x10c6ul) : \ __udelay(n)) #endif /* defined(_I386_DELAY_H) */ diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h index 0d611cef4..155ff1419 100644 --- a/include/asm-i386/io.h +++ b/include/asm-i386/io.h @@ -36,9 +36,9 @@ #endif #ifdef REALLY_SLOW_IO -#define SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO +#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO #else -#define SLOW_DOWN_IO __SLOW_DOWN_IO +#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO #endif /* @@ -52,7 +52,7 @@ __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" #define __OUT(s,s1,x) \ __OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "Nd" (port)); } \ -__OUT1(s##_p,x) __OUT2(s,s1,"w") SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \ +__OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \ #define __IN1(s) \ extern inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; @@ -62,7 +62,7 @@ __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" #define __IN(s,s1,i...) \ __IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ -__IN1(s##_p) __IN2(s,s1,"w") SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ +__IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ #define __INS(s) \ extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ diff --git a/include/asm-i386/ioctls.h b/include/asm-i386/ioctls.h index ae04e1a55..7930defbe 100644 --- a/include/asm-i386/ioctls.h +++ b/include/asm-i386/ioctls.h @@ -46,6 +46,7 @@ #define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x5429 /* Return the session ID of FD */ #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ #define FIOCLEX 0x5451 diff --git a/include/asm-i386/irq.h b/include/asm-i386/irq.h index d764ef164..b96288a5c 100644 --- a/include/asm-i386/irq.h +++ b/include/asm-i386/irq.h @@ -9,9 +9,6 @@ * IRQ/IPI changes taken from work by Thomas Radke <tomsoft@informatik.tu-chemnitz.de> */ -#include <linux/linkage.h> -#include <asm/segment.h> - #define NR_IRQS 16 #define TIMER_IRQ 0 diff --git a/include/asm-i386/posix_types.h b/include/asm-i386/posix_types.h index 4da54d2be..aed0fd6fd 100644 --- a/include/asm-i386/posix_types.h +++ b/include/asm-i386/posix_types.h @@ -20,6 +20,7 @@ typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; typedef int __kernel_daddr_t; typedef char * __kernel_caddr_t; diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index b4f26c73c..449caf768 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -9,6 +9,7 @@ #include <asm/vm86.h> #include <asm/math_emu.h> +#include <asm/segment.h> /* * System setup and hardware bug flags.. @@ -87,6 +88,10 @@ union i387_union { struct i387_soft_struct soft; }; +typedef struct { + unsigned long seg; +} mm_segment_t; + struct thread_struct { unsigned short back_link,__blh; unsigned long esp0; @@ -113,7 +118,8 @@ struct thread_struct { unsigned short trace, bitmap; unsigned long io_bitmap[IO_BITMAP_SIZE+1]; unsigned long tr; - unsigned long cr2, trap_no, error_code, segment; + unsigned long cr2, trap_no, error_code; + mm_segment_t segment; /* floating point info */ union i387_union i387; /* virtual 86 mode info */ @@ -128,11 +134,12 @@ struct thread_struct { #define INIT_TSS { \ 0,0, \ sizeof(init_stack) + (long) &init_stack, \ - KERNEL_DS, 0, \ + __KERNEL_DS, 0, \ 0,0,0,0,0,0, \ (long) &swapper_pg_dir - PAGE_OFFSET, \ 0,0,0,0,0,0,0,0,0,0, \ - USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0, \ + __USER_DS,0,__USER_DS,0,__USER_DS,0, \ + __USER_DS,0,__USER_DS,0,__USER_DS,0, \ _LDT(0),0, \ 0, 0x8000, \ {~0, }, /* ioperm */ \ @@ -142,13 +149,13 @@ struct thread_struct { } #define start_thread(regs, new_eip, new_esp) do {\ - unsigned long seg = USER_DS; \ + unsigned long seg = __USER_DS; \ __asm__("mov %w0,%%fs ; mov %w0,%%gs":"=r" (seg) :"0" (seg)); \ - set_fs(seg); \ + set_fs(MAKE_MM_SEG(seg)); \ regs->xds = seg; \ regs->xes = seg; \ regs->xss = seg; \ - regs->xcs = USER_CS; \ + regs->xcs = __USER_CS; \ regs->eip = new_eip; \ regs->esp = new_esp; \ } while (0) diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h index d5f1ef6de..f09db9f73 100644 --- a/include/asm-i386/segment.h +++ b/include/asm-i386/segment.h @@ -1,10 +1,10 @@ #ifndef _ASM_SEGMENT_H #define _ASM_SEGMENT_H -#define KERNEL_CS 0x10 -#define KERNEL_DS 0x18 +#define __KERNEL_CS 0x10 +#define __KERNEL_DS 0x18 -#define USER_CS 0x23 -#define USER_DS 0x2B +#define __USER_CS 0x23 +#define __USER_DS 0x2B #endif diff --git a/include/asm-i386/sigcontext.h b/include/asm-i386/sigcontext.h index 3d8f51ea4..616fb1415 100644 --- a/include/asm-i386/sigcontext.h +++ b/include/asm-i386/sigcontext.h @@ -51,4 +51,5 @@ struct sigcontext { unsigned long cr2; }; + #endif diff --git a/include/asm-i386/signal.h b/include/asm-i386/signal.h index c68928cd7..5da9ff0ed 100644 --- a/include/asm-i386/signal.h +++ b/include/asm-i386/signal.h @@ -1,10 +1,32 @@ #ifndef _ASMi386_SIGNAL_H #define _ASMi386_SIGNAL_H -typedef unsigned long sigset_t; /* at least 32 bits */ +#include <linux/types.h> -#define _NSIG 32 -#define NSIG _NSIG +/* Avoid too many header ordering problems. */ +struct siginfo; + +#ifdef __KERNEL__ +/* Most things should be clean enough to redefine this at will, if care + is taken to make libc match. */ + +#define _NSIG 64 +#define _NSIG_BPW 32 +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) + +typedef unsigned long old_sigset_t; /* at least 32 bits */ + +typedef struct { + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +#define NSIG 32 +typedef unsigned long sigset_t; + +#endif /* __KERNEL__ */ #define SIGHUP 1 #define SIGINT 2 @@ -43,35 +65,52 @@ typedef unsigned long sigset_t; /* at least 32 bits */ #define SIGPWR 30 #define SIGUNUSED 31 +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX (_NSIG-1) + /* - * sa_flags values: SA_STACK is not currently supported, but will allow the - * usage of signal stacks by using the (now obsolete) sa_restorer field in - * the sigaction structure as a stack pointer. This is now possible due to - * the changes in signal handling. LBT 010493. + * SA_FLAGS values: + * + * SA_ONSTACK is not currently supported, but will allow sigaltstack(2). * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_SHIRQ flag is for shared interrupt support on PCI and EISA. + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_RESETHAND clears the handler when the signal is delivered. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_NODEFER prevents the current signal from being masked in the handler. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. */ -#define SA_NOCLDSTOP 1 -#define SA_SHIRQ 0x04000000 -#define SA_STACK 0x08000000 +#define SA_NOCLDSTOP 0x00000001 +#define SA_NOCLDWAIT 0x00000002 /* not supported yet */ +#define SA_SIGINFO 0x00000004 +#define SA_ONSTACK 0x08000000 #define SA_RESTART 0x10000000 -#define SA_INTERRUPT 0x20000000 -#define SA_NOMASK 0x40000000 -#define SA_ONESHOT 0x80000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND +#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ + +#define SA_RESTORER 0x04000000 #ifdef __KERNEL__ + /* * These values of sa_flags are used only by the kernel as part of the * irq handling routines. * * SA_INTERRUPT is also used by the irq handling routines. + * SA_SHIRQ is for shared interrupt support on PCI and EISA. */ -#define SA_PROBE SA_ONESHOT -#define SA_SAMPLE_RANDOM SA_RESTART +#define SA_PROBE SA_ONESHOT +#define SA_SAMPLE_RANDOM SA_RESTART +#define SA_SHIRQ 0x04000000 #endif - #define SIG_BLOCK 0 /* for blocking signals */ #define SIG_UNBLOCK 1 /* for unblocking signals */ #define SIG_SETMASK 2 /* for setting the signal mask */ @@ -83,15 +122,83 @@ typedef void (*__sighandler_t)(int); #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ +#ifdef __KERNEL__ +struct old_sigaction { + __sighandler_t sa_handler; + old_sigset_t sa_mask; + unsigned long sa_flags; + void (*sa_restorer)(void); +}; + +struct sigaction { + __sighandler_t sa_handler; + unsigned long sa_flags; + void (*sa_restorer)(void); + sigset_t sa_mask; /* mask last for extensibility */ +}; + +struct k_sigaction { + struct sigaction sa; +}; +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + struct sigaction { __sighandler_t sa_handler; sigset_t sa_mask; unsigned long sa_flags; void (*sa_restorer)(void); }; +#endif /* __KERNEL__ */ + +typedef struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; #ifdef __KERNEL__ #include <asm/sigcontext.h> -#endif + +#define __HAVE_ARCH_SIG_BITOPS + +extern __inline__ void sigaddset(sigset_t *set, int _sig) +{ + __asm__("btsl %1,%0" : "=m"(*set) : "ir"(_sig - 1) : "cc"); +} + +extern __inline__ void sigdelset(sigset_t *set, int _sig) +{ + __asm__("btrl %1,%0" : "=m"(*set) : "ir"(_sig - 1) : "cc"); +} + +extern __inline__ int __const_sigismember(sigset_t *set, int _sig) +{ + unsigned long sig = _sig - 1; + return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW)); +} + +extern __inline__ int __gen_sigismember(sigset_t *set, int _sig) +{ + int ret; + __asm__("btl %2,%1\n\tsbbl %0,%0" + : "=r"(ret) : "m"(*set), "ir"(_sig-1) : "cc"); + return ret; +} + +#define sigismember(set,sig) \ + (__builtin_constant_p(sig) ? \ + __const_sigismember((set),(sig)) : \ + __gen_sigismember((set),(sig))) + +#define sigmask(sig) (1UL << ((sig) - 1)) + +extern __inline__ int sigfindinword(unsigned long word) +{ + __asm__("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc"); + return word; +} + +#endif /* __KERNEL__ */ #endif diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 9dcc21b44..145118a71 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -21,8 +21,8 @@ #define FIRST_LDT_ENTRY (FIRST_TSS_ENTRY+1) #define _TSS(n) ((((unsigned long) n)<<4)+(FIRST_TSS_ENTRY<<3)) #define _LDT(n) ((((unsigned long) n)<<4)+(FIRST_LDT_ENTRY<<3)) -#define load_TR(n) __asm__("ltr %%ax": /* no output */ :"a" (_TSS(n))) -#define load_ldt(n) __asm__("lldt %%ax": /* no output */ :"a" (_LDT(n))) +#define load_TR(n) __asm__ __volatile__("ltr %%ax": /* no output */ :"a" (_TSS(n))) +#define load_ldt(n) __asm__ __volatile__("lldt %%ax": /* no output */ :"a" (_LDT(n))) #define store_TR(n) \ __asm__("str %%ax\n\t" \ "subl %2,%%eax\n\t" \ @@ -33,11 +33,9 @@ __asm__("str %%ax\n\t" \ /* This special macro can be used to load a debugging register */ #define loaddebug(tsk,register) \ - __asm__("movl %0,%%edx\n\t" \ - "movl %%edx,%%db" #register "\n\t" \ + __asm__("movl %0,%%db" #register \ : /* no output */ \ - :"m" (tsk->debugreg[register]) \ - :"dx"); + :"r" (tsk->debugreg[register])) /* @@ -251,7 +249,7 @@ __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \ :"=m" (*((long *) (gate_addr))), \ "=m" (*(1+(long *) (gate_addr))) \ :"i" ((short) (0x8000+(dpl<<13)+(type<<8))), \ - "d" ((char *) (addr)),"a" (KERNEL_CS << 16) \ + "d" ((char *) (addr)),"a" (__KERNEL_CS << 16) \ :"ax","dx") #define set_intr_gate(n,addr) \ diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h index 84bb65f76..0ac6380fd 100644 --- a/include/asm-i386/uaccess.h +++ b/include/asm-i386/uaccess.h @@ -5,7 +5,6 @@ * User space memory access functions */ #include <linux/sched.h> -#include <asm/segment.h> #define VERIFY_READ 0 #define VERIFY_WRITE 1 @@ -18,24 +17,21 @@ * For historical reasons, these macros are grossly misnamed. */ -extern unsigned long __bad_fs_size(void); +#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) +#define KERNEL_DS MAKE_MM_SEG(0) +#define USER_DS MAKE_MM_SEG(3) -#define get_fs() (current->tss.segment) #define get_ds() (KERNEL_DS) +#define get_fs() (current->tss.segment) +#define set_fs(x) (current->tss.segment = (x)) -/* Some architectures -- Alpha for one -- use "segment" schemes that - require all bits to be preserved, thus the i386 traditional `ushort' - doesn't work. To head off problems early, force the Intel folks - to do it Right as well. */ +#define segment_eq(a,b) ((a).seg == (b).seg) -#define set_fs(x) (current->tss.segment = \ - sizeof(x) == sizeof(unsigned long) ? (x) \ - : __bad_fs_size()) /* * Address Ok: * - * low two bits of segment + * segment * 00 (kernel) 11 (user) * * high 00 1 1 @@ -44,12 +40,12 @@ extern unsigned long __bad_fs_size(void); * address 11 1 0 */ #define __addr_ok(x) \ - ((((unsigned long)(x)>>30)&get_fs()) != 3) + ((((unsigned long)(x)>>30)&get_fs().seg) != 3) #define __user_ok(addr,size) \ ((size <= 0xC0000000UL) && (addr <= 0xC0000000UL - size)) #define __kernel_ok \ - (!(get_fs() & 3)) + (!get_fs().seg) extern int __verify_write(const void *, unsigned long); diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 2daadab53..1a45b75c3 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -178,6 +178,15 @@ #define __NR_setresgid 170 #define __NR_getresgid 171 #define __NR_prctl 172 +#define __NR_rt_sigreturn 173 +#define __NR_rt_sigaction 174 +#define __NR_rt_sigprocmask 175 +#define __NR_rt_sigpending 176 +#define __NR_rt_sigtimedwait 177 +#define __NR_rt_sigqueueinfo 178 +#define __NR_rt_sigsuspend 179 +#define __NR_pread 180 +#define __NR_pwrite 181 /* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */ diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h index 00e23b352..c43c1ed2e 100644 --- a/include/asm-m68k/bitops.h +++ b/include/asm-m68k/bitops.h @@ -257,19 +257,7 @@ ext2_find_next_zero_bit (const void *vaddr, unsigned size, unsigned offset) return (p - addr) * 32 + res; } -/* Byte swapping. */ -extern __inline__ unsigned short -swab16 (unsigned short val) -{ - return (val << 8) | (val >> 8); -} - -extern __inline__ unsigned int -swab32 (unsigned int val) -{ - __asm__ ("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val)); - return val; -} +/* Byte swapping (swab16 and swab32) is now in asm/byteorder.h . */ #endif /* _M68K_BITOPS_H */ diff --git a/include/asm-m68k/byteorder.h b/include/asm-m68k/byteorder.h index a5f0ce8bb..31271886b 100644 --- a/include/asm-m68k/byteorder.h +++ b/include/asm-m68k/byteorder.h @@ -1,137 +1,24 @@ #ifndef _M68K_BYTEORDER_H #define _M68K_BYTEORDER_H -#ifndef __BIG_ENDIAN -#define __BIG_ENDIAN 4321 -#endif - -#ifndef __BIG_ENDIAN_BITFIELD -#define __BIG_ENDIAN_BITFIELD -#endif - -#ifdef __KERNEL__ #include <asm/types.h> -/* - * In-kernel byte order macros to handle stuff like - * byte-order-dependent filesystems etc. - */ - -extern __inline__ __u16 __swab16 (__u16 val) -{ - return (val << 8) | (val >> 8); -} - -extern __inline__ __u32 __constant_swab32 (__u32 val) -{ - return (val << 24) | ((val << 8) & 0xff0000) | - ((val >> 8) & 0xff00) | (val >> 24); -} +#ifdef __GNUC__ -extern __inline__ __u32 __swab32 (__u32 val) +static __inline__ __const__ __u32 ___arch__swab32(__u32 val) { - __asm__ ("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val)); + __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val)); return val; } - -/* Convert from CPU byte order, to specified byte order. */ -#define cpu_to_le16(__val) __swab16(__val) -#define cpu_to_le32(__val) \ -(__builtin_constant_p(__val) ? __constant_swab32(__val) : __swab32(__val)) -#define cpu_to_be16(x) (x) -#define cpu_to_be32(x) (x) - -/* The same, but returns converted value from the location pointer by addr. */ -extern __inline__ __u16 cpu_to_le16p(__u16 *addr) -{ - return cpu_to_le16(*addr); -} - -extern __inline__ __u32 cpu_to_le32p(__u32 *addr) -{ - return cpu_to_le32(*addr); -} - -extern __inline__ __u16 cpu_to_be16p(__u16 *addr) -{ - return cpu_to_be16(*addr); -} - -extern __inline__ __u32 cpu_to_be32p(__u32 *addr) -{ - return cpu_to_be32(*addr); -} - -/* The same, but do the conversion in situ, ie. put the value back to addr. */ -extern __inline__ void cpu_to_le16s(__u16 *addr) -{ - *addr = cpu_to_le16(*addr); -} - -extern __inline__ void cpu_to_le32s(__u32 *addr) -{ - *addr = cpu_to_le32(*addr); -} - -#define cpu_to_be16s(x) do { } while (0) -#define cpu_to_be32s(x) do { } while (0) - -/* Convert from specified byte order, to CPU byte order. */ -#define le16_to_cpu(x) cpu_to_le16(x) -#define le32_to_cpu(x) cpu_to_le32(x) -#define be16_to_cpu(x) cpu_to_be16(x) -#define be32_to_cpu(x) cpu_to_be32(x) - -#define le16_to_cpup(x) cpu_to_le16p(x) -#define le32_to_cpup(x) cpu_to_le32p(x) -#define be16_to_cpup(x) cpu_to_be16p(x) -#define be32_to_cpup(x) cpu_to_be32p(x) - -#define le16_to_cpus(x) cpu_to_le16s(x) -#define le32_to_cpus(x) cpu_to_le32s(x) -#define be16_to_cpus(x) cpu_to_be16s(x) -#define be32_to_cpus(x) cpu_to_be32s(x) +#define __arch__swab32(x) ___arch__swab32(x) #endif -#undef ntohl -#undef ntohs -#undef htonl -#undef htons - -extern unsigned long int ntohl(unsigned long int); -extern unsigned short int ntohs(unsigned short int); -extern unsigned long int htonl(unsigned long int); -extern unsigned short int htons(unsigned short int); - -extern __inline__ unsigned long int __ntohl(unsigned long int); -extern __inline__ unsigned short int __ntohs(unsigned short int); - -extern __inline__ unsigned long int -__ntohl(unsigned long int x) -{ - return x; -} - -extern __inline__ unsigned short int -__ntohs(unsigned short int x) -{ - return x; -} - -#define __htonl(x) __ntohl(x) -#define __htons(x) __ntohs(x) - -#define __constant_htonl(x) (x) -#define __constant_htons(x) (x) -#define __constant_ntohl(x) (x) -#define __constant_ntohs(x) (x) - -#ifdef __OPTIMIZE__ -#define ntohl(x) __ntohl(x) -#define ntohs(x) __ntohs(x) -#define htonl(x) __htonl(x) -#define htons(x) __htons(x) +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) +# define __BYTEORDER_HAS_U64__ +# define __SWAB_64_THRU_32__ #endif -#endif +#include <linux/byteorder/big_endian.h> + +#endif /* _M68K_BYTEORDER_H */ diff --git a/include/asm-m68k/ioctls.h b/include/asm-m68k/ioctls.h index b4a95af61..fa91491f6 100644 --- a/include/asm-m68k/ioctls.h +++ b/include/asm-m68k/ioctls.h @@ -46,6 +46,7 @@ #define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x5429 /* Return the session ID of FD */ #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ #define FIOCLEX 0x5451 diff --git a/include/asm-m68k/posix_types.h b/include/asm-m68k/posix_types.h index 535095971..33c423980 100644 --- a/include/asm-m68k/posix_types.h +++ b/include/asm-m68k/posix_types.h @@ -20,6 +20,7 @@ typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; typedef int __kernel_daddr_t; typedef char * __kernel_caddr_t; diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h index 410bce393..0f0ac9976 100644 --- a/include/asm-m68k/unistd.h +++ b/include/asm-m68k/unistd.h @@ -175,6 +175,8 @@ #define __NR_poll 168 #define __NR_nfsservctl 169 #define __NR_prctl 170 +#define __NR_pread 171 +#define __NR_pwrite 172 /* user-visible error numbers are in the range -1 - -122: see <asm-m68k/errno.h> */ diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h index d9f5fe48c..0069b966b 100644 --- a/include/asm-mips/atomic.h +++ b/include/asm-mips/atomic.h @@ -11,7 +11,7 @@ * * Copyright (C) 1996 by Ralf Baechle * - * $Id: atomic.h,v 1.2 1997/06/20 03:05:12 ralf Exp $ + * $Id: atomic.h,v 1.3 1997/12/01 18:00:35 ralf Exp $ */ #ifndef __ASM_MIPS_ATOMIC_H #define __ASM_MIPS_ATOMIC_H @@ -99,7 +99,7 @@ extern __inline__ int atomic_sub_return(int i, atomic_t * v) * on us. We need to use _exactly_ the address the user gave us, * not some alias that contains the same information. */ -#define __atomic_fool_gcc(x) (*(struct { int a[100]; } *)x) +#define __atomic_fool_gcc(x) (*(volatile struct { int a[100]; } *)x) extern __inline__ void atomic_add(int i, volatile atomic_t * v) { diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index a059bb178..89668887e 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h @@ -5,11 +5,14 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (c) 1994, 1995, 1996 Ralf Baechle + * Copyright (c) 1994 - 1997 Ralf Baechle (ralf@gnu.org) */ #ifndef __ASM_MIPS_BITOPS_H #define __ASM_MIPS_BITOPS_H +#include <linux/types.h> +#include <linux/byteorder/swab.h> /* sigh ... */ + #ifdef __KERNEL__ #include <asm/sgidefs.h> @@ -467,11 +470,6 @@ extern __inline__ int ext2_test_bit(int nr, const void * addr) #define ext2_find_first_zero_bit(addr, size) \ ext2_find_next_zero_bit((addr), (size), 0) -static __inline__ unsigned long __swab32(unsigned long val) -{ - return ((val>>24)|((val>>8)&0xff00)|((val<<8)&0xff0000)|(val<<24)); -} - extern __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset) { unsigned long *p = ((unsigned long *) addr) + (offset >> 5); diff --git a/include/asm-mips/byteorder.h b/include/asm-mips/byteorder.h index 9cec1a26a..28f6376db 100644 --- a/include/asm-mips/byteorder.h +++ b/include/asm-mips/byteorder.h @@ -1,175 +1,14 @@ -/* - * Functions depending of the byteorder. - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995, 1996, 1997 by Ralf Baechle - * - * $Id: byteorder.h,v 1.4 1997/07/15 01:56:32 ralf Exp $ - */ -#ifndef __ASM_MIPS_BYTEORDER_H -#define __ASM_MIPS_BYTEORDER_H +#ifndef _MIPS_BYTEORDER_H +#define _MIPS_BYTEORDER_H -#define __swap32(x) \ - ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \ - (((unsigned long int)(x) & 0x0000ff00U) << 8) | \ - (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \ - (((unsigned long int)(x) & 0xff000000U) >> 24))) -#define __swap16(x) \ - ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \ - (((unsigned short int)(x) & 0xff00) >> 8))) +#include <asm/types.h> #if defined (__MIPSEB__) - -#ifndef __BIG_ENDIAN -#define __BIG_ENDIAN 4321 -#endif - -#ifndef __BIG_ENDIAN_BITFIELD -#define __BIG_ENDIAN_BITFIELD -#endif - -#define __constant_ntohl(x) (x) -#define __constant_ntohs(x) (x) -#define __constant_htonl(x) (x) -#define __constant_htons(x) (x) - -#elif defined (__MIPSEL__) - -#ifndef __LITTLE_ENDIAN -#define __LITTLE_ENDIAN 1234 -#endif - -#ifndef __LITTLE_ENDIAN_BITFIELD -#define __LITTLE_ENDIAN_BITFIELD -#endif - -#define __constant_ntohl(x) __swap32(x) -#define __constant_ntohs(x) __swap16(x) -#define __constant_htonl(x) __swap32(x) -#define __constant_htons(x) __swap16(x) - -#endif /* defined(__MIPSEL_) */ - -#ifdef __KERNEL__ - -#if defined (__MIPSEB__) - -/* - * In-kernel byte order macros to handle stuff like - * byte-order-dependent filesystems etc. - */ -#define cpu_to_le32(x) __swap32((x)) -#define le32_to_cpu(x) __swap32((x)) -#define cpu_to_le16(x) __swap16((x)) -#define le16_to_cpu(x) __swap16((x)) - -#define cpu_to_be32(x) (x) -#define be32_to_cpu(x) (x) -#define cpu_to_be16(x) (x) -#define be16_to_cpu(x) (x) - +# include <linux/byteorder/big_endian.h> #elif defined (__MIPSEL__) - -/* - * In-kernel byte order macros to handle stuff like - * byte-order-dependent filesystems etc. - */ -#define cpu_to_le32(x) (x) -#define le32_to_cpu(x) (x) -#define cpu_to_le16(x) (x) -#define le16_to_cpu(x) (x) - -#define cpu_to_be32(x) __swap32((x)) -#define be32_to_cpu(x) __swap32((x)) -#define cpu_to_be16(x) __swap16((x)) -#define be16_to_cpu(x) __swap16((x)) - +# include <linux/byteorder/little_endian.h> #else -#error "MIPS but neither __MIPSEL__ nor __MIPSEB__?" +# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???" #endif -/* The same, but returns converted value from the location pointer by addr. */ -extern __inline__ __u16 cpu_to_le16p(__u16 *addr) -{ - return cpu_to_le16(*addr); -} - -extern __inline__ __u32 cpu_to_le32p(__u32 *addr) -{ - return cpu_to_le32(*addr); -} - -extern __inline__ __u16 cpu_to_be16p(__u16 *addr) -{ - return cpu_to_be16(*addr); -} - -extern __inline__ __u32 cpu_to_be32p(__u32 *addr) -{ - return cpu_to_be32(*addr); -} - -#define le16_to_cpup(x) cpu_to_le16p(x) -#define le32_to_cpup(x) cpu_to_le32p(x) -#define be16_to_cpup(x) cpu_to_be16p(x) -#define be32_to_cpup(x) cpu_to_be32p(x) - - -/* The same, but do the conversion in situ, ie. put the value back to addr. */ -extern __inline__ void cpu_to_le16s(__u16 *addr) -{ - *addr = cpu_to_le16(*addr); -} - -extern __inline__ void cpu_to_le32s(__u32 *addr) -{ - *addr = cpu_to_le32(*addr); -} - -extern __inline__ void cpu_to_be16s(__u16 *addr) -{ - *addr = cpu_to_be16(*addr); -} - -extern __inline__ void cpu_to_be32s(__u32 *addr) -{ - *addr = cpu_to_be32(*addr); -} - -#define le16_to_cpus(x) cpu_to_le16s(x) -#define le32_to_cpus(x) cpu_to_le32s(x) -#define be16_to_cpus(x) cpu_to_be16s(x) -#define be32_to_cpus(x) cpu_to_be32s(x) - -#endif /* __KERNEL__ */ - -extern unsigned long int ntohl(unsigned long int __x); -extern unsigned short int ntohs(unsigned short int __x); -extern unsigned short int htons(unsigned short int __x); -extern unsigned long int htonl(unsigned long int __x); - - -extern __inline__ unsigned long int ntohl(unsigned long int __x) -{ - return __constant_ntohl(__x); -} - -extern __inline__ unsigned short int ntohs(unsigned short int __x) -{ - return __constant_ntohs(__x); -} - -extern __inline__ unsigned long int htonl(unsigned long int __x) -{ - return __constant_htonl(__x); -} - -extern __inline__ unsigned short int htons(unsigned short int __x) -{ - return __constant_htons(__x); -} - -#endif /* __ASM_MIPS_BYTEORDER_H */ +#endif /* _MIPS_BYTEORDER_H */ diff --git a/include/asm-mips/decstation.h b/include/asm-mips/decstation.h index ac04ff097..e69de29bb 100644 --- a/include/asm-mips/decstation.h +++ b/include/asm-mips/decstation.h @@ -1,254 +0,0 @@ -/* - * Hardware info about DEC Personal DECStation systems (otherwise known - * as maxine or pmax (internal DEC codenames). - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Paul M. Antoine, some code and definitions are - * by curteousy of Chris Fraser. - * - * This file is under construction - you were warned! - */ - -#ifndef __ASM_MIPS_PMAX_H -#define __ASM_MIPS_PMAX_H - -/* - * The addresses below are virtual address. The mappings are - * created on startup via wired entries in the tlb. - */ - -#define PMAX_LOCAL_IO_SPACE 0xe0000000 - -/* - * Motherboard regs (kseg1 addresses) - */ -#define PMAX_SSR_ADDR 0xbc040100 /* system support reg */ - -/* - * SSR defines - */ -#define PMAX_SSR_LEDMASK 0x00000001 /* power LED */ - -/* - * REX functions -- these are for the new TURBOchannel style ROMs - */ -#define REX_PROM_MAGIC 0x30464354 /* passed in a2 */ - -#define REX_GETBITMAP 0x84 /* get mem bitmap */ -#define REX_GETCHAR 0x24 /* getch() */ -#define REX_PUTCHAR 0x13 /* putch() */ -#define REX_HALT 0x9c /* halt the system */ -#define REX_PRINTF 0x30 /* printf() */ -#define REX_PUTS 0x2c /* puts() */ -#define REX_SLOTADDR 0x6c /* slotaddr */ - -#ifndef __LANGUAGE_ASSEMBLY__ - -extern __inline__ void pmax_set_led(unsigned int bits) -{ - volatile unsigned int *led_register = (unsigned int *) PMAX_SSR_ADDR; - - *led_register = bits & PMAX_SSR_LEDMASK; -} - -/* - * Glue code to call the PMAX boot proms. - */ -extern asmlinkage void pmax_printf(const char *); - -#endif - -/* - * These are just hacked out of the JAZZ ones, no ideas really. - */ -#define PMAX_KEYBOARD_ADDRESS 0xe0005000 -#define PMAX_KEYBOARD_DATA 0xe0005000 -#define PMAX_KEYBOARD_COMMAND 0xe0005001 - -#ifndef __LANGUAGE_ASSEMBLY__ - -typedef struct { - unsigned char data; - unsigned char command; -} pmax_keyboard_hardware; - -typedef struct { - unsigned char pad0[3]; - unsigned char data; - unsigned char pad1[3]; - unsigned char command; -} mips_keyboard_hardware; - -/* - * For now. - */ -#define keyboard_hardware pmax_keyboard_hardware - -#endif - -/* - * Serial ports on DEC - maybe! - */ - -#define PMAX_SERIAL1_BASE (unsigned int)0xe0006000 -#define PMAX_SERIAL2_BASE (unsigned int)0xe0007000 - -/* - * Dummy Device Address. Used in pmaxdma.c - */ - -#define PMAX_DUMMY_DEVICE 0xe000d000 - -/* - * PMAX timer registers and interrupt no. - * Note that the hardware timer interrupt is actually on - * cpu level 6, but to keep compatibility with PC stuff - * it is remapped to vector 0. See arch/mips/kernel/entry.S. - */ -#define PMAX_TIMER_INTERVAL 0xe0000228 -#define PMAX_TIMER_REGISTER 0xe0000230 - -/* - * DRAM configuration register - */ -#ifndef __LANGUAGE_ASSEMBLY__ -#ifdef __MIPSEL__ -typedef struct { - unsigned int bank2 : 3; - unsigned int bank1 : 3; - unsigned int mem_bus_width : 1; - unsigned int reserved2 : 1; - unsigned int page_mode : 1; - unsigned int reserved1 : 23; -} dram_configuration; -#else /* defined (__MIPSEB__) */ -typedef struct { - unsigned int reserved1 : 23; - unsigned int page_mode : 1; - unsigned int reserved2 : 1; - unsigned int mem_bus_width : 1; - unsigned int bank1 : 3; - unsigned int bank2 : 3; -} dram_configuration; -#endif -#endif /* __LANGUAGE_ASSEMBLY__ */ - -#define PMAX_DRAM_CONFIG 0xe00fffe0 - -/* - * PMAX interrupt control registers - */ -#define PMAX_IO_IRQ_SOURCE 0xe0100000 -#define PMAX_IO_IRQ_ENABLE 0xe0100002 - -/* - * PMAX interrupt enable bits - */ -#define PMAX_IE_PARALLEL (1 << 0) -#define PMAX_IE_FLOPPY (1 << 1) -#define PMAX_IE_SOUND (1 << 2) -#define PMAX_IE_VIDEO (1 << 3) -#define PMAX_IE_ETHERNET (1 << 4) -#define PMAX_IE_SCSI (1 << 5) -#define PMAX_IE_KEYBOARD (1 << 6) -#define PMAX_IE_MOUSE (1 << 7) -#define PMAX_IE_SERIAL1 (1 << 8) -#define PMAX_IE_SERIAL2 (1 << 9) - -/* - * PMAX Interrupt Level definitions - */ - -#define PMAX_TIMER_IRQ 0 -#define PMAX_KEYBOARD_IRQ 1 -#define PMAX_ETHERNET_IRQ 2 /* 15 */ -#define PMAX_SERIAL1_IRQ 3 -#define PMAX_SERIAL2_IRQ 4 -#define PMAX_PARALLEL_IRQ 5 -#define PMAX_FLOPPY_IRQ 6 /* needs to be consistent with floppy driver! */ - -/* - * PMAX DMA Channels - * Note: Channels 4...7 are not used with respect to the Acer PICA-61 - * chipset which does not provide these DMA channels. - */ - -#define PMAX_SCSI_DMA 0 /* SCSI */ -#define PMAX_FLOPPY_DMA 1 /* FLOPPY */ -#define PMAX_AUDIOL_DMA 2 /* AUDIO L */ -#define PMAX_AUDIOR_DMA 3 /* AUDIO R */ - -/* - * PMAX R4030 MCT_ADR chip (DMA controller) - * Note: Virtual Addresses ! - */ - -#define PMAX_R4030_CONFIG 0xE0000000 /* R4030 config register */ -#define PMAX_R4030_REVISION 0xE0000008 /* same as PICA_ASIC_REVISION */ -#define PMAX_R4030_INV_ADDR 0xE0000010 /* Invalid Address register */ - -#define PMAX_R4030_TRSTBL_BASE 0xE0000018 /* Translation Table Base */ -#define PMAX_R4030_TRSTBL_LIM 0xE0000020 /* Translation Table Limit */ -#define PMAX_R4030_TRSTBL_INV 0xE0000028 /* Translation Table Invalidate */ - -#define PMAX_R4030_CACHE_MTNC 0xE0000030 /* Cache Maintenance */ -#define PMAX_R4030_R_FAIL_ADDR 0xE0000038 /* Remote Failed Address */ -#define PMAX_R4030_M_FAIL_ADDR 0xE0000040 /* Memory Failed Adresss */ - -#define PMAX_R4030_CACHE_PTAG 0xE0000048 /* I/O Cache Physical Tag */ -#define PMAX_R4030_CACHE_LTAG 0xE0000050 /* I/O Cache Logical Tag */ -#define PMAX_R4030_CACHE_BMASK 0xE0000058 /* I/O Cache Byte Mask */ -#define PMAX_R4030_CACHE_BWIN 0xE0000060 /* I/O Cache Buffer Window */ - -/* - * Remote Speed Registers. - * - * 0: free, 1: Ethernet, 2: SCSI, 3: Floppy, - * 4: RTC, 5: Kb./Mouse 6: serial 1, 7: serial 2, - * 8: parallel, 9: NVRAM, 10: CPU, 11: PROM, - * 12: reserved, 13: free, 14: 7seg LED, 15: ??? - */ - -#define PMAX_R4030_REM_SPEED 0xE0000070 /* 16 Remote Speed Registers */ - /* 0xE0000070,78,80... 0xE00000E8 */ -#define PMAX_R4030_IRQ_ENABLE 0xE00000E8 /* Internal Interrupt Enable */ - -#define PMAX_R4030_IRQ_SOURCE 0xE0000200 /* Interrupt Source Reg */ -#define PMAX_R4030_I386_ERROR 0xE0000208 /* i386/EISA Bus Error */ - - -/* - * Access the R4030 DMA and I/O Controller - */ - -#ifndef __LANGUAGE_ASSEMBLY__ - -extern inline unsigned short r4030_read_reg16(unsigned addr) { - unsigned short ret = *((volatile unsigned short *)addr); - __asm__ __volatile__("nop; nop; nop; nop;"); - return ret; -} - -extern inline unsigned int r4030_read_reg32(unsigned addr) { - unsigned int ret = *((volatile unsigned int *)addr); - __asm__ __volatile__("nop; nop; nop; nop;"); - return ret; -} - -extern inline void r4030_write_reg16(unsigned addr, unsigned val) { - *((volatile unsigned short *)addr) = val; - __asm__ __volatile__("nop; nop; nop; nop;"); -} - -extern inline unsigned int r4030_write_reg32(unsigned addr, unsigned val) { - *((volatile unsigned int *)addr) = val; - __asm__ __volatile__("nop; nop; nop; nop;"); -} - -#endif /* !LANGUAGE_ASSEMBLY__ */ - - -#endif /* __ASM_MIPS_PMAX_H */ diff --git a/include/asm-mips/deskstation.h b/include/asm-mips/deskstation.h index 52b8cdf43..e69de29bb 100644 --- a/include/asm-mips/deskstation.h +++ b/include/asm-mips/deskstation.h @@ -1,15 +0,0 @@ -/* - * SNI specific definitions - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1997 by Ralf Baechle - */ -#ifndef __ASM_MIPS_DESKSTATION_H -#define __ASM_MIPS_DESKSTATION_H - -#define RPC44_PORT_BASE 0xe2000000 - -#endif /* __ASM_MIPS_DESKSTATION_H */ diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h index b08f69181..5cd755b38 100644 --- a/include/asm-mips/elf.h +++ b/include/asm-mips/elf.h @@ -1,3 +1,6 @@ +/* + * $Id: elf.h,v 1.4 1997/12/15 10:38:30 ralf Exp $ + */ #ifndef __ASM_MIPS_ELF_H #define __ASM_MIPS_ELF_H diff --git a/include/asm-mips/ioctls.h b/include/asm-mips/ioctls.h index 5648eae7f..b871cd449 100644 --- a/include/asm-mips/ioctls.h +++ b/include/asm-mips/ioctls.h @@ -98,6 +98,7 @@ #define TIOCTTYGSTRUCT 0x5487 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x7416 /* Return the session ID of FD */ #define TIOCSERCONFIG 0x5488 #define TIOCSERGWILD 0x5489 diff --git a/include/asm-mips/keyboard.h b/include/asm-mips/keyboard.h index 813cb7c69..e9f237d72 100644 --- a/include/asm-mips/keyboard.h +++ b/include/asm-mips/keyboard.h @@ -5,7 +5,7 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * $Id: keyboard.h,v 1.4 1997/07/24 01:55:56 ralf Exp $ + * $Id: keyboard.h,v 1.5 1997/08/06 19:16:26 miguel Exp $ */ #ifndef __ASM_MIPS_KEYBOARD_H #define __ASM_MIPS_KEYBOARD_H @@ -78,8 +78,7 @@ void (*keyboard_setup)(void); #endif /* CONFIG_SGI */ -#if defined(CONFIG_ACER_PICA_61) || defined(CONFIG_SNI_RM200_PCI) \ - || defined(CONFIG_DESKSTATION_RPC44) || defined(CONFIG_DESKSTATION_TYNE) +#if defined(CONFIG_ACER_PICA_61) || defined(CONFIG_SNI_RM200_PCI) #define CONF_KEYBOARD_USES_IO_PORTS #endif diff --git a/include/asm-mips/offset.h b/include/asm-mips/offset.h index 6f03155f2..cb0be6469 100644 --- a/include/asm-mips/offset.h +++ b/include/asm-mips/offset.h @@ -50,35 +50,34 @@ #define TASK_STATE 0 #define TASK_COUNTER 4 #define TASK_PRIORITY 8 -#define TASK_SIGNAL 12 -#define TASK_BLOCKED 16 -#define TASK_FLAGS 20 -#define TASK_MM 920 +#define TASK_FLAGS 12 +#define TASK_SIGPENDING 16 +#define TASK_MM 928 /* MIPS specific thread_struct offsets. */ -#define THREAD_REG16 552 -#define THREAD_REG17 556 -#define THREAD_REG18 560 -#define THREAD_REG19 564 -#define THREAD_REG20 568 -#define THREAD_REG21 572 -#define THREAD_REG22 576 -#define THREAD_REG23 580 -#define THREAD_REG28 584 -#define THREAD_REG29 588 -#define THREAD_REG30 592 -#define THREAD_REG31 596 -#define THREAD_STATUS 600 -#define THREAD_FPU 608 -#define THREAD_BVADDR 872 -#define THREAD_ECODE 876 -#define THREAD_TRAPNO 880 -#define THREAD_KSP 884 -#define THREAD_PGDIR 888 -#define THREAD_MFLAGS 892 -#define THREAD_CURDS 896 -#define THREAD_TRAMP 900 -#define THREAD_OLDCTX 904 +#define THREAD_REG16 560 +#define THREAD_REG17 564 +#define THREAD_REG18 568 +#define THREAD_REG19 572 +#define THREAD_REG20 576 +#define THREAD_REG21 580 +#define THREAD_REG22 584 +#define THREAD_REG23 588 +#define THREAD_REG28 592 +#define THREAD_REG29 596 +#define THREAD_REG30 600 +#define THREAD_REG31 604 +#define THREAD_STATUS 608 +#define THREAD_FPU 616 +#define THREAD_BVADDR 880 +#define THREAD_ECODE 884 +#define THREAD_TRAPNO 888 +#define THREAD_KSP 892 +#define THREAD_PGDIR 896 +#define THREAD_MFLAGS 900 +#define THREAD_CURDS 904 +#define THREAD_TRAMP 908 +#define THREAD_OLDCTX 912 /* Linux mm_struct offsets. */ #define MM_COUNT 12 diff --git a/include/asm-mips/posix_types.h b/include/asm-mips/posix_types.h index ae9e5d14c..6ae7982d1 100644 --- a/include/asm-mips/posix_types.h +++ b/include/asm-mips/posix_types.h @@ -33,6 +33,7 @@ typedef __SIZE_TYPE__ __kernel_size_t; typedef __SSIZE_TYPE__ __kernel_ssize_t; typedef int __kernel_ptrdiff_t; typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; typedef long __kernel_daddr_t; typedef char * __kernel_caddr_t; diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h index e0d9ad387..c1de4e748 100644 --- a/include/asm-mips/processor.h +++ b/include/asm-mips/processor.h @@ -5,7 +5,7 @@ * written by Ralf Baechle * Modified further for R[236]000 compatibility by Paul M. Antoine * - * $Id: processor.h,v 1.5 1997/12/01 16:48:39 ralf Exp $ + * $Id: processor.h,v 1.3 1997/12/01 18:00:41 ralf Exp $ */ #ifndef __ASM_MIPS_PROCESSOR_H #define __ASM_MIPS_PROCESSOR_H @@ -81,6 +81,10 @@ union mips_fpu_union { {{0,},} \ } +typedef struct { + unsigned long seg; +} mm_segment_t; + /* * If you change thread_struct remember to change the #defines below too! */ @@ -105,7 +109,7 @@ struct thread_struct { #define MF_FIXADE 1 /* Fix address errors in software */ #define MF_LOGADE 2 /* Log address errors to syslog */ unsigned long mflags; - int current_ds; + mm_segment_t current_ds; unsigned long irix_trampoline; /* Wheee... */ unsigned long irix_oldctx; }; diff --git a/include/asm-mips/sigcontext.h b/include/asm-mips/sigcontext.h index 97dafc9ca..913dc1c95 100644 --- a/include/asm-mips/sigcontext.h +++ b/include/asm-mips/sigcontext.h @@ -7,7 +7,7 @@ * * Copyright (C) 1996, 1997 by Ralf Baechle * - * $Id: sigcontext.h,v 1.4 1997/12/01 16:46:19 ralf Exp $ + * $Id: sigcontext.h,v 1.4 1997/12/01 18:00:42 ralf Exp $ */ #ifndef __ASM_MIPS_SIGCONTEXT_H #define __ASM_MIPS_SIGCONTEXT_H @@ -32,8 +32,7 @@ struct sigcontext { unsigned int sc_cause; /* Unused */ unsigned int sc_badvaddr; /* Unused */ - unsigned long sc_sigset; /* kernel's sigset_t */ - unsigned long __pad0[3]; /* pad for constant size */ + unsigned long sc_sigset[4]; /* kernel's sigset_t */ }; #endif /* __ASM_MIPS_SIGCONTEXT_H */ diff --git a/include/asm-mips/signal.h b/include/asm-mips/signal.h index 7bdf024e5..0f5988610 100644 --- a/include/asm-mips/signal.h +++ b/include/asm-mips/signal.h @@ -7,17 +7,22 @@ * * Copyright (C) 1995, 1996, 1997 by Ralf Baechle * - * $Id: signal.h,v 1.2 1997/09/07 05:27:50 ralf Exp $ + * $Id: signal.h,v 1.3 1997/12/14 18:57:19 ralf Exp $ */ #ifndef __ASM_MIPS_SIGNAL_H #define __ASM_MIPS_SIGNAL_H -#include <asm/sgidefs.h> +#include <linux/types.h> -typedef unsigned long sigset_t; +#define _NSIG 128 +#define _NSIG_BPW 32 +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) -#define _NSIG 32 -#define NSIG _NSIG +typedef struct { + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +typedef unsigned long old_sigset_t; /* at least 32 bits */ #define SIGHUP 1 /* Hangup (POSIX). */ #define SIGINT 2 /* Interrupt (ANSI). */ @@ -54,34 +59,48 @@ typedef unsigned long sigset_t; #define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ #define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX (_NSIG-1) + /* - * sa_flags values: SA_STACK is not currently supported, but will allow the - * usage of signal stacks by using the (now obsolete) sa_restorer field in - * the sigaction structure as a stack pointer. This is now possible due to - * the changes in signal handling. LBT 010493. + * SA_FLAGS values: + * + * SA_ONSTACK is not currently supported, but will allow sigaltstack(2). * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_SHIRQ flag is for shared interrupt support on PCI and EISA. + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_RESETHAND clears the handler when the signal is delivered. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_NODEFER prevents the current signal from being masked in the handler. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. */ -#define SA_STACK 0x1 -#define SA_ONSTACK SA_STACK -#define SA_RESTART 0x4 -#define SA_NOCLDSTOP 0x20000 -/* Non ABI signals */ -#define SA_INTERRUPT 0x01000000 -#define SA_NOMASK 0x02000000 -#define SA_ONESHOT 0x04000000 -#define SA_SHIRQ 0x08000000 +#define SA_STACK 0x00000001 +#define SA_RESETHAND 0x00000002 +#define SA_RESTART 0x00000004 +#define SA_SIGINFO 0x00000008 +#define SA_NODEFER 0x00000010 +#define SA_NOCLDWAIT 0x00010000 /* Not supported yet */ +#define SA_NOCLDSTOP 0x00020000 + +#define SA_NOMASK SA_NODEFER /* DANGER: was 0x02000000 */ +#define SA_ONESHOT SA_RESETHAND /* DANGER: was 0x04000000 */ #ifdef __KERNEL__ /* * These values of sa_flags are used only by the kernel as part of the * irq handling routines. * - * SA_INTERRUPT is also used by the irq handling routines. + * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the + * SA_RESTART flag to get restarting signals (which were the default long ago) + * SA_SHIRQ flag is for shared interrupt support on PCI and EISA. */ -#define SA_PROBE SA_ONESHOT -#define SA_SAMPLE_RANDOM SA_RESTART +#define SA_INTERRUPT 0x01000000 /* interrupt handling */ +#define SA_SHIRQ 0x08000000 +#define SA_PROBE SA_ONESHOT +#define SA_SAMPLE_RANDOM SA_RESTART #endif /* __KERNEL__ */ #define SIG_BLOCK 1 /* for blocking signals */ @@ -102,17 +121,13 @@ struct sigaction { unsigned int sa_flags; __sighandler_t sa_handler; sigset_t sa_mask; - unsigned int __pad0[3]; /* reserved, keep size constant */ - - /* Abi says here follows reserved int[2] */ - void (*sa_restorer)(void); -#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) - /* - * For 32 bit code we have to pad struct sigaction to get - * constant size for the ABI - */ - int __pad1[1]; /* reserved */ -#endif + int sa_resv[2]; /* reserved */ +}; + +/* XXX use sa_rev for storing ka_restorer */ +struct k_sigaction { + struct sigaction sa; + void (*ka_restorer)(void); }; #ifdef __KERNEL__ diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h index 97181113a..6fb330fe0 100644 --- a/include/asm-mips/uaccess.h +++ b/include/asm-mips/uaccess.h @@ -7,7 +7,7 @@ * * Copyright (C) 1996, 1997 by Ralf Baechle * - * $Id: uaccess.h,v 1.5 1997/12/01 16:44:08 ralf Exp $ + * $Id: uaccess.h,v 1.4 1997/12/01 18:00:44 ralf Exp $ */ #ifndef __ASM_MIPS_UACCESS_H #define __ASM_MIPS_UACCESS_H @@ -26,21 +26,20 @@ * * For historical reasons, these macros are grossly misnamed. */ -#define KERNEL_DS 0 -#define USER_DS 1 +#define KERNEL_DS ((mm_segment_t) { 0UL }) +#define USER_DS ((mm_segment_t) { 1UL }) #define VERIFY_READ 0 #define VERIFY_WRITE 1 -extern int active_ds; +extern mm_segment_t active_ds; -#define get_fs() active_ds +#define get_fs() (active_ds) +#define get_ds() (KERNEL_DS) #define set_fs(x) (active_ds=(x)) -static inline unsigned long get_ds(void) -{ - return KERNEL_DS; -} +#define segment_eq(a,b) ((a).seg == (b).seg) + /* * Is a address valid? This does a straighforward calculation rather @@ -53,8 +52,8 @@ static inline unsigned long get_ds(void) * - OR we are in kernel mode. */ #define __access_ok(addr,size,mask) \ - (((__signed__ long)((mask)&(addr | size | (addr+size)))) >= 0) -#define __access_mask (-(long)get_fs()) + (((__signed__ long)((mask)&(addr | size | (addr+size)))) >= 0) +#define __access_mask (-(long)(get_fs().seg)) #define access_ok(type,addr,size) \ __access_ok(((unsigned long)(addr)),(size),__access_mask) diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h index f0511957c..22694b75f 100644 --- a/include/asm-mips/unistd.h +++ b/include/asm-mips/unistd.h @@ -1180,11 +1180,20 @@ #define __NR_setresgid (__NR_Linux + 190) #define __NR_getresgid (__NR_Linux + 191) #define __NR_prctl (__NR_Linux + 192) +#define __NR_rt_sigreturn (__NR_Linux + 193) +#define __NR_rt_sigaction (__NR_Linux + 194) +#define __NR_rt_sigprocmask (__NR_Linux + 195) +#define __NR_rt_sigpending (__NR_Linux + 196) +#define __NR_rt_sigtimedwait (__NR_Linux + 197) +#define __NR_rt_sigqueueinfo (__NR_Linux + 198) +#define __NR_rt_sigsuspend (__NR_Linux + 199) +#define __NR_pread (__NR_Linux + 200) +#define __NR_pwrite (__NR_Linux + 201) /* * Offset of the last Linux flavoured syscall */ -#define __NR_Linux_syscalls 192 +#define __NR_Linux_syscalls 201 #ifndef __LANGUAGE_ASSEMBLY__ diff --git a/include/asm-ppc/byteorder.h b/include/asm-ppc/byteorder.h index 8fee6e46f..a16503851 100644 --- a/include/asm-ppc/byteorder.h +++ b/include/asm-ppc/byteorder.h @@ -3,31 +3,8 @@ #include <asm/types.h> -#ifndef __BIG_ENDIAN -#define __BIG_ENDIAN 4321 -#endif - -#ifndef __BIG_ENDIAN_BITFIELD -#define __BIG_ENDIAN_BITFIELD -#endif - -#define ntohl(x) ((unsigned long)(x)) -#define ntohs(x) ((unsigned short)(x)) -#define htonl(x) ((unsigned long)(x)) -#define htons(x) ((unsigned short)(x)) - -#define __htonl(x) ntohl(x) -#define __htons(x) ntohs(x) - -#define __constant_ntohs(x) ntohs(x) -#define __constant_ntohl(x) ntohl(x) -#define __constant_htonl(x) ntohl(x) -#define __constant_htons(x) ntohs(x) - -#ifdef __KERNEL__ -/* - * 16 and 32 bit little-endian loads and stores. - */ +#ifdef __GNUC__ + extern inline unsigned ld_le16(volatile unsigned short *addr) { unsigned val; @@ -55,16 +32,10 @@ extern inline void st_le32(volatile unsigned *addr, unsigned val) } #if 0 -extern __inline__ __u16 cpu_to_le16(__u16 value) -{ - return ld_le16(&value); -} -extern __inline__ __u32 cpu_to_le32(__u32 value) -{ - return ld_le32(&value); -} +# define __arch_swab16(x) ld_le16(&x) +# define __arch_swab32(x) ld_le32(&x) #else -extern __inline__ __u16 cpu_to_le16(__u16 value) +static __inline__ __const__ __u16 ___arch__swab16(__u16 value) { __u16 result; @@ -73,7 +44,8 @@ extern __inline__ __u16 cpu_to_le16(__u16 value) : "r" (value), "0" (value >> 8)); return result; } -extern __inline__ __u32 cpu_to_le32(__u32 value) + +static __inline__ __const__ __u32 ___arch__swab32(__u32 value) { __u32 result; @@ -84,68 +56,20 @@ extern __inline__ __u32 cpu_to_le32(__u32 value) : "r" (value), "0" (value >> 24)); return result; } +#define __arch__swab32(x) ___arch__swab32(x) +#define __arch__swab16(x) ___arch__swab16(x) #endif /* 0 */ -#define cpu_to_be16(x) (x) -#define cpu_to_be32(x) (x) - /* The same, but returns converted value from the location pointer by addr. */ -extern __inline__ __u16 cpu_to_le16p(__u16 *addr) -{ - return ld_le16(addr); -} - -extern __inline__ __u32 cpu_to_le32p(__u32 *addr) -{ - return ld_le32(addr); -} - -extern __inline__ __u16 cpu_to_be16p(__u16 *addr) -{ - return *addr; -} - -extern __inline__ __u32 cpu_to_be32p(__u32 *addr) -{ - return *addr; -} +#define __arch__swab16p(addr) ld_le16(addr) +#define __arch__swab32p(addr) ld_le32(addr) /* The same, but do the conversion in situ, ie. put the value back to addr. */ -extern __inline__ void cpu_to_le16s(__u16 *addr) -{ - st_le16(addr,*addr); -} - -extern __inline__ void cpu_to_le32s(__u32 *addr) -{ - st_le32(addr,*addr); -} - -#define cpu_to_be16s(x) do { } while (0) -#define cpu_to_be32s(x) do { } while (0) - -/* Convert from specified byte order, to CPU byte order. */ -#define le16_to_cpu(x) cpu_to_le16(x) -#define le32_to_cpu(x) cpu_to_le32(x) -#define be16_to_cpu(x) cpu_to_be16(x) -#define be32_to_cpu(x) cpu_to_be32(x) - -#define le16_to_cpup(x) cpu_to_le16p(x) -#define le32_to_cpup(x) cpu_to_le32p(x) -#define be16_to_cpup(x) cpu_to_be16p(x) -#define be32_to_cpup(x) cpu_to_be32p(x) - -#define le16_to_cpus(x) cpu_to_le16s(x) -#define le32_to_cpus(x) cpu_to_le32s(x) -#define be16_to_cpus(x) cpu_to_be16s(x) -#define be32_to_cpus(x) cpu_to_be32s(x) - - -#endif /* __KERNEL__ */ -#endif /* !(_PPC_BYTEORDER_H) */ - - - +#define __arch__swab16s(addr) st_le16(addr,*addr) +#define __arch__swab32s(addr) st_le32(addr,*addr) +#endif /* __GNUC__ */ +#include <linux/byteorder/big_endian.h> +#endif /* _PPC_BYTEORDER_H */ diff --git a/include/asm-ppc/ioctls.h b/include/asm-ppc/ioctls.h index f56e53db7..7bbf41cf0 100644 --- a/include/asm-ppc/ioctls.h +++ b/include/asm-ppc/ioctls.h @@ -85,6 +85,7 @@ #define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x5429 /* Return the session ID of FD */ #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 diff --git a/include/asm-ppc/posix_types.h b/include/asm-ppc/posix_types.h index 72b24318e..e659279ff 100644 --- a/include/asm-ppc/posix_types.h +++ b/include/asm-ppc/posix_types.h @@ -19,6 +19,7 @@ typedef unsigned long __kernel_size_t; typedef long __kernel_ssize_t; typedef long __kernel_ptrdiff_t; typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; typedef int __kernel_daddr_t; typedef char * __kernel_caddr_t; diff --git a/include/asm-sparc/byteorder.h b/include/asm-sparc/byteorder.h index 5becb7c5d..7cbbfd26d 100644 --- a/include/asm-sparc/byteorder.h +++ b/include/asm-sparc/byteorder.h @@ -1,93 +1,13 @@ -/* $Id: byteorder.h,v 1.14 1997/05/28 11:35:38 jj Exp $ */ #ifndef _SPARC_BYTEORDER_H #define _SPARC_BYTEORDER_H -#define ntohl(x) ((unsigned long int)(x)) -#define ntohs(x) ((unsigned short int)(x)) -#define htonl(x) ((unsigned long int)(x)) -#define htons(x) ((unsigned short int)(x)) +#include <asm/types.h> -/* Some programs depend upon these being around. */ -#define __constant_ntohl(x) ((unsigned long int)(x)) -#define __constant_ntohs(x) ((unsigned short int)(x)) -#define __constant_htonl(x) ((unsigned long int)(x)) -#define __constant_htons(x) ((unsigned short int)(x)) - -#ifndef __BIG_ENDIAN -#define __BIG_ENDIAN 4321 -#endif - -#ifndef __BIG_ENDIAN_BITFIELD -#define __BIG_ENDIAN_BITFIELD +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) +# define __BYTEORDER_HAS_U64__ +# define __SWAB_64_THRU_32__ #endif -#ifdef __KERNEL__ - -/* Convert from CPU byte order, to specified byte order. */ -extern __inline__ __u16 cpu_to_le16(__u16 value) -{ - return (value >> 8) | (value << 8); -} - -extern __inline__ __u32 cpu_to_le32(__u32 value) -{ - return((value>>24) | ((value>>8)&0xff00) | - ((value<<8)&0xff0000) | (value<<24)); -} -#define cpu_to_be16(x) (x) -#define cpu_to_be32(x) (x) - -/* The same, but returns converted value from the location pointer by addr. */ -extern __inline__ __u16 cpu_to_le16p(__u16 *addr) -{ - return cpu_to_le16(*addr); -} - -extern __inline__ __u32 cpu_to_le32p(__u32 *addr) -{ - return cpu_to_le32(*addr); -} - -extern __inline__ __u16 cpu_to_be16p(__u16 *addr) -{ - return cpu_to_be16(*addr); -} - -extern __inline__ __u32 cpu_to_be32p(__u32 *addr) -{ - return cpu_to_be32(*addr); -} - -/* The same, but do the conversion in situ, ie. put the value back to addr. */ -extern __inline__ void cpu_to_le16s(__u16 *addr) -{ - *addr = cpu_to_le16(*addr); -} - -extern __inline__ void cpu_to_le32s(__u32 *addr) -{ - *addr = cpu_to_le32(*addr); -} - -#define cpu_to_be16s(x) do { } while (0) -#define cpu_to_be32s(x) do { } while (0) - -/* Convert from specified byte order, to CPU byte order. */ -#define le16_to_cpu(x) cpu_to_le16(x) -#define le32_to_cpu(x) cpu_to_le32(x) -#define be16_to_cpu(x) cpu_to_be16(x) -#define be32_to_cpu(x) cpu_to_be32(x) - -#define le16_to_cpup(x) cpu_to_le16p(x) -#define le32_to_cpup(x) cpu_to_le32p(x) -#define be16_to_cpup(x) cpu_to_be16p(x) -#define be32_to_cpup(x) cpu_to_be32p(x) - -#define le16_to_cpus(x) cpu_to_le16s(x) -#define le32_to_cpus(x) cpu_to_le32s(x) -#define be16_to_cpus(x) cpu_to_be16s(x) -#define be32_to_cpus(x) cpu_to_be32s(x) - -#endif /* __KERNEL__ */ +#include <linux/byteorder/big_endian.h> -#endif /* !(_SPARC_BYTEORDER_H) */ +#endif /* _SPARC_BYTEORDER_H */ diff --git a/include/asm-sparc/ioctls.h b/include/asm-sparc/ioctls.h index ccc5e7fce..1124df116 100644 --- a/include/asm-sparc/ioctls.h +++ b/include/asm-sparc/ioctls.h @@ -74,6 +74,7 @@ #define TIOCSPGRP _IOW('t', 130, int) #define TIOCGPGRP _IOR('t', 131, int) #define TIOCSCTTY _IO('t', 132) +#define TIOCGSID _IOR('t', 133, int) /* Little f */ #define FIOCLEX _IO('f', 1) diff --git a/include/asm-sparc/posix_types.h b/include/asm-sparc/posix_types.h index 1df2f62d2..a3fb5bb58 100644 --- a/include/asm-sparc/posix_types.h +++ b/include/asm-sparc/posix_types.h @@ -17,6 +17,7 @@ typedef long unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef long int __kernel_ptrdiff_t; typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; typedef int __kernel_pid_t; typedef unsigned short __kernel_ipc_pid_t; diff --git a/include/asm-sparc64/byteorder.h b/include/asm-sparc64/byteorder.h index dce2db246..43964767b 100644 --- a/include/asm-sparc64/byteorder.h +++ b/include/asm-sparc64/byteorder.h @@ -1,129 +1,46 @@ -/* $Id: byteorder.h,v 1.6 1997/06/14 17:35:07 davem Exp $ */ #ifndef _SPARC64_BYTEORDER_H #define _SPARC64_BYTEORDER_H +#include <asm/types.h> #include <asm/asi.h> -#define ntohl(x) ((unsigned long int)(x)) -#define ntohs(x) ((unsigned short int)(x)) -#define htonl(x) ((unsigned long int)(x)) -#define htons(x) ((unsigned short int)(x)) +#ifdef __GNUC__ -/* Some programs depend upon these being around. */ -#define __constant_ntohl(x) ((unsigned long int)(x)) -#define __constant_ntohs(x) ((unsigned short int)(x)) -#define __constant_htonl(x) ((unsigned long int)(x)) -#define __constant_htons(x) ((unsigned short int)(x)) - -#ifndef __BIG_ENDIAN -#define __BIG_ENDIAN 4321 -#endif - -#ifndef __BIG_ENDIAN_BITFIELD -#define __BIG_ENDIAN_BITFIELD -#endif - -#ifdef __KERNEL__ - -/* Convert from CPU byte order, to specified byte order. */ -extern __inline__ __u16 cpu_to_le16(__u16 value) -{ - return (value >> 8) | (value << 8); -} - -extern __inline__ __u32 cpu_to_le32(__u32 value) -{ - return((value>>24) | ((value>>8)&0xff00) | - ((value<<8)&0xff0000) | (value<<24)); -} - -extern __inline__ __u64 cpu_to_le64(__u64 value) -{ - return (((value>>56) & 0x00000000000000ffUL) | - ((value>>40) & 0x000000000000ff00UL) | - ((value>>24) & 0x0000000000ff0000UL) | - ((value>>8) & 0x00000000ff000000UL) | - ((value<<8) & 0x000000ff00000000UL) | - ((value<<24) & 0x0000ff0000000000UL) | - ((value<<40) & 0x00ff000000000000UL) | - ((value<<56) & 0xff00000000000000UL)); -} -#define cpu_to_be16(x) (x) -#define cpu_to_be32(x) (x) -#define cpu_to_be64(x) (x) - -/* The same, but returns converted value from the location pointer by addr. */ -extern __inline__ __u16 cpu_to_le16p(__u16 *addr) +static __inline__ __u16 ___arch__swab16p(__u16 *addr) { __u16 ret; + __asm__ __volatile__ ("lduha [%1] %2, %0" : "=r" (ret) : "r" (addr), "i" (ASI_PL)); return ret; } -extern __inline__ __u32 cpu_to_le32p(__u32 *addr) +static __inline__ __u32 ___arch__swab32p(__u32 *addr) { __u32 ret; + __asm__ __volatile__ ("lduwa [%1] %2, %0" : "=r" (ret) : "r" (addr), "i" (ASI_PL)); return ret; } -extern __inline__ __u64 cpu_to_le64p(__u64 *addr) -{ +static __inline__ __u64 ___arch__swab64p(__u64 *addr) { __u64 ret; + __asm__ __volatile__ ("ldxa [%1] %2, %0" : "=r" (ret) : "r" (addr), "i" (ASI_PL)); return ret; } -extern __inline__ __u16 cpu_to_be16p(__u16 *addr) { return *addr; } -extern __inline__ __u32 cpu_to_be32p(__u32 *addr) { return *addr; } -extern __inline__ __u64 cpu_to_be64p(__u64 *addr) { return *addr; } - -/* The same, but do the conversion in situ, ie. put the value back to addr. */ -extern __inline__ void cpu_to_le16s(__u16 *addr) -{ - *addr = cpu_to_le16p(addr); -} - -extern __inline__ void cpu_to_le32s(__u32 *addr) -{ - *addr = cpu_to_le32p(addr); -} - -extern __inline__ void cpu_to_le64s(__u64 *addr) -{ - *addr = cpu_to_le64p(addr); -} -#define cpu_to_be16s(x) do { } while (0) -#define cpu_to_be32s(x) do { } while (0) -#define cpu_to_be64s(x) do { } while (0) - -/* Convert from specified byte order, to CPU byte order. */ -#define le16_to_cpu(x) cpu_to_le16(x) -#define le32_to_cpu(x) cpu_to_le32(x) -#define le64_to_cpu(x) cpu_to_le64(x) -#define be16_to_cpu(x) cpu_to_be16(x) -#define be32_to_cpu(x) cpu_to_be32(x) -#define be64_to_cpu(x) cpu_to_be64(x) -#define le16_to_cpup(x) cpu_to_le16p(x) -#define le32_to_cpup(x) cpu_to_le32p(x) -#define le64_to_cpup(x) cpu_to_le64p(x) -#define be16_to_cpup(x) cpu_to_be16p(x) -#define be32_to_cpup(x) cpu_to_be32p(x) -#define be64_to_cpup(x) cpu_to_be64p(x) +#define __arch__swab16p(x) ___arch__swab16p(x) +#define __arch__swab32p(x) ___arch__swab32p(x) +#define __arch__swab64p(x) ___arch__swab64p(x) -#define le16_to_cpus(x) cpu_to_le16s(x) -#define le32_to_cpus(x) cpu_to_le32s(x) -#define le64_to_cpus(x) cpu_to_le64s(x) -#define be16_to_cpus(x) cpu_to_be16s(x) -#define be32_to_cpus(x) cpu_to_be32s(x) -#define be64_to_cpus(x) cpu_to_be64s(x) +#define __BYTEORDER_HAS_U64__ -#endif /* __KERNEL__ */ +#include <linux/byteorder/big_endian.h> -#endif /* !(_SPARC64_BYTEORDER_H) */ +#endif /* _SPARC64_BYTEORDER_H */ diff --git a/include/asm-sparc64/ioctls.h b/include/asm-sparc64/ioctls.h index 8a4a2c91d..56d74c356 100644 --- a/include/asm-sparc64/ioctls.h +++ b/include/asm-sparc64/ioctls.h @@ -75,6 +75,7 @@ #define TIOCSPGRP _IOW('t', 130, int) #define TIOCGPGRP _IOR('t', 131, int) #define TIOCSCTTY _IO('t', 132) +#define TIOCGSID _IOR('t', 133, int) /* Little f */ #define FIOCLEX _IO('f', 1) diff --git a/include/asm-sparc64/posix_types.h b/include/asm-sparc64/posix_types.h index 6bf51c96a..0c0e25a77 100644 --- a/include/asm-sparc64/posix_types.h +++ b/include/asm-sparc64/posix_types.h @@ -26,6 +26,9 @@ typedef int __kernel_daddr_t; typedef long __kernel_off_t; typedef char * __kernel_caddr_t; +/* Note this piece of asymmetry from the v9 ABI. */ +typedef int __kernel_suseconds_t; + #ifdef __GNUC__ typedef long long __kernel_loff_t; #endif diff --git a/include/linux/acct.h b/include/linux/acct.h index 99fe14917..e1c96a4c1 100644 --- a/include/linux/acct.h +++ b/include/linux/acct.h @@ -1,29 +1,86 @@ -#ifndef __LINUX_ACCT_H -#define __LINUX_ACCT_H +/* + * BSD Process Accounting for Linux - Definitions + * + * Author: Marco van Wieringen (mvw@planets.elm.net) + * + * This header file contains the definitions needed to implement + * BSD-style process accounting. The kernel accounting code and all + * user-level programs that try to do something useful with the + * process accounting log must include this file. + * + * Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V. + * + */ -#define ACCT_COMM 16 +#ifndef _LINUX_ACCT_H +#define _LINUX_ACCT_H + +#include <linux/types.h> + +/* + * comp_t is a 16-bit "floating" point number with a 3-bit base 8 + * exponent and a 13-bit fraction. See linux/kernel/acct.c for the + * specific encoding system used. + */ + +typedef __u16 comp_t; + +/* + * accounting file record + * + * This structure contains all of the information written out to the + * process accounting file whenever a process exits. + */ + +#define ACCT_COMM 16 struct acct { - char ac_comm[ACCT_COMM]; /* Accounting command name */ - time_t ac_utime; /* Accounting user time */ - time_t ac_stime; /* Accounting system time */ - time_t ac_etime; /* Accounting elapsed time */ - time_t ac_btime; /* Beginning time */ - uid_t ac_uid; /* Accounting user ID */ - gid_t ac_gid; /* Accounting group ID */ - dev_t ac_tty; /* controlling tty */ - char ac_flag; /* Accounting flag */ - long ac_minflt; /* Accounting minor pagefaults */ - long ac_majflt; /* Accounting major pagefaults */ - long ac_exitcode; /* Accounting process exitcode */ + char ac_flag; /* Accounting Flags */ +/* + * No binary format break with 2.0 - but when we hit 32bit uid we'll + * have to bite one + */ + __u16 ac_uid; /* Accounting Real User ID */ + __u16 ac_gid; /* Accounting Real Group ID */ + __u16 ac_tty; /* Accounting Control Terminal */ + __u32 ac_btime; /* Accounting Process Creation Time */ + comp_t ac_utime; /* Accounting User Time */ + comp_t ac_stime; /* Accounting System Time */ + comp_t ac_etime; /* Accounting Elapsed Time */ + comp_t ac_mem; /* Accounting Average Memory Usage */ + comp_t ac_io; /* Accounting Chars Transferred */ + comp_t ac_rw; /* Accounting Blocks Read or Written */ + comp_t ac_minflt; /* Accounting Minor Pagefaults */ + comp_t ac_majflt; /* Accounting Major Pagefaults */ + comp_t ac_swaps; /* Accounting Number of Swaps */ + __u32 ac_exitcode; /* Accounting Exitcode */ + char ac_comm[ACCT_COMM + 1]; /* Accounting Command Name */ + char ac_pad[10]; /* Accounting Padding Bytes */ }; -#define AFORK 0001 /* has executed fork, but no exec */ -#define ASU 0002 /* used super-user privileges */ -#define ACORE 0004 /* dumped core */ -#define AXSIG 0010 /* killed by a signal */ +/* + * accounting flags + */ + /* bit set when the process ... */ +#define AFORK 0x01 /* ... executed fork, but did not exec */ +#define ASU 0x02 /* ... used super-user privileges */ +#define ACOMPAT 0x04 /* ... used compatibility mode (VAX only not used) */ +#define ACORE 0x08 /* ... dumped core */ +#define AXSIG 0x10 /* ... was killed by a signal */ -#define AHZ 100 +#define AHZ 100 +#ifdef __KERNEL__ + +#include <linux/config.h> + +#ifdef CONFIG_BSD_PROCESS_ACCT +extern int acct_process(long exitcode); +#else +#define acct_process(x) do { } while (0) #endif + +#endif /* __KERNEL */ + +#endif /* _LINUX_ACCT_H */ diff --git a/include/linux/affs_fs.h b/include/linux/affs_fs.h index cfb891c4e..ec637973d 100644 --- a/include/linux/affs_fs.h +++ b/include/linux/affs_fs.h @@ -27,23 +27,26 @@ struct DateStamp u32 ds_Tick; }; - /* --- Prototypes ----------------------------------------------------------------------------- */ /* amigaffs.c */ extern int affs_get_key_entry(int bsize, void *data, int entry_pos); -extern int affs_get_file_name(int bsize, void *fh_data, char **name); +extern int affs_get_file_name(int bsize, void *fh_data, unsigned char **name); extern u32 affs_checksum_block(int bsize, void *data, s32 *ptype, s32 *stype); extern void affs_fix_checksum(int bsize, void *data, int cspos); extern void secs_to_datestamp(time_t secs, struct DateStamp *ds); extern int prot_to_mode(unsigned int prot); extern u32 mode_to_prot(int mode); -extern int affs_fix_hash_pred(struct inode *startino, int startoffset, - s32 key, s32 newkey); -extern int affs_fix_link_pred(struct inode *startino, s32 key, s32 newkey); +extern int affs_insert_hash(unsigned long dir_ino, struct buffer_head *header, + struct inode *inode); +extern int affs_remove_hash(struct buffer_head *bh, struct inode *inode); +extern int affs_remove_link(struct buffer_head *bh, struct inode *inode); +extern int affs_remove_header(struct buffer_head *bh, struct inode *inode); extern void affs_error(struct super_block *sb, const char *function, const char *fmt, ...); extern void affs_warning(struct super_block *sb, const char *function, const char *fmt, ...); +extern int affs_check_name(const unsigned char *name, int len); +extern int affs_copy_name(unsigned char *bstr, const unsigned char *name); /* bitmap. c */ @@ -56,39 +59,44 @@ extern void affs_make_zones(struct super_block *sb); /* namei.c */ -extern int affs_hash_name(const char *name, int len, int intl, int hashsize); -extern int affs_lookup(struct inode *dir,const char *name, int len, - struct inode **result); -extern int affs_unlink(struct inode *dir, const char *name, int len); -extern int affs_create(struct inode *dir, const char *name, int len, int mode, - struct inode **result); -extern int affs_mkdir(struct inode *dir, const char *name, int len, int mode); -extern int affs_rmdir(struct inode *dir, const char *name, int len); +extern int affs_hash_name(const unsigned char *name, int len, int intl, int hashsize); +extern int affs_lookup(struct inode *dir, struct dentry *dentry); +extern int affs_unlink(struct inode *dir, struct dentry *dentry); +extern int affs_create(struct inode *dir, struct dentry *dentry, int mode); +extern int affs_mkdir(struct inode *dir, struct dentry *dentry, int mode); +extern int affs_rmdir(struct inode *dir, struct dentry *dentry); extern int affs_link(struct inode *oldinode, struct inode *dir, - const char *name, int len); -extern int affs_symlink(struct inode *dir, const char *name, int len, - const char *symname); -extern int affs_rename(struct inode *old_dir, const char *old_name, int old_len, - struct inode *new_dir, const char *new_name, int new_len); + struct dentry *dentry); +extern int affs_symlink(struct inode *dir, struct dentry *dentry, + const char *symname); +extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry, + struct inode *new_dir, struct dentry *new_dentry); /* inode.c */ -extern struct buffer_head *affs_bread(kdev_t dev, int block, int size); -extern void affs_brelse(struct buffer_head *buf); -extern unsigned long affs_parent_ino(struct inode *dir); -extern struct inode *affs_new_inode(const struct inode *dir); -extern int affs_add_entry(struct inode *dir, struct inode *link, - struct inode *inode, const char *name, - int len, s32 type); +extern struct buffer_head *affs_bread(kdev_t dev, int block, int size); +extern void affs_brelse(struct buffer_head *buf); +extern unsigned long affs_parent_ino(struct inode *dir); +extern struct inode *affs_new_inode(const struct inode *dir); +extern int affs_notify_change(struct inode *inode, struct iattr *attr); +extern int affs_add_entry(struct inode *dir, struct inode *link, + struct inode *inode, struct dentry *dentry, s32 type); +extern void affs_put_inode(struct inode *inode); +extern void affs_delete_inode(struct inode *inode); +extern void affs_read_inode(struct inode *inode); +extern void affs_write_inode(struct inode *inode); + +/* super.c */ + +extern int affs_fs(void); /* file.c */ -extern void affs_truncate(struct inode *); -extern void affs_truncate_ofs(struct inode *); +extern void affs_truncate(struct inode *); /* dir.c */ -extern void affs_dir_truncate(struct inode *); +extern void affs_dir_truncate(struct inode *); /* jump tables */ @@ -99,5 +107,4 @@ extern struct inode_operations affs_symlink_inode_operations; extern struct inode_operations affs_chrdev_inode_operations; extern struct inode_operations affs_blkdev_inode_operations; -extern int init_affs_fs(void); #endif diff --git a/include/linux/affs_fs_sb.h b/include/linux/affs_fs_sb.h index 75af71dba..7ab261209 100644 --- a/include/linux/affs_fs_sb.h +++ b/include/linux/affs_fs_sb.h @@ -68,5 +68,6 @@ struct affs_sb_info { #define SF_OFS 0x0200 /* Old filesystem */ #define SF_PREFIX 0x0400 /* Buffer for prefix is allocated */ #define SF_VERBOSE 0x0800 /* Talk about fs when mounting */ +#define SF_READONLY 0x1000 /* Don't allow to remount rw */ #endif diff --git a/include/linux/amigaffs.h b/include/linux/amigaffs.h index 8e39a6fe2..a6b16e066 100644 --- a/include/linux/amigaffs.h +++ b/include/linux/amigaffs.h @@ -4,10 +4,18 @@ #include <asm/byteorder.h> #include <linux/types.h> +/* AmigaOS allows file names with up to 30 characters length. + * Names longer than that will be silently truncated. If you + * want to disallow this, comment out the following #define. + * Creating filesystem objects with longer names will then + * result in an error (ENAMETOOLONG). + */ +/*#define AFFS_NO_TRUNCATE */ + /* Ugly macros make the code more pretty. */ #define GET_END_PTR(st,p,sz) ((st *)((char *)(p)+((sz)-sizeof(st)))) -#define AFFS_GET_HASHENTRY(data,hashkey) htonl(((struct dir_front *)data)->hashtable[hashkey]) +#define AFFS_GET_HASHENTRY(data,hashkey) be32_to_cpu(((struct dir_front *)data)->hashtable[hashkey]) #define AFFS_BLOCK(data,ino,blk) ((struct file_front *)data)->blocks[AFFS_I2HSIZE(ino)-1-(blk)] #define FILE_END(p,i) GET_END_PTR(struct file_end,p,AFFS_I2BSIZE(i)) @@ -16,6 +24,7 @@ #define LINK_END(p,i) GET_END_PTR(struct hlink_end,p,AFFS_I2BSIZE(i)) #define ROOT_END_S(p,s) GET_END_PTR(struct root_end,p,(s)->s_blocksize) #define DATA_FRONT(bh) ((struct data_front *)(bh)->b_data) +#define DIR_FRONT(bh) ((struct dir_front *)(bh)->b_data) /* Only for easier debugging if need be */ #define affs_bread bread @@ -206,14 +215,14 @@ struct data_front #define AFFS_UMAYWRITE(prot) (((prot) & (FIBF_WRITE|FIBF_DELETE)) == (FIBF_WRITE|FIBF_DELETE)) #define AFFS_UMAYREAD(prot) ((prot) & FIBF_READ) -#define AFFS_UMAYEXECUTE(prot) (((prot) & (FIBF_SCRIPT|FIBF_READ)) == (FIBF_SCRIPT|FIBF_READ)) +#define AFFS_UMAYEXECUTE(prot) ((prot) & FIBF_EXECUTE) #define AFFS_GMAYWRITE(prot) (((prot)&(FIBF_GRP_WRITE|FIBF_GRP_DELETE))==\ (FIBF_GRP_WRITE|FIBF_GRP_DELETE)) #define AFFS_GMAYREAD(prot) ((prot) & FIBF_GRP_READ) -#define AFFS_GMAYEXECUTE(prot) (((prot)&(FIBF_SCRIPT|FIBF_GRP_READ))==(FIBF_SCRIPT|FIBF_GRP_READ)) +#define AFFS_GMAYEXECUTE(prot) ((prot) & FIBF_EXECUTE) #define AFFS_OMAYWRITE(prot) (((prot)&(FIBF_OTR_WRITE|FIBF_OTR_DELETE))==\ (FIBF_OTR_WRITE|FIBF_OTR_DELETE)) #define AFFS_OMAYREAD(prot) ((prot) & FIBF_OTR_READ) -#define AFFS_OMAYEXECUTE(prot) (((prot)&(FIBF_SCRIPT|FIBF_OTR_READ))==(FIBF_SCRIPT|FIBF_OTR_READ)) +#define AFFS_OMAYEXECUTE(prot) ((prot) & FIBF_EXECUTE) #endif diff --git a/include/linux/aztcd.h b/include/linux/aztcd.h index 71fe5a0df..e69de29bb 100644 --- a/include/linux/aztcd.h +++ b/include/linux/aztcd.h @@ -1,154 +0,0 @@ -/* $Id: aztcd.h,v 2.50 1996/05/17 16:15:43 root Exp root $ - * - * Definitions for a AztechCD268 CD-ROM interface - * Copyright (C) 1994, 1995 Werner Zimmermann - * - * based on Mitsumi CDROM driver by Martin Harriss - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * History: W.Zimmermann adaption to Aztech CD268-01A Version 1.3 - * October 1994 Email: zimmerma@rz.fht-esslingen.de - */ - -/* *** change this to set the I/O port address of your CD-ROM drive*/ -#define AZT_BASE_ADDR 0x320 - -/* Uncomment this, if your CDROM is connected to a Soundwave32-soundcard - and configure AZT_BASE_ADDR and AZT_SW32_BASE_ADDR */ -/*#define AZT_SW32 1 -*/ - -#ifdef AZT_SW32 -#define AZT_SW32_BASE_ADDR 0x220 /*I/O port base address of your soundcard*/ -#endif - -/* Set this to 1, if you want your tray to be locked, set to 0 to prevent tray - from locking */ -#define AZT_ALLOW_TRAY_LOCK 1 - -/*Set this to 1 to allow auto-eject when unmounting a disk, set to 0, if you - don't want the auto-eject feature*/ -#define AZT_AUTO_EJECT 0 - -/*Set this to 1, if you want to use incompatible ioctls for reading in raw and - cooked mode */ -#define AZT_PRIVATE_IOCTLS 1 - -/*Set this to 1, if you want multisession support by the ISO fs. Even if you set - this value to '0' you can use multisession CDs. In that case the drive's firm- - ware will do the appropriate redirection automatically. The CD will then look - like a single session CD (but nevertheless all data may be read). Please read - chapter '5.1 Multisession support' in README.aztcd for details. Normally it's - uncritical to leave this setting untouched */ -#define AZT_MULTISESSION 1 - -/*---------------------------------------------------------------------------*/ -/*-----nothing to be configured for normal applications below this line------*/ - - -/* Increase this if you get lots of timeouts; if you get kernel panic, replace - STEN_LOW_WAIT by STEN_LOW in the source code */ -#define AZT_STATUS_DELAY 400 /*for timer wait, STEN_LOW_WAIT*/ -#define AZT_TIMEOUT 8000000 /*for busy wait STEN_LOW, DTEN_LOW*/ -#define AZT_FAST_TIMEOUT 10000 /*for reading the version string*/ - -/* number of times to retry a command before giving up */ -#define AZT_RETRY_ATTEMPTS 3 - -/* port access macros */ -#define CMD_PORT azt_port -#define DATA_PORT azt_port -#define STATUS_PORT azt_port+1 -#define MODE_PORT azt_port+2 -#ifdef AZT_SW32 - #define AZT_SW32_INIT (unsigned int) (0xFF00 & (AZT_BASE_ADDR*16)) - #define AZT_SW32_CONFIG_REG AZT_SW32_BASE_ADDR+0x16 /*Soundwave32 Config. Register*/ - #define AZT_SW32_ID_REG AZT_SW32_BASE_ADDR+0x04 /*Soundwave32 ID Version Register*/ -#endif - -/* status bits */ -#define AST_CMD_CHECK 0x80 /* 1 = command error */ -#define AST_DOOR_OPEN 0x40 /* 1 = door is open */ -#define AST_NOT_READY 0x20 /* 1 = no disk in the drive */ -#define AST_DSK_CHG 0x02 /* 1 = disk removed or changed */ -#define AST_MODE 0x01 /* 0=MODE1, 1=MODE2 */ -#define AST_MODE_BITS 0x1C /* Mode Bits */ -#define AST_INITIAL 0x0C /* initial, only valid ... */ -#define AST_BUSY 0x04 /* now playing, only valid - in combination with mode - bits */ -/* flag bits */ -#define AFL_DATA 0x02 /* data available if low */ -#define AFL_STATUS 0x04 /* status available if low */ -#define AFL_OP_OK 0x01 /* OP_OK command correct*/ -#define AFL_PA_OK 0x02 /* PA_OK parameter correct*/ -#define AFL_OP_ERR 0x05 /* error in command*/ -#define AFL_PA_ERR 0x06 /* error in parameters*/ -#define POLLED 0x04 /* polled mode */ - -/* commands */ -#define ACMD_SOFT_RESET 0x10 /* reset drive */ -#define ACMD_PLAY_READ 0x20 /* read data track in cooked mode */ -#define ACMD_PLAY_READ_RAW 0x21 /* reading in raw mode*/ -#define ACMD_SEEK 0x30 /* seek msf address*/ -#define ACMD_SEEK_TO_LEADIN 0x31 /* seek to leadin track*/ -#define ACMD_GET_ERROR 0x40 /* get error code */ -#define ACMD_GET_STATUS 0x41 /* get status */ -#define ACMD_GET_Q_CHANNEL 0x50 /* read info from q channel */ -#define ACMD_EJECT 0x60 /* eject/open tray */ -#define ACMD_CLOSE 0x61 /* close tray */ -#define ACMD_LOCK 0x71 /* lock tray closed */ -#define ACMD_UNLOCK 0x72 /* unlock tray */ -#define ACMD_PAUSE 0x80 /* pause */ -#define ACMD_STOP 0x81 /* stop play */ -#define ACMD_PLAY_AUDIO 0x90 /* play audio track */ -#define ACMD_SET_VOLUME 0x93 /* set audio level */ -#define ACMD_GET_VERSION 0xA0 /* get firmware version */ -#define ACMD_SET_DISK_TYPE 0xA1 /* set disk data mode */ - -#define MAX_TRACKS 104 - -struct msf { - unsigned char min; - unsigned char sec; - unsigned char frame; -}; - -struct azt_Play_msf { - struct msf start; - struct msf end; -}; - -struct azt_DiskInfo { - unsigned char first; - unsigned char next; - unsigned char last; - struct msf diskLength; - struct msf firstTrack; - unsigned char multi; - struct msf nextSession; - struct msf lastSession; - unsigned char xa; - unsigned char audio; -}; - -struct azt_Toc { - unsigned char ctrl_addr; - unsigned char track; - unsigned char pointIndex; - struct msf trackTime; - struct msf diskTime; -}; diff --git a/include/linux/baycom.h b/include/linux/baycom.h index 20d927f50..9754f9384 100644 --- a/include/linux/baycom.h +++ b/include/linux/baycom.h @@ -1,7 +1,7 @@ /* * The Linux BAYCOM driver for the Baycom serial 1200 baud modem * and the parallel 9600 baud modem - * (C) 1996 by Thomas Sailer, HB9JNX + * (C) 1997 by Thomas Sailer, HB9JNX/AE4WA */ #ifndef _BAYCOM_H diff --git a/include/linux/blk.h b/include/linux/blk.h index 0625942de..8893b170a 100644 --- a/include/linux/blk.h +++ b/include/linux/blk.h @@ -36,7 +36,9 @@ #endif /* IDE_DRIVER */ #define SUBSECTOR(block) (CURRENT->current_nr_sectors > 0) - +#ifdef CONFIG_CDROM +extern int cdrom_init(void); +#endif CONFIG_CDROM #ifdef CONFIG_CDU31A extern int cdu31a_init(void); #endif CONFIG_CDU31A diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 1c2ede5e0..f41342b53 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -1,108 +1,140 @@ /* * -- <linux/cdrom.h> - * general (not only SCSI) header library for linux CDROM drivers - * (C) 1992 David Giller rafetmad@oxy.edu - * 1994, 1995 Eberhard Moenkeberg emoenke@gwdg.de - * + * General header file for linux CD-ROM drivers + * Copyright (C) 1992 David Giller, rafetmad@oxy.edu + * 1994, 1995 Eberhard Moenkeberg, emoenke@gwdg.de + * 1996 David van Leeuwen, david@tm.tno.nl + * 1997 Erik Andersen, andersee@debian.org */ - + #ifndef _LINUX_CDROM_H #define _LINUX_CDROM_H +/******************************************************* + * As of Linux 2.1.x, all Linux CD-ROM application programs will use this + * (and only this) include file. It is my hope to provide Linux with + * a uniform interface between software accessing CD-ROMs and the various + * device drivers that actually talk to the drives. There may still be + * 23 different kinds of strange CD-ROM drives, but at least there will + * now be one, and only one, Linux CD-ROM interface. + * + * Additionally, as of Linux 2.1.x, all Linux application programs + * should use the O_NONBLOCK option when opening a CD-ROM device + * for subsequent ioctl commands. This allows for neat system errors + * like "No medium found" or "Wrong medium type" upon attempting to + * mount or play an empty slot, mount an audio disc, or play a data disc. + * Generally, changing an application program to support O_NONBLOCK + * is as easy as the following: + * - drive = open("/dev/cdrom", O_RDONLY); + * + drive = open("/dev/cdrom", O_RDONLY | O_NONBLOCK); + * It is worth the small change. + * + * Patches for many common CD programs (provided by David A. van Leeuwen) + * can be found at: ftp://ftp.gwdg.de/pub/linux/cdrom/drivers/cm206/ + * + *******************************************************/ + +/* When a driver supports a certain function, but the cdrom drive we are + * using doesn't, we will return the error EDRIVE_CANT_DO_THIS. We will + * borrow the "Operation not supported" error from the network folks to + * accomplish this. Maybe someday we will get a more targeted error code, + * but this will do for now... */ +#define EDRIVE_CANT_DO_THIS EOPNOTSUPP + +/******************************************************* + * The CD-ROM IOCTL commands -- these should be supported by + * all the various cdrom drivers. For the CD-ROM ioctls, we + * will commandeer byte 0x53, or 'S'. + *******************************************************/ +#define CDROMPAUSE 0x5301 /* Pause Audio Operation */ +#define CDROMRESUME 0x5302 /* Resume paused Audio Operation */ +#define CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ +#define CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index + (struct cdrom_ti) */ +#define CDROMREADTOCHDR 0x5305 /* Read TOC header + (struct cdrom_tochdr) */ +#define CDROMREADTOCENTRY 0x5306 /* Read TOC entry + (struct cdrom_tocentry) */ +#define CDROMSTOP 0x5307 /* Stop the cdrom drive */ +#define CDROMSTART 0x5308 /* Start the cdrom drive */ +#define CDROMEJECT 0x5309 /* Ejects the cdrom media */ +#define CDROMVOLCTRL 0x530a /* Control output volume + (struct cdrom_volctrl) */ +#define CDROMSUBCHNL 0x530b /* Read subchannel data + (struct cdrom_subchnl) */ +#define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) + (struct cdrom_read) */ +#define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes) + (struct cdrom_read) */ +#define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ +#define CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ +#define CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session + address of multi session disks + (struct cdrom_multisession) */ +#define CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" + if available (struct cdrom_mcn) */ +#define CDROM_GET_UPC CDROM_GET_MCN /* This one is depricated, + but here anyway for compatability */ +#define CDROMRESET 0x5312 /* hard-reset the drive */ +#define CDROMVOLREAD 0x5313 /* Get the drive's volume setting + (struct cdrom_volctrl) */ +#define CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) + (struct cdrom_read) */ +/* + * These ioctls are used only used in aztcd.c and optcd.c + */ +#define CDROMREADCOOKED 0x5315 /* read data in cooked mode */ +#define CDROMSEEK 0x5316 /* seek msf address */ + /* - * some fix numbers + * This ioctl is only used by the scsi-cd driver. + It is for playing audio in logical block addressing mode. */ -#define CD_MINS 74 /* max. minutes per CD, not really a limit */ -#define CD_SECS 60 /* seconds per minute */ -#define CD_FRAMES 75 /* frames per second */ - -#define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame, not transfered by the drive */ -#define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */ -#define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */ -#define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */ -#define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD)/* sync bytes + header of XA frame */ - -#define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ -#define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ -/* most drives don't deliver everything: */ -#define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /* 2340 */ -#define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /* 2336 */ -/* Optics drive also has a 'read all' mode: */ -#define CD_FRAMESIZE_RAWER 2646 /* bytes per frame */ - -#define CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */ -#define CD_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */ -#define CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */ -#define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) /* "after data" part of raw XA frame */ - -#define CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */ -#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ - -#define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */ -#define CD_NUM_OF_CHUNKS 98 /* chunks per frame */ - -#define CD_FRAMESIZE_XA CD_FRAMESIZE_RAW1 /* obsolete name */ -#define CD_BLOCK_OFFSET CD_MSF_OFFSET /* obsolete name */ +#define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ -/* - * the raw frame layout: - * - * - audio (red): | audio_sample_bytes | - * | 2352 | - * - * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | - * | 12 - 4 - 2048 - 4 - 8 - 276 | - * - * - data (yellow, mode2): | sync - head - data | - * | 12 - 4 - 2336 | - * - * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | - * | 12 - 4 - 8 - 2048 - 4 - 276 | - * - * - XA data (green, mode2 form2): | sync - head - sub - data - EDC | - * | 12 - 4 - 8 - 2324 - 4 | - * - * Sector types (format) - Forces the CD-ROM to read the specified sector type, - * attempt to read any other format ends with an error - * - * format sector type user data size (bytes) - * ----------------------------------------------------------------------------- - * 1 CD DA (Red Book) 2352 (CD_FRAMESIZE_RAW) - * 2 Mode1 Form1 (Yellow Book) 2048 (CD_FRAMESIZE) - * 3 Mode1 Form2 (Yellow Book) 2336 (CD_FRAMESIZE_RAW0) - * 4 Mode2 Form1 (Green Book) 2048 (CD_FRAMESIZE) - * 5 Mode2 Form2 (Green Book) 2328 (2324+4 spare bytes) - * - * - * Data Selection Field (pc.c[9]) - This value controls the actual number - * of bytes transferred from the CD-ROM - * - * bit 7 6 5 4 3 2 1 0 - * ---------------------------------------------------------------------------- - * | Sync | Sub | Header | User | EDC & | Error | Block | reserved - * | | Header | | Data | ECC | Flags | Error | - * \-------------------------------------------/\---------------/ - * | | - * V V - * stored on CD (2532) generated during error correction - * - * The maximal number of bytes returned by CD-ROM is 2646 (CD_FRAMESIZE_RAWER), - * when pc.c[9] = 0xfa. - * +/* + * These ioctls are used only used in optcd.c */ - +#define CDROMREADALL 0x5318 /* read all 2646 bytes */ +#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ -/* - * CDROM IOCTL structures +/* + * These ioctls are implemented through the uniform CD-ROM driver + * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM + * drivers are eventually ported to the uniform CD-ROM driver interface. */ +#define CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ +#define CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ +#define CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ +#define CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ +#define CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ +#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ +#define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ +#define CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ + +/* This ioctl is only used by sbpcd at the moment */ +#define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ + +/******************************************************* + * CDROM IOCTL structures + *******************************************************/ -struct cdrom_blk +/* Address in MSF format */ +struct cdrom_msf0 { - unsigned from; - unsigned short len; + u_char minute; + u_char second; + u_char frame; }; +/* Address in either MSF or logical format */ +union cdrom_addr +{ + struct cdrom_msf0 msf; + int lba; +}; +/* This struct is used by the CDROMPLAYMSF ioctl */ struct cdrom_msf { u_char cdmsf_min0; /* start minute */ @@ -113,6 +145,7 @@ struct cdrom_msf u_char cdmsf_frame1; /* end frame */ }; +/* This struct is used by the CDROMPLAYTRKIND ioctl */ struct cdrom_ti { u_char cdti_trk0; /* start track */ @@ -121,51 +154,23 @@ struct cdrom_ti u_char cdti_ind1; /* end index */ }; +/* This struct is used by the CDROMREADTOCHDR ioctl */ struct cdrom_tochdr { u_char cdth_trk0; /* start track */ u_char cdth_trk1; /* end track */ }; -struct cdrom_msf0 /* address in MSF format */ -{ - u_char minute; - u_char second; - u_char frame; -}; - -union cdrom_addr /* address in either MSF or logical format */ -{ - struct cdrom_msf0 msf; - int lba; -}; - -struct cdrom_tocentry +/* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */ +struct cdrom_volctrl { - u_char cdte_track; - u_char cdte_adr :4; - u_char cdte_ctrl :4; - u_char cdte_format; - union cdrom_addr cdte_addr; - u_char cdte_datamode; + u_char channel0; + u_char channel1; + u_char channel2; + u_char channel3; }; -/* - * CD-ROM address types (cdrom_tocentry.cdte_format) - */ -#define CDROM_LBA 0x01 /* "logical block": first frame is #0 */ -#define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */ - -/* - * bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) - */ -#define CDROM_DATA_TRACK 0x04 - -/* - * The leadout track is always 0xAA, regardless of # of tracks on disc - */ -#define CDROM_LEADOUT 0xAA - +/* This struct is used by the CDROMSUBCHNL ioctl */ struct cdrom_subchnl { u_char cdsc_format; @@ -178,28 +183,19 @@ struct cdrom_subchnl union cdrom_addr cdsc_reladdr; }; -struct cdrom_mcn { - u_char medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ -}; - -/* - * audio states (from SCSI-2, but seen with other drives, too) - */ -#define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */ -#define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */ -#define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */ -#define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */ -#define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */ -#define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */ -struct cdrom_volctrl +/* This struct is used by the CDROMREADTOCENTRY ioctl */ +struct cdrom_tocentry { - u_char channel0; - u_char channel1; - u_char channel2; - u_char channel3; + u_char cdte_track; + u_char cdte_adr :4; + u_char cdte_ctrl :4; + u_char cdte_format; + union cdrom_addr cdte_addr; + u_char cdte_datamode; }; +/* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */ struct cdrom_read { int cdread_lba; @@ -207,269 +203,217 @@ struct cdrom_read int cdread_buflen; }; -/* - * extensions for transferring audio frames - * currently used by sbpcd.c, cdu31a.c, ide-cd.c - */ +/* This struct is used by the CDROMREADAUDIO ioctl */ struct cdrom_read_audio { union cdrom_addr addr; /* frame address */ - u_char addr_format; /* CDROM_LBA or CDROM_MSF */ - int nframes; /* number of 2352-byte-frames to read at once, limited by the drivers */ - u_char *buf; /* frame buffer (size: nframes*2352 bytes) */ + u_char addr_format; /* CDROM_LBA or CDROM_MSF */ + int nframes; /* number of 2352-byte-frames to read at once */ + u_char *buf; /* frame buffer (size: nframes*2352 bytes) */ }; -/* - * this has to be the "arg" of the CDROMMULTISESSION ioctl - * for obtaining multi session info. - * The returned "addr" is valid only if "xa_flag" is true. - */ +/* This struct is used with the CDROMMULTISESSION ioctl */ struct cdrom_multisession { - union cdrom_addr addr; /* frame address: start-of-last-session (not the new "frame 16"!)*/ - u_char xa_flag; /* 1: "is XA disk" */ - u_char addr_format; /* CDROM_LBA or CDROM_MSF */ + union cdrom_addr addr; /* frame address: start-of-last-session + (not the new "frame 16"!). Only valid + if the "xa_flag" is true. */ + u_char xa_flag; /* 1: "is XA disk" */ + u_char addr_format; /* CDROM_LBA or CDROM_MSF */ }; -#ifdef FIVETWELVE -#define CDROM_MODE1_SIZE 512 -#else -#define CDROM_MODE1_SIZE 2048 -#endif FIVETWELVE -#define CDROM_MODE2_SIZE 2336 - -/* - * CD-ROM IOCTL commands - * For IOCTL calls, we will commandeer byte 0x53, or 'S'. - */ - -#define CDROMPAUSE 0x5301 -#define CDROMRESUME 0x5302 -#define CDROMPLAYMSF 0x5303 /* (struct cdrom_msf) */ -#define CDROMPLAYTRKIND 0x5304 /* (struct cdrom_ti) */ - -#define CDROMREADTOCHDR 0x5305 /* (struct cdrom_tochdr) */ -#define CDROMREADTOCENTRY 0x5306 /* (struct cdrom_tocentry) */ - -#define CDROMSTOP 0x5307 /* stop the drive motor */ -#define CDROMSTART 0x5308 /* turn the motor on */ - -#define CDROMEJECT 0x5309 /* eject CD-ROM media */ - -#define CDROMVOLCTRL 0x530a /* (struct cdrom_volctrl) */ - -#define CDROMSUBCHNL 0x530b /* (struct cdrom_subchnl) */ - -#define CDROMREADMODE2 0x530c /* (struct cdrom_read) */ - /* read type-2 data */ +/* This struct is used with the CDROM_GET_MCN ioctl. + * Very few audio discs actually have Universal Product Code information, + * which should just be the Medium Catalog Number on the box. Also note + * that the way the codeis written on CD is _not_ uniform across all discs! + */ +struct cdrom_mcn +{ + u_char medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ +}; -#define CDROMREADMODE1 0x530d /* (struct cdrom_read) */ - /* read type-1 data */ +/* This is used by the CDROMPLAYBLK ioctl */ +struct cdrom_blk +{ + unsigned from; + unsigned short len; +}; -#define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ /* - * enable (1) / disable (0) auto-ejecting - */ -#define CDROMEJECT_SW 0x530f /* arg: 0 or 1 */ - -/* - * obtain the start-of-last-session address of multi session disks - */ -#define CDROMMULTISESSION 0x5310 /* (struct cdrom_multisession) */ + * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, + * 2340, or 2352 bytes long. -/* - * obtain the "universal product code" number - * (only some data disks have it coded) +* Sector types of the standard CD-ROM data formats: + * + * format sector type user data size (bytes) + * ----------------------------------------------------------------------------- + * 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW) + * 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE) + * 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0) + * 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE) + * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes) + * + * + * The layout of the standard CD-ROM data formats: + * ----------------------------------------------------------------------------- + * - audio (red): | audio_sample_bytes | + * | 2352 | + * + * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | + * | 12 - 4 - 2048 - 4 - 8 - 276 | + * + * - data (yellow, mode2): | sync - head - data | + * | 12 - 4 - 2336 | + * + * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | + * | 12 - 4 - 8 - 2048 - 4 - 276 | + * + * - XA data (green, mode2 form2): | sync - head - sub - data - Spare | + * | 12 - 4 - 8 - 2324 - 4 | + * */ -#define CDROM_GET_UPC 0x5311 /* 8 bytes returned */ -#define CDROMRESET 0x5312 /* hard-reset the drive */ -#define CDROMVOLREAD 0x5313 /* let the drive tell its volume setting */ - /* (struct cdrom_volctrl) */ +/* Some generally useful CD-ROM information -- mostly based on the above */ +#define CD_MINS 74 /* max. minutes per CD, not really a limit */ +#define CD_SECS 60 /* seconds per minute */ +#define CD_FRAMES 75 /* frames per second */ +#define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */ +#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ +#define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */ +#define CD_NUM_OF_CHUNKS 98 /* chunks per frame */ +#define CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */ +#define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */ +#define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */ +#define CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */ +#define CD_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */ +#define CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */ +#define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ +#define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ +#define CD_FRAMESIZE_RAWER 2646 /* The maximum possible returned bytes */ +/* most drives don't deliver everything: */ +#define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/ +#define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/ -/* - * these ioctls are used in aztcd.c and optcd.c - */ -#define CDROMREADRAW 0x5314 /* read data in raw mode */ -#define CDROMREADCOOKED 0x5315 /* read data in cooked mode */ -#define CDROMSEEK 0x5316 /* seek msf address */ - -/* - * for playing audio in logical block addressing mode - */ -#define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ +#define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */ +#define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) /* "after data" part of raw XA frame */ +#define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD) /* sync bytes + header of XA frame */ -/* - * these ioctls are used in optcd.c - */ -#define CDROMREADALL 0x5318 /* read all 2646 bytes */ -#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ +/* CD-ROM address types (cdrom_tocentry.cdte_format) */ +#define CDROM_LBA 0x01 /* "logical block": first frame is #0 */ +#define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */ +/* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */ +#define CDROM_DATA_TRACK 0x04 -/* - * CD-ROM-specific SCSI command opcodes - */ +/* The leadout track is always 0xAA, regardless of # of tracks on disc */ +#define CDROM_LEADOUT 0xAA -/* - * Group 2 (10-byte). All of these are called 'optional' by SCSI-II. - */ +/* audio states (from SCSI-2, but seen with other drives, too) */ +#define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */ +#define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */ +#define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */ +#define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */ +#define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */ +#define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */ + +/* CD-ROM-specific SCSI command opcodes */ #define SCMD_READ_TOC 0x43 /* read table of contents */ #define SCMD_PLAYAUDIO_MSF 0x47 /* play data at time offset */ #define SCMD_PLAYAUDIO_TI 0x48 /* play data at track/index */ #define SCMD_PAUSE_RESUME 0x4B /* pause/resume audio */ #define SCMD_READ_SUBCHANNEL 0x42 /* read SC info on playing disc */ #define SCMD_PLAYAUDIO10 0x45 /* play data at logical block */ -#define SCMD_READ_HEADER 0x44 /* read TOC header */ - -/* - * Group 5 - */ -#define SCMD_PLAYAUDIO12 0xA5 /* play data at logical block */ -#define SCMD_PLAYTRACK_REL12 0xA9 /* play track at relative offset */ - -/* - * Group 6 Commands - */ -#define SCMD_CD_PLAYBACK_CONTROL 0xC9 /* Sony vendor-specific audio */ -#define SCMD_CD_PLAYBACK_STATUS 0xC4 /* control opcodes */ -/* - * CD-ROM capacity structure. - */ -struct scsi_capacity -{ - u_long capacity; - u_long lbasize; -}; - -/* - * CD-ROM MODE_SENSE/MODE_SELECT parameters - */ -#define ERR_RECOVERY_PARMS 0x01 -#define DISCO_RECO_PARMS 0x02 -#define FORMAT_PARMS 0x03 -#define GEOMETRY_PARMS 0x04 -#define CERTIFICATION_PARMS 0x06 -#define CACHE_PARMS 0x38 +/* capability flags used with the uniform CD-ROM driver */ +#define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */ +#define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */ +#define CDC_LOCK 0x4 /* disable manual eject */ +#define CDC_SELECT_SPEED 0x8 /* programmable speed */ +#define CDC_SELECT_DISC 0x10 /* select disc from juke-box */ +#define CDC_MULTI_SESSION 0x20 /* read sessions>1 */ +#define CDC_MCN 0x40 /* Medium Catalog Number */ +#define CDC_MEDIA_CHANGED 0x80 /* media changed */ +#define CDC_PLAY_AUDIO 0x100 /* audio functions */ +#define CDC_RESET 0x200 /* hard reset device */ +#define CDC_IOCTLS 0x400 /* driver has non-standard ioctls */ +#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ + +/* drive status possibilities used with the uniform CD-ROM driver */ +#define CDS_NO_INFO 0 /* if not implemented */ +#define CDS_NO_DISC 1 +#define CDS_TRAY_OPEN 2 +#define CDS_DRIVE_NOT_READY 3 +#define CDS_DISC_OK 4 + +/* disc status possibilities, other than CDS_NO_DISC and CDS_NO_INFO */ +#define CDS_AUDIO 100 +#define CDS_DATA_1 101 +#define CDS_DATA_2 102 +#define CDS_XA_2_1 103 +#define CDS_XA_2_2 104 + +/* User-configurable behavior options for the uniform CD-ROM driver */ +#define CDO_AUTO_CLOSE 0x1 /* close tray on first open() */ +#define CDO_AUTO_EJECT 0x2 /* open tray on last release() */ +#define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */ +#define CDO_LOCK 0x8 /* lock tray on open files */ +#define CDO_CHECK_TYPE 0x10 /* check type on open for data */ + +/* Special codes used when specifying changer slots. */ +#define CDSL_NONE ((int) (~0U>>1)-1) +#define CDSL_CURRENT ((int) (~0U>>1)) + +#ifdef __KERNEL__ +/* Uniform cdrom data structures for cdrom.c */ +struct cdrom_device_info { + struct cdrom_device_ops *ops; /* link to device_ops */ + struct cdrom_device_info *next; /* next device_info for this major */ + void *handle; /* driver-dependent data */ +/* specifications */ + kdev_t dev; /* device number */ + int mask; /* mask of capability: disables them */ + int speed; /* maximum speed for reading data */ + int capacity; /* number of discs in jukebox */ +/* device-related storage */ + int options : 30; /* options flags */ + unsigned mc_flags : 2; /* media change buffer flags */ + int use_count; /* number of times device opened */ + char name[20]; /* name of the device type */ -/* - * standard mode-select header prepended to all mode-select commands - */ -struct ccs_modesel_head -{ - u_char _r1; /* reserved */ - u_char medium; /* device-specific medium type */ - u_char _r2; /* reserved */ - u_char block_desc_length; /* block descriptor length */ - u_char density; /* device-specific density code */ - u_char number_blocks_hi; /* number of blocks in this block desc */ - u_char number_blocks_med; - u_char number_blocks_lo; - u_char _r3; - u_char block_length_hi; /* block length for blocks in this desc */ - u_char block_length_med; - u_char block_length_lo; -}; - -/* - * error recovery parameters - */ -struct ccs_err_recovery -{ - u_char _r1 : 2; /* reserved */ - u_char page_code : 6; /* page code */ - u_char page_length; /* page length */ - u_char awre : 1; /* auto write realloc enabled */ - u_char arre : 1; /* auto read realloc enabled */ - u_char tb : 1; /* transfer block */ - u_char rc : 1; /* read continuous */ - u_char eec : 1; /* enable early correction */ - u_char per : 1; /* post error */ - u_char dte : 1; /* disable transfer on error */ - u_char dcr : 1; /* disable correction */ - u_char retry_count; /* error retry count */ - u_char correction_span; /* largest recov. to be attempted, bits */ - u_char head_offset_count; /* head offset (2's C) for each retry */ - u_char strobe_offset_count; /* data strobe */ - u_char recovery_time_limit; /* time limit on recovery attempts */ }; -/* - * disco/reco parameters - */ -struct ccs_disco_reco -{ - u_char _r1 : 2; /* reserved */ - u_char page_code : 6; /* page code */ - u_char page_length; /* page length */ - u_char buffer_full_ratio; /* write buffer reconnect threshold */ - u_char buffer_empty_ratio; /* read */ - u_short bus_inactivity_limit; /* limit on bus inactivity time */ - u_short disconnect_time_limit; /* minimum disconnect time */ - u_short connect_time_limit; /* minimum connect time */ - u_short _r2; /* reserved */ +struct cdrom_device_ops { +/* routines */ + int (*open) (struct cdrom_device_info *, int); + void (*release) (struct cdrom_device_info *); + int (*drive_status) (struct cdrom_device_info *, int); + int (*media_changed) (struct cdrom_device_info *, int); + int (*tray_move) (struct cdrom_device_info *, int); + int (*lock_door) (struct cdrom_device_info *, int); + int (*select_speed) (struct cdrom_device_info *, int); + int (*select_disc) (struct cdrom_device_info *, int); + int (*get_last_session) (struct cdrom_device_info *, + struct cdrom_multisession *); + int (*get_mcn) (struct cdrom_device_info *, + struct cdrom_mcn *); + /* hard reset device */ + int (*reset) (struct cdrom_device_info *); + /* play stuff */ + int (*audio_ioctl) (struct cdrom_device_info *,unsigned int, void *); + /* dev-specific */ + int (*dev_ioctl) (struct cdrom_device_info *, + unsigned int, unsigned long); +/* driver specifications */ + const int capability; /* capability flags */ + int n_minors; /* number of active minor devices */ }; -/* - * drive geometry parameters - */ -struct ccs_geometry -{ - u_char _r1 : 2; /* reserved */ - u_char page_code : 6; /* page code */ - u_char page_length; /* page length */ - u_char cyl_ub; /* #cyls */ - u_char cyl_mb; - u_char cyl_lb; - u_char heads; /* #heads */ - u_char precomp_cyl_ub; /* precomp start */ - u_char precomp_cyl_mb; - u_char precomp_cyl_lb; - u_char current_cyl_ub; /* reduced current start */ - u_char current_cyl_mb; - u_char current_cyl_lb; - u_short step_rate; /* stepping motor rate */ - u_char landing_cyl_ub; /* landing zone */ - u_char landing_cyl_mb; - u_char landing_cyl_lb; - u_char _r2; - u_char _r3; - u_char _r4; -}; +/* the general file operations structure: */ +extern struct file_operations cdrom_fops; -/* - * cache parameters - */ -struct ccs_cache -{ - u_char _r1 : 2; /* reserved */ - u_char page_code : 6; /* page code */ - u_char page_length; /* page length */ - u_char mode; /* cache control byte */ - u_char threshold; /* prefetch threshold */ - u_char max_prefetch; /* maximum prefetch size */ - u_char max_multiplier; /* maximum prefetch multiplier */ - u_char min_prefetch; /* minimum prefetch size */ - u_char min_multiplier; /* minimum prefetch multiplier */ - u_char _r2[8]; -}; +extern int register_cdrom(struct cdrom_device_info *cdi); +extern int unregister_cdrom(struct cdrom_device_info *cdi); +#endif /* End of kernel only stuff */ #endif _LINUX_CDROM_H -/*==========================================================================*/ -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-indent-level: 8 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -8 - * c-argdecl-indent: 8 - * c-label-offset: -8 - * c-continued-statement-offset: 8 - * c-continued-brace-offset: 0 - * End: - */ diff --git a/include/linux/cdu31a.h b/include/linux/cdu31a.h index 269e7b614..e69de29bb 100644 --- a/include/linux/cdu31a.h +++ b/include/linux/cdu31a.h @@ -1,389 +0,0 @@ -/* - * Definitions for a Sony interface CDROM drive. - * - * Corey Minyard (minyard@wf-rch.cirr.com) - * - * Copyright (C) 1993 Corey Minyard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * General defines. - */ -#define SONY_XA_DISK_TYPE 0x20 - -/* - * Offsets (from the base address) and bits for the various write registers - * of the drive. - */ -#define SONY_CMD_REG_OFFSET 0 -#define SONY_PARAM_REG_OFFSET 1 -#define SONY_WRITE_REG_OFFSET 2 -#define SONY_CONTROL_REG_OFFSET 3 -# define SONY_ATTN_CLR_BIT 0x01 -# define SONY_RES_RDY_CLR_BIT 0x02 -# define SONY_DATA_RDY_CLR_BIT 0x04 -# define SONY_ATTN_INT_EN_BIT 0x08 -# define SONY_RES_RDY_INT_EN_BIT 0x10 -# define SONY_DATA_RDY_INT_EN_BIT 0x20 -# define SONY_PARAM_CLR_BIT 0x40 -# define SONY_DRIVE_RESET_BIT 0x80 - -/* - * Offsets (from the base address) and bits for the various read registers - * of the drive. - */ -#define SONY_STATUS_REG_OFFSET 0 -# define SONY_ATTN_BIT 0x01 -# define SONY_RES_RDY_BIT 0x02 -# define SONY_DATA_RDY_BIT 0x04 -# define SONY_ATTN_INT_ST_BIT 0x08 -# define SONY_RES_RDY_INT_ST_BIT 0x10 -# define SONY_DATA_RDY_INT_ST_BIT 0x20 -# define SONY_DATA_REQUEST_BIT 0x40 -# define SONY_BUSY_BIT 0x80 -#define SONY_RESULT_REG_OFFSET 1 -#define SONY_READ_REG_OFFSET 2 -#define SONY_FIFOST_REG_OFFSET 3 -# define SONY_PARAM_WRITE_RDY_BIT 0x01 -# define SONY_PARAM_REG_EMPTY_BIT 0x02 -# define SONY_RES_REG_NOT_EMP_BIT 0x04 -# define SONY_RES_REG_FULL_BIT 0x08 - -#define LOG_START_OFFSET 150 /* Offset of first logical sector */ - -#define SONY_DETECT_TIMEOUT (8*HZ/10) /* Maximum amount of time - that drive detection code - will wait for response - from drive (in 1/100th's - of seconds). */ - -#define SONY_JIFFIES_TIMEOUT 1000 /* Maximum number of times the - drive will wait/try for an - operation */ -#define SONY_RESET_TIMEOUT 100 /* Maximum number of times the - drive will wait/try a reset - operation */ -#define SONY_READY_RETRIES 20000 /* How many times to retry a - spin waiting for a register - to come ready */ - -#define MAX_CDU31A_RETRIES 3 /* How many times to retry an - operation */ - -/* Commands to request or set drive control parameters and disc information */ -#define SONY_REQ_DRIVE_CONFIG_CMD 0x00 /* Returns s_sony_drive_config */ -#define SONY_REQ_DRIVE_MODE_CMD 0x01 -#define SONY_REQ_DRIVE_PARAM_CMD 0x02 -#define SONY_REQ_MECH_STATUS_CMD 0x03 -#define SONY_REQ_AUDIO_STATUS_CMD 0x04 -#define SONY_SET_DRIVE_PARAM_CMD 0x10 -#define SONY_REQ_TOC_DATA_CMD 0x20 /* Returns s_sony_toc */ -#define SONY_REQ_SUBCODE_ADDRESS_CMD 0x21 /* Returns s_sony_subcode */ -#define SONY_REQ_UPC_EAN_CMD 0x22 -#define SONY_REQ_ISRC_CMD 0x23 -#define SONY_REQ_TOC_DATA_SPEC_CMD 0x24 - -/* Commands to request information from the drive */ -#define SONY_READ_TOC_CMD 0x30 -#define SONY_SEEK_CMD 0x31 -#define SONY_READ_CMD 0x32 -#define SONY_READ_BLKERR_STAT_CMD 0x34 -#define SONY_ABORT_CMD 0x35 -#define SONY_READ_TOC_SPEC_CMD 0x36 - -/* Commands to control audio */ -#define SONY_AUDIO_PLAYBACK_CMD 0x40 -#define SONY_AUDIO_STOP_CMD 0x41 -#define SONY_AUDIO_SCAN_CMD 0x42 - -/* Miscellaneous control commands */ -#define SONY_EJECT_CMD 0x50 -#define SONY_SPIN_UP_CMD 0x51 -#define SONY_SPIN_DOWN_CMD 0x52 - -/* Diagnostic commands */ -#define SONY_WRITE_BUFFER_CMD 0x60 -#define SONY_READ_BUFFER_CMD 0x61 -#define SONY_DIAGNOSTICS_CMD 0x62 - - -/* - * The following are command parameters for the set drive parameter command - */ -#define SONY_SD_DECODE_PARAM 0x00 -#define SONY_SD_INTERFACE_PARAM 0x01 -#define SONY_SD_BUFFERING_PARAM 0x02 -#define SONY_SD_AUDIO_PARAM 0x03 -#define SONY_SD_AUDIO_VOLUME 0x04 -#define SONY_SD_MECH_CONTROL 0x05 -#define SONY_SD_AUTO_SPIN_DOWN_TIME 0x06 - -/* - * The following are parameter bits for the mechanical control command - */ -#define SONY_AUTO_SPIN_UP_BIT 0x01 -#define SONY_AUTO_EJECT_BIT 0x02 -#define SONY_DOUBLE_SPEED_BIT 0x04 - -/* - * The following extract information from the drive configuration about - * the drive itself. - */ -#define SONY_HWC_GET_LOAD_MECH(c) (c.hw_config[0] & 0x03) -#define SONY_HWC_EJECT(c) (c.hw_config[0] & 0x04) -#define SONY_HWC_LED_SUPPORT(c) (c.hw_config[0] & 0x08) -#define SONY_HWC_DOUBLE_SPEED(c) (c.hw_config[0] & 0x10) -#define SONY_HWC_GET_BUF_MEM_SIZE(c) ((c.hw_config[0] & 0xc0) >> 6) -#define SONY_HWC_AUDIO_PLAYBACK(c) (c.hw_config[1] & 0x01) -#define SONY_HWC_ELECTRIC_VOLUME(c) (c.hw_config[1] & 0x02) -#define SONY_HWC_ELECTRIC_VOLUME_CTL(c) (c.hw_config[1] & 0x04) - -#define SONY_HWC_CADDY_LOAD_MECH 0x00 -#define SONY_HWC_TRAY_LOAD_MECH 0x01 -#define SONY_HWC_POPUP_LOAD_MECH 0x02 -#define SONY_HWC_UNKWN_LOAD_MECH 0x03 - -#define SONY_HWC_8KB_BUFFER 0x00 -#define SONY_HWC_32KB_BUFFER 0x01 -#define SONY_HWC_64KB_BUFFER 0x02 -#define SONY_HWC_UNKWN_BUFFER 0x03 - -/* - * This is the complete status returned from the drive configuration request - * command. - */ -struct s_sony_drive_config -{ - unsigned char exec_status[2]; - char vendor_id[8]; - char product_id[16]; - char product_rev_level[8]; - unsigned char hw_config[2]; -}; - -/* The following is returned from the request subcode address command */ -struct s_sony_subcode -{ - unsigned char exec_status[2]; - unsigned char address :4; - unsigned char control :4; - unsigned char track_num; - unsigned char index_num; - unsigned char rel_msf[3]; - unsigned char reserved1; - unsigned char abs_msf[3]; -}; - -#define MAX_TRACKS 100 /* The maximum tracks a disk may have. */ -/* - * The following is returned from the request TOC (Table Of Contents) command. - * (last_track_num-first_track_num+1) values are valid in tracks. - */ -struct s_sony_toc -{ - unsigned char exec_status[2]; - unsigned char address0 :4; - unsigned char control0 :4; - unsigned char point0; - unsigned char first_track_num; - unsigned char disk_type; - unsigned char dummy0; - unsigned char address1 :4; - unsigned char control1 :4; - unsigned char point1; - unsigned char last_track_num; - unsigned char dummy1; - unsigned char dummy2; - unsigned char address2 :4; - unsigned char control2 :4; - unsigned char point2; - unsigned char lead_out_start_msf[3]; - struct - { - unsigned char address :4; - unsigned char control :4; - unsigned char track; - unsigned char track_start_msf[3]; - } tracks[MAX_TRACKS]; - - unsigned int lead_out_start_lba; -}; - -struct s_sony_session_toc -{ - unsigned char exec_status[2]; - unsigned char session_number; - unsigned char address0 :4; - unsigned char control0 :4; - unsigned char point0; - unsigned char first_track_num; - unsigned char disk_type; - unsigned char dummy0; - unsigned char address1 :4; - unsigned char control1 :4; - unsigned char point1; - unsigned char last_track_num; - unsigned char dummy1; - unsigned char dummy2; - unsigned char address2 :4; - unsigned char control2 :4; - unsigned char point2; - unsigned char lead_out_start_msf[3]; - unsigned char addressb0 :4; - unsigned char controlb0 :4; - unsigned char pointb0; - unsigned char next_poss_prog_area_msf[3]; - unsigned char num_mode_5_pointers; - unsigned char max_start_outer_leadout_msf[3]; - unsigned char addressb1 :4; - unsigned char controlb1 :4; - unsigned char pointb1; - unsigned char dummyb0_1[4]; - unsigned char num_skip_interval_pointers; - unsigned char num_skip_track_assignments; - unsigned char dummyb0_2; - unsigned char addressb2 :4; - unsigned char controlb2 :4; - unsigned char pointb2; - unsigned char tracksb2[7]; - unsigned char addressb3 :4; - unsigned char controlb3 :4; - unsigned char pointb3; - unsigned char tracksb3[7]; - unsigned char addressb4 :4; - unsigned char controlb4 :4; - unsigned char pointb4; - unsigned char tracksb4[7]; - unsigned char addressc0 :4; - unsigned char controlc0 :4; - unsigned char pointc0; - unsigned char dummyc0[7]; - struct - { - unsigned char address :4; - unsigned char control :4; - unsigned char track; - unsigned char track_start_msf[3]; - } tracks[MAX_TRACKS]; - - unsigned int start_track_lba; - unsigned int lead_out_start_lba; -}; - - -/* - * The following are errors returned from the drive. - */ - -/* Command error group */ -#define SONY_ILL_CMD_ERR 0x10 -#define SONY_ILL_PARAM_ERR 0x11 - -/* Mechanism group */ -#define SONY_NOT_LOAD_ERR 0x20 -#define SONY_NO_DISK_ERR 0x21 -#define SONY_NOT_SPIN_ERR 0x22 -#define SONY_SPIN_ERR 0x23 -#define SONY_SPINDLE_SERVO_ERR 0x25 -#define SONY_FOCUS_SERVO_ERR 0x26 -#define SONY_EJECT_MECH_ERR 0x29 -#define SONY_AUDIO_PLAYING_ERR 0x2a -#define SONY_EMERGENCY_EJECT_ERR 0x2c - -/* Seek error group */ -#define SONY_FOCUS_ERR 0x30 -#define SONY_FRAME_SYNC_ERR 0x31 -#define SONY_SUBCODE_ADDR_ERR 0x32 -#define SONY_BLOCK_SYNC_ERR 0x33 -#define SONY_HEADER_ADDR_ERR 0x34 - -/* Read error group */ -#define SONY_ILL_TRACK_R_ERR 0x40 -#define SONY_MODE_0_R_ERR 0x41 -#define SONY_ILL_MODE_R_ERR 0x42 -#define SONY_ILL_BLOCK_SIZE_R_ERR 0x43 -#define SONY_MODE_R_ERR 0x44 -#define SONY_FORM_R_ERR 0x45 -#define SONY_LEAD_OUT_R_ERR 0x46 -#define SONY_BUFFER_OVERRUN_R_ERR 0x47 - -/* Data error group */ -#define SONY_UNREC_CIRC_ERR 0x53 -#define SONY_UNREC_LECC_ERR 0x57 - -/* Subcode error group */ -#define SONY_NO_TOC_ERR 0x60 -#define SONY_SUBCODE_DATA_NVAL_ERR 0x61 -#define SONY_FOCUS_ON_TOC_READ_ERR 0x63 -#define SONY_FRAME_SYNC_ON_TOC_READ_ERR 0x64 -#define SONY_TOC_DATA_ERR 0x65 - -/* Hardware failure group */ -#define SONY_HW_FAILURE_ERR 0x70 -#define SONY_LEAD_IN_A_ERR 0x91 -#define SONY_LEAD_OUT_A_ERR 0x92 -#define SONY_DATA_TRACK_A_ERR 0x93 - -/* - * The following are returned from the Read With Block Error Status command. - * They are not errors but information (Errors from the 0x5x group above may - * also be returned - */ -#define SONY_NO_CIRC_ERR_BLK_STAT 0x50 -#define SONY_NO_LECC_ERR_BLK_STAT 0x54 -#define SONY_RECOV_LECC_ERR_BLK_STAT 0x55 -#define SONY_NO_ERR_DETECTION_STAT 0x59 - -/* - * The following is not an error returned by the drive, but by the code - * that talks to the drive. It is returned because of a timeout. - */ -#define SONY_TIMEOUT_OP_ERR 0x01 -#define SONY_SIGNAL_OP_ERR 0x02 -#define SONY_BAD_DATA_ERR 0x03 - - -/* - * The following are attention code for asynchronous events from the drive. - */ - -/* Standard attention group */ -#define SONY_EMER_EJECT_ATTN 0x2c -#define SONY_HW_FAILURE_ATTN 0x70 -#define SONY_MECH_LOADED_ATTN 0x80 -#define SONY_EJECT_PUSHED_ATTN 0x81 - -/* Audio attention group */ -#define SONY_AUDIO_PLAY_DONE_ATTN 0x90 -#define SONY_LEAD_IN_ERR_ATTN 0x91 -#define SONY_LEAD_OUT_ERR_ATTN 0x92 -#define SONY_DATA_TRACK_ERR_ATTN 0x93 -#define SONY_AUDIO_PLAYBACK_ERR_ATTN 0x94 - -/* Auto spin up group */ -#define SONY_SPIN_UP_COMPLETE_ATTN 0x24 -#define SONY_SPINDLE_SERVO_ERR_ATTN 0x25 -#define SONY_FOCUS_SERVO_ERR_ATTN 0x26 -#define SONY_TOC_READ_DONE_ATTN 0x62 -#define SONY_FOCUS_ON_TOC_READ_ERR_ATTN 0x63 -#define SONY_SYNC_ON_TOC_READ_ERR_ATTN 0x65 - -/* Auto eject group */ -#define SONY_SPIN_DOWN_COMPLETE_ATTN 0x27 -#define SONY_EJECT_COMPLETE_ATTN 0x28 -#define SONY_EJECT_MECH_ERR_ATTN 0x29 diff --git a/include/linux/cm206.h b/include/linux/cm206.h index 671a46f31..e69de29bb 100644 --- a/include/linux/cm206.h +++ b/include/linux/cm206.h @@ -1,177 +0,0 @@ -/* cm206.h Header file for cm206.c. - Copyright (c) 1995 David van Leeuwen -*/ - -#ifndef LINUX_CM206_H -#define LINUX_CM206_H - -#include <linux/ioctl.h> - -/* First, the cm260 stuff */ -/* The ports and irq used. Although CM206_BASE and CM206_IRQ are defined - below, the values are not used unless autoprobing is turned off and - no LILO boot options or module command line options are given. Change - these values to your own as last resort if autoprobing and options - don't work. */ - -#define CM206_BASE 0x340 -#define CM206_IRQ 11 - -#define r_data_status (cm206_base) -#define r_uart_receive (cm206_base+0x2) -#define r_fifo_output_buffer (cm206_base+0x4) -#define r_line_status (cm206_base+0x6) -#define r_data_control (cm206_base+0x8) -#define r_uart_transmit (cm206_base+0xa) -#define r_test_clock (cm206_base+0xc) -#define r_test_control (cm206_base+0xe) - -/* the data_status flags */ -#define ds_ram_size 0x4000 -#define ds_toc_ready 0x2000 -#define ds_fifo_empty 0x1000 -#define ds_sync_error 0x800 -#define ds_crc_error 0x400 -#define ds_data_error 0x200 -#define ds_fifo_overflow 0x100 -#define ds_data_ready 0x80 - -/* the line_status flags */ -#define ls_attention 0x10 -#define ls_parity_error 0x8 -#define ls_overrun 0x4 -#define ls_receive_buffer_full 0x2 -#define ls_transmitter_buffer_empty 0x1 - -/* the data control register flags */ -#define dc_read_q_channel 0x4000 -#define dc_mask_sync_error 0x2000 -#define dc_toc_enable 0x1000 -#define dc_no_stop_on_error 0x800 -#define dc_break 0x400 -#define dc_initialize 0x200 -#define dc_mask_transmit_ready 0x100 -#define dc_flag_enable 0x80 - -/* Define the default data control register flags here */ -#define dc_normal (dc_mask_sync_error | dc_no_stop_on_error | \ - dc_mask_transmit_ready) - -/* now some constants related to the cm206 */ -/* another drive status byte, echoed by the cm206 on most commands */ - -#define dsb_error_condition 0x1 -#define dsb_play_in_progress 0x4 -#define dsb_possible_media_change 0x8 -#define dsb_disc_present 0x10 -#define dsb_drive_not_ready 0x20 -#define dsb_tray_locked 0x40 -#define dsb_tray_not_closed 0x80 - -#define dsb_not_useful (dsb_drive_not_ready | dsb_tray_not_closed) - -/* the cm206 command set */ - -#define c_close_tray 0 -#define c_lock_tray 0x01 -#define c_unlock_tray 0x04 -#define c_open_tray 0x05 -#define c_seek 0x10 -#define c_read_data 0x20 -#define c_force_1x 0x21 -#define c_force_2x 0x22 -#define c_auto_mode 0x23 -#define c_play 0x30 -#define c_set_audio_mode 0x31 -#define c_read_current_q 0x41 -#define c_stream_q 0x42 -#define c_drive_status 0x50 -#define c_disc_status 0x51 -#define c_audio_status 0x52 -#define c_drive_configuration 0x53 -#define c_read_upc 0x60 -#define c_stop 0x70 -#define c_calc_checksum 0xe5 - -#define c_gimme 0xf8 - -/* finally, the (error) condition that the drive can be in * - * OK, this is not always an error, but let's prefix it with e_ */ - -#define e_none 0 -#define e_illegal_command 0x01 -#define e_sync 0x02 -#define e_seek 0x03 -#define e_parity 0x04 -#define e_focus 0x05 -#define e_header_sync 0x06 -#define e_code_incompatibility 0x07 -#define e_reset_done 0x08 -#define e_bad_parameter 0x09 -#define e_radial 0x0a -#define e_sub_code 0x0b -#define e_no_data_track 0x0c -#define e_scan 0x0d -#define e_tray_open 0x0f -#define e_no_disc 0x10 -#define e_tray stalled 0x11 - -/* drive configuration masks */ - -#define dcf_revision_code 0x7 -#define dcf_transfer_rate 0x60 -#define dcf_motorized_tray 0x80 - -/* disc status byte */ - -#define cds_multi_session 0x2 -#define cds_all_audio 0x8 -#define cds_xa_mode 0xf0 - -/* finally some ioctls for the driver */ - -#define CM206CTL_GET_STAT _IO( 0x20, 0 ) -#define CM206CTL_GET_LAST_STAT _IO( 0x20, 1 ) - -/* for kernel 1.2.n */ -#if !defined(CDROM_GET_UPC) -#define CDROM_GET_UPC _IO( 'S', 0x11 ) -#define CDROMRESET _IO( 'S', 0x12 ) -#endif - -#ifdef STATISTICS - -/* This is an ugly way to guarantee that the names of the statistics - * are the same in the code and in the diagnostics program. */ - -#ifdef __KERNEL__ -#define x(a) st_ ## a -#define y enum -#else -#define x(a) #a -#define y char * stats_name[] = -#endif - -y {x(interrupt), x(data_ready), x(fifo_overflow), x(data_error), - x(crc_error), x(sync_error), x(lost_intr), x(echo), - x(write_timeout), x(receive_timeout), x(read_timeout), - x(dsb_timeout), x(stop_0xff), x(back_read_timeout), - x(sector_transferred), x(read_restarted), x(read_background), - x(bh), x(open), x(ioctl_multisession), x(attention) -#ifdef __KERNEL__ - , x(last_entry) -#endif - }; - -#ifdef __KERNEL__ -#define NR_STATS st_last_entry -#else -#define NR_STATS (sizeof(stats_name)/sizeof(char*)) -#endif - -#undef y -#undef x - -#endif STATISTICS - -#endif LINUX_CM206_H diff --git a/include/linux/console.h b/include/linux/console.h index 16f1754ec..fc5cd4b2d 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -62,36 +62,40 @@ extern struct consw *conswitchp; struct tty_struct; int tioclinux(struct tty_struct *tty, unsigned long arg); -/* The interface for /dev/console(s) and printk output */ +/* + * Array of consoles built from command line options (console=) + */ +struct console_cmdline +{ + char name[8]; /* Name of the driver */ + int index; /* Minor dev. to use */ + char *options; /* Options for the driver */ +}; +#define MAX_CMDLINECONSOLES 8 +extern struct console_cmdline console_list[MAX_CMDLINECONSOLES]; + +/* + * The interface for a console, or any other device that + * wants to capture console messages (printer driver?) + */ + +#define CON_PRINTBUFFER (1) +#define CON_FIRST (2) +#define CON_ENABLED (4) struct console { - /* - * This function should not return before the string is written. - */ - void (*write)(const char*, unsigned); - - /* To unblank the console in case of panic */ - void (*unblank)(void); - - /* - * Only the console that was registered last with wait_key != - * NULL will be used. This blocks until there is a character - * to give back, it does not schedule. - */ - void (*wait_key)(void); - - /* - * Return the device to use when opening /dev/console. Only the - * last registered console will do. - */ - int (*device)(void); - - /* - * For a linked list of consoles for multiple output. Any console - * not at the head of the list is used only for output. - */ - struct console *next; + char name[8]; + void (*write)(struct console *, const char *, unsigned); + int (*read)(struct console *, const char *, unsigned); + kdev_t (*device)(struct console *); + int (*wait_key)(struct console *); + void (*unblank)(void); + int (*setup)(struct console *, char *); + short flags; + short index; + int cflag; + struct console *next; }; extern void register_console(struct console *); diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 456596073..53a2ce3e3 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -1,6 +1,8 @@ #ifndef __LINUX_DCACHE_H #define __LINUX_DCACHE_H +#ifdef __KERNEL__ + /* * linux/include/linux/dcache.h * @@ -25,14 +27,14 @@ struct qstr { #define init_name_hash() 0 /* partial hash update function. Assume roughly 4 bits per character */ -static inline unsigned long partial_name_hash(unsigned char c, unsigned long prevhash) +static __inline__ unsigned long partial_name_hash(unsigned char c, unsigned long prevhash) { prevhash = (prevhash << 4) | (prevhash >> (8*sizeof(unsigned long)-4)); return prevhash ^ c; } /* Finally: cut down the number of bits to a int value (and try to avoid losing bits) */ -static inline unsigned long end_name_hash(unsigned long hash) +static __inline__ unsigned long end_name_hash(unsigned long hash) { if (sizeof(hash) > sizeof(unsigned int)) hash += hash >> 4*sizeof(hash); @@ -40,7 +42,7 @@ static inline unsigned long end_name_hash(unsigned long hash) } /* Compute the hash for a name string. */ -static inline unsigned int full_name_hash(const char * name, unsigned int len) +static __inline__ unsigned int full_name_hash(const char * name, unsigned int len) { unsigned long hash = init_name_hash(); while (len--) @@ -102,7 +104,7 @@ struct dentry_operations { * to invalidate a dentry for some reason (NFS * timeouts or autofs deletes). */ -static inline void d_drop(struct dentry * dentry) +static __inline__ void d_drop(struct dentry * dentry) { list_del(&dentry->d_hash); INIT_LIST_HEAD(&dentry->d_hash); @@ -152,7 +154,7 @@ extern int d_validate(struct dentry *dentry, struct dentry *dparent, extern char * d_path(struct dentry * entry, char * buf, int buflen); /* Allocation counts.. */ -static inline struct dentry * dget(struct dentry *dentry) +static __inline__ struct dentry * dget(struct dentry *dentry) { if (dentry) dentry->d_count++; @@ -161,4 +163,6 @@ static inline struct dentry * dget(struct dentry *dentry) extern void dput(struct dentry *); +#endif /* __KERNEL__ */ + #endif /* __LINUX_DCACHE_H */ diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index e0a3ab3c5..c0384391d 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -38,6 +38,8 @@ extern void eth_header_cache_update(struct hh_cache *hh, struct device *dev, extern int eth_header_cache(struct dst_entry *dst, struct neighbour *neigh, struct hh_cache *hh); +extern int eth_header_parse(struct sk_buff *skb, + unsigned char *haddr); extern struct device * init_etherdev(struct device *, int); #ifdef CONFIG_IP_ROUTER diff --git a/include/linux/fs.h b/include/linux/fs.h index 7f93af7fa..28b6f1e50 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -551,7 +551,7 @@ struct file_operations { ssize_t (*read) (struct file *, char *, size_t, loff_t *); ssize_t (*write) (struct file *, const char *, size_t, loff_t *); int (*readdir) (struct file *, void *, filldir_t); - unsigned int (*poll) (struct file *, poll_table *); + unsigned int (*poll) (struct file *, struct poll_table_struct *); int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); int (*mmap) (struct file *, struct vm_area_struct *); int (*open) (struct inode *, struct file *); diff --git a/include/linux/ftape.h b/include/linux/ftape.h index 36ade3437..a26f2e51b 100644 --- a/include/linux/ftape.h +++ b/include/linux/ftape.h @@ -159,7 +159,7 @@ typedef union { # undef CONFIG_FT_FDC_DMA # define CONFIG_FT_FDC_DMA 3 # endif -#elif CONIFG_FT_MACH2 == 1 /* CONFIG_FT_PROBE_FC10 == 1 */ +#elif CONFIG_FT_MACH2 == 1 /* CONFIG_FT_PROBE_FC10 == 1 */ # if CONFIG_FT_FDC_BASE == 0 # undef CONFIG_FT_FDC_BASE # define CONFIG_FT_FDC_BASE 0x1E0 diff --git a/include/linux/gscd.h b/include/linux/gscd.h index fccc742a5..e69de29bb 100644 --- a/include/linux/gscd.h +++ b/include/linux/gscd.h @@ -1,110 +0,0 @@ -/* - * Definitions for a GoldStar R420 CD-ROM interface - * - * Copyright (C) 1995 Oliver Raupach <raupach@nwfs1.rz.fh-hannover.de> - * Eberhard Moenkeberg <emoenke@gwdg.de> - * - * Published under the GPL. - * - */ - - -/* The Interface Card default address is 0x340. This will work for most - applications. Address selection is accomplished by jumpers PN801-1 to - PN801-4 on the GoldStar Interface Card. - Appropriate settings are: 0x300, 0x310, 0x320, 0x330, 0x340, 0x350, 0x360 - 0x370, 0x380, 0x390, 0x3A0, 0x3B0, 0x3C0, 0x3D0, 0x3E0, 0x3F0 */ - -/* insert here the I/O port address */ -#define GSCD_BASE_ADDR 0x340 - -/* change this to set the dma-channel */ -#define GSCD_DMA_CHANNEL 3 /* not used */ - -/************** nothing to set up below here *********************/ - -/* port access macro */ -#define GSCDPORT(x) (gscd_port + (x)) - -/* - * commands - * the lower nibble holds the command length - */ -#define CMD_STATUS 0x01 -#define CMD_READSUBQ 0x02 /* 1: ?, 2: UPC, 5: ? */ -#define CMD_SEEK 0x05 /* read_mode M-S-F */ -#define CMD_READ 0x07 /* read_mode M-S-F nsec_h nsec_l */ -#define CMD_RESET 0x11 -#define CMD_SETMODE 0x15 -#define CMD_PLAY 0x17 /* M-S-F M-S-F */ -#define CMD_LOCK_CTL 0x22 /* 0: unlock, 1: lock */ -#define CMD_IDENT 0x31 -#define CMD_SETSPEED 0x32 /* 0: auto */ /* ??? */ -#define CMD_GETMODE 0x41 -#define CMD_PAUSE 0x51 -#define CMD_READTOC 0x61 -#define CMD_DISKINFO 0x71 -#define CMD_TRAY_CTL 0x81 - -/* - * disk_state: - */ -#define ST_PLAYING 0x80 -#define ST_UNLOCKED 0x40 -#define ST_NO_DISK 0x20 -#define ST_DOOR_OPEN 0x10 -#define ST_x08 0x08 -#define ST_x04 0x04 -#define ST_INVALID 0x02 -#define ST_x01 0x01 - -/* - * cmd_type: - */ -#define TYPE_INFO 0x01 -#define TYPE_DATA 0x02 - -/* - * read_mode: - */ -#define MOD_POLLED 0x80 -#define MOD_x08 0x08 -#define MOD_RAW 0x04 - -#define READ_DATA(port, buf, nr) insb(port, buf, nr) - -#define SET_TIMER(func, jifs) \ - ((timer_table[GSCD_TIMER].expires = jiffies + jifs), \ - (timer_table[GSCD_TIMER].fn = func), \ - (timer_active |= 1<<GSCD_TIMER)) - -#define CLEAR_TIMER timer_active &= ~(1<<GSCD_TIMER) - -#define MAX_TRACKS 104 - -struct msf { - unsigned char min; - unsigned char sec; - unsigned char frame; -}; - -struct gscd_Play_msf { - struct msf start; - struct msf end; -}; - -struct gscd_DiskInfo { - unsigned char first; - unsigned char last; - struct msf diskLength; - struct msf firstTrack; -}; - -struct gscd_Toc { - unsigned char ctrl_addr; - unsigned char track; - unsigned char pointIndex; - struct msf trackTime; - struct msf diskTime; -}; - diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h index 80fbfc79b..cedbd1e2c 100644 --- a/include/linux/hdreg.h +++ b/include/linux/hdreg.h @@ -73,7 +73,8 @@ #define ABRT_ERR 0x04 /* Command aborted */ #define ID_ERR 0x10 /* ID field not found */ #define ECC_ERR 0x40 /* Uncorrectable ECC error */ -#define BBD_ERR 0x80 /* block marked bad */ +#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */ +#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */ struct hd_geometry { unsigned char heads; @@ -149,11 +150,28 @@ struct hd_driveid { unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */ unsigned short eide_pio; /* min cycle time (ns), no IORDY */ unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */ - unsigned short reserved69; /* reserved (word 69) */ - unsigned short reserved70; /* reserved (word 70) */ - /* unsigned short reservedxx[57];*/ /* reserved (words 71-127) */ - /* unsigned short vendor7 [32];*/ /* vendor unique (words 128-159) */ - /* unsigned short reservedyy[96];*/ /* reserved (words 160-255) */ + unsigned short word69; + unsigned short word70; + /* HDIO_GET_IDENTITY currently returns only words 0 through 70 */ + unsigned short word71; + unsigned short word72; + unsigned short word73; + unsigned short word74; + unsigned short word75; + unsigned short word76; + unsigned short word77; + unsigned short word78; + unsigned short word79; + unsigned short word80; + unsigned short word81; + unsigned short word82; + unsigned short word83; + unsigned short word84; + unsigned short word85; + unsigned short word86; + unsigned short word87; + unsigned short dma_ultra; + unsigned short reserved[167]; }; /* diff --git a/include/linux/hfmodem.h b/include/linux/hfmodem.h index 739dc5acd..7b35f1169 100644 --- a/include/linux/hfmodem.h +++ b/include/linux/hfmodem.h @@ -100,6 +100,7 @@ struct hfmodem_ioctl_sample_params { /* --------------------------------------------------------------------- */ #ifdef __KERNEL__ +#include <linux/parport.h> #define DMA_MODE_AUTOINIT 0x10 @@ -133,6 +134,7 @@ struct hfmodem_state { unsigned int pariobase; unsigned int midiiobase; unsigned int flags; + struct pardevice *pardev; } ptt_out; struct { diff --git a/include/linux/igmp.h b/include/linux/igmp.h index b4a16b565..8be2d1b87 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h @@ -38,7 +38,7 @@ struct igmphdr #define IGMP_PIM 0x14 /* PIM routing */ #define IGMP_TRACE 0x15 #define IGMP_HOST_NEW_MEMBERSHIP_REPORT 0x16 /* New version of 0x11 */ -#define IGMP_HOST_LEAVE_MESSAGE 0x17 /* An extra BSD seems to send */ +#define IGMP_HOST_LEAVE_MESSAGE 0x17 #define IGMP_MTRACE_RESP 0x1e #define IGMP_MTRACE 0x1f @@ -54,9 +54,6 @@ struct igmphdr #define IGMP_SLEEPING_MEMBER 0x04 #define IGMP_AWAKENING_MEMBER 0x05 -#define IGMP_OLD_ROUTER 0x00 -#define IGMP_NEW_ROUTER 0x01 - #define IGMP_MINLEN 8 #define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ @@ -65,7 +62,7 @@ struct igmphdr #define IGMP_TIMER_SCALE 10 /* denotes that the igmphdr->timer field */ /* specifies time in 10th of seconds */ -#define IGMP_AGE_THRESHOLD 540 /* If this host don't hear any IGMP V1 */ +#define IGMP_AGE_THRESHOLD 400 /* If this host don't hear any IGMP V1 */ /* message in this period of time, */ /* revert to IGMP v2 router. */ @@ -79,40 +76,53 @@ struct igmphdr */ #ifdef __KERNEL__ + +/* ip_mc_socklist is real list now. Speed is not argument; + this list never used in fast path code + */ + struct ip_mc_socklist { - unsigned long multiaddr[IP_MAX_MEMBERSHIPS]; /* This is a speed trade off */ - struct device *multidev[IP_MAX_MEMBERSHIPS]; + struct ip_mc_socklist *next; + int count; + struct ip_mreqn multi; }; struct ip_mc_list { - struct device *interface; - unsigned long multiaddr; - struct ip_mc_list *next; - struct timer_list timer; - int users; - char tm_running; - char reporter; + struct in_device *interface; + unsigned long multiaddr; + struct ip_mc_list *next; + struct timer_list timer; + int users; + char tm_running; + char reporter; + char unsolicit_count; }; -struct ip_router_info +extern __inline__ int ip_check_mc(struct device *dev, u32 mc_addr) { - struct device *dev; - int type; /* type of router which is querier on this interface */ - int time; /* # of slow timeouts since last old query */ - struct timer_list timer; - struct ip_router_info *next; -}; - -extern struct ip_mc_list *ip_mc_head; + struct in_device *in_dev = dev->ip_ptr; + struct ip_mc_list *im; + if (in_dev) { + for (im=in_dev->mc_list; im; im=im->next) + if (im->multiaddr == mc_addr) + return 1; + } + return 0; +} extern int igmp_rcv(struct sk_buff *, unsigned short); -extern void ip_mc_drop_device(struct device *dev); -extern int ip_mc_join_group(struct sock *sk, struct device *dev, unsigned long addr); -extern int ip_mc_leave_group(struct sock *sk, struct device *dev,unsigned long addr); +extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr); +extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr); extern void ip_mc_drop_socket(struct sock *sk); extern void ip_mr_init(void); +extern void ip_mc_init_dev(struct in_device *); +extern void ip_mc_destroy_dev(struct in_device *); +extern void ip_mc_up(struct in_device *); +extern void ip_mc_down(struct in_device *); +extern int ip_mc_dec_group(struct in_device *in_dev, u32 addr); +extern void ip_mc_inc_group(struct in_device *in_dev, u32 addr); #endif #endif diff --git a/include/linux/in.h b/include/linux/in.h index 0b77670e1..2cc007a43 100644 --- a/include/linux/in.h +++ b/include/linux/in.h @@ -31,9 +31,13 @@ enum { IPPROTO_PUP = 12, /* PUP protocol */ IPPROTO_UDP = 17, /* User Datagram Protocol */ IPPROTO_IDP = 22, /* XNS IDP protocol */ + IPPROTO_RSVP = 46, /* RSVP protocol */ + IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */ IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */ + IPPROTO_PIM = 103, /* Protocol Independent Multicast */ + IPPROTO_RAW = 255, /* Raw IP packets */ IPPROTO_MAX }; @@ -48,15 +52,15 @@ struct in_addr { #define IP_TTL 2 #define IP_HDRINCL 3 #define IP_OPTIONS 4 -#define IP_LOCALADDR 5 /* Cannot remove; a lot of apps still use it. ANK */ +#define IP_ROUTER_ALERT 5 #define IP_RECVOPTS 6 #define IP_RETOPTS 7 -#define IP_RXINFO 8 -#define IP_TXINFO IP_RXINFO -/* Gated uses it. Remove later or preserve for 4.4BSD compatibility??? */ -#define IP_RECVDSTADDR 9 +#define IP_PKTINFO 8 +#define IP_PKTOPTIONS 9 #define IP_PMTUDISC 10 #define IP_RECVERR 11 +#define IP_RECVTTL 12 +#define IP_RECVTOS 13 /* BSD compatibility */ #define IP_RECVRETOPTS IP_RETOPTS @@ -71,9 +75,6 @@ struct in_addr { #define IP_MULTICAST_LOOP 34 #define IP_ADD_MEMBERSHIP 35 #define IP_DROP_MEMBERSHIP 36 -#define IP_MULTICAST_IFN 37 -#define IP_ADD_MEMBERSHIPN 38 -#define IP_DROP_MEMBERSHIPN 39 /* These need to appear somewhere around here */ #define IP_DEFAULT_MULTICAST_TTL 1 diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 4c71abf5d..a3cabfbc1 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -34,6 +34,7 @@ enum { DIGI_BH, SERIAL_BH, RISCOM8_BH, + SPECIALIX_BH, ESP_BH, NET_BH, IMMEDIATE_BH, diff --git a/include/linux/isp16.h b/include/linux/isp16.h index 9945bb34c..e69de29bb 100644 --- a/include/linux/isp16.h +++ b/include/linux/isp16.h @@ -1,75 +0,0 @@ -/* -- isp16.h - * - * Header for detection and initialisation of cdrom interface (only) on - * ISP16 (MAD16, Mozart) sound card. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* These are the default values */ -#define ISP16_CDROM_TYPE "Sanyo" -#define ISP16_CDROM_IO_BASE 0x340 -#define ISP16_CDROM_IRQ 0 -#define ISP16_CDROM_DMA 0 - -/* Some (Media)Magic */ -/* define types of drive the interface on an ISP16 card may be looking at */ -#define ISP16_DRIVE_X 0x00 -#define ISP16_SONY 0x02 -#define ISP16_PANASONIC0 0x02 -#define ISP16_SANYO0 0x02 -#define ISP16_MITSUMI 0x04 -#define ISP16_PANASONIC1 0x06 -#define ISP16_SANYO1 0x06 -#define ISP16_DRIVE_NOT_USED 0x08 /* not used */ -#define ISP16_DRIVE_SET_MASK 0xF1 /* don't change 0-bit or 4-7-bits*/ -/* ...for port */ -#define ISP16_DRIVE_SET_PORT 0xF8D -/* set io parameters */ -#define ISP16_BASE_340 0x00 -#define ISP16_BASE_330 0x40 -#define ISP16_BASE_360 0x80 -#define ISP16_BASE_320 0xC0 -#define ISP16_IRQ_X 0x00 -#define ISP16_IRQ_5 0x04 /* shouldn't be used to avoid sound card conflicts */ -#define ISP16_IRQ_7 0x08 /* shouldn't be used to avoid sound card conflicts */ -#define ISP16_IRQ_3 0x0C -#define ISP16_IRQ_9 0x10 -#define ISP16_IRQ_10 0x14 -#define ISP16_IRQ_11 0x18 -#define ISP16_DMA_X 0x03 -#define ISP16_DMA_3 0x00 -#define ISP16_DMA_5 0x00 -#define ISP16_DMA_6 0x01 -#define ISP16_DMA_7 0x02 -#define ISP16_IO_SET_MASK 0x20 /* don't change 5-bit */ -/* ...for port */ -#define ISP16_IO_SET_PORT 0xF8E -/* enable the card */ -#define ISP16_C928__ENABLE_PORT 0xF90 /* ISP16 with OPTi 82C928 chip */ -#define ISP16_C929__ENABLE_PORT 0xF91 /* ISP16 with OPTi 82C929 chip */ -#define ISP16_ENABLE_CDROM 0x80 /* seven bit */ - -/* the magic stuff */ -#define ISP16_CTRL_PORT 0xF8F -#define ISP16_C928__CTRL 0xE2 /* ISP16 with OPTi 82C928 chip */ -#define ISP16_C929__CTRL 0xE3 /* ISP16 with OPTi 82C929 chip */ - -#define ISP16_IO_BASE 0xF8D -#define ISP16_IO_SIZE 5 /* ports used from 0xF8D up to 0xF91 */ - -void isp16_setup(char *str, int *ints); -int isp16_init(void); diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 956b0f310..cf21ecf73 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -50,10 +50,6 @@ extern int vsprintf(char *buf, const char *, va_list); extern int session_of_pgrp(int pgrp); -extern int kill_proc(int pid, int sig, int priv); -extern int kill_pg(int pgrp, int sig, int priv); -extern int kill_sl(int sess, int sig, int priv); - asmlinkage int printk(const char * fmt, ...) __attribute__ ((format (printf, 1, 2))); diff --git a/include/linux/limits.h b/include/linux/limits.h index b99a12bc0..5848688e7 100644 --- a/include/linux/limits.h +++ b/include/linux/limits.h @@ -14,4 +14,6 @@ #define PATH_MAX 4095 /* # chars in a path name */ #define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */ +#define RTSIG_MAX 32 + #endif diff --git a/include/linux/list.h b/include/linux/list.h index 00b879310..e77559a68 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -1,6 +1,8 @@ #ifndef _LINUX_LIST_H #define _LINUX_LIST_H +#ifdef __KERNEL__ + /* * Simple doubly linked list implementation. * @@ -28,7 +30,7 @@ struct list_head { * This is only for internal list manipulation where we know * the prev/next entries already! */ -static inline void __list_add(struct list_head * new, +static __inline__ void __list_add(struct list_head * new, struct list_head * prev, struct list_head * next) { @@ -41,7 +43,7 @@ static inline void __list_add(struct list_head * new, /* * Insert a new entry after the specified head.. */ -static inline void list_add(struct list_head *new, struct list_head *head) +static __inline__ void list_add(struct list_head *new, struct list_head *head) { __list_add(new, head, head->next); } @@ -53,18 +55,19 @@ static inline void list_add(struct list_head *new, struct list_head *head) * This is only for internal list manipulation where we know * the prev/next entries already! */ -static inline void __list_del(struct list_head * prev, struct list_head * next) +static __inline__ void __list_del(struct list_head * prev, + struct list_head * next) { next->prev = prev; prev->next = next; } -static inline void list_del(struct list_head *entry) +static __inline__ void list_del(struct list_head *entry) { __list_del(entry->prev, entry->next); } -static inline int list_empty(struct list_head *head) +static __inline__ int list_empty(struct list_head *head) { return head->next == head; } @@ -72,7 +75,7 @@ static inline int list_empty(struct list_head *head) /* * Splice in "list" into "head" */ -static inline void list_splice(struct list_head *list, struct list_head *head) +static __inline__ void list_splice(struct list_head *list, struct list_head *head) { struct list_head *first = list->next; @@ -91,4 +94,6 @@ static inline void list_splice(struct list_head *list, struct list_head *head) #define list_entry(ptr, type, member) \ ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) +#endif /* __KERNEL__ */ + #endif diff --git a/include/linux/major.h b/include/linux/major.h index c561163e6..5fa870474 100644 --- a/include/linux/major.h +++ b/include/linux/major.h @@ -75,6 +75,9 @@ #define MKISS_MAJOR 55 #define DSP56K_MAJOR 55 /* DSP56001 processor device */ +#define SPECIALIX_NORMAL_MAJOR 75 +#define SPECIALIX_CALLOUT_MAJOR 76 + /* * Tests for SCSI devices. */ diff --git a/include/linux/mcd.h b/include/linux/mcd.h index b87d6bbe4..e69de29bb 100644 --- a/include/linux/mcd.h +++ b/include/linux/mcd.h @@ -1,116 +0,0 @@ -/* - * Definitions for a Mitsumi CD-ROM interface - * - * Copyright (C) 1992 Martin Harriss - * - * martin@bdsi.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* *** change this to set the I/O port address */ -#define MCD_BASE_ADDR 0x300 - -/* *** change this to set the interrupt number */ -#define MCD_INTR_NR 11 - -/* *** make the following line uncommented, if you're sure, - * *** all configuration is done */ -/* #define I_WAS_HERE */ - -/* Increase this if you get lots of timeouts */ -#define MCD_STATUS_DELAY 200 - -/* number of times to retry a command before giving up */ -#define MCD_RETRY_ATTEMPTS 5 - -/* port access macro */ -#define MCDPORT(x) (mcd_port + (x)) - -/* status bits */ - -#define MST_CMD_CHECK 0x01 /* command error */ -#define MST_BUSY 0x02 /* now playing */ -#define MST_READ_ERR 0x04 /* read error */ -#define MST_DSK_TYPE 0x08 -#define MST_SERVO_CHECK 0x10 -#define MST_DSK_CHG 0x20 /* disk removed or changed */ -#define MST_READY 0x40 /* disk in the drive */ -#define MST_DOOR_OPEN 0x80 /* door is open */ - -/* flag bits */ - -#define MFL_DATA 0x02 /* data available */ -#define MFL_STATUS 0x04 /* status available */ - -/* commands */ - -#define MCMD_GET_DISK_INFO 0x10 /* read info from disk */ -#define MCMD_GET_Q_CHANNEL 0x20 /* read info from q channel */ -#define MCMD_GET_STATUS 0x40 -#define MCMD_SET_MODE 0x50 -#define MCMD_SOFT_RESET 0x60 -#define MCMD_STOP 0x70 /* stop play */ -#define MCMD_CONFIG_DRIVE 0x90 -#define MCMD_SET_VOLUME 0xAE /* set audio level */ -#define MCMD_PLAY_READ 0xC0 /* play or read data */ -#define MCMD_GET_VERSION 0xDC -#define MCMD_EJECT 0xF6 /* eject (FX drive) */ - -/* borrowed from hd.c */ - -#define READ_DATA(port, buf, nr) \ -insb(port, buf, nr) - -#define SET_TIMER(func, jifs) \ - ((timer_table[MCD_TIMER].expires = jiffies + jifs), \ - (timer_table[MCD_TIMER].fn = func), \ - (timer_active |= 1<<MCD_TIMER)) - -#define CLEAR_TIMER timer_active &= ~(1<<MCD_TIMER) - -#define MAX_TRACKS 104 - -struct msf { - unsigned char min; - unsigned char sec; - unsigned char frame; -}; - -struct mcd_Play_msf { - struct msf start; - struct msf end; -}; - -struct mcd_DiskInfo { - unsigned char first; - unsigned char last; - struct msf diskLength; - struct msf firstTrack; -}; - -struct mcd_Toc { - unsigned char ctrl_addr; - unsigned char track; - unsigned char pointIndex; - struct msf trackTime; - struct msf diskTime; -}; - -#ifndef I_WAS_HERE -#warning You have not edited mcd.h -#warning Perhaps irq and i/o settings are wrong. -#endif diff --git a/include/linux/mcdx.h b/include/linux/mcdx.h index b1b431326..e69de29bb 100644 --- a/include/linux/mcdx.h +++ b/include/linux/mcdx.h @@ -1,184 +0,0 @@ -/* - * Definitions for the Mitsumi CDROM interface - * Copyright (C) 1995 1996 Heiko Schlittermann <heiko@lotte.sax.de> - * VERSION: @VERSION@ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Thanks to - * The Linux Community at all and ... - * Martin Harris (he wrote the first Mitsumi Driver) - * Eberhard Moenkeberg (he gave me much support and the initial kick) - * Bernd Huebner, Ruediger Helsch (Unifix-Software Gmbh, they - * improved the original driver) - * Jon Tombs, Bjorn Ekwall (module support) - * Daniel v. Mosnenck (he sent me the Technical and Programming Reference) - * Gerd Knorr (he lent me his PhotoCD) - * Nils Faerber and Roger E. Wolff (extensively tested the LU portion) - * Andreas Kies (testing the mysterious hang up's) - * ... somebody forgotten? - * Marcin Dalecki - * - */ - -/* - * The following lines are for user configuration - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * {0|1} -- 1 if you want the driver detect your drive, may crash and - * needs a long time to seek. The higher the address the longer the - * seek. - * - * WARNING: AUTOPROBE doesn't work. - */ -#define MCDX_AUTOPROBE 0 - -/* - * Drive specific settings according to the jumpers on the controller - * board(s). - * o MCDX_NDRIVES : number of used entries of the following table - * o MCDX_DRIVEMAP : table of {i/o base, irq} per controller - * - * NOTE: I didn't get a drive at irq 9(2) working. Not even alone. - */ -#if MCDX_AUTOPROBE == 0 - #define MCDX_NDRIVES 1 - #define MCDX_DRIVEMAP { \ - {0x300, 11}, \ - {0x304, 05}, \ - {0x000, 00}, \ - {0x000, 00}, \ - {0x000, 00}, \ - } -#else - #error Autoprobing is not implemented yet. -#endif - -#ifndef MCDX_QUIET -#define MCDX_QUIET 1 -#endif - -#ifndef MCDX_DEBUG -#define MCDX_DEBUG 0 -#endif - -/* *** make the following line uncommented, if you're sure, - * *** all configuration is done */ -/* #define I_WAS_HERE */ -#define I_WAS_HERE /* delete this line, it's for heiko only */ - -/* The name of the device */ -#define MCDX "mcdx" - -/* Flags for DEBUGGING */ -#define INIT 0 -#define MALLOC 0 -#define IOCTL 0 -#define PLAYTRK 0 -#define SUBCHNL 0 -#define TOCHDR 0 -#define MS 0 -#define PLAYMSF 0 -#define READTOC 0 -#define OPENCLOSE 0 -#define HW 0 -#define TALK 0 -#define IRQ 0 -#define XFER 0 -#define REQUEST 0 -#define SLEEP 0 - -/* The following addresses are taken from the Mitsumi Reference - * and describe the possible i/o range for the controller. - */ -#define MCDX_IO_BEGIN ((char*) 0x300) /* first base of i/o addr */ -#define MCDX_IO_END ((char*) 0x3fc) /* last base of i/o addr */ - -/* Per controller 4 bytes i/o are needed. */ -#define MCDX_IO_SIZE 4 - -/* - * Bits - */ - -/* The status byte, returned from every command, set if - * the description is true */ -#define MCDX_RBIT_OPEN 0x80 /* door is open */ -#define MCDX_RBIT_DISKSET 0x40 /* disk set (recognised) */ -#define MCDX_RBIT_CHANGED 0x20 /* disk was changed */ -#define MCDX_RBIT_CHECK 0x10 /* disk rotates, servo is on */ -#define MCDX_RBIT_AUDIOTR 0x08 /* current track is audio */ -#define MCDX_RBIT_RDERR 0x04 /* read error, refer SENSE KEY */ -#define MCDX_RBIT_AUDIOBS 0x02 /* currently playing audio */ -#define MCDX_RBIT_CMDERR 0x01 /* command, param or format error */ - -/* The I/O Register holding the h/w status of the drive, - * can be read at i/o base + 1 */ -#define MCDX_RBIT_DOOR 0x10 /* door is open */ -#define MCDX_RBIT_STEN 0x04 /* if 0, i/o base contains drive status */ -#define MCDX_RBIT_DTEN 0x02 /* if 0, i/o base contains data */ - -/* - * The commands. - */ - -#define OPCODE 1 /* offset of opcode */ -#define MCDX_CMD_REQUEST_TOC 1, 0x10 -#define MCDX_CMD_REQUEST_STATUS 1, 0x40 -#define MCDX_CMD_RESET 1, 0x60 -#define MCDX_CMD_REQUEST_DRIVE_MODE 1, 0xc2 -#define MCDX_CMD_SET_INTERLEAVE 2, 0xc8, 0 -#define MCDX_CMD_DATAMODE_SET 2, 0xa0, 0 - #define MCDX_DATAMODE1 0x01 - #define MCDX_DATAMODE2 0x02 -#define MCDX_CMD_LOCK_DOOR 2, 0xfe, 0 - -#define READ_AHEAD 4 /* 8 Sectors (4K) */ - -/* Useful macros */ -#define e_door(x) ((x) & MCDX_RBIT_OPEN) -#define e_check(x) (~(x) & MCDX_RBIT_CHECK) -#define e_notset(x) (~(x) & MCDX_RBIT_DISKSET) -#define e_changed(x) ((x) & MCDX_RBIT_CHANGED) -#define e_audio(x) ((x) & MCDX_RBIT_AUDIOTR) -#define e_audiobusy(x) ((x) & MCDX_RBIT_AUDIOBS) -#define e_cmderr(x) ((x) & MCDX_RBIT_CMDERR) -#define e_readerr(x) ((x) & MCDX_RBIT_RDERR) - -/** no drive specific */ -#define MCDX_CDBLK 2048 /* 2048 cooked data each blk */ - -#define MCDX_DATA_TIMEOUT (HZ/10) /* 0.1 second */ - -/* - * Access to the msf array - */ -#define MSF_MIN 0 /* minute */ -#define MSF_SEC 1 /* second */ -#define MSF_FRM 2 /* frame */ - -/* - * Errors - */ -#define MCDX_E 1 /* unspec error */ -#define MCDX_ST_EOM 0x0100 /* end of media */ -#define MCDX_ST_DRV 0x00ff /* mask to query the drive status */ - -#ifndef I_WAS_HERE -#warning You have not edited mcdx.h -#warning Perhaps irq and i/o settings are wrong. -#endif - -/* ex:set ts=4 sw=4: */ diff --git a/include/linux/mroute.h b/include/linux/mroute.h index c0dc052b2..55193867d 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h @@ -10,6 +10,9 @@ * * See the mrouted code for the original history. * + * Protocol Independent Multicast (PIM) data structures included + * Carlos Picoto (cap@di.fc.ul.pt) + * */ #define MRT_BASE 200 @@ -57,16 +60,9 @@ struct vifctl { struct in_addr vifc_rmt_addr; /* IPIP tunnel addr */ }; -#define VIFF_TUNNEL 0x1 /* IPIP tunnel */ -#define VIFF_SRCRT 0x2 /* NI */ - - -/* PIM Vif Flags */ -#define VIFF_DR 0x0010 /* designated router */ -#define VIFF_NOMRT 0x0020 /* no neighbor on vif */ -#define VIFF_DOWN 0x0040 /* interface is down */ -#define VIFF_DISABLED 0x0080 /* disabled interafce */ -#define VIFF_REGISTER 0x00A0 /* MIssing cap@di.fc.ul.pt */ +#define VIFF_TUNNEL 0x1 /* IPIP tunnel */ +#define VIFF_SRCRT 0x2 /* NI */ +#define VIFF_REGISTER 0x4 /* register vif */ /* * Cache manipulation structures for mrouted and PIMd @@ -111,23 +107,13 @@ struct sioc_vif_req }; /* - * To get RPF from unicast routing table (PIM: cap@di.fc.ul.pt) - */ -struct sioc_rpf_req -{ - unsigned long source; /* Source address */ - unsigned long rpfneighbor; /* RPF */ - vifi_t iif; /* Incoming Interface */ -}; - -/* * This is the format the mroute daemon expects to see IGMP control * data. Magically happens to be like an IP packet as per the original */ struct igmpmsg { - unsigned long unused1,unused2; + __u32 unused1,unused2; unsigned char im_msgtype; /* What is this */ unsigned char im_mbz; /* Must be zero */ unsigned char im_vif; /* Interface (this ought to be a vifi_t!) */ @@ -147,22 +133,19 @@ extern int ipmr_ioctl(struct sock *sk, int cmd, unsigned long arg); extern void mroute_close(struct sock *sk); extern void ipmr_forward(struct sk_buff *skb, int is_frag); extern int ip_mr_find_tunnel(__u32, __u32); +extern void ip_mr_init(void); struct vif_device { - union - { - struct device *dev; /* Device we are using */ - struct rtable *rt; /* Route for tunnel */ - } u; + struct device *dev; /* Device we are using */ unsigned long bytes_in,bytes_out; unsigned long pkt_in,pkt_out; /* Statistics */ unsigned long rate_limit; /* Traffic shaping (NI) */ unsigned char threshold; /* TTL threshold */ unsigned short flags; /* Control flags */ - unsigned long local,remote; /* Addresses(remote for tunnels)*/ - unsigned long uptime; + __u32 local,remote; /* Addresses(remote for tunnels)*/ + int link; /* Physical interface index */ }; struct mfc_cache @@ -175,11 +158,9 @@ struct mfc_cache int mfc_flags; /* Flags on line */ struct sk_buff_head mfc_unresolved; /* Unresolved buffers */ int mfc_queuelen; /* Unresolved buffer counter */ - unsigned mfc_last_assert; + unsigned long mfc_last_assert; int mfc_minvif; int mfc_maxvif; - unsigned long uptime; - unsigned long expire; unsigned long mfc_bytes; unsigned long mfc_pkt; unsigned long mfc_wrong_if; @@ -188,6 +169,7 @@ struct mfc_cache #define MFC_QUEUED 1 #define MFC_RESOLVED 2 +#define MFC_NOTIFY 4 #define MFC_LINES 64 @@ -211,4 +193,31 @@ struct mfc_cache #define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */ #define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ +#ifdef __KERNEL__ + +#define PIM_V1_VERSION __constant_htonl(0x10000000) +#define PIM_V1_REGISTER 1 + +#define PIM_VERSION 2 +#define PIM_REGISTER 1 + +#define PIM_NULL_REGISTER __constant_htonl(0x40000000) + +/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ + +struct pimreghdr +{ + __u8 type; + __u8 reserved; + __u16 csum; + __u32 flags; +}; + +extern int pim_rcv(struct sk_buff * , unsigned short); +extern int pim_rcv_v1(struct sk_buff * , unsigned short len); + +struct rtmsg; +extern int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm); +#endif + #endif diff --git a/include/linux/net.h b/include/linux/net.h index 82a4b7570..015f2d8b2 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -18,11 +18,11 @@ #ifndef _LINUX_NET_H #define _LINUX_NET_H - -#include <linux/wait.h> #include <linux/socket.h> -#define NPROTO 16 /* should be enough for now.. */ +struct poll_table_struct; + +#define NPROTO 32 /* should be enough for now.. */ #define SYS_SOCKET 1 /* sys_socket(2) */ @@ -93,7 +93,7 @@ struct proto_ops { int flags); int (*getname) (struct socket *sock, struct sockaddr *uaddr, int *usockaddr_len, int peer); - unsigned int (*poll) (struct socket *sock, poll_table *wait); + unsigned int (*poll) (struct socket *sock, struct poll_table_struct *wait); int (*ioctl) (struct socket *sock, unsigned int cmd, unsigned long arg); int (*listen) (struct socket *sock, int len); diff --git a/include/linux/net_alias.h b/include/linux/net_alias.h index 54ba8525c..e69de29bb 100644 --- a/include/linux/net_alias.h +++ b/include/linux/net_alias.h @@ -1,187 +0,0 @@ -/* - * NET_ALIAS network device aliasing definitions. - * - * - * Version: @(#)net_alias.h 0.43 12/20/95 - * - * Author: Juan Jose Ciarlante, <jjciarla@raiz.uncu.edu.ar> - * - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - */ - -#ifndef _NET_ALIAS_H -#define _NET_ALIAS_H - -#include <linux/config.h> - -#ifdef CONFIG_NET_ALIAS -#include <linux/types.h> -#include <linux/if.h> -#include <linux/netdevice.h> - -/* - * max. alias slot number allowed - */ - -#define NET_ALIAS_MAX_SLOT 256 - -struct net_alias; -struct net_alias_info; -struct net_alias_type; - - -/* - * Main alias structure - * Note that *defines* dev & devname. - */ - -struct net_alias -{ - struct device dev; /* alias device defn*/ - char name[IFNAMSIZ]; /* device name defn */ - unsigned hash; /* my hash value: for quick rehash */ - unsigned slot; /* slot number */ - void *data; /* private data */ - struct device *main_dev; /* pointer to main device */ - struct net_alias_type *nat; /* alias type object bound */ - struct net_alias *next; /* next alias (hashed linked list) */ -}; - - -/* - * alias structure pointed by main device - * it holds main device's alias hash table - */ - -struct net_alias_info -{ - int n_aliases; /* num aliases */ - struct device *taildev; /* my last (alias) device */ - struct net_alias *hash_tab[16]; /* hashed alias table */ -}; - -/* - * net_alias_type class - * Declares a generic (AF_ independent) structure that will - * manage generic to family-specific behavior. - */ - -struct net_alias_type -{ - int type; /* aliasing type: address family */ - int n_attach; /* number of aliases attached */ - char name[16]; /* af_name */ - __u32 (*get_addr32) /* get __u32 addr 'representation'*/ - (struct net_alias_type *this, struct sockaddr*); - int (*dev_addr_chk) /* address checking func: */ - (struct net_alias_type *this, struct device *, struct sockaddr *); - struct device * (*dev_select) /* closest alias selector*/ - (struct net_alias_type *this, struct device *, struct sockaddr *sa); - int (*alias_init_1) /* called after alias creation: */ - (struct net_alias_type *this,struct net_alias *alias, struct sockaddr *sa); - int (*alias_done_1) /* called before alias deletion */ - (struct net_alias_type *this, struct net_alias *alias); - int (*alias_print_1) - (struct net_alias_type *this, struct net_alias *alias, char *buf, int len); - struct net_alias_type *next; /* link */ -}; - - -/* - * is dev an alias? - */ - -#ifdef CONFIG_NET_ALIAS - -extern __inline__ int net_alias_is(struct device *dev) -{ - return (dev->my_alias != NULL); -} - -/* - * Does dev have aliases? - */ - -extern __inline__ int net_alias_has(struct device *dev) -{ - return (dev->alias_info != NULL); -} - -/* - * Returns MY 'true' main device - * intended for alias devices - */ - -extern __inline__ struct device *net_alias_main_dev(struct device *dev) -{ - return (net_alias_is(dev))? dev->my_alias->main_dev : dev; -} - - -/* - * Returns NEXT 'true' device - * intended for true devices - */ - -extern __inline__ struct device *net_alias_nextdev(struct device *dev) -{ - return (dev->alias_info)? dev->alias_info->taildev->next : dev->next; -} - -/* - * Sets NEXT 'true' device - * Intended for main devices (treat main device as block: dev+aliases). - */ - -extern __inline__ struct device *net_alias_nextdev_set(struct device *dev, struct device *nextdev) -{ - struct device *pdev = dev; - if (net_alias_has(dev)) - { - pdev = dev->alias_info->taildev; /* point to last dev alias */ - } - pdev->next = nextdev; - return nextdev; -} - -#else - -#define net_alias_has(dev) (0) -#define net_alias_is(dev) (0) -#define net_alias_main_dev(dev) (dev) -#endif - - -extern void net_alias_init(void); - -extern struct device * net_alias_dev_get(char *dev_name, int aliasing_ok, int *err, struct sockaddr *sa, void *data); -extern int net_alias_dev_rehash(struct device *dev, struct sockaddr *sa); - -extern int net_alias_getinfo(char *buf, char **, off_t , int , int ); -extern int net_alias_types_getinfo(char *buf, char **, off_t , int , int ); - -extern int register_net_alias_type(struct net_alias_type *nat, int type); -extern int unregister_net_alias_type(struct net_alias_type *nat); - -extern struct device * net_alias_dev_chk(struct device *main_dev, struct sockaddr *sa, int flags_on, int flags_off); -extern struct device * net_alias_dev_chk32(struct device *main_dev, int family, __u32 addr32, int flags_on, int flags_off); - -extern struct device * net_alias_dev_rcv_sel(struct device *main_dev, struct sockaddr *sa_src, struct sockaddr *sa_dst); -extern struct device * net_alias_dev_rcv_sel32(struct device *main_dev, int family, __u32 src, __u32 dst); - - - -#else - -#define net_alias_is(a) 0 -#define net_alias_main_dev(dev) (dev) -#define net_alias_has(dev) 0 - -#endif - -#endif /* _NET_ALIAS_H */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 4a530fe8f..9d1f67cc0 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -27,6 +27,7 @@ #include <linux/config.h> #include <linux/if.h> #include <linux/if_ether.h> +#include <linux/if_packet.h> #include <asm/atomic.h> @@ -34,7 +35,6 @@ * For future expansion when we will have different priorities. */ -#define DEV_NUMBUFFS 3 /* Number of queues per device */ #define MAX_ADDR_LEN 7 /* Largest hardware address length */ /* @@ -59,18 +59,6 @@ #define MAX_HEADER (LL_MAX_HEADER + 48) #endif -#define IS_MYADDR 1 /* address is (one of) our own */ -#define IS_LOOPBACK 2 /* address is for LOOPBACK */ -#define IS_BROADCAST 3 /* address is a valid broadcast */ -#define IS_INVBCAST 4 /* Wrong netmask bcast not for us (unused)*/ -#define IS_MULTICAST 5 /* Multicast IP address */ - -/* NOTE: move to ipv4_device.h */ - -#define IFF_IP_ADDR_OK 1 -#define IFF_IP_MASK_OK 2 -#define IFF_IP_BRD_OK 4 - struct neighbour; /* @@ -188,10 +176,11 @@ struct device /* The device initialization function. Called only once. */ int (*init)(struct device *dev); + void (*destructor)(struct device *dev); /* Interface index. Unique device identifier */ int ifindex; - struct device *next_up; + int iflink; /* * Some hardware also needs these fields, but they are not @@ -215,7 +204,7 @@ struct device unsigned long last_rx; /* Time of last Rx */ unsigned short flags; /* interface flags (a la BSD) */ - unsigned short family; /* address family ID (AF_INET) */ + unsigned short gflags; unsigned short metric; /* routing metric (not used) */ unsigned short mtu; /* interface MTU value */ unsigned short type; /* interface hardware type */ @@ -227,34 +216,25 @@ struct device unsigned char pad; /* make dev_addr aligned to 8 bytes */ unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */ unsigned char addr_len; /* hardware address length */ - unsigned long pa_addr; /* protocol address */ - - unsigned long pa_brdaddr; /* protocol broadcast addr */ - unsigned long pa_dstaddr; /* protocol P-P other side addr */ - unsigned long pa_mask; /* protocol netmask */ - unsigned short pa_alen; /* protocol address length */ struct dev_mc_list *mc_list; /* Multicast mac addresses */ int mc_count; /* Number of installed mcasts */ - - struct ip_mc_list *ip_mc_list; /* IP multicast filter chain */ - unsigned ip_flags; /* IP layer control flags */ - __u32 tx_queue_len; /* Max frames per queue allowed */ + int promiscuity; + int allmulti; /* For load balancing driver pair support */ unsigned long pkt_queue; /* Packets queued */ struct device *slave; /* Slave device */ - struct net_alias_info *alias_info; /* main dev alias info */ - struct net_alias *my_alias; /* alias devs */ /* Protocol specific pointers */ void *atalk_ptr; /* Appletalk link */ - void *ip_ptr; /* Not used yet */ + void *ip_ptr; /* IPv4 specific data */ - /* Pointer to the interface buffers. */ - struct sk_buff_head buffs[DEV_NUMBUFFS]; + struct Qdisc *qdisc; + struct Qdisc *qdisc_sleeping; + unsigned long tx_queue_len; /* Max frames per queue allowed */ /* Pointers to interface service routines. */ int (*open)(struct device *dev); @@ -289,6 +269,8 @@ struct device #define HAVE_CHANGE_MTU int (*change_mtu)(struct device *dev, int new_mtu); + int (*hard_header_parse)(struct sk_buff *skb, + unsigned char *haddr); }; @@ -309,16 +291,8 @@ struct packet_type extern struct device loopback_dev; /* The loopback */ extern struct device *dev_base; /* All devices */ extern struct packet_type *ptype_base[16]; /* Hashed types */ - -/* NOTE: move to INET specific header; - __ip_chk_addr is deprecated, do not use if it's possible. - */ - -extern int __ip_chk_addr(unsigned long addr); -extern struct device *ip_dev_find(unsigned long addr, char *name); -/* This is the wrong place but it'll do for the moment */ -extern void ip_mc_allhost(struct device *dev); -extern int devinet_ioctl(unsigned int cmd, void *); +extern int netdev_dropping; +extern int net_cpu_congestion; extern struct device *dev_getbyhwaddr(unsigned short type, char *hwaddr); extern void dev_add_pack(struct packet_type *pt); @@ -330,16 +304,28 @@ extern int dev_open(struct device *dev); extern int dev_close(struct device *dev); extern int dev_queue_xmit(struct sk_buff *skb); extern void dev_loopback_xmit(struct sk_buff *skb); - +extern int register_netdevice(struct device *dev); +extern int unregister_netdevice(struct device *dev); +extern int register_netdevice_notifier(struct notifier_block *nb); +extern int unregister_netdevice_notifier(struct notifier_block *nb); +extern int dev_new_index(void); +extern struct device *dev_get_by_index(int ifindex); +extern int register_gifconf(int family, int (*func)(struct device *dev, char *bufptr, int len)); +extern int dev_restart(struct device *dev); + #define HAVE_NETIF_RX 1 extern void netif_rx(struct sk_buff *skb); extern void net_bh(void); extern void dev_tint(struct device *dev); extern int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy); extern int dev_ioctl(unsigned int cmd, void *); +extern int dev_change_flags(struct device *, unsigned); +extern void dev_queue_xmit_nit(struct sk_buff *skb, struct device *dev); extern void dev_init(void); +extern int netdev_nit; + /* Locking protection for page faults during outputs to devices unloaded during the fault */ extern atomic_t dev_lockct; @@ -365,30 +351,24 @@ extern __inline__ void dev_unlock_list(void) * * FIXME: What if this is being run as a real time process ?? * Linus: We need a way to force a yield here ? + * + * FIXME: Though dev_lockct is atomic varible, locking procedure + * is not atomic. */ - + extern __inline__ void dev_lock_wait(void) { - while(atomic_read(&dev_lockct)) + while (atomic_read(&dev_lockct)) { + current->counter = 0; schedule(); + } } -/* - * Buffer initialisation function. This used to appear in all the - * drivers but is now an inline in case we ever want to change the - * schemes used. - */ - extern __inline__ void dev_init_buffers(struct device *dev) { - int i; - for(i=0;i<DEV_NUMBUFFS;i++) - { - skb_queue_head_init(&dev->buffs[i]); - } + /* DO NOTHING */ } - /* These functions live elsewhere (drivers/net/net_init.c, but related) */ extern void ether_setup(struct device *dev); @@ -399,8 +379,6 @@ extern int ether_config(struct device *dev, struct ifmap *map); /* Support for loadable net-drivers */ extern int register_netdev(struct device *dev); extern void unregister_netdev(struct device *dev); -extern int register_netdevice_notifier(struct notifier_block *nb); -extern int unregister_netdevice_notifier(struct notifier_block *nb); extern int register_trdev(struct device *dev); extern void unregister_trdev(struct device *dev); /* Functions used for multicast support */ @@ -408,10 +386,11 @@ extern void dev_mc_upload(struct device *dev); extern void dev_mc_delete(struct device *dev, void *addr, int alen, int all); extern void dev_mc_add(struct device *dev, void *addr, int alen, int newonly); extern void dev_mc_discard(struct device *dev); +extern void dev_set_promiscuity(struct device *dev, int inc); +extern void dev_set_allmulti(struct device *dev, int inc); /* Load a device via the kerneld */ extern void dev_load(const char *name); -extern int dev_new_index(void); -extern struct device * dev_get_by_index(int ifindex); + #endif /* __KERNEL__ */ diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 711687af8..8766af2b4 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -1,20 +1,174 @@ #ifndef __LINUX_NETLINK_H #define __LINUX_NETLINK_H +#define NETLINK_ROUTE 0 /* Routing/device hook */ +#define NETLINK_SKIP 1 /* Reserved for ENskip */ +#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ +#define NETLINK_FIREWALL 3 /* Firewalling hook */ +#define NETLINK_ARPD 8 +#define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ +#define NETLINK_IP6_FW 13 +#define NETLINK_TAPBASE 16 /* 16 to 31 are ethertap */ + +#define MAX_LINKS 32 + +struct sockaddr_nl +{ + sa_family_t nl_family; /* AF_NETLINK */ + unsigned short nl_pad; /* zero */ + __kernel_pid_t nl_pid; /* process pid */ + unsigned nl_groups; /* multicast groups mask */ +}; + struct nlmsghdr { - unsigned long nlmsg_len; /* Length of message including header */ - unsigned long nlmsg_type; /* Message type */ - unsigned long nlmsg_seq; /* Sequence number */ - unsigned long nlmsg_pid; /* Sending process PID */ - unsigned char nlmsg_data[0]; + __u32 nlmsg_len; /* Length of message including header */ + __u16 nlmsg_type; /* Message content */ + __u16 nlmsg_flags; /* Additional flags */ + __u32 nlmsg_seq; /* Sequence number */ + __kernel_pid_t nlmsg_pid; /* Sending process PID */ +}; + +/* Flags values */ + +#define NLM_F_REQUEST 1 /* It is request message. */ +#define NLM_F_MULTI 2 /* Multipart message, terminated by NLMSG_DONE */ +#define NLM_F_ACK 4 /* If succeed, reply with ack */ +#define NLM_F_ECHO 8 /* Echo this request */ + +/* Modifiers to GET request */ +#define NLM_F_ROOT 0x100 /* specify tree root */ +#define NLM_F_MATCH 0x200 /* return all matching */ +#define NLM_F_ATOMIC 0x400 /* atomic GET */ +#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) + +/* Modifiers to NEW request */ +#define NLM_F_REPLACE 0x100 /* Override existing */ +#define NLM_F_EXCL 0x200 /* Do not touch, if it exists */ +#define NLM_F_CREATE 0x400 /* Create, if it does not exist */ + +/* + 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL + 4.4BSD CHANGE NLM_F_REPLACE + + True CHANGE NLM_F_CREATE|NLM_F_REPLACE + Append NLM_F_CREATE + Check NLM_F_EXCL + */ + +#define NLMSG_ALIGNTO 4 +#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) +#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(sizeof(struct nlmsghdr))) +#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) +#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) +#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ + (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) +#define NLMSG_OK(nlh,len) ((nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ + (nlh)->nlmsg_len <= (len)) + +#define NLMSG_NOOP 0x1 /* Nothing. */ +#define NLMSG_ERROR 0x2 /* Error */ +#define NLMSG_DONE 0x3 /* End of a dump */ +#define NLMSG_OVERRUN 0x4 /* Data lost */ + +struct nlmsgerr +{ + int error; + struct nlmsghdr msg; +}; + +#define NET_MAJOR 36 /* Major 36 is reserved for networking */ + +#ifdef __KERNEL__ + +struct netlink_skb_parms +{ + struct ucred creds; /* Skb credentials */ + pid_t pid; + unsigned groups; + pid_t dst_pid; + unsigned dst_groups; }; -#define NLMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) ) +#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) +#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) -#define NLMSG_ACK 0x01 /* int - error code */ -#define NLMSG_OVERRUN 0x02 /* unsigned long[2] - start and end - * of lost message sequence numbers. - */ + +extern int netlink_attach(int unit, int (*function)(int,struct sk_buff *skb)); +extern void netlink_detach(int unit); +extern int netlink_post(int unit, struct sk_buff *skb); +extern int init_netlink(void); +extern struct sock *netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len)); +extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); +extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, pid_t pid, int nonblock); +extern void netlink_broadcast(struct sock *ssk, struct sk_buff *skb, pid_t pid, + unsigned group, int allocation); +extern void netlink_set_err(struct sock *ssk, pid_t pid, unsigned group, int code); + +/* + * skb should fit one page. This choice is good for headerless malloc. + * + * FIXME: What is the best size for SLAB???? --ANK + */ +#define NLMSG_GOODSIZE (PAGE_SIZE - ((sizeof(struct sk_buff)+0xF)&~0xF)) + + +struct netlink_callback +{ + struct sk_buff *skb; + struct nlmsghdr *nlh; + int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); + int (*done)(struct netlink_callback *cb); + long args[4]; +}; + +#if 0 + +void* nlmsg_broadcast(struct sock*, unsigned long type, int len, unsigned groups); +struct skb_buff *nlmsg_alloc(unsigned long type, int len, + unsigned long seq, unsigned long pid, int allocation); +void __nlmsg_transmit(struct sock*, int allocation); + +extern __inline__ void nlmsg_release(struct sk_buff *skb) +{ + atomic_dec(skb->users); +} + +extern __inline__ void nlmsg_transmit(struct sk_buff *sk, int allocation) +{ + if (sk->write_queue.qlen) + __nlmsg_transmit(sk, allocation); +} #endif + +extern __inline__ struct nlmsghdr * +__nlmsg_put(struct sk_buff *skb, pid_t pid, u32 seq, int type, int len) +{ + struct nlmsghdr *nlh; + int size = NLMSG_LENGTH(len); + + nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); + nlh->nlmsg_type = type; + nlh->nlmsg_len = size; + nlh->nlmsg_flags = 0; + nlh->nlmsg_pid = pid; + nlh->nlmsg_seq = seq; + return nlh; +} + +#define NLMSG_PUT(skb, pid, seq, type, len) \ +({ if (skb_tailroom(skb) < NLMSG_SPACE(len)) goto nlmsg_failure; \ + __nlmsg_put(skb, pid, seq, type, len); }) + +extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, + struct nlmsghdr *nlh, + int (*dump)(struct sk_buff *skb, struct netlink_callback*), + int (*done)(struct netlink_callback*)); + + +extern void netlink_proto_init(struct net_proto *pro); + +#endif /* __KERNEL__ */ + +#endif /* __LINUX_NETLINK_H */ diff --git a/include/linux/netrom.h b/include/linux/netrom.h index ffa8e4a89..6939b32f6 100644 --- a/include/linux/netrom.h +++ b/include/linux/netrom.h @@ -7,7 +7,6 @@ #ifndef NETROM_KERNEL_H #define NETROM_KERNEL_H -#define PF_NETROM AF_NETROM #define NETROM_MTU 236 #define NETROM_T1 1 diff --git a/include/linux/optcd.h b/include/linux/optcd.h index 00dd3aed8..e69de29bb 100644 --- a/include/linux/optcd.h +++ b/include/linux/optcd.h @@ -1,52 +0,0 @@ -/* linux/include/linux/optcd.h - Optics Storage 8000 AT CDROM driver - $Id: optcd.h,v 1.2 1996/01/15 18:43:44 root Exp root $ - - Copyright (C) 1995 Leo Spiekman (spiekman@dutette.et.tudelft.nl) - - - Configuration file for linux/drivers/cdrom/optcd.c -*/ - -#ifndef _LINUX_OPTCD_H -#define _LINUX_OPTCD_H - - -/* I/O base of drive. Drive uses base to base+2. - This setting can be overridden with the kernel or insmod command - line option 'optcd=<portbase>'. Use address of 0 to disable driver. */ -#define OPTCD_PORTBASE 0x340 - - -/* enable / disable parts of driver by define / undef */ -#define MULTISESSION /* multisession support (ALPHA) */ - - -/* Change 0 to 1 to debug various parts of the driver */ -#define DEBUG_DRIVE_IF 0 /* Low level drive interface */ -#define DEBUG_CONV 0 /* Address conversions */ -#define DEBUG_BUFFERS 0 /* Buffering and block size conversion */ -#define DEBUG_REQUEST 0 /* Request mechanism */ -#define DEBUG_STATE 0 /* State machine */ -#define DEBUG_TOC 0 /* Q-channel and Table of Contents */ -#define DEBUG_MULTIS 0 /* Multisession code */ -#define DEBUG_VFS 0 /* VFS interface */ - - -/* Don't touch these unless you know what you're doing. */ - -/* Various timeout loop repetition counts. */ -#define BUSY_TIMEOUT 10000000 /* for busy wait */ -#define FAST_TIMEOUT 100000 /* ibid. for probing */ -#define SLEEP_TIMEOUT 6000 /* for timer wait */ -#define MULTI_SEEK_TIMEOUT 1000 /* for timer wait */ -#define READ_TIMEOUT 6000 /* for poll wait */ -#define STOP_TIMEOUT 2000 /* for poll wait */ -#define RESET_WAIT 5000 /* busy wait at drive reset */ - -/* # of buffers for block size conversion. 6 is optimal for my setup (P75), - giving 280 kb/s, with 0.4% CPU usage. Experiment to find your optimal - setting */ -#define N_BUFS 6 - - -#endif _LINUX_OPTCD_H diff --git a/include/linux/parport.h b/include/linux/parport.h index dc88589ae..6a2bbd183 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -1,4 +1,4 @@ -/* $Id: parport.h,v 1.2.6.3.2.2 1997/04/18 15:03:53 phil Exp $ */ +/* $Id: parport.h,v 1.3 1997/10/19 18:02:00 phil Exp $ */ #ifndef _PARPORT_H_ #define _PARPORT_H_ @@ -160,7 +160,7 @@ struct parport_dir { /* A parallel port */ struct parport { - unsigned int base; /* base address */ + unsigned long base; /* base address */ unsigned int size; /* IO extent */ char *name; int irq; /* interrupt (or -1 for none) */ @@ -266,11 +266,11 @@ extern int parport_proc_cleanup(void); extern int parport_proc_register(struct parport *pp); extern int parport_proc_unregister(struct parport *pp); -/* Prototypes from parport_ksyms.c */ extern void dec_parport_count(void); extern void inc_parport_count(void); extern int parport_probe(struct parport *port, char *buffer, int len); extern void parport_probe_one(struct parport *port); +extern void (*parport_probe_hook)(struct parport *port); #endif /* _PARPORT_H_ */ diff --git a/include/linux/pci.h b/include/linux/pci.h index b1f401847..164a32768 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -43,8 +43,8 @@ -#ifndef PCI_H -#define PCI_H +#ifndef LINUX_PCI_H +#define LINUX_PCI_H /* * Under PCI, each device has 256 bytes of configuration address space, @@ -241,11 +241,13 @@ #define PCI_DEVICE_ID_NCR_53C895 0x000c #define PCI_DEVICE_ID_NCR_53C885 0x000d #define PCI_DEVICE_ID_NCR_53C875 0x000f +#define PCI_DEVICE_ID_NCR_53C876 0x008f #define PCI_VENDOR_ID_ATI 0x1002 #define PCI_DEVICE_ID_ATI_68800 0x4158 #define PCI_DEVICE_ID_ATI_215CT222 0x4354 #define PCI_DEVICE_ID_ATI_210888CX 0x4358 +#define PCI_DEVICE_ID_ATI_215GB 0x4742 #define PCI_DEVICE_ID_ATI_215GP 0x4750 #define PCI_DEVICE_ID_ATI_215GT 0x4754 #define PCI_DEVICE_ID_ATI_215GTB 0x4755 @@ -257,6 +259,8 @@ #define PCI_DEVICE_ID_VLSI_82C593 0x0006 #define PCI_DEVICE_ID_VLSI_82C594 0x0007 #define PCI_DEVICE_ID_VLSI_82C597 0x0009 +#define PCI_DEVICE_ID_VLSI_82C541 0x000c +#define PCI_DEVICE_ID_VLSI_82C543 0x000d #define PCI_DEVICE_ID_VLSI_VAS96011 0x0702 #define PCI_VENDOR_ID_ADL 0x1005 @@ -307,6 +311,7 @@ #define PCI_VENDOR_ID_IBM 0x1014 #define PCI_DEVICE_ID_IBM_FIRE_CORAL 0x000a +#define PCI_DEVICE_ID_IBM_TR 0x0018 #define PCI_DEVICE_ID_IBM_82G2675 0x001d #define PCI_DEVICE_ID_IBM_82351 0x0022 @@ -321,6 +326,7 @@ #define PCI_DEVICE_ID_TRIDENT_9420 0x9420 #define PCI_DEVICE_ID_TRIDENT_9440 0x9440 #define PCI_DEVICE_ID_TRIDENT_9660 0x9660 +#define PCI_DEVICE_ID_TRIDENT_9750 0x9750 #define PCI_VENDOR_ID_AI 0x1025 #define PCI_DEVICE_ID_AI_M1435 0x1435 @@ -342,6 +348,7 @@ #define PCI_DEVICE_ID_MIRO_36050 0x5601 #define PCI_VENDOR_ID_NEC 0x1033 +#define PCI_DEVICE_ID_NEC_PCX2 0x0046 #define PCI_VENDOR_ID_FD 0x1036 #define PCI_DEVICE_ID_FD_36C70 0x0000 @@ -358,12 +365,16 @@ #define PCI_DEVICE_ID_SI_5511 0x5511 #define PCI_DEVICE_ID_SI_5513 0x5513 #define PCI_DEVICE_ID_SI_5571 0x5571 +#define PCI_DEVICE_ID_SI_5597 0x5597 #define PCI_DEVICE_ID_SI_7001 0x7001 #define PCI_VENDOR_ID_HP 0x103c #define PCI_DEVICE_ID_HP_J2585A 0x1030 #define PCI_DEVICE_ID_HP_J2585B 0x1031 +#define PCI_VENDOR_ID_HOLTEK 0x9412 +#define PCI_DEVICE_ID_HOLTEK_6565 0x6565 + #define PCI_VENDOR_ID_PCTECH 0x1042 #define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000 #define PCI_DEVICE_ID_PCTECH_RZ1001 0x1001 @@ -376,6 +387,9 @@ #define PCI_DEVICE_ID_OPTI_82C557 0xc557 #define PCI_DEVICE_ID_OPTI_82C558 0xc558 #define PCI_DEVICE_ID_OPTI_82C621 0xc621 +#define PCI_DEVICE_ID_OPTI_82C700 0xc700 +#define PCI_DEVICE_ID_OPTI_82C701 0xc701 +#define PCI_DEVICE_ID_OPTI_82C814 0xc814 #define PCI_DEVICE_ID_OPTI_82C822 0xc822 #define PCI_VENDOR_ID_SGS 0x104a @@ -388,6 +402,8 @@ #define PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT 0x8130 #define PCI_VENDOR_ID_TI 0x104c +#define PCI_DEVICE_ID_TI_TVP4010 0x3d04 +#define PCI_DEVICE_ID_TI_TVP4020 0x3d07 #define PCI_DEVICE_ID_TI_PCI1130 0xac12 #define PCI_DEVICE_ID_TI_PCI1131 0xac15 @@ -404,7 +420,7 @@ #define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801 #define PCI_VENDOR_ID_PROMISE 0x105a -#define PCI_DEVICE_ID_PROMISE_IDE_UDMA 0x4d33 +#define PCI_DEVICE_ID_PROMISE_20246 0x4d33 #define PCI_DEVICE_ID_PROMISE_5300 0x5300 #define PCI_VENDOR_ID_N9 0x105d @@ -518,10 +534,14 @@ #define PCI_VENDOR_ID_MITSUBISHI 0x10ba +#define PCI_VENDOR_ID_SURECOM 0x10bd +#define PCI_DEVICE_ID_SURECOM_NE34 0x0e34 + #define PCI_VENDOR_ID_NEOMAGIC 0x10c8 #define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2070 0x0001 #define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128V 0x0002 #define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZV 0x0003 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2160 0x0004 #define PCI_VENDOR_ID_ASP 0x10cd #define PCI_DEVICE_ID_ASP_ABP940 0x1200 @@ -531,6 +551,8 @@ #define PCI_DEVICE_ID_CERN_SPSB_PMC 0x0001 #define PCI_DEVICE_ID_CERN_SPSB_PCI 0x0002 +#define PCI_VENDOR_ID_NVIDIA 0x10de + #define PCI_VENDOR_ID_IMS 0x10e0 #define PCI_DEVICE_ID_IMS_8849 0x8849 @@ -627,6 +649,7 @@ #define PCI_DEVICE_ID_ALLIANCE_PROMOTIO 0x3210 #define PCI_DEVICE_ID_ALLIANCE_PROVIDEO 0x6422 #define PCI_DEVICE_ID_ALLIANCE_AT24 0x6424 +#define PCI_DEVICE_ID_ALLIANCE_AT3D 0x643d #define PCI_VENDOR_ID_VMIC 0x114a #define PCI_DEVICE_ID_VMIC_VME 0x7587 @@ -656,6 +679,9 @@ #define PCI_VENDOR_ID_GALILEO 0x11ab #define PCI_DEVICE_ID_GALILEO_GT64011 0x4146 +#define PCI_VENDOR_ID_LITEON 0x11ad +#define PCI_DEVICE_ID_LITEON_LNE100TX 0x0002 + #define PCI_VENDOR_ID_NP 0x11bc #define PCI_DEVICE_ID_NP_PCI_FDDI 0x0001 @@ -663,6 +689,9 @@ #define PCI_DEVICE_ID_SPECIALIX_XIO 0x4000 #define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 +#define PCI_VENDOR_ID_AURAVISION 0x11d1 +#define PCI_DEVICE_ID_AURAVISION_VXP524 0x01f7 + #define PCI_VENDOR_ID_IKON 0x11d5 #define PCI_DEVICE_ID_IKON_10115 0x0115 #define PCI_DEVICE_ID_IKON_10117 0x0117 @@ -706,8 +735,8 @@ #define PCI_VENDOR_ID_PICTUREL 0x12c5 #define PCI_DEVICE_ID_PICTUREL_PCIVST 0x0081 -#define PCI_VENDOR_ID_NVIDIA 0x12d2 -#define PCI_DEVICE_ID_NVIDIA_RIVA128 0x0018 +#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 +#define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018 #define PCI_VENDOR_ID_SYMPHONY 0x1c1c #define PCI_DEVICE_ID_SYMPHONY_101 0x0001 @@ -775,6 +804,8 @@ #define PCI_DEVICE_ID_INTEL_82371AB 0x7111 #define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112 #define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 +#define PCI_DEVICE_ID_INTEL_82443LX_0 0x7180 +#define PCI_DEVICE_ID_INTEL_82443LX_1 0x7181 #define PCI_DEVICE_ID_INTEL_P6 0x84c4 #define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 @@ -784,6 +815,7 @@ #define PCI_VENDOR_ID_ADAPTEC 0x9004 #define PCI_DEVICE_ID_ADAPTEC_7850 0x5078 #define PCI_DEVICE_ID_ADAPTEC_7855 0x5578 +#define PCI_DEVICE_ID_ADAPTEC_5800 0x5800 #define PCI_DEVICE_ID_ADAPTEC_7860 0x6078 #define PCI_DEVICE_ID_ADAPTEC_7861 0x6178 #define PCI_DEVICE_ID_ADAPTEC_7870 0x7078 @@ -791,6 +823,7 @@ #define PCI_DEVICE_ID_ADAPTEC_7872 0x7278 #define PCI_DEVICE_ID_ADAPTEC_7873 0x7378 #define PCI_DEVICE_ID_ADAPTEC_7874 0x7478 +#define PCI_DEVICE_ID_ADAPTEC_7895 0x7895 #define PCI_DEVICE_ID_ADAPTEC_7880 0x8078 #define PCI_DEVICE_ID_ADAPTEC_7881 0x8178 #define PCI_DEVICE_ID_ADAPTEC_7882 0x8278 @@ -805,6 +838,7 @@ #define PCI_DEVICE_ID_ARK_STINGARK 0xa099 #define PCI_DEVICE_ID_ARK_2000MT 0xa0a1 +#ifdef __KERNEL__ /* * The PCI interface treats multi-function devices as independent * devices. The slot/function address of each device is encoded @@ -895,5 +929,5 @@ extern const char *pci_strvendor (unsigned int vendor); extern const char *pci_strdev (unsigned int vendor, unsigned int device); extern int get_pci_list (char *buf); - -#endif /* PCI_H */ +#endif /* __KERNEL__ */ +#endif /* LINUX_PCI_H */ diff --git a/include/linux/pi2.h b/include/linux/pi2.h index 1740cc0b2..e69de29bb 100644 --- a/include/linux/pi2.h +++ b/include/linux/pi2.h @@ -1,130 +0,0 @@ - -#define DMA_BUFF_SIZE 2200 - -#define ON 1 -#define OFF 0 - - -/* Register offset info, specific to the PI - * E.g., to read the data port on channel A, use - * inportb(pichan[dev].base + CHANA + DATA) - */ -#define CHANB 0 /* Base of channel B regs */ -#define CHANA 2 /* Base of channel A regs */ - -/* 8530 ports on each channel */ -#define CTL 0 -#define DATA 1 - -#define DMAEN 0x4 /* Offset off DMA Enable register */ - -/* Timer chip offsets */ -#define TMR0 0x8 /* Offset of timer 0 register */ -#define TMR1 0x9 /* Offset of timer 1 register */ -#define TMR2 0xA /* Offset of timer 2 register */ -#define TMRCMD 0xB /* Offset of timer command register */ - -/* Timer chip equates */ -#define SC0 0x00 /* Select counter 0 */ -#define SC1 0x40 /* Select counter 1 */ -#define SC2 0x80 /* Select counter 2 */ -#define CLATCH 0x00 /* Counter latching operation */ -#define MSB 0x20 /* Read/load MSB only */ -#define LSB 0x10 /* Read/load LSB only */ -#define LSB_MSB 0x30 /* Read/load LSB, then MSB */ -#define MODE0 0x00 /* Interrupt on terminal count */ -#define MODE1 0x02 /* Programmable one shot */ -#define MODE2 0x04 /* Rate generator */ -#define MODE3 0x06 /* Square wave rate generator */ -#define MODE4 0x08 /* Software triggered strobe */ -#define MODE5 0x0a /* Hardware triggered strobe */ -#define BCD 0x01 /* BCD counter */ - -/* DMA controller registers */ -#define DMA_STAT 8 /* DMA controller status register */ -#define DMA_CMD 8 /* DMA controller command register */ -#define DMA_MASK 10 /* DMA controller mask register */ -#define DMA_MODE 11 /* DMA controller mode register */ -#define DMA_RESETFF 12 /* DMA controller first/last flip flop */ -/* DMA data */ -#define DMA_DISABLE (0x04) /* Disable channel n */ -#define DMA_ENABLE (0x00) /* Enable channel n */ -/* Single transfers, incr. address, auto init, writes, ch. n */ -#define DMA_RX_MODE (0x54) -/* Single transfers, incr. address, no auto init, reads, ch. n */ -#define DMA_TX_MODE (0x48) - -#define SINGLE 3686400 -#define DOUBLE 7372800 - -#define SIOCGPIPARAM 0x5000 /* get PI parameters */ -#define SIOCSPIPARAM 0x5001 /* set */ -#define SIOCGPIBAUD 0x5002 /* get only baud rate */ -#define SIOCSPIBAUD 0x5003 -#define SIOCGPIDMA 0x5004 /* get only DMA */ -#define SIOCSPIDMA 0x5005 -#define SIOCGPIIRQ 0x5006 /* get only IRQ */ -#define SIOCSPIIRQ 0x5007 - -struct pi_req { - int cmd; - int speed; - int clockmode; - int txdelay; - unsigned char persist; - int slotime; - int squeldelay; - int dmachan; - int irq; -}; - -#ifdef __KERNEL__ - -/* Information that needs to be kept for each channel. */ -struct pi_local { - struct net_device_stats stats; - long open_time; /* Useless example local info. */ - unsigned long xtal; - - struct mbuf *rcvbuf;/* Buffer for current rx packet */ - struct mbuf *rxdmabuf1; /* DMA rx buffer */ - struct mbuf *rxdmabuf2; /* DMA rx buffer */ - - int bufsiz; /* Size of rcvbuf */ - char *rcp; /* Pointer into rcvbuf */ - - struct sk_buff_head sndq; /* Packets awaiting transmission */ - int sndcnt; /* Number of packets on sndq */ - struct sk_buff *sndbuf; /* Current buffer being transmitted */ - char *txdmabuf; /* Transmit DMA buffer */ - char *txptr; /* Used by B port tx */ - int txcnt; - char tstate; /* Transmitter state */ -#define IDLE 0 /* Transmitter off, no data pending */ -#define ACTIVE 1 /* Transmitter on, sending data */ -#define UNDERRUN 2 /* Transmitter on, flushing CRC */ -#define FLAGOUT 3 /* CRC sent - attempt to start next frame */ -#define DEFER 4 /* Receive Active - DEFER Transmit */ -#define ST_TXDELAY 5 /* Sending leading flags */ -#define CRCOUT 6 - char rstate; /* Set when !DCD goes to 0 (TRUE) */ -/* Normal state is ACTIVE if Receive enabled */ -#define RXERROR 2 /* Error -- Aborting current Frame */ -#define RXABORT 3 /* ABORT sequence detected */ -#define TOOBIG 4 /* too large a frame to store */ - int dev; /* Device number */ - int base; /* Base of I/O registers */ - int cardbase; /* Base address of card */ - int stata; /* address of Channel A status regs */ - int statb; /* address of Channel B status regs */ - int speed; /* Line speed, bps */ - int clockmode; /* tapr 9600 modem clocking option */ - int txdelay; /* Transmit Delay 10 ms/cnt */ - unsigned char persist; /* Persistence (0-255) as a % */ - int slotime; /* Delay to wait on persistence hit */ - int squeldelay; /* Delay after XMTR OFF for squelch tail */ - struct iface *iface; /* Associated interface */ - int dmachan; /* DMA channel for this port */ -}; - -#endif diff --git a/include/linux/poll.h b/include/linux/poll.h index 2001fedfb..01c4d1519 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h @@ -1 +1,106 @@ +#ifndef _LINUX_POLL_H + #include <asm/poll.h> + +#ifdef __KERNEL__ + +#include <linux/wait.h> +#include <linux/string.h> +#include <asm/uaccess.h> + + +struct poll_table_entry { + struct wait_queue wait; + struct wait_queue ** wait_address; +}; + +typedef struct poll_table_struct { + unsigned int nr; + struct poll_table_entry * entry; +} poll_table; + +#define __MAX_POLL_TABLE_ENTRIES (PAGE_SIZE / sizeof (struct poll_table_entry)) + +extern inline void poll_wait(struct wait_queue ** wait_address, poll_table *p) +{ + struct poll_table_entry * entry; + + if (!p || !wait_address) + return; + if (p->nr >= __MAX_POLL_TABLE_ENTRIES) + return; + entry = p->entry + p->nr; + entry->wait_address = wait_address; + entry->wait.task = current; + entry->wait.next = NULL; + add_wait_queue(wait_address,&entry->wait); + p->nr++; +} + + +/* + * For the kernel fd_set we use a fixed set-size for allocation purposes. + * This set-size doesn't necessarily bear any relation to the size the user + * uses, but should preferably obviously be larger than any possible user + * size (NR_OPEN bits). + * + * We need 6 bitmaps (in/out/ex for both incoming and outgoing), and we + * allocate one page for all the bitmaps. Thus we have 8*PAGE_SIZE bits, + * to be divided by 6. And we'd better make sure we round to a full + * long-word (in fact, we'll round to 64 bytes). + */ + + +#define KFDS_64BLOCK ((PAGE_SIZE/(6*64))*64) +#define KFDS_NR (KFDS_64BLOCK*8 > NR_OPEN ? NR_OPEN : KFDS_64BLOCK*8) +typedef unsigned long kernel_fd_set[KFDS_NR/__NFDBITS]; + +typedef struct { + kernel_fd_set in, out, ex; + kernel_fd_set res_in, res_out, res_ex; +} fd_set_buffer; + + +/* + * We do a VERIFY_WRITE here even though we are only reading this time: + * we'll write to it eventually.. + * + * Use "unsigned long" accesses to let user-mode fd_set's be long-aligned. + */ +static inline +int get_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset) +{ + /* round up nr to nearest "unsigned long" */ + nr = (nr + 8*sizeof(long) - 1) / (8*sizeof(long)) * sizeof(long); + if (ufdset) { + int error; + error = verify_area(VERIFY_WRITE, ufdset, nr); + if (!error) + error = __copy_from_user(fdset, ufdset, nr); + return error; + } + memset(fdset, 0, nr); + return 0; +} + +static inline +void set_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset) +{ + if (ufdset) { + nr = (nr + 8*sizeof(long) - 1) / (8*sizeof(long))*sizeof(long); + __copy_to_user(ufdset, fdset, nr); + } +} + +static inline +void zero_fd_set(unsigned long nr, unsigned long *fdset) +{ + nr = (nr + 8*sizeof(long) - 1) / (8*sizeof(long)) * sizeof(long); + memset(fdset, 0, nr); +} + +extern int do_select(int n, fd_set_buffer *fds, unsigned long timeout); + +#endif /* KERNEL */ + +#endif /* _LINUX_POLL_H */ diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index dc0d41d9e..902e63f39 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -81,9 +81,6 @@ enum net_directory_inos { PROC_NET_UNIX = 128, PROC_NET_ARP, PROC_NET_ROUTE, - PROC_NET_RTCLASSES, - PROC_NET_RTLOCAL, - PROC_NET_RTRULES, PROC_NET_DEV, PROC_NET_RAW, PROC_NET_RAW6, @@ -118,8 +115,6 @@ enum net_directory_inos { PROC_NET_SOCKSTAT6, PROC_NET_RTCACHE, PROC_NET_AX25_BPQETHER, - PROC_NET_ALIAS_TYPES, - PROC_NET_ALIASES, PROC_NET_IP_MASQ_APP, PROC_NET_RT6, PROC_NET_RT6_TREE, diff --git a/include/linux/pt.h b/include/linux/pt.h index 9ab17f501..e69de29bb 100644 --- a/include/linux/pt.h +++ b/include/linux/pt.h @@ -1,174 +0,0 @@ -/* - * pt.h: Linux device driver for the Gracilis PackeTwin - * Copyright (C) 1995 Craig Small VK2XLZ (vk2xlz@vk2xlz.ampr.org.) - * - * Please read the notice appearing at the top of the file pt.c - */ -#define DMA_BUFF_SIZE 2200 - -#define ON 1 -#define OFF 0 - - -/* Register offset info, specific to the PT - * E.g., to read the data port on channel A, use - * inportb(pichan[dev].base + CHANA + DATA) - */ -#define CHANB 0 /* Base of channel B regs */ -#define CHANA 2 /* Base of channel A regs */ - -/* 8530 ports on each channel */ -#define CTL 0 -#define DATA 1 - -#define DMAEN 0x8 /* Offset off DMA Enable register */ - -/* Timer chip offsets */ -#define TMR0 0x4 /* Offset of timer 0 register */ -#define TMR1 0x5 /* Offset of timer 1 register */ -#define TMR2 0x6 /* Offset of timer 2 register */ -#define TMRCMD 0x7 /* Offset of timer command register */ -#define INT_REG 0x8 -#define TMR1CLR 0x9 -#define TMR2CLR 0xa - -/* Interrupt register equates */ -#define PT_SCC_MSK 0x1 -#define PT_TMR1_MSK 0x2 -#define PT_TMR2_MSK 0x4 - -/* Serial/interrupt register equates */ -#define PT_DTRA_ON 0x1 -#define PT_DTRB_ON 0x2 -#define PT_EXTCLKA 0x4 -#define PT_EXTCLKB 0x8 -#define PT_LOOPA_ON 0x10 -#define PT_LOOPB_ON 0x20 -#define PT_EI 0x80 - -/* Timer chip equates */ -#define SC0 0x00 /* Select counter 0 */ -#define SC1 0x40 /* Select counter 1 */ -#define SC2 0x80 /* Select counter 2 */ -#define CLATCH 0x00 /* Counter latching operation */ -#define MSB 0x20 /* Read/load MSB only */ -#define LSB 0x10 /* Read/load LSB only */ -#define LSB_MSB 0x30 /* Read/load LSB, then MSB */ -#define MODE0 0x00 /* Interrupt on terminal count */ -#define MODE1 0x02 /* Programmable one shot */ -#define MODE2 0x04 /* Rate generator */ -#define MODE3 0x06 /* Square wave rate generator */ -#define MODE4 0x08 /* Software triggered strobe */ -#define MODE5 0x0a /* Hardware triggered strobe */ -#define BCD 0x01 /* BCD counter */ - -/* DMA controller registers */ -#define DMA_STAT 8 /* DMA controller status register */ -#define DMA_CMD 8 /* DMA controller command register */ -#define DMA_MASK 10 /* DMA controller mask register */ -#define DMA_MODE 11 /* DMA controller mode register */ -#define DMA_RESETFF 12 /* DMA controller first/last flip flop */ -/* DMA data */ -#define DMA_DISABLE (0x04) /* Disable channel n */ -#define DMA_ENABLE (0x00) /* Enable channel n */ -/* Single transfers, incr. address, auto init, writes, ch. n */ -#define DMA_RX_MODE (0x54) -/* Single transfers, incr. address, no auto init, reads, ch. n */ -#define DMA_TX_MODE (0x48) - -/* Write registers */ -#define DMA_CFG 0x08 -#define SERIAL_CFG 0x09 -#define INT_CFG 0x09 /* shares with serial config */ -#define DMA_CLR_FF 0x0a - -#define SINGLE 3686400 -#define DOUBLE 7372800 -#define XTAL ((long) 6144000L) - -#define SIOCGPIPARAM 0x5000 /* get PI parameters */ -#define SIOCSPIPARAM 0x5001 /* set */ -#define SIOCGPIBAUD 0x5002 /* get only baud rate */ -#define SIOCSPIBAUD 0x5003 -#define SIOCGPIDMA 0x5004 /* get only DMA */ -#define SIOCSPIDMA 0x5005 -#define SIOCGPIIRQ 0x5006 /* get only IRQ */ -#define SIOCSPIIRQ 0x5007 - -struct pt_req -{ - int cmd; - int speed; - int clockmode; - int txdelay; - unsigned char persist; - int slotime; - int squeldelay; - int dmachan; - int irq; -}; - -/* SCC Interrupt vectors, if we have set 'status low' */ -#define CHBTxIV 0x00 -#define CHBEXTIV 0x02 -#define CHBRxIV 0x04 -#define CHBSRCIV 0x06 -#define CHATxIV 0x08 -#define CHAEXTIV 0x0a -#define CHARxIV 0x0c -#define CHASRCIV 0x0e - - -#ifdef __KERNEL__ - -/* Information that needs to be kept for each channel. */ -struct pt_local -{ - struct net_device_stats stats; /* %%%dp*/ - long open_time; /* Useless example local info. */ - unsigned long xtal; - - struct mbuf *rcvbuf;/* Buffer for current rx packet */ - struct mbuf *rxdmabuf1; /* DMA rx buffer */ - struct mbuf *rxdmabuf2; /* DMA rx buffer */ - - int bufsiz; /* Size of rcvbuf */ - char *rcp; /* Pointer into rcvbuf */ - struct sk_buff_head sndq; /* Packets awaiting transmission */ - int sndcnt; /* Number of packets on sndq */ - struct sk_buff *sndbuf; /* Current buffer being transmitted */ - char *txdmabuf; /* Transmit DMA buffer */ - char *txptr; /* Used by B port tx */ - int txcnt; - char tstate; /* Transmitter state */ -#define IDLE 0 /* Transmitter off, no data pending */ -#define ACTIVE 1 /* Transmitter on, sending data */ -#define UNDERRUN 2 /* Transmitter on, flushing CRC */ -#define FLAGOUT 3 /* CRC sent - attempt to start next frame */ -#define DEFER 4 /* Receive Active - DEFER Transmit */ -#define ST_TXDELAY 5 /* Sending leading flags */ -#define CRCOUT 6 - char rstate; /* Set when !DCD goes to 0 (TRUE) */ -/* Normal state is ACTIVE if Receive enabled */ -#define RXERROR 2 /* Error -- Aborting current Frame */ -#define RXABORT 3 /* ABORT sequence detected */ -#define TOOBIG 4 /* too large a frame to store */ - - int dev; /* Device number */ - int base; /* Base of I/O registers */ - int cardbase; /* Base address of card */ - int stata; /* address of Channel A status regs */ - int statb; /* address of Channel B status regs */ - int speed; /* Line speed, bps */ - int clockmode; /* tapr 9600 modem clocking option */ - int txdelay; /* Transmit Delay 10 ms/cnt */ - unsigned char persist; /* Persistence (0-255) as a % */ - int slotime; /* Delay to wait on persistence hit */ - int squeldelay; /* Delay after XMTR OFF for squelch tail */ - struct iface *iface; /* Associated interface */ - int dmachan; /* DMA channel for this port */ - char saved_RR0; /* The saved version of RR) that we compare with */ - int nrzi; /* Do we use NRZI (or NRZ) */ -}; - -#endif diff --git a/include/linux/rose.h b/include/linux/rose.h index 61abbc0d3..69d592f67 100644 --- a/include/linux/rose.h +++ b/include/linux/rose.h @@ -7,7 +7,6 @@ #ifndef ROSE_KERNEL_H #define ROSE_KERNEL_H -#define PF_ROSE AF_ROSE #define ROSE_MTU 251 #define ROSE_DEFER 1 diff --git a/include/linux/route.h b/include/linux/route.h index 4432d1900..2582f9a89 100644 --- a/include/linux/route.h +++ b/include/linux/route.h @@ -33,9 +33,7 @@ struct rtentry unsigned short rt_flags; short rt_pad2; unsigned long rt_pad3; - unsigned char rt_tos; - unsigned char rt_class; - short rt_pad4; + void *rt_pad4; short rt_metric; /* +1 for binary compatibility! */ char *rt_dev; /* forcing the device at add */ unsigned long rt_mtu; /* per route MTU/Window */ @@ -44,13 +42,11 @@ struct rtentry #endif unsigned long rt_window; /* Window clamping */ unsigned short rt_irtt; /* Initial RTT */ - }; #define RTF_UP 0x0001 /* route usable */ #define RTF_GATEWAY 0x0002 /* destination is a gateway */ - #define RTF_HOST 0x0004 /* host entry (net otherwise) */ #define RTF_REINSTATE 0x0008 /* reinstate route after tmout */ #define RTF_DYNAMIC 0x0010 /* created dyn. (by redirect) */ @@ -60,138 +56,12 @@ struct rtentry #define RTF_WINDOW 0x0080 /* per route window clamping */ #define RTF_IRTT 0x0100 /* Initial round trip time */ #define RTF_REJECT 0x0200 /* Reject route */ -#define RTF_STATIC 0x0400 /* Manually injected route */ -#define RTF_XRESOLVE 0x0800 /* External resolver */ -#define RTF_NOFORWARD 0x1000 /* Forwarding inhibited */ -#define RTF_THROW 0x2000 /* Go to next class */ -#define RTF_NOPMTUDISC 0x4000 /* Do not send packets with DF */ - -#define RTF_MAGIC 0x8000 /* Route added/deleted authomatically, - * when interface changes its state. - */ /* * <linux/ipv6_route.h> uses RTF values >= 64k */ -#define RTCF_VALVE 0x00200000 -#define RTCF_MASQ 0x00400000 -#define RTCF_NAT 0x00800000 -#define RTCF_DOREDIRECT 0x01000000 -#define RTCF_LOG 0x02000000 -#define RTCF_DIRECTSRC 0x04000000 - -#define RTF_LOCAL 0x80000000 -#define RTF_INTERFACE 0x40000000 -#define RTF_MULTICAST 0x20000000 -#define RTF_BROADCAST 0x10000000 -#define RTF_NAT 0x08000000 - -#define RTF_ADDRCLASSMASK 0xF8000000 -#define RT_ADDRCLASS(flags) ((__u32)flags>>23) - -#define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) - -#define RT_LOCALADDR(flags) ((flags&RTF_ADDRCLASSMASK) == (RTF_LOCAL|RTF_INTERFACE)) - -#define RT_CLASS_UNSPEC 0 -#define RT_CLASS_DEFAULT 253 - -#define RT_CLASS_MAIN 254 -#define RT_CLASS_LOCAL 255 -#define RT_CLASS_MAX 255 - -#ifdef _LINUX_IN_H /* hack to check that in.h included */ -/* - * This structure is passed from the kernel to user space by netlink - * routing/device announcements - */ - -struct in_rtmsg -{ - struct in_addr rtmsg_prefix; - struct in_addr rtmsg_gateway; - unsigned rtmsg_flags; - unsigned long rtmsg_mtu; - unsigned long rtmsg_window; - unsigned short rtmsg_rtt; - short rtmsg_metric; - unsigned char rtmsg_tos; - unsigned char rtmsg_class; - unsigned char rtmsg_prefixlen; - unsigned char rtmsg_reserved; - int rtmsg_ifindex; -}; - - -struct in_ifmsg -{ - struct sockaddr ifmsg_lladdr; - struct in_addr ifmsg_prefix; - struct in_addr ifmsg_brd; - unsigned ifmsg_flags; - unsigned long ifmsg_mtu; - short ifmsg_metric; - unsigned char ifmsg_prefixlen; - unsigned char ifmsg_reserved; - int ifmsg_index; - char ifmsg_name[16]; -}; - -enum rtrule_actions -{ - RTP_GO, - RTP_NAT, - RTP_DROP, - RTP_UNREACHABLE, - RTP_PROHIBIT, - RTP_MASQUERADE -}; - -#define RTRF_LOG 1 /* Log route creations */ -#define RTRF_VALVE 2 /* One-way route */ - -struct in_rtrulemsg -{ - struct in_addr rtrmsg_src; - struct in_addr rtrmsg_dst; - struct in_addr rtrmsg_srcmap; - int rtrmsg_ifindex; - unsigned char rtrmsg_srclen; - unsigned char rtrmsg_dstlen; - unsigned char rtrmsg_tos; - unsigned char rtrmsg_class; - unsigned char rtrmsg_flags; - unsigned char rtrmsg_action; - unsigned char rtrmsg_preference; - unsigned char rtrmsg_rtmsgs; - struct in_rtmsg rtrmsg_rtmsg[1]; -}; - -struct in_rtctlmsg -{ - unsigned rtcmsg_flags; - int rtcmsg_delay; -}; - -#define RTCTL_ECHO 1 /* Echo route changes */ -#define RTCTL_FLUSH 2 /* Send flush updates */ -#define RTCTL_ACK 4 /* Send acks */ -#define RTCTL_DELAY 8 /* Set netlink delay */ -#define RTCTL_OWNER 0x10 /* Set netlink reader */ -#endif - -#define RTMSG_ACK NLMSG_ACK -#define RTMSG_OVERRUN NLMSG_OVERRUN -#define RTMSG_NEWDEVICE 0x11 -#define RTMSG_DELDEVICE 0x12 -#define RTMSG_NEWROUTE 0x21 -#define RTMSG_DELROUTE 0x22 -#define RTMSG_NEWRULE 0x31 -#define RTMSG_DELRULE 0x32 -#define RTMSG_CONTROL 0x40 -#define RTMSG_AR_FAILED 0x51 /* Address Resolution failed */ #endif /* _LINUX_ROUTE_H */ diff --git a/include/linux/sbpcd.h b/include/linux/sbpcd.h index e9021316d..e69de29bb 100644 --- a/include/linux/sbpcd.h +++ b/include/linux/sbpcd.h @@ -1,858 +0,0 @@ -/* - * sbpcd.h Specify interface address and interface type here. - */ - -/* - * Attention! This file contains user-serviceable parts! - * I recommend to make use of it... - * If you feel helpless, look into linux/Documentation/cdrom/sbpcd - * (good idea anyway, at least before mailing me). - * - * The definitions for the first controller can get overridden by - * the kernel command line ("lilo boot option"). - * Examples: - * sbpcd=0x300,LaserMate - * or - * sbpcd=0x230,SoundBlaster - * or - * sbpcd=0x338,SoundScape - * or - * sbpcd=0x2C0,Teac16bit - * - * If sbpcd gets used as a module, you can load it with - * insmod sbpcd.o sbpcd=0x300,0 - * or - * insmod sbpcd.o sbpcd=0x230,1 - * or - * insmod sbpcd.o sbpcd=0x338,2 - * or - * insmod sbpcd.o sbpcd=0x2C0,3 - * respective to override the configured address and type. - */ - -/* - * define your CDROM port base address as CDROM_PORT - * and specify the type of your interface card as SBPRO. - * - * address: - * ======== - * SBPRO type addresses typically are 0x0230 (=0x220+0x10), 0x0250, ... - * LASERMATE type (CI-101P, WDH-7001C) addresses typically are 0x0300, ... - * SOUNDSCAPE addresses are from the LASERMATE type and range. You have to - * specify the REAL address here, not the configuration port address. Look - * at the CDROM driver's invoking line within your DOS CONFIG.SYS, or let - * sbpcd auto-probe, if you are not firm with the address. - * There are some soundcards on the market with 0x0630, 0x0650, ...; their - * type is not obvious (both types are possible). - * - * example: if your SBPRO audio address is 0x220, specify 0x230 and SBPRO 1. - * if your soundcard has its CDROM port above 0x300, specify - * that address and try SBPRO 0 first. - * if your SoundScape configuration port is at 0x330, specify - * 0x338 and SBPRO 2. - * - * interface type: - * =============== - * set SBPRO to 1 for "true" SoundBlaster card - * set SBPRO to 0 for "compatible" soundcards and - * for "poor" (no sound) interface cards. - * set SBPRO to 2 for Ensonic SoundScape or SPEA Media FX cards - * set SBPRO to 3 for Teac 16bit interface cards - * - * Almost all "compatible" sound boards need to set SBPRO to 0. - * If SBPRO is set wrong, the drives will get found - but any - * data access will give errors (audio access will work). - * The "OmniCD" no-sound interface card from CreativeLabs and most Teac - * interface cards need SBPRO 1. - * - * sound base: - * =========== - * The SOUND_BASE definition tells if we should try to turn the CD sound - * channels on. It will only be of use regarding soundcards with a SbPro - * compatible mixer. - * - * Example: #define SOUND_BASE 0x220 enables the sound card's CD channels - * #define SOUND_BASE 0 leaves the soundcard untouched - */ -#if !(SBPCD_ISSUE-1) /* first (or if you have only one) interface board: */ -#define CDROM_PORT 0x340 /* <-----------<< port address */ -#define SBPRO 0 /* <-----------<< interface type */ -#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */ -#define SOUND_BASE 0x220 /* <-----------<< sound address of this card or 0 */ -#endif -#if !(SBPCD_ISSUE-2) /* ==================== second interface board: === */ -#define CDROM_PORT 0x344 /* <-----------<< port address */ -#define SBPRO 0 /* <-----------<< interface type */ -#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */ -#define SOUND_BASE 0x000 /* <-----------<< sound address of this card or 0 */ -#endif -#if !(SBPCD_ISSUE-3) /* ===================== third interface board: === */ -#define CDROM_PORT 0x630 /* <-----------<< port address */ -#define SBPRO 1 /* <-----------<< interface type */ -#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */ -#define SOUND_BASE 0x240 /* <-----------<< sound address of this card or 0 */ -#endif -#if !(SBPCD_ISSUE-4) /* ==================== fourth interface board: === */ -#define CDROM_PORT 0x634 /* <-----------<< port address */ -#define SBPRO 0 /* <-----------<< interface type */ -#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */ -#define SOUND_BASE 0x000 /* <-----------<< sound address of this card or 0 */ -#endif - -/* - * some more or less user dependent definitions - service them! - */ - -/* Set this to 0 once you have configured your interface definitions right. */ -#define DISTRIBUTION 1 - -/* - * Time to wait after giving a message. - * This gets important if you enable non-standard DBG_xxx flags. - * You will see what happens if you omit the pause or make it - * too short. Be warned! - */ -#define KLOGD_PAUSE 1 - -/* tray control: eject tray if no disk is in */ -#if DISTRIBUTION -#define JUKEBOX 0 -#else -#define JUKEBOX 1 -#endif DISTRIBUTION - -/* tray control: eject tray after last use */ -#if DISTRIBUTION -#define EJECT 0 -#else -#define EJECT 1 -#endif DISTRIBUTION - -/* max. number of audio frames to read with one */ -/* request (allocates n* 2352 bytes kernel memory!) */ -/* may be freely adjusted, f.e. 75 (= 1 sec.), at */ -/* runtime by use of the CDROMAUDIOBUFSIZ ioctl. */ -#define READ_AUDIO 0 - -/* Optimizations for the Teac CD-55A drive read performance. - * SBP_TEAC_SPEED can be changed here, or one can set the - * variable "teac" when loading as a module. - * Valid settings are: - * 0 - very slow - the recommended "DISTRIBUTION 1" setup. - * 1 - 2x performance with little overhead. No busy waiting. - * 2 - 4x performance with 5ms overhead per read. Busy wait. - * - * Setting SBP_TEAC_SPEED or the variable 'teac' to anything - * other than 0 may cause problems. If you run into them, first - * change SBP_TEAC_SPEED back to 0 and see if your drive responds - * normally. If yes, you are "allowed" to report your case - to help - * me with the driver, not to solve your hassle. Don´t mail if you - * simply are stuck into your own "tuning" experiments, you know? - */ -#define SBP_TEAC_SPEED 1 - -/*==========================================================================*/ -/*==========================================================================*/ -/* - * nothing to change below here if you are not fully aware what you're doing - */ -#ifndef _LINUX_SBPCD_H - -#define _LINUX_SBPCD_H -/*==========================================================================*/ -/*==========================================================================*/ -/* - * driver's own read_ahead, data mode - */ -#define SBP_BUFFER_FRAMES 8 - -#define LONG_TIMING 0 /* test against timeouts with "gold" CDs on CR-521 */ -#undef FUTURE -#undef SAFE_MIXED - -#define TEST_UPC 0 -#define SPEA_TEST 0 -#define TEST_STI 0 -#define OLD_BUSY 0 -#undef PATH_CHECK -#ifndef SOUND_BASE -#define SOUND_BASE 0 -#endif -#if DISTRIBUTION -#undef SBP_TEAC_SPEED -#define SBP_TEAC_SPEED 0 -#endif -/*==========================================================================*/ -/* - * DDI interface definitions - * "invented" by Fred N. van Kempen.. - */ -#define DDIOCSDBG 0x9000 - -/*==========================================================================*/ -/* - * "private" IOCTL functions - */ -#define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ - -/*==========================================================================*/ -/* - * Debug output levels - */ -#define DBG_INF 1 /* necessary information */ -#define DBG_BSZ 2 /* BLOCK_SIZE trace */ -#define DBG_REA 3 /* READ status trace */ -#define DBG_CHK 4 /* MEDIA CHECK trace */ -#define DBG_TIM 5 /* datarate timer test */ -#define DBG_INI 6 /* initialization trace */ -#define DBG_TOC 7 /* tell TocEntry values */ -#define DBG_IOC 8 /* ioctl trace */ -#define DBG_STA 9 /* ResponseStatus() trace */ -#define DBG_ERR 10 /* cc_ReadError() trace */ -#define DBG_CMD 11 /* cmd_out() trace */ -#define DBG_WRN 12 /* give explanation before auto-probing */ -#define DBG_MUL 13 /* multi session code test */ -#define DBG_IDX 14 /* test code for drive_id !=0 */ -#define DBG_IOX 15 /* some special information */ -#define DBG_DID 16 /* drive ID test */ -#define DBG_RES 17 /* drive reset info */ -#define DBG_SPI 18 /* SpinUp test */ -#define DBG_IOS 19 /* ioctl trace: subchannel functions */ -#define DBG_IO2 20 /* ioctl trace: general */ -#define DBG_UPC 21 /* show UPC information */ -#define DBG_XA1 22 /* XA mode debugging */ -#define DBG_LCK 23 /* door (un)lock info */ -#define DBG_SQ1 24 /* dump SubQ frame */ -#define DBG_AUD 25 /* READ AUDIO debugging */ -#define DBG_SEQ 26 /* Sequoia interface configuration trace */ -#define DBG_LCS 27 /* Longshine LCS-7260 debugging trace */ -#define DBG_CD2 28 /* MKE/Funai CD200 debugging trace */ -#define DBG_TEA 29 /* TEAC CD-55A debugging trace */ -#define DBG_ECS 30 /* ECS-AT (Vertos 100) debugging trace */ -#define DBG_000 31 /* unnecessary information */ - -/*==========================================================================*/ -/*==========================================================================*/ - -/* - * bits of flags_cmd_out: - */ -#define f_respo3 0x100 -#define f_putcmd 0x80 -#define f_respo2 0x40 -#define f_lopsta 0x20 -#define f_getsta 0x10 -#define f_ResponseStatus 0x08 -#define f_obey_p_check 0x04 -#define f_bit1 0x02 -#define f_wait_if_busy 0x01 - -/* - * diskstate_flags: - */ -#define x80_bit 0x80 -#define upc_bit 0x40 -#define volume_bit 0x20 -#define toc_bit 0x10 -#define multisession_bit 0x08 -#define cd_size_bit 0x04 -#define subq_bit 0x02 -#define frame_size_bit 0x01 - -/* - * disk states (bits of diskstate_flags): - */ -#define upc_valid (D_S[d].diskstate_flags&upc_bit) -#define volume_valid (D_S[d].diskstate_flags&volume_bit) -#define toc_valid (D_S[d].diskstate_flags&toc_bit) -#define cd_size_valid (D_S[d].diskstate_flags&cd_size_bit) -#define subq_valid (D_S[d].diskstate_flags&subq_bit) -#define frame_size_valid (D_S[d].diskstate_flags&frame_size_bit) - -/* - * the status_bits variable - */ -#define p_success 0x100 -#define p_door_closed 0x80 -#define p_caddy_in 0x40 -#define p_spinning 0x20 -#define p_check 0x10 -#define p_busy_new 0x08 -#define p_door_locked 0x04 -#define p_disk_ok 0x01 - -/* - * LCS-7260 special status result bits: - */ -#define p_lcs_door_locked 0x02 -#define p_lcs_door_closed 0x01 /* probably disk_in */ - -/* - * CR-52x special status result bits: - */ -#define p_caddin_old 0x40 -#define p_success_old 0x08 -#define p_busy_old 0x04 -#define p_bit_1 0x02 /* hopefully unused now */ - -/* - * "generation specific" defs of the status result bits: - */ -#define p0_door_closed 0x80 -#define p0_caddy_in 0x40 -#define p0_spinning 0x20 -#define p0_check 0x10 -#define p0_success 0x08 /* unused */ -#define p0_busy 0x04 -#define p0_bit_1 0x02 /* unused */ -#define p0_disk_ok 0x01 - -#define pL_disk_in 0x40 -#define pL_spinning 0x20 -#define pL_check 0x10 -#define pL_success 0x08 /* unused ?? */ -#define pL_busy 0x04 -#define pL_door_locked 0x02 -#define pL_door_closed 0x01 - -#define pV_door_closed 0x40 -#define pV_spinning 0x20 -#define pV_check 0x10 -#define pV_success 0x08 -#define pV_busy 0x04 -#define pV_door_locked 0x02 -#define pV_disk_ok 0x01 - -#define p1_door_closed 0x80 -#define p1_disk_in 0x40 -#define p1_spinning 0x20 -#define p1_check 0x10 -#define p1_busy 0x08 -#define p1_door_locked 0x04 -#define p1_bit_1 0x02 /* unused */ -#define p1_disk_ok 0x01 - -#define p2_disk_ok 0x80 -#define p2_door_locked 0x40 -#define p2_spinning 0x20 -#define p2_busy2 0x10 -#define p2_busy1 0x08 -#define p2_door_closed 0x04 -#define p2_disk_in 0x02 -#define p2_check 0x01 - -/* - * used drive states: - */ -#define st_door_closed (D_S[d].status_bits&p_door_closed) -#define st_caddy_in (D_S[d].status_bits&p_caddy_in) -#define st_spinning (D_S[d].status_bits&p_spinning) -#define st_check (D_S[d].status_bits&p_check) -#define st_busy (D_S[d].status_bits&p_busy_new) -#define st_door_locked (D_S[d].status_bits&p_door_locked) -#define st_diskok (D_S[d].status_bits&p_disk_ok) - -/* - * bits of the CDi_status register: - */ -#define s_not_result_ready 0x04 /* 0: "result ready" */ -#define s_not_data_ready 0x02 /* 0: "data ready" */ -#define s_attention 0x01 /* 1: "attention required" */ -/* - * usable as: - */ -#define DRV_ATTN ((inb(CDi_status)&s_attention)!=0) -#define DATA_READY ((inb(CDi_status)&s_not_data_ready)==0) -#define RESULT_READY ((inb(CDi_status)&s_not_result_ready)==0) - -/* - * drive families and types (firmware versions): - */ -#define drv_fam0 0x0100 /* CR-52x family */ -#define drv_199 (drv_fam0+0x01) /* <200 */ -#define drv_200 (drv_fam0+0x02) /* <201 */ -#define drv_201 (drv_fam0+0x03) /* <210 */ -#define drv_210 (drv_fam0+0x04) /* <211 */ -#define drv_211 (drv_fam0+0x05) /* <300 */ -#define drv_300 (drv_fam0+0x06) /* >=300 */ - -#define drv_fam1 0x0200 /* CR-56x family */ -#define drv_099 (drv_fam1+0x01) /* <100 */ -#define drv_100 (drv_fam1+0x02) /* >=100, only 1.02 and 5.00 known */ - -#define drv_fam2 0x0400 /* CD200 family */ - -#define drv_famT 0x0800 /* TEAC CD-55A */ - -#define drv_famL 0x1000 /* Longshine family */ -#define drv_260 (drv_famL+0x01) /* LCS-7260 */ -#define drv_e1 (drv_famL+0x01) /* LCS-7260, firmware "A E1" */ -#define drv_f4 (drv_famL+0x02) /* LCS-7260, firmware "A4F4" */ - -#define drv_famV 0x2000 /* ECS-AT (vertos-100) family */ -#define drv_at (drv_famV+0x01) /* ECS-AT, firmware "1.00" */ - -#define fam0_drive (D_S[d].drv_type&drv_fam0) -#define famL_drive (D_S[d].drv_type&drv_famL) -#define famV_drive (D_S[d].drv_type&drv_famV) -#define fam1_drive (D_S[d].drv_type&drv_fam1) -#define fam2_drive (D_S[d].drv_type&drv_fam2) -#define famT_drive (D_S[d].drv_type&drv_famT) -#define fam0L_drive (D_S[d].drv_type&(drv_fam0|drv_famL)) -#define fam0V_drive (D_S[d].drv_type&(drv_fam0|drv_famV)) -#define famLV_drive (D_S[d].drv_type&(drv_famL|drv_famV)) -#define fam0LV_drive (D_S[d].drv_type&(drv_fam0|drv_famL|drv_famV)) -#define fam1L_drive (D_S[d].drv_type&(drv_fam1|drv_famL)) -#define fam1V_drive (D_S[d].drv_type&(drv_fam1|drv_famV)) -#define fam1LV_drive (D_S[d].drv_type&(drv_fam1|drv_famL|drv_famV)) -#define fam01_drive (D_S[d].drv_type&(drv_fam0|drv_fam1)) -#define fam12_drive (D_S[d].drv_type&(drv_fam1|drv_fam2)) -#define fam2T_drive (D_S[d].drv_type&(drv_fam2|drv_famT)) - -/* - * audio states: - */ -#define audio_playing 2 -#define audio_pausing 1 - -/* - * drv_pattern, drv_options: - */ -#define speed_auto 0x80 -#define speed_300 0x40 -#define speed_150 0x20 -#define audio_mono 0x04 - -/* - * values of cmd_type (0 else): - */ -#define READ_M1 0x01 /* "data mode 1": 2048 bytes per frame */ -#define READ_M2 0x02 /* "data mode 2": 12+2048+280 bytes per frame */ -#define READ_SC 0x04 /* "subchannel info": 96 bytes per frame */ -#define READ_AU 0x08 /* "audio frame": 2352 bytes per frame */ - -/* - * sense_byte: - * - * values: 00 - * 01 - * 81 - * 82 "raw audio" mode - * xx from infobuf[0] after 85 00 00 00 00 00 00 - */ - -/* audio status (bin) */ -#define aud_00 0x00 /* Audio status byte not supported or not valid */ -#define audx11 0x0b /* Audio play operation in progress */ -#define audx12 0x0c /* Audio play operation paused */ -#define audx13 0x0d /* Audio play operation successfully completed */ -#define audx14 0x0e /* Audio play operation stopped due to error */ -#define audx15 0x0f /* No current audio status to return */ -/* audio status (bcd) */ -#define aud_11 0x11 /* Audio play operation in progress */ -#define aud_12 0x12 /* Audio play operation paused */ -#define aud_13 0x13 /* Audio play operation successfully completed */ -#define aud_14 0x14 /* Audio play operation stopped due to error */ -#define aud_15 0x15 /* No current audio status to return */ - -/* - * highest allowed drive number (MINOR+1) - */ -#define NR_SBPCD 4 - -/* - * we try to never disable interrupts - seems to work - */ -#define SBPCD_DIS_IRQ 0 - -/* - * "write byte to port" - */ -#define OUT(x,y) outb(y,x) - -/*==========================================================================*/ - -#define MIXER_addr SOUND_BASE+4 /* sound card's address register */ -#define MIXER_data SOUND_BASE+5 /* sound card's data register */ -#define MIXER_CD_Volume 0x28 /* internal SB Pro register address */ - -/*==========================================================================*/ - -#define MAX_TRACKS 99 - -#define ERR_DISKCHANGE 615 - -/*==========================================================================*/ -/* - * To make conversions easier (machine dependent!) - */ -typedef union _msf -{ - u_int n; - u_char c[4]; -} MSF; - -typedef union _blk -{ - u_int n; - u_char c[4]; -} BLK; - -/*==========================================================================*/ - -/*============================================================================ -============================================================================== - -COMMAND SET of "old" drives like CR-521, CR-522 - (the CR-562 family is different): - -No. Command Code --------------------------------------------- - -Drive Commands: - 1 Seek 01 - 2 Read Data 02 - 3 Read XA-Data 03 - 4 Read Header 04 - 5 Spin Up 05 - 6 Spin Down 06 - 7 Diagnostic 07 - 8 Read UPC 08 - 9 Read ISRC 09 -10 Play Audio 0A -11 Play Audio MSF 0B -12 Play Audio Track/Index 0C - -Status Commands: -13 Read Status 81 -14 Read Error 82 -15 Read Drive Version 83 -16 Mode Select 84 -17 Mode Sense 85 -18 Set XA Parameter 86 -19 Read XA Parameter 87 -20 Read Capacity 88 -21 Read SUB_Q 89 -22 Read Disc Code 8A -23 Read Disc Information 8B -24 Read TOC 8C -25 Pause/Resume 8D -26 Read Packet 8E -27 Read Path Check 00 - - -all numbers (lba, msf-bin, msf-bcd, counts) to transfer high byte first - -mnemo 7-byte command #bytes response (r0...rn) -________ ____________________ ____ - -Read Status: -status: 81. (1) one-byte command, gives the main - status byte -Read Error: -check1: 82 00 00 00 00 00 00. (6) r1: audio status - -Read Packet: -check2: 8e xx 00 00 00 00 00. (xx) gets xx bytes response, relating - to commands 01 04 05 07 08 09 - -Play Audio: -play: 0a ll-bb-aa nn-nn-nn. (0) play audio, ll-bb-aa: starting block (lba), - nn-nn-nn: #blocks -Play Audio MSF: - 0b mm-ss-ff mm-ss-ff (0) play audio from/to - -Play Audio Track/Index: - 0c ... - -Pause/Resume: -pause: 8d pr 00 00 00 00 00. (0) pause (pr=00) - resume (pr=80) audio playing - -Mode Select: - 84 00 nn-nn ??-?? 00 (0) nn-nn: 2048 or 2340 - possibly defines transfer size - -set_vol: 84 83 00 00 sw le 00. (0) sw(itch): lrxxxxxx (off=1) - le(vel): min=0, max=FF, else half - (firmware 2.11) - -Mode Sense: -get_vol: 85 03 00 00 00 00 00. (2) tell current audio volume setting - -Read Disc Information: -tocdesc: 8b 00 00 00 00 00 00. (6) read the toc descriptor ("msf-bin"-format) - -Read TOC: -tocent: 8c fl nn 00 00 00 00. (8) read toc entry #nn - (fl=0:"lba"-, =2:"msf-bin"-format) - -Read Capacity: -capacit: 88 00 00 00 00 00 00. (5) "read CD-ROM capacity" - - -Read Path Check: -ping: 00 00 00 00 00 00 00. (2) r0=AA, r1=55 - ("ping" if the drive is connected) - -Read Drive Version: -ident: 83 00 00 00 00 00 00. (12) gives "MATSHITAn.nn" - (n.nn = 2.01, 2.11., 3.00, ...) - -Seek: -seek: 01 00 ll-bb-aa 00 00. (0) -seek: 01 02 mm-ss-ff 00 00. (0) - -Read Data: -read: 02 xx-xx-xx nn-nn fl. (??) read nn-nn blocks of 2048 bytes, - starting at block xx-xx-xx - fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx - -Read XA-Data: -read: 03 xx-xx-xx nn-nn fl. (??) read nn-nn blocks of 2340 bytes, - starting at block xx-xx-xx - fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx - -Read SUB_Q: - 89 fl 00 00 00 00 00. (13) r0: audio status, r4-r7: lba/msf, - fl=0: "lba", fl=2: "msf" - -Read Disc Code: - 8a 00 00 00 00 00 00. (14) possibly extended "check condition"-info - -Read Header: - 04 00 ll-bb-aa 00 00. (0) 4 bytes response with "check2" - 04 02 mm-ss-ff 00 00. (0) 4 bytes response with "check2" - -Spin Up: - 05 00 ll-bb-aa 00 00. (0) possibly implies a "seek" - -Spin Down: - 06 ... - -Diagnostic: - 07 00 ll-bb-aa 00 00. (2) 2 bytes response with "check2" - 07 02 mm-ss-ff 00 00. (2) 2 bytes response with "check2" - -Read UPC: - 08 00 ll-bb-aa 00 00. (16) - 08 02 mm-ss-ff 00 00. (16) - -Read ISRC: - 09 00 ll-bb-aa 00 00. (15) 15 bytes response with "check2" - 09 02 mm-ss-ff 00 00. (15) 15 bytes response with "check2" - -Set XA Parameter: - 86 ... - -Read XA Parameter: - 87 ... - -============================================================================== -============================================================================*/ - -/* - * commands - * - * CR-52x: CMD0_ - * CR-56x: CMD1_ - * CD200: CMD2_ - * LCS-7260: CMDL_ - * TEAC CD-55A: CMDT_ - * ECS-AT: CMDV_ - */ -#define CMD1_RESET 0x0a -#define CMD2_RESET 0x01 -#define CMDT_RESET 0xc0 - -#define CMD1_LOCK_CTL 0x0c -#define CMD2_LOCK_CTL 0x1e -#define CMDT_LOCK_CTL CMD2_LOCK_CTL -#define CMDL_LOCK_CTL 0x0e -#define CMDV_LOCK_CTL CMDL_LOCK_CTL - -#define CMD1_TRAY_CTL 0x07 -#define CMD2_TRAY_CTL 0x1b -#define CMDT_TRAY_CTL CMD2_TRAY_CTL -#define CMDL_TRAY_CTL 0x0d -#define CMDV_TRAY_CTL CMDL_TRAY_CTL - -#define CMD1_MULTISESS 0x8d -#define CMDL_MULTISESS 0x8c -#define CMDV_MULTISESS CMDL_MULTISESS - -#define CMD1_SUBCHANINF 0x11 -#define CMD2_SUBCHANINF 0x?? - -#define CMD1_ABORT 0x08 -#define CMD2_ABORT 0x08 -#define CMDT_ABORT 0x08 - -#define CMD2_x02 0x02 - -#define CMD2_SETSPEED 0xda - -#define CMD0_PATH_CHECK 0x00 -#define CMD1_PATH_CHECK 0x??? -#define CMD2_PATH_CHECK 0x??? -#define CMDT_PATH_CHECK 0x??? -#define CMDL_PATH_CHECK CMD0_PATH_CHECK -#define CMDV_PATH_CHECK CMD0_PATH_CHECK - -#define CMD0_SEEK 0x01 -#define CMD1_SEEK CMD0_SEEK -#define CMD2_SEEK 0x2b -#define CMDT_SEEK CMD2_SEEK -#define CMDL_SEEK CMD0_SEEK -#define CMDV_SEEK CMD0_SEEK - -#define CMD0_READ 0x02 -#define CMD1_READ 0x10 -#define CMD2_READ 0x28 -#define CMDT_READ CMD2_READ -#define CMDL_READ CMD0_READ -#define CMDV_READ CMD0_READ - -#define CMD0_READ_XA 0x03 -#define CMD2_READ_XA 0xd4 -#define CMD2_READ_XA2 0xd5 -#define CMDL_READ_XA CMD0_READ_XA /* really ?? */ -#define CMDV_READ_XA CMD0_READ_XA - -#define CMD0_READ_HEAD 0x04 - -#define CMD0_SPINUP 0x05 -#define CMD1_SPINUP 0x02 -#define CMD2_SPINUP CMD2_TRAY_CTL -#define CMDL_SPINUP CMD0_SPINUP -#define CMDV_SPINUP CMD0_SPINUP - -#define CMD0_SPINDOWN 0x06 /* really??? */ -#define CMD1_SPINDOWN 0x06 -#define CMD2_SPINDOWN CMD2_TRAY_CTL -#define CMDL_SPINDOWN 0x0d -#define CMDV_SPINDOWN CMD0_SPINDOWN - -#define CMD0_DIAG 0x07 - -#define CMD0_READ_UPC 0x08 -#define CMD1_READ_UPC 0x88 -#define CMD2_READ_UPC 0x??? -#define CMDL_READ_UPC CMD0_READ_UPC -#define CMDV_READ_UPC 0x8f - -#define CMD0_READ_ISRC 0x09 - -#define CMD0_PLAY 0x0a -#define CMD1_PLAY 0x??? -#define CMD2_PLAY 0x??? -#define CMDL_PLAY CMD0_PLAY -#define CMDV_PLAY CMD0_PLAY - -#define CMD0_PLAY_MSF 0x0b -#define CMD1_PLAY_MSF 0x0e -#define CMD2_PLAY_MSF 0x47 -#define CMDT_PLAY_MSF CMD2_PLAY_MSF -#define CMDL_PLAY_MSF 0x??? - -#define CMD0_PLAY_TI 0x0c -#define CMD1_PLAY_TI 0x0f - -#define CMD0_STATUS 0x81 -#define CMD1_STATUS 0x05 -#define CMD2_STATUS 0x00 -#define CMDT_STATUS CMD2_STATUS -#define CMDL_STATUS CMD0_STATUS -#define CMDV_STATUS CMD0_STATUS -#define CMD2_SEEK_LEADIN 0x00 - -#define CMD0_READ_ERR 0x82 -#define CMD1_READ_ERR CMD0_READ_ERR -#define CMD2_READ_ERR 0x03 -#define CMDT_READ_ERR CMD2_READ_ERR /* get audio status */ -#define CMDL_READ_ERR CMD0_READ_ERR -#define CMDV_READ_ERR CMD0_READ_ERR - -#define CMD0_READ_VER 0x83 -#define CMD1_READ_VER CMD0_READ_VER -#define CMD2_READ_VER 0x12 -#define CMDT_READ_VER CMD2_READ_VER /* really ?? */ -#define CMDL_READ_VER CMD0_READ_VER -#define CMDV_READ_VER CMD0_READ_VER - -#define CMD0_SETMODE 0x84 -#define CMD1_SETMODE 0x09 -#define CMD2_SETMODE 0x55 -#define CMDT_SETMODE CMD2_SETMODE -#define CMDL_SETMODE CMD0_SETMODE - -#define CMD0_GETMODE 0x85 -#define CMD1_GETMODE 0x84 -#define CMD2_GETMODE 0x5a -#define CMDT_GETMODE CMD2_GETMODE -#define CMDL_GETMODE CMD0_GETMODE - -#define CMD0_SET_XA 0x86 - -#define CMD0_GET_XA 0x87 - -#define CMD0_CAPACITY 0x88 -#define CMD1_CAPACITY 0x85 -#define CMD2_CAPACITY 0x25 -#define CMDL_CAPACITY CMD0_CAPACITY /* missing in some firmware versions */ - -#define CMD0_READSUBQ 0x89 -#define CMD1_READSUBQ 0x87 -#define CMD2_READSUBQ 0x42 -#define CMDT_READSUBQ CMD2_READSUBQ -#define CMDL_READSUBQ CMD0_READSUBQ -#define CMDV_READSUBQ CMD0_READSUBQ - -#define CMD0_DISKCODE 0x8a - -#define CMD0_DISKINFO 0x8b -#define CMD1_DISKINFO CMD0_DISKINFO -#define CMD2_DISKINFO 0x43 -#define CMDT_DISKINFO CMD2_DISKINFO -#define CMDL_DISKINFO CMD0_DISKINFO -#define CMDV_DISKINFO CMD0_DISKINFO - -#define CMD0_READTOC 0x8c -#define CMD1_READTOC CMD0_READTOC -#define CMD2_READTOC 0x??? -#define CMDL_READTOC CMD0_READTOC -#define CMDV_READTOC CMD0_READTOC - -#define CMD0_PAU_RES 0x8d -#define CMD1_PAU_RES 0x0d -#define CMD2_PAU_RES 0x4b -#define CMDT_PAUSE CMD2_PAU_RES -#define CMDL_PAU_RES CMD0_PAU_RES -#define CMDV_PAUSE CMD0_PAU_RES - -#define CMD0_PACKET 0x8e -#define CMD1_PACKET CMD0_PACKET -#define CMD2_PACKET 0x??? -#define CMDL_PACKET CMD0_PACKET -#define CMDV_PACKET 0x??? - -/*==========================================================================*/ -/*==========================================================================*/ -#endif _LINUX_SBPCD_H -/*==========================================================================*/ -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-indent-level: 8 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -8 - * c-argdecl-indent: 8 - * c-label-offset: -8 - * c-continued-statement-offset: 8 - * c-continued-brace-offset: 0 - * End: - */ diff --git a/include/linux/scc.h b/include/linux/scc.h index 275cbbb77..c8a440538 100644 --- a/include/linux/scc.h +++ b/include/linux/scc.h @@ -3,6 +3,8 @@ #ifndef _SCC_H #define _SCC_H +#include <linux/config.h> + /* selection of hardware types */ #define PA0HZP 0x00 /* hardware type for PA0HZP SCC card and compatible */ @@ -184,7 +186,7 @@ enum {TX_OFF, TX_ON}; /* command for scc_key_trx() */ #define RXINT 0x04 #define SPINT 0x06 -#ifdef SCC_DELAY +#ifdef CONFIG_SCC_DELAY #define Inb(port) inb_p(port) #define Outb(port, val) outb_p(val, port) #else diff --git a/include/linux/sched.h b/include/linux/sched.h index 71411900b..3afeaa33c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -19,6 +19,7 @@ extern unsigned long event; #include <linux/smp.h> #include <linux/tty.h> #include <linux/sem.h> +#include <linux/signal.h> /* * cloning flags: @@ -165,14 +166,14 @@ struct mm_struct { struct signal_struct { atomic_t count; - struct sigaction action[32]; + struct k_sigaction action[_NSIG]; spinlock_t siglock; }; #define INIT_SIGNALS { \ ATOMIC_INIT(1), \ - { {0,}, }, \ + { {{0,}}, }, \ SPIN_LOCK_UNLOCKED } struct task_struct { @@ -180,10 +181,8 @@ struct task_struct { volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ long counter; long priority; - unsigned long signal; - unsigned long blocked; /* bitmap of masked signals */ unsigned long flags; /* per process flags, defined below */ - int errno; + int sigpending; long debugreg[8]; /* Hardware debugging registers */ struct exec_domain *exec_domain; /* various fields */ @@ -196,11 +195,10 @@ struct task_struct { unsigned long personality; int dumpable:1; int did_exec:1; - /* shouldn't this be pid_t? */ - int pid; - int pgrp; - int tty_old_pgrp; - int session; + pid_t pid; + pid_t pgrp; + pid_t tty_old_pgrp; + pid_t session; /* boolean value for session group leader */ int leader; int ngroups; @@ -220,8 +218,8 @@ struct task_struct { struct task_struct **tarray_ptr; struct wait_queue *wait_chldexit; /* for wait4() */ - unsigned short uid,euid,suid,fsuid; - unsigned short gid,egid,sgid,fsgid; + uid_t uid,euid,suid,fsuid; + gid_t gid,egid,sgid,fsgid; unsigned long timeout, policy, rt_priority; unsigned long it_real_value, it_prof_value, it_virt_value; unsigned long it_real_incr, it_prof_incr, it_virt_incr; @@ -257,6 +255,8 @@ struct task_struct { struct mm_struct *mm; /* signal handlers */ struct signal_struct *sig; + sigset_t signal, blocked; + struct signal_queue *sigqueue, **sigqueue_tail; /* SMP state */ int has_cpu; int processor; @@ -271,17 +271,16 @@ struct task_struct { */ #define PF_ALIGNWARN 0x00000001 /* Print alignment warning msgs */ /* Not implemented yet, only for 486*/ -#define PF_PTRACED 0x00000010 /* set if ptrace (0) has been called. */ +#define PF_STARTING 0x00000002 /* being created */ +#define PF_EXITING 0x00000004 /* getting shut down */ +#define PF_PTRACED 0x00000010 /* set if ptrace (0) has been called */ #define PF_TRACESYS 0x00000020 /* tracing system calls */ #define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ #define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ #define PF_DUMPCORE 0x00000200 /* dumped core */ #define PF_SIGNALED 0x00000400 /* killed by a signal */ -#define PF_STARTING 0x00000002 /* being created */ -#define PF_EXITING 0x00000004 /* getting shut down */ - -#define PF_USEDFPU 0x00100000 /* Process used the FPU this quantum (SMP only) */ +#define PF_USEDFPU 0x00100000 /* task used FPU this quantum (SMP) */ #define PF_DTRACE 0x00200000 /* delayed trace (used on m68k) */ #define PF_ONSIGSTK 0x00400000 /* works on signal stack (m68k only) */ @@ -308,7 +307,7 @@ struct task_struct { * your own risk!. Base=0, limit=0x1fffff (=2MB) */ #define INIT_TASK \ -/* state etc */ { 0,DEF_PRIORITY,DEF_PRIORITY,0,0,0,0, \ +/* state etc */ { 0,DEF_PRIORITY,DEF_PRIORITY,0,0, \ /* debugregs */ { 0, }, \ /* exec domain */&default_exec_domain, \ /* binfmt */ NULL, \ @@ -336,7 +335,7 @@ struct task_struct { /* fs */ &init_fs, \ /* files */ &init_files, \ /* mm */ &init_mm, \ -/* signals */ &init_signals, \ +/* signals */ &init_signals, {{0}}, {{0}}, NULL, &init_task.sigqueue, \ /* SMP */ 0,0,0,0, \ /* locks */ INIT_LOCKS \ } @@ -445,15 +444,61 @@ extern void FASTCALL(wake_up(struct wait_queue ** p)); extern void FASTCALL(wake_up_interruptible(struct wait_queue ** p)); extern void FASTCALL(wake_up_process(struct task_struct * tsk)); -extern void notify_parent(struct task_struct * tsk, int signal); extern void release(struct task_struct * p); -extern void force_sig(unsigned long sig,struct task_struct * p); -extern int send_sig(unsigned long sig,struct task_struct * p,int priv); extern int in_group_p(gid_t grp); +extern void flush_signals(struct task_struct *); +extern void flush_signal_handlers(struct task_struct *); +extern int dequeue_signal(sigset_t *block, siginfo_t *); +extern int send_sig_info(int, struct siginfo *info, struct task_struct *); +extern int force_sig_info(int, struct siginfo *info, struct task_struct *); +extern int kill_pg_info(int, struct siginfo *info, pid_t); +extern int kill_sl_info(int, struct siginfo *info, pid_t); +extern int kill_proc_info(int, struct siginfo *info, pid_t); +extern int kill_something_info(int, struct siginfo *info, int); +extern void notify_parent(struct task_struct * tsk, int); +extern void force_sig(int sig, struct task_struct * p); +extern int send_sig(int sig, struct task_struct * p, int priv); +extern int kill_pg(pid_t, int, int); +extern int kill_sl(pid_t, int, int); +extern int kill_proc(pid_t, int, int); +extern int do_sigaction(int sig, const struct k_sigaction *act, + struct k_sigaction *oact); + extern inline int signal_pending(struct task_struct *p) { - return (p->signal &~ p->blocked) != 0; + return (p->sigpending != 0); +} + +/* Reevaluate whether the task has signals pending delivery. + This is required every time the blocked sigset_t changes. + All callers should have t->sigmask_lock. */ + +static inline void recalc_sigpending(struct task_struct *t) +{ + unsigned long ready; + long i; + + switch (_NSIG_WORDS) { + default: + for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;) + ready |= t->signal.sig[i] &~ t->blocked.sig[i]; + break; + + case 4: ready = t->signal.sig[3] &~ t->blocked.sig[3]; + ready |= t->signal.sig[2] &~ t->blocked.sig[2]; + ready |= t->signal.sig[1] &~ t->blocked.sig[1]; + ready |= t->signal.sig[0] &~ t->blocked.sig[0]; + break; + + case 2: ready = t->signal.sig[1] &~ t->blocked.sig[1]; + ready |= t->signal.sig[0] &~ t->blocked.sig[0]; + break; + + case 1: ready = t->signal.sig[0] &~ t->blocked.sig[0]; + } + + t->sigpending = (ready != 0); } extern int request_irq(unsigned int irq, @@ -556,22 +601,6 @@ extern inline void remove_wait_queue(struct wait_queue ** p, struct wait_queue * write_unlock_irqrestore(&waitqueue_lock, flags); } -extern inline void poll_wait(struct wait_queue ** wait_address, poll_table * p) -{ - struct poll_table_entry * entry; - - if (!p || !wait_address) - return; - if (p->nr >= __MAX_POLL_TABLE_ENTRIES) - return; - entry = p->entry + p->nr; - entry->wait_address = wait_address; - entry->wait.task = current; - entry->wait.next = NULL; - add_wait_queue(wait_address,&entry->wait); - p->nr++; -} - #define REMOVE_LINKS(p) do { unsigned long flags; \ write_lock_irqsave(&tasklist_lock, flags); \ (p)->next_task->prev_task = (p)->prev_task; \ diff --git a/include/linux/signal.h b/include/linux/signal.h index 9d1afa91c..0dd75b886 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h @@ -2,5 +2,204 @@ #define _LINUX_SIGNAL_H #include <asm/signal.h> +#include <asm/siginfo.h> -#endif +#ifdef __KERNEL__ +/* + * Real Time signals may be queued. + */ + +struct signal_queue +{ + struct signal_queue *next; + siginfo_t info; +}; + +/* + * Define some primitives to manipulate sigset_t. + */ + +#ifndef __HAVE_ARCH_SIG_BITOPS +#include <asm/bitops.h> + +/* We don't use <asm/bitops.h> for these because there is no need to + be atomic. */ +extern inline void sigaddset(sigset_t *set, int _sig) +{ + unsigned long sig = _sig - 1; + if (_NSIG_WORDS == 1) + set->sig[0] |= 1UL << sig; + else + set->sig[sig / _NSIG_BPW] |= 1UL << (sig % _NSIG_BPW); +} + +extern inline void sigdelset(sigset_t *set, int _sig) +{ + unsigned long sig = _sig - 1; + if (_NSIG_WORDS == 1) + set->sig[0] &= ~(1UL << sig); + else + set->sig[sig / _NSIG_BPW] &= ~(1UL << (sig % _NSIG_BPW)); +} + +extern inline int sigismember(sigset_t *set, int _sig) +{ + unsigned long sig = _sig - 1; + if (_NSIG_WORDS == 1) + return 1 & (set->sig[0] >> sig); + else + return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW)); +} + +extern inline int sigfindinword(unsigned long word) +{ + return ffz(~word); +} + +#define sigmask(sig) (1UL << ((sig) - 1)) + +#endif /* __HAVE_ARCH_SIG_BITOPS */ + +#ifndef __HAVE_ARCH_SIG_SETOPS +#include <linux/string.h> + +#define _SIG_SET_BINOP(name, op) \ +extern inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \ +{ \ + unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \ + unsigned long i; \ + \ + for (i = 0; i < _NSIG_WORDS/4; ++i) { \ + a0 = a->sig[4*i+0]; a1 = a->sig[4*i+1]; \ + a2 = a->sig[4*i+2]; a3 = a->sig[4*i+3]; \ + b0 = b->sig[4*i+0]; b1 = b->sig[4*i+1]; \ + b2 = b->sig[4*i+2]; b3 = b->sig[4*i+3]; \ + r->sig[4*i+0] = op(a0, b0); \ + r->sig[4*i+1] = op(a1, b1); \ + r->sig[4*i+2] = op(a2, b2); \ + r->sig[4*i+3] = op(a3, b3); \ + } \ + switch (_NSIG_WORDS % 4) { \ + case 3: \ + a0 = a->sig[4*i+0]; a1 = a->sig[4*i+1]; a2 = a->sig[4*i+2]; \ + b0 = b->sig[4*i+0]; b1 = b->sig[4*i+1]; b2 = b->sig[4*i+2]; \ + r->sig[4*i+0] = op(a0, b0); \ + r->sig[4*i+1] = op(a1, b1); \ + r->sig[4*i+2] = op(a2, b2); \ + break; \ + case 2: \ + a0 = a->sig[4*i+0]; a1 = a->sig[4*i+1]; \ + b0 = b->sig[4*i+0]; b1 = b->sig[4*i+1]; \ + r->sig[4*i+0] = op(a0, b0); \ + r->sig[4*i+1] = op(a1, b1); \ + break; \ + case 1: \ + a0 = a->sig[4*i+0]; b0 = b->sig[4*i+0]; \ + r->sig[4*i+0] = op(a0, b0); \ + break; \ + } \ +} + +#define _sig_or(x,y) ((x) | (y)) +_SIG_SET_BINOP(sigorsets, _sig_or) + +#define _sig_and(x,y) ((x) & (y)) +_SIG_SET_BINOP(sigandsets, _sig_and) + +#define _sig_nand(x,y) ((x) & ~(y)) +_SIG_SET_BINOP(signandsets, _sig_nand) + +#undef _SIG_SET_BINOP +#undef _sig_or +#undef _sig_and +#undef _sig_nand + +#define _SIG_SET_OP(name, op) \ +extern inline void name(sigset_t *set) \ +{ \ + unsigned long i; \ + \ + for (i = 0; i < _NSIG_WORDS/4; ++i) { \ + set->sig[4*i+0] = op(set->sig[4*i+0]); \ + set->sig[4*i+1] = op(set->sig[4*i+1]); \ + set->sig[4*i+2] = op(set->sig[4*i+2]); \ + set->sig[4*i+3] = op(set->sig[4*i+3]); \ + } \ + switch (_NSIG_WORDS % 4) { \ + case 3: set->sig[4*i+2] = op(set->sig[4*i+2]); \ + case 2: set->sig[4*i+1] = op(set->sig[4*i+1]); \ + case 1: set->sig[4*i+0] = op(set->sig[4*i+0]); \ + } \ +} + +#define _sig_not(x) (~(x)) +_SIG_SET_OP(signotset, _sig_not) + +#undef _SIG_SET_OP +#undef _sig_not + +extern inline void sigemptyset(sigset_t *set) +{ + switch (_NSIG_WORDS) { + default: + memset(set, 0, sizeof(sigset_t)); + break; + case 2: set->sig[1] = 0; + case 1: set->sig[0] = 0; + break; + } +} + +extern inline void sigfillset(sigset_t *set) +{ + switch (_NSIG_WORDS) { + default: + memset(set, -1, sizeof(sigset_t)); + break; + case 2: set->sig[1] = -1; + case 1: set->sig[0] = -1; + break; + } +} + +/* Some extensions for manipulating the low 32 signals in particular. */ + +extern inline void sigaddsetmask(sigset_t *set, unsigned long mask) +{ + set->sig[0] |= mask; +} + +extern inline void sigdelsetmask(sigset_t *set, unsigned long mask) +{ + set->sig[0] &= ~mask; +} + +extern inline void siginitset(sigset_t *set, unsigned long mask) +{ + set->sig[0] = mask; + switch (_NSIG_WORDS) { + default: + memset(&set->sig[1], 0, sizeof(long)*(_NSIG_WORDS-1)); + break; + case 2: set->sig[1] = 0; + case 1: + } +} + +extern inline void siginitsetinv(sigset_t *set, unsigned long mask) +{ + set->sig[0] = ~mask; + switch (_NSIG_WORDS) { + default: + memset(&set->sig[1], -1, sizeof(long)*(_NSIG_WORDS-1)); + break; + case 2: set->sig[1] = -1; + case 1: + } +} + +#endif /* __HAVE_ARCH_SIG_SETOPS */ + +#endif /* __KERNEL__ */ + +#endif /* _LINUX_SIGNAL_H */ diff --git a/include/linux/sjcd.h b/include/linux/sjcd.h index 0aa5e7146..e69de29bb 100644 --- a/include/linux/sjcd.h +++ b/include/linux/sjcd.h @@ -1,181 +0,0 @@ -/* - * Definitions for a Sanyo CD-ROM interface. - * - * Copyright (C) 1995 Vadim V. Model - * model@cecmow.enet.dec.com - * vadim@rbrf.msk.su - * vadim@ipsun.ras.ru - * Eric van der Maarel - * H.T.M.v.d.Maarel@marin.nl - * - * This information is based on mcd.c from M. Harriss and sjcd102.lst from - * E. Moenkeberg. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SJCD_H__ -#define __SJCD_H__ - -/* - * Change this to set the I/O port address as default. More flexibility - * come with setup implementation. - */ -#define SJCD_BASE_ADDR 0x340 - -/* - * Change this to set the irq as default. Really SANYO do not use interrupts - * at all. - */ -#define SJCD_INTR_NR 0 - -/* - * Change this to set the dma as default value. really SANYO does not use - * direct memory access at all. - */ -#define SJCD_DMA_NR 0 - -/* - * Macros which allow us to find out the status of the drive. - */ -#define SJCD_STATUS_AVAILABLE( x ) (((x)&0x02)==0) -#define SJCD_DATA_AVAILABLE( x ) (((x)&0x01)==0) - -/* - * Port access macro. Three ports are available: S-data port (command port), - * status port (read only) and D-data port (read only). - */ -#define SJCDPORT( x ) ( sjcd_base + ( x ) ) -#define SJCD_STATUS_PORT SJCDPORT( 1 ) -#define SJCD_S_DATA_PORT SJCDPORT( 0 ) -#define SJCD_COMMAND_PORT SJCDPORT( 0 ) -#define SJCD_D_DATA_PORT SJCDPORT( 2 ) - -/* - * Drive info bits. Drive info available as first (mandatory) byte of - * command completion status. - */ -#define SST_NOT_READY 0x10 /* no disk in the drive (???) */ -#define SST_MEDIA_CHANGED 0x20 /* disk is changed */ -#define SST_DOOR_OPENED 0x40 /* door is open */ - -/* commands */ - -#define SCMD_EJECT_TRAY 0xD0 /* eject tray if not locked */ -#define SCMD_LOCK_TRAY 0xD2 /* lock tray when in */ -#define SCMD_UNLOCK_TRAY 0xD4 /* unlock tray when in */ -#define SCMD_CLOSE_TRAY 0xD6 /* load tray in */ - -#define SCMD_RESET 0xFA /* soft reset */ -#define SCMD_GET_STATUS 0x80 -#define SCMD_GET_VERSION 0xCC - -#define SCMD_DATA_READ 0xA0 /* are the same, depend on mode&args */ -#define SCMD_SEEK 0xA0 -#define SCMD_PLAY 0xA0 - -#define SCMD_GET_QINFO 0xA8 - -#define SCMD_SET_MODE 0xC4 -#define SCMD_MODE_PLAY 0xE0 -#define SCMD_MODE_COOKED (0xF8 & ~0x20) -#define SCMD_MODE_RAW 0xF9 -#define SCMD_MODE_x20_BIT 0x20 /* What is it for ? */ - -#define SCMD_SET_VOLUME 0xAE -#define SCMD_PAUSE 0xE0 -#define SCMD_STOP 0xE0 - -#define SCMD_GET_DISK_INFO 0xAA - -/* - * Some standard arguments for SCMD_GET_DISK_INFO. - */ -#define SCMD_GET_1_TRACK 0xA0 /* get the first track information */ -#define SCMD_GET_L_TRACK 0xA1 /* get the last track information */ -#define SCMD_GET_D_SIZE 0xA2 /* get the whole disk information */ - -/* - * Borrowed from hd.c. Allows to optimize multiple port read commands. - */ -#define S_READ_DATA( port, buf, nr ) insb( port, buf, nr ) - -/* - * We assume that there are no audio disks with TOC length more than this - * number (I personally have never seen disks with more than 20 fragments). - */ -#define SJCD_MAX_TRACKS 100 - -struct msf { - unsigned char min; - unsigned char sec; - unsigned char frame; -}; - -struct sjcd_hw_disk_info { - unsigned char track_control; - unsigned char track_no; - unsigned char x, y, z; - union { - unsigned char track_no; - struct msf track_msf; - } un; -}; - -struct sjcd_hw_qinfo { - unsigned char track_control; - unsigned char track_no; - unsigned char x; - struct msf rel; - struct msf abs; -}; - -struct sjcd_play_msf { - struct msf start; - struct msf end; -}; - -struct sjcd_disk_info { - unsigned char first; - unsigned char last; - struct msf disk_length; - struct msf first_track; -}; - -struct sjcd_toc { - unsigned char ctrl_addr; - unsigned char track; - unsigned char point_index; - struct msf track_time; - struct msf disk_time; -}; - -#if defined( SJCD_GATHER_STAT ) - -struct sjcd_stat { - int ticks; - int tticks[ 8 ]; - int idle_ticks; - int start_ticks; - int mode_ticks; - int read_ticks; - int data_ticks; - int stop_ticks; - int stopping_ticks; -}; - -#endif - -#endif diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a2617b15c..3668712d8 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -90,15 +90,10 @@ struct sk_buff arp; /* Has IP/ARP resolution finished */ unsigned char tries, /* Times tried */ inclone, /* Inline clone */ - priority, pkt_type, /* Packet class */ pkt_bridged, /* Tracker for bridging */ ip_summed; /* Driver fed us an IP checksum */ -#define PACKET_HOST 0 /* To us */ -#define PACKET_BROADCAST 1 /* To all */ -#define PACKET_MULTICAST 2 /* To group */ -#define PACKET_OTHERHOST 3 /* To someone else */ -#define PACKET_NDISC 17 /* Outgoing NDISC packet */ + __u32 priority; atomic_t users; /* User count - see datagram.c,tcp.c */ unsigned short protocol; /* Packet protocol from driver. */ unsigned short security; /* Security level of packet */ @@ -447,13 +442,17 @@ here: ; return skb->data; } -extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len) +extern __inline__ char *__skb_pull(struct sk_buff *skb, unsigned int len) { + skb->len-=len; + return skb->data+=len; +} + +extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len) +{ if (len > skb->len) return NULL; - skb->data+=len; - skb->len-=len; - return skb->data; + return __skb_pull(skb,len); } extern __inline__ int skb_headroom(struct sk_buff *skb) @@ -472,11 +471,16 @@ extern __inline__ void skb_reserve(struct sk_buff *skb, unsigned int len) skb->tail+=len; } +extern __inline__ void __skb_trim(struct sk_buff *skb, unsigned int len) +{ + skb->len = len; + skb->tail = skb->data+len; +} + extern __inline__ void skb_trim(struct sk_buff *skb, unsigned int len) { if (skb->len > len) { - skb->len = len; - skb->tail = skb->data+len; + __skb_trim(skb, len); } } @@ -515,8 +519,15 @@ extern __inline__ void skb_orphan(struct sk_buff *skb) skb->sk = NULL; } +extern __inline__ void skb_queue_purge(struct sk_buff_head *list) +{ + struct sk_buff *skb; + while ((skb=skb_dequeue(list))!=NULL) + kfree_skb(skb,0); +} + extern struct sk_buff * skb_recv_datagram(struct sock *sk,unsigned flags,int noblock, int *err); -extern unsigned int datagram_poll(struct socket *sock, poll_table *wait); +extern unsigned int datagram_poll(struct socket *sock, struct poll_table_struct *wait); extern int skb_copy_datagram(struct sk_buff *from, int offset, char *to,int size); extern int skb_copy_datagram_iovec(struct sk_buff *from, int offset, struct iovec *to,int size); extern void skb_free_datagram(struct sock * sk, struct sk_buff *skb); diff --git a/include/linux/socket.h b/include/linux/socket.h index 96ec54d1d..86d2b5665 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -12,8 +12,7 @@ typedef unsigned short sa_family_t; * 1003.1g requires sa_family_t and that sa_data is char. */ -struct sockaddr -{ +struct sockaddr { sa_family_t sa_family; /* address family, AF_xxx */ char sa_data[14]; /* 14 bytes of protocol address */ }; @@ -29,8 +28,7 @@ struct linger { * belong in an obscure libc emulation or the bin. */ -struct msghdr -{ +struct msghdr { void * msg_name; /* Socket name */ int msg_namelen; /* Length of name */ struct iovec * msg_iov; /* Data blocks */ @@ -57,7 +55,8 @@ struct cmsghdr { * Table 5-14 of POSIX 1003.1g */ -#define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr(mhdr, cmsg) +#define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg)) +#define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg)) #define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) ) @@ -65,18 +64,19 @@ struct cmsghdr { #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) -#define CMSG_FIRSTHDR(msg) ((msg)->msg_controllen >= sizeof(struct cmsghdr) ? \ - (struct cmsghdr *)(msg)->msg_control : \ - (struct cmsghdr *)NULL) +#define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ? \ + (struct cmsghdr *)(ctl) : \ + (struct cmsghdr *)NULL) +#define CMSG_FIRSTHDR(msg) __CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen) /* * This mess will go away with glibc */ #ifdef __KERNEL__ -#define KINLINE extern __inline__ +#define __KINLINE extern __inline__ #else -#define KINLINE static +#define __KINLINE static #endif @@ -84,20 +84,23 @@ struct cmsghdr { * Get the next cmsg header */ -KINLINE struct cmsghdr * cmsg_nxthdr(struct msghdr *mhdr, - struct cmsghdr *cmsg) +__KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size, + struct cmsghdr *__cmsg) { - unsigned char * ptr; + unsigned char * __ptr; - if (cmsg->cmsg_len < sizeof(struct cmsghdr)) - { + if (__cmsg->cmsg_len < sizeof(struct cmsghdr)) return NULL; - } - ptr = ((unsigned char *) cmsg) + CMSG_ALIGN(cmsg->cmsg_len); - if (ptr >= (unsigned char *) mhdr->msg_control + mhdr->msg_controllen) + __ptr = ((unsigned char *) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len); + if (__ptr >= (unsigned char *) __ctl + __size) return NULL; - return (struct cmsghdr *) ptr; + return (struct cmsghdr *) __ptr; +} + +__KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg) +{ + return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); } /* "Socket"-level control message types: */ @@ -106,8 +109,7 @@ KINLINE struct cmsghdr * cmsg_nxthdr(struct msghdr *mhdr, #define SCM_CREDENTIALS 0x02 /* rw: struct ucred */ #define SCM_CONNECT 0x03 /* rw: struct scm_connect */ -struct ucred -{ +struct ucred { __kernel_pid_t pid; __kernel_uid_t uid; __kernel_gid_t gid; @@ -132,6 +134,9 @@ struct ucred #define AF_NETBEUI 13 /* Reserved for 802.2LLC project*/ #define AF_SECURITY 14 /* Security callback pseudo AF */ #define pseudo_AF_KEY 15 /* PF_KEY key management API */ +#define AF_NETLINK 16 +#define AF_ROUTE AF_NETLINK /* Alias to emulate 4.4BSD */ +#define AF_PACKET 17 /* Packet family */ #define AF_MAX 32 /* For now.. */ /* Protocol families, same as address families. */ @@ -152,6 +157,9 @@ struct ucred #define PF_NETBEUI AF_NETBEUI #define PF_SECURITY AF_SECURITY #define PF_KEY pseudo_AF_KEY +#define PF_NETLINK AF_NETLINK +#define PF_ROUTE AF_ROUTE +#define PF_PACKET AF_PACKET #define PF_MAX AF_MAX @@ -184,6 +192,9 @@ struct ucred /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ #define SOL_IP 0 +/* #define SOL_ICMP 1 No-no-no! Due to Linux :-) we cannot use SOL_ICMP=1 */ +#define SOL_TCP 6 +#define SOL_UDP 17 #define SOL_IPV6 41 #define SOL_ICMPV6 58 #define SOL_RAW 255 @@ -194,8 +205,7 @@ struct ucred #define SOL_ROSE 260 #define SOL_DECNET 261 #define SOL_X25 262 -#define SOL_TCP 6 -#define SOL_UDP 17 +#define SOL_PACKET 263 /* IPX options */ #define IPX_TYPE 1 @@ -204,24 +214,19 @@ struct ucred #define TCP_NODELAY 1 #define TCP_MAXSEG 2 -/* The various priorities. */ -#define SOPRI_INTERACTIVE 0 -#define SOPRI_NORMAL 1 -#define SOPRI_BACKGROUND 2 - #ifdef __KERNEL__ extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); extern int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, int offset, int len); -extern unsigned int csum_partial_copy_fromiovecend(unsigned char *kdata, - struct iovec *iov, - int offset, - int len, int csum); +extern int csum_partial_copy_fromiovecend(unsigned char *kdata, + struct iovec *iov, + int offset, + int len, int *csump); extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode); extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); extern int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen); extern int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr); -extern void put_cmsg(struct msghdr*, int level, int type, int len, void *data); +extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); #endif #endif /* _LINUX_SOCKET_H */ diff --git a/include/linux/sockios.h b/include/linux/sockios.h index 5147dd23c..5465bc6b8 100644 --- a/include/linux/sockios.h +++ b/include/linux/sockios.h @@ -53,18 +53,19 @@ #define SIOCSIFSLAVE 0x8930 #define SIOCADDMULTI 0x8931 /* Multicast address lists */ #define SIOCDELMULTI 0x8932 -#define SIOGIFINDEX 0x8933 /* name -> if_index mapping */ -#define SIOGIFNAME 0x8934 /* if_index -> name mapping */ -#define SIOCGIFCOUNT 0x8935 /* get number of interfaces */ +#define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ +#define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ +#define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ +#define SIOCGIFPFLAGS 0x8935 #define SIOCDIFADDR 0x8936 /* delete PA address */ +#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ +#define SIOCGIFCOUNT 0x8938 /* get number of devices */ #define SIOCGIFBR 0x8940 /* Bridging support */ #define SIOCSIFBR 0x8941 /* Set bridging options */ /* ARP cache control calls. */ -#define OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ -#define OLD_SIOCGARP 0x8951 /* old get ARP table entry */ -#define OLD_SIOCSARP 0x8952 /* old set ARP table entry */ + /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ #define SIOCDARP 0x8953 /* delete ARP table entry */ #define SIOCGARP 0x8954 /* get ARP table entry */ #define SIOCSARP 0x8955 /* set ARP table entry */ diff --git a/include/linux/sonycd535.h b/include/linux/sonycd535.h index 5dea1ef16..e69de29bb 100644 --- a/include/linux/sonycd535.h +++ b/include/linux/sonycd535.h @@ -1,183 +0,0 @@ -#ifndef SONYCD535_H -#define SONYCD535_H - -/* - * define all the commands recognized by the CDU-531/5 - */ -#define SONY535_REQUEST_DRIVE_STATUS_1 (0x80) -#define SONY535_REQUEST_SENSE (0x82) -#define SONY535_REQUEST_DRIVE_STATUS_2 (0x84) -#define SONY535_REQUEST_ERROR_STATUS (0x86) -#define SONY535_REQUEST_AUDIO_STATUS (0x88) -#define SONY535_INQUIRY (0x8a) - -#define SONY535_SET_INACTIVITY_TIME (0x90) - -#define SONY535_SEEK_AND_READ_N_BLOCKS_1 (0xa0) -#define SONY535_SEEK_AND_READ_N_BLOCKS_2 (0xa4) -#define SONY535_PLAY_AUDIO (0xa6) - -#define SONY535_REQUEST_DISC_CAPACITY (0xb0) -#define SONY535_REQUEST_TOC_DATA (0xb2) -#define SONY535_REQUEST_SUB_Q_DATA (0xb4) -#define SONY535_REQUEST_ISRC (0xb6) -#define SONY535_REQUEST_UPC_EAN (0xb8) - -#define SONY535_SET_DRIVE_MODE (0xc0) -#define SONY535_REQUEST_DRIVE_MODE (0xc2) -#define SONY535_SET_RETRY_COUNT (0xc4) - -#define SONY535_DIAGNOSTIC_1 (0xc6) -#define SONY535_DIAGNOSTIC_4 (0xcc) -#define SONY535_DIAGNOSTIC_5 (0xce) - -#define SONY535_EJECT_CADDY (0xd0) -#define SONY535_DISABLE_EJECT_BUTTON (0xd2) -#define SONY535_ENABLE_EJECT_BUTTON (0xd4) - -#define SONY535_HOLD (0xe0) -#define SONY535_AUDIO_PAUSE_ON_OFF (0xe2) -#define SONY535_SET_VOLUME (0xe8) - -#define SONY535_STOP (0xf0) -#define SONY535_SPIN_UP (0xf2) -#define SONY535_SPIN_DOWN (0xf4) - -#define SONY535_CLEAR_PARAMETERS (0xf6) -#define SONY535_CLEAR_ENDING_ADDRESS (0xf8) - -/* - * define some masks - */ -#define SONY535_DATA_NOT_READY_BIT (0x1) -#define SONY535_RESULT_NOT_READY_BIT (0x2) - -/* - * drive status 1 - */ -#define SONY535_STATUS1_COMMAND_ERROR (0x1) -#define SONY535_STATUS1_DATA_ERROR (0x2) -#define SONY535_STATUS1_SEEK_ERROR (0x4) -#define SONY535_STATUS1_DISC_TYPE_ERROR (0x8) -#define SONY535_STATUS1_NOT_SPINNING (0x10) -#define SONY535_STATUS1_EJECT_BUTTON_PRESSED (0x20) -#define SONY535_STATUS1_CADDY_NOT_INSERTED (0x40) -#define SONY535_STATUS1_BYTE_TWO_FOLLOWS (0x80) - -/* - * drive status 2 - */ -#define SONY535_CDD_LOADING_ERROR (0x7) -#define SONY535_CDD_NO_DISC (0x8) -#define SONY535_CDD_UNLOADING_ERROR (0x9) -#define SONY535_CDD_CADDY_NOT_INSERTED (0xd) -#define SONY535_ATN_RESET_OCCURRED (0x2) -#define SONY535_ATN_DISC_CHANGED (0x4) -#define SONY535_ATN_RESET_AND_DISC_CHANGED (0x6) -#define SONY535_ATN_EJECT_IN_PROGRESS (0xe) -#define SONY535_ATN_BUSY (0xf) - -/* - * define some parameters - */ -#define SONY535_AUDIO_DRIVE_MODE (0) -#define SONY535_CDROM_DRIVE_MODE (0xe0) - -#define SONY535_PLAY_OP_PLAYBACK (0) -#define SONY535_PLAY_OP_ENTER_HOLD (1) -#define SONY535_PLAY_OP_SET_AUDIO_ENDING_ADDR (2) -#define SONY535_PLAY_OP_SCAN_FORWARD (3) -#define SONY535_PLAY_OP_SCAN_BACKWARD (4) - -/* - * convert from msf format to block number - */ -#define SONY_BLOCK_NUMBER(m,s,f) (((m)*60L+(s))*75L+(f)) -#define SONY_BLOCK_NUMBER_MSF(x) (((x)[0]*60L+(x)[1])*75L+(x)[2]) - -/* - * error return values from the doSonyCmd() routines - */ -#define TIME_OUT (-1) -#define NO_CDROM (-2) -#define BAD_STATUS (-3) -#define CD_BUSY (-4) -#define NOT_DATA_CD (-5) -#define NO_ROOM (-6) - -#define LOG_START_OFFSET 150 /* Offset of first logical sector */ - -#define SONY_JIFFIES_TIMEOUT (5*HZ) /* Maximum time - the drive will wait/try for an - operation */ -#define SONY_READY_RETRIES (50000) /* How many times to retry a - spin waiting for a register - to come ready */ -#define SONY535_FAST_POLLS (10000) /* how many times recheck - status waiting for a data - to become ready */ - -typedef unsigned char Byte; - -/* - * This is the complete status returned from the drive configuration request - * command. - */ -struct s535_sony_drive_config -{ - char vendor_id[8]; - char product_id[16]; - char product_rev_level[4]; -}; - -/* The following is returned from the request sub-q data command */ -struct s535_sony_subcode -{ - unsigned char address :4; - unsigned char control :4; - unsigned char track_num; - unsigned char index_num; - unsigned char rel_msf[3]; - unsigned char abs_msf[3]; -}; - -struct s535_sony_disc_capacity -{ - Byte mFirstTrack, sFirstTrack, fFirstTrack; - Byte mLeadOut, sLeadOut, fLeadOut; -}; - -/* - * The following is returned from the request TOC (Table Of Contents) command. - * (last_track_num-first_track_num+1) values are valid in tracks. - */ -struct s535_sony_toc -{ - unsigned char reserved0 :4; - unsigned char control0 :4; - unsigned char point0; - unsigned char first_track_num; - unsigned char reserved0a; - unsigned char reserved0b; - unsigned char reserved1 :4; - unsigned char control1 :4; - unsigned char point1; - unsigned char last_track_num; - unsigned char dummy1; - unsigned char dummy2; - unsigned char reserved2 :4; - unsigned char control2 :4; - unsigned char point2; - unsigned char lead_out_start_msf[3]; - struct - { - unsigned char reserved :4; - unsigned char control :4; - unsigned char track; - unsigned char track_start_msf[3]; - } tracks[100]; - - unsigned int lead_out_start_lba; -}; - -#endif /* SONYCD535_H */ diff --git a/include/linux/soundcard.h b/include/linux/soundcard.h index bfd28359e..e48c0b079 100644 --- a/include/linux/soundcard.h +++ b/include/linux/soundcard.h @@ -599,6 +599,7 @@ typedef struct buffmem_desc { #define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc) #define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21) #define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22) +#define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int) /* * Application's profile defines the way how playback underrun situations should be handled. diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 587aaa847..1f9ab2bf8 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -150,14 +150,15 @@ enum NET_IPV4_RFC1812_FILTER, NET_IPV4_LOG_MARTIANS, NET_IPV4_SOURCE_ROUTE, - NET_IPV4_ADDRMASK_AGENT, - NET_IPV4_BOOTP_AGENT, + NET_IPV4_SEND_REDIRECTS, + NET_IPV4_AUTOCONFIG, NET_IPV4_BOOTP_RELAY, - NET_IPV4_FIB_MODEL, + NET_IPV4_PROXY_ARP, NET_IPV4_NO_PMTU_DISC, NET_IPV4_ACCEPT_REDIRECTS, NET_IPV4_SECURE_REDIRECTS, NET_IPV4_RFC1620_REDIRECTS, + NET_IPV4_RTCACHE_FLUSH, NET_IPV4_TCP_SYN_RETRIES, NET_IPV4_IPFRAG_HIGH_THRESH, NET_IPV4_IPFRAG_LOW_THRESH, @@ -176,6 +177,14 @@ enum NET_TCP_STDURG, NET_TCP_SYN_TAILDROP, NET_TCP_MAX_SYN_BACKLOG, + NET_IPV4_LOCAL_PORT_RANGE, + NET_IPV4_ICMP_ECHO_IGNORE_ALL, + NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, + NET_IPV4_ICMP_SOURCEQUENCH_RATE, + NET_IPV4_ICMP_DESTUNREACH_RATE, + NET_IPV4_ICMP_TIMEEXCEED_RATE, + NET_IPV4_ICMP_PARAMPROB_RATE, + NET_IPV4_ICMP_ECHOREPLY_RATE }; @@ -198,6 +207,8 @@ enum { NET_IPV6_RTR_SOLICITS, NET_IPV6_RTR_SOLICIT_INTERVAL, NET_IPV6_RTR_SOLICIT_DELAY, + + NET_IPV6_ICMPV6_TIME, }; /* /proc/sys/net/ipx */ @@ -291,6 +302,14 @@ enum { /* CTL_DEBUG names: */ /* CTL_DEV names: */ +enum { + DEV_CDROM = 1, +}; + +/* /proc/sys/dev/cdrom */ +enum { + DEV_CDROM_INFO = 1, +}; #ifdef __KERNEL__ diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h index eb443b269..7c5167fa8 100644 --- a/include/linux/sysv_fs.h +++ b/include/linux/sysv_fs.h @@ -361,17 +361,14 @@ sv_bread (struct super_block *sb, kdev_t dev, unsigned int block) * Function prototypes */ -extern int sysv_lookup(struct inode * dir,const char * name, int len, - struct inode ** result); -extern int sysv_create(struct inode * dir,const char * name, int len, int mode, - struct inode ** result); -extern int sysv_mkdir(struct inode * dir, const char * name, int len, int mode); -extern int sysv_rmdir(struct inode * dir, const char * name, int len); -extern int sysv_unlink(struct inode * dir, const char * name, int len); -extern int sysv_symlink(struct inode * inode, const char * name, int len, - const char * symname); -extern int sysv_link(struct inode * oldinode, struct inode * dir, const char * name, int len); -extern int sysv_mknod(struct inode * dir, const char * name, int len, int mode, int rdev); +extern int sysv_lookup(struct inode * dir, struct dentry * dentry); +extern int sysv_create(struct inode * dir, struct dentry * dentry, int mode); +extern int sysv_mkdir(struct inode * dir, struct dentry * dentry, int mode); +extern int sysv_rmdir(struct inode * dir, struct dentry * dentry); +extern int sysv_unlink(struct inode * dir, struct dentry * dentry); +extern int sysv_symlink(struct inode * inode, struct dentry * dentry, const char * symname); +extern int sysv_link(struct inode * oldinode, struct inode * dir, struct dentry * dentry); +extern int sysv_mknod(struct inode * dir, struct dentry * dentry, int mode, int rdev); extern int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, struct inode * new_dir, struct dentry * new_dentry); extern struct inode * sysv_new_inode(const struct inode * dir); diff --git a/include/linux/tcp.h b/include/linux/tcp.h index ae6a063e3..594b3108a 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -68,4 +68,18 @@ enum { TCP_CLOSING /* now a valid state */ }; +enum { + TCPF_ESTABLISHED = (1 << 1), + TCPF_SYN_SENT = (1 << 2), + TCPF_SYN_RECV = (1 << 3), + TCPF_FIN_WAIT1 = (1 << 4), + TCPF_FIN_WAIT2 = (1 << 5), + TCPF_TIME_WAIT = (1 << 6), + TCPF_CLOSE = (1 << 7), + TCPF_CLOSE_WAIT = (1 << 8), + TCPF_LAST_ACK = (1 << 9), + TCPF_LISTEN = (1 << 10), + TCPF_CLOSING = (1 << 11) +}; + #endif /* _LINUX_TCP_H */ diff --git a/include/linux/time.h b/include/linux/time.h index 0ecf7bbba..d60d8c776 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -1,19 +1,44 @@ #ifndef _LINUX_TIME_H #define _LINUX_TIME_H +#include <asm/param.h> +#include <linux/types.h> + #ifndef _STRUCT_TIMESPEC #define _STRUCT_TIMESPEC -#ifdef __KERNEL__ struct timespec { - long tv_sec; /* seconds */ + time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; -#endif /* (__KERNEL__) */ #endif /* _STRUCT_TIMESPEC */ +/* + * change timeval to jiffies, trying to avoid the + * most obvious overflows.. + */ +static __inline__ unsigned long +timespec_to_jiffies(struct timespec *value) +{ + unsigned long sec = value->tv_sec; + long nsec = value->tv_nsec; + + if (sec > ((long)(~0UL >> 1) / HZ)) + return ~0UL >> 1; + nsec += 1000000000L / HZ - 1; + nsec /= 1000000000L / HZ; + return HZ * sec + nsec; +} + +static __inline__ void +jiffies_to_timespec(unsigned long jiffies, struct timespec *value) +{ + value->tv_nsec = (jiffies % HZ) * (1000000000L / HZ); + value->tv_sec = jiffies / HZ; +} + struct timeval { - int tv_sec; /* seconds */ - int tv_usec; /* microseconds */ + time_t tv_sec; /* seconds */ + suseconds_t tv_usec; /* microseconds */ }; struct timezone { diff --git a/include/linux/tty.h b/include/linux/tty.h index 78a59c0a5..a00d759f9 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -230,7 +230,7 @@ struct tty_struct { int count; struct winsize winsize; unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; - unsigned char low_latency:1; + unsigned char low_latency:1, warned:1; unsigned char ctrl_status; struct tty_struct *link; @@ -313,6 +313,7 @@ extern int cy_init(void); extern int stl_init(void); extern int stli_init(void); extern int riscom8_init(void); +extern int specialix_init(void); extern int espserial_init(void); extern int tty_paranoia_check(struct tty_struct *tty, kdev_t device, diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 65853d701..1e8bf261c 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -207,10 +207,12 @@ struct tty_driver { #define TTY_DRIVER_TYPE_SERIAL 0x0003 #define TTY_DRIVER_TYPE_PTY 0x0004 #define TTY_DRIVER_TYPE_SCC 0x0005 /* scc driver */ +#define TTY_DRIVER_TYPE_SYSCONS 0x0006 /* system subtypes (magic, used by tty_io.c) */ #define SYSTEM_TYPE_TTY 0x0001 #define SYSTEM_TYPE_CONSOLE 0x0002 +#define SYSTEM_TYPE_SYSCONS 0x0003 /* pty subtypes (magic, used by tty_io.c) */ #define PTY_TYPE_MASTER 0x0001 diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index f5f329607..501ea0765 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h @@ -119,7 +119,8 @@ struct tty_ldisc { int (*ioctl)(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg); void (*set_termios)(struct tty_struct *tty, struct termios * old); - unsigned int (*poll)(struct tty_struct *, struct file *, poll_table *); + unsigned int (*poll)(struct tty_struct *, struct file *, + struct poll_table_struct *); /* * The following routines are called from below. diff --git a/include/linux/types.h b/include/linux/types.h index 7f98711a4..a990773af 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -17,6 +17,7 @@ typedef __kernel_uid_t uid_t; typedef __kernel_gid_t gid_t; typedef __kernel_daddr_t daddr_t; typedef __kernel_key_t key_t; +typedef __kernel_suseconds_t suseconds_t; #if defined(__GNUC__) && !defined(__STRICT_ANSI__) typedef __kernel_loff_t loff_t; diff --git a/include/linux/ucdrom.h b/include/linux/ucdrom.h index 6cf5c05b3..e69de29bb 100644 --- a/include/linux/ucdrom.h +++ b/include/linux/ucdrom.h @@ -1,114 +0,0 @@ -/* ucdrom.h. Uniform cdrom data structures for cdrom.c. -*- linux-c -*- - Copyright (c) 1996 David van Leeuwen. - */ - -#ifndef LINUX_UCDROM_H -#define LINUX_UCDROM_H - -#ifdef __KERNEL__ -struct cdrom_device_info { - struct cdrom_device_ops *ops; /* link to device_ops */ - struct cdrom_device_info *next; /* next device_info for this major */ - void *handle; /* driver-dependent data */ -/* specifications */ - kdev_t dev; /* device number */ - int mask; /* mask of capability: disables them */ - int speed; /* maximum speed for reading data */ - int capacity; /* number of discs in jukebox */ -/* device-related storage */ - int options : 30; /* options flags */ - unsigned mc_flags : 2; /* media change buffer flags */ - int use_count; /* number of times device opened */ -}; - -struct cdrom_device_ops { -/* routines */ - int (*open) (struct cdrom_device_info *, int); - void (*release) (struct cdrom_device_info *); - int (*drive_status) (struct cdrom_device_info *, int); - int (*disc_status) (struct cdrom_device_info *); - int (*media_changed) (struct cdrom_device_info *, int); - int (*tray_move) (struct cdrom_device_info *, int); - int (*lock_door) (struct cdrom_device_info *, int); - int (*select_speed) (struct cdrom_device_info *, int); - int (*select_disc) (struct cdrom_device_info *, int); - int (*get_last_session) (struct cdrom_device_info *, - struct cdrom_multisession *); - int (*get_mcn) (struct cdrom_device_info *, - struct cdrom_mcn *); - /* hard reset device */ - int (*reset) (struct cdrom_device_info *); - /* play stuff */ - int (*audio_ioctl) (struct cdrom_device_info *,unsigned int, void *); - /* dev-specific */ - int (*dev_ioctl) (struct cdrom_device_info *, - unsigned int, unsigned long); -/* driver specifications */ - const int capability; /* capability flags */ - int n_minors; /* number of active minor devices */ -}; -#endif - -/* capability flags */ -#define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */ -#define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */ -#define CDC_LOCK 0x4 /* disable manual eject */ -#define CDC_SELECT_SPEED 0x8 /* programmable speed */ -#define CDC_SELECT_DISC 0x10 /* select disc from juke-box */ -#define CDC_MULTI_SESSION 0x20 /* read sessions>1 */ -#define CDC_MCN 0x40 /* Medium Catalog Number */ -#define CDC_MEDIA_CHANGED 0x80 /* media changed */ -#define CDC_PLAY_AUDIO 0x100 /* audio functions */ - -/* drive status possibilities */ -#define CDS_NO_INFO 0 /* if not implemented */ -#define CDS_NO_DISC 1 -#define CDS_TRAY_OPEN 2 -#define CDS_DRIVE_NOT_READY 3 -#define CDS_DISC_OK 4 - -/* disc status possibilities, other than CDS_NO_DISC */ -#define CDS_AUDIO 100 -#define CDS_DATA_1 101 -#define CDS_DATA_2 102 -#define CDS_XA_2_1 103 -#define CDS_XA_2_2 104 - -/* User-configurable behavior options */ -#define CDO_AUTO_CLOSE 0x1 /* close tray on first open() */ -#define CDO_AUTO_EJECT 0x2 /* open tray on last release() */ -#define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */ -#define CDO_LOCK 0x8 /* lock tray on open files */ -#define CDO_CHECK_TYPE 0x10 /* check type on open for data */ - -/* Special codes for specifying changer slots. */ -#define CDSL_NONE ((int) (~0U>>1)-1) -#define CDSL_CURRENT ((int) (~0U>>1)) - -/* Some more ioctls to control these options */ -#define CDROM_SET_OPTIONS 0x5320 -#define CDROM_CLEAR_OPTIONS 0x5321 -#define CDROM_SELECT_SPEED 0x5322 /* head-speed */ -#define CDROM_SELECT_DISC 0x5323 /* for juke-boxes */ -#define CDROM_MEDIA_CHANGED 0x5325 -#define CDROM_DRIVE_STATUS 0x5326 /* tray position, etc. */ -#define CDROM_DISC_STATUS 0x5327 /* disc type etc. */ -#define CDROM_CHANGER_NSLOTS 0x5328 - -/* Rename an old ioctl */ -#define CDROM_GET_MCN CDROM_GET_UPC /* medium catalog number */ - -#ifdef __KERNEL__ -/* the general file operations structure: */ -extern struct file_operations cdrom_fops; - -extern int register_cdrom(struct cdrom_device_info *cdi, char *name); -extern int unregister_cdrom(struct cdrom_device_info *cdi); -#endif - -#endif /* LINUX_UCDROM_H */ -/* - * Local variables: - * comment-column: 40 - * End: - */ diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h index eb2f6ec0d..25420e1b1 100644 --- a/include/linux/ufs_fs.h +++ b/include/linux/ufs_fs.h @@ -6,13 +6,17 @@ * Laboratory for Computer Science Research Computing Facility * Rutgers, The State University of New Jersey * - * $Id: ufs_fs.h,v 1.8 1997/07/17 02:17:54 davem Exp $ - * + * Clean swab support by Fare <rideau@ens.fr> + * just hope no one is using NNUUXXI on __?64 structure elements */ #ifndef __LINUX_UFS_FS_H #define __LINUX_UFS_FS_H +#undef UFS_HEAVY_DEBUG +/*#define UFS_HEAVY_DEBUG 1*/ +/* Uncomment the line above when hacking ufs code */ + #include <linux/types.h> #include <linux/kernel.h> #include <linux/time.h> @@ -24,6 +28,7 @@ #define UFS_SBSIZE 8192 #define UFS_MAGIC 0x00011954 +#define UFS_CIGAM 0x54190100 /* byteswapped MAGIC */ #define UFS_FSIZE 1024 #define UFS_BSIZE 8192 @@ -51,6 +56,17 @@ #define UFS_DEBUG_NAMEI 0x00000004 #define UFS_DEBUG_LINKS 0x00000008 +#ifdef UFS_HEAVY_DEBUG +# define UFS_DEBUG_INITIAL UFS_DEBUG +#else +# define UFS_DEBUG_INITIAL 0 +#endif + +/* (!) HERE WE ASSUME EITHER BIG OR LITTLE ENDIAN UFSes */ +#define UFS_LITTLE_ENDIAN 0x00000000 /* 0x00010000 */ +#define UFS_BIG_ENDIAN 0x00010000 /* 0x00020000 */ +#define UFS_BYTESEX 0x00010000 /* 0x00030000 */ + #define UFS_ADDR_PER_BLOCK(sb) ((sb)->u.ufs_sb.s_bsize >> 2) #define UFS_ADDR_PER_BLOCK_BITS(sb) ((sb)->u.ufs_sb.s_bshift - 2) @@ -93,10 +109,6 @@ struct ufs_csum { __u32 cs_nffree; /* number of free frags */ }; -typedef struct _ufsquad { - __u32 val[2]; -} ufsquad; - /* * This is the actual superblock, as it is laid out on the disk. */ @@ -109,7 +121,7 @@ struct ufs_superblock { __u32 fs_dblkno; /* offset of first data after cg */ __u32 fs_cgoffset; /* cylinder group offset in cylinder */ __u32 fs_cgmask; /* used to calc mod fs_ntrak */ - time_t fs_time; /* last time written */ + __u32 fs_time; /* last time written -- time_t */ __u32 fs_size; /* number of blocks in fs */ __u32 fs_dsize; /* number of data blocks in fs */ __u32 fs_ncg; /* number of cylinder groups */ @@ -177,15 +189,14 @@ struct ufs_superblock { __u16 fs_opostbl[16][8]; /* old rotation block list head */ __s32 fs_sparecon[55]; /* reserved for future constants */ __s32 fs_state; /* file system state time stamp */ - ufsquad fs_qbmask; /* ~usb_bmask - for use with __s64 size */ - ufsquad fs_qfmask; /* ~usb_fmask - for use with __s64 size */ + __s64 fs_qbmask; /* ~usb_bmask */ + __s64 fs_qfmask; /* ~usb_fmask */ __s32 fs_postblformat; /* format of positional layout tables */ __s32 fs_nrpos; /* number of rotational positions */ __s32 fs_postbloff; /* (__s16) rotation block list head */ __s32 fs_rotbloff; /* (__u8) blocks for each rotation */ __s32 fs_magic; /* magic number */ __u8 fs_space[1]; /* list of blocks for each rotation */ - }; /* @@ -196,13 +207,13 @@ struct ufs_inode { __u16 ui_nlink; /* 0x2 */ __u16 ui_suid; /* 0x4 */ __u16 ui_sgid; /* 0x6 */ - ufsquad ui_size; /* 0x8 */ /* XXX - should be __u64 */ - struct timeval ui_atime; /* 0x10 */ - struct timeval ui_mtime; /* 0x18 */ - struct timeval ui_ctime; /* 0x20 */ - __u32 ui_db[UFS_NDADDR]; /* 0x28 data blocks */ - __u32 ui_ib[UFS_NINDIR]; /* 0x58 indirect blocks */ - __u32 ui_flags; /* 0x64 unused */ + __u64 ui_size; /* 0x8 */ + struct timeval ui_atime; /* 0x10 access */ + struct timeval ui_mtime; /* 0x18 modification */ + struct timeval ui_ctime; /* 0x20 creation */ + __u32 ui_db[UFS_NDADDR]; /* 0x28 data blocks */ + __u32 ui_ib[UFS_NINDIR]; /* 0x58 indirect blocks */ + __u32 ui_flags; /* 0x64 unused -- "status flags (chflags)" ??? */ __u32 ui_blocks; /* 0x68 blocks in use */ __u32 ui_gen; /* 0x6c generation number XXX - what is this? */ __u32 ui_shadow; /* 0x70 shadow inode XXX - what is this?*/ @@ -225,7 +236,7 @@ extern void ufs_put_inode(struct inode * inode); extern void ufs_print_inode (struct inode *); /* ufs_namei.c */ -extern int ufs_lookup (struct inode *, struct qstr *, struct inode **); +extern int ufs_lookup (struct inode *, struct dentry *); /* ufs_super.c */ extern void ufs_warning (struct super_block *, const char *, const char *, ...) @@ -248,23 +259,6 @@ extern struct file_operations ufs_file_operations; extern struct inode_operations ufs_symlink_inode_operations; extern struct file_operations ufs_symlink_operations; -/* Byte swapping 32/16-bit quantities into little endian format. */ -extern int ufs_need_swab; - -extern __inline__ __u32 ufs_swab32(__u32 value) -{ - return (ufs_need_swab ? ((value >> 24) | - ((value >> 8) & 0xff00) | - ((value << 8) & 0xff0000) | - (value << 24)) : value); -} - -extern __inline__ __u16 ufs_swab16(__u16 value) -{ - return (ufs_need_swab ? ((value >> 8) | - (value << 8)) : value); -} - #endif /* __KERNEL__ */ #endif /* __LINUX_UFS_FS_H */ diff --git a/include/linux/wait.h b/include/linux/wait.h index 0a0d11fc9..6514693c2 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -28,18 +28,6 @@ static inline int waitqueue_active(struct wait_queue **q) return head && head != WAIT_QUEUE_HEAD(q); } -struct poll_table_entry { - struct wait_queue wait; - struct wait_queue ** wait_address; -}; - -typedef struct poll_table_struct { - unsigned int nr; - struct poll_table_entry * entry; -} poll_table; - -#define __MAX_POLL_TABLE_ENTRIES (PAGE_SIZE / sizeof (struct poll_table_entry)) - #endif /* __KERNEL__ */ #endif diff --git a/include/net/dst.h b/include/net/dst.h index 9d2a69100..155662f9d 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -40,6 +40,9 @@ struct dst_entry unsigned window; unsigned pmtu; unsigned rtt; + unsigned long rate_last; /* rate limiting for ICMP */ + unsigned long rate_tokens; + int error; struct neighbour *neighbour; @@ -49,7 +52,7 @@ struct dst_entry int (*output)(struct sk_buff*); struct dst_ops *ops; - + char info[0]; }; @@ -57,12 +60,14 @@ struct dst_entry struct dst_ops { unsigned short family; - struct dst_entry * (*check)(struct dst_entry *, u32 cookie); + struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); struct dst_entry * (*reroute)(struct dst_entry *, struct sk_buff *); void (*destroy)(struct dst_entry *); }; +#ifdef __KERNEL__ + extern struct dst_entry * dst_garbage_list; extern atomic_t dst_total; @@ -122,5 +127,6 @@ void dst_free(struct dst_entry * dst) } __dst_free(dst); } +#endif #endif /* _NET_DST_H */ diff --git a/include/net/gc.h b/include/net/gc.h index 0b28c098e..e69de29bb 100644 --- a/include/net/gc.h +++ b/include/net/gc.h @@ -1,46 +0,0 @@ -/* - * Interface routines assumed by gc() - * - * Copyright (C) Barak A. Pearlmutter. - * Released under the GPL version 2 or later. - * - */ - -typedef struct object *pobj; /* pointer to a guy of the type we gc */ - -/* - * How to mark and unmark objects - */ - -extern void gc_mark(pobj); -extern void gc_unmark(pobj); -extern int gc_marked(pobj); - -/* - * How to count and access an object's children - */ - -extern int n_children(pobj); /* how many children */ -extern pobj child_n(pobj, int); /* child i, numbered 0..n-1 */ - -/* - * How to access the root set - */ - -extern int root_size(void); /* number of things in root set */ -extern pobj root_elt(int); /* element i of root set, numbered 0..n-1 */ - -/* - * How to access the free list - */ - -extern void clear_freelist(void); -extern void add_to_free_list(pobj); - -/* - * How to iterate through all objects in memory - */ - -extern int N_OBJS; -extern pobj obj_number(int); - diff --git a/include/net/icmp.h b/include/net/icmp.h index a936803eb..6e9c54188 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h @@ -33,6 +33,9 @@ extern int icmp_rcv(struct sk_buff *skb, unsigned short len); extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); extern void icmp_init(struct net_proto_family *ops); +/* Move into dst.h ? */ +extern int xrlim_allow(struct dst_entry *dst, int timeout); + /* CONFIG_IP_TRANSPARENT_PROXY */ extern int icmp_chkaddr(struct sk_buff *skb); diff --git a/include/net/inet_common.h b/include/net/inet_common.h index 728b6662e..af1128baf 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h @@ -28,7 +28,7 @@ extern int inet_sendmsg(struct socket *sock, struct msghdr *msg, int size, struct scm_cookie *scm); extern int inet_shutdown(struct socket *sock, int how); -extern unsigned int inet_poll(struct socket *sock, poll_table *wait); +extern unsigned int inet_poll(struct socket *sock, struct poll_table_struct *wait); extern int inet_setsockopt(struct socket *sock, int level, int optname, char *optval, int optlen); diff --git a/include/net/ip.h b/include/net/ip.h index e5d59dd33..29c40ca87 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -25,6 +25,8 @@ #include <linux/socket.h> #include <linux/ip.h> #include <linux/netdevice.h> +#include <linux/inetdevice.h> +#include <linux/in_route.h> #include <net/route.h> #ifndef _SNMP_H @@ -38,21 +40,30 @@ struct inet_skb_parm struct ip_options opt; /* Compiled IP options */ u16 redirport; /* Redirect port */ unsigned char flags; - char vif; #define IPSKB_MASQUERADED 1 #define IPSKB_TRANSLATED 2 -#define IPSKB_TUNNELED 4 +#define IPSKB_FORWARDED 4 }; struct ipcm_cookie { u32 addr; + int oif; struct ip_options *opt; }; #define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) +struct ip_ra_chain +{ + struct ip_ra_chain *next; + struct sock *sk; + void (*destructor)(struct sock *); +}; + +extern struct ip_ra_chain *ip_ra_chain; + /* IP flags. */ #define IP_CE 0x8000 /* Flag: "Congestion" */ #define IP_DF 0x4000 /* Flag: "Don't Fragment" */ @@ -134,20 +145,23 @@ struct ipv4_config int secure_redirects; int rfc1620_redirects; int rfc1812_filter; - int addrmask_agent; + int send_redirects; int log_martians; int source_route; int multicast_route; - int bootp_agent; + int proxy_arp; int bootp_relay; - int fib_model; + int autoconfig; int no_pmtu_disc; }; extern struct ipv4_config ipv4_config; +extern int sysctl_local_port_range[2]; #define IS_ROUTER (ip_statistics.IpForwarding == 1) +extern int ip_call_ra_chain(struct sk_buff *skb); + /* * Functions provided by ip_fragment.o */ @@ -165,7 +179,7 @@ extern int ip_net_unreachable(struct sk_buff *skb); * Functions provided by ip_options.c */ -extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, u32 daddr, u32 saddr, int is_frag); +extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, u32 daddr, struct rtable *rt, int is_frag); extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); extern void ip_options_fragment(struct sk_buff *skb); extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb); @@ -179,9 +193,12 @@ extern int ip_options_rcv_srr(struct sk_buff *skb); */ extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); -extern int ip_cmsg_send(struct msghdr *msg, struct ipcm_cookie *ipc, struct device **devp); +extern int ip_cmsg_send(struct msghdr *msg, struct ipcm_cookie *ipc); extern int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int optlen); extern int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen); +extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *)); extern int ipv4_backlog_rcv(struct sock *sk, struct sk_buff *skb); + + #endif /* _IP_H */ diff --git a/include/net/ip_alias.h b/include/net/ip_alias.h index 683a04276..e69de29bb 100644 --- a/include/net/ip_alias.h +++ b/include/net/ip_alias.h @@ -1,23 +0,0 @@ -/* - * IP_ALIAS (AF_INET) aliasing definitions. - * - * - * Version: @(#)ip_alias.h 0.43 12/20/95 - * - * Author: Juan Jose Ciarlante, <jjciarla@raiz.uncu.edu.ar> - * - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - */ - -#ifndef _IP_ALIAS_H -#define _IP_ALIAS_H - -extern int ip_alias_init(void); -extern int ip_alias_done(void); - -#endif /* _IP_ALIAS_H */ diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index e96378d77..cd46bc7dc 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -16,118 +16,190 @@ #ifndef _NET_IP_FIB_H #define _NET_IP_FIB_H +#include <linux/config.h> -struct fib_node +struct fib_nh { - struct fib_node *fib_next; - u32 fib_key; - struct fib_info *fib_info; - short fib_metric; - u8 fib_tos; - u8 fib_flag; + struct device *nh_dev; + unsigned nh_flags; + unsigned char nh_scope; +#ifdef CONFIG_IP_ROUTE_MULTIPATH + int nh_weight; + int nh_power; +#endif + int nh_oif; + u32 nh_gw; }; -#define FIBFLG_DOWN 1 /* Ignore this node */ -#define FIBFLG_THROW 2 /* Class lookup failed */ -#define FIBFLG_REJECT 4 /* Route lookup failed */ - -#define MAGIC_METRIC 0x7FFF - /* * This structure contains data shared by many of routes. - */ + */ struct fib_info { struct fib_info *fib_next; struct fib_info *fib_prev; - u32 fib_gateway; - struct device *fib_dev; int fib_refcnt; - unsigned long fib_window; unsigned fib_flags; - unsigned short fib_mtu; - unsigned short fib_irtt; + int fib_protocol; + u32 fib_prefsrc; + unsigned fib_mtu; + unsigned fib_rtt; + unsigned fib_window; + int fib_nhs; +#ifdef CONFIG_IP_ROUTE_MULTIPATH + int fib_power; +#endif + struct fib_nh fib_nh[0]; +#define fib_dev fib_nh[0].nh_dev }; -struct fib_zone -{ - struct fib_zone *fz_next; - struct fib_node **fz_hash; - int fz_nent; - int fz_divisor; - u32 fz_hashmask; - int fz_logmask; - u32 fz_mask; -}; -struct fib_class -{ - unsigned char cl_id; - unsigned char cl_auto; - struct fib_zone *fib_zones[33]; - struct fib_zone *fib_zone_list; - int cl_users; -}; +#ifdef CONFIG_IP_MULTIPLE_TABLES +struct fib_rule; +#endif -struct fib_rule +struct fib_result { - struct fib_rule *cl_next; - struct fib_class *cl_class; - u32 cl_src; - u32 cl_srcmask; - u32 cl_dst; - u32 cl_dstmask; - u32 cl_srcmap; - u8 cl_action; - u8 cl_flags; - u8 cl_tos; - u8 cl_preference; - struct device *cl_dev; + u32 *prefix; + unsigned char prefixlen; + unsigned char nh_sel; + unsigned char type; + unsigned char scope; + struct fib_info *fi; +#ifdef CONFIG_IP_MULTIPLE_TABLES + struct fib_rule *r; +#endif }; -struct fib_result +#ifdef CONFIG_IP_ROUTE_MULTIPATH + +#define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) +#define FIB_RES_RESET(res) ((res).nh_sel = 0) + +#else /* CONFIG_IP_ROUTE_MULTIPATH */ + +#define FIB_RES_NH(res) ((res).fi->fib_nh[0]) +#define FIB_RES_RESET(res) + +#endif /* CONFIG_IP_ROUTE_MULTIPATH */ + +#define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __fib_res_prefsrc(&res)) +#define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw) +#define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev) +#define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif) + +struct fib_table { - struct fib_node *f; - struct fib_rule *fr; - int fm; + unsigned char tb_id; + unsigned tb_stamp; + int (*tb_lookup)(struct fib_table *tb, const struct rt_key *key, struct fib_result *res); + int (*tb_insert)(struct fib_table *table, struct rtmsg *r, + struct kern_rta *rta, struct nlmsghdr *n, + struct netlink_skb_parms *req); + int (*tb_delete)(struct fib_table *table, struct rtmsg *r, + struct kern_rta *rta, struct nlmsghdr *n, + struct netlink_skb_parms *req); + int (*tb_dump)(struct fib_table *table, struct sk_buff *skb, + struct netlink_callback *cb); + int (*tb_flush)(struct fib_table *table); + int (*tb_get_info)(struct fib_table *table, char *buf, + int first, int count); + + unsigned char tb_data[0]; }; -void ip_fib_init(void); -unsigned ip_fib_chk_addr(u32 addr); -int ip_fib_chk_default_gw(u32 addr, struct device*); +#ifndef CONFIG_IP_MULTIPLE_TABLES + +extern struct fib_table *local_table; +extern struct fib_table *main_table; + +extern __inline__ struct fib_table *fib_get_table(int id) +{ + if (id != RT_TABLE_LOCAL) + return main_table; + return local_table; +} -int fib_lookup(struct fib_result *, u32 daddr, u32 src, u8 tos, struct device *devin, - struct device *devout); +extern __inline__ struct fib_table *fib_new_table(int id) +{ + return fib_get_table(id); +} -static __inline__ struct fib_info * -fib_lookup_info(u32 dst, u32 src, u8 tos, struct device *devin, - struct device *devout) +extern __inline__ int fib_lookup(const struct rt_key *key, struct fib_result *res) { - struct fib_result res; - if (fib_lookup(&res, dst, src, tos, devin, devout) < 0) - return NULL; - return res.f->fib_info; + if (local_table->tb_lookup(local_table, key, res)) + return main_table->tb_lookup(main_table, key, res); + return 0; } -static __inline__ struct device * get_gw_dev(u32 gw, struct device *dev) +#else /* CONFIG_IP_MULTIPLE_TABLES */ +#define local_table (fib_tables[RT_TABLE_LOCAL]) +#define main_table (fib_tables[RT_TABLE_MAIN]) + +extern struct fib_table * fib_tables[RT_TABLE_MAX+1]; +extern int fib_lookup(const struct rt_key *key, struct fib_result *res); +extern struct fib_table *__fib_new_table(int id); + +extern __inline__ struct fib_table *fib_get_table(int id) { - struct fib_info * fi; + if (id == 0) + id = RT_TABLE_MAIN; - fi = fib_lookup_info(gw, 0, 1, &loopback_dev, dev); - if (fi) - return fi->fib_dev; - return NULL; + return fib_tables[id]; } -extern int ip_rt_event(int event, struct device *dev); -extern int ip_rt_ioctl(unsigned int cmd, void *arg); -extern void ip_rt_change_broadcast(struct device *, u32); -extern void ip_rt_change_dstaddr(struct device *, u32); -extern void ip_rt_change_netmask(struct device *, u32); -extern void ip_rt_multicast_event(struct device *dev); +extern __inline__ struct fib_table *fib_new_table(int id) +{ + if (id == 0) + id = RT_TABLE_MAIN; -extern struct device * ip_dev_find_tunnel(u32 daddr, u32 saddr); + return fib_tables[id] ? : __fib_new_table(id); +} +#endif /* CONFIG_IP_MULTIPLE_TABLES */ + +/* Exported by fib_frontend.c */ +extern void ip_fib_init(void); +extern void fib_flush(void); +extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); +extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); +extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); +extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); +extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, + struct device *dev, u32 *spec_dst); +extern void fib_select_multipath(const struct rt_key *key, struct fib_result *res); + +/* Exported by fib_semantics.c */ +extern int ip_fib_check_default(u32 gw, struct device *dev); +extern void fib_release_info(struct fib_info *); +extern int fib_semantic_match(int type, struct fib_info *, + const struct rt_key *, struct fib_result*); +extern struct fib_info *fib_create_info(const struct rtmsg *r, struct kern_rta *rta, + const struct nlmsghdr *, int *err); +extern int fib_nh_match(struct rtmsg *r, struct nlmsghdr *, struct kern_rta *rta, struct fib_info *fi); +extern int fib_dump_info(struct sk_buff *skb, pid_t pid, u32 seq, int event, + u8 tb_id, u8 type, u8 scope, void *dst, int dst_len, u8 tos, + struct fib_info *fi); +extern int fib_sync_down(u32 local, struct device *dev); +extern int fib_sync_up(struct device *dev); +extern int fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm, + struct kern_rta *rta, struct rtentry *r); +extern void fib_node_get_info(int type, int dead, struct fib_info *fi, u32 prefix, u32 mask, char *buffer); +extern u32 __fib_res_prefsrc(struct fib_result *res); + +/* Exported by fib_hash.c */ +extern struct fib_table *fib_hash_init(int id); + +#ifdef CONFIG_IP_MULTIPLE_TABLES +/* Exported by fib_rules.c */ + +extern int inet_rtm_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); +extern int inet_rtm_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); +extern int inet_dump_rules(struct sk_buff *skb, struct netlink_callback *cb); +extern u32 fib_rules_map_destination(u32 daddr, struct fib_result *res); +extern u32 fib_rules_policy(u32 saddr, struct fib_result *res, unsigned *flags); +extern void fib_rules_init(void); +#endif #endif _NET_FIB_H diff --git a/include/net/ip_masq.h b/include/net/ip_masq.h index 8b29eeb15..4a0b10a55 100644 --- a/include/net/ip_masq.h +++ b/include/net/ip_masq.h @@ -88,14 +88,14 @@ extern int ip_masq_init(void); /* * functions called from ip layer */ -extern int ip_fw_masquerade(struct sk_buff **, struct device *); -extern int ip_fw_masq_icmp(struct sk_buff **, struct device *); -extern int ip_fw_demasquerade(struct sk_buff **, struct device *); +extern int ip_fw_masquerade(struct sk_buff **, __u32 maddr); +extern int ip_fw_masq_icmp(struct sk_buff **); +extern int ip_fw_demasquerade(struct sk_buff **); /* * ip_masq obj creation/deletion functions. */ -extern struct ip_masq *ip_masq_new(struct device *dev, int proto, __u32 saddr, __u16 sport, __u32 daddr, __u16 dport, unsigned flags); +extern struct ip_masq *ip_masq_new(__u32 maddr, int proto, __u32 saddr, __u16 sport, __u32 daddr, __u16 dport, unsigned flags); extern void ip_masq_set_expire(struct ip_masq *ms, unsigned long tout); @@ -116,9 +116,9 @@ struct ip_masq_app int (*masq_done_1) /* ip_masq fin. */ (struct ip_masq_app *, struct ip_masq *); int (*pkt_out) /* output (masquerading) hook */ - (struct ip_masq_app *, struct ip_masq *, struct sk_buff **, struct device *); + (struct ip_masq_app *, struct ip_masq *, struct sk_buff **, __u32); int (*pkt_in) /* input (demasq) hook */ - (struct ip_masq_app *, struct ip_masq *, struct sk_buff **, struct device *); + (struct ip_masq_app *, struct ip_masq *, struct sk_buff **); }; /* @@ -147,8 +147,8 @@ extern int ip_masq_unbind_app(struct ip_masq *ms); * output and input app. masquerading hooks. * */ -extern int ip_masq_app_pkt_out(struct ip_masq *, struct sk_buff **skb_p, struct device *dev); -extern int ip_masq_app_pkt_in(struct ip_masq *, struct sk_buff **skb_p, struct device *dev); +extern int ip_masq_app_pkt_out(struct ip_masq *, struct sk_buff **skb_p, __u32 maddr); +extern int ip_masq_app_pkt_in(struct ip_masq *, struct sk_buff **skb_p); /* * service routine(s). diff --git a/include/net/ipip.h b/include/net/ipip.h index 64ce7a29d..22c464c3c 100644 --- a/include/net/ipip.h +++ b/include/net/ipip.h @@ -1,8 +1,33 @@ #ifndef __NET_IPIP_H #define __NET_IPIP_H 1 -extern void ipip_err(struct sk_buff *skb, unsigned char*); -extern int ipip_rcv(struct sk_buff *skb, unsigned short len); - +#include <linux/if_tunnel.h> + +/* Keep error state on tunnel for 30 sec */ +#define IPTUNNEL_ERR_TIMEO (30*HZ) + +struct ip_tunnel +{ + struct ip_tunnel *next; + struct device *dev; + struct net_device_stats stat; + + int recursion; /* Depth of hard_start_xmit recursion */ + int err_count; /* Number of arrived ICMP errors */ + unsigned long err_time; /* Time when the last ICMP error arrived */ + + /* These four fields used only by GRE */ + __u32 i_seqno; /* The last seen seqno */ + __u32 o_seqno; /* The last output seqno */ + int hlen; /* Precalculated GRE header length */ + int mlink; + + struct ip_tunnel_parm parms; +}; + +extern int ipip_init(void); +extern int ipgre_init(void); +extern int sit_init(void); +extern void sit_cleanup(void); #endif diff --git a/include/net/netlink.h b/include/net/netlink.h index 17aa55583..e69de29bb 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -1,65 +0,0 @@ -#ifndef __NET_NETLINK_H -#define __NET_NETLINK_H - -#define NET_MAJOR 36 /* Major 18 is reserved for networking */ -#define MAX_LINKS 32 -#define MAX_QBYTES 32768 /* Maximum bytes in the queue */ - -#include <linux/netlink.h> - -extern int netlink_attach(int unit, int (*function)(int,struct sk_buff *skb)); -extern int netlink_donothing(int, struct sk_buff *skb); -extern void netlink_detach(int unit); -extern int netlink_post(int unit, struct sk_buff *skb); -extern int init_netlink(void); - -/* - * skb should fit one page. This choice is good for headerless malloc. - */ -#define NLMSG_GOODSIZE (PAGE_SIZE - ((sizeof(struct sk_buff)+0xF)&~0xF)-32) - -#define NLMSG_RECOVERY_TIMEO (HZ/2) /* If deleivery was failed, - retry after */ - -struct nlmsg_ctl -{ - struct timer_list nlmsg_timer; - struct sk_buff *nlmsg_skb; /* Partially built skb */ - int nlmsg_unit; - int nlmsg_delay; /* Time to delay skb send*/ - int nlmsg_maxsize; /* Maximal message size */ - int nlmsg_force; /* post immediately */ - unsigned long nlmsg_overrun_start; /* seqno starting lossage*/ - unsigned long nlmsg_overrun_end; /* the last lost message */ - char nlmsg_overrun; /* overrun flag */ -}; - -void* nlmsg_send(struct nlmsg_ctl*, unsigned long type, int len, - unsigned long seq, unsigned long pid); -void nlmsg_transmit(struct nlmsg_ctl*); - -extern __inline__ void nlmsg_ack(struct nlmsg_ctl* ctl, unsigned long seq, - unsigned long pid, int err) -{ - int *r; - - start_bh_atomic(); - r = nlmsg_send(ctl, NLMSG_ACK, sizeof(r), seq, pid); - if (r) - *r = err; - end_bh_atomic(); -} - - -#define NETLINK_ROUTE 0 /* Routing/device hook */ -#define NETLINK_SKIP 1 /* Reserved for ENskip */ -#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ -#define NETLINK_FIREWALL 3 /* Firewalling hook */ -#define NETLINK_FREE 4 /* PSI devices - 4 to 7 (obsolete) */ -#define NETLINK_ARPD 8 /* ARP daemon for big switched networks */ -#define NETLINK_IPSEC 10 /* IPSEC (JI) */ -#define NETLINK_ROUTE6 11 /* Af_inet6 route communication channel */ -#define NETLINK_IP6_FW 13 /* IPv6 firewall trap outs */ -#define NETLINK_DNRT 14 /* DECnet routing messages */ -#define NETLINK_TAPBASE 16 /* 16->31 are the ethertap devices */ -#endif diff --git a/include/net/protocol.h b/include/net/protocol.h index 3e60c1b31..3c00907ea 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h @@ -37,7 +37,7 @@ struct inet_protocol { int (*handler)(struct sk_buff *skb, unsigned short len); - void (*err_handler)(struct sk_buff *skb, unsigned char *dp); + void (*err_handler)(struct sk_buff *skb, unsigned char *dp, int len); struct inet_protocol *next; unsigned char protocol; unsigned char copy:1; diff --git a/include/net/raw.h b/include/net/raw.h index 064b5bf7a..4d2e6e98b 100644 --- a/include/net/raw.h +++ b/include/net/raw.h @@ -32,6 +32,7 @@ extern struct sock *raw_v4_htable[RAWV4_HTABLE_SIZE]; extern struct sock *raw_v4_lookup(struct sock *sk, unsigned short num, - unsigned long raddr, unsigned long laddr); + unsigned long raddr, unsigned long laddr, + int dif); #endif /* _RAW_H */ diff --git a/include/net/rose.h b/include/net/rose.h index 86f6a6721..8e86c1457 100644 --- a/include/net/rose.h +++ b/include/net/rose.h @@ -129,10 +129,9 @@ typedef struct { unsigned char cause, diagnostic; unsigned short vs, vr, va, vl; unsigned long t1, t2, t3, hb, idle; - unsigned short fraglen; + struct sk_buff_head ack_queue; struct timer_list timer; struct timer_list idletimer; - struct sk_buff_head frag_queue; struct sock *sk; /* Backlink to socket */ } rose_cb; @@ -181,10 +180,8 @@ extern void rose_transmit_clear_request(struct rose_neigh *, unsigned int, unsig extern void rose_transmit_link(struct sk_buff *, struct rose_neigh *); /* rose_out.c */ -extern void rose_output(struct sock *, struct sk_buff *); extern void rose_kick(struct sock *); extern void rose_enquiry_response(struct sock *); -extern void rose_check_iframes_acked(struct sock *, unsigned short); /* rose_route.c */ extern void rose_rt_device_down(struct device *); @@ -204,6 +201,8 @@ extern void rose_rt_free(void); /* rose_subr.c */ extern void rose_clear_queues(struct sock *); +extern void rose_frames_acked(struct sock *, unsigned short); +extern void rose_requeue_frames(struct sock *); extern int rose_validate_nr(struct sock *, unsigned short); extern void rose_write_internal(struct sock *, int); extern int rose_decode(struct sk_buff *, int *, int *, int *, int *, int *); diff --git a/include/net/route.h b/include/net/route.h index d309ab63f..486508ce0 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -22,9 +22,10 @@ #ifndef _ROUTE_H #define _ROUTE_H -#include <net/ip_fib.h> +#include <linux/config.h> #include <net/dst.h> - +#include <linux/in_route.h> +#include <linux/rtnetlink.h> #define RT_HASH_DIVISOR 256 #define RT_CACHE_MAX_SIZE 256 @@ -37,12 +38,12 @@ /* * Cache invalidations can be delayed by: */ -#define RT_FLUSH_DELAY (2*HZ) +#define RT_FLUSH_DELAY (5*HZ) #define RT_REDIRECT_NUMBER 9 #define RT_REDIRECT_LOAD (HZ/50) /* 20 msec */ #define RT_REDIRECT_SILENCE (RT_REDIRECT_LOAD<<(RT_REDIRECT_NUMBER+1)) - /* 20sec */ +/* 20sec */ #define RT_ERROR_LOAD (1*HZ) @@ -55,7 +56,17 @@ #include <linux/route.h> -struct rtable +struct rt_key +{ + __u32 dst; + __u32 src; + int iif; + int oif; + __u8 tos; + __u8 scope; +}; + +struct rtable { union { @@ -64,92 +75,76 @@ struct rtable } u; unsigned rt_flags; + unsigned rt_type; - u32 rt_dst; /* Path destination */ - u32 rt_src; /* Path source */ - struct device *rt_src_dev; /* Path source device */ + __u32 rt_dst; /* Path destination */ + __u32 rt_src; /* Path source */ + int rt_iif; /* Info on neighbour */ - u32 rt_gateway; + __u32 rt_gateway; /* Cache lookup keys */ - struct - { - u32 dst; - u32 src; - struct device *src_dev; - struct device *dst_dev; - u8 tos; - } key; + struct rt_key key; /* Miscellaneous cached information */ - u32 rt_spec_dst; /* RFC1122 specific destination */ - u32 rt_src_map; - u32 rt_dst_map; + __u32 rt_spec_dst; /* RFC1122 specific destination */ + +#ifdef CONFIG_IP_ROUTE_NAT + __u32 rt_src_map; + __u32 rt_dst_map; +#endif /* ICMP statistics */ unsigned long last_error; unsigned long errors; }; - -#define RTF_IFBRD (RTF_UP|RTF_MAGIC|RTF_LOCAL|RTF_BROADCAST) -#define RTF_IFLOCAL (RTF_UP|RTF_MAGIC|RTF_LOCAL|RTF_INTERFACE) -#define RTF_IFPREFIX (RTF_UP|RTF_MAGIC|RTF_INTERFACE) - -/* - * Flags not visible at user level. - */ -#define RTF_INTERNAL 0xFFFF8000 /* to get RTF_MAGIC as well... */ - -/* - * Flags saved in FIB. - */ -#define RTF_FIB (RTF_UP|RTF_GATEWAY|RTF_REJECT|RTF_THROW|RTF_STATIC|\ - RTF_XRESOLVE|RTF_NOPMTUDISC|RTF_NOFORWARD|RTF_INTERNAL) - +#ifdef __KERNEL__ extern void ip_rt_init(void); extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw, u32 src, u8 tos, struct device *dev); extern void ip_rt_check_expire(void); extern void ip_rt_advice(struct rtable **rp, int advice); extern void rt_cache_flush(int how); -extern int ip_route_output(struct rtable **, u32 dst, u32 src, u8 tos, struct device *devout); -extern int ip_route_output_dev(struct rtable **, u32 dst, u32 src, u8 tos, int); +extern int ip_route_output(struct rtable **, u32 dst, u32 src, u8 tos, int oif); extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct device *devin); extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); extern void ip_rt_send_redirect(struct sk_buff *skb); -static __inline__ void ip_rt_put(struct rtable * rt) +extern unsigned inet_addr_type(u32 addr); +extern void ip_rt_multicast_event(struct in_device *); +extern int ip_rt_ioctl(unsigned int cmd, void *arg); +extern void ip_rt_get_source(u8 *src, struct rtable *rt); + + +extern __inline__ void ip_rt_put(struct rtable * rt) { if (rt) dst_release(&rt->u.dst); } -static __inline__ char rt_tos2priority(u8 tos) +extern __u8 ip_tos2prio[16]; + +extern __inline__ char rt_tos2priority(u8 tos) { - if (tos & IPTOS_LOWDELAY) - return SOPRI_INTERACTIVE; - if (tos & (IPTOS_THROUGHPUT|IPTOS_MINCOST)) - return SOPRI_BACKGROUND; - return SOPRI_NORMAL; + return ip_tos2prio[IPTOS_TOS(tos)>>1]; } - -static __inline__ int ip_route_connect(struct rtable **rp, u32 dst, u32 src, u32 tos) +extern __inline__ int ip_route_connect(struct rtable **rp, u32 dst, u32 src, u32 tos, int oif) { int err; - err = ip_route_output(rp, dst, src, tos, NULL); + err = ip_route_output(rp, dst, src, tos, oif); if (err || (dst && src)) return err; dst = (*rp)->rt_dst; src = (*rp)->rt_src; ip_rt_put(*rp); *rp = NULL; - return ip_route_output(rp, dst, src, tos, NULL); + return ip_route_output(rp, dst, src, tos, oif); } -static __inline__ void ip_ll_header(struct sk_buff *skb) +extern __inline__ void ip_ll_header(struct sk_buff *skb) { struct rtable *rt = (struct rtable*)skb->dst; struct device *dev = rt->u.dst.dev; @@ -169,6 +164,7 @@ static __inline__ void ip_ll_header(struct sk_buff *skb) skb->mac.raw = skb->data; } +#endif #endif /* _ROUTE_H */ diff --git a/include/net/sit.h b/include/net/sit.h index 98bb5b386..e69de29bb 100644 --- a/include/net/sit.h +++ b/include/net/sit.h @@ -1,39 +0,0 @@ -/* - * SIT tunneling device - definitions - * Linux INET6 implementation - * - * Authors: - * Pedro Roque <roque@di.fc.ul.pt> - * - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifndef _NET_SIT_H -#define _NET_SIT_H - -struct sit_mtu_info { - __u32 addr; /* IPv4 destination */ - unsigned long tstamp; /* last use tstamp */ - __u32 mtu; /* Path MTU */ - struct sit_mtu_info *next; -}; - -struct sit_vif { - char name[8]; - struct device *dev; - struct sit_vif *next; -}; - -extern int sit_init(void); -extern void sit_cleanup(void); - -extern struct device * sit_add_tunnel(__u32 dstaddr); - -#define SIT_GC_TIMEOUT (3*60*HZ) -#define SIT_GC_FREQUENCY (2*60*HZ) - -#endif diff --git a/include/net/slhc_vj.h b/include/net/slhc_vj.h index 387b848d8..04387d8a8 100644 --- a/include/net/slhc_vj.h +++ b/include/net/slhc_vj.h @@ -112,8 +112,8 @@ * int int32 long 32 bits */ -typedef unsigned char byte_t; -typedef unsigned long int32; +typedef __u8 byte_t; +typedef __u32 int32; /* * "state" data for each active tcp conversation on the wire. This is diff --git a/include/net/sock.h b/include/net/sock.h index 1e40d3a2d..8dd105485 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -44,8 +44,10 @@ #include <net/if_inet6.h> /* struct ipv6_mc_socklist */ #endif +#if defined(CONFIG_INET) || defined (CONFIG_INET_MODULE) +#include <linux/icmp.h> +#endif #include <linux/tcp.h> /* struct tcphdr */ -#include <linux/config.h> #include <linux/netdevice.h> #include <linux/skbuff.h> /* struct sk_buff */ @@ -75,8 +77,6 @@ #include <net/dn.h> #endif -#include <linux/igmp.h> - #include <asm/atomic.h> /* @@ -98,18 +98,20 @@ struct unix_opt int inflight; }; -/* - * IP packet socket options - */ +#ifdef CONFIG_NETLINK +struct netlink_callback; -struct inet_packet_opt +struct netlink_opt { - struct notifier_block notifier; /* Used when bound */ - struct device *bound_dev; - unsigned long dev_stamp; - struct packet_type *prot_hook; - char device_name[15]; + pid_t pid; + unsigned groups; + pid_t dst_pid; + unsigned dst_groups; + int (*handler)(int unit, struct sk_buff *skb); + atomic_t locks; + struct netlink_callback *cb; }; +#endif /* * Once the IPX ncpd patches are in these are going into protinfo @@ -184,6 +186,12 @@ struct raw6_opt { #endif /* IPV6 */ +#if defined(CONFIG_INET) || defined(CONFIG_INET_MODULE) +struct raw_opt { + struct icmp_filter filter; +}; +#endif + struct tcp_opt { @@ -374,6 +382,7 @@ struct sock broadcast, nonagle, bsdism; + int bound_dev_if; unsigned long lingertime; int proc; @@ -401,9 +410,6 @@ struct sock __u32 rcv_saddr; /* Bound address */ struct dst_entry *dst_cache; - - unsigned short max_unacked; - /* * mss is min(mtu, max_window) */ @@ -422,6 +428,9 @@ struct sock union { struct tcp_opt af_tcp; +#if defined(CONFIG_INET) || defined (CONFIG_INET_MODULE) + struct raw_opt tp_raw4; +#endif #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) struct raw6_opt tp_raw; #endif @@ -435,8 +444,8 @@ struct sock volatile unsigned char state; unsigned short ack_backlog; unsigned short max_ack_backlog; - unsigned char priority; unsigned char debug; + __u32 priority; int rcvbuf; int sndbuf; unsigned short type; @@ -462,8 +471,10 @@ struct sock #if defined(CONFIG_IPX) || defined(CONFIG_IPX_MODULE) struct ipx_opt af_ipx; #endif +#if defined (CONFIG_PACKET) || defined(CONFIG_PACKET_MODULE) + struct packet_opt *af_packet; +#endif #ifdef CONFIG_INET - struct inet_packet_opt af_packet; #ifdef CONFIG_NUTCP struct tcp_opt af_tcp; #endif @@ -483,6 +494,9 @@ struct sock #if defined(CONFIG_DECNET) || defined(CONFIG_DECNET_MODULE) dn_cb *dn; #endif +#ifdef CONFIG_NETLINK + struct netlink_opt af_netlink; +#endif } protinfo; /* @@ -560,7 +574,8 @@ struct proto void (*write_wakeup)(struct sock *sk); void (*read_wakeup)(struct sock *sk); - unsigned int (*poll)(struct socket *sock, poll_table *wait); + unsigned int (*poll)(struct socket *sock, + struct poll_table_struct *wait); int (*ioctl)(struct sock *sk, int cmd, unsigned long arg); @@ -783,7 +798,7 @@ extern int sock_no_accept(struct socket *, extern int sock_no_getname(struct socket *, struct sockaddr *, int *, int); extern unsigned int sock_no_poll(struct socket *, - poll_table *); + struct poll_table_struct *); extern int sock_no_ioctl(struct socket *, unsigned int, unsigned long); extern int sock_no_listen(struct socket *, int); diff --git a/include/net/tcp.h b/include/net/tcp.h index 57840f7e9..f47a273d0 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -226,6 +226,7 @@ struct open_request; struct or_calltable { void (*rtx_syn_ack) (struct sock *sk, struct open_request *req); void (*destructor) (struct open_request *req); + void (*send_reset) (struct sk_buff *skb); }; struct tcp_v4_open_req { @@ -306,11 +307,6 @@ struct tcp_func { struct open_request *req, struct dst_entry *dst); -#if 0 - __u32 (*init_sequence) (struct sock *sk, - struct sk_buff *skb); -#endif - struct sock * (*get_sock) (struct sk_buff *skb, struct tcphdr *th); @@ -330,15 +326,6 @@ struct tcp_func { void (*addr2sockaddr) (struct sock *sk, struct sockaddr *); - void (*send_reset) (struct sk_buff *skb); - - struct open_request * (*search_open_req) (struct tcp_opt *, void *, - struct tcphdr *, - struct open_request **); - - struct sock * (*cookie_check) (struct sock *, struct sk_buff *, - void *); - int sockaddr_len; }; @@ -371,7 +358,7 @@ extern struct tcp_mib tcp_statistics; extern unsigned short tcp_good_socknum(void); extern void tcp_v4_err(struct sk_buff *skb, - unsigned char *); + unsigned char *, int); extern void tcp_shutdown (struct sock *sk, int how); @@ -399,7 +386,7 @@ extern int tcp_rcv_established(struct sock *sk, extern void tcp_close(struct sock *sk, unsigned long timeout); extern struct sock * tcp_accept(struct sock *sk, int flags); -extern unsigned int tcp_poll(struct socket *sock, poll_table *wait); +extern unsigned int tcp_poll(struct socket *sock, struct poll_table_struct *wait); extern int tcp_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen); @@ -485,8 +472,7 @@ extern void tcp_delack_timer(unsigned long); extern void tcp_probe_timer(unsigned long); extern struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, - void *); - + struct open_request *req); /* * TCP slow timer @@ -546,9 +532,9 @@ extern unsigned short tcp_select_window(struct sock *sk); extern __inline const int tcp_connected(const int state) { - return(state == TCP_ESTABLISHED || state == TCP_CLOSE_WAIT || - state == TCP_FIN_WAIT1 || state == TCP_FIN_WAIT2 || - state == TCP_SYN_RECV); + return ((1 << state) & + (TCPF_ESTABLISHED|TCPF_CLOSE_WAIT|TCPF_FIN_WAIT1| + TCPF_FIN_WAIT2|TCPF_SYN_RECV)); } /* diff --git a/include/net/udp.h b/include/net/udp.h index 0fa99fb1c..5af3c18b7 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -40,7 +40,7 @@ extern unsigned short udp_good_socknum(void); extern struct proto udp_prot; -extern void udp_err(struct sk_buff *, unsigned char *); +extern void udp_err(struct sk_buff *, unsigned char *, int); extern int udp_connect(struct sock *sk, struct sockaddr *usin, int addr_len); diff --git a/include/net/x25.h b/include/net/x25.h index 7b58ad4e3..a72bd0426 100644 --- a/include/net/x25.h +++ b/include/net/x25.h @@ -123,6 +123,7 @@ typedef struct { unsigned short vs, vr, va, vl; unsigned long t2, t21, t22, t23; unsigned short fraglen; + struct sk_buff_head ack_queue; struct sk_buff_head fragment_queue; struct sk_buff_head interrupt_in_queue; struct sk_buff_head interrupt_out_queue; @@ -183,7 +184,6 @@ extern void x25_link_free(void); extern void x25_output(struct sock *, struct sk_buff *); extern void x25_kick(struct sock *); extern void x25_enquiry_response(struct sock *); -extern void x25_check_iframes_acked(struct sock *, unsigned short); /* x25_route.c */ extern struct device *x25_get_route(x25_address *); @@ -195,6 +195,8 @@ extern void x25_route_free(void); /* x25_subr.c */ extern void x25_clear_queues(struct sock *); +extern void x25_frames_acked(struct sock *, unsigned short); +extern void x25_requeue_frames(struct sock *); extern int x25_validate_nr(struct sock *, unsigned short); extern void x25_write_internal(struct sock *, int); extern int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *, int *); diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index c503aeec0..36492f862 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -135,6 +135,27 @@ #define TYPE_MEDIUM_CHANGER 0x08 #define TYPE_NO_LUN 0x7f +/* + * standard mode-select header prepended to all mode-select commands + * + * moved here from cdrom.h -- kraxel + */ + +struct ccs_modesel_head +{ + u_char _r1; /* reserved */ + u_char medium; /* device-specific medium type */ + u_char _r2; /* reserved */ + u_char block_desc_length; /* block descriptor length */ + u_char density; /* device-specific density code */ + u_char number_blocks_hi; /* number of blocks in this block desc */ + u_char number_blocks_med; + u_char number_blocks_lo; + u_char _r3; + u_char block_length_hi; /* block length for blocks in this desc */ + u_char block_length_med; + u_char block_length_lo; +}; /* * MESSAGE CODES |