diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-06-22 23:05:57 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-06-22 23:05:57 +0000 |
commit | 51d3b7814cdccef9188240fe0cbd8d97ff2c7470 (patch) | |
tree | 5cbb01d0323d4f63ade66bdf48ba4a91aaa6df16 /include | |
parent | 52273a23c9a84336b93a35e4847fc88fac7eb0e4 (diff) |
Merge with Linux 2.3.7.
WARNING: 2.3.7 is known to eat filesystems for breakfast and little
children for lunch, so if you try this on your machine make backups
first ...
Diffstat (limited to 'include')
57 files changed, 578 insertions, 358 deletions
diff --git a/include/asm-arm/arch-arc/ide.h b/include/asm-arm/arch-arc/ide.h index 031225380..5729b956d 100644 --- a/include/asm-arm/arch-arc/ide.h +++ b/include/asm-arm/arch-arc/ide.h @@ -19,7 +19,8 @@ * Set up a hw structure for a specified data port, control port and IRQ. * This should follow whatever the default interface uses. */ -static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq) +static __inline__ void +ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq) { ide_ioreg_t reg = (ide_ioreg_t) data_port; int i; diff --git a/include/asm-arm/arch-ebsa285/ide.h b/include/asm-arm/arch-ebsa285/ide.h index d86a6f98a..1a09f1827 100644 --- a/include/asm-arm/arch-ebsa285/ide.h +++ b/include/asm-arm/arch-ebsa285/ide.h @@ -12,7 +12,8 @@ * Set up a hw structure for a specified data port, control port and IRQ. * This should follow whatever the default interface uses. */ -static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq) +static __inline__ void +ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int irq) { ide_ioreg_t reg = (ide_ioreg_t) data_port; int i; @@ -22,7 +23,7 @@ static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctr reg += 1; } hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port; - hw->irq = *irq; + hw->irq = irq; } /* diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h index ca1a55cdb..d8f0ab21d 100644 --- a/include/asm-arm/arch-ebsa285/irq.h +++ b/include/asm-arm/arch-ebsa285/irq.h @@ -10,7 +10,6 @@ * 26-Jan-1999 PJB Don't use IACK on CATS * 16-Mar-1999 RMK Added autodetect of ISA PICs */ -#include <linux/config.h> #include <asm/hardware.h> #include <asm/dec21285.h> #include <asm/irq.h> diff --git a/include/asm-arm/arch-ebsa285/memory.h b/include/asm-arm/arch-ebsa285/memory.h index a03cea639..745750e3b 100644 --- a/include/asm-arm/arch-ebsa285/memory.h +++ b/include/asm-arm/arch-ebsa285/memory.h @@ -15,8 +15,6 @@ #ifndef __ASM_ARCH_MMU_H #define __ASM_ARCH_MMU_H -#include <linux/config.h> - #if defined(CONFIG_HOST_FOOTBRIDGE) /* diff --git a/include/asm-arm/arch-ebsa285/system.h b/include/asm-arm/arch-ebsa285/system.h index a8f94c198..4f3850b44 100644 --- a/include/asm-arm/arch-ebsa285/system.h +++ b/include/asm-arm/arch-ebsa285/system.h @@ -20,16 +20,7 @@ extern __inline__ void arch_reset(char mode) mcr p15, 0, ip, c7, c7 @ flush caches mov pc, lr" : : : "cc"); } else { - if (machine_is_ebsa285() || machine_is_co285()) { - /* To reboot, we set up the 21285 watchdog and - * enable it. We then wait for it to timeout. - */ - *CSR_TIMER4_LOAD = 0x8000; - *CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE | - TIMER_CNTL_AUTORELOAD | - TIMER_CNTL_DIV16; - *CSR_SA110_CNTL |= 1 << 13; - } else if (machine_is_netwinder()) { + if (machine_is_netwinder()) { /* open up the SuperIO chip */ outb(0x87, 0x370); @@ -48,6 +39,15 @@ extern __inline__ void arch_reset(char mode) /* set a RED LED and toggle WD_TIMER for rebooting */ outb(0xc4, 0x338); + } else { + /* To reboot, we set up the 21285 watchdog and + * enable it. We then wait for it to timeout. + */ + *CSR_TIMER4_LOAD = 0x8000; + *CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE | + TIMER_CNTL_AUTORELOAD | + TIMER_CNTL_DIV16; + *CSR_SA110_CNTL |= 1 << 13; } } } diff --git a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h index ed70ecf25..7c5cd89c4 100644 --- a/include/asm-arm/arch-ebsa285/time.h +++ b/include/asm-arm/arch-ebsa285/time.h @@ -333,7 +333,7 @@ extern __inline__ void setup_timer(void) set_rtc_mmss = set_dummy_time; } - if (machine_is_ebsa285()) { + if (machine_is_ebsa285() || machine_is_co285()) { gettimeoffset = timer1_gettimeoffset; *CSR_TIMER1_CLR = 0; diff --git a/include/asm-arm/arch-rpc/ide.h b/include/asm-arm/arch-rpc/ide.h index 9826f15f5..ccbc7cf76 100644 --- a/include/asm-arm/arch-rpc/ide.h +++ b/include/asm-arm/arch-rpc/ide.h @@ -12,30 +12,31 @@ * Set up a hw structure for a specified data port, control port and IRQ. * This should follow whatever the default interface uses. */ -static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq) +static __inline__ void +ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int irq) { ide_ioreg_t reg = (ide_ioreg_t) data_port; int i; + memset(hw, 0, sizeof(*hw)); + for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { hw->io_ports[i] = reg; reg += 1; } hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port; - hw->irq = *irq; + hw->irq = irq; } /* * This registers the standard ports for this architecture with the IDE * driver. */ -static __inline__ void ide_init_default_hwifs(void) +static __inline__ void +ide_init_default_hwifs(void) { hw_regs_t hw; - memset(hw, 0, sizeof(*hw)); - - ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL); - hw.irq = IRQ_HARDDISK; + ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, IRQ_HARDDISK); ide_register_hw(&hw, NULL); } diff --git a/include/asm-arm/current.h b/include/asm-arm/current.h index 9f08dae30..01e20e285 100644 --- a/include/asm-arm/current.h +++ b/include/asm-arm/current.h @@ -4,17 +4,19 @@ static inline unsigned long get_sp(void) { unsigned long sp; - __asm__ ("mov %0,sp" : "=r" (sp)); + __asm__ ("mov %0,sp" : "=r" (sp)); return sp; } +//static inline struct task_struct *get_current(void) __attribute__ (( __const__ )); + static inline struct task_struct *get_current(void) { struct task_struct *ts; - __asm__ __volatile__(" - bic %0, sp, #0x1f00 - bic %0, %0, #0x00ff - " : "=r" (ts)); + __asm__ __volatile__ ( + "bic %0, sp, #0x1f00 @ get_current + bic %0, %0, #0x00ff" + : "=r" (ts)); return ts; } diff --git a/include/asm-arm/dma.h b/include/asm-arm/dma.h index 46d7cab05..bc7d03ddd 100644 --- a/include/asm-arm/dma.h +++ b/include/asm-arm/dma.h @@ -119,6 +119,10 @@ extern void set_dma_count(dmach_t channel, unsigned long count); */ extern void set_dma_mode(dmach_t channel, dmamode_t mode); +/* Set the transfer speed for this channel + */ +extern void set_dma_speed(dmach_t channel, int cycle_ns); + /* Get DMA residue count. After a DMA transfer, this * should return zero. Reading this while a DMA transfer is * still in progress will return unpredictable results. diff --git a/include/asm-arm/ide.h b/include/asm-arm/ide.h index 6bd9d3c02..5b898dfee 100644 --- a/include/asm-arm/ide.h +++ b/include/asm-arm/ide.h @@ -46,6 +46,13 @@ typedef union { #define ide_release_lock(lock) do {} while (0) #define ide_get_lock(lock, hdlr, data) do {} while (0) +/* + * We always use the new IDE port registering, + * so these are fixed here. + */ +#define ide_default_io_base(i) ((ide_ioreg_t)0) +#define ide_default_irq(b) (0) + #endif /* __KERNEL__ */ #endif /* __ASMARM_IDE_H */ diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index cfa021bcd..35db8e667 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h @@ -189,21 +189,10 @@ __IO(l,"",long) #define inl_p(port) __inl_p((port)) #endif -/* Nothing to do */ - -#ifndef dma_cache_inv -#define dma_cache_inv(_start,_size) do { } while (0) -#endif -#ifndef dma_cache_wback -#define dma_cache_wback(_start,_size) do { } while (0) -#ifndef ARCH_READWRITE -#ifndef dma_cache_wback_inv -#define dma_cache_wback_inv(_start,_size) do { } while (0) #endif -#endif /* __KERNEL__ */ +#ifndef ARCH_READWRITE -#endif /* __ASM_ARM_IO_H */ /* for panic */ #include <linux/kernel.h> diff --git a/include/asm-arm/irq.h b/include/asm-arm/irq.h index 9bdd7e00e..ce5930243 100644 --- a/include/asm-arm/irq.h +++ b/include/asm-arm/irq.h @@ -24,8 +24,5 @@ extern void disable_irq(unsigned int); extern void enable_irq(unsigned int); -#define __STR(x) #x -#define STR(x) __STR(x) - #endif diff --git a/include/asm-arm/proc-armo/ptrace.h b/include/asm-arm/proc-armo/ptrace.h index f53aa229d..513501b7d 100644 --- a/include/asm-arm/proc-armo/ptrace.h +++ b/include/asm-arm/proc-armo/ptrace.h @@ -44,6 +44,8 @@ struct pt_regs { #define CC_Z_BIT (1 << 30) #define CC_N_BIT (1 << 31) +#ifdef __KERNEL__ + #define processor_mode(regs) \ ((regs)->ARM_pc & MODE_MASK) @@ -70,11 +72,19 @@ struct pt_regs { */ static inline int valid_user_regs(struct pt_regs *regs) { - if (!user_mode(regs) || regs->ARM_pc & (F_BIT | I_BIT)) + if (user_mode(regs) && + (regs->ARM_pc & (F_BIT | I_BIT)) == 0) return 1; + /* + * force it to be something sensible + */ + regs->ARM_pc &= ~(MODE_MASK | F_BIT | I_BIT); + return 0; } +#endif /* __KERNEL__ */ + #endif diff --git a/include/asm-arm/proc-armo/semaphore.h b/include/asm-arm/proc-armo/semaphore.h index 9cd99cf50..19fa29bf9 100644 --- a/include/asm-arm/proc-armo/semaphore.h +++ b/include/asm-arm/proc-armo/semaphore.h @@ -14,13 +14,13 @@ extern inline void down(struct semaphore * sem) @ atomic down operation mov r0, pc orr lr, r0, #0x08000000 - and r0, r0, #0x0c000003 teqp lr, #0 ldr lr, [%0] + and r0, r0, #0x0c000003 subs lr, lr, #1 str lr, [%0] - mov lr, pc, lsr #28 - teqp r0, lr, lsl #28 + orrmi r0, r0, #0x80000000 @ set N + teqp r0, #0 movmi r0, %0 blmi " SYMBOL_NAME_STR(__down_failed) : @@ -39,14 +39,13 @@ extern inline int down_interruptible (struct semaphore * sem) @ atomic down operation mov r0, pc orr lr, r0, #0x08000000 - and r0, r0, #0x0c000003 teqp lr, #0 ldr lr, [%1] + and r0, r0, #0x0c000003 subs lr, lr, #1 str lr, [%1] - mov lr, pc, lsr #28 orrmi r0, r0, #0x80000000 @ set N - teqp r0, lr, lsl #28 + teqp r0, #0 movmi r0, %1 movpl r0, #0 blmi " SYMBOL_NAME_STR(__down_interruptible_failed) " @@ -64,14 +63,13 @@ extern inline int down_trylock(struct semaphore * sem) @ atomic down operation mov r0, pc orr lr, r0, #0x08000000 - and r0, r0, #0x0c000003 teqp lr, #0 ldr lr, [%1] + and r0, r0, #0x0c000003 subs lr, lr, #1 str lr, [%1] - mov lr, pc, lsr #28 orrmi r0, r0, #0x80000000 @ set N - teqp r0, lr, lsl #28 + teqp r0, #0 movmi r0, %1 movpl r0, #0 blmi " SYMBOL_NAME_STR(__down_trylock_failed) " @@ -94,14 +92,13 @@ extern inline void up(struct semaphore * sem) @ atomic up operation mov r0, pc orr lr, r0, #0x08000000 - and r0, r0, #0x0c000003 teqp lr, #0 ldr lr, [%0] + and r0, r0, #0x0c000003 adds lr, lr, #1 str lr, [%0] - mov lr, pc, lsr #28 - orrls r0, r0, #0x80000000 @ set N - teqp r0, lr, lsl #28 + orrle r0, r0, #0x80000000 @ set N + teqp r0, #0 movmi r0, %0 blmi " SYMBOL_NAME_STR(__up_wakeup) : diff --git a/include/asm-arm/proc-armo/system.h b/include/asm-arm/proc-armo/system.h index 471daf654..733a6cdff 100644 --- a/include/asm-arm/proc-armo/system.h +++ b/include/asm-arm/proc-armo/system.h @@ -110,6 +110,12 @@ extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int : "memory"); \ } while (0) +/* For spinlocks etc */ +#define local_irq_save(x) __save_flags_cli(x) +#define local_irq_restore(x) __restore_flags(x) +#define local_irq_disable() __cli() +#define local_irq_enable() __sti() + #ifdef __SMP__ #error SMP not supported #else diff --git a/include/asm-arm/proc-armv/ptrace.h b/include/asm-arm/proc-armv/ptrace.h index b24305bd4..01f0a8ac8 100644 --- a/include/asm-arm/proc-armv/ptrace.h +++ b/include/asm-arm/proc-armv/ptrace.h @@ -52,6 +52,8 @@ struct pt_regs { #define CC_Z_BIT (1 << 30) #define CC_N_BIT (1 << 31) +#ifdef __KERNEL__ + #if 0 /* GCC/egcs should be able to optimise this, IMHO */ #define user_mode(regs) \ ((((regs)->ARM_cpsr & MODE_MASK) == USR_MODE) || \ @@ -81,8 +83,8 @@ struct pt_regs { */ static inline int valid_user_regs(struct pt_regs *regs) { - if ((regs->ARM_cpsr & 0xf) == 0 || - (regs->ARM_cpsr & (F_BIT|I_BIT))) + if ((regs->ARM_cpsr & 0xf) == 0 && + (regs->ARM_cpsr & (F_BIT|I_BIT)) == 0) return 1; /* @@ -93,5 +95,7 @@ static inline int valid_user_regs(struct pt_regs *regs) return 0; } +#endif /* __KERNEL__ */ + #endif diff --git a/include/asm-arm/proc-armv/semaphore.h b/include/asm-arm/proc-armv/semaphore.h index 52098bc5c..45ceaa3f1 100644 --- a/include/asm-arm/proc-armv/semaphore.h +++ b/include/asm-arm/proc-armv/semaphore.h @@ -16,12 +16,12 @@ extern inline void down(struct semaphore * sem) @ atomic down operation mrs %0, cpsr orr %1, %0, #128 @ disable IRQs - bic %0, %0, #0x80000000 @ clear N msr cpsr, %1 ldr %1, [%2] + bic %0, %0, #0x80000000 @ clear N subs %1, %1, #1 - orrmi %0, %0, #0x80000000 @ set N str %1, [%2] + orrmi %0, %0, #0x80000000 @ set N msr cpsr, %0 movmi r0, %2 blmi " SYMBOL_NAME_STR(__down_failed) @@ -42,12 +42,12 @@ extern inline int down_interruptible (struct semaphore * sem) @ atomic down interruptible operation mrs %0, cpsr orr %1, %0, #128 @ disable IRQs - bic %0, %0, #0x80000000 @ clear N msr cpsr, %1 ldr %1, [%2] + bic %0, %0, #0x80000000 @ clear N subs %1, %1, #1 - orrmi %0, %0, #0x80000000 @ set N str %1, [%2] + orrmi %0, %0, #0x80000000 @ set N msr cpsr, %0 movmi r0, %2 movpl r0, #0 @@ -68,12 +68,12 @@ extern inline int down_trylock(struct semaphore *sem) @ atomic down try lock operation mrs %0, cpsr orr %1, %0, #128 @ disable IRQs - bic %0, %0, #0x80000000 @ clear N msr cpsr, %1 ldr %1, [%2] + bic %0, %0, #0x80000000 @ clear N subs %1, %1, #1 - orrmi %0, %0, #0x80000000 @ set N str %1, [%2] + orrmi %0, %0, #0x80000000 @ set N msr cpsr, %0 movmi r0, %2 movpl r0, #0 @@ -100,12 +100,12 @@ extern inline void up(struct semaphore * sem) @ atomic up operation mrs %0, cpsr orr %1, %0, #128 @ disable IRQs - bic %0, %0, #0x80000000 @ clear N msr cpsr, %1 ldr %1, [%2] + bic %0, %0, #0x80000000 @ clear N adds %1, %1, #1 - orrls %0, %0, #0x80000000 @ set N str %1, [%2] + orrle %0, %0, #0x80000000 @ set N msr cpsr, %0 movmi r0, %2 blmi " SYMBOL_NAME_STR(__up_wakeup) diff --git a/include/asm-arm/proc-armv/system.h b/include/asm-arm/proc-armv/system.h index 9de0fccc5..2aa59a26e 100644 --- a/include/asm-arm/proc-armv/system.h +++ b/include/asm-arm/proc-armv/system.h @@ -121,6 +121,12 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ : "memory"); \ } while (0) +/* For spinlocks etc */ +#define local_irq_save(x) __save_flags_cli(x) +#define local_irq_restore(x) __restore_flags(x) +#define local_irq_disable() __cli() +#define local_irq_enable() __sti() + #ifdef __SMP__ #error SMP not supported #else diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h index f308d67b1..97141aa25 100644 --- a/include/asm-arm/processor.h +++ b/include/asm-arm/processor.h @@ -36,6 +36,7 @@ typedef unsigned long mm_segment_t; /* domain register */ #define NR_DEBUGS 5 +#include <asm/proc/ptrace.h> #include <asm/arch/processor.h> #include <asm/proc/processor.h> @@ -86,6 +87,7 @@ extern __inline__ void init_thread_css(struct context_save_struct *save) } /* Forward declaration, a strange C thing */ +struct task_struct; struct mm_struct; /* Free all resources held by a thread. */ diff --git a/include/asm-arm/semaphore.h b/include/asm-arm/semaphore.h index 05456d7de..111e24f96 100644 --- a/include/asm-arm/semaphore.h +++ b/include/asm-arm/semaphore.h @@ -6,6 +6,7 @@ #include <linux/linkage.h> #include <asm/atomic.h> +#include <linux/wait.h> struct semaphore { atomic_t count; @@ -13,8 +14,35 @@ struct semaphore { wait_queue_head_t wait; }; -#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), 0, NULL }) -#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), 0, NULL }) +#define __SEMAPHORE_INIT(name,count) \ + { ATOMIC_INIT(count), 0, \ + __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) } + +#define __MUTEX_INITIALIZER(name) \ + __SEMAPHORE_INIT(name,1) + +#define __DECLARE_SEMAPHORE_GENERIC(name,count) \ + struct semaphore name = __SEMAPHORE_INIT(name,count) + +#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) +#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) + +#define sema_init(sem, val) \ +do { \ + atomic_set(&((sem)->count), (val)); \ + (sem)->waking = 0; \ + init_waitqueue_head(&(sem)->wait); \ +} while (0) + +static inline void init_MUTEX(struct semaphore *sem) +{ + sema_init(sem, 1); +} + +static inline void init_MUTEX_LOCKED(struct semaphore *sem) +{ + sema_init(sem, 0); +} asmlinkage void __down_failed (void /* special register calling convention */); asmlinkage int __down_interruptible_failed (void /* special register calling convention */); @@ -26,7 +54,7 @@ extern int __down_interruptible(struct semaphore * sem); extern int __down_trylock(struct semaphore * sem); extern void __up(struct semaphore * sem); -#define sema_init(sem, val) atomic_set(&((sem)->count), (val)) +extern spinlock_t semaphore_wake_lock; #include <asm/proc/semaphore.h> diff --git a/include/asm-arm/softirq.h b/include/asm-arm/softirq.h index 6bad79dd4..28ac2eb2a 100644 --- a/include/asm-arm/softirq.h +++ b/include/asm-arm/softirq.h @@ -5,10 +5,18 @@ #include <asm/hardirq.h> extern unsigned int local_bh_count[NR_CPUS]; -#define in_bh() (local_bh_count[smp_processor_id()] != 0) + +#define cpu_bh_disable(cpu) do { local_bh_count[(cpu)]++; barrier(); } while (0) +#define cpu_bh_enable(cpu) do { barrier(); local_bh_count[(cpu)]--; } while (0) + +#define cpu_bh_trylock(cpu) (local_bh_count[(cpu)] ? 0 : (local_bh_count[(cpu)] = 1)) +#define cpu_bh_endlock(cpu) (local_bh_count[(cpu)] = 0) + +#define local_bh_disable() cpu_bh_disable(smp_processor_id()) +#define local_bh_enable() cpu_bh_enable(smp_processor_id()) #define get_active_bhs() (bh_mask & bh_active) -#define clear_active_bhs(x) atomic_clear_mask((int)(x),&bh_active) +#define clear_active_bhs(x) atomic_clear_mask((x),&bh_active) extern inline void init_bh(int nr, void (*routine)(void)) { @@ -19,8 +27,9 @@ extern inline void init_bh(int nr, void (*routine)(void)) extern inline void remove_bh(int nr) { - bh_base[nr] = NULL; bh_mask &= ~(1 << nr); + mb(); + bh_base[nr] = NULL; } extern inline void mark_bh(int nr) @@ -34,20 +43,20 @@ extern inline void mark_bh(int nr) extern inline void start_bh_atomic(void) { - local_bh_count[smp_processor_id()]++; + local_bh_disable(); barrier(); } extern inline void end_bh_atomic(void) { barrier(); - local_bh_count[smp_processor_id()]--; + local_bh_enable(); } /* These are for the irq's testing the lock */ -#define softirq_trylock(cpu) (in_bh() ? 0 : (local_bh_count[smp_processor_id()]=1)) -#define softirq_endlock(cpu) (local_bh_count[smp_processor_id()] = 0) -#define synchronize_bh() do { } while (0) +#define softirq_trylock(cpu) (cpu_bh_trylock(cpu)) +#define softirq_endlock(cpu) (cpu_bh_endlock(cpu)) +#define synchronize_bh() barrier() #endif /* SMP */ diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h index 33e1fe183..74022ebae 100644 --- a/include/asm-arm/spinlock.h +++ b/include/asm-arm/spinlock.h @@ -1,39 +1,96 @@ #ifndef __ASM_SPINLOCK_H #define __ASM_SPINLOCK_H -#ifndef __SMP__ - /* * To be safe, we assume the only compiler that can cope with * empty initialisers is EGCS. */ #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 90)) -#define EMPTY_INIT_OK +#define EMPTY_STRUCT struct { } +#define EMPTY_STRUCT_INIT(t) (t) { } +#else +#define EMPTY_STRUCT unsigned char +#define EMPTY_STRUCT_INIT(t) (t) 0 #endif /* + * These are the generic versions of the spinlocks + * and read-write locks.. We should actually do a + * <linux/spinlock.h> with all of this. Oh, well. + */ +#define spin_lock_irqsave(lock, flags) do { local_irq_save(flags); spin_lock(lock); } while (0) +#define spin_lock_irq(lock) do { local_irq_disable(); spin_lock(lock); } while (0) +#define spin_lock_bh(lock) do { local_bh_disable(); spin_lock(lock); } while (0) + +#define read_lock_irqsave(lock, flags) do { local_irq_save(flags); read_lock(lock); } while (0) +#define read_lock_irq(lock) do { local_irq_disable(); read_lock(lock); } while (0) +#define read_lock_bh(lock) do { local_bh_disable(); read_lock(lock); } while (0) + +#define write_lock_irqsave(lock, flags) do { local_irq_save(flags); write_lock(lock); } while (0) +#define write_lock_irq(lock) do { local_irq_disable(); write_lock(lock); } while (0) +#define write_lock_bh(lock) do { local_bh_disable(); write_lock(lock); } while (0) + +#define spin_unlock_irqrestore(lock, flags) do { spin_unlock(lock); local_irq_restore(flags); } while (0) +#define spin_unlock_irq(lock) do { spin_unlock(lock); local_irq_enable(); } while (0) +#define spin_unlock_bh(lock) do { spin_unlock(lock); local_bh_enable(); } while (0) + +#define read_unlock_irqrestore(lock, flags) do { read_unlock(lock); local_irq_restore(flags); } while (0) +#define read_unlock_irq(lock) do { read_unlock(lock); local_irq_enable(); } while (0) +#define read_unlock_bh(lock) do { read_unlock(lock); local_bh_enable(); } while (0) + +#define write_unlock_irqrestore(lock, flags) do { write_unlock(lock); local_irq_restore(flags); } while (0) +#define write_unlock_irq(lock) do { write_unlock(lock); local_irq_enable(); } while (0) +#define write_unlock_bh(lock) do { write_unlock(lock); local_bh_enable(); } while (0) + +#ifndef __SMP__ + +#define DEBUG_SPINLOCKS 0 /* 0 == no debugging, 1 == maintain lock state, 2 == full debugging */ + +#if (DEBUG_SPINLOCKS < 1) +/* * Your basic spinlocks, allowing only a single CPU anywhere */ -#ifdef EMPTY_INIT_OK - typedef struct { } spinlock_t; -# define SPIN_LOCK_UNLOCKED (spinlock_t) { } -#else - typedef unsigned char spinlock_t; -# define SPIN_LOCK_UNLOCKED 0 -#endif +typedef EMPTY_STRUCT spinlock_t; +#define SPIN_LOCK_UNLOCKED EMPTY_STRUCT_INIT(spinlock_t) #define spin_lock_init(lock) do { } while(0) #define spin_lock(lock) do { } while(0) -#define spin_trylock(lock) do { } while(0) +#define spin_trylock(lock) (1) #define spin_unlock_wait(lock) do { } while(0) #define spin_unlock(lock) do { } while(0) -#define spin_lock_irq(lock) cli() -#define spin_unlock_irq(lock) sti() -#define spin_lock_irqsave(lock, flags) \ - do { __save_flags_cli(flags); } while (0) -#define spin_unlock_irqrestore(lock, flags) \ - restore_flags(flags) +#elif (DEBUG_SPINLOCKS < 2) + +typedef struct { + volatile unsigned int lock; +} spinlock_t; +#define SPIN_LOCK_UNLOCKED (pinlock_t) { 0 } + +#define spin_lock_init(x) do { (x)->lock = 0; } while (0) +#define spin_lock(x) do { (x)->lock = 1; } while (0) +#define spin_trylock(lock) (!test_and_set_bit(0,(lock))) +#define spin_unlock_wait(x) do { } while (0) +#define spin_unlock(x) do { (x)->lock = 0; } while (0) + +#else /* (DEBUG_SPINLOCKS >= 2) */ + +typedef struct { + volatule unsigned int lock; + volatile unsigned int babble; + const char *module; +} spinlock_t; +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 25, __BASE_FILE__ } + +#include <linux/kernel.h> + +#define spin_lock_init(x) do { (x)->lock = 0; } while (0) +#define spin_trylock(lock) (!test_and_set_bit(0,(lock))) + +#define spin_lock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_lock(%s:%p) already locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 1; restore_flags(__spinflags);} while (0) +#define spin_unlock_wait(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock_wait(%s:%p) deadlock\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} restore_flags(__spinflags);} while (0) +#define spin_unlock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if (!(x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock(%s:%p) not locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 0; restore_flags(__spinflags);} while (0) + +#endif /* * Read-write spinlocks, allowing multiple readers @@ -45,31 +102,13 @@ * irq-safe write-lock, but readers can get non-irqsafe * read-locks. */ -#ifdef EMPTY_INIT_OK - typedef struct { } rwlock_t; -# define RW_LOCK_UNLOCKED (rwlock_t) { } -#else - typedef unsigned char rwlock_t; -# define RW_LOCK_UNLOCKED 0 -#endif +typedef EMPTY_STRUCT rwlock_t; +#define RW_LOCK_UNLOCKED EMPTY_STRUCT_INIT(rwlock_t) #define read_lock(lock) do { } while(0) #define read_unlock(lock) do { } while(0) #define write_lock(lock) do { } while(0) #define write_unlock(lock) do { } while(0) -#define read_lock_irq(lock) cli() -#define read_unlock_irq(lock) sti() -#define write_lock_irq(lock) cli() -#define write_unlock_irq(lock) sti() - -#define read_lock_irqsave(lock, flags) \ - do { __save_flags_cli(flags); } while (0) -#define read_unlock_irqrestore(lock, flags) \ - restore_flags(flags) -#define write_lock_irqsave(lock, flags) \ - do { __save_flags_cli(flags); } while (0) -#define write_unlock_irqrestore(lock, flags) \ - restore_flags(flags) #else #error ARM architecture does not support spin locks diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 2874c4661..80252899d 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -35,7 +35,7 @@ extern unsigned int __machine_arch_type; /* * Sort out a definition for machine_arch_type - * The rules basically are: + * The rules are: * 1. If one architecture is selected, then all machine_is_xxx() * are constant. * 2. If two or more architectures are selected, then the selected @@ -118,28 +118,16 @@ extern unsigned int __machine_arch_type; #define machine_arch_type __machine_arch_type #endif -/* - * task_struct isn't always declared - forward-declare it here. - */ -struct task_struct; - #include <asm/proc-fns.h> -extern void arm_malalignedptr(const char *, void *, volatile void *); -extern void arm_invalidptr(const char *, int); - #define xchg(ptr,x) \ ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) #define tas(ptr) (xchg((ptr),1)) -/* - * switch_to(prev, next) should switch from task `prev' to `next' - * `prev' will never be the same as `next'. - * - * `next' and `prev' should be struct task_struct, but it isn't always defined - */ -#define switch_to(prev,next,last) do { last = processor._switch_to(prev,next); } while (0) +extern void arm_malalignedptr(const char *, void *, volatile void *); +extern void arm_invalidptr(const char *, int); +extern asmlinkage void __backtrace(void); /* * Include processor dependent parts @@ -152,7 +140,16 @@ extern void arm_invalidptr(const char *, int); #define wmb() mb() #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); -extern asmlinkage void __backtrace(void); +/* + * switch_to(prev, next) should switch from task `prev' to `next' + * `prev' will never be the same as `next'. + * The `mb' is to tell GCC not to cache `current' across this call. + */ +#define switch_to(prev,next,last) \ + do { \ + last = processor._switch_to(prev,next); \ + mb(); \ + } while (0) #endif diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index 86c0c2883..f4a7ed33a 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h @@ -59,7 +59,7 @@ #define __NR_geteuid (__NR_SYSCALL_BASE+ 49) #define __NR_getegid (__NR_SYSCALL_BASE+ 50) #define __NR_acct (__NR_SYSCALL_BASE+ 51) -#define __NR_phys (__NR_SYSCALL_BASE+ 52) +#define __NR_umount2 (__NR_SYSCALL_BASE+ 52) #define __NR_lock (__NR_SYSCALL_BASE+ 53) #define __NR_ioctl (__NR_SYSCALL_BASE+ 54) #define __NR_fcntl (__NR_SYSCALL_BASE+ 55) diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index 0490404b7..847dffbd0 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h @@ -84,6 +84,19 @@ typedef unsigned long pgprot_t; #define __PAGE_OFFSET (PAGE_OFFSET_RAW) +#ifndef __ASSEMBLY__ + +#define BUG() do { \ + printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ + __asm__ __volatile__(".byte 0x0f,0x0b"); \ +} while (0) + +#define PAGE_BUG(page) do { \ + BUG(); \ +} while (0) + +#endif /* __ASSEMBLY__ */ + #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) diff --git a/include/asm-i386/smplock.h b/include/asm-i386/smplock.h index 73c9cf927..4d44a2919 100644 --- a/include/asm-i386/smplock.h +++ b/include/asm-i386/smplock.h @@ -49,6 +49,8 @@ extern __inline__ void lock_kernel(void) extern __inline__ void unlock_kernel(void) { + if (current->lock_depth < 0) + BUG(); __asm__ __volatile__( "decl %1\n\t" "jns 9f\n\t" diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index 397e9b008..c24112ea1 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h @@ -1,4 +1,4 @@ -/* $Id: page.h,v 1.5 1998/08/28 23:24:03 tsbogend Exp $ +/* $Id: page.h,v 1.6 1999/01/04 16:09:24 ralf Exp $ * * Definitions for page handling * @@ -6,7 +6,7 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 1994 - 1998 by Ralf Baechle + * Copyright (C) 1994 - 1999 by Ralf Baechle */ #ifndef __ASM_MIPS_PAGE_H #define __ASM_MIPS_PAGE_H @@ -22,6 +22,9 @@ #ifndef _LANGUAGE_ASSEMBLY +#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0=0; } while (0) +#define PAGE_BUG(page) do { BUG(); } while (0) + extern void (*clear_page)(unsigned long page); extern void (*copy_page)(unsigned long to, unsigned long from); diff --git a/include/asm-sparc/namei.h b/include/asm-sparc/namei.h index e03f86c75..89cd1c3a9 100644 --- a/include/asm-sparc/namei.h +++ b/include/asm-sparc/namei.h @@ -1,4 +1,4 @@ -/* $Id: namei.h,v 1.13 1999/04/06 06:54:36 jj Exp $ +/* $Id: namei.h,v 1.14 1999/06/10 05:23:12 davem Exp $ * linux/include/asm-sparc/namei.h * * Routines to handle famous /usr/gnemul/s*. diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h index 57e46e7b0..b014e1739 100644 --- a/include/asm-sparc/page.h +++ b/include/asm-sparc/page.h @@ -28,6 +28,10 @@ #ifndef __ASSEMBLY__ +#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0=0; } while (0) +#define PAGE_BUG(page) do { \ + BUG(); } while (0) + #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h index 57e74b4d3..2cad9d56f 100644 --- a/include/asm-sparc/spinlock.h +++ b/include/asm-sparc/spinlock.h @@ -17,7 +17,7 @@ typedef unsigned char spinlock_t; #define spin_lock_init(lock) do { } while(0) #define spin_lock(lock) do { } while(0) -#define spin_trylock(lock) do { } while(0) +#define spin_trylock(lock) (1) #define spin_unlock_wait(lock) do { } while(0) #define spin_unlock(lock) do { } while(0) #define spin_lock_irq(lock) cli() diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h index 521bfb72a..e0db514fc 100644 --- a/include/asm-sparc64/elf.h +++ b/include/asm-sparc64/elf.h @@ -1,4 +1,4 @@ -/* $Id: elf.h,v 1.18 1998/09/09 05:36:08 davem Exp $ */ +/* $Id: elf.h,v 1.19 1999/06/11 13:26:04 jj Exp $ */ #ifndef __ASM_SPARC64_ELF_H #define __ASM_SPARC64_ELF_H @@ -7,7 +7,9 @@ */ #include <asm/ptrace.h> +#ifdef __KERNEL__ #include <asm/processor.h> +#endif /* * These are used to set parameters in the core dumps. diff --git a/include/asm-sparc64/namei.h b/include/asm-sparc64/namei.h index 2dbcdedf3..d3d57545c 100644 --- a/include/asm-sparc64/namei.h +++ b/include/asm-sparc64/namei.h @@ -1,4 +1,4 @@ -/* $Id: namei.h,v 1.14 1999/04/06 06:54:39 jj Exp $ +/* $Id: namei.h,v 1.15 1999/06/10 05:23:17 davem Exp $ * linux/include/asm-sparc64/namei.h * * Routines to handle famous /usr/gnemul/s*. diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h index 0894bb90d..1a808c0ba 100644 --- a/include/asm-sparc64/page.h +++ b/include/asm-sparc64/page.h @@ -18,6 +18,10 @@ #ifndef __ASSEMBLY__ +#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0=0; } while (0) +#define PAGE_BUG(page) do { \ + BUG(); } while (0) + extern void clear_page(unsigned long page); extern void copy_page(unsigned long to, unsigned long from); diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h index d0c25a965..b3311df9d 100644 --- a/include/asm-sparc64/spinlock.h +++ b/include/asm-sparc64/spinlock.h @@ -15,7 +15,7 @@ typedef unsigned char spinlock_t; #define spin_lock_init(lock) do { } while(0) #define spin_lock(lock) do { } while(0) -#define spin_trylock(lock) do { } while(0) +#define spin_trylock(lock) (1) #define spin_unlock_wait(lock) do { } while(0) #define spin_unlock(lock) do { } while(0) #define spin_lock_irq(lock) cli() diff --git a/include/linux/blk.h b/include/linux/blk.h index 3974bc23b..dcb407c61 100644 --- a/include/linux/blk.h +++ b/include/linux/blk.h @@ -342,6 +342,15 @@ static void floppy_off(unsigned int nr); #define DEVICE_ON(device) #define DEVICE_OFF(device) +#elif (MAJOR_NR == MFM_ACORN_MAJOR) + +#define DEVICE_NAME "mfm disk" +#define DEVICE_INTR do_mfm +#define DEVICE_REQUEST do_mfm_request +#define DEVICE_NR(device) (MINOR(device) >> 6) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + #elif (MAJOR_NR == NBD_MAJOR) #define DEVICE_NAME "nbd" diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index dcd36e63c..f0eba99c1 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h @@ -556,6 +556,7 @@ extern void ext2_check_inodes_bitmap (struct super_block *); extern int ext2_bmap (struct inode *, int); extern struct buffer_head * ext2_getblk (struct inode *, long, int, int *); +extern int ext2_getblk_block (struct inode *, long, int, int *, int *); extern struct buffer_head * ext2_bread (struct inode *, int, int, int *); extern int ext2_getcluster (struct inode * inode, long block); diff --git a/include/linux/fd1772.h b/include/linux/fd1772.h new file mode 100644 index 000000000..871d6e4c6 --- /dev/null +++ b/include/linux/fd1772.h @@ -0,0 +1,80 @@ +#ifndef _LINUX_FD1772REG_H +#define _LINUX_FD1772REG_H + +/* +** WD1772 stuff - originally from the M68K Linux + * Modified for Archimedes by Dave Gilbert (gilbertd@cs.man.ac.uk) + */ + +/* register codes */ + +#define FDC1772SELREG_STP (0x80) /* command/status register */ +#define FDC1772SELREG_TRA (0x82) /* track register */ +#define FDC1772SELREG_SEC (0x84) /* sector register */ +#define FDC1772SELREG_DTA (0x86) /* data register */ + +/* register names for FDC1772_READ/WRITE macros */ + +#define FDC1772REG_CMD 0 +#define FDC1772REG_STATUS 0 +#define FDC1772REG_TRACK 2 +#define FDC1772REG_SECTOR 4 +#define FDC1772REG_DATA 6 + +/* command opcodes */ + +#define FDC1772CMD_RESTORE (0x00) /* - */ +#define FDC1772CMD_SEEK (0x10) /* | */ +#define FDC1772CMD_STEP (0x20) /* | TYP 1 Commands */ +#define FDC1772CMD_STIN (0x40) /* | */ +#define FDC1772CMD_STOT (0x60) /* - */ +#define FDC1772CMD_RDSEC (0x80) /* - TYP 2 Commands */ +#define FDC1772CMD_WRSEC (0xa0) /* - " */ +#define FDC1772CMD_RDADR (0xc0) /* - */ +#define FDC1772CMD_RDTRA (0xe0) /* | TYP 3 Commands */ +#define FDC1772CMD_WRTRA (0xf0) /* - */ +#define FDC1772CMD_FORCI (0xd0) /* - TYP 4 Command */ + +/* command modifier bits */ + +#define FDC1772CMDADD_SR6 (0x00) /* step rate settings */ +#define FDC1772CMDADD_SR12 (0x01) +#define FDC1772CMDADD_SR2 (0x02) +#define FDC1772CMDADD_SR3 (0x03) +#define FDC1772CMDADD_V (0x04) /* verify */ +#define FDC1772CMDADD_H (0x08) /* wait for spin-up */ +#define FDC1772CMDADD_U (0x10) /* update track register */ +#define FDC1772CMDADD_M (0x10) /* multiple sector access */ +#define FDC1772CMDADD_E (0x04) /* head settling flag */ +#define FDC1772CMDADD_P (0x02) /* precompensation */ +#define FDC1772CMDADD_A0 (0x01) /* DAM flag */ + +/* status register bits */ + +#define FDC1772STAT_MOTORON (0x80) /* motor on */ +#define FDC1772STAT_WPROT (0x40) /* write protected (FDC1772CMD_WR*) */ +#define FDC1772STAT_SPINUP (0x20) /* motor speed stable (Type I) */ +#define FDC1772STAT_DELDAM (0x20) /* sector has deleted DAM (Type II+III) */ +#define FDC1772STAT_RECNF (0x10) /* record not found */ +#define FDC1772STAT_CRC (0x08) /* CRC error */ +#define FDC1772STAT_TR00 (0x04) /* Track 00 flag (Type I) */ +#define FDC1772STAT_LOST (0x04) /* Lost Data (Type II+III) */ +#define FDC1772STAT_IDX (0x02) /* Index status (Type I) */ +#define FDC1772STAT_DRQ (0x02) /* DRQ status (Type II+III) */ +#define FDC1772STAT_BUSY (0x01) /* FDC1772 is busy */ + + +/* PSG Port A Bit Nr 0 .. Side Sel .. 0 -> Side 1 1 -> Side 2 */ +#define DSKSIDE (0x01) + +#define DSKDRVNONE (0x06) +#define DSKDRV0 (0x02) +#define DSKDRV1 (0x04) + +/* step rates */ +#define FDC1772STEP_6 0x00 +#define FDC1772STEP_12 0x01 +#define FDC1772STEP_2 0x02 +#define FDC1772STEP_3 0x03 + +#endif diff --git a/include/linux/fs.h b/include/linux/fs.h index 55b07ba48..792df9495 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -74,11 +74,11 @@ extern int max_super_blocks, nr_super_blocks; /* public flags for file_system_type */ #define FS_REQUIRES_DEV 1 -#define FS_NO_DCACHE 2 /* Only dcache the necessary things. */ -#define FS_NO_PRELIM 4 /* prevent preloading of dentries, even if +#define FS_NO_DCACHE 2 /* Only dcache the necessary things. */ +#define FS_NO_PRELIM 4 /* prevent preloading of dentries, even if * FS_NO_DCACHE is not set. */ -#define FS_IBASKET 8 /* FS does callback to free_ibasket() if space gets low. */ +#define FS_IBASKET 8 /* FS does callback to free_ibasket() if space gets low. */ /* * These are the fs-independent mount-flags: up to 16 flags are supported @@ -94,9 +94,9 @@ extern int max_super_blocks, nr_super_blocks; #define S_APPEND 256 /* Append-only file */ #define S_IMMUTABLE 512 /* Immutable file */ #define MS_NOATIME 1024 /* Do not update access times. */ -#define MS_NODIRATIME 2048 /* Do not update directory access times */ +#define MS_NODIRATIME 2048 /* Do not update directory access times */ -#define MS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon +#define MS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon * as nfs_rename() will be cleaned up */ @@ -189,7 +189,6 @@ typedef char buffer_block[BLOCK_SIZE]; #define BH_Lock 2 /* 1 if the buffer is locked */ #define BH_Req 3 /* 0 if the buffer has been invalidated */ #define BH_Protected 6 /* 1 if the buffer is protected */ - /* * Try to keep the most commonly used fields in single cache lines (16 * bytes) to improve performance. This ordering should be @@ -218,7 +217,7 @@ struct buffer_head { /* Non-performance-critical data follows. */ char * b_data; /* pointer to data block (1024 bytes) */ unsigned int b_list; /* List that this buffer appears */ - unsigned long b_flushtime; /* Time when this (dirty) buffer + unsigned long b_flushtime; /* Time when this (dirty) buffer * should be written */ wait_queue_head_t b_wait; struct buffer_head ** b_pprev; /* doubly linked list of hash-queue */ @@ -235,30 +234,13 @@ struct buffer_head { typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate); void init_buffer(struct buffer_head *, kdev_t, int, bh_end_io_t *, void *); -static inline int buffer_uptodate(struct buffer_head * bh) -{ - return test_bit(BH_Uptodate, &bh->b_state); -} - -static inline int buffer_dirty(struct buffer_head * bh) -{ - return test_bit(BH_Dirty, &bh->b_state); -} +#define __buffer_state(bh, state) (((bh)->b_state & (1UL << BH_##state)) != 0) -static inline int buffer_locked(struct buffer_head * bh) -{ - return test_bit(BH_Lock, &bh->b_state); -} - -static inline int buffer_req(struct buffer_head * bh) -{ - return test_bit(BH_Req, &bh->b_state); -} - -static inline int buffer_protected(struct buffer_head * bh) -{ - return test_bit(BH_Protected, &bh->b_state); -} +#define buffer_uptodate(bh) __buffer_state(bh,Uptodate) +#define buffer_dirty(bh) __buffer_state(bh,Dirty) +#define buffer_locked(bh) __buffer_state(bh,Lock) +#define buffer_req(bh) __buffer_state(bh,Req) +#define buffer_protected(bh) __buffer_state(bh,Protected) #define buffer_page(bh) (mem_map + MAP_NR((bh)->b_data)) #define touch_buffer(bh) set_bit(PG_referenced, &buffer_page(bh)->flags) @@ -357,7 +339,6 @@ struct inode { unsigned long i_version; unsigned long i_nrpages; struct semaphore i_sem; - struct semaphore i_atomic_write; struct inode_operations *i_op; struct super_block *i_sb; wait_queue_head_t i_wait; @@ -365,22 +346,21 @@ struct inode { struct vm_area_struct *i_mmap; struct page *i_pages; struct dquot *i_dquot[MAXQUOTAS]; + struct pipe_inode_info *i_pipe; unsigned long i_state; unsigned int i_flags; - unsigned char i_pipe; unsigned char i_sock; int i_writecount; unsigned int i_attr_flags; __u32 i_generation; union { - struct pipe_inode_info pipe_i; struct minix_inode_info minix_i; struct ext2_inode_info ext2_i; struct hpfs_inode_info hpfs_i; - struct ntfs_inode_info ntfs_i; + struct ntfs_inode_info ntfs_i; struct msdos_inode_info msdos_i; struct umsdos_inode_info umsdos_i; struct iso_inode_info isofs_i; @@ -388,7 +368,7 @@ struct inode { struct sysv_inode_info sysv_i; struct affs_inode_info affs_i; struct ufs_inode_info ufs_i; - struct efs_inode_info efs_i; + struct efs_inode_info efs_i; struct romfs_inode_info romfs_i; struct coda_inode_info coda_i; struct smb_inode_info smbfs_i; @@ -491,10 +471,10 @@ extern void posix_block_lock(struct file_lock *, struct file_lock *); extern void posix_unblock_lock(struct file_lock *); struct fasync_struct { - int magic; - int fa_fd; - struct fasync_struct *fa_next; /* singly linked list */ - struct file *fa_file; + int magic; + int fa_fd; + struct fasync_struct *fa_next; /* singly linked list */ + struct file *fa_file; }; #define FASYNC_MAGIC 0x4601 @@ -547,19 +527,19 @@ struct super_block { struct minix_sb_info minix_sb; struct ext2_sb_info ext2_sb; struct hpfs_sb_info hpfs_sb; - struct ntfs_sb_info ntfs_sb; + struct ntfs_sb_info ntfs_sb; struct msdos_sb_info msdos_sb; struct isofs_sb_info isofs_sb; struct nfs_sb_info nfs_sb; struct sysv_sb_info sysv_sb; struct affs_sb_info affs_sb; struct ufs_sb_info ufs_sb; - struct efs_sb_info efs_sb; + struct efs_sb_info efs_sb; struct romfs_sb_info romfs_sb; struct smb_sb_info smbfs_sb; struct hfs_sb_info hfs_sb; struct adfs_sb_info adfs_sb; - struct qnx4_sb_info qnx4_sb; + struct qnx4_sb_info qnx4_sb; void *generic_sbp; } u; /* @@ -616,13 +596,22 @@ struct inode_operations { struct inode *, struct dentry *); int (*readlink) (struct dentry *, char *,int); struct dentry * (*follow_link) (struct dentry *, struct dentry *, unsigned int); + /* + * the order of these functions within the VFS template has been + * changed because SMP locking has changed: from now on all bmap, + * readpage, writepage and flushpage functions are supposed to do + * whatever locking they need to get proper SMP operation - for + * now in most cases this means a lock/unlock_kernel at entry/exit. + * [The new order is also slightly more logical :)] + */ + int (*bmap) (struct inode *,int); int (*readpage) (struct file *, struct page *); int (*writepage) (struct file *, struct page *); - int (*bmap) (struct inode *,int); + int (*flushpage) (struct inode *, struct page *, unsigned long); + void (*truncate) (struct inode *); int (*permission) (struct inode *, int); int (*smap) (struct inode *,int); - int (*updatepage) (struct file *, struct page *, unsigned long, unsigned int); int (*revalidate) (struct dentry *); }; @@ -749,13 +738,11 @@ extern int fs_may_mount(kdev_t); extern struct file *inuse_filps; -extern void refile_buffer(struct buffer_head *); extern void set_writetime(struct buffer_head *, int); extern int try_to_free_buffers(struct page *); +extern void refile_buffer(struct buffer_head * buf); -extern int nr_buffers; extern int buffermem; -extern int nr_buffer_heads; #define BUF_CLEAN 0 #define BUF_LOCKED 1 /* Buffers scheduled for write */ @@ -766,21 +753,36 @@ void mark_buffer_uptodate(struct buffer_head *, int); extern inline void mark_buffer_clean(struct buffer_head * bh) { - if (test_and_clear_bit(BH_Dirty, &bh->b_state)) { - if (bh->b_list == BUF_DIRTY) - refile_buffer(bh); - } + if (test_and_clear_bit(BH_Dirty, &bh->b_state)) + refile_buffer(bh); } +extern void FASTCALL(__mark_buffer_dirty(struct buffer_head *bh, int flag)); +extern void FASTCALL(__atomic_mark_buffer_dirty(struct buffer_head *bh, int flag)); + +#define atomic_set_buffer_dirty(bh) test_and_set_bit(BH_Dirty, &(bh)->b_state) + extern inline void mark_buffer_dirty(struct buffer_head * bh, int flag) { - if (!test_and_set_bit(BH_Dirty, &bh->b_state)) { - set_writetime(bh, flag); - if (bh->b_list != BUF_DIRTY) - refile_buffer(bh); - } + if (!atomic_set_buffer_dirty(bh)) + __mark_buffer_dirty(bh, flag); +} + +/* + * SMP-safe version of the above - does synchronization with + * other users of buffer-cache data structures. + * + * since we test-set the dirty bit in a CPU-atomic way we also + * have optimized the common 'redirtying' case away completely. + */ +extern inline void atomic_mark_buffer_dirty(struct buffer_head * bh, int flag) +{ + if (!atomic_set_buffer_dirty(bh)) + __atomic_mark_buffer_dirty(bh, flag); } + +extern void balance_dirty(kdev_t); extern int check_disk_change(kdev_t); extern int invalidate_inodes(struct super_block *); extern void invalidate_inode_pages(struct inode *); @@ -869,12 +871,19 @@ extern struct buffer_head * breada(kdev_t, int, int, unsigned int, unsigned int) extern int brw_page(int, struct page *, kdev_t, int [], int, int); typedef long (*writepage_t)(struct file *, struct page *, unsigned long, unsigned long, const char *); +typedef int (*fs_getblock_t)(struct inode *, long, int, int *, int *); + +/* Generic buffer handling for block filesystems.. */ +extern int block_read_full_page(struct file *, struct page *); +extern int block_write_full_page (struct file *, struct page *, fs_getblock_t); +extern int block_write_partial_page (struct file *, struct page *, unsigned long, unsigned long, const char *, fs_getblock_t); +extern int block_flushpage(struct inode *, struct page *, unsigned long); -extern int generic_readpage(struct file *, struct page *); extern int generic_file_mmap(struct file *, struct vm_area_struct *); extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *); extern ssize_t generic_file_write(struct file *, const char *, size_t, loff_t *, writepage_t); + extern struct super_block *get_super(kdev_t); extern void put_super(kdev_t); unsigned long generate_cluster(kdev_t, int b[], int); @@ -898,6 +907,7 @@ extern ssize_t block_write(struct file *, const char *, size_t, loff_t *); extern int block_fsync(struct file *, struct dentry *); extern int file_fsync(struct file *, struct dentry *); +extern int generic_buffer_fdatasync(struct inode *inode, unsigned long start, unsigned long end); extern int inode_change_ok(struct inode *, struct iattr *); extern void inode_setattr(struct inode *, struct iattr *); diff --git a/include/linux/hpfs_fs_i.h b/include/linux/hpfs_fs_i.h index 7dea10b41..8263bf2d7 100644 --- a/include/linux/hpfs_fs_i.h +++ b/include/linux/hpfs_fs_i.h @@ -1,17 +1,7 @@ #ifndef _HPFS_FS_I #define _HPFS_FS_I -#if ANALWARNINGS -#warning Fix the FIFO stuff! -#warning Fix the FIFO stuff! -#warning Fix the FIFO stuff! -#endif - struct hpfs_inode_info { - union { /* Linux sometimes destroys this structure */ - struct pipe_inode_info bla; /* due to a bug. Linus doesn't want to fix */ - struct socket ble; /* it so I had to write this workaround :-) */ - } dummy; ino_t i_parent_dir; /* (directories) gives fnode of parent dir */ unsigned i_dno; /* (directories) root dnode */ unsigned i_dpos; /* (directories) temp for readdir */ diff --git a/include/linux/ioport.h b/include/linux/ioport.h index b5eef44dd..2f729f96b 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -1,14 +1,38 @@ /* - * portio.h Definitions of routines for detecting, reserving and + * ioport.h Definitions of routines for detecting, reserving and * allocating system resources. * - * Version: 0.01 8/30/93 - * - * Author: Donald Becker (becker@super.org) + * Authors: Donald Becker (becker@cesdis.gsfc.nasa.gov) + * David Hinds (dhinds@zen.stanford.edu) */ -#ifndef _LINUX_PORTIO_H -#define _LINUX_PORTIO_H +#ifndef _LINUX_IOPORT_H +#define _LINUX_IOPORT_H + +#define RES_IO 0 +#define RES_MEM 1 + +extern void reserve_setup(char *str, int *ints); + +extern struct resource_entry *iolist, *memlist; + +extern int get_resource_list(int class, char *buf); +extern int check_resource(int class, + unsigned long from, unsigned long extent); +extern void request_resource(int class, + unsigned long from, unsigned long extent, + const char *name); +extern void release_resource(int class, + unsigned long from, unsigned long extent); +extern unsigned long occupy_resource(int class, + unsigned long base, unsigned long end, + unsigned long num, unsigned long align, + const char *name); +extern void vacate_resource(int class, + unsigned long from, unsigned long extent); + +#define get_ioport_list(buf) get_resource_list(RES_IO, buf) +#define get_mem_list(buf) get_resource_list(RES_MEM, buf) #define HAVE_PORTRESERVE /* @@ -16,20 +40,21 @@ * Once you have found you hardware, register it with request_region(). * If you unload the driver, use release_region to free ports. */ -extern void reserve_setup(char *str, int *ints); -extern int check_region(unsigned long from, unsigned long extent); -extern void request_region(unsigned long from, unsigned long extent,const char *name); -extern void release_region(unsigned long from, unsigned long extent); -extern int get_ioport_list(char *); +#define check_region(f,e) check_resource(RES_IO,f,e) +#define request_region(f,e,n) request_resource(RES_IO,f,e,n) +#define release_region(f,e) release_resource(RES_IO,f,e) +#define occupy_region(b,e,n,a,s) occupy_resource(RES_IO,b,e,n,a,s) +#define vacate_region(f,e) vacate_resource(RES_IO,f,e) -#ifdef __sparc__ -extern unsigned long occupy_region(unsigned long base, unsigned long end, - unsigned long num, unsigned int align, - const char *name); -#endif +#define HAVE_MEMRESERVE +#define check_mem_region(f,e) check_resource(RES_MEM,f,e) +#define request_mem_region(f,e,n) request_resource(RES_MEM,f,e,n) +#define release_mem_region(f,e) release_resource(RES_MEM,f,e) +#define occupy_mem_region(b,e,n,a,s) occupy_resource(RES_MEM,b,e,n,a,s) +#define vacate_mem_region(f,e) vacate_resource(RES_MEM,f,e) #define HAVE_AUTOIRQ extern void autoirq_setup(int waittime); extern int autoirq_report(int waittime); -#endif /* _LINUX_PORTIO_H */ +#endif /* _LINUX_IOPORT_H */ diff --git a/include/linux/minix_fs.h b/include/linux/minix_fs.h index 4682ee56e..0b41889bd 100644 --- a/include/linux/minix_fs.h +++ b/include/linux/minix_fs.h @@ -110,6 +110,7 @@ extern unsigned long minix_count_free_blocks(struct super_block *sb); extern int minix_bmap(struct inode *,int); extern struct buffer_head * minix_getblk(struct inode *, int, int); +extern int minix_getblk_block (struct inode *, long, int, int *, int *); extern struct buffer_head * minix_bread(struct inode *, int, int); extern void minix_truncate(struct inode *); diff --git a/include/linux/mm.h b/include/linux/mm.h index 3a1963887..b41ff492c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -129,29 +129,57 @@ typedef struct page { wait_queue_head_t wait; struct page **pprev_hash; struct buffer_head * buffers; + int owner; /* temporary debugging check */ } mem_map_t; +#define get_page(p) do { atomic_inc(&(p)->count); \ + } while (0) +#define put_page(p) __free_page(p) +#define put_page_testzero(p) ({ int __ret = atomic_dec_and_test(&(p)->count);\ + __ret; }) +#define page_count(p) atomic_read(&(p)->count) +#define set_page_count(p,v) do { atomic_set(&(p)->count, v); \ + } while (0) + /* Page flag bit values */ #define PG_locked 0 #define PG_error 1 #define PG_referenced 2 -#define PG_dirty 3 -#define PG_uptodate 4 -#define PG_free_after 5 -#define PG_decr_after 6 -#define PG_swap_unlock_after 7 -#define PG_DMA 8 -#define PG_Slab 9 -#define PG_swap_cache 10 -#define PG_skip 11 +#define PG_uptodate 3 +#define PG_free_after 4 +#define PG_decr_after 5 +#define PG_swap_unlock_after 6 +#define PG_DMA 7 +#define PG_Slab 8 +#define PG_swap_cache 9 +#define PG_skip 10 + /* bits 21-30 unused */ #define PG_reserved 31 + /* Make it prettier to test the above... */ +#define Page_Uptodate(page) (test_bit(PG_uptodate, &(page)->flags)) +#define SetPageUptodate(page) do { set_bit(PG_uptodate, &(page)->flags); \ + } while (0) +#define ClearPageUptodate(page) do { clear_bit(PG_uptodate, &(page)->flags); \ + } while (0) #define PageLocked(page) (test_bit(PG_locked, &(page)->flags)) +#define LockPage(page) \ + do { int _ret = test_and_set_bit(PG_locked, &(page)->flags); \ + if (_ret) PAGE_BUG(page); \ + if (page->owner) PAGE_BUG(page); \ + page->owner = (int)current; } while (0) +#define TryLockPage(page) ({ int _ret = test_and_set_bit(PG_locked, &(page)->flags); \ + if (!_ret) page->owner = (int)current; _ret; }) +#define UnlockPage(page) do { \ + if (page->owner != (int)current) { \ +BUG(); } page->owner = 0; \ +if (!test_and_clear_bit(PG_locked, &(page)->flags)) { \ + PAGE_BUG(page); } wake_up(&page->wait); } while (0) #define PageError(page) (test_bit(PG_error, &(page)->flags)) +#define SetPageError(page) ({ int _ret = test_and_set_bit(PG_error, &(page)->flags); _ret; }) +#define ClearPageError(page) do { if (!test_and_clear_bit(PG_error, &(page)->flags)) BUG(); } while (0) #define PageReferenced(page) (test_bit(PG_referenced, &(page)->flags)) -#define PageDirty(page) (test_bit(PG_dirty, &(page)->flags)) -#define PageUptodate(page) (test_bit(PG_uptodate, &(page)->flags)) #define PageFreeAfter(page) (test_bit(PG_free_after, &(page)->flags)) #define PageDecrAfter(page) (test_bit(PG_decr_after, &(page)->flags)) #define PageSwapUnlockAfter(page) (test_bit(PG_swap_unlock_after, &(page)->flags)) @@ -163,16 +191,12 @@ typedef struct page { #define PageSetSlab(page) (set_bit(PG_Slab, &(page)->flags)) #define PageSetSwapCache(page) (set_bit(PG_swap_cache, &(page)->flags)) -#define PageTestandSetDirty(page) \ - (test_and_set_bit(PG_dirty, &(page)->flags)) #define PageTestandSetSwapCache(page) \ (test_and_set_bit(PG_swap_cache, &(page)->flags)) #define PageClearSlab(page) (clear_bit(PG_Slab, &(page)->flags)) #define PageClearSwapCache(page)(clear_bit(PG_swap_cache, &(page)->flags)) -#define PageTestandClearDirty(page) \ - (test_and_clear_bit(PG_dirty, &(page)->flags)) #define PageTestandClearSwapCache(page) \ (test_and_clear_bit(PG_swap_cache, &(page)->flags)) @@ -274,8 +298,8 @@ extern int low_on_memory; /* memory.c & swap.c*/ #define free_page(addr) free_pages((addr),0) -extern void FASTCALL(free_pages(unsigned long addr, unsigned long order)); -extern void FASTCALL(__free_page(struct page *)); +extern int FASTCALL(free_pages(unsigned long addr, unsigned long order)); +extern int FASTCALL(__free_page(struct page *)); extern void show_free_areas(void); extern unsigned long put_dirty_page(struct task_struct * tsk,unsigned long page, @@ -398,7 +422,7 @@ extern struct vm_area_struct *find_extend_vma(struct task_struct *tsk, unsigned #define buffer_under_min() ((buffermem >> PAGE_SHIFT) * 100 < \ buffer_mem.min_percent * num_physpages) -#define pgcache_under_min() (page_cache_size * 100 < \ +#define pgcache_under_min() (atomic_read(&page_cache_size) * 100 < \ page_cache.min_percent * num_physpages) #endif /* __KERNEL__ */ diff --git a/include/linux/msdos_fs_i.h b/include/linux/msdos_fs_i.h index fcb746552..b2381f6d4 100644 --- a/include/linux/msdos_fs_i.h +++ b/include/linux/msdos_fs_i.h @@ -1,30 +1,11 @@ #ifndef _MSDOS_FS_I #define _MSDOS_FS_I -#ifndef _LINUX_PIPE_FS_I_H -#include <linux/pipe_fs_i.h> -#endif - /* * MS-DOS file system inode data in memory */ struct msdos_inode_info { - /* - UMSDOS manage special file and fifo as normal empty - msdos file. fifo inode processing conflict with msdos - processing. So I insert the pipe_inode_info so the - information does not overlap. This increases the size of - the msdos_inode_info, but the clear winner here is - the ext2_inode_info. So it does not change anything to - the total size of a struct inode. - - I have not put it conditional. With the advent of loadable - file system drivers, it would be very easy to compile - a MS-DOS FS driver unaware of UMSDOS and then later to - load a (then incompatible) UMSDOS FS driver. - */ - struct pipe_inode_info reserved; int i_start; /* first cluster or 0 */ int i_logstart; /* logical first cluster */ int i_attrs; /* unused attribute bits */ diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 613eb6872..d91a0b641 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -192,7 +192,8 @@ extern struct inode_operations nfs_file_inode_operations; */ extern struct inode_operations nfs_dir_inode_operations; extern struct dentry_operations nfs_dentry_operations; -extern void nfs_invalidate_dircache(struct inode *); +extern void nfs_flush_dircache(struct inode *); +extern void nfs_free_dircache(struct inode *); /* * linux/fs/nfs/symlink.c diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index d21f0078f..13bf610b6 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h @@ -9,13 +9,6 @@ */ struct nfs_inode_info { /* - * This is a place holder so named pipes on NFS filesystems - * work (more or less correctly). This must be first in the - * struct because the data is really accessed via inode->u.pipe_i. - */ - struct pipe_inode_info pipeinfo; - - /* * Various flags */ unsigned short flags; diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 218098416..c5a8af7c7 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -39,10 +39,10 @@ static inline unsigned long page_address(struct page * page) */ #define page_cache_entry(x) (mem_map + MAP_NR(x)) -#define PAGE_HASH_BITS 12 +#define PAGE_HASH_BITS 16 #define PAGE_HASH_SIZE (1 << PAGE_HASH_BITS) -extern unsigned long page_cache_size; /* # of pages currently in the hash table */ +extern atomic_t page_cache_size; /* # of pages currently in the hash table */ extern struct page * page_hash_table[PAGE_HASH_SIZE]; /* @@ -64,72 +64,25 @@ static inline unsigned long _page_hashfn(struct inode * inode, unsigned long off #define page_hash(inode,offset) (page_hash_table+_page_hashfn(inode,offset)) -static inline struct page * __find_page(struct inode * inode, unsigned long offset, struct page *page) -{ - goto inside; - for (;;) { - page = page->next_hash; -inside: - if (!page) - goto not_found; - if (page->inode != inode) - continue; - if (page->offset == offset) - break; - } - /* Found the page. */ - atomic_inc(&page->count); - set_bit(PG_referenced, &page->flags); -not_found: - return page; -} - -static inline struct page *find_page(struct inode * inode, unsigned long offset) -{ - return __find_page(inode, offset, *page_hash(inode, offset)); -} +extern struct page * __find_get_page (struct inode * inode, + unsigned long offset, struct page **hash); +#define find_get_page(inode, offset) \ + __find_get_page(inode, offset, page_hash(inode, offset)) +extern struct page * __find_lock_page (struct inode * inode, + unsigned long offset, struct page **hash); +extern void lock_page(struct page *page); +#define find_lock_page(inode, offset) \ + __find_lock_page(inode, offset, page_hash(inode, offset)) -static inline void remove_page_from_hash_queue(struct page * page) -{ - if(page->pprev_hash) { - if(page->next_hash) - page->next_hash->pprev_hash = page->pprev_hash; - *page->pprev_hash = page->next_hash; - page->pprev_hash = NULL; - } - page_cache_size--; -} +extern void __add_page_to_hash_queue(struct page * page, struct page **p); -static inline void __add_page_to_hash_queue(struct page * page, struct page **p) -{ - page_cache_size++; - if((page->next_hash = *p) != NULL) - (*p)->pprev_hash = &page->next_hash; - *p = page; - page->pprev_hash = p; -} +extern int add_to_page_cache_unique(struct page * page, struct inode * inode, unsigned long offset, struct page **hash); static inline void add_page_to_hash_queue(struct page * page, struct inode * inode, unsigned long offset) { __add_page_to_hash_queue(page, page_hash(inode,offset)); } -static inline void remove_page_from_inode_queue(struct page * page) -{ - struct inode * inode = page->inode; - - page->inode = NULL; - inode->i_nrpages--; - if (inode->i_pages == page) - inode->i_pages = page->next; - if (page->next) - page->next->prev = page->prev; - if (page->prev) - page->prev->next = page->next; - page->next = NULL; - page->prev = NULL; -} - static inline void add_page_to_inode_queue(struct inode * inode, struct page * page) { struct page **p = &inode->i_pages; @@ -142,11 +95,13 @@ static inline void add_page_to_inode_queue(struct inode * inode, struct page * p *p = page; } -extern void __wait_on_page(struct page *); +extern void ___wait_on_page(struct page *); + static inline void wait_on_page(struct page * page) { + if (PageLocked(page)) - __wait_on_page(page); + ___wait_on_page(page); } extern void update_vm_cache(struct inode *, unsigned long, const char *, int); diff --git a/include/linux/pci.h b/include/linux/pci.h index bd7f320e3..2a9932148 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -280,7 +280,7 @@ /* * Vendor and card ID's: sort these numerically according to vendor * (and according to card ID within vendor). Send all updates to - * <linux-pcisupport@cck.uni-kl.de>. + * <pci-ids@ucw.cz>. */ #define PCI_VENDOR_ID_COMPAQ 0x0e11 #define PCI_DEVICE_ID_COMPAQ_1280 0x3033 @@ -1260,6 +1260,8 @@ struct pci_dev *pci_find_device (unsigned int vendor, unsigned int device, struc struct pci_dev *pci_find_class (unsigned int class, struct pci_dev *from); struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn); +#define PCI_ANY_ID (~0) + #define pci_present pcibios_present int pci_read_config_byte(struct pci_dev *dev, u8 where, u8 *val); int pci_read_config_word(struct pci_dev *dev, u8 where, u16 *val); diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 7d44e8293..c00d37845 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h @@ -12,15 +12,15 @@ struct pipe_inode_info { unsigned int writers; }; -#define PIPE_WAIT(inode) ((inode).u.pipe_i.wait) -#define PIPE_BASE(inode) ((inode).u.pipe_i.base) -#define PIPE_START(inode) ((inode).u.pipe_i.start) +#define PIPE_WAIT(inode) ((inode).i_pipe->wait) +#define PIPE_BASE(inode) ((inode).i_pipe->base) +#define PIPE_START(inode) ((inode).i_pipe->start) #define PIPE_LEN(inode) ((inode).i_size) -#define PIPE_RD_OPENERS(inode) ((inode).u.pipe_i.rd_openers) -#define PIPE_WR_OPENERS(inode) ((inode).u.pipe_i.wr_openers) -#define PIPE_READERS(inode) ((inode).u.pipe_i.readers) -#define PIPE_WRITERS(inode) ((inode).u.pipe_i.writers) -#define PIPE_LOCK(inode) ((inode).u.pipe_i.lock) +#define PIPE_RD_OPENERS(inode) ((inode).i_pipe->rd_openers) +#define PIPE_WR_OPENERS(inode) ((inode).i_pipe->wr_openers) +#define PIPE_READERS(inode) ((inode).i_pipe->readers) +#define PIPE_WRITERS(inode) ((inode).i_pipe->writers) +#define PIPE_LOCK(inode) ((inode).i_pipe->lock) #define PIPE_SIZE(inode) PIPE_LEN(inode) #define PIPE_EMPTY(inode) (PIPE_SIZE(inode)==0) diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index e9a284573..be5c2c666 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -37,6 +37,7 @@ enum root_directory_inos { PROC_KSYMS, PROC_DMA, PROC_IOPORTS, + PROC_MEMORY, PROC_PROFILE, /* whether enabled or not */ PROC_CMDLINE, PROC_SYS, diff --git a/include/linux/sched.h b/include/linux/sched.h index bfa9e633e..10a074449 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -286,7 +286,7 @@ struct task_struct { gid_t gid,egid,sgid,fsgid; int ngroups; gid_t groups[NGROUPS]; - kernel_cap_t cap_effective, cap_inheritable, cap_permitted; + kernel_cap_t cap_effective, cap_inheritable, cap_permitted; struct user_struct *user; /* limits */ struct rlimit rlim[RLIM_NLIMITS]; @@ -603,7 +603,7 @@ extern inline int capable(int cap) #else if (cap_is_fs_cap(cap) ? current->fsuid == 0 : current->euid == 0) #endif - { + { current->flags |= PF_SUPERPRIV; return 1; } diff --git a/include/linux/smb.h b/include/linux/smb.h index 8953686b0..852d5b0dd 100644 --- a/include/linux/smb.h +++ b/include/linux/smb.h @@ -57,7 +57,7 @@ struct smb_conn_opt { /* The following are NT LM 0.12 options */ __u32 maxraw; __u32 capabilities; - __u16 serverzone; + __s16 serverzone; }; #ifdef __KERNEL__ diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index a151a75e6..11dfce7dd 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h @@ -77,6 +77,22 @@ smb_vfree(void *obj) #define SMB_FIX_OLDATTR 0x0002 /* Use core getattr (Win 95 speedup) */ #define SMB_FIX_DIRATTR 0x0004 /* Use find_first for getattr */ + +/* NT1 protocol capability bits */ +#define SMB_CAP_RAW_MODE 0x0001 +#define SMB_CAP_MPX_MODE 0x0002 +#define SMB_CAP_UNICODE 0x0004 +#define SMB_CAP_LARGE_FILES 0x0008 +#define SMB_CAP_NT_SMBS 0x0010 +#define SMB_CAP_RPC_REMOTE_APIS 0x0020 +#define SMB_CAP_STATUS32 0x0040 +#define SMB_CAP_LEVEL_II_OPLOCKS 0x0080 +#define SMB_CAP_LOCK_AND_READ 0x0100 +#define SMB_CAP_NT_FIND 0x0200 +#define SMB_CAP_DFS 0x1000 +#define SMB_CAP_LARGE_READX 0x4000 + + /* linux/fs/smbfs/mmap.c */ int smb_mmap(struct file *, struct vm_area_struct *); diff --git a/include/linux/swap.h b/include/linux/swap.h index bc9fb4e48..c06ddba63 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -67,7 +67,7 @@ extern int nr_swap_pages; extern int nr_free_pages; extern atomic_t nr_async_pages; extern struct inode swapper_inode; -extern unsigned long page_cache_size; +extern atomic_t page_cache_size; extern int buffermem; /* Incomplete types for prototype declarations: */ @@ -107,6 +107,7 @@ extern int FASTCALL(swap_count(unsigned long)); /* * Make these inline later once they are working properly. */ +extern void __delete_from_swap_cache(struct page *page); extern void delete_from_swap_cache(struct page *page); extern void free_page_and_swap_cache(unsigned long addr); @@ -163,7 +164,7 @@ static inline int is_page_shared(struct page *page) unsigned int count; if (PageReserved(page)) return 1; - count = atomic_read(&page->count); + count = page_count(page); if (PageSwapCache(page)) count += swap_count(page->offset) - 2; if (PageFreeAfter(page)) diff --git a/include/linux/synclink.h b/include/linux/synclink.h index 69dc86725..70ce90e10 100644 --- a/include/linux/synclink.h +++ b/include/linux/synclink.h @@ -1,6 +1,8 @@ /* * SyncLink Multiprotocol Serial Adapter Driver * + * ==FILEDATE 19990523== + * * Copyright (C) 1998 by Microgate Corporation * * Redistribution of this file is permitted under @@ -66,11 +68,16 @@ #define HDLC_FLAG_AUTO_RTS 0x0080 #define HDLC_FLAG_RXC_DPLL 0x0100 #define HDLC_FLAG_RXC_BRG 0x0200 +#define HDLC_FLAG_RXC_TXCPIN 0x8000 +#define HDLC_FLAG_RXC_RXCPIN 0x0000 #define HDLC_FLAG_TXC_DPLL 0x0400 #define HDLC_FLAG_TXC_BRG 0x0800 +#define HDLC_FLAG_TXC_TXCPIN 0x0000 +#define HDLC_FLAG_TXC_RXCPIN 0x0008 #define HDLC_FLAG_DPLL_DIV8 0x1000 #define HDLC_FLAG_DPLL_DIV16 0x2000 #define HDLC_FLAG_DPLL_DIV32 0x0000 +#define HDLC_FLAG_HDLC_LOOPMODE 0x4000 #define HDLC_CRC_NONE 0 #define HDLC_CRC_16_CCITT 1 @@ -87,6 +94,7 @@ #define HDLC_ENCODING_NRZB 1 #define HDLC_ENCODING_NRZI_MARK 2 #define HDLC_ENCODING_NRZI_SPACE 3 +#define HDLC_ENCODING_NRZI HDLC_ENCODING_NRZI_SPACE #define HDLC_ENCODING_BIPHASE_MARK 4 #define HDLC_ENCODING_BIPHASE_SPACE 5 #define HDLC_ENCODING_BIPHASE_LEVEL 6 @@ -227,17 +235,19 @@ struct mgsl_icount { * MGSL_IOCTXABORT abort transmitting frame (HDLC) * MGSL_IOCGSTATS return current statistics * MGSL_IOCWAITEVENT wait for specified event to occur + * MGSL_LOOPTXDONE transmit in HDLC LoopMode done */ #define MGSL_MAGIC_IOC 'm' -#define MGSL_IOCSPARAMS _IOW(MGSL_MAGIC_IOC,0,sizeof(MGSL_PARAMS)) -#define MGSL_IOCGPARAMS _IOR(MGSL_MAGIC_IOC,1,sizeof(MGSL_PARAMS)) +#define MGSL_IOCSPARAMS _IOW(MGSL_MAGIC_IOC,0,struct _MGSL_PARAMS) +#define MGSL_IOCGPARAMS _IOR(MGSL_MAGIC_IOC,1,struct _MGSL_PARAMS) #define MGSL_IOCSTXIDLE _IO(MGSL_MAGIC_IOC,2) #define MGSL_IOCGTXIDLE _IO(MGSL_MAGIC_IOC,3) #define MGSL_IOCTXENABLE _IO(MGSL_MAGIC_IOC,4) #define MGSL_IOCRXENABLE _IO(MGSL_MAGIC_IOC,5) #define MGSL_IOCTXABORT _IO(MGSL_MAGIC_IOC,6) #define MGSL_IOCGSTATS _IO(MGSL_MAGIC_IOC,7) -#define MGSL_IOCWAITEVENT _IO(MGSL_MAGIC_IOC,8) +#define MGSL_IOCWAITEVENT _IOWR(MGSL_MAGIC_IOC,8,int) #define MGSL_IOCCLRMODCOUNT _IO(MGSL_MAGIC_IOC,15) +#define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9) #endif /* _SYNCLINK_H_ */ diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h index 49d9d24f1..d8c6eef5c 100644 --- a/include/linux/sysv_fs.h +++ b/include/linux/sysv_fs.h @@ -387,6 +387,7 @@ extern unsigned long sysv_count_free_blocks(struct super_block *sb); extern int sysv_bmap(struct inode *,int); extern struct buffer_head * sysv_getblk(struct inode *, unsigned int, int); +extern int sysv_getblk_block(struct inode *, long, int, int *, int *); extern struct buffer_head * sysv_file_bread(struct inode *, int, int); extern ssize_t sysv_file_read(struct file *, char *, size_t, loff_t *); diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h index e36ceba9e..2124c7e57 100644 --- a/include/linux/ufs_fs.h +++ b/include/linux/ufs_fs.h @@ -537,6 +537,7 @@ extern int ufs_sync_inode (struct inode *); extern void ufs_write_inode (struct inode *); extern void ufs_delete_inode (struct inode *); extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *); +extern int ufs_getfrag_block (struct inode *, long, int, int *, int *); extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *); /* namei.c */ diff --git a/include/linux/umsdos_fs_i.h b/include/linux/umsdos_fs_i.h index e3af5e921..96135ec0f 100644 --- a/include/linux/umsdos_fs_i.h +++ b/include/linux/umsdos_fs_i.h @@ -28,9 +28,8 @@ * * For directory, we also have a reference to the inode of its * own EMD file. Also, we have dir_locking_info to help synchronise - * file creation and file lookup. This data is sharing space with - * the pipe_inode_info not used by directory. See also msdos_fs_i.h - * for more information about pipe_inode_info and msdos_inode_info. + * file creation and file lookup. See also msdos_fs_i.h for more + * information about msdos_inode_info. * * Special file and fifo do have an inode which correspond to an * empty MSDOS file. @@ -38,11 +37,6 @@ * symlink are processed mostly like regular file. The content is the * link. * - * fifos add there own extension to the inode. I have reserved some - * space for fifos side by side with msdos_inode_info. This is just - * to for the show, because msdos_inode_info already include the - * pipe_inode_info. - * * The UMSDOS specific extension is placed after the union. */ @@ -60,7 +54,6 @@ struct dir_locking_info { struct umsdos_inode_info { union { struct msdos_inode_info msdos_info; - struct pipe_inode_info pipe_info; struct dir_locking_info dir_info; } u; int i_patched; /* Inode has been patched */ |