diff options
| author | David S. Miller <davem@nuts.ninka.net> | 2002-10-15 07:41:35 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2002-10-15 07:41:35 -0700 |
| commit | 8fbfe7cd5594010a23cb4e81786d1fb8015ffdee (patch) | |
| tree | b5be190f22984395209823ec3cac1c76fc93f67f /include | |
| parent | e22f7f5fd43205bfd20ea3a7bb4e689cb3f3d278 (diff) | |
| parent | 5a7728c6d3eb83df9d120944cca4cf476dd326a1 (diff) | |
Merge nuts.ninka.net:/home/davem/src/BK/network-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
Diffstat (limited to 'include')
53 files changed, 1858 insertions, 337 deletions
diff --git a/include/asm-i386/apicdef.h b/include/asm-i386/apicdef.h index a91e6ede6b0a..4aac5f72e9ed 100644 --- a/include/asm-i386/apicdef.h +++ b/include/asm-i386/apicdef.h @@ -32,6 +32,8 @@ #define SET_APIC_LOGICAL_ID(x) (((x)<<24)) #define APIC_ALL_CPUS 0xFF #define APIC_DFR 0xE0 +#define APIC_DFR_CLUSTER 0x0FFFFFFFul +#define APIC_DFR_FLAT 0xFFFFFFFFul #define APIC_SPIV 0xF0 #define APIC_SPIV_FOCUS_DISABLED (1<<9) #define APIC_SPIV_APIC_ENABLED (1<<8) @@ -108,7 +110,11 @@ #define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) -#define MAX_IO_APICS 8 +#ifdef CONFIG_X86_NUMA + #define MAX_IO_APICS 32 +#else + #define MAX_IO_APICS 8 +#endif /* * the local APIC register structure, memory mapped. Not terribly well diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h index f23f4f75ce65..1a60daa9172e 100644 --- a/include/asm-i386/hw_irq.h +++ b/include/asm-i386/hw_irq.h @@ -13,6 +13,7 @@ */ #include <linux/config.h> +#include <linux/profile.h> #include <asm/atomic.h> #include <asm/irq.h> @@ -65,20 +66,31 @@ extern char _stext, _etext; #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs)) -extern unsigned long prof_cpu_mask; -extern unsigned int * prof_buffer; -extern unsigned long prof_len; -extern unsigned long prof_shift; - /* - * x86 profiling function, SMP safe. We might want to do this in - * assembly totally? + * The profiling function is SMP safe. (nothing can mess + * around with "current", and the profiling counters are + * updated with atomic operations). This is especially + * useful with a profiling multiplier != 1 */ -static inline void x86_do_profile (unsigned long eip) +static inline void x86_do_profile(struct pt_regs * regs) { + unsigned long eip; + extern unsigned long prof_cpu_mask; + extern char _stext; +#ifdef CONFIG_PROFILING + extern void x86_profile_hook(struct pt_regs *); + + x86_profile_hook(regs); +#endif + + if (user_mode(regs)) + return; + if (!prof_buffer) return; + eip = regs->eip; + /* * Only measure the CPUs specified by /proc/irq/prof_cpu_mask. * (default is all CPUs.) @@ -97,7 +109,28 @@ static inline void x86_do_profile (unsigned long eip) eip = prof_len-1; atomic_inc((atomic_t *)&prof_buffer[eip]); } + +struct notifier_block; + +#ifdef CONFIG_PROFILING + +int register_profile_notifier(struct notifier_block * nb); +int unregister_profile_notifier(struct notifier_block * nb); + +#else + +static inline int register_profile_notifier(struct notifier_block * nb) +{ + return -ENOSYS; +} + +static inline int unregister_profile_notifier(struct notifier_block * nb) +{ + return -ENOSYS; +} +#endif /* CONFIG_PROFILING */ + #ifdef CONFIG_SMP /*more of this file should probably be ifdefed SMP */ static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) { if (IO_APIC_IRQ(i)) diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h index f2a73c118d33..6fee20b0ef9f 100644 --- a/include/asm-i386/mpspec.h +++ b/include/asm-i386/mpspec.h @@ -16,11 +16,11 @@ /* * a maximum of 16 APICs with the current APIC ID architecture. */ -#ifdef CONFIG_X86_NUMAQ +#ifdef CONFIG_X86_NUMA #define MAX_APICS 256 -#else /* !CONFIG_X86_NUMAQ */ +#else /* !CONFIG_X86_NUMA */ #define MAX_APICS 16 -#endif /* CONFIG_X86_NUMAQ */ +#endif /* CONFIG_X86_NUMA */ #define MAX_MPC_ENTRY 1024 diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h index b1b5ae1ce148..8eefc078d95e 100644 --- a/include/asm-i386/msr.h +++ b/include/asm-i386/msr.h @@ -99,7 +99,13 @@ #define MSR_K6_PFIR 0xC0000088 #define MSR_K7_EVNTSEL0 0xC0010000 +#define MSR_K7_EVNTSEL1 0xC0010001 +#define MSR_K7_EVNTSEL2 0xC0010002 +#define MSR_K7_EVNTSEL3 0xC0010003 #define MSR_K7_PERFCTR0 0xC0010004 +#define MSR_K7_PERFCTR1 0xC0010005 +#define MSR_K7_PERFCTR2 0xC0010006 +#define MSR_K7_PERFCTR3 0xC0010007 #define MSR_K7_HWCR 0xC0010015 #define MSR_K7_FID_VID_CTL 0xC0010041 #define MSR_K7_VID_STATUS 0xC0010042 diff --git a/include/asm-i386/nmi.h b/include/asm-i386/nmi.h new file mode 100644 index 000000000000..d20f0fb9ad2b --- /dev/null +++ b/include/asm-i386/nmi.h @@ -0,0 +1,49 @@ +/* + * linux/include/asm-i386/nmi.h + */ +#ifndef ASM_NMI_H +#define ASM_NMI_H + +#include <linux/pm.h> + +struct pt_regs; + +typedef int (*nmi_callback_t)(struct pt_regs * regs, int cpu); + +/** + * set_nmi_callback + * + * Set a handler for an NMI. Only one handler may be + * set. Return 1 if the NMI was handled. + */ +void set_nmi_callback(nmi_callback_t callback); + +/** + * unset_nmi_callback + * + * Remove the handler previously set. + */ +void unset_nmi_callback(void); + +#ifdef CONFIG_PM + +/** Replace the PM callback routine for NMI. */ +struct pm_dev * set_nmi_pm_callback(pm_callback callback); + +/** Unset the PM callback routine back to the default. */ +void unset_nmi_pm_callback(struct pm_dev * dev); + +#else + +static inline struct pm_dev * set_nmi_pm_callback(pm_callback callback) +{ + return 0; +} + +static inline void unset_nmi_pm_callback(struct pm_dev * dev) +{ +} + +#endif /* CONFIG_PM */ + +#endif /* ASM_NMI_H */ diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index 71a71d011842..6df7592b84f5 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h @@ -21,17 +21,10 @@ #endif #endif -#ifdef CONFIG_SMP -# ifdef CONFIG_CLUSTERED_APIC -# define TARGET_CPUS 0xf /* all CPUs in *THIS* quad */ -# define INT_DELIVERY_MODE 0 /* physical delivery on LOCAL quad */ -# else -# define TARGET_CPUS cpu_online_map -# define INT_DELIVERY_MODE 1 /* logical delivery broadcast to all procs */ -# endif +#ifdef CONFIG_CLUSTERED_APIC + #define INT_DELIVERY_MODE 0 /* physical delivery on LOCAL quad */ #else -# define INT_DELIVERY_MODE 1 /* logical delivery */ -# define TARGET_CPUS 0x01 + #define INT_DELIVERY_MODE 1 /* logical delivery broadcast to all procs */ #endif #ifndef clustered_apic_mode @@ -72,6 +65,7 @@ extern void zap_low_mappings (void); * the real APIC ID <-> CPU # mapping. */ #define MAX_APICID 256 +#define BAD_APICID 0xFFu extern volatile int cpu_to_physical_apicid[NR_CPUS]; extern volatile int physical_apicid_to_cpu[MAX_APICID]; extern volatile int cpu_to_logical_apicid[NR_CPUS]; diff --git a/include/asm-i386/smpboot.h b/include/asm-i386/smpboot.h index 6a77a1663ca9..a3840aa6eca8 100644 --- a/include/asm-i386/smpboot.h +++ b/include/asm-i386/smpboot.h @@ -24,15 +24,6 @@ #endif /* CONFIG_CLUSTERED_APIC */ /* - * How to map from the cpu_present_map - */ -#ifdef CONFIG_CLUSTERED_APIC - #define cpu_present_to_apicid(mps_cpu) ( ((mps_cpu/4)*16) + (1<<(mps_cpu%4)) ) -#else /* !CONFIG_CLUSTERED_APIC */ - #define cpu_present_to_apicid(apicid) (apicid) -#endif /* CONFIG_CLUSTERED_APIC */ - -/* * Mappings between logical cpu number and logical / physical apicid * The first four macros are trivial, but it keeps the abstraction consistent */ diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 8765a0f82aff..159dfa7fefe1 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -257,6 +257,8 @@ #define __NR_alloc_hugepages 250 #define __NR_free_hugepages 251 #define __NR_exit_group 252 +#define __NR_lookup_dcookie 253 + /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */ diff --git a/include/asm-sparc64/checksum.h b/include/asm-sparc64/checksum.h index 6cfa55be0f09..a7d31c896881 100644 --- a/include/asm-sparc64/checksum.h +++ b/include/asm-sparc64/checksum.h @@ -78,45 +78,8 @@ csum_and_copy_to_user(const char *src, char *dst, int len, /* ihl is always 5 or greater, almost always is 5, and iph is word aligned * the majority of the time. */ -static __inline__ unsigned short ip_fast_csum(__const__ unsigned char *iph, - unsigned int ihl) -{ - unsigned short sum; - - /* Note: We must read %2 before we touch %0 for the first time, - * because GCC can legitimately use the same register for - * both operands. - */ - __asm__ __volatile__( -" sub %2, 4, %%g7 ! IEU0\n" -" lduw [%1 + 0x00], %0 ! Load Group\n" -" lduw [%1 + 0x04], %%g2 ! Load Group\n" -" lduw [%1 + 0x08], %%g3 ! Load Group\n" -" addcc %%g2, %0, %0 ! IEU1 1 Load Bubble + Group\n" -" lduw [%1 + 0x0c], %%g2 ! Load\n" -" addccc %%g3, %0, %0 ! Sngle Group no Bubble\n" -" lduw [%1 + 0x10], %%g3 ! Load Group\n" -" addccc %%g2, %0, %0 ! Sngle Group no Bubble\n" -" addc %0, %%g0, %0 ! Sngle Group\n" -"1: addcc %%g3, %0, %0 ! IEU1 Group no Bubble\n" -" add %1, 4, %1 ! IEU0\n" -" addccc %0, %%g0, %0 ! Sngle Group no Bubble\n" -" subcc %%g7, 1, %%g7 ! IEU1 Group\n" -" be,a,pt %%icc, 2f ! CTI\n" -" sll %0, 16, %%g2 ! IEU0\n" -" lduw [%1 + 0x10], %%g3 ! Load Group\n" -" ba,pt %%xcc, 1b ! CTI\n" -" nop ! IEU0\n" -"2: addcc %0, %%g2, %%g2 ! IEU1 Group\n" -" srl %%g2, 16, %0 ! IEU0 Group regdep XXX Scheisse!\n" -" addc %0, %%g0, %0 ! Sngle Group\n" -" xnor %%g0, %0, %0 ! IEU0 Group\n" -" srl %0, 0, %0 ! IEU0 Group XXX Scheisse!\n" - : "=r" (sum), "=&r" (iph) - : "r" (ihl), "1" (iph) - : "g2", "g3", "g7", "cc"); - return sum; -} +extern unsigned short ip_fast_csum(__const__ unsigned char *iph, + unsigned int ihl); /* Fold a partial checksum without adding pseudo headers. */ static __inline__ unsigned short csum_fold(unsigned int sum) diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h index a56c528e9af4..397744bb33d7 100644 --- a/include/asm-sparc64/irq.h +++ b/include/asm-sparc64/irq.h @@ -93,7 +93,7 @@ extern unsigned char dma_sync_reg_table_entry; #define IBF_MULTI 0x08 /* On PCI, indicates shared bucket. */ #define IBF_INPROGRESS 0x10 /* IRQ is being serviced. */ -#define NUM_IVECS 8192 +#define NUM_IVECS (IMAP_INR + 1) extern struct ino_bucket ivector_table[NUM_IVECS]; #define __irq_ino(irq) \ diff --git a/include/asm-sparc64/semaphore.h b/include/asm-sparc64/semaphore.h index 2aaa3160115e..7419dd88b49e 100644 --- a/include/asm-sparc64/semaphore.h +++ b/include/asm-sparc64/semaphore.h @@ -47,184 +47,10 @@ static inline void init_MUTEX_LOCKED (struct semaphore *sem) sema_init(sem, 0); } -extern void __down(struct semaphore * sem); -extern int __down_interruptible(struct semaphore * sem); -extern void __up(struct semaphore * sem); - -static __inline__ void down(struct semaphore * sem) -{ - /* This atomically does: - * old_val = sem->count; - * new_val = sem->count - 1; - * sem->count = new_val; - * if (old_val < 1) - * __down(sem); - * - * The (old_val < 1) test is equivalent to - * the more straightforward (new_val < 0), - * but it is easier to test the former because - * of how the CAS instruction works. - */ - - __asm__ __volatile__("\n" -" ! down sem(%0)\n" -"1: lduw [%0], %%g5\n" -" sub %%g5, 1, %%g7\n" -" cas [%0], %%g5, %%g7\n" -" cmp %%g5, %%g7\n" -" bne,pn %%icc, 1b\n" -" cmp %%g7, 1\n" -" bl,pn %%icc, 3f\n" -" membar #StoreLoad | #StoreStore\n" -"2:\n" -" .subsection 2\n" -"3: mov %0, %%g5\n" -" save %%sp, -160, %%sp\n" -" mov %%g1, %%l1\n" -" mov %%g2, %%l2\n" -" mov %%g3, %%l3\n" -" call %1\n" -" mov %%g5, %%o0\n" -" mov %%l1, %%g1\n" -" mov %%l2, %%g2\n" -" ba,pt %%xcc, 2b\n" -" restore %%l3, %%g0, %%g3\n" -" .previous\n" - : : "r" (sem), "i" (__down) - : "g5", "g7", "memory", "cc"); -} - -static __inline__ int down_interruptible(struct semaphore *sem) -{ - int ret = 0; - - /* This atomically does: - * old_val = sem->count; - * new_val = sem->count - 1; - * sem->count = new_val; - * if (old_val < 1) - * ret = __down_interruptible(sem); - * - * The (old_val < 1) test is equivalent to - * the more straightforward (new_val < 0), - * but it is easier to test the former because - * of how the CAS instruction works. - */ - - __asm__ __volatile__("\n" -" ! down_interruptible sem(%2) ret(%0)\n" -"1: lduw [%2], %%g5\n" -" sub %%g5, 1, %%g7\n" -" cas [%2], %%g5, %%g7\n" -" cmp %%g5, %%g7\n" -" bne,pn %%icc, 1b\n" -" cmp %%g7, 1\n" -" bl,pn %%icc, 3f\n" -" membar #StoreLoad | #StoreStore\n" -"2:\n" -" .subsection 2\n" -"3: mov %2, %%g5\n" -" save %%sp, -160, %%sp\n" -" mov %%g1, %%l1\n" -" mov %%g2, %%l2\n" -" mov %%g3, %%l3\n" -" call %3\n" -" mov %%g5, %%o0\n" -" mov %%l1, %%g1\n" -" mov %%l2, %%g2\n" -" mov %%l3, %%g3\n" -" ba,pt %%xcc, 2b\n" -" restore %%o0, %%g0, %0\n" -" .previous\n" - : "=r" (ret) - : "0" (ret), "r" (sem), "i" (__down_interruptible) - : "g5", "g7", "memory", "cc"); - return ret; -} - -static __inline__ int down_trylock(struct semaphore *sem) -{ - int ret; - - /* This atomically does: - * old_val = sem->count; - * new_val = sem->count - 1; - * if (old_val < 1) { - * ret = 1; - * } else { - * sem->count = new_val; - * ret = 0; - * } - * - * The (old_val < 1) test is equivalent to - * the more straightforward (new_val < 0), - * but it is easier to test the former because - * of how the CAS instruction works. - */ - - __asm__ __volatile__("\n" -" ! down_trylock sem(%1) ret(%0)\n" -"1: lduw [%1], %%g5\n" -" sub %%g5, 1, %%g7\n" -" cmp %%g5, 1\n" -" bl,pn %%icc, 2f\n" -" mov 1, %0\n" -" cas [%1], %%g5, %%g7\n" -" cmp %%g5, %%g7\n" -" bne,pn %%icc, 1b\n" -" mov 0, %0\n" -" membar #StoreLoad | #StoreStore\n" -"2:\n" - : "=&r" (ret) - : "r" (sem) - : "g5", "g7", "memory", "cc"); - - return ret; -} - -static __inline__ void up(struct semaphore * sem) -{ - /* This atomically does: - * old_val = sem->count; - * new_val = sem->count + 1; - * sem->count = new_val; - * if (old_val < 0) - * __up(sem); - * - * The (old_val < 0) test is equivalent to - * the more straightforward (new_val <= 0), - * but it is easier to test the former because - * of how the CAS instruction works. - */ - - __asm__ __volatile__("\n" -" ! up sem(%0)\n" -" membar #StoreLoad | #LoadLoad\n" -"1: lduw [%0], %%g5\n" -" add %%g5, 1, %%g7\n" -" cas [%0], %%g5, %%g7\n" -" cmp %%g5, %%g7\n" -" bne,pn %%icc, 1b\n" -" addcc %%g7, 1, %%g0\n" -" ble,pn %%icc, 3f\n" -" membar #StoreLoad | #StoreStore\n" -"2:\n" -" .subsection 2\n" -"3: mov %0, %%g5\n" -" save %%sp, -160, %%sp\n" -" mov %%g1, %%l1\n" -" mov %%g2, %%l2\n" -" mov %%g3, %%l3\n" -" call %1\n" -" mov %%g5, %%o0\n" -" mov %%l1, %%g1\n" -" mov %%l2, %%g2\n" -" ba,pt %%xcc, 2b\n" -" restore %%l3, %%g0, %%g3\n" -" .previous\n" - : : "r" (sem), "i" (__up) - : "g5", "g7", "memory", "cc"); -} +extern void up(struct semaphore *sem); +extern void down(struct semaphore *sem); +extern int down_trylock(struct semaphore *sem); +extern int down_interruptible(struct semaphore *sem); #endif /* __KERNEL__ */ diff --git a/include/asm-um/cache.h b/include/asm-um/cache.h index a4962992cf86..4b134fe8504e 100644 --- a/include/asm-um/cache.h +++ b/include/asm-um/cache.h @@ -1,7 +1,10 @@ #ifndef __UM_CACHE_H #define __UM_CACHE_H +/* These are x86 numbers */ #define L1_CACHE_SHIFT 5 #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) +#define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */ + #endif diff --git a/include/asm-um/smp.h b/include/asm-um/smp.h index 931b1f956f17..a991b9feea3f 100644 --- a/include/asm-um/smp.h +++ b/include/asm-um/smp.h @@ -6,15 +6,30 @@ extern unsigned long cpu_online_map; #ifdef CONFIG_SMP #include "linux/config.h" +#include "linux/bitops.h" #include "asm/current.h" -#define smp_processor_id() (current->processor) +#define smp_processor_id() (current->thread_info->cpu) #define cpu_logical_map(n) (n) #define cpu_number_map(n) (n) #define PROC_CHANGE_PENALTY 15 /* Pick a number, any number */ extern int hard_smp_processor_id(void); #define NO_PROC_ID -1 +#define cpu_online(cpu) (cpu_online_map & (1<<(cpu))) + +extern int ncpus; +#define cpu_possible(cpu) (cpu < ncpus) + +extern inline unsigned int num_online_cpus(void) +{ + return(hweight32(cpu_online_map)); +} + +extern inline void smp_cpus_done(unsigned int maxcpus) +{ +} + #endif #endif diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h index 494e367f4ff9..1cb0f45359f5 100644 --- a/include/asm-um/thread_info.h +++ b/include/asm-um/thread_info.h @@ -64,10 +64,14 @@ static inline struct thread_info *current_thread_info(void) #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ #define TIF_SIGPENDING 1 /* signal pending */ #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ +#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling + * TIF_NEED_RESCHED + */ #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) +#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) #endif diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4929d743683d..ccb56d58de6a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -34,6 +34,7 @@ struct request { int rq_status; /* should split this into a few status bits */ kdev_t rq_dev; + struct gendisk *rq_disk; int errors; sector_t sector; unsigned long nr_sectors; @@ -60,6 +61,12 @@ struct request { int tag; void *special; char *buffer; + + /* For packet commands */ + unsigned int data_len; + void *data, *sense; + + unsigned int timeout; struct completion *waiting; struct bio *bio, *biotail; request_queue_t *q; @@ -85,6 +92,8 @@ enum rq_flag_bits { __REQ_BLOCK_PC, /* queued down pc from block layer */ __REQ_SENSE, /* sense retrival */ + __REQ_FAILED, /* set if the request failed */ + __REQ_QUIET, /* don't worry about errors */ __REQ_SPECIAL, /* driver suplied command */ __REQ_DRIVE_CMD, __REQ_DRIVE_TASK, @@ -103,6 +112,8 @@ enum rq_flag_bits { #define REQ_PC (1 << __REQ_PC) #define REQ_BLOCK_PC (1 << __REQ_BLOCK_PC) #define REQ_SENSE (1 << __REQ_SENSE) +#define REQ_FAILED (1 << __REQ_FAILED) +#define REQ_QUIET (1 << __REQ_QUIET) #define REQ_SPECIAL (1 << __REQ_SPECIAL) #define REQ_DRIVE_CMD (1 << __REQ_DRIVE_CMD) #define REQ_DRIVE_TASK (1 << __REQ_DRIVE_TASK) @@ -301,7 +312,7 @@ extern int blk_remove_plug(request_queue_t *); extern void blk_recount_segments(request_queue_t *, struct bio *); extern inline int blk_phys_contig_segment(request_queue_t *q, struct bio *, struct bio *); extern inline int blk_hw_contig_segment(request_queue_t *q, struct bio *, struct bio *); -extern int block_ioctl(struct block_device *, unsigned int, unsigned long); +extern int scsi_cmd_ioctl(struct block_device *, unsigned int, unsigned long); extern void blk_start_queue(request_queue_t *q); extern void blk_stop_queue(request_queue_t *q); extern void __blk_stop_queue(request_queue_t *q); diff --git a/include/linux/blkpg.h b/include/linux/blkpg.h index 3cfedb07f803..571618972e30 100644 --- a/include/linux/blkpg.h +++ b/include/linux/blkpg.h @@ -57,7 +57,6 @@ struct blkpg_partition { #ifdef __KERNEL__ extern char * partition_name(dev_t dev); -extern int blk_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg); #endif /* __KERNEL__ */ diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index b287b7a24b11..4387203c95b7 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -730,7 +730,6 @@ 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 */ - struct device cdrom_driverfs_dev; /* driverfs implementation */ /* specifications */ kdev_t dev; /* device number */ int mask; /* mask of capability: disables them */ diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 71708edafce9..76a5085043e1 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -66,6 +66,8 @@ static __inline__ unsigned int full_name_hash(const unsigned char * name, unsign #define DNAME_INLINE_LEN 16 +struct dcookie_struct; + struct dentry { atomic_t d_count; unsigned int d_flags; @@ -84,6 +86,7 @@ struct dentry { unsigned long d_vfs_flags; void * d_fsdata; /* fs-specific data */ unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */ + struct dcookie_struct * d_cookie; /* cookie, if any */ }; struct dentry_operations { diff --git a/include/linux/dcookies.h b/include/linux/dcookies.h new file mode 100644 index 000000000000..7c4d3319e7d0 --- /dev/null +++ b/include/linux/dcookies.h @@ -0,0 +1,69 @@ +/* + * dcookies.h + * + * Persistent cookie-path mappings + * + * Copyright 2002 John Levon <levon@movementarian.org> + */ + +#ifndef DCOOKIES_H +#define DCOOKIES_H + +#include <linux/config.h> + +#ifdef CONFIG_PROFILING + +#include <linux/types.h> + +struct dcookie_user; + +/** + * dcookie_register - register a user of dcookies + * + * Register as a dcookie user. Returns %NULL on failure. + */ +struct dcookie_user * dcookie_register(void); + +/** + * dcookie_unregister - unregister a user of dcookies + * + * Unregister as a dcookie user. This may invalidate + * any dcookie values returned from get_dcookie(). + */ +void dcookie_unregister(struct dcookie_user * user); + +/** + * get_dcookie - acquire a dcookie + * + * Convert the given dentry/vfsmount pair into + * a cookie value. + * + * Returns -EINVAL if no living task has registered as a + * dcookie user. + * + * Returns 0 on success, with *cookie filled in + */ +int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt, + u32 * cookie); + +#else + +struct dcookie_user * dcookie_register(void) +{ + return 0; +} + +void dcookie_unregister(struct dcookie_user * user) +{ + return; +} + +static inline int get_dcookie(struct dentry * dentry, + struct vfsmount * vfsmnt, u32 * cookie) +{ + return -ENOSYS; +} + +#endif /* CONFIG_PROFILING */ + +#endif /* DCOOKIES_H */ diff --git a/include/linux/device.h b/include/linux/device.h index 3290c5c40276..80a63939f924 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -329,6 +329,9 @@ dev_set_drvdata (struct device *dev, void *data) */ extern int device_register(struct device * dev); extern void device_unregister(struct device * dev); +extern void device_initialize(struct device * dev); +extern int device_add(struct device * dev); +extern void device_del(struct device * dev); /* driverfs interface for exporting device attributes */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 93148f1659b0..bca164f4265a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -359,6 +359,7 @@ struct block_device { sector_t bd_offset; unsigned bd_part_count; int bd_invalidated; + struct gendisk * bd_disk; }; struct inode { @@ -1087,6 +1088,7 @@ extern struct file_operations def_blk_fops; extern struct address_space_operations def_blk_aops; extern struct file_operations def_fifo_fops; extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); +extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); extern int blkdev_get(struct block_device *, mode_t, unsigned, int); extern int blkdev_put(struct block_device *, int); extern int bd_claim(struct block_device *, void *); diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 62781b452fe9..9de2f51ae935 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -62,17 +62,19 @@ struct hd_struct { sector_t start_sect; sector_t nr_sects; devfs_handle_t de; /* primary (master) devfs entry */ - struct device hd_driverfs_dev; /* support driverfs hiearchy */ + struct device *hd_driverfs_dev; /* support driverfs hiearchy */ }; #define GENHD_FL_REMOVABLE 1 #define GENHD_FL_DRIVERFS 2 #define GENHD_FL_DEVFS 4 #define GENHD_FL_CD 8 +#define GENHD_FL_UP 16 struct gendisk { int major; /* major number of driver */ int first_minor; + int minors; int minor_shift; /* number of times minor is shifted to get real minor */ char disk_name[16]; /* name of major driver */ @@ -88,6 +90,10 @@ struct gendisk { devfs_handle_t disk_de; /* piled higher and deeper */ struct device *driverfs_dev; struct device disk_dev; + + unsigned sync_io; /* RAID */ + unsigned reads, writes; + unsigned rio, wio; }; /* drivers/block/genhd.c */ @@ -260,21 +266,16 @@ struct unixware_disklabel { char *disk_name (struct gendisk *hd, int part, char *buf); extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); -extern void update_partition(struct gendisk *disk, int part); +extern void add_partition(struct gendisk *, int, sector_t, sector_t); +extern void delete_partition(struct gendisk *, int); -extern struct gendisk *alloc_disk(void); +extern struct gendisk *alloc_disk(int minors); +extern struct gendisk *get_disk(struct gendisk *disk); extern void put_disk(struct gendisk *disk); /* will go away */ extern void blk_set_probe(int major, struct gendisk *(p)(int)); -static inline unsigned int disk_index (kdev_t dev) -{ - int part; - struct gendisk *g = get_gendisk(kdev_t_to_nr(dev), &part); - return g ? (minor(dev) >> g->minor_shift) : 0; -} - #endif #endif diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h new file mode 100644 index 000000000000..ed8dc6755219 --- /dev/null +++ b/include/linux/mtd/concat.h @@ -0,0 +1,23 @@ +/* + * MTD device concatenation layer definitions + * + * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> + * + * This code is GPL + * + * $Id: concat.h,v 1.1 2002/03/08 16:34:36 rkaiser Exp $ + */ + +#ifndef MTD_CONCAT_H +#define MTD_CONCAT_H + + +struct mtd_info *mtd_concat_create( + struct mtd_info *subdev[], /* subdevices to concatenate */ + int num_devs, /* number of subdevices */ + char *name); /* name for the new device */ + +void mtd_concat_destroy(struct mtd_info *mtd); + +#endif + diff --git a/include/linux/nfs.h b/include/linux/nfs.h index 181e8decebfc..d99650a19b55 100644 --- a/include/linux/nfs.h +++ b/include/linux/nfs.h @@ -120,7 +120,7 @@ enum nfs_ftype { /* * This is the kernel NFS client file handle representation */ -#define NFS_MAXFHSIZE 64 +#define NFS_MAXFHSIZE 128 struct nfs_fh { unsigned short size; unsigned char data[NFS_MAXFHSIZE]; diff --git a/include/linux/nfs3.h b/include/linux/nfs3.h index 359c73e00841..7f11fa589207 100644 --- a/include/linux/nfs3.h +++ b/include/linux/nfs3.h @@ -59,6 +59,11 @@ enum nfs3_ftype { NF3BAD = 8 }; +struct nfs3_fh { + unsigned short size; + unsigned char data[NFS3_FHSIZE]; +}; + #define NFS3_VERSION 3 #define NFS3PROC_NULL 0 #define NFS3PROC_GETATTR 1 diff --git a/include/linux/nfs4_mount.h b/include/linux/nfs4_mount.h new file mode 100644 index 000000000000..9a782c2bbdd3 --- /dev/null +++ b/include/linux/nfs4_mount.h @@ -0,0 +1,70 @@ +#ifndef _LINUX_NFS4_MOUNT_H +#define _LINUX_NFS4_MOUNT_H + +/* + * linux/include/linux/nfs4_mount.h + * + * Copyright (C) 2002 Trond Myklebust + * + * structure passed from user-space to kernel-space during an nfsv4 mount + */ + +/* + * WARNING! Do not delete or change the order of these fields. If + * a new field is required then add it to the end. The version field + * tracks which fields are present. This will ensure some measure of + * mount-to-kernel version compatibility. Some of these aren't used yet + * but here they are anyway. + */ +#define NFS4_MOUNT_VERSION 1 + +struct nfs_string { + unsigned int len; + const char* data; +}; + +struct nfs4_mount_data { + int version; /* 1 */ + int flags; /* 1 */ + int rsize; /* 1 */ + int wsize; /* 1 */ + int timeo; /* 1 */ + int retrans; /* 1 */ + int acregmin; /* 1 */ + int acregmax; /* 1 */ + int acdirmin; /* 1 */ + int acdirmax; /* 1 */ + + /* see the definition of 'struct clientaddr4' in RFC3010 */ + struct nfs_string client_addr; /* 1 */ + + /* Mount path */ + struct nfs_string mnt_path; /* 1 */ + + /* Server details */ + struct nfs_string hostname; /* 1 */ + /* Server IP address */ + unsigned int host_addrlen; /* 1 */ + struct sockaddr* host_addr; /* 1 */ + + /* Transport protocol to use */ + int proto; /* 1 */ + + /* Pseudo-flavours to use for authentication. See RFC2623 */ + int auth_flavourlen; /* 1 */ + int *auth_flavours; /* 1 */ +}; + +/* bits in the flags field */ +/* Note: the fields that correspond to existing NFSv2/v3 mount options + * should mirror the values from include/linux/nfs_mount.h + */ + +#define NFS4_MOUNT_SOFT 0x0001 /* 1 */ +#define NFS4_MOUNT_INTR 0x0002 /* 1 */ +#define NFS4_MOUNT_NOCTO 0x0010 /* 1 */ +#define NFS4_MOUNT_NOAC 0x0020 /* 1 */ +#define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */ +#define NFS4_MOUNT_FLAGMASK 0xFFFF + +#endif diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 4c35f7cbb97c..3a23ac81e80f 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -472,6 +472,55 @@ extern void * nfs_root_data(void); #define NFS_JUKEBOX_RETRY_TIME (5 * HZ) +#ifdef CONFIG_NFS_V4 +struct nfs4_client { + atomic_t cl_count; /* refcount */ + u64 cl_clientid; /* constant */ + nfs4_verifier cl_confirm; + + /* + * Starts a list of lockowners, linked through lo_list. + */ + struct list_head cl_lockowners; /* protected by state_spinlock */ +}; + +/* nfs4proc.c */ +extern int nfs4_proc_renew(struct nfs_server *server); + +/* nfs4renewd.c */ +extern int nfs4_init_renewd(struct nfs_server *server); +#endif /* CONFIG_NFS_V4 */ + +#ifdef CONFIG_NFS_V4 + +extern struct nfs4_client *nfs4_get_client(void); +extern void nfs4_put_client(struct nfs4_client *clp); + +struct nfs4_mount_data; +static inline int +create_nfsv4_state(struct nfs_server *server, struct nfs4_mount_data *data) +{ + server->nfs4_state = NULL; + return 0; +} + +static inline void +destroy_nfsv4_state(struct nfs_server *server) +{ + if (server->mnt_path) { + kfree(server->mnt_path); + server->mnt_path = NULL; + } + if (server->nfs4_state) { + nfs4_put_client(server->nfs4_state); + server->nfs4_state = NULL; + } +} +#else +#define create_nfsv4_state(server, data) 0 +#define destroy_nfsv4_state(server) do { } while (0) +#endif + #endif /* __KERNEL__ */ /* diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 080c98fed1dd..d171608d7105 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -30,6 +30,16 @@ struct nfs_server { lru_busy; struct nfs_fh fh; struct sockaddr_in addr; +#if CONFIG_NFS_V4 + /* Our own IP address, as a null-terminated string. + * This is used to generate the clientid, and the callback address. + */ + char ip_addr[16]; + char * mnt_path; + struct nfs4_client * nfs4_state; /* all NFSv4 state starts here */ + unsigned long lease_time; /* in jiffies */ + unsigned long last_renewal; /* in jiffies */ +#endif }; /* Server capabilities */ diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h index 2b552936eeca..223ed3462064 100644 --- a/include/linux/nfs_mount.h +++ b/include/linux/nfs_mount.h @@ -10,6 +10,8 @@ */ #include <linux/in.h> #include <linux/nfs.h> +#include <linux/nfs2.h> +#include <linux/nfs3.h> /* * WARNING! Do not delete or change the order of these fields. If @@ -37,7 +39,7 @@ struct nfs_mount_data { char hostname[256]; /* 1 */ int namlen; /* 2 */ unsigned int bsize; /* 3 */ - struct nfs_fh root; /* 4 */ + struct nfs3_fh root; /* 4 */ }; /* bits in the flags field */ @@ -53,6 +55,10 @@ struct nfs_mount_data { #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ #define NFS_MOUNT_NONLM 0x0200 /* 3 */ #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ +#if 0 +#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ +#define NFS_MOUNT_SECFLAVOUR 0x2000 /* reserved */ +#endif #define NFS_MOUNT_FLAGMASK 0xFFFF #endif diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index b71b1b217c70..4bb5125056e7 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -50,6 +50,7 @@ struct nfs_fattr { * Info on the file system */ struct nfs_fsinfo { + struct nfs_fattr *fattr; /* Post-op attributes */ __u32 rtmax; /* max. read transfer size */ __u32 rtpref; /* pref. read transfer size */ __u32 rtmult; /* reads should be multiple of this */ @@ -58,16 +59,31 @@ struct nfs_fsinfo { __u32 wtmult; /* writes should be multiple of this */ __u32 dtpref; /* pref. readdir transfer size */ __u64 maxfilesize; - __u64 bsize; /* block size */ + __u32 lease_time; /* in seconds */ +}; + +struct nfs_fsstat { + struct nfs_fattr *fattr; /* Post-op attributes */ __u64 tbytes; /* total size in bytes */ __u64 fbytes; /* # of free bytes */ __u64 abytes; /* # of bytes available to user */ __u64 tfiles; /* # of files */ __u64 ffiles; /* # of free files */ __u64 afiles; /* # of files available to user */ - __u32 linkmax;/* max # of hard links */ - __u32 namelen;/* max name length */ - __u32 lease_time; /* in seconds */ +}; + +struct nfs2_fsstat { + __u32 tsize; /* Server transfer size */ + __u32 bsize; /* Filesystem block size */ + __u32 blocks; /* No. of "bsize" blocks on filesystem */ + __u32 bfree; /* No. of free "bsize" blocks */ + __u32 bavail; /* No. of available "bsize" blocks */ +}; + +struct nfs_pathconf { + struct nfs_fattr *fattr; /* Post-op attributes */ + __u32 max_link; /* max # of hard links */ + __u32 max_namelen; /* max name length */ }; /* @@ -309,6 +325,219 @@ struct nfs3_readdirres { int plus; }; +#ifdef CONFIG_NFS_V4 + +typedef u64 clientid4; + +struct nfs4_change_info { + u32 atomic; + u64 before; + u64 after; +}; + +struct nfs4_access { + u32 ac_req_access; /* request */ + u32 * ac_resp_supported; /* response */ + u32 * ac_resp_access; /* response */ +}; + +struct nfs4_close { + char * cl_stateid; /* request */ + u32 cl_seqid; /* request */ +}; + +struct nfs4_commit { + u64 co_start; /* request */ + u32 co_len; /* request */ + struct nfs_writeverf * co_verifier; /* response */ +}; + +struct nfs4_create { + u32 cr_ftype; /* request */ + union { /* request */ + struct { + u32 textlen; + const char * text; + } symlink; /* NF4LNK */ + struct { + u32 specdata1; + u32 specdata2; + } device; /* NF4BLK, NF4CHR */ + } u; + u32 cr_namelen; /* request */ + const char * cr_name; /* request */ + struct iattr * cr_attrs; /* request */ + struct nfs4_change_info * cr_cinfo; /* response */ +}; +#define cr_textlen u.symlink.textlen +#define cr_text u.symlink.text +#define cr_specdata1 u.device.specdata1 +#define cr_specdata2 u.device.specdata2 + +struct nfs4_getattr { + u32 * gt_bmval; /* request */ + struct nfs_fattr * gt_attrs; /* response */ + struct nfs_fsstat * gt_fsstat; /* response */ + struct nfs_fsinfo * gt_fsinfo; /* response */ + struct nfs_pathconf * gt_pathconf; /* response */ + u32 * gt_bmres; /* response */ +}; + +struct nfs4_getfh { + struct nfs_fh * gf_fhandle; /* response */ +}; + +struct nfs4_link { + u32 ln_namelen; /* request */ + const char * ln_name; /* request */ + struct nfs4_change_info * ln_cinfo; /* response */ +}; + +struct nfs4_lookup { + struct qstr * lo_name; /* request */ +}; + +struct nfs4_open { + u32 op_share_access; /* request */ + u32 op_opentype; /* request */ + u32 op_createmode; /* request */ + union { /* request */ + struct iattr * attrs; /* UNCHECKED, GUARDED */ + nfs4_verifier verifier; /* EXCLUSIVE */ + } u; + struct qstr * op_name; /* request */ + char * op_stateid; /* response */ + struct nfs4_change_info * op_cinfo; /* response */ + u32 * op_rflags; /* response */ +}; +#define op_attrs u.attrs +#define op_verifier u.verifier + +struct nfs4_open_confirm { + char * oc_stateid; /* request */ +}; + +struct nfs4_putfh { + struct nfs_fh * pf_fhandle; /* request */ +}; + +struct nfs4_read { + u64 rd_offset; /* request */ + u32 rd_length; /* request */ + u32 *rd_eof; /* response */ + u32 *rd_bytes_read; /* response */ + struct page ** rd_pages; /* zero-copy data */ + unsigned int rd_pgbase; /* zero-copy data */ +}; + +struct nfs4_readdir { + u64 rd_cookie; /* request */ + nfs4_verifier rd_req_verifier; /* request */ + u32 rd_count; /* request */ + u32 rd_bmval[2]; /* request */ + nfs4_verifier rd_resp_verifier; /* response */ + struct page ** rd_pages; /* zero-copy data */ + unsigned int rd_pgbase; /* zero-copy data */ +}; + +struct nfs4_readlink { + u32 rl_count; /* zero-copy data */ + struct page ** rl_pages; /* zero-copy data */ +}; + +struct nfs4_remove { + u32 rm_namelen; /* request */ + const char * rm_name; /* request */ + struct nfs4_change_info * rm_cinfo; /* response */ +}; + +struct nfs4_rename { + u32 rn_oldnamelen; /* request */ + const char * rn_oldname; /* request */ + u32 rn_newnamelen; /* request */ + const char * rn_newname; /* request */ + struct nfs4_change_info * rn_src_cinfo; /* response */ + struct nfs4_change_info * rn_dst_cinfo; /* response */ +}; + +struct nfs4_setattr { + char * st_stateid; /* request */ + struct iattr * st_iap; /* request */ +}; + +struct nfs4_setclientid { + nfs4_verifier sc_verifier; /* request */ + char * sc_name; /* request */ + u32 sc_prog; /* request */ + char sc_netid[4]; /* request */ + char sc_uaddr[24]; /* request */ + u32 sc_cb_ident; /* request */ +}; + +struct nfs4_write { + u64 wr_offset; /* request */ + u32 wr_stable_how; /* request */ + u32 wr_len; /* request */ + u32 * wr_bytes_written; /* response */ + struct nfs_writeverf * wr_verf; /* response */ + struct page ** wr_pages; /* zero-copy data */ + unsigned int wr_pgbase; /* zero-copy data */ +}; + +struct nfs4_op { + u32 opnum; + u32 nfserr; + union { + struct nfs4_access access; + struct nfs4_close close; + struct nfs4_commit commit; + struct nfs4_create create; + struct nfs4_getattr getattr; + struct nfs4_getfh getfh; + struct nfs4_link link; + struct nfs4_lookup lookup; + struct nfs4_open open; + struct nfs4_open_confirm open_confirm; + struct nfs4_putfh putfh; + struct nfs4_read read; + struct nfs4_readdir readdir; + struct nfs4_readlink readlink; + struct nfs4_remove remove; + struct nfs4_rename rename; + struct nfs4_setattr setattr; + struct nfs4_setclientid setclientid; + struct nfs4_write write; + } u; +}; + +struct nfs4_compound { + unsigned int flags; /* defined below */ + struct nfs_server * server; + + /* RENEW information */ + int renew_index; + unsigned long timestamp; + + /* scratch variables for XDR encode/decode */ + int nops; + u32 * p; + u32 * end; + + /* the individual COMPOUND operations */ + struct nfs4_op *ops; + + /* request */ + int req_nops; + u32 taglen; + char * tag; + + /* response */ + int resp_nops; + int toplevel_status; +}; + +#endif /* CONFIG_NFS_V4 */ + struct nfs_read_data { struct rpc_task task; struct inode *inode; @@ -322,7 +551,12 @@ struct nfs_read_data { struct nfs_readres res; } v3; /* also v2 */ #ifdef CONFIG_NFS_V4 - /* NFSv4 data will come here... */ + struct { + struct nfs4_compound compound; + struct nfs4_op ops[3]; + u32 res_count; + u32 res_eof; + } v4; #endif } u; }; @@ -337,11 +571,17 @@ struct nfs_write_data { struct page *pagevec[NFS_WRITE_MAXIOV]; union { struct { - struct nfs_writeargs args; - struct nfs_writeres res; + struct nfs_writeargs args; /* argument struct */ + struct nfs_writeres res; /* result struct */ } v3; #ifdef CONFIG_NFS_V4 - /* NFSv4 data to come here... */ + struct { + struct nfs4_compound compound; + struct nfs4_op ops[3]; + u32 arg_count; + u32 arg_stable; + u32 res_count; + } v4; #endif } u; }; @@ -391,7 +631,11 @@ struct nfs_rpc_ops { int (*mknod) (struct inode *, struct qstr *, struct iattr *, dev_t, struct nfs_fh *, struct nfs_fattr *); int (*statfs) (struct nfs_server *, struct nfs_fh *, + struct nfs_fsstat *); + int (*fsinfo) (struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); + int (*pathconf) (struct nfs_server *, struct nfs_fh *, + struct nfs_pathconf *); u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); void (*read_setup) (struct nfs_read_data *, unsigned int count); void (*write_setup) (struct nfs_write_data *, unsigned int count, int how); @@ -410,8 +654,10 @@ struct nfs_rpc_ops { */ extern struct nfs_rpc_ops nfs_v2_clientops; extern struct nfs_rpc_ops nfs_v3_clientops; +extern struct nfs_rpc_ops nfs_v4_clientops; extern struct rpc_version nfs_version2; extern struct rpc_version nfs_version3; +extern struct rpc_version nfs_version4; extern struct rpc_program nfs_program; extern struct rpc_stat nfs_rpcstat; diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h new file mode 100644 index 000000000000..982b64e0518a --- /dev/null +++ b/include/linux/oprofile.h @@ -0,0 +1,98 @@ +/** + * @file oprofile.h + * + * API for machine-specific interrupts to interface + * to oprofile. + * + * @remark Copyright 2002 OProfile authors + * @remark Read the file COPYING + * + * @author John Levon <levon@movementarian.org> + */ + +#ifndef OPROFILE_H +#define OPROFILE_H + +#include <linux/types.h> +#include <linux/spinlock.h> +#include <asm/atomic.h> + +struct super_block; +struct dentry; +struct file_operations; + +enum oprofile_cpu { + OPROFILE_CPU_PPRO, + OPROFILE_CPU_PII, + OPROFILE_CPU_PIII, + OPROFILE_CPU_ATHLON, + OPROFILE_CPU_TIMER +}; + +/* Operations structure to be filled in */ +struct oprofile_operations { + /* create any necessary configuration files in the oprofile fs. + * Optional. */ + int (*create_files)(struct super_block * sb, struct dentry * root); + /* Do any necessary interrupt setup. Optional. */ + int (*setup)(void); + /* Do any necessary interrupt shutdown. Optional. */ + void (*shutdown)(void); + /* Start delivering interrupts. */ + int (*start)(void); + /* Stop delivering interrupts. */ + void (*stop)(void); +}; + +/** + * One-time initialisation. *ops must be set to a filled-in + * operations structure. oprofile_cpu_type must be set. + * Return 0 on success. + */ +int oprofile_arch_init(struct oprofile_operations ** ops, enum oprofile_cpu * cpu); + +/** + * Add a sample. This may be called from any context. Pass + * smp_processor_id() as cpu. + */ +extern void FASTCALL(oprofile_add_sample(unsigned long eip, unsigned long event, int cpu)); + +/** + * Create a file of the given name as a child of the given root, with + * the specified file operations. + */ +int oprofilefs_create_file(struct super_block * sb, struct dentry * root, + char const * name, struct file_operations * fops); + +/** Create a file for read/write access to an unsigned long. */ +int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root, + char const * name, ulong * val); + +/** Create a file for read-only access to an unsigned long. */ +int oprofilefs_create_ro_ulong(struct super_block * sb, struct dentry * root, + char const * name, ulong * val); + +/** Create a file for read-only access to an atomic_t. */ +int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root, + char const * name, atomic_t * val); + +/** create a directory */ +struct dentry * oprofilefs_mkdir(struct super_block * sb, struct dentry * root, + char const * name); + +/** + * Convert an unsigned long value into ASCII and copy it to the user buffer @buf, + * updating *offset appropriately. Returns bytes written or -EFAULT. + */ +ssize_t oprofilefs_ulong_to_user(unsigned long * val, char * buf, size_t count, loff_t * offset); + +/** + * Read an ASCII string for a number from a userspace buffer and fill *val on success. + * Returns 0 on success, < 0 on error. + */ +int oprofilefs_ulong_from_user(unsigned long * val, char const * buf, size_t count); + +/** lock for read/write safety */ +extern spinlock_t oprofilefs_lock; + +#endif /* OPROFILE_H */ diff --git a/include/linux/profile.h b/include/linux/profile.h new file mode 100644 index 000000000000..11fbe9cec572 --- /dev/null +++ b/include/linux/profile.h @@ -0,0 +1,67 @@ +#ifndef _LINUX_PROFILE_H +#define _LINUX_PROFILE_H + +#ifdef __KERNEL__ + +#include <linux/kernel.h> +#include <linux/config.h> +#include <linux/init.h> +#include <asm/errno.h> + +/* parse command line */ +int __init profile_setup(char * str); + +/* init basic kernel profiler */ +void __init profile_init(void); + +extern unsigned int * prof_buffer; +extern unsigned long prof_len; +extern unsigned long prof_shift; + + +enum profile_type { + EXIT_TASK, + EXIT_MMAP, + EXEC_UNMAP +}; + +#ifdef CONFIG_PROFILING + +struct notifier_block; +struct task_struct; +struct mm_struct; + +/* task is in do_exit() */ +void profile_exit_task(struct task_struct * task); + +/* change of vma mappings */ +void profile_exec_unmap(struct mm_struct * mm); + +/* exit of all vmas for a task */ +void profile_exit_mmap(struct mm_struct * mm); + +int profile_event_register(enum profile_type, struct notifier_block * n); + +int profile_event_unregister(enum profile_type, struct notifier_block * n); + +#else + +static inline int profile_event_register(enum profile_type t, struct notifier_block * n) +{ + return -ENOSYS; +} + +static inline int profile_event_unregister(enum profile_type t, struct notifier_block * n) +{ + return -ENOSYS; +} + +#define profile_exit_task(a) do { } while (0) +#define profile_exec_unmap(a) do { } while (0) +#define profile_exit_mmap(a) do { } while (0) + +#endif /* CONFIG_PROFILING */ + +#endif /* __KERNEL__ */ + +#endif /* _LINUX_PROFILE_H */ diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h new file mode 100644 index 000000000000..a5ffb7bb5743 --- /dev/null +++ b/include/linux/rcupdate.h @@ -0,0 +1,134 @@ +/* + * Read-Copy Update mechanism for mutual exclusion + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Copyright (c) IBM Corporation, 2001 + * + * Author: Dipankar Sarma <dipankar@in.ibm.com> + * + * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com> + * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. + * Papers: + * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf + * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001) + * + * For detailed explanation of Read-Copy Update mechanism see - + * http://lse.sourceforge.net/locking/rcupdate.html + * + */ + +#ifndef __LINUX_RCUPDATE_H +#define __LINUX_RCUPDATE_H + +#ifdef __KERNEL__ + +#include <linux/cache.h> +#include <linux/list.h> +#include <linux/spinlock.h> +#include <linux/threads.h> + +/** + * struct rcu_head - callback structure for use with RCU + * @list: list_head to queue the update requests + * @func: actual update function to call after the grace period. + * @arg: argument to be passed to the actual update function. + */ +struct rcu_head { + struct list_head list; + void (*func)(void *obj); + void *arg; +}; + +#define RCU_HEAD_INIT(head) \ + { list: LIST_HEAD_INIT(head.list), func: NULL, arg: NULL } +#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT(head) +#define INIT_RCU_HEAD(ptr) do { \ + INIT_LIST_HEAD(&(ptr)->list); (ptr)->func = NULL; (ptr)->arg = NULL; \ +} while (0) + + + +/* Control variables for rcupdate callback mechanism. */ +struct rcu_ctrlblk { + spinlock_t mutex; /* Guard this struct */ + long curbatch; /* Current batch number. */ + long maxbatch; /* Max requested batch number. */ + unsigned long rcu_cpu_mask; /* CPUs that need to switch in order */ + /* for current batch to proceed. */ +}; + +/* Is batch a before batch b ? */ +static inline int rcu_batch_before(long a, long b) +{ + return (a - b) < 0; +} + +/* Is batch a after batch b ? */ +static inline int rcu_batch_after(long a, long b) +{ + return (a - b) > 0; +} + +/* + * Per-CPU data for Read-Copy UPdate. + * nxtlist - new callbacks are added here + * curlist - current batch for which quiescent cycle started if any + */ +struct rcu_data { + long qsctr; /* User-mode/idle loop etc. */ + long last_qsctr; /* value of qsctr at beginning */ + /* of rcu grace period */ + long batch; /* Batch # for current RCU batch */ + struct list_head nxtlist; + struct list_head curlist; +} ____cacheline_aligned_in_smp; + +extern struct rcu_data rcu_data[NR_CPUS]; +extern struct rcu_ctrlblk rcu_ctrlblk; + +#define RCU_qsctr(cpu) (rcu_data[(cpu)].qsctr) +#define RCU_last_qsctr(cpu) (rcu_data[(cpu)].last_qsctr) +#define RCU_batch(cpu) (rcu_data[(cpu)].batch) +#define RCU_nxtlist(cpu) (rcu_data[(cpu)].nxtlist) +#define RCU_curlist(cpu) (rcu_data[(cpu)].curlist) + +#define RCU_QSCTR_INVALID 0 + +static inline int rcu_pending(int cpu) +{ + if ((!list_empty(&RCU_curlist(cpu)) && + rcu_batch_before(RCU_batch(cpu), rcu_ctrlblk.curbatch)) || + (list_empty(&RCU_curlist(cpu)) && + !list_empty(&RCU_nxtlist(cpu))) || + test_bit(cpu, &rcu_ctrlblk.rcu_cpu_mask)) + return 1; + else + return 0; +} + +#define rcu_read_lock() preempt_disable() +#define rcu_read_unlock() preempt_enable() + +extern void rcu_init(void); +extern void rcu_check_callbacks(int cpu, int user); + +/* Exported interfaces */ +extern void FASTCALL(call_rcu(struct rcu_head *head, + void (*func)(void *arg), void *arg)); +extern void synchronize_kernel(void); + +#endif /* __KERNEL__ */ +#endif /* __LINUX_RCUPDATE_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 89c4ead4cf4b..764a3ebf3c24 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -492,10 +492,6 @@ extern unsigned long itimer_ticks; extern unsigned long itimer_next; extern void do_timer(struct pt_regs *); -extern unsigned int * prof_buffer; -extern unsigned long prof_len; -extern unsigned long prof_shift; - extern void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode, int nr)); extern void FASTCALL(__wake_up_locked(wait_queue_head_t *q, unsigned int mode)); extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr)); diff --git a/include/linux/vcache.h b/include/linux/vcache.h index d5756643332c..5708fe6a908a 100644 --- a/include/linux/vcache.h +++ b/include/linux/vcache.h @@ -18,7 +18,7 @@ extern void __attach_vcache(vcache_t *vcache, struct mm_struct *mm, void (*callback)(struct vcache_s *data, struct page *new_page)); -extern void detach_vcache(vcache_t *vcache); +extern void __detach_vcache(vcache_t *vcache); extern void invalidate_vcache(unsigned long address, struct mm_struct *mm, struct page *new_page); diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 3253f7e9e06a..d8e54c8f4daf 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -40,11 +40,7 @@ #endif /* Reserv for core and drivers use */ -#define BLUEZ_SKB_RESERVE 8 - -#ifndef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif +#define BT_SKB_RESERVE 8 #define BTPROTO_L2CAP 0 #define BTPROTO_HCI 1 @@ -57,29 +53,12 @@ #define SOL_SCO 17 #define SOL_RFCOMM 18 -/* Debugging */ -#ifdef CONFIG_BLUEZ_DEBUG - -#define HCI_CORE_DEBUG 1 -#define HCI_SOCK_DEBUG 1 -#define HCI_UART_DEBUG 1 -#define HCI_USB_DEBUG 1 -//#define HCI_DATA_DUMP 1 - -#define L2CAP_DEBUG 1 -#define SCO_DEBUG 1 -#define AF_BLUETOOTH_DEBUG 1 - -#endif /* CONFIG_BLUEZ_DEBUG */ - -extern void bluez_dump(char *pref, __u8 *buf, int count); - #define BT_INFO(fmt, arg...) printk(KERN_INFO fmt "\n" , ## arg) #define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg) #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __FUNCTION__ , ## arg) #ifdef HCI_DATA_DUMP -#define BT_DMP(buf, len) bluez_dump(__FUNCTION__, buf, len) +#define BT_DMP(buf, len) bt_dump(__FUNCTION__, buf, len) #else #define BT_DMP(D...) #endif @@ -127,9 +106,9 @@ bdaddr_t *strtoba(char *str); /* Common socket structures and functions */ -#define bluez_sk(__sk) ((struct bluez_sock *) __sk) +#define bt_sk(__sk) ((struct bt_sock *) __sk) -struct bluez_sock { +struct bt_sock { struct sock sk; bdaddr_t src; bdaddr_t dst; @@ -137,48 +116,48 @@ struct bluez_sock { struct sock *parent; }; -struct bluez_sock_list { +struct bt_sock_list { struct sock *head; rwlock_t lock; }; -int bluez_sock_register(int proto, struct net_proto_family *ops); -int bluez_sock_unregister(int proto); -struct sock *bluez_sock_alloc(struct socket *sock, int proto, int pi_size, int prio); -void bluez_sock_link(struct bluez_sock_list *l, struct sock *s); -void bluez_sock_unlink(struct bluez_sock_list *l, struct sock *s); -int bluez_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, int len, int flags, struct scm_cookie *scm); -uint bluez_sock_poll(struct file * file, struct socket *sock, poll_table *wait); -int bluez_sock_w4_connect(struct sock *sk, int flags); +int bt_sock_register(int proto, struct net_proto_family *ops); +int bt_sock_unregister(int proto); +struct sock *bt_sock_alloc(struct socket *sock, int proto, int pi_size, int prio); +void bt_sock_link(struct bt_sock_list *l, struct sock *s); +void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); +int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, int len, int flags, struct scm_cookie *scm); +uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); +int bt_sock_w4_connect(struct sock *sk, int flags); -void bluez_accept_enqueue(struct sock *parent, struct sock *sk); -struct sock *bluez_accept_dequeue(struct sock *parent, struct socket *newsock); +void bt_accept_enqueue(struct sock *parent, struct sock *sk); +struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock); /* Skb helpers */ -struct bluez_skb_cb { - int incomming; +struct bt_skb_cb { + int incoming; }; -#define bluez_cb(skb) ((struct bluez_skb_cb *)(skb->cb)) +#define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb)) -static inline struct sk_buff *bluez_skb_alloc(unsigned int len, int how) +static inline struct sk_buff *bt_skb_alloc(unsigned int len, int how) { struct sk_buff *skb; - if ((skb = alloc_skb(len + BLUEZ_SKB_RESERVE, how))) { - skb_reserve(skb, BLUEZ_SKB_RESERVE); - bluez_cb(skb)->incomming = 0; + if ((skb = alloc_skb(len + BT_SKB_RESERVE, how))) { + skb_reserve(skb, BT_SKB_RESERVE); + bt_cb(skb)->incoming = 0; } return skb; } -static inline struct sk_buff *bluez_skb_send_alloc(struct sock *sk, unsigned long len, +static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long len, int nb, int *err) { struct sk_buff *skb; - if ((skb = sock_alloc_send_skb(sk, len + BLUEZ_SKB_RESERVE, nb, err))) { - skb_reserve(skb, BLUEZ_SKB_RESERVE); - bluez_cb(skb)->incomming = 0; + if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { + skb_reserve(skb, BT_SKB_RESERVE); + bt_cb(skb)->incoming = 0; } return skb; @@ -193,11 +172,8 @@ static inline int skb_frags_no(struct sk_buff *skb) return n; } -int hci_core_init(void); -int hci_core_cleanup(void); -int hci_sock_init(void); -int hci_sock_cleanup(void); +void bt_dump(char *pref, __u8 *buf, int count); -int bterr(__u16 code); +int bt_err(__u16 code); #endif /* __BLUETOOTH_H */ diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index b58ebef5397b..a8832055d170 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -39,6 +39,8 @@ #define HCI_DEV_UNREG 2 #define HCI_DEV_UP 3 #define HCI_DEV_DOWN 4 +#define HCI_DEV_SUSPEND 5 +#define HCI_DEV_RESUME 6 /* HCI device types */ #define HCI_VHCI 0 @@ -582,7 +584,7 @@ typedef struct { } __attribute__ ((packed)) evt_read_remote_version_complete; #define EVT_READ_REMOTE_VERSION_COMPLETE_SIZE 8 -/* Internal events generated by BlueZ stack */ +/* Internal events generated by Bluetooth stack */ #define EVT_STACK_INTERNAL 0xfd typedef struct { __u16 type; diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 1740cde1287d..adf5558f660a 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -302,6 +302,8 @@ struct hci_dev *hci_dev_get(int index); struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); int hci_register_dev(struct hci_dev *hdev); int hci_unregister_dev(struct hci_dev *hdev); +int hci_suspend_dev(struct hci_dev *hdev); +int hci_resume_dev(struct hci_dev *hdev); int hci_dev_open(__u16 dev); int hci_dev_close(__u16 dev); int hci_dev_reset(__u16 dev); diff --git a/include/rxrpc/call.h b/include/rxrpc/call.h new file mode 100644 index 000000000000..0ae39ad9c612 --- /dev/null +++ b/include/rxrpc/call.h @@ -0,0 +1,218 @@ +/* call.h: Rx call record + * + * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.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. + */ + +#ifndef _LINUX_RXRPC_CALL_H +#define _LINUX_RXRPC_CALL_H + +#include <rxrpc/types.h> +#include <rxrpc/rxrpc.h> +#include <rxrpc/packet.h> +#include <linux/timer.h> + +#define RXRPC_CALL_ACK_WINDOW_SIZE 16 + +extern unsigned rxrpc_call_rcv_timeout; /* receive activity timeout (secs) */ +extern unsigned rxrpc_call_acks_timeout; /* pending ACK (retransmit) timeout (secs) */ +extern unsigned rxrpc_call_dfr_ack_timeout; /* deferred ACK timeout (secs) */ +extern unsigned short rxrpc_call_max_resend; /* maximum consecutive resend count */ + +/* application call state + * - only state 0 and ffff are reserved, the state is set to 1 after an opid is received + */ +enum rxrpc_app_cstate { + RXRPC_CSTATE_COMPLETE = 0, /* operation complete */ + RXRPC_CSTATE_ERROR, /* operation ICMP error or aborted */ + RXRPC_CSTATE_SRVR_RCV_OPID, /* [SERVER] receiving operation ID */ + RXRPC_CSTATE_SRVR_RCV_ARGS, /* [SERVER] receiving operation data */ + RXRPC_CSTATE_SRVR_GOT_ARGS, /* [SERVER] completely received operation data */ + RXRPC_CSTATE_SRVR_SND_REPLY, /* [SERVER] sending operation reply */ + RXRPC_CSTATE_SRVR_RCV_FINAL_ACK, /* [SERVER] receiving final ACK */ + RXRPC_CSTATE_CLNT_SND_ARGS, /* [CLIENT] sending operation args */ + RXRPC_CSTATE_CLNT_RCV_REPLY, /* [CLIENT] receiving operation reply */ + RXRPC_CSTATE_CLNT_GOT_REPLY, /* [CLIENT] completely received operation reply */ +} __attribute__((packed)); + +extern const char *rxrpc_call_states[]; + +enum rxrpc_app_estate { + RXRPC_ESTATE_NO_ERROR = 0, /* no error */ + RXRPC_ESTATE_LOCAL_ABORT, /* aborted locally by application layer */ + RXRPC_ESTATE_PEER_ABORT, /* aborted remotely by peer */ + RXRPC_ESTATE_LOCAL_ERROR, /* local ICMP network error */ + RXRPC_ESTATE_REMOTE_ERROR, /* remote ICMP network error */ +} __attribute__((packed)); + +extern const char *rxrpc_call_error_states[]; + +/*****************************************************************************/ +/* + * Rx call record and application scratch buffer + * - the call record occupies the bottom of a complete page + * - the application scratch buffer occupies the rest + */ +struct rxrpc_call +{ + atomic_t usage; + struct rxrpc_connection *conn; /* connection upon which active */ + spinlock_t lock; /* access lock */ + struct module *owner; /* owner module */ + wait_queue_head_t waitq; /* wait queue for events to happen */ + struct list_head link; /* general internal list link */ + struct list_head call_link; /* master call list link */ + u32 chan_ix; /* connection channel index (net order) */ + u32 call_id; /* call ID on connection (net order) */ + unsigned long cjif; /* jiffies at call creation */ + unsigned long flags; /* control flags */ +#define RXRPC_CALL_ACKS_TIMO 0x00000001 /* ACKS timeout reached */ +#define RXRPC_CALL_ACKR_TIMO 0x00000002 /* ACKR timeout reached */ +#define RXRPC_CALL_RCV_TIMO 0x00000004 /* RCV timeout reached */ +#define RXRPC_CALL_RCV_PKT 0x00000008 /* received packet */ + + /* transmission */ + rxrpc_seq_t snd_seq_count; /* outgoing packet sequence number counter */ + struct rxrpc_message *snd_nextmsg; /* next message being constructed for sending */ + struct rxrpc_message *snd_ping; /* last ping message sent */ + unsigned short snd_resend_cnt; /* count of resends since last ACK */ + + /* transmission ACK tracking */ + struct list_head acks_pendq; /* messages pending ACK (ordered by seq) */ + unsigned acks_pend_cnt; /* number of un-ACK'd packets */ + rxrpc_seq_t acks_dftv_seq; /* highest definitively ACK'd msg seq */ + struct timer_list acks_timeout; /* timeout on expected ACK */ + + /* reception */ + struct list_head rcv_receiveq; /* messages pending reception (ordered by seq) */ + struct list_head rcv_krxiodq_lk; /* krxiod queue for new inbound packets */ + struct timer_list rcv_timeout; /* call receive activity timeout */ + + /* reception ACK'ing */ + rxrpc_seq_t ackr_win_bot; /* bottom of ACK window */ + rxrpc_seq_t ackr_win_top; /* top of ACK window */ + rxrpc_seq_t ackr_high_seq; /* highest seqno yet received */ + rxrpc_seq_t ackr_prev_seq; /* previous seqno received */ + unsigned ackr_pend_cnt; /* number of pending ACKs */ + struct timer_list ackr_dfr_timo; /* timeout on deferred ACK */ + char ackr_dfr_perm; /* request for deferred ACKs permitted */ + rxrpc_seq_t ackr_dfr_seq; /* seqno for deferred ACK */ + struct rxrpc_ackpacket ackr; /* pending normal ACK packet */ + u8 ackr_array[RXRPC_CALL_ACK_WINDOW_SIZE]; /* ACK records */ + + /* presentation layer */ + char app_last_rcv; /* T if received last packet from remote end */ + enum rxrpc_app_cstate app_call_state; /* call state */ + enum rxrpc_app_estate app_err_state; /* abort/error state */ + struct list_head app_readyq; /* ordered ready received packet queue */ + struct list_head app_unreadyq; /* ordered post-hole recv'd packet queue */ + rxrpc_seq_t app_ready_seq; /* last seq number dropped into readyq */ + size_t app_ready_qty; /* amount of data ready in readyq */ + unsigned app_opcode; /* operation ID */ + unsigned app_abort_code; /* abort code (when aborted) */ + int app_errno; /* error number (when ICMP error received) */ + + /* statisics */ + unsigned pkt_rcv_count; /* count of received packets on this call */ + unsigned pkt_snd_count; /* count of sent packets on this call */ + unsigned app_read_count; /* number of reads issued */ + + /* bits for the application to use */ + rxrpc_call_attn_func_t app_attn_func; /* callback when attention required */ + rxrpc_call_error_func_t app_error_func; /* callback when abort sent (cleanup and put) */ + rxrpc_call_aemap_func_t app_aemap_func; /* callback to map abort code to/from errno */ + void *app_user; /* application data */ + struct list_head app_link; /* application list linkage */ + struct list_head app_attn_link; /* application attention list linkage */ + size_t app_mark; /* trigger callback when app_ready_qty>=app_mark */ + char app_async_read; /* T if in async-read mode */ + u8 *app_read_buf; /* application async read buffer (app_mark size) */ + u8 *app_scr_alloc; /* application scratch allocation pointer */ + void *app_scr_ptr; /* application pointer into scratch buffer */ + +#define RXRPC_APP_MARK_EOF 0xFFFFFFFFU /* mark at end of input */ + + /* application scratch buffer */ + u8 app_scratch[0] __attribute__((aligned(sizeof(long)))); +}; + +#define RXRPC_CALL_SCRATCH_SIZE (PAGE_SIZE - sizeof(struct rxrpc_call)) + +#define rxrpc_call_reset_scratch(CALL) \ +do { (CALL)->app_scr_alloc = (CALL)->app_scratch; } while(0) + +#define rxrpc_call_alloc_scratch(CALL,SIZE) \ +({ \ + void *ptr; \ + ptr = (CALL)->app_scr_alloc; \ + (CALL)->app_scr_alloc += (SIZE); \ + if ((SIZE)>RXRPC_CALL_SCRATCH_SIZE || \ + (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \ + printk("rxrpc_call_alloc_scratch(%p,%u)\n",(CALL),(SIZE)); \ + BUG(); \ + } \ + ptr; \ +}) + +#define rxrpc_call_alloc_scratch_s(CALL,TYPE) \ +({ \ + size_t size = sizeof(TYPE); \ + TYPE *ptr; \ + ptr = (TYPE*)(CALL)->app_scr_alloc; \ + (CALL)->app_scr_alloc += size; \ + if (size>RXRPC_CALL_SCRATCH_SIZE || \ + (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \ + printk("rxrpc_call_alloc_scratch(%p,%u)\n",(CALL),size); \ + BUG(); \ + } \ + ptr; \ +}) + +#define rxrpc_call_is_ack_pending(CALL) ((CALL)->ackr.reason != 0) + +extern int rxrpc_create_call(struct rxrpc_connection *conn, + rxrpc_call_attn_func_t attn, + rxrpc_call_error_func_t error, + rxrpc_call_aemap_func_t aemap, + struct rxrpc_call **_call); + +extern int rxrpc_incoming_call(struct rxrpc_connection *conn, + struct rxrpc_message *msg, + struct rxrpc_call **_call); + +static inline void rxrpc_get_call(struct rxrpc_call *call) +{ + if (atomic_read(&call->usage)<=0) + BUG(); + atomic_inc(&call->usage); + /*printk("rxrpc_get_call(%p{u=%d})\n",(C),atomic_read(&(C)->usage));*/ +} + +extern void rxrpc_put_call(struct rxrpc_call *call); + +extern void rxrpc_call_do_stuff(struct rxrpc_call *call); + +extern int rxrpc_call_abort(struct rxrpc_call *call, int error); + +#define RXRPC_CALL_READ_BLOCK 0x0001 /* block if not enough data and not yet EOF */ +#define RXRPC_CALL_READ_ALL 0x0002 /* error if insufficient data received */ +extern int rxrpc_call_read_data(struct rxrpc_call *call, void *buffer, size_t size, int flags); + +extern int rxrpc_call_write_data(struct rxrpc_call *call, + size_t sioc, + struct iovec siov[], + u8 rxhdr_flags, + int alloc_flags, + int dup_data, + size_t *size_sent); + +extern int rxrpc_call_flush(struct rxrpc_call *call); + +extern void rxrpc_call_handle_error(struct rxrpc_call *conn, int local, int errno); + +#endif /* _LINUX_RXRPC_CALL_H */ diff --git a/include/rxrpc/connection.h b/include/rxrpc/connection.h new file mode 100644 index 000000000000..fc10fed01b21 --- /dev/null +++ b/include/rxrpc/connection.h @@ -0,0 +1,83 @@ +/* connection.h: Rx connection record + * + * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.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. + */ + +#ifndef _LINUX_RXRPC_CONNECTION_H +#define _LINUX_RXRPC_CONNECTION_H + +#include <rxrpc/types.h> +#include <rxrpc/krxtimod.h> + +struct sk_buff; + +/*****************************************************************************/ +/* + * Rx connection + * - connections are matched by (rmt_port,rmt_addr,service_id,conn_id,clientflag) + * - connections only retain a refcount on the peer when they are active + * - connections with refcount==0 are inactive and reside in the peer's graveyard + */ +struct rxrpc_connection +{ + atomic_t usage; + struct rxrpc_transport *trans; /* transport endpoint */ + struct rxrpc_peer *peer; /* peer from/to which connected */ + struct rxrpc_service *service; /* responsible service (inbound conns) */ + struct rxrpc_timer timeout; /* decaching timer */ + struct list_head link; /* link in peer's list */ + struct list_head proc_link; /* link in proc list */ + struct list_head err_link; /* link in ICMP error processing list */ + struct sockaddr_in addr; /* remote address */ + struct rxrpc_call *channels[4]; /* channels (active calls) */ + wait_queue_head_t chanwait; /* wait for channel to become available */ + spinlock_t lock; /* access lock */ + struct timeval atime; /* last access time */ + size_t mtu_size; /* MTU size for outbound messages */ + unsigned call_counter; /* call ID counter */ + rxrpc_serial_t serial_counter; /* packet serial number counter */ + + /* the following should all be in net order */ + u32 in_epoch; /* peer's epoch */ + u32 out_epoch; /* my epoch */ + u32 conn_id; /* connection ID, appropriately shifted */ + u16 service_id; /* service ID */ + u8 security_ix; /* security ID */ + u8 in_clientflag; /* RXRPC_CLIENT_INITIATED if we are server */ + u8 out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */ +}; + +extern int rxrpc_create_connection(struct rxrpc_transport *trans, + u16 port, + u32 addr, + unsigned short service_id, + void *security, + struct rxrpc_connection **_conn); + +extern int rxrpc_connection_lookup(struct rxrpc_peer *peer, + struct rxrpc_message *msg, + struct rxrpc_connection **_conn); + +static inline void rxrpc_get_connection(struct rxrpc_connection *conn) +{ + if (atomic_read(&conn->usage)<0) + BUG(); + atomic_inc(&conn->usage); + //printk("rxrpc_get_conn(%p{u=%d})\n",conn,atomic_read(&conn->usage)); +} + +extern void rxrpc_put_connection(struct rxrpc_connection *conn); + +extern int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn, + struct rxrpc_call *call, + struct rxrpc_message *msg); + +extern void rxrpc_conn_handle_error(struct rxrpc_connection *conn, int local, int errno); + +#endif /* _LINUX_RXRPC_CONNECTION_H */ diff --git a/include/rxrpc/krxiod.h b/include/rxrpc/krxiod.h new file mode 100644 index 000000000000..c0e0e82e4df2 --- /dev/null +++ b/include/rxrpc/krxiod.h @@ -0,0 +1,27 @@ +/* krxiod.h: Rx RPC I/O kernel thread interface + * + * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.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. + */ + +#ifndef _LINUX_RXRPC_KRXIOD_H +#define _LINUX_RXRPC_KRXIOD_H + +#include <rxrpc/types.h> + +extern int rxrpc_krxiod_init(void); +extern void rxrpc_krxiod_kill(void); +extern void rxrpc_krxiod_queue_transport(struct rxrpc_transport *trans); +extern void rxrpc_krxiod_dequeue_transport(struct rxrpc_transport *trans); +extern void rxrpc_krxiod_queue_peer(struct rxrpc_peer *peer); +extern void rxrpc_krxiod_dequeue_peer(struct rxrpc_peer *peer); +extern void rxrpc_krxiod_clear_peers(struct rxrpc_transport *trans); +extern void rxrpc_krxiod_queue_call(struct rxrpc_call *call); +extern void rxrpc_krxiod_dequeue_call(struct rxrpc_call *call); + +#endif /* _LINUX_RXRPC_KRXIOD_H */ diff --git a/include/rxrpc/krxsecd.h b/include/rxrpc/krxsecd.h new file mode 100644 index 000000000000..55ce43a25b38 --- /dev/null +++ b/include/rxrpc/krxsecd.h @@ -0,0 +1,22 @@ +/* krxsecd.h: Rx RPC security kernel thread interface + * + * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.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. + */ + +#ifndef _LINUX_RXRPC_KRXSECD_H +#define _LINUX_RXRPC_KRXSECD_H + +#include <rxrpc/types.h> + +extern int rxrpc_krxsecd_init(void); +extern void rxrpc_krxsecd_kill(void); +extern void rxrpc_krxsecd_clear_transport(struct rxrpc_transport *trans); +extern void rxrpc_krxsecd_queue_incoming_call(struct rxrpc_message *msg); + +#endif /* _LINUX_RXRPC_KRXSECD_H */ diff --git a/include/rxrpc/krxtimod.h b/include/rxrpc/krxtimod.h new file mode 100644 index 000000000000..b3d298b612f2 --- /dev/null +++ b/include/rxrpc/krxtimod.h @@ -0,0 +1,45 @@ +/* krxtimod.h: RxRPC timeout daemon + * + * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.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. + */ + +#ifndef _LINUX_RXRPC_KRXTIMOD_H +#define _LINUX_RXRPC_KRXTIMOD_H + +#include <rxrpc/types.h> + +struct rxrpc_timer_ops { + /* called when the front of the timer queue has timed out */ + void (*timed_out)(struct rxrpc_timer *timer); +}; + +/*****************************************************************************/ +/* + * RXRPC timer/timeout record + */ +struct rxrpc_timer +{ + struct list_head link; /* link in timer queue */ + unsigned long timo_jif; /* timeout time */ + const struct rxrpc_timer_ops *ops; /* timeout expiry function */ +}; + +static inline void rxrpc_timer_init(rxrpc_timer_t *timer, const struct rxrpc_timer_ops *ops) +{ + INIT_LIST_HEAD(&timer->link); + timer->ops = ops; +} + +extern int rxrpc_krxtimod_start(void); +extern void rxrpc_krxtimod_kill(void); + +extern void rxrpc_krxtimod_add_timer(rxrpc_timer_t *timer, unsigned long timeout); +extern int rxrpc_krxtimod_del_timer(rxrpc_timer_t *timer); + +#endif /* _LINUX_RXRPC_KRXTIMOD_H */ diff --git a/include/rxrpc/message.h b/include/rxrpc/message.h new file mode 100644 index 000000000000..2e43c03c6857 --- /dev/null +++ b/include/rxrpc/message.h @@ -0,0 +1,72 @@ +/* message.h: Rx message caching + * + * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.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. + */ + +#ifndef _H_3AD3363A_3A9C_11D6_83D8_0002B3163499 +#define _H_3AD3363A_3A9C_11D6_83D8_0002B3163499 + +#include <rxrpc/packet.h> + +/*****************************************************************************/ +/* + * Rx message record + */ +struct rxrpc_message +{ + atomic_t usage; + struct list_head link; /* list link */ + struct timeval stamp; /* time received or last sent */ + rxrpc_seq_t seq; /* message sequence number */ + + int state; /* the state the message is currently in */ +#define RXRPC_MSG_PREPARED 0 +#define RXRPC_MSG_SENT 1 +#define RXRPC_MSG_ACKED 2 /* provisionally ACK'd */ +#define RXRPC_MSG_DONE 3 /* definitively ACK'd (msg->seq<ack.firstPacket) */ +#define RXRPC_MSG_RECEIVED 4 +#define RXRPC_MSG_ERROR -1 + char rttdone; /* used for RTT */ + + struct rxrpc_transport *trans; /* transport received through */ + struct rxrpc_connection *conn; /* connection received over */ + struct sk_buff *pkt; /* received packet */ + off_t offset; /* offset into pkt of next byte of data */ + + struct rxrpc_header hdr; /* message header */ + + int dcount; /* data part count */ + size_t dsize; /* data size */ +#define RXRPC_MSG_MAX_IOCS 8 + struct iovec data[RXRPC_MSG_MAX_IOCS]; /* message data */ + unsigned long dfree; /* bit mask indicating kfree(data[x]) if T */ +}; + +#define rxrpc_get_message(M) do { atomic_inc(&(M)->usage); } while(0) + +extern void __rxrpc_put_message(struct rxrpc_message *msg); +static inline void rxrpc_put_message(struct rxrpc_message *msg) +{ + if (atomic_read(&msg->usage)<=0) + BUG(); + if (atomic_dec_and_test(&msg->usage)) + __rxrpc_put_message(msg); +} + +extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn, + struct rxrpc_call *call, + u8 type, + int count, + struct iovec diov[], + int alloc_flags, + struct rxrpc_message **_msg); + +extern int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg); + +#endif /* _H_3AD3363A_3A9C_11D6_83D8_0002B3163499 */ diff --git a/include/rxrpc/packet.h b/include/rxrpc/packet.h new file mode 100644 index 000000000000..78999077f5b8 --- /dev/null +++ b/include/rxrpc/packet.h @@ -0,0 +1,128 @@ +/* packet.h: Rx packet layout and definitions + * + * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.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. + */ + +#ifndef _LINUX_RXRPC_PACKET_H +#define _LINUX_RXRPC_PACKET_H + +#include <rxrpc/types.h> + +#define RXRPC_IPUDP_SIZE 28 +extern size_t RXRPC_MAX_PACKET_SIZE; +#define RXRPC_MAX_PACKET_DATA_SIZE (RXRPC_MAX_PACKET_SIZE - sizeof(struct rxrpc_header)) +#define RXRPC_LOCAL_PACKET_SIZE RXRPC_MAX_PACKET_SIZE +#define RXRPC_REMOTE_PACKET_SIZE (576 - RXRPC_IPUDP_SIZE) + +/*****************************************************************************/ +/* + * on-the-wire Rx packet header + * - all multibyte fields should be in network byte order + */ +struct rxrpc_header +{ + u32 epoch; /* client boot timestamp */ + + u32 cid; /* connection and channel ID */ +#define RXRPC_MAXCALLS 4 /* max active calls per conn */ +#define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */ +#define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */ +#define RXRPC_CIDSHIFT 2 /* shift for connection ID */ + + u32 callNumber; /* call ID (0 for connection-level packets) */ +#define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */ + + u32 seq; /* sequence number of pkt in call stream */ + u32 serial; /* serial number of pkt sent to network */ + + u8 type; /* packet type */ +#define RXRPC_PACKET_TYPE_DATA 1 /* data */ +#define RXRPC_PACKET_TYPE_ACK 2 /* ACK */ +#define RXRPC_PACKET_TYPE_BUSY 3 /* call reject */ +#define RXRPC_PACKET_TYPE_ABORT 4 /* call/connection abort */ +#define RXRPC_PACKET_TYPE_ACKALL 5 /* ACK all outstanding packets on call */ +#define RXRPC_PACKET_TYPE_CHALLENGE 6 /* connection security challenge (SRVR->CLNT) */ +#define RXRPC_PACKET_TYPE_RESPONSE 7 /* connection secutity response (CLNT->SRVR) */ +#define RXRPC_PACKET_TYPE_DEBUG 8 /* debug info request */ +#define RXRPC_N_PACKET_TYPES 9 /* number of packet types (incl type 0) */ + + u8 flags; /* packet flags */ +#define RXRPC_CLIENT_INITIATED 0x01 /* signifies a packet generated by a client */ +#define RXRPC_REQUEST_ACK 0x02 /* request an unconditional ACK of this packet */ +#define RXRPC_LAST_PACKET 0x04 /* the last packet from this side for this call */ +#define RXRPC_MORE_PACKETS 0x08 /* more packets to come */ +#define RXRPC_JUMBO_PACKET 0x20 /* [DATA] this is a jumbo packet */ +#define RXRPC_SLOW_START_OK 0x20 /* [ACK] slow start supported */ + + u8 userStatus; /* app-layer defined status */ + u8 securityIndex; /* security protocol ID */ + u16 _rsvd; /* reserved (used by kerberos security as cksum) */ + u16 serviceId; /* service ID */ + +} __attribute__((packed)); + +#define __rxrpc_header_off(X) offsetof(struct rxrpc_header,X) + +extern const char *rxrpc_pkts[]; + +/*****************************************************************************/ +/* + * jumbo packet secondary header + * - can be mapped to read header by: + * - new_serial = serial + 1 + * - new_seq = seq + 1 + * - new_flags = j_flags + * - new__rsvd = j__rsvd + * - duplicating all other fields + */ +struct rxrpc_jumbo_header +{ + u8 flags; /* packet flags (as per rxrpc_header) */ + u8 pad; + u16 _rsvd; /* reserved (used by kerberos security as cksum) */ +}; + +#define RXRPC_JUMBO_DATALEN 1412 /* non-terminal jumbo packet data length */ + +/*****************************************************************************/ +/* + * on-the-wire Rx ACK packet data payload + * - all multibyte fields should be in network byte order + */ +struct rxrpc_ackpacket +{ + u16 bufferSpace; /* number of packet buffers available */ + u16 maxSkew; /* diff between serno being ACK'd and highest serial no received */ + u32 firstPacket; /* sequence no of first ACK'd packet in attached list */ + u32 previousPacket; /* sequence no of previous packet received */ + u32 serial; /* serial no of packet that prompted this ACK */ + + u8 reason; /* reason for ACK */ +#define RXRPC_ACK_REQUESTED 1 /* ACK was requested on packet */ +#define RXRPC_ACK_DUPLICATE 2 /* duplicate packet received */ +#define RXRPC_ACK_OUT_OF_SEQUENCE 3 /* out of sequence packet received */ +#define RXRPC_ACK_EXCEEDS_WINDOW 4 /* packet received beyond end of ACK window */ +#define RXRPC_ACK_NOSPACE 5 /* packet discarded due to lack of buffer space */ +#define RXRPC_ACK_PING 6 /* keep alive ACK */ +#define RXRPC_ACK_PING_RESPONSE 7 /* response to RXRPC_ACK_PING */ +#define RXRPC_ACK_DELAY 8 /* nothing happened since received packet */ +#define RXRPC_ACK_IDLE 9 /* ACK due to fully received ACK window */ + + u8 nAcks; /* number of ACKs */ +#define RXRPC_MAXACKS 255 + + u8 acks[0]; /* list of ACK/NAKs */ +#define RXRPC_ACK_TYPE_NACK 0 +#define RXRPC_ACK_TYPE_ACK 1 + +} __attribute__((packed)); + +extern const char *rxrpc_acks[]; + +#endif /* _LINUX_RXRPC_PACKET_H */ diff --git a/include/rxrpc/peer.h b/include/rxrpc/peer.h new file mode 100644 index 000000000000..9f09bc95a40f --- /dev/null +++ b/include/rxrpc/peer.h @@ -0,0 +1,80 @@ +/* peer.h: Rx RPC per-transport peer record + * + * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.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. + */ + +#ifndef _LINUX_RXRPC_PEER_H +#define _LINUX_RXRPC_PEER_H + +#include <linux/wait.h> +#include <rxrpc/types.h> +#include <rxrpc/krxtimod.h> + +struct rxrpc_peer_ops +{ + /* peer record being added */ + int (*adding)(struct rxrpc_peer *peer); + + /* peer record being discarded from graveyard */ + void (*discarding)(struct rxrpc_peer *peer); + + /* change of epoch detected on connection */ + void (*change_of_epoch)(struct rxrpc_connection *conn); +}; + +/*****************************************************************************/ +/* + * Rx RPC per-transport peer record + * - peers only retain a refcount on the transport when they are active + * - peers with refcount==0 are inactive and reside in the transport's graveyard + */ +struct rxrpc_peer +{ + atomic_t usage; + struct rxrpc_peer_ops *ops; /* operations on this peer */ + struct rxrpc_transport *trans; /* owner transport */ + struct rxrpc_timer timeout; /* timeout for grave destruction */ + struct list_head link; /* link in transport's peer list */ + struct list_head proc_link; /* link in /proc list */ + rwlock_t conn_lock; /* lock for connections */ + struct list_head conn_active; /* active connections to/from this peer */ + struct list_head conn_graveyard; /* graveyard for inactive connections */ + spinlock_t conn_gylock; /* lock for conn_graveyard */ + wait_queue_head_t conn_gy_waitq; /* wait queue hit when graveyard is empty */ + atomic_t conn_count; /* number of attached connections */ + struct in_addr addr; /* remote address */ + size_t if_mtu; /* interface MTU for this peer */ + spinlock_t lock; /* access lock */ + + void *user; /* application layer data */ + + /* calculated RTT cache */ +#define RXRPC_RTT_CACHE_SIZE 32 + suseconds_t rtt; /* current RTT estimate (in uS) */ + unsigned short rtt_point; /* next entry at which to insert */ + unsigned short rtt_usage; /* amount of cache actually used */ + suseconds_t rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* calculated RTT cache */ +}; + + +extern int rxrpc_peer_lookup(struct rxrpc_transport *trans, + u32 addr, + struct rxrpc_peer **_peer); + +static inline void rxrpc_get_peer(struct rxrpc_peer *peer) +{ + if (atomic_read(&peer->usage)<0) + BUG(); + atomic_inc(&peer->usage); + //printk("rxrpc_get_peer(%p{u=%d})\n",peer,atomic_read(&peer->usage)); +} + +extern void rxrpc_put_peer(struct rxrpc_peer *peer); + +#endif /* _LINUX_RXRPC_PEER_H */ diff --git a/include/rxrpc/rxrpc.h b/include/rxrpc/rxrpc.h new file mode 100644 index 000000000000..454d59933675 --- /dev/null +++ b/include/rxrpc/rxrpc.h @@ -0,0 +1,29 @@ +/* rx.h: Rx RPC interface + * + * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.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. + */ + +#ifndef _LINUX_RXRPC_RXRPC_H +#define _LINUX_RXRPC_RXRPC_H + +#ifdef __KERNEL__ + +extern u32 rxrpc_epoch; + +extern int rxrpc_ktrace; +extern int rxrpc_kdebug; +extern int rxrpc_kproto; +extern int rxrpc_knet; + +extern int rxrpc_sysctl_init(void); +extern void rxrpc_sysctl_cleanup(void); + +#endif /* __KERNEL__ */ + +#endif /* _LINUX_RXRPC_RXRPC_H */ diff --git a/include/rxrpc/transport.h b/include/rxrpc/transport.h new file mode 100644 index 000000000000..b9c225533158 --- /dev/null +++ b/include/rxrpc/transport.h @@ -0,0 +1,115 @@ +/* transport.h: Rx transport management + * + * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.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. + */ + +#ifndef _LINUX_RXRPC_TRANSPORT_H +#define _LINUX_RXRPC_TRANSPORT_H + +#include <rxrpc/types.h> +#include <rxrpc/krxiod.h> +#include <rxrpc/rxrpc.h> +#include <linux/skbuff.h> +#include <linux/rwsem.h> + +typedef int (*rxrpc_newcall_fnx_t)(struct rxrpc_call *call); + +extern wait_queue_head_t rxrpc_krxiod_wq; + +/*****************************************************************************/ +/* + * Rx operation specification + * - tables of these must be sorted by op ID so that they can be binary-chop searched + */ +struct rxrpc_operation +{ + unsigned id; /* operation ID */ + size_t asize; /* minimum size of argument block */ + const char *name; /* name of operation */ + void *user; /* initial user data */ +}; + +/*****************************************************************************/ +/* + * Rx transport service record + */ +struct rxrpc_service +{ + struct list_head link; /* link in services list on transport */ + struct module *owner; /* owner module */ + rxrpc_newcall_fnx_t new_call; /* new call handler function */ + const char *name; /* name of service */ + unsigned short service_id; /* Rx service ID */ + rxrpc_call_attn_func_t attn_func; /* call requires attention callback */ + rxrpc_call_error_func_t error_func; /* call error callback */ + rxrpc_call_aemap_func_t aemap_func; /* abort -> errno mapping callback */ + + const struct rxrpc_operation *ops_begin; /* beginning of operations table */ + const struct rxrpc_operation *ops_end; /* end of operations table */ +}; + +/*****************************************************************************/ +/* + * Rx transport endpoint record + */ +struct rxrpc_transport +{ + atomic_t usage; + struct socket *socket; /* my UDP socket */ + struct list_head services; /* services listening on this socket */ + struct list_head link; /* link in transport list */ + struct list_head proc_link; /* link in transport proc list */ + struct list_head krxiodq_link; /* krxiod attention queue link */ + spinlock_t lock; /* access lock */ + struct list_head peer_active; /* active peers connected to over this socket */ + struct list_head peer_graveyard; /* inactive peer list */ + spinlock_t peer_gylock; /* peer graveyard lock */ + wait_queue_head_t peer_gy_waitq; /* wait queue hit when peer graveyard is empty */ + rwlock_t peer_lock; /* peer list access lock */ + atomic_t peer_count; /* number of peers */ + struct rxrpc_peer_ops *peer_ops; /* default peer operations */ + unsigned short port; /* port upon which listening */ + volatile char error_rcvd; /* T if received ICMP error outstanding */ +}; + +extern struct list_head rxrpc_transports; + +extern int rxrpc_create_transport(unsigned short port, + struct rxrpc_transport **_trans); + +static inline void rxrpc_get_transport(struct rxrpc_transport *trans) +{ + if (atomic_read(&trans->usage)<=0) + BUG(); + atomic_inc(&trans->usage); + //printk("rxrpc_get_transport(%p{u=%d})\n",trans,atomic_read(&trans->usage)); +} + +extern void rxrpc_put_transport(struct rxrpc_transport *trans); + +extern int rxrpc_add_service(struct rxrpc_transport *trans, + struct rxrpc_service *srv); + +extern void rxrpc_del_service(struct rxrpc_transport *trans, + struct rxrpc_service *srv); + +#if 0 +extern int rxrpc_trans_add_connection(struct rxrpc_transport *trans, + struct rxrpc_connection *conn); +#endif + +extern void rxrpc_trans_receive_packet(struct rxrpc_transport *trans); + +extern int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans, + struct rxrpc_message *msg, + int error); + +extern void rxrpc_clear_transport(struct rxrpc_transport *trans); + +#endif /* _LINUX_RXRPC_TRANSPORT_H */ diff --git a/include/rxrpc/types.h b/include/rxrpc/types.h new file mode 100644 index 000000000000..40700bc61a6f --- /dev/null +++ b/include/rxrpc/types.h @@ -0,0 +1,39 @@ +/* types.h: Rx types + * + * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.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. + */ + +#ifndef _LINUX_RXRPC_TYPES_H +#define _LINUX_RXRPC_TYPES_H + +#include <linux/types.h> +#include <linux/list.h> +#include <linux/socket.h> +#include <linux/in.h> +#include <linux/spinlock.h> +#include <asm/atomic.h> + +typedef unsigned rxrpc_seq_t; /* Rx message sequence number */ +typedef unsigned rxrpc_serial_t; /* Rx message serial number */ + +struct rxrpc_call; +struct rxrpc_connection; +struct rxrpc_header; +struct rxrpc_message; +struct rxrpc_operation; +struct rxrpc_peer; +struct rxrpc_service; +typedef struct rxrpc_timer rxrpc_timer_t; +struct rxrpc_transport; + +typedef void (*rxrpc_call_attn_func_t)(struct rxrpc_call *call); +typedef void (*rxrpc_call_error_func_t)(struct rxrpc_call *call); +typedef void (*rxrpc_call_aemap_func_t)(struct rxrpc_call *call); + +#endif /* _LINUX_RXRPC_TYPES_H */ diff --git a/include/sound/asound.h b/include/sound/asound.h index d749d968b9fb..9e351ebaf847 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -129,7 +129,7 @@ enum { * * *****************************************************************************/ -#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 2) +#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) typedef unsigned long sndrv_pcm_uframes_t; typedef long sndrv_pcm_sframes_t; @@ -423,6 +423,7 @@ enum { SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct sndrv_pcm_sw_params), SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct sndrv_pcm_status), SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, sndrv_pcm_sframes_t), + SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22), SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct sndrv_pcm_channel_info), SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40), SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41), diff --git a/include/sound/core.h b/include/sound/core.h index 8d90674f046c..a0051adef639 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -225,7 +225,6 @@ int snd_minor_info_oss_init(void); int snd_minor_info_oss_done(void); int snd_oss_init_module(void); -void snd_oss_cleanup_module(void); #endif diff --git a/include/sound/info.h b/include/sound/info.h index 576cc37de253..b45b422063e2 100644 --- a/include/sound/info.h +++ b/include/sound/info.h @@ -164,7 +164,7 @@ static inline int snd_info_card_unregister(snd_card_t * card) { return 0; } static inline int snd_info_register(snd_info_entry_t * entry) { return 0; } static inline int snd_info_unregister(snd_info_entry_t * entry) { return 0; } -static inline struct proc_dir_entry *snd_create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent) { return 0; } +static inline struct proc_dir_entry *snd_create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent) { return NULL; } static inline void snd_remove_proc_entry(struct proc_dir_entry *parent, struct proc_dir_entry *de) { ; } @@ -174,7 +174,7 @@ static inline void snd_remove_proc_entry(struct proc_dir_entry *parent, * OSS info part */ -#ifdef CONFIG_SND_OSSEMUL +#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) #define SNDRV_OSS_INFO_DEV_AUDIO 0 #define SNDRV_OSS_INFO_DEV_SYNTH 1 @@ -187,6 +187,6 @@ static inline void snd_remove_proc_entry(struct proc_dir_entry *parent, extern int snd_oss_info_register(int dev, int num, char *string); #define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL) -#endif /* CONFIG_SND_OSSEMUL */ +#endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */ #endif /* __SOUND_INFO_H */ diff --git a/include/sound/version.h b/include/sound/version.h index ba48af7a3099..9ac82df6cf79 100644 --- a/include/sound/version.h +++ b/include/sound/version.h @@ -1,3 +1,3 @@ /* include/version.h. Generated automatically by configure. */ #define CONFIG_SND_VERSION "0.9.0rc3" -#define CONFIG_SND_DATE " (Fri Oct 04 13:09:13 2002 UTC)" +#define CONFIG_SND_DATE " (Mon Oct 14 16:41:26 2002 UTC)" |
