diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-12-16 06:06:25 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1997-12-16 06:06:25 +0000 |
commit | aa944aa3453e47706685bc562711a9e87375941e (patch) | |
tree | 8fb37a65f205a90412917ca2b91c429263ef1790 /include | |
parent | 967c65a99059fd459b956c1588ce0ba227912c4e (diff) |
Merge with Linux 2.1.72, part 2.
The new signal code with exception of the code for the rt signals.
The definitions in <asm/siginfo.h> and <asm/ucontext.h> are currently
just stolen from the Alpha and will need to be overhauled.
Diffstat (limited to 'include')
42 files changed, 2817 insertions, 0 deletions
diff --git a/include/asm-alpha/siginfo.h b/include/asm-alpha/siginfo.h new file mode 100644 index 000000000..b32ceb1f9 --- /dev/null +++ b/include/asm-alpha/siginfo.h @@ -0,0 +1,195 @@ +#ifndef _ALPHA_SIGINFO_H +#define _ALPHA_SIGINFO_H + +#include <linux/types.h> + +/* This structure matches OSF/1 for binary compatibility. */ + +typedef union sigval { + int sival_int; + void *sival_ptr; +} sigval_t; + +#define SI_MAX_SIZE 128 +#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 4) + +typedef struct siginfo { + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[SI_PAD_SIZE]; + + /* kill() */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + unsigned int _timer1; + unsigned int _timer2; + } _timer; + + /* POSIX.1b signals */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + pid_t _pid; /* which child */ + int _status; /* exit code */ + clock_t _utime; + clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + void *_addr; /* faulting insn/memory ref. */ + } _sigfault; + + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +} siginfo_t; + +/* + * How these fields are to be accessed. + */ +#define si_pid _sifields._kill._pid +#define si_uid _sifields._kill._uid +#define si_status _sifields._sigchld._status +#define si_utime _sifields._sigchld._utime +#define si_stime _sifields._sigchld._stime +#define si_value _sifields._rt._sigval +#define si_int _sifields._rt._sigval.sival_int +#define si_ptr _sifields._rt._sigval.sival_ptr +#define si_addr _sifields._sigfault._addr +#define si_band _sifields._sigpoll._band +#define si_fd _sifields._sigpoll._fd + +/* + * si_code values + * Digital reserves positive values for kernel-generated signals. + */ +#define SI_USER 0 /* sent by kill, sigsend, raise */ +#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ +#define SI_QUEUE -1 /* sent by sigqueue */ +#define SI_TIMER -2 /* sent by timer expiration */ +#define SI_MESGQ -3 /* sent by real time mesq state change */ +#define SI_ASYNCIO -4 /* sent by AIO completion */ + +#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) +#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) + +/* + * SIGILL si_codes + */ +#define ILL_ILLOPC 1 /* illegal opcode */ +#define ILL_ILLOPN 2 /* illegal operand */ +#define ILL_ILLADR 3 /* illegal addressing mode */ +#define ILL_ILLTRP 4 /* illegal trap */ +#define ILL_PRVOPC 5 /* privileged opcode */ +#define ILL_PRVREG 6 /* privileged register */ +#define ILL_COPROC 7 /* coprocessor error */ +#define ILL_BADSTK 8 /* internal stack error */ +#define NSIGILL 8 + +/* + * SIGFPE si_codes + */ +#define FPE_INTDIV 1 /* integer divide by zero */ +#define FPE_INTOVF 2 /* integer overflow */ +#define FPE_FLTDIV 3 /* floating point divide by zero */ +#define FPE_FLTOVF 4 /* floating point overflow */ +#define FPE_FLTUND 5 /* floating point underflow */ +#define FPE_FLTRES 6 /* floating point inexact result */ +#define FPE_FLTINV 7 /* floating point invalid operation */ +#define FPE_FLTSUB 8 /* subscript out of range */ +#define NSIGFPE 8 + +/* + * SIGSEGV si_codes + */ +#define SEGV_MAPERR 1 /* address not mapped to object */ +#define SEGV_ACCERR 2 /* invalid permissions for mapped object */ +#define NSIGSEGV 2 + +/* + * SIGBUS si_codes + */ +#define BUS_ADRALN 1 /* invalid address alignment */ +#define BUS_ADRERR 2 /* non-existant physical address */ +#define BUS_OBJERR 3 /* object specific hardware error */ +#define NSIGBUS 3 + +/* + * SIGTRAP si_codes + */ +#define TRAP_BRKPT 1 /* process breakpoint */ +#define TRAP_TRACE 2 /* process trace trap */ +#define NSIGTRAP + +/* + * SIGCHLD si_codes + */ +#define CLD_EXITED 1 /* child has exited */ +#define CLD_KILLED 2 /* child was killed */ +#define CLD_DUMPED 3 /* child terminated abnormally */ +#define CLD_TRAPPED 4 /* traced child has trapped */ +#define CLD_STOPPED 5 /* child has stopped */ +#define CLD_CONTINUED 6 /* stopped child has continued */ +#define NSIGCHLD + +/* + * SIGPOLL si_codes + */ +#define POLL_IN 1 /* data input available */ +#define POLL_OUT 2 /* output buffers available */ +#define POLL_MSG 3 /* input message available */ +#define POLL_ERR 4 /* i/o error */ +#define POLL_PRI 5 /* high priority input available */ +#define POLL_HUP 6 /* device disconnected */ +#define NSIGPOLL 6 + +/* + * sigevent definitions + * + * It seems likely that SIGEV_THREAD will have to be handled from + * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the + * thread manager then catches and does the appropriate nonsense. + * However, everything is written out here so as to not get lost. + */ +#define SIGEV_SIGNAL 0 /* notify via signal */ +#define SIGEV_NONE 1 /* other notification: meaningless */ +#define SIGEV_THREAD 2 /* deliver via thread creation */ + +#define SIGEV_MAX_SIZE 64 +#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4) + +typedef struct sigevent { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + union { + int _pad[SIGEV_PAD_SIZE]; + + struct { + void (*_function)(sigval_t); + void *_attribute; /* really pthread_attr_t */ + } _sigev_thread; + } _sigev_un; +} sigevent_t; + +#define sigev_notify_function _sigev_un._sigev_thread._function +#define sigev_notify_attributes _sigev_un._sigev_thread._attribute + +#endif diff --git a/include/asm-alpha/ucontext.h b/include/asm-alpha/ucontext.h new file mode 100644 index 000000000..47578ab42 --- /dev/null +++ b/include/asm-alpha/ucontext.h @@ -0,0 +1,13 @@ +#ifndef _ASMAXP_UCONTEXT_H +#define _ASMAXP_UCONTEXT_H + +struct ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + old_sigset_t uc_osf_sigmask; + stack_t uc_stack; + struct sigcontext uc_mcontext; + sigset_t uc_sigmask; /* mask last for extensibility */ +}; + +#endif /* !_ASMAXP_UCONTEXT_H */ diff --git a/include/asm-i386/siginfo.h b/include/asm-i386/siginfo.h new file mode 100644 index 000000000..99101420b --- /dev/null +++ b/include/asm-i386/siginfo.h @@ -0,0 +1,195 @@ +#ifndef _I386_SIGINFO_H +#define _I386_SIGINFO_H + +#include <linux/types.h> + +/* XXX: This structure was copied from the Alpha; is there an iBCS version? */ + +typedef union sigval { + int sival_int; + void *sival_ptr; +} sigval_t; + +#define SI_MAX_SIZE 128 +#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 3) + +typedef struct siginfo { + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[SI_PAD_SIZE]; + + /* kill() */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + unsigned int _timer1; + unsigned int _timer2; + } _timer; + + /* POSIX.1b signals */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + pid_t _pid; /* which child */ + int _status; /* exit code */ + clock_t _utime; + clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + void *_addr; /* faulting insn/memory ref. */ + } _sigfault; + + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +} siginfo_t; + +/* + * How these fields are to be accessed. + */ +#define si_pid _sifields._kill._pid +#define si_uid _sifields._kill._uid +#define si_status _sifields._sigchld._status +#define si_utime _sifields._sigchld._utime +#define si_stime _sifields._sigchld._stime +#define si_value _sifields._rt._sigval +#define si_int _sifields._rt._sigval.sival_int +#define si_ptr _sifields._rt._sigval.sival_ptr +#define si_addr _sifields._sigfault._addr +#define si_band _sifields._sigpoll._band +#define si_fd _sifields._sigpoll._fd + +/* + * si_code values + * Digital reserves positive values for kernel-generated signals. + */ +#define SI_USER 0 /* sent by kill, sigsend, raise */ +#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ +#define SI_QUEUE -1 /* sent by sigqueue */ +#define SI_TIMER -2 /* sent by timer expiration */ +#define SI_MESGQ -3 /* sent by real time mesq state change */ +#define SI_ASYNCIO -4 /* sent by AIO completion */ + +#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) +#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) + +/* + * SIGILL si_codes + */ +#define ILL_ILLOPC 1 /* illegal opcode */ +#define ILL_ILLOPN 2 /* illegal operand */ +#define ILL_ILLADR 3 /* illegal addressing mode */ +#define ILL_ILLTRP 4 /* illegal trap */ +#define ILL_PRVOPC 5 /* privileged opcode */ +#define ILL_PRVREG 6 /* privileged register */ +#define ILL_COPROC 7 /* coprocessor error */ +#define ILL_BADSTK 8 /* internal stack error */ +#define NSIGILL 8 + +/* + * SIGFPE si_codes + */ +#define FPE_INTDIV 1 /* integer divide by zero */ +#define FPE_INTOVF 2 /* integer overflow */ +#define FPE_FLTDIV 3 /* floating point divide by zero */ +#define FPE_FLTOVF 4 /* floating point overflow */ +#define FPE_FLTUND 5 /* floating point underflow */ +#define FPE_FLTRES 6 /* floating point inexact result */ +#define FPE_FLTINV 7 /* floating point invalid operation */ +#define FPE_FLTSUB 8 /* subscript out of range */ +#define NSIGFPE 8 + +/* + * SIGSEGV si_codes + */ +#define SEGV_MAPERR 1 /* address not mapped to object */ +#define SEGV_ACCERR 2 /* invalid permissions for mapped object */ +#define NSIGSEGV 2 + +/* + * SIGBUS si_codes + */ +#define BUS_ADRALN 1 /* invalid address alignment */ +#define BUS_ADRERR 2 /* non-existant physical address */ +#define BUS_OBJERR 3 /* object specific hardware error */ +#define NSIGBUS 3 + +/* + * SIGTRAP si_codes + */ +#define TRAP_BRKPT 1 /* process breakpoint */ +#define TRAP_TRACE 2 /* process trace trap */ +#define NSIGTRAP + +/* + * SIGCHLD si_codes + */ +#define CLD_EXITED 1 /* child has exited */ +#define CLD_KILLED 2 /* child was killed */ +#define CLD_DUMPED 3 /* child terminated abnormally */ +#define CLD_TRAPPED 4 /* traced child has trapped */ +#define CLD_STOPPED 5 /* child has stopped */ +#define CLD_CONTINUED 6 /* stopped child has continued */ +#define NSIGCHLD + +/* + * SIGPOLL si_codes + */ +#define POLL_IN 1 /* data input available */ +#define POLL_OUT 2 /* output buffers available */ +#define POLL_MSG 3 /* input message available */ +#define POLL_ERR 4 /* i/o error */ +#define POLL_PRI 5 /* high priority input available */ +#define POLL_HUP 6 /* device disconnected */ +#define NSIGPOLL 6 + +/* + * sigevent definitions + * + * It seems likely that SIGEV_THREAD will have to be handled from + * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the + * thread manager then catches and does the appropriate nonsense. + * However, everything is written out here so as to not get lost. + */ +#define SIGEV_SIGNAL 0 /* notify via signal */ +#define SIGEV_NONE 1 /* other notification: meaningless */ +#define SIGEV_THREAD 2 /* deliver via thread creation */ + +#define SIGEV_MAX_SIZE 64 +#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3) + +typedef struct sigevent { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + union { + int _pad[SIGEV_PAD_SIZE]; + + struct { + void (*_function)(sigval_t); + void *_attribute; /* really pthread_attr_t */ + } _sigev_thread; + } _sigev_un; +} sigevent_t; + +#define sigev_notify_function _sigev_un._sigev_thread._function +#define sigev_notify_attributes _sigev_un._sigev_thread._attribute + +#endif diff --git a/include/asm-i386/ucontext.h b/include/asm-i386/ucontext.h new file mode 100644 index 000000000..b0db36925 --- /dev/null +++ b/include/asm-i386/ucontext.h @@ -0,0 +1,12 @@ +#ifndef _ASMi386_UCONTEXT_H +#define _ASMi386_UCONTEXT_H + +struct ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct sigcontext uc_mcontext; + sigset_t uc_sigmask; /* mask last for extensibility */ +}; + +#endif /* !_ASMi386_UCONTEXT_H */ diff --git a/include/asm-mips/decstation.h b/include/asm-mips/decstation.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/asm-mips/decstation.h +++ /dev/null diff --git a/include/asm-mips/deskstation.h b/include/asm-mips/deskstation.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/asm-mips/deskstation.h +++ /dev/null diff --git a/include/asm-mips/siginfo.h b/include/asm-mips/siginfo.h new file mode 100644 index 000000000..d4e6f4145 --- /dev/null +++ b/include/asm-mips/siginfo.h @@ -0,0 +1,195 @@ +#ifndef __ASM_MIPS_SIGINFO_H +#define __ASM_MIPS_SIGINFO_H + +#include <linux/types.h> + +/* This structure matches OSF/1 for binary compatibility. */ + +typedef union sigval { + int sival_int; + void *sival_ptr; +} sigval_t; + +#define SI_MAX_SIZE 128 +#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 4) + +typedef struct siginfo { + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[SI_PAD_SIZE]; + + /* kill() */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + unsigned int _timer1; + unsigned int _timer2; + } _timer; + + /* POSIX.1b signals */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + pid_t _pid; /* which child */ + int _status; /* exit code */ + clock_t _utime; + clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + void *_addr; /* faulting insn/memory ref. */ + } _sigfault; + + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +} siginfo_t; + +/* + * How these fields are to be accessed. + */ +#define si_pid _sifields._kill._pid +#define si_uid _sifields._kill._uid +#define si_status _sifields._sigchld._status +#define si_utime _sifields._sigchld._utime +#define si_stime _sifields._sigchld._stime +#define si_value _sifields._rt._sigval +#define si_int _sifields._rt._sigval.sival_int +#define si_ptr _sifields._rt._sigval.sival_ptr +#define si_addr _sifields._sigfault._addr +#define si_band _sifields._sigpoll._band +#define si_fd _sifields._sigpoll._fd + +/* + * si_code values + * Digital reserves positive values for kernel-generated signals. + */ +#define SI_USER 0 /* sent by kill, sigsend, raise */ +#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ +#define SI_QUEUE -1 /* sent by sigqueue */ +#define SI_TIMER -2 /* sent by timer expiration */ +#define SI_MESGQ -3 /* sent by real time mesq state change */ +#define SI_ASYNCIO -4 /* sent by AIO completion */ + +#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) +#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) + +/* + * SIGILL si_codes + */ +#define ILL_ILLOPC 1 /* illegal opcode */ +#define ILL_ILLOPN 2 /* illegal operand */ +#define ILL_ILLADR 3 /* illegal addressing mode */ +#define ILL_ILLTRP 4 /* illegal trap */ +#define ILL_PRVOPC 5 /* privileged opcode */ +#define ILL_PRVREG 6 /* privileged register */ +#define ILL_COPROC 7 /* coprocessor error */ +#define ILL_BADSTK 8 /* internal stack error */ +#define NSIGILL 8 + +/* + * SIGFPE si_codes + */ +#define FPE_INTDIV 1 /* integer divide by zero */ +#define FPE_INTOVF 2 /* integer overflow */ +#define FPE_FLTDIV 3 /* floating point divide by zero */ +#define FPE_FLTOVF 4 /* floating point overflow */ +#define FPE_FLTUND 5 /* floating point underflow */ +#define FPE_FLTRES 6 /* floating point inexact result */ +#define FPE_FLTINV 7 /* floating point invalid operation */ +#define FPE_FLTSUB 8 /* subscript out of range */ +#define NSIGFPE 8 + +/* + * SIGSEGV si_codes + */ +#define SEGV_MAPERR 1 /* address not mapped to object */ +#define SEGV_ACCERR 2 /* invalid permissions for mapped object */ +#define NSIGSEGV 2 + +/* + * SIGBUS si_codes + */ +#define BUS_ADRALN 1 /* invalid address alignment */ +#define BUS_ADRERR 2 /* non-existant physical address */ +#define BUS_OBJERR 3 /* object specific hardware error */ +#define NSIGBUS 3 + +/* + * SIGTRAP si_codes + */ +#define TRAP_BRKPT 1 /* process breakpoint */ +#define TRAP_TRACE 2 /* process trace trap */ +#define NSIGTRAP + +/* + * SIGCHLD si_codes + */ +#define CLD_EXITED 1 /* child has exited */ +#define CLD_KILLED 2 /* child was killed */ +#define CLD_DUMPED 3 /* child terminated abnormally */ +#define CLD_TRAPPED 4 /* traced child has trapped */ +#define CLD_STOPPED 5 /* child has stopped */ +#define CLD_CONTINUED 6 /* stopped child has continued */ +#define NSIGCHLD + +/* + * SIGPOLL si_codes + */ +#define POLL_IN 1 /* data input available */ +#define POLL_OUT 2 /* output buffers available */ +#define POLL_MSG 3 /* input message available */ +#define POLL_ERR 4 /* i/o error */ +#define POLL_PRI 5 /* high priority input available */ +#define POLL_HUP 6 /* device disconnected */ +#define NSIGPOLL 6 + +/* + * sigevent definitions + * + * It seems likely that SIGEV_THREAD will have to be handled from + * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the + * thread manager then catches and does the appropriate nonsense. + * However, everything is written out here so as to not get lost. + */ +#define SIGEV_SIGNAL 0 /* notify via signal */ +#define SIGEV_NONE 1 /* other notification: meaningless */ +#define SIGEV_THREAD 2 /* deliver via thread creation */ + +#define SIGEV_MAX_SIZE 64 +#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4) + +typedef struct sigevent { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + union { + int _pad[SIGEV_PAD_SIZE]; + + struct { + void (*_function)(sigval_t); + void *_attribute; /* really pthread_attr_t */ + } _sigev_thread; + } _sigev_un; +} sigevent_t; + +#define sigev_notify_function _sigev_un._sigev_thread._function +#define sigev_notify_attributes _sigev_un._sigev_thread._attribute + +#endif /* __ASM_MIPS_SIGINFO_H */ diff --git a/include/asm-mips/ucontext.h b/include/asm-mips/ucontext.h new file mode 100644 index 000000000..56a5805fb --- /dev/null +++ b/include/asm-mips/ucontext.h @@ -0,0 +1,12 @@ +#ifndef __ASM_MIPS_UCONTEXT_H +#define __ASM_MIPS_UCONTEXT_H + +struct ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct sigcontext uc_mcontext; + sigset_t uc_sigmask; /* mask last for extensibility */ +}; + +#endif /* __ASM_MIPS_UCONTEXT_H */ diff --git a/include/linux/aztcd.h b/include/linux/aztcd.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/aztcd.h +++ /dev/null diff --git a/include/linux/cdu31a.h b/include/linux/cdu31a.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/cdu31a.h +++ /dev/null diff --git a/include/linux/cm206.h b/include/linux/cm206.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/cm206.h +++ /dev/null diff --git a/include/linux/coda.h b/include/linux/coda.h new file mode 100644 index 000000000..08e263925 --- /dev/null +++ b/include/linux/coda.h @@ -0,0 +1,489 @@ +/* + * Venus interface for Coda. + * Original version: (C) 1996 Peter Braam + * Rewritten for Linux 2.1: (C) 1997 Carnegie Mellon University + * + * Carnegie Mellon encourages users of this code to contribute improvements + * to the Coda project. Contact Peter Braam <coda@cs.cmu.edu>. + */ + +/* + * + * Based on cfs.h from Mach, but revamped for increased simplicity. + * Linux modifications by Peter Braam, Aug 1996 + */ + +#ifndef _CFS_HEADER_ +#define _CFS_HEADER_ + + + +/* Catch new _KERNEL defn for NetBSD */ +#ifdef __NetBSD__ +#include <sys/types.h> +#ifdef _KERNEL +#define KERNEL +#endif +#endif + +#if 0 +#ifndef _SCALAR_T_ +#define _SCALAR_T_ 1 +typedef unsigned long u_int32_t; +typedef unsigned short u_int16_t; +typedef unsigned char u_int8_t; +#endif +#endif + +#ifdef __linux__ +#ifndef _UQUAD_T_ +#define _UQUAD_T_ 1 +typedef unsigned long u_quad_t; +#endif + +#ifdef __KERNEL__ +#define KERNEL +#endif __KERNEL__ +#endif + +/* + * Cfs constants + */ +#define CFS_MAXNAMLEN 256 +#define CFS_MAXPATHLEN 256 +#define CODA_MAXSYMLINK 10 + +/* types used in kernel and user mode */ +#ifndef _VENUS_DIRENT_T_ +#define _VENUS_DIRENT_T_ 1 +struct venus_dirent { + unsigned long d_fileno; /* file number of entry */ + unsigned short d_reclen; /* length of this record */ + char d_type; /* file type, see below */ + char d_namlen; /* length of string in d_name */ + char d_name[CFS_MAXNAMLEN + 1];/* name must be no longer than this */ +}; +#undef DIRSIZ +#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CFS_MAXNAMLEN+1)) + \ + (((dp)->d_namlen+1 + 3) &~ 3)) + +/* + * File types + */ +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 + +/* + * Convert between stat structure types and directory types. + */ +#define IFTODT(mode) (((mode) & 0170000) >> 12) +#define DTTOIF(dirtype) ((dirtype) << 12) + +#endif + +#ifndef _FID_T_ +#define _FID_T_ 1 +typedef u_long VolumeId; +typedef u_long VnodeId; +typedef u_long Unique_t; +typedef u_long FileVersion; +#endif + +#ifndef _VICEFID_T_ +#define _VICEFID_T_ 1 +typedef struct ViceFid { + VolumeId Volume; + VnodeId Vnode; + Unique_t Unique; +} ViceFid; +#endif /* VICEFID */ + +#ifndef _VUID_T_ +#define _VUID_T_ +typedef u_long vuid_t; +typedef u_long vgid_t; +#endif /*_VUID_T_ */ + +#ifndef _CODACRED_T_ +#define _CODACRED_T_ +#define NGROUPS 32 +struct CodaCred { + vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/ + vgid_t cr_gid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */ + vgid_t cr_groups[NGROUPS]; /* Group membership for caller */ +}; +#endif + +#ifndef _VENUS_VATTR_T_ +#define _VENUS_VATTR_T_ +/* + * Vnode types. VNON means no type. + */ +enum coda_vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; + +struct coda_vattr { + enum coda_vtype va_type; /* vnode type (for create) */ + u_short va_mode; /* files access mode and type */ + short va_nlink; /* number of references to file */ + vuid_t va_uid; /* owner user id */ + vgid_t va_gid; /* owner group id */ + long va_fsid; /* file system id (dev for now) */ + long va_fileid; /* file id */ + u_quad_t va_size; /* file size in bytes */ + long va_blocksize; /* blocksize preferred for i/o */ + struct timespec va_atime; /* time of last access */ + struct timespec va_mtime; /* time of last modification */ + struct timespec va_ctime; /* time file changed */ + u_long va_gen; /* generation number of file */ + u_long va_flags; /* flags defined for file */ + dev_t va_rdev; /* device the special file represents */ + u_quad_t va_bytes; /* bytes of disk space held by file */ + u_quad_t va_filerev; /* file modification number */ + u_int va_vaflags; /* operations flags, see below */ + long va_spare; /* remain quad aligned */ +}; +#define VREAD 00400 +#define VWRITE 00200 + +#endif + +/* + * opcode constants + */ +#define CFS_ROOT ((u_long) 2) +#define CFS_SYNC ((u_long) 3) +#define CFS_OPEN ((u_long) 4) +#define CFS_CLOSE ((u_long) 5) +#define CFS_IOCTL ((u_long) 6) +#define CFS_GETATTR ((u_long) 7) +#define CFS_SETATTR ((u_long) 8) +#define CFS_ACCESS ((u_long) 9) +#define CFS_LOOKUP ((u_long) 10) +#define CFS_CREATE ((u_long) 11) +#define CFS_REMOVE ((u_long) 12) +#define CFS_LINK ((u_long) 13) +#define CFS_RENAME ((u_long) 14) +#define CFS_MKDIR ((u_long) 15) +#define CFS_RMDIR ((u_long) 16) +#define CFS_READDIR ((u_long) 17) +#define CFS_SYMLINK ((u_long) 18) +#define CFS_READLINK ((u_long) 19) +#define CFS_FSYNC ((u_long) 20) +#define CFS_INACTIVE ((u_long) 21) +#define CFS_VGET ((u_long) 22) +#define CFS_SIGNAL ((u_long) 23) +#define CFS_REPLACE ((u_long) 24) +#define CFS_FLUSH ((u_long) 25) +#define CFS_PURGEUSER ((u_long) 26) +#define CFS_ZAPFILE ((u_long) 27) +#define CFS_ZAPDIR ((u_long) 28) +#define CFS_ZAPVNODE ((u_long) 29) +#define CFS_PURGEFID ((u_long) 30) +#define CFS_RDWR ((u_long) 31) +#define ODY_MOUNT ((u_long) 32) +#define ODY_LOOKUP ((u_long) 33) +#define ODY_EXPAND ((u_long) 34) + +#define CFS_NCALLS 35 +#define DOWNCALL(opcode) (opcode >= CFS_REPLACE && opcode <= CFS_PURGEFID) + +/* + * Venus <-> Coda RPC arguments + */ + +struct inputArgs { + u_long opcode; + u_long unique; /* Keep multiple outstanding msgs distinct */ + u_short pid; /* Common to all */ + u_short pgid; /* Common to all */ + struct CodaCred cred; /* Common to all */ + + union { + /* Nothing needed for cfs_root */ + /* Nothing needed for cfs_sync */ + struct cfs_open_in { + ViceFid VFid; + int flags; + } cfs_open; + struct cfs_close_in { + ViceFid VFid; + int flags; + } cfs_close; + struct cfs_ioctl_in { + ViceFid VFid; + int cmd; + int len; + int rwflag; + char *data; /* Place holder for data. */ + } cfs_ioctl; + struct cfs_getattr_in { + ViceFid VFid; + struct coda_vattr attr; + } cfs_getattr; + struct cfs_setattr_in { + ViceFid VFid; + struct coda_vattr attr; + } cfs_setattr; + struct cfs_access_in { + ViceFid VFid; + int flags; + } cfs_access; + struct cfs_lookup_in { + ViceFid VFid; + char *name; /* Place holder for data. */ + } cfs_lookup; + struct cfs_create_in { + ViceFid VFid; + struct coda_vattr attr; + int excl; + int mode; + char *name; /* Place holder for data. */ + } cfs_create; + struct cfs_remove_in { + ViceFid VFid; + char *name; /* Place holder for data. */ + } cfs_remove; + struct cfs_link_in { + ViceFid sourceFid; /* cnode to link *to* */ + ViceFid destFid; /* Directory in which to place link */ + char *tname; /* Place holder for data. */ + } cfs_link; + struct cfs_rename_in { + ViceFid sourceFid; + char *srcname; + ViceFid destFid; + char *destname; + } cfs_rename; + struct cfs_mkdir_in { + ViceFid VFid; + struct coda_vattr attr; + char *name; /* Place holder for data. */ + } cfs_mkdir; + struct cfs_rmdir_in { + ViceFid VFid; + char *name; /* Place holder for data. */ + } cfs_rmdir; + struct cfs_readdir_in { + ViceFid VFid; + int count; + int offset; + } cfs_readdir; + struct cfs_symlink_in { + ViceFid VFid; /* Directory to put symlink in */ + char *srcname; + struct coda_vattr attr; + char *tname; + } cfs_symlink; + struct cfs_readlink_in { + ViceFid VFid; + } cfs_readlink; + struct cfs_fsync_in { + ViceFid VFid; + } cfs_fsync; + struct cfs_inactive_in { + ViceFid VFid; + } cfs_inactive; + struct cfs_vget_in { + ViceFid VFid; + } cfs_vget; + /* CFS_SIGNAL is out-of-band, doesn't need data. */ + /* CFS_INVALIDATE is a venus->kernel call */ + /* CFS_FLUSH is a venus->kernel call */ + /* CFS_PURGEUSER is a venus->kernel call */ + /* CFS_ZAPFILE is a venus->kernel call */ + /* CFS_ZAPDIR is a venus->kernel call */ + /* CFS_ZAPVNODE is a venus->kernel call */ + /* CFS_PURGEFID is a venus->kernel call */ + struct cfs_rdwr_in { + ViceFid VFid; + int rwflag; + int count; + int offset; + int ioflag; + caddr_t data; /* Place holder for data. */ + } cfs_rdwr; + struct ody_mount_in { + char *name; /* Place holder for data. */ + } ody_mount; + struct ody_lookup_in { + ViceFid VFid; + char *name; /* Place holder for data. */ + } ody_lookup; + struct ody_expand_in { + ViceFid VFid; + int size; /* Size of buffer to return. */ + } ody_expand; + /* CFS_REPLACE is a venus->kernel call */ + } d; +}; + +/* Occasionally, don't cache the fid returned by CFS_LOOKUP. For + * instance, if the fid is inconsistent. This case is handled by + * setting the top bit of the return result parameter. */ +#define CFS_NOCACHE 0x80000000 + +#define INIT_OUT(out, opcode, result) \ + out->opcode = (opcode); out->result = (result); + +/* IMPORTANT: opcode and unique must be first two fields! */ +struct outputArgs { + u_long opcode; + u_long unique; /* Keep multiple outstanding msgs distinct */ + u_long result; + union { + struct cfs_root_out { + ViceFid VFid; + } cfs_root; + /* Nothing needed for cfs_sync */ + struct cfs_open_out { + dev_t dev; + ino_t inode; + } cfs_open; + /* Nothing needed for cfs_close */ + struct cfs_ioctl_out { + int len; + caddr_t data; /* Place holder for data. */ + } cfs_ioctl; + struct cfs_getattr_out { + struct coda_vattr attr; + } cfs_getattr; + /* Nothing needed for cfs_setattr */ + /* Nothing needed for cfs_access */ + struct cfs_lookup_out { + ViceFid VFid; + int vtype; + } cfs_lookup; + struct cfs_create_out { + ViceFid VFid; + struct coda_vattr attr; + } cfs_create; + /* Nothing needed for cfs_remove */ + /* Nothing needed for cfs_link */ + /* Nothing needed for cfs_rename */ + struct cfs_mkdir_out { + ViceFid VFid; + struct coda_vattr attr; + } cfs_mkdir; + /* Nothing needed for cfs_rmdir */ + struct cfs_readdir_out { + int size; + caddr_t data; /* Place holder for data. */ + } cfs_readdir; + /* Nothing needed for cfs_symlink */ + struct cfs_readlink_out { + int count; + caddr_t data; /* Place holder for data. */ + } cfs_readlink; + /* Nothing needed for cfs_fsync */ + /* Nothing needed for cfs_inactive */ + struct cfs_vget_out { + ViceFid VFid; + int vtype; + } cfs_vget; + /* CFS_SIGNAL is out-of-band, doesn't need data. */ + /* CFS_INVALIDATE is a venus->kernel call */ + /* CFS_FLUSH is a venus->kernel call */ + struct cfs_purgeuser_out {/* CFS_PURGEUSER is a venus->kernel call */ + struct CodaCred cred; + } cfs_purgeuser; + struct cfs_zapfile_out { /* CFS_ZAPFILE is a venus->kernel call */ + ViceFid CodaFid; + } cfs_zapfile; + struct cfs_zapdir_out { /* CFS_ZAPDIR is a venus->kernel call */ + ViceFid CodaFid; + } cfs_zapdir; + struct cfs_zapvnode_out { /* CFS_ZAPVNODE is a venus->kernel call */ + struct CodaCred cred; + ViceFid VFid; + } cfs_zapvnode; + struct cfs_purgefid_out { /* CFS_PURGEFID is a venus->kernel call */ + ViceFid CodaFid; + } cfs_purgefid; + struct cfs_rdwr_out { + int rwflag; + int count; + caddr_t data; /* Place holder for data. */ + } cfs_rdwr; + struct ody_mount_out { + ViceFid VFid; + } ody_mount; + struct ody_lookup_out { + ViceFid VFid; + } ody_lookup; + struct ody_expand_out { /* Eventually it would be nice to get some */ + char links[sizeof(int)]; /* Place holder for data. */ + } ody_expand; + struct cfs_replace_out { /* cfs_replace is a venus->kernel call */ + ViceFid NewFid; + ViceFid OldFid; + } cfs_replace; + } d; +}; + + +/* + * how big are the inputArgs and outputArgs structures + * for the varying types of calls? + */ +#define VC_IN_NO_DATA (2 * (int)sizeof(u_long) \ + + 2 * (int)sizeof(u_short) \ + + (int)sizeof(struct CodaCred)) +#define VC_OUT_NO_DATA (3 * (int)sizeof(u_long)) +#define VC_INSIZE(member) (VC_IN_NO_DATA + (int)sizeof(struct member)) +#define VC_OUTSIZE(member) (VC_OUT_NO_DATA + (int)sizeof(struct member)) + +/* Now for venus. C++ doesn't know what struct foo means. */ +#define VC_SIZE(Thing, Member) (VC_OUT_NO_DATA \ + + (int)sizeof((Thing)->d.Member)) + +#define VC_BIGGER_OF_IN_OR_OUT (sizeof(struct outputArgs) \ + > sizeof(struct inputArgs) \ + ? sizeof(struct outputArgs) \ + : sizeof(struct inputArgs)) +#define VC_DATASIZE 8192 +#define VC_MAXMSGSIZE (VC_DATASIZE + VC_BIGGER_OF_IN_OR_OUT) + +/* + * Used for identifying usage of "Control" and pioctls + */ +struct ViceIoctl { + caddr_t in, out; /* Data to be transferred in, or out */ + short in_size; /* Size of input buffer <= 2K */ + short out_size; /* Maximum size of output buffer, <= 2K */ +}; + +struct PioctlData { + const char *path; + int follow; + struct ViceIoctl vi; +}; + + + + + + +#define CFS_CONTROL ".CONTROL" +#define CFS_CONTROLLEN 8 +#define CTL_VOL -1 +#define CTL_VNO -1 +#define CTL_UNI -1 +#define CTL_INO -1 +#define CTL_FILE "/coda/.CONTROL" +#define IOCPARM_MASK 0x0000ffff + + +#define IS_CTL_FID(fidp) ((fidp)->Volume == CTL_VOL &&\ + (fidp)->Vnode == CTL_VNO &&\ + (fidp)->Unique == CTL_UNI) + /*#define ISDIR(fid) ((fid).Vnode & 0x1) */ + +#endif + diff --git a/include/linux/coda_cnode.h b/include/linux/coda_cnode.h new file mode 100644 index 000000000..43bf1b2cc --- /dev/null +++ b/include/linux/coda_cnode.h @@ -0,0 +1,47 @@ +/* + * Cnode definitions for Coda. + * Original version: (C) 1996 Peter Braam + * Rewritten for Linux 2.1: (C) 1997 Carnegie Mellon University + * + * Carnegie Mellon encourages users of this code to contribute improvements + * to the Coda project. Contact Peter Braam <coda@cs.cmu.edu>. + */ + +/* revamped cnode.h file: platform dependent, kernel only! */ + + +#ifndef _CNODE_H_ +#define _CNODE_H_ +#include <linux/coda.h> + + +#define CODA_CNODE_MAGIC 0x47114711 + +/* defintion of cnode, which combines ViceFid with inode information */ +struct cnode { + struct inode *c_vnode; /* linux inode associated with cnode */ + ViceFid c_fid; /* Coda identifier */ + u_short c_flags; /* flags (see below) */ + int c_magic; /* to verify the data structure */ + u_short c_ocount; /* count of openers */ + u_short c_owrite; /* count of open for write */ + u_short c_mmcount; /* count of mmappers */ + struct inode *c_ovp; /* open vnode pointer */ + struct dentry c_odentry; +}; + +/* flags */ +#define C_VATTR 0x1 /* Validity of vattr in the cnode */ +#define C_SYMLINK 0x2 /* Validity of symlink pointer in the cnode */ +#define C_DYING 0x4 /* Set for outstanding cnodes from venus (which died) */ + +struct cnode *coda_cnode_alloc(void); +void coda_cnode_free(struct cnode *cinode); +int coda_cnode_make(struct inode **inode, ViceFid *fid, struct super_block *sb); +struct inode *coda_fid2inode(ViceFid *fid, struct super_block *sb); +int coda_cnode_makectl(struct inode **inode, struct super_block *sb); + + + +#endif + diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h new file mode 100644 index 000000000..35901883b --- /dev/null +++ b/include/linux/coda_linux.h @@ -0,0 +1,187 @@ +/* + * Coda File System, Linux Kernel module + * + * Original version, adapted from cfs_mach.c, (C) Carnegie Mellon University + * Linux modifications (C) 1996, Peter J. Braam + * Rewritten for Linux 2.1 (C) 1997 Carnegie Mellon University + * + * Carnegie Mellon University encourages users of this software to + * contribute improvements to the Coda project. + */ + +#ifndef _LINUX_CODA_FS +#define _LINUX_CODA_FS + +#include <linux/kernel.h> +#include <linux/param.h> +#include <linux/sched.h> +#include <linux/mm.h> +#include <linux/vmalloc.h> +#include <linux/malloc.h> +#include <linux/wait.h> +#include <linux/types.h> +#include <linux/fs.h> + +/* operations */ +extern struct inode_operations coda_dir_inode_operations; +extern struct inode_operations coda_file_inode_operations; +extern struct inode_operations coda_ioctl_inode_operations; +extern struct inode_operations coda_symlink_inode_operations; + +extern struct file_operations coda_dir_operations; +extern struct file_operations coda_file_operations; +extern struct file_operations coda_ioctl_operations; + +/* operations shared over more than one file */ +int coda_open(struct inode *i, struct file *f); +int coda_release(struct inode *i, struct file *f); +int coda_permission(struct inode *inode, int mask); + +/* global variables */ +extern int coda_debug; +extern int coda_print_entry; +extern int coda_access_cache; +extern int cfsnc_use; + + +/* */ +char *coda_f2s(ViceFid *f, char *s); +int coda_isroot(struct inode *i); +void coda_load_creds(struct CodaCred *cred); + + + +/* defined in file.c */ +void coda_prepare_openfile(struct inode *coda_inode, struct file *coda_file, + struct inode *open_inode, struct file *open_file, + struct dentry *open_dentry); +void coda_restore_codafile(struct inode *coda_inode, struct file *coda_file, + struct inode *open_inode, struct file *open_file); +int coda_inode_grab(dev_t dev, ino_t ino, struct inode **ind); +struct super_block *coda_find_super(kdev_t device); + + +#define INIT_IN(in, op) \ + (in)->opcode = (op); \ + (in)->pid = current->pid; \ + (in)->pgid = current->gid; + +/* debugging aids */ + +#define coda_panic printk + +/* debugging masks */ +#define D_SUPER 1 /* print results returned by Venus */ +#define D_INODE 2 /* print entry and exit into procedure */ +#define D_FILE 4 /* print malloc, de-alloc information */ +#define D_CACHE 8 /* cache debugging */ +#define D_MALLOC 16 +#define D_CNODE 32 +#define D_UPCALL 64 /* up and downcall debugging */ +#define D_PSDEV 128 +#define D_PIOCTL 256 +#define D_SPECIAL 512 +/* until we are really good, ... */ +#define coda_panic printk + +#define CDEBUG(mask, format, a...) \ + do { \ + if (coda_debug & mask) { \ + printk("(%s,l. %d): ", __FUNCTION__, __LINE__); \ + printk(format, ## a); } \ +} while (0) ; + +#define ENTRY \ + if(coda_print_entry) printk("Process %d entered %s\n",current->pid,__FUNCTION__) + +#define EXIT \ + if(coda_print_entry) printk("Process %d leaving %s\n",current->pid,__FUNCTION__) + + +/* inode to cnode */ +#define ITOC(the_inode) ((struct cnode *)(the_inode)->u.generic_ip) +/* cnode to inode */ +#define CTOI(the_cnode) ((the_cnode)->c_vnode) + +#define CHECK_CNODE(c) \ +do { \ + struct cnode *cnode = (c); \ + if (!cnode) \ + coda_panic ("%s(%d): cnode is null\n", __FUNCTION__, __LINE__); \ + if (cnode->c_magic != CODA_CNODE_MAGIC) \ + coda_panic ("%s(%d): cnode magic wrong\n", __FUNCTION__, __LINE__); \ + if (!cnode->c_vnode) \ + coda_panic ("%s(%d): cnode has null inode\n", __FUNCTION__, __LINE__); \ + if ( (struct cnode *)cnode->c_vnode->u.generic_ip != cnode ) \ + coda_panic("AAooh, %s(%d) cnode doesn't link right!\n", __FUNCTION__,__LINE__);\ +} while (0); + + +/* ioctl stuff */ +/* this needs to be sorted out XXXX */ +#ifdef __linux__ +#define IOCPARM_MASK 0x0000ffff +#endif + +#define CODA_ALLOC(ptr, cast, size) \ +do { \ + if (size < 3000) { \ + ptr = (cast)kmalloc((unsigned long) size, GFP_KERNEL); \ + CDEBUG(D_MALLOC, "kmalloced: %x at %x.\n", (int) size, (int) ptr);\ + } else { \ + ptr = (cast)vmalloc((unsigned long) size); \ + CDEBUG(D_MALLOC, "vmalloced: %x at %x.\n", (int) size, (int) ptr);}\ + if (ptr == 0) { \ + coda_panic("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ + } \ + memset( ptr, 0, size ); \ +} while (0) + + +#define CODA_FREE(ptr,size) do {if (size < 3000) { kfree_s((ptr), (size)); CDEBUG(D_MALLOC, "kfreed: %x at %x.\n", (int) size, (int) ptr); } else { vfree((ptr)); CDEBUG(D_MALLOC, "vfreed: %x at %x.\n", (int) size, (int) ptr);} } while (0) + + + + +/* + * Macros to manipulate the queue + */ +#define crfree(cred) CODA_FREE( (cred), sizeof(struct ucred)) + +#ifndef INIT_QUEUE + +struct queue { + struct queue *forw, *back; +}; + +#define INIT_QUEUE(head) \ +do { \ + (head).forw = (struct queue *)&(head); \ + (head).back = (struct queue *)&(head); \ +} while (0) + +#define GETNEXT(head) (head).forw + +#define EMPTY(head) ((head).forw == &(head)) + +#define EOQ(el, head) ((struct queue *)(el) == (struct queue *)&(head)) + +#define INSQUE(el, head) \ +do { \ + (el).forw = ((head).back)->forw; \ + (el).back = (head).back; \ + ((head).back)->forw = (struct queue *)&(el); \ + (head).back = (struct queue *)&(el); \ +} while (0) + +#define REMQUE(el) \ +do { \ + ((el).forw)->back = (el).back; \ + (el).back->forw = (el).forw; \ +} while (0) + +#endif INIT_QUEUE + + +#endif _LINUX_CODA_FS + diff --git a/include/linux/coda_namecache.h b/include/linux/coda_namecache.h new file mode 100644 index 000000000..261adff6b --- /dev/null +++ b/include/linux/coda_namecache.h @@ -0,0 +1,160 @@ +/* + * Mach Operating System + * Copyright (c) 1990 Carnegie-Mellon University + * Copyright (c) 1989 Carnegie-Mellon University + * All rights reserved. The CMU software License Agreement specifies + * the terms and conditions for use and redistribution. + */ + +/* + * This code was written for the Coda file system at Carnegie Mellon University. + * Contributers include David Steere, James Kistler, and M. Satyanarayanan. + */ + +/* + * HISTORY + * cfsnc.h,v + * Revision 1.2 1996/01/02 16:57:19 bnoble + * Added support for Coda MiniCache and raw inode calls (final commit) + * + * Revision 1.1.2.1 1995/12/20 01:57:45 bnoble + * Added CFS-specific files + * + * Revision 3.1.1.1 1995/03/04 19:08:22 bnoble + * Branch for NetBSD port revisions + * + * Revision 3.1 1995/03/04 19:08:21 bnoble + * Bump to major revision 3 to prepare for NetBSD port + * + * Revision 2.2 1994/08/28 19:37:39 luqi + * Add a new CFS_REPLACE call to allow venus to replace a ViceFid in the + * mini-cache. + * + * In "cfs.h": + * Add CFS_REPLACE decl. + * + * In "cfs_namecache.c": + * Add routine cfsnc_replace. + * + * In "cfs_subr.c": + * Add case-statement to process CFS_REPLACE. + * + * In "cfsnc.h": + * Add decl for CFSNC_REPLACE. + * + * Revision 2.1 94/07/21 16:25:27 satya + * Conversion to C++ 3.0; start of Coda Release 2.0 + * + * Revision 1.2 92/10/27 17:58:34 lily + * merge kernel/latest and alpha/src/cfs + * + * Revision 2.2 90/07/05 11:27:04 mrt + * Created for the Coda File System. + * [90/05/23 dcs] + * + * Revision 1.4 90/05/31 17:02:12 dcs + * Prepare for merge with facilities kernel. + * + * + */ +#ifndef _CFSNC_HEADER_ +#define _CFSNC_HEADER_ + +#include "coda.h" +#include "coda_cnode.h" + + +/* + * Cfs constants + */ +#define CFSNC_NAMELEN 15 /* longest name stored in cache */ +#define CFSNC_CACHESIZE 256 /* Default cache size */ +#define CFSNC_HASHSIZE 64 /* Must be multiple of 2 */ +/* + * Structure for an element in the CFS Name Cache. + */ + +/* roughly 50 bytes per entry */ +struct cfscache { + struct cfscache *hash_next,*hash_prev; /* Hash list */ + struct cfscache *lru_next, *lru_prev; /* LRU list */ + struct cnode *cp; /* vnode of the file */ + struct cnode *dcp; /* parent's cnode */ + struct CodaCred *cred; /* user credentials */ + char name[CFSNC_NAMELEN]; /* segment name */ + int namelen; /* length of name */ +}; + + + +/* exported */ +void cfsnc_init(void); +void cfsnc_enter(struct cnode *dcp, register const char *name, int namelen, struct cnode *cp); +struct cnode *cfsnc_lookup(struct cnode *dcp, register const char *name, int namelen); +void cfsnc_zapParentfid(ViceFid *fid); +void cfsnc_zapfid(ViceFid *fid); +void cfsnc_zapfile(struct cnode *dcp, register const char *name, int length); +void cfsnc_purge_user(struct CodaCred *cred); +void cfsnc_flush(void); +void cfsnc_replace(ViceFid *f1, ViceFid *f2); +void print_cfsnc(void); +void coda_print_ce(struct cfscache *); +int cfsnc_resize(int hashsize, int heapsize); + + + +/* #define CFSNC_VALID(cncp) ( (cncp->dcp != (struct cnode *)0) && (cncp->cp->c_flags & C_VATTR) ) */ +#define CFSNC_VALID(cncp) (cncp->dcp != (struct cnode *)0) + +#define DATA_PART(cncp) (struct cfscache *) \ + ((char *)cncp + (4*sizeof(struct cfscache *))) +#define DATA_SIZE (sizeof(struct cfscache)-(4*sizeof(struct cfscache *))) + +/* + * Structure to contain statistics on the cache usage + */ + +struct cfsnc_statistics { + unsigned hits; + unsigned misses; + unsigned enters; + unsigned dbl_enters; + unsigned long_name_enters; + unsigned long_name_lookups; + unsigned long_remove; + unsigned lru_rm; + unsigned zapPfids; + unsigned zapFids; + unsigned zapFile; + unsigned zapUsers; + unsigned Flushes; + unsigned Sum_bucket_len; + unsigned Sum2_bucket_len; + unsigned Max_bucket_len; + unsigned Num_zero_len; + unsigned Search_len; +}; + +/* + * Symbols to aid in debugging the namecache code. Assumes the existence + * of the variable cfsnc_debug, which is defined in cfs_namecache.c + */ +extern int cfsnc_debug; +#define CFSNC_DEBUG(N, STMT) { if (cfsnc_debug & (1 <<N)) { STMT } } + +#define CFSNC_FIND ((u_long) 1) +#define CFSNC_REMOVE ((u_long) 2) +#define CFSNC_INIT ((u_long) 3) +#define CFSNC_ENTER ((u_long) 4) +#define CFSNC_LOOKUP ((u_long) 5) +#define CFSNC_ZAPPFID ((u_long) 6) +#define CFSNC_ZAPFID ((u_long) 7) +#define CFSNC_ZAPVNODE ((u_long) 8) +#define CFSNC_ZAPFILE ((u_long) 9) +#define CFSNC_PURGEUSER ((u_long) 10) +#define CFSNC_FLUSH ((u_long) 11) +#define CFSNC_PRINTCFSNC ((u_long) 12) +#define CFSNC_PRINTSTATS ((u_long) 13) +#define CFSNC_REPLACE ((u_long) 14) + +#endif _CFSNC_HEADER_ diff --git a/include/linux/coda_opstats.h b/include/linux/coda_opstats.h new file mode 100644 index 000000000..2c127e6e5 --- /dev/null +++ b/include/linux/coda_opstats.h @@ -0,0 +1,107 @@ +/* + * Operations statistics for Coda. + * Original version: (C) 1996 Peter Braam + * Rewritten for Linux 2.1: (C) 1997 Carnegie Mellon University + * + * Carnegie Mellon encourages users of this code to contribute improvements + * to the Coda project. Contact Peter Braam <coda@cs.cmu.edu>. + */ + + +/* + * operation stats: what the minicache can intercept that + * *isn't* seen by venus. These stats are kept to augment + * the stats maintained by the Volume-Session mechanism. + */ + +/* vfsops: + * mount: not currently bounced to Venus + * umount: nope + * root: only first call, rest is cached. + * statfs: none (bogus) + * sync: none (bogus) + * vget: all + */ + +#define CFS_MOUNT_STATS 0 +#define CFS_UMOUNT_STATS 1 +#define CFS_ROOT_STATS 2 +#define CFS_STATFS_STATS 3 +#define CFS_SYNC_STATS 4 +#define CFS_VGET_STATS 5 +#define CFS_VFSOPS_SIZE 6 + +/* vnodeops: + * open: all to venus + * close: all to venus + * rdrw: bogus. Maybe redirected to UFS. + * May call open/close for internal opens/closes + * (Does exec not call open?) + * ioctl: causes a lookupname + * passes through + * select: can't get there from here. + * getattr: can be satsified by cache + * setattr: all go through + * access: can be satisfied by cache + * readlink: can be satisfied by cache + * fsync: passes through + * inactive: passes through + * lookup: can be satisfied by cache + * create: passes through + * remove: passes through + * link: passes through + * rename: passes through + * mkdir: passes through + * rmdir: passes through + * symlink: passes through + * readdir: may be redirected to UFS + * may cause an "internal" open/close + */ + +#define CFS_OPEN_STATS 0 +#define CFS_CLOSE_STATS 1 +#define CFS_RDWR_STATS 2 +#define CFS_IOCTL_STATS 3 +#define CFS_SELECT_STATS 4 +#define CFS_GETATTR_STATS 5 +#define CFS_SETATTR_STATS 6 +#define CFS_ACCESS_STATS 7 +#define CFS_READLINK_STATS 8 +#define CFS_FSYNC_STATS 9 +#define CFS_INACTIVE_STATS 10 +#define CFS_LOOKUP_STATS 11 +#define CFS_CREATE_STATS 12 +#define CFS_REMOVE_STATS 13 +#define CFS_LINK_STATS 14 +#define CFS_RENAME_STATS 15 +#define CFS_MKDIR_STATS 16 +#define CFS_RMDIR_STATS 17 +#define CFS_SYMLINK_STATS 18 +#define CFS_READDIR_STATS 19 +#define CFS_VNODEOPS_SIZE 20 + + +/* + * I propose the following structres: + */ + + +struct cfs_op_stats { + int opcode; /* vfs opcode */ + long entries; /* number of times call attempted */ + long sat_intrn; /* number of times call satisfied by cache */ + long unsat_intrn; /* number of times call failed in cache, but + was not bounced to venus proper. */ + long gen_intrn; /* number of times call generated internally */ + /* (do we need that?) */ +}; + + +/* + * With each call to the minicache, we'll bump the counters whenver + * a call is satisfied internally (through the cache or through a + * redirect), and whenever an operation is caused internally. + * Then, we can add the total operations caught by the minicache + * to the world-wide totals, and leave a caveat for the specific + * graphs later. + */ diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h new file mode 100644 index 000000000..ecd213f8b --- /dev/null +++ b/include/linux/coda_psdev.h @@ -0,0 +1,143 @@ +#ifndef __CODA_PSDEV_H +#define __CODA_PSDEV_H + +#define CODA_PSDEV_MAJOR 67 +#define MAX_CODADEVS 5 /* how many do we allow */ + +extern struct vcomm psdev_vcomm[]; + +#define CODA_SUPER_MAGIC 0x73757245 + +struct coda_sb_info +{ + struct inode * sbi_psdev; /* /dev/cfs? Venus/kernel device */ + struct inode * sbi_ctlcp; /* control magic file */ + int sbi_refct; + struct vcomm * sbi_vcomm; + struct inode * sbi_root; +}; + + +static inline struct coda_sb_info *coda_sbp(struct super_block *sb) +{ + return ((struct coda_sb_info *)((sb)->u.generic_sbp)); +} + + + +extern void coda_psdev_detach(int unit); +extern int init_coda_psdev(void); + +/* to aid procedures make upcalls. They must have a + declaration at the top containing: + struct inputArgs *inp; + struct outputArgs *outp; + int error=0; + int size; +*/ + +#define UPARG(bsize, op)\ +do {\ + CODA_ALLOC(inp, struct inputArgs *, (bsize));\ + outp = (struct outputArgs *) (inp);\ + INIT_IN(inp, (op))\ + coda_load_creds(&(inp->cred));\ + size = (bsize);\ +} while (0) + +/* upcalls */ +int venus_rootfid(struct super_block *sb, ViceFid *fidp); +int venus_getattr(struct super_block *sb, struct ViceFid *fid, + struct coda_vattr *attr); +int venus_setattr(struct super_block *, struct ViceFid *, + struct coda_vattr *); +int venus_lookup(struct super_block *sb, struct ViceFid *fid, + const char *name, int length, int *type, + struct ViceFid *resfid); +int venus_release(struct super_block *sb, struct ViceFid *fid, int flags); +int venus_open(struct super_block *sb, struct ViceFid *fid, + int flags, ino_t *ino, dev_t *dev); +int venus_mkdir(struct super_block *sb, struct ViceFid *dirfid, + const char *name, int length, + struct ViceFid *newfid, struct coda_vattr *attrs); +int venus_create(struct super_block *sb, struct ViceFid *dirfid, + const char *name, int length, int excl, int mode, + struct ViceFid *newfid, struct coda_vattr *attrs) ; +int venus_rmdir(struct super_block *sb, struct ViceFid *dirfid, + const char *name, int length); +int venus_remove(struct super_block *sb, struct ViceFid *dirfid, + const char *name, int length); +int venus_readlink(struct super_block *sb, struct ViceFid *fid, + char *buffer, int *length); +int venus_rename(struct super_block *, struct ViceFid *new_fid, + struct ViceFid *old_fid, size_t old_length, + size_t new_length, const char *old_name, + const char *new_name); +int venus_link(struct super_block *sb, struct ViceFid *fid, + struct ViceFid *dirfid, const char *name, int len ); +int venus_symlink(struct super_block *sb, struct ViceFid *fid, + const char *name, int len, const char *symname, int symlen); +int venus_access(struct super_block *sb, struct ViceFid *fid, int mask); +int venus_pioctl(struct super_block *sb, struct ViceFid *fid, + unsigned int cmd, struct PioctlData *data); +int coda_downcall(int opcode, struct outputArgs *out); +int coda_upcall(struct coda_sb_info *mntinfo, int inSize, + int *outSize, struct inputArgs *buffer); + + +/* messages between coda filesystem in kernel and Venus */ +struct vmsg { + struct queue vm_chain; + caddr_t vm_data; + u_short vm_flags; + u_short vm_inSize; /* Size is at most 5000 bytes */ + u_short vm_outSize; + u_short vm_opcode; /* copied from data to save lookup */ + int vm_unique; + struct wait_queue *vm_sleep; /* process' wait queue */ +}; + +/* communication pending/processing queues queues */ +struct vcomm { + u_long vc_seq; + struct wait_queue *vc_waitq; /* Venus wait queue */ + struct queue vc_pending; + struct queue vc_processing; +}; + +static inline int vcomm_open(struct vcomm *vcp) +{ + return ((vcp)->vc_pending.forw != NULL); +} + +static inline void mark_vcomm_closed(struct vcomm *vcp) +{ + (vcp)->vc_pending.forw = NULL; +} + +/* + * Statistics + */ +struct coda_upcallstats { + int ncalls; /* client requests */ + int nbadcalls; /* upcall failures */ + int reqs[CFS_NCALLS]; /* count of each request */ +} ; + +extern struct coda_upcallstats coda_callstats; + +static inline void clstats(int opcode) +{ + coda_callstats.ncalls++; + if ( (0 <= opcode) && (opcode <= CFS_NCALLS) ) + coda_callstats.reqs[opcode]++; + else + printk("clstats called with bad opcode %d\n", opcode); +} + +static inline void badclstats(void) +{ + coda_callstats.nbadcalls++; +} + +#endif diff --git a/include/linux/coda_sysctl.h b/include/linux/coda_sysctl.h new file mode 100644 index 000000000..add670b35 --- /dev/null +++ b/include/linux/coda_sysctl.h @@ -0,0 +1,10 @@ +/* + * Sysctl operations for Coda. + * Original version: (C) 1996 Peter Braam + * Rewritten for Linux 2.1: (C) 1997 Carnegie Mellon University + * + * Carnegie Mellon encourages users of this code to contribute improvements + * to the Coda project. Contact Peter Braam <coda@cs.cmu.edu>. + */ +void coda_sysctl_init(void); +void coda_sysctl_clean(void); diff --git a/include/linux/dmascc.h b/include/linux/dmascc.h new file mode 100644 index 000000000..01b46df73 --- /dev/null +++ b/include/linux/dmascc.h @@ -0,0 +1,43 @@ +/* + * $Id: dmascc.h,v 1.1 1997/12/01 10:44:55 oe1kib Exp $ + * + * Driver for high-speed SCC boards (those with DMA support) + * Copyright (C) 1997 Klaus Kudielka + * + * 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. + */ + +/* Ioctls */ +#define SIOCGSCCPARAM SIOCDEVPRIVATE +#define SIOCSSCCPARAM (SIOCDEVPRIVATE+1) + +/* Frequency of timer 0 */ +#define TMR_0_HZ 25600 + +/* Configurable parameters */ +struct scc_param { + int pclk_hz; /* frequency of BRG input (read-only - don't change) */ + int brg_tc; /* baud rate generator terminal count - BRG disabled if < 0 */ + int nrzi; /* 0 (nrz), 1 (nrzi) */ + int clocks; /* see documentation */ + int txdelay; /* [1/TMR_0_HZ] */ + int txtime; /* [1/HZ] */ + int sqdelay; /* [1/TMR_0_HZ] */ + int waittime; /* [1/TMR_0_HZ] */ + int slottime; /* [1/TMR_0_HZ] */ + int persist; /* 0 ... 255 */ + int dma; /* 1, 3 */ +}; + diff --git a/include/linux/gscd.h b/include/linux/gscd.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/gscd.h +++ /dev/null diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h new file mode 100644 index 000000000..bef9f8fd9 --- /dev/null +++ b/include/linux/if_tunnel.h @@ -0,0 +1,29 @@ +#ifndef _IF_TUNNEL_H_ +#define _IF_TUNNEL_H_ + +#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) +#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) +#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) +#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) + +#define GRE_CSUM __constant_htons(0x8000) +#define GRE_ROUTING __constant_htons(0x4000) +#define GRE_KEY __constant_htons(0x2000) +#define GRE_SEQ __constant_htons(0x1000) +#define GRE_STRICT __constant_htons(0x0800) +#define GRE_REC __constant_htons(0x0700) +#define GRE_FLAGS __constant_htons(0x00F8) +#define GRE_VERSION __constant_htons(0x0007) + +struct ip_tunnel_parm +{ + char name[IFNAMSIZ]; + int link; + __u16 i_flags; + __u16 o_flags; + __u32 i_key; + __u32 o_key; + struct iphdr iph; +}; + +#endif /* _IF_TUNNEL_H_ */ diff --git a/include/linux/in_route.h b/include/linux/in_route.h new file mode 100644 index 000000000..6eaa7992a --- /dev/null +++ b/include/linux/in_route.h @@ -0,0 +1,31 @@ +#ifndef _LINUX_IN_ROUTE_H +#define _LINUX_IN_ROUTE_H + +/* IPv4 routing cache flags */ + +#define RTCF_DEAD RTNH_F_DEAD +#define RTCF_ONLINK RTNH_F_ONLINK + +#define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC + +#define RTCF_NOTIFY 0x00010000 +#define RTCF_DIRECTDST 0x00020000 +#define RTCF_REDIRECTED 0x00040000 + +#define RTCF_VALVE 0x00200000 +#define RTCF_MASQ 0x00400000 +#define RTCF_SNAT 0x00800000 +#define RTCF_DOREDIRECT 0x01000000 +#define RTCF_LOG 0x02000000 +#define RTCF_DIRECTSRC 0x04000000 +#define RTCF_DNAT 0x08000000 +#define RTCF_BROADCAST 0x10000000 +#define RTCF_MULTICAST 0x20000000 +#define RTCF_REJECT 0x40000000 +#define RTCF_LOCAL 0x80000000 + +#define RTCF_NAT (RTCF_DNAT|RTCF_SNAT) + +#define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) + +#endif /* _LINUX_IN_ROUTE_H */ diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h new file mode 100644 index 000000000..5f84c38de --- /dev/null +++ b/include/linux/inetdevice.h @@ -0,0 +1,118 @@ +#ifndef _LINUX_INETDEVICE_H +#define _LINUX_INETDEVICE_H + +/* IPv4 specific flags. They are initialized from global sysctl variables, + when IPv4 is initialized. + */ + +#define IFF_IP_FORWARD 1 +#define IFF_IP_PROXYARP 2 +#define IFF_IP_RXREDIRECTS 4 +#define IFF_IP_TXREDIRECTS 8 +#define IFF_IP_SHAREDMEDIA 0x10 +#define IFF_IP_MFORWARD 0x20 +#define IFF_IP_RPFILTER 0x40 + +#ifdef __KERNEL__ + +struct in_device +{ + struct device *dev; + struct in_ifaddr *ifa_list; /* IP ifaddr chain */ + struct ip_mc_list *mc_list; /* IP multicast filter chain */ + unsigned long mr_v1_seen; + unsigned flags; +}; + + +#define IN_DEV_RPFILTER(in_dev) (ipv4_config.rfc1812_filter && ((in_dev)->flags&IFF_IP_RPFILTER)) +#define IN_DEV_MFORWARD(in_dev) (ipv4_config.multicast_route && ((in_dev)->flags&IFF_IP_MFORWARD)) +#define IN_DEV_PROXY_ARP(in_dev) ((in_dev)->flags&IFF_IP_PROXYARP) + +#if 1 +#define IN_DEV_FORWARD(in_dev) (IS_ROUTER) +#define IN_DEV_RX_REDIRECTS(in_dev) (ipv4_config.accept_redirects) +#define IN_DEV_TX_REDIRECTS(in_dev) (1) +#define IN_DEV_SHARED_MEDIA(in_dev) (ipv4_config.rfc1620_redirects) +#else +#define IN_DEV_FORWARD(in_dev) (ipv4_config.ip_forwarding==1 && ((in_dev)->flags&IFF_IP_FORWARD)) +#define IN_DEV_RX_REDIRECTS(in_dev) ((in_dev)->flags&IFF_IP_RXREDIRECTS) +#define IN_DEV_TX_REDIRECTS(in_dev) ((in_dev)->flags&IFF_IP_TXREDIRECTS) +#define IN_DEV_SHARED_MEDIA(in_dev) ((in_dev)->flags&IFF_IP_SHAREDMEDIA) +#endif + +struct in_ifaddr +{ + struct in_ifaddr *ifa_next; + struct in_device *ifa_dev; + u32 ifa_local; + u32 ifa_address; + u32 ifa_mask; + u32 ifa_broadcast; + u32 ifa_anycast; + unsigned char ifa_scope; + unsigned char ifa_flags; + unsigned char ifa_prefixlen; + char ifa_label[IFNAMSIZ]; +}; + +extern int register_inetaddr_notifier(struct notifier_block *nb); +extern int unregister_inetaddr_notifier(struct notifier_block *nb); + +extern struct device *ip_dev_find(u32 addr); +extern struct in_ifaddr *inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b); +extern int devinet_ioctl(unsigned int cmd, void *); +extern void devinet_init(void); +extern struct in_device *inetdev_init(struct device *dev); +extern struct in_device *inetdev_by_index(int); +extern u32 inet_select_addr(struct device *dev, u32 dst, int scope); +extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, u32 mask); +extern int inet_add_bootp_addr(struct device *dev); +extern void inet_del_bootp_addr(struct device *dev); + +extern __inline__ int inet_ifa_match(u32 addr, struct in_ifaddr *ifa) +{ + return !((addr^ifa->ifa_address)&ifa->ifa_mask); +} + +/* + * Check if a mask is acceptable. + */ + +extern __inline__ int bad_mask(u32 mask, u32 addr) +{ + if (addr & (mask = ~mask)) + return 1; + mask = ntohl(mask); + if (mask & (mask+1)) + return 1; + return 0; +} + +#define for_primary_ifa(in_dev) { struct in_ifaddr *ifa; \ + for (ifa = (in_dev)->ifa_list; ifa && !(ifa->ifa_flags&IFA_F_SECONDARY); ifa = ifa->ifa_next) + +#define for_ifa(in_dev) { struct in_ifaddr *ifa; \ + for (ifa = (in_dev)->ifa_list; ifa; ifa = ifa->ifa_next) + + +#define endfor_ifa(in_dev) } + +#endif /* __KERNEL__ */ + +extern __inline__ __u32 inet_make_mask(int logmask) +{ + if (logmask) + return htonl(~((1<<(32-logmask))-1)); + return 0; +} + +extern __inline__ int inet_mask_len(__u32 mask) +{ + if (!(mask = ntohl(mask))) + return 0; + return 32 - ffz(~mask); +} + + +#endif /* _LINUX_INETDEVICE_H */ diff --git a/include/linux/isp16.h b/include/linux/isp16.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/isp16.h +++ /dev/null diff --git a/include/linux/mcd.h b/include/linux/mcd.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/mcd.h +++ /dev/null diff --git a/include/linux/mcdx.h b/include/linux/mcdx.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/mcdx.h +++ /dev/null diff --git a/include/linux/net_alias.h b/include/linux/net_alias.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/net_alias.h +++ /dev/null diff --git a/include/linux/optcd.h b/include/linux/optcd.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/optcd.h +++ /dev/null diff --git a/include/linux/pi2.h b/include/linux/pi2.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/pi2.h +++ /dev/null diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h new file mode 100644 index 000000000..b72ca41c1 --- /dev/null +++ b/include/linux/pkt_sched.h @@ -0,0 +1,93 @@ +#ifndef __LINUX_PKT_SCHED_H +#define __LINUX_PKT_SCHED_H + +#define PSCHED_TC_INIT 1 +#define PSCHED_TC_DESTROY 2 +#define PSCHED_TC_ATTACH 3 +#define PSCHED_TC_DETACH 4 + + +/* "Logical" priority bands, not depending of concrete packet scheduler. + Every scheduler will map them to real traffic classes, if it have + no more precise machanism. + */ + +#define TC_PRIO_BESTEFFORT 0 +#define TC_PRIO_FILLER 1 +#define TC_PRIO_BULK 2 +#define TC_PRIO_INTERACTIVE_BULK 4 +#define TC_PRIO_INTERACTIVE 6 +#define TC_PRIO_CONTROL 7 + + +struct pschedctl +{ + int command; + int handle; + int child; + int ifindex; + char id[IFNAMSIZ]; + int arglen; + char args[0]; +}; + +/* CBQ section */ + +#define CBQ_MAXPRIO 8 +#define CBQ_MAXLEVEL 8 + +/* CSZ section */ + +struct cszctl +{ + int flow_id; + int handle; + unsigned long rate; + unsigned long max_bytes; + unsigned long depth; + unsigned long L_tab[256]; +}; + +struct cszinitctl +{ + int flows; + unsigned cell_log; +}; + +/* TBF section */ + +struct tbfctl +{ + unsigned cell_log; + unsigned long bytes; + unsigned long depth; + unsigned long L_tab[256]; +}; + +/* SFQ section */ + +struct sfqctl +{ + unsigned quantum; + unsigned depth; + unsigned divisor; + unsigned flows; +}; + +/* RED section */ + +struct redctl +{ + unsigned qmaxbytes; /* HARD maximal queue length */ + unsigned qth_min; /* Min average length threshold: A scaled */ + unsigned qth_max; /* Max average length threshold: A scaled */ + char Alog; /* Point position in average lengths */ + char Wlog; /* log(W) */ + char Rlog; /* random number bits */ + char C1log; /* log(1/C1) */ + char Slog; + char Stab[256]; +}; + + +#endif diff --git a/include/linux/pt.h b/include/linux/pt.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/pt.h +++ /dev/null diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h new file mode 100644 index 000000000..01f60fb24 --- /dev/null +++ b/include/linux/rtnetlink.h @@ -0,0 +1,555 @@ +#ifndef __LINUX_RTNETLINK_H +#define __LINUX_RTNETLINK_H + +#include <linux/config.h> +#include <linux/netlink.h> + +#define RTNL_DEBUG 1 + + +/**** + * Routing/neighbour discovery messages. + ****/ + +/* Types of messages */ + +#define RTM_BASE 0x10 + +#define RTM_NEWLINK (RTM_BASE+0) +#define RTM_DELLINK (RTM_BASE+1) +#define RTM_GETLINK (RTM_BASE+2) + +#define RTM_NEWADDR (RTM_BASE+4) +#define RTM_DELADDR (RTM_BASE+5) +#define RTM_GETADDR (RTM_BASE+6) + +#define RTM_NEWROUTE (RTM_BASE+8) +#define RTM_DELROUTE (RTM_BASE+9) +#define RTM_GETROUTE (RTM_BASE+10) + +#define RTM_NEWNEIGH (RTM_BASE+12) +#define RTM_DELNEIGH (RTM_BASE+13) +#define RTM_GETNEIGH (RTM_BASE+14) + +#define RTM_NEWRULE (RTM_BASE+16) +#define RTM_DELRULE (RTM_BASE+17) +#define RTM_GETRULE (RTM_BASE+18) + +#define RTM_MAX (RTM_BASE+19) + + +/* Generic structure for encapsulation optional route + information. It is reminiscent of sockaddr, but with sa_family + replaced with attribute type. + It would be good, if constructions of sort: + struct something { + struct rtattr rta; + struct a_content a; + } + had correct alignment. It is true for x86, but I have no idea + how to make it on 64bit architectures. Please, teach me. --ANK + */ + +struct rtattr +{ + unsigned short rta_len; + unsigned short rta_type; +/* + unsigned char rta_data[0]; + */ +}; + +enum rtattr_type_t +{ + RTA_UNSPEC, + RTA_DST, + RTA_SRC, + RTA_IIF, + RTA_OIF, + RTA_GATEWAY, + RTA_PRIORITY, + RTA_PREFSRC, + RTA_WINDOW, + RTA_RTT, + RTA_MTU, + RTA_IFNAME +}; + +#define RTA_MAX RTA_IFNAME + +/* Macros to handle rtattributes */ + +#define RTA_ALIGNTO 4 +#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) +#define RTA_OK(rta,len) ((rta)->rta_len > sizeof(struct rtattr) && \ + (rta)->rta_len <= (len)) +#define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \ + (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len))) +#define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len)) +#define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len)) +#define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0))) + + +/* + * "struct rtnexthop" describres all necessary nexthop information, + * i.e. parameters of path to a destination via this nextop. + * + * At the moment it is impossible to set different prefsrc, mtu, window + * and rtt for different paths from multipath. + */ + +struct rtnexthop +{ + unsigned short rtnh_len; + unsigned char rtnh_flags; + unsigned char rtnh_hops; + int rtnh_ifindex; +/* + struct rtattr rtnh_data[0]; + */ +}; + +/* rtnh_flags */ + +#define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ +#define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ +#define RTNH_F_ONLINK 4 /* Gateway is forced on link */ + +/* Macros to handle hexthops */ + +#define RTNH_ALIGNTO 4 +#define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) ) +#define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \ + (rtnh)->rtnh_len <= (len)) +#define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len))) +#define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len)) +#define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len)) +#define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0))) + + +struct rtmsg +{ + unsigned char rtm_family; + unsigned char rtm_dst_len; + unsigned char rtm_src_len; + unsigned char rtm_tos; + unsigned char rtm_table; /* Routing table id */ + unsigned char rtm_protocol; /* Routing protocol; see below */ + unsigned char rtm_nhs; /* Number of nexthops */ + unsigned char rtm_type; /* See below */ + unsigned short rtm_optlen; /* Byte length of rtm_opt */ + unsigned char rtm_scope; /* See below */ + unsigned char rtm_whatsit; /* Unused byte */ + unsigned rtm_flags; +/* + struct rtattr rtm_opt[0]; + struct rtnexthop rtm_nh[0]; + */ +}; + +#define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)))) +#define RTM_RTNH(r) ((struct rtnexthop*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)) \ + + NLMSG_ALIGN((r)->rtm_optlen))) +#define RTM_NHLEN(nlh,r) ((nlh)->nlmsg_len - NLMSG_SPACE(sizeof(struct rtmsg)) - NLMSG_ALIGN((r)->rtm_optlen)) + +/* rtm_type */ + +enum +{ + RTN_UNSPEC, + RTN_UNICAST, /* Gateway or direct route */ + RTN_LOCAL, /* Accept locally */ + RTN_BROADCAST, /* Accept locally as broadcast, + send as broadcast */ + RTN_ANYCAST, /* Accept locally as broadcast, + but send as unicast */ + RTN_MULTICAST, /* Multicast route */ + RTN_BLACKHOLE, /* Drop */ + RTN_UNREACHABLE, /* Destination is unreachable */ + RTN_PROHIBIT, /* Administratively prohibited */ + RTN_THROW, /* Not in this table */ + RTN_NAT, /* Translate this address */ + RTN_XRESOLVE, /* Use external resolver */ +}; + +#define RTN_MAX RTN_XRESOLVE + +/* rtm_protocol */ + +#define RTPROT_UNSPEC 0 +#define RTPROT_REDIRECT 1 /* Route installed by ICMP redirects; + not used by current IPv4 */ +#define RTPROT_KERNEL 2 /* Route installed by kernel */ +#define RTPROT_BOOT 3 /* Route installed during boot */ +#define RTPROT_STATIC 4 /* Route installed by administrator */ + +/* Values of protocol >= RTPROT_STATIC are not interpreted by kernel; + they just passed from user and back as is. + It will be used by hypothetical multiple routing daemons. + Note that protocol values should be standardized in order to + avoid conflicts. + */ + +#define RTPROT_GATED 8 /* Apparently, GateD */ +#define RTPROT_RA 9 /* RDISC router advertisment */ + + +/* rtm_scope + + Really it is not scope, but sort of distance to the destination. + NOWHERE are reserved for not existing destinations, HOST is our + local addresses, LINK are destinations, locate on directly attached + link and UNIVERSE is everywhere in the Universe :-) + + Intermediate values are also possible f.e. interior routes + could be assigned a value between UNIVERSE and LINK. +*/ + +enum rt_scope_t +{ + RT_SCOPE_UNIVERSE=0, +/* User defined values f.e. "site" */ + RT_SCOPE_LINK=253, + RT_SCOPE_HOST=254, + RT_SCOPE_NOWHERE=255 +}; + +/* rtm_flags */ + +#define RTM_F_NOTIFY 0x100 /* Notify user of route change */ +#define RTM_F_CLONED 0x200 /* This route is cloned */ +#define RTM_F_NOPMTUDISC 0x400 /* Do not make PMTU discovery */ +#define RTM_F_EQUALIZE 0x800 /* Multipath equalizer: NI */ + +/* Reserved table identifiers */ + +enum rt_class_t +{ + RT_TABLE_UNSPEC=0, +/* User defined values */ + RT_TABLE_DEFAULT=253, + RT_TABLE_MAIN=254, + RT_TABLE_LOCAL=255 +}; +#define RT_TABLE_MAX RT_TABLE_LOCAL + + +/********************************************************* + * Interface address. + ****/ + +struct ifaddrmsg +{ + unsigned char ifa_family; + unsigned char ifa_prefixlen; /* The prefix length */ + unsigned char ifa_flags; /* Flags */ + unsigned char ifa_scope; /* See above */ + int ifa_index; /* Link index */ +/* + struct rtattr ifa_data[0]; + */ +}; + +enum +{ + IFA_UNSPEC, + IFA_ADDRESS, + IFA_LOCAL, + IFA_LABEL, + IFA_BROADCAST, + IFA_ANYCAST +}; + +#define IFA_MAX IFA_ANYCAST + +/* ifa_flags */ + +#define IFA_F_SECONDARY 1 + + +#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) + +/* + Important comment: + IFA_ADDRESS is prefix address, rather than local interface address. + It makes no difference for normally configured broadcast interfaces, + but for point-to-point IFA_ADDRESS is DESTINATION address, + local address is supplied in IFA_LOCAL attribute. + */ + +/************************************************************** + * Neighbour discovery. + ****/ + +struct ndmsg +{ + unsigned char nd_family; + int nd_ifindex; /* Link index */ + unsigned nd_flags; +/* + struct rtattr nd_data[0]; + */ +}; + +enum +{ + NDA_UNSPEC, + NDA_DST, + NDA_LLADDR, +}; + +#define NDA_MAX NDA_LLADDR + +#define NDA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg)))) + +/**** + * General form of address family dependent message. + ****/ + +struct rtgenmsg +{ + unsigned char rtgen_family; +}; + +/***************************************************************** + * Link layer specific messages. + ****/ + +/* struct ifinfomsg + * passes link level specific information, not dependent + * on network protocol. + */ + +struct ifinfomsg +{ + unsigned char ifi_family; /* Dummy */ + unsigned char ifi_addrlen; /* Length of HW address */ + unsigned short ifi_pad__; + int ifi_index; /* Link index */ + int ifi_link; /* Physical device */ + char ifi_name[IFNAMSIZ]; + struct sockaddr ifi_address; /* HW address */ + struct sockaddr ifi_broadcast; /* HW broadcast */ + unsigned ifi_flags; /* IFF_* flags */ + int ifi_mtu; /* Link mtu */ + char ifi_qdiscname[IFNAMSIZ];/* Id of packet scheduler */ + int ifi_qdisc; /* Packet scheduler handle */ +}; + +/* ifi_flags. + + IFF_* flags. + + The only change is: + IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are + more not changeable by user. They describe link media + characteristics and set by device driver. + + Comments: + - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid + - If neiher of these three flags are set; + the interface is NBMA. + + - IFF_MULTICAST does not mean anything special: + multicasts can be used on all not-NBMA links. + IFF_MULTICAST means that this media uses special encapsulation + for multicast frames. Apparently, all IFF_POINTOPOINT and + IFF_BROADCAST devices are able to use multicasts too. + */ + +/* ifi_link. + For usual devices it is equal ifi_index. + If it is a "virtual interface" (f.e. tunnel), ifi_link + can point to real physical interface (f.e. for bandwidth calculations), + or maybe 0, what means, that real media is unknown (usual + for IPIP tunnels, when route to endpoint is allowed to change) + */ + +#define RTMGRP_LINK 1 +#define RTMGRP_NOTIFY 2 + +#define RTMGRP_IPV4_IFADDR 0x10 +#define RTMGRP_IPV4_NDISC 0x20 +#define RTMGRP_IPV4_ROUTE 0x40 +#define RTMGRP_IPV4_MROUTE 0x80 + +#define RTMGRP_IPV6_IFADDR 0x100 +#define RTMGRP_IPV6_NDISC 0x200 +#define RTMGRP_IPV6_ROUTE 0x400 +#define RTMGRP_IPV6_MROUTE 0x800 + + +#ifdef __KERNEL__ + +struct kern_rta +{ + void *rta_dst; + void *rta_src; + int *rta_iif; + int *rta_oif; + void *rta_gw; + u32 *rta_priority; + void *rta_prefsrc; + unsigned *rta_window; + unsigned *rta_rtt; + unsigned *rta_mtu; + unsigned char *rta_ifname; +}; + +struct kern_ifa +{ + void *ifa_address; + void *ifa_local; + unsigned char *ifa_label; + void *ifa_broadcast; + void *ifa_anycast; +}; + + +extern atomic_t rtnl_rlockct; +extern struct wait_queue *rtnl_wait; + +#ifdef CONFIG_RTNETLINK +extern struct sock *rtnl; + +struct rtnetlink_link +{ + int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr); + int (*dumpit)(struct sk_buff *, struct netlink_callback *cb); +}; + +extern struct rtnetlink_link * rtnetlink_links[NPROTO]; +extern int rtnetlink_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb); + + +extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data); + +#define RTA_PUT(skb, attrtype, attrlen, data) \ +({ if (skb_tailroom(skb) < RTA_SPACE(attrlen)) goto rtattr_failure; \ + __rta_fill(skb, attrtype, attrlen, data); }) + +extern unsigned long rtnl_wlockct; + +/* NOTE: these locks are not interrupt safe, are not SMP safe, + * they are even not atomic. 8)8)8) ... and it is not a bug. + * Really, if these locks will be programmed correctly, + * all the addressing/routing machine would become SMP safe, + * but is absolutely useless at the moment, because all the kernel + * is not reenterable in any case. --ANK + * + * Well, atomic_* and set_bit provide the only thing here: + * gcc is confused not to overoptimize them, that's all. + * I remember as gcc splitted ++ operation, but cannot reproduce + * it with gcc-2.7.*. --ANK + * + * One more note: rwlock facility should be written and put + * to a kernel wide location: f.e. current implementation of semaphores + * (especially, for x86) looks like a wonder. It would be good + * to have something similar for rwlock. Recursive lock could be also + * useful thing. --ANK + */ + +extern __inline__ int rtnl_shlock_nowait(void) +{ + atomic_inc(&rtnl_rlockct); + if (test_bit(0, &rtnl_wlockct)) { + atomic_dec(&rtnl_rlockct); + return -EAGAIN; + } + return 0; +} + +extern __inline__ void rtnl_shlock(void) +{ + while (rtnl_shlock_nowait()) + sleep_on(&rtnl_wait); +} + +/* Check for possibility to PROMOTE shared lock to exclusive. + Shared lock must be already grabbed with rtnl_shlock*(). + */ + +extern __inline__ int rtnl_exlock_nowait(void) +{ + if (atomic_read(&rtnl_rlockct) > 1) + return -EAGAIN; + if (test_and_set_bit(0, &rtnl_wlockct)) + return -EAGAIN; + return 0; +} + +extern __inline__ void rtnl_exlock(void) +{ + while (rtnl_exlock_nowait()) + sleep_on(&rtnl_wait); +} + +#if 0 +extern __inline__ void rtnl_shunlock(void) +{ + atomic_dec(&rtnl_rlockct); + if (atomic_read(&rtnl_rlockct) <= 1) { + wake_up(&rtnl_wait); + if (rtnl->receive_queue.qlen) + rtnl->data_ready(rtnl, 0); + } +} +#else + +/* The problem: inline requires to include <net/sock.h> and, hence, + almost all of net includes :-( + */ + +#define rtnl_shunlock() ({ \ + atomic_dec(&rtnl_rlockct); \ + if (atomic_read(&rtnl_rlockct) <= 1) { \ + wake_up(&rtnl_wait); \ + if (rtnl->receive_queue.qlen) \ + rtnl->data_ready(rtnl, 0); \ + } \ +}) +#endif + +/* Release exclusive lock. Note, that we do not wake up rtnetlink socket, + * it will be done later after releasing shared lock. + */ + +extern __inline__ void rtnl_exunlock(void) +{ + clear_bit(0, &rtnl_wlockct); + wake_up(&rtnl_wait); +} + +#else + +extern __inline__ void rtnl_shlock(void) +{ + while (atomic_read(&rtnl_rlockct)) + sleep_on(&rtnl_wait); + atomic_inc(&rtnl_rlockct); +} + +extern __inline__ void rtnl_shunlock(void) +{ + if (atomic_dec_and_test(&rtnl_rlockct)) + wake_up(&rtnl_wait); +} + +extern __inline__ void rtnl_exlock(void) +{ +} + +extern __inline__ void rtnl_exunlock(void) +{ +} + +#endif + +extern void rtnl_lock(void); +extern void rtnl_unlock(void); +extern void rtnetlink_init(void); + +#endif /* __KERNEL__ */ + + +#endif /* __LINUX_RTNETLINK_H */ diff --git a/include/linux/sbpcd.h b/include/linux/sbpcd.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/sbpcd.h +++ /dev/null diff --git a/include/linux/sjcd.h b/include/linux/sjcd.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/sjcd.h +++ /dev/null diff --git a/include/linux/sonycd535.h b/include/linux/sonycd535.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/sonycd535.h +++ /dev/null diff --git a/include/linux/ucdrom.h b/include/linux/ucdrom.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/linux/ucdrom.h +++ /dev/null diff --git a/include/net/gc.h b/include/net/gc.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/net/gc.h +++ /dev/null diff --git a/include/net/ip_alias.h b/include/net/ip_alias.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/net/ip_alias.h +++ /dev/null diff --git a/include/net/ipconfig.h b/include/net/ipconfig.h new file mode 100644 index 000000000..db64243a6 --- /dev/null +++ b/include/net/ipconfig.h @@ -0,0 +1,19 @@ +/* + * $Id: ipconfig.h,v 1.2 1997/10/17 12:41:16 mj Exp $ + * + * Copyright (C) 1997 Martin Mares + * + * Automatic IP Layer Configuration + */ + +extern __u32 root_server_addr; +extern u8 root_server_path[]; +extern u32 ic_myaddr; +extern u32 ic_servaddr; +extern u32 ic_gateway; +extern u32 ic_netmask; +extern int ic_bootp_flag; +extern int ic_rarp_flag; +extern int ic_enable; +extern int ic_host_name_set; +extern int ic_set_manually; diff --git a/include/net/netlink.h b/include/net/netlink.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/net/netlink.h +++ /dev/null diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h new file mode 100644 index 000000000..b83c1048b --- /dev/null +++ b/include/net/pkt_sched.h @@ -0,0 +1,164 @@ +#ifndef __NET_PKT_SCHED_H +#define __NET_PKT_SCHED_H + +#include <linux/pkt_sched.h> + +struct Qdisc_ops +{ + struct Qdisc_ops *next; + char id[IFNAMSIZ]; + int refcnt; + int priv_size; + int (*enqueue)(struct sk_buff *skb, struct Qdisc *); + struct sk_buff * (*dequeue)(struct Qdisc *); + void (*reset)(struct Qdisc *); + void (*destroy)(struct Qdisc *); + int (*init)(struct Qdisc *, void *arg); + int (*control)(struct Qdisc *, void *); +}; + +struct Qdisc_head +{ + struct Qdisc_head *forw; +}; + +extern struct Qdisc_head qdisc_head; + +struct Qdisc +{ + struct Qdisc_head h; + int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev); + struct sk_buff * (*dequeue)(struct Qdisc *dev); + struct Qdisc_ops *ops; + int handle; + struct Qdisc *parent; + struct sk_buff_head q; + struct device *dev; + struct sk_buff_head failure_q; + unsigned long dropped; + unsigned long tx_last; + unsigned long tx_timeo; + + char data[0]; +}; + + +/* Yes, it is slow for [34]86, but we have no choice. + 10 msec resolution is appropriate only for bandwidth < 32Kbit/sec. + + RULE: + Timer resolution MUST BE < 10% of min_schedulable_packet_size/bandwidth + + Normal IP packet size ~ 512byte, hence: + + 0.5Kbyte/1Mbyte/sec = 0.5msec, so that we need 50usec timer for + 10Mbit ethernet. + + 10msec resolution -> <50Kbit/sec. + + The result: [34]86 is not good choice for QoS router :-( + */ + + +typedef struct timeval psched_time_t; + +/* On 64bit architecures it would be clever to define: +typedef u64 psched_time_t; + and make all this boring arithmetics directly + */ + +#ifndef SCHEDULE_ONLY_LOW_BANDWIDTH +#define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp)) +#else +#define PSCHED_GET_TIME(stamp) ((stamp) = xtime) +#endif + +#define PSCHED_TDIFF(tv1, tv2) \ +({ \ + int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \ + int __delta = (tv1).tv_usec - (tv2).tv_usec; \ + if (__delta_sec) { \ + switch (__delta_sec) { \ + default: \ + __delta = 0; \ + case 2: \ + __delta += 1000000; \ + case 1: \ + __delta += 1000000; \ + } \ + } \ + __delta; \ +}) + +#define PSCHED_TDIFF_SAFE(tv1, tv2, bound, guard) \ +({ \ + int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \ + int __delta = (tv1).tv_usec - (tv2).tv_usec; \ + switch (__delta_sec) { \ + default: \ + __delta = (bound); guard; break; \ + case 2: \ + __delta += 1000000; \ + case 1: \ + __delta += 1000000; \ + case 0: ; \ + } \ + __delta; \ +}) + +#define PSCHED_US2JIFFIE(usecs) (((usecs)+(1000000/HZ-1))/(1000000/HZ)) + +#define PSCHED_TLESS(tv1, tv2) (((tv1).tv_usec < (tv2).tv_usec && \ + (tv1).tv_sec < (tv2).tv_sec) || \ + (tv1).tv_sec < (tv2).tv_sec) + +#define PSCHED_TADD2(tv, delta, tv_res) \ +({ \ + int __delta = (tv).tv_usec + (delta); \ + (tv_res).tv_sec = (tv).tv_sec; \ + if (__delta > 1000000) { (tv_res).tv_sec++; __delta -= 1000000; } \ + (tv_res).tv_sec = __delta; \ +}) + +#define PSCHED_TADD(tv, delta) \ +({ \ + (tv).tv_usec += (delta); \ + if ((tv).tv_usec > 1000000) { (tv).tv_sec++; \ + (tv).tv_usec -= 1000000; } \ +}) + +/* Set/check that undertime is in the "past perfect"; + it depends on concrete representation of system time + */ + +#define PSCHED_SET_PASTPERFECT(t) ((t).tv_sec = 0) +#define PSCHED_IS_PASTPERFECT(t) ((t).tv_sec == 0) + + +extern struct Qdisc noop_qdisc; + +int register_qdisc(struct Qdisc_ops *qops); +int unregister_qdisc(struct Qdisc_ops *qops); +void dev_init_scheduler(struct device *dev); +void dev_shutdown(struct device *dev); +void dev_activate(struct device *dev); +void dev_deactivate(struct device *dev); +void qdisc_reset(struct Qdisc *qdisc); +void qdisc_destroy(struct Qdisc *qdisc); +int pktsched_init(void); + +void qdisc_run_queues(void); +int qdisc_restart(struct device *dev); + +extern __inline__ void qdisc_wakeup(struct device *dev) +{ + if (!dev->tbusy) { + struct Qdisc *q = dev->qdisc; + if (qdisc_restart(dev) && q->h.forw == NULL) { + q->h.forw = qdisc_head.forw; + qdisc_head.forw = &q->h; + } + } +} + +#endif diff --git a/include/net/sit.h b/include/net/sit.h deleted file mode 100644 index e69de29bb..000000000 --- a/include/net/sit.h +++ /dev/null |