summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJames Simmons <jsimmons@maxwell.earthlink.net>2002-07-21 20:42:48 -0700
committerJames Simmons <jsimmons@maxwell.earthlink.net>2002-07-21 20:42:48 -0700
commit975f679b6b9e7321503694de9ea739280374f741 (patch)
tree36b1f6247ba050ad7406166d0ff1ca499344cfd6 /include
parent9a56acef9e6203b444a956d7e45a49a91cefbfb0 (diff)
parent4872eaccd9c1926c2e047abd761a1076eb7c4d11 (diff)
Merge http://linus.bkbits.net/linux-2.5
into maxwell.earthlink.net:/tmp/linus-2.5
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/rmap.h7
-rw-r--r--include/asm-arm/proc-armv/rmap.h51
-rw-r--r--include/asm-arm/rmap.h6
-rw-r--r--include/asm-cris/rmap.h7
-rw-r--r--include/asm-generic/rmap.h54
-rw-r--r--include/asm-generic/smplock.h3
-rw-r--r--include/asm-i386/hardirq.h76
-rw-r--r--include/asm-i386/rmap.h7
-rw-r--r--include/asm-i386/smplock.h14
-rw-r--r--include/asm-i386/softirq.h55
-rw-r--r--include/asm-i386/system.h26
-rw-r--r--include/asm-ia64/rmap.h7
-rw-r--r--include/asm-m68k/rmap.h7
-rw-r--r--include/asm-mips/rmap.h7
-rw-r--r--include/asm-mips64/rmap.h7
-rw-r--r--include/asm-parisc/rmap.h7
-rw-r--r--include/asm-ppc/rmap.h9
-rw-r--r--include/asm-s390/rmap.h7
-rw-r--r--include/asm-s390x/rmap.h7
-rw-r--r--include/asm-sh/rmap.h7
-rw-r--r--include/asm-sparc/rmap.h7
-rw-r--r--include/asm-sparc64/rmap.h7
-rw-r--r--include/linux/adfs_fs_i.h2
-rw-r--r--include/linux/affs_fs_i.h2
-rw-r--r--include/linux/agp_backend.h6
-rw-r--r--include/linux/agpgart.h10
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/blkdev.h14
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/fs.h38
-rw-r--r--include/linux/genhd.h6
-rw-r--r--include/linux/hfs_fs_i.h2
-rw-r--r--include/linux/hpfs_fs_i.h2
-rw-r--r--include/linux/irq_cpustat.h2
-rw-r--r--include/linux/kernel_stat.h12
-rw-r--r--include/linux/mm.h13
-rw-r--r--include/linux/mpage.h5
-rw-r--r--include/linux/msdos_fs_i.h2
-rw-r--r--include/linux/msg.h29
-rw-r--r--include/linux/page-flags.h41
-rw-r--r--include/linux/pagemap.h2
-rw-r--r--include/linux/preempt.h46
-rw-r--r--include/linux/qnx4_fs.h2
-rw-r--r--include/linux/sched.h10
-rw-r--r--include/linux/security.h383
-rw-r--r--include/linux/serial_core.h395
-rw-r--r--include/linux/shm.h13
-rw-r--r--include/linux/smp_lock.h2
-rw-r--r--include/linux/spinlock.h37
-rw-r--r--include/linux/swap.h14
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/usb.h4
-rw-r--r--include/scsi/scsicam.h5
53 files changed, 1263 insertions, 226 deletions
diff --git a/include/asm-alpha/rmap.h b/include/asm-alpha/rmap.h
new file mode 100644
index 000000000000..08b2236efd3a
--- /dev/null
+++ b/include/asm-alpha/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _ALPHA_RMAP_H
+#define _ALPHA_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-arm/proc-armv/rmap.h b/include/asm-arm/proc-armv/rmap.h
new file mode 100644
index 000000000000..f775d26eea88
--- /dev/null
+++ b/include/asm-arm/proc-armv/rmap.h
@@ -0,0 +1,51 @@
+#ifndef _ARMV_RMAP_H
+#define _ARMV_RMAP_H
+/*
+ * linux/include/asm-arm/proc-armv/rmap.h
+ *
+ * Architecture dependant parts of the reverse mapping code,
+ *
+ * ARM is different since hardware page tables are smaller than
+ * the page size and Linux uses a "duplicate" one with extra info.
+ * For rmap this means that the first 2 kB of a page are the hardware
+ * page tables and the last 2 kB are the software page tables.
+ */
+
+static inline void pgtable_add_rmap(pte_t * ptep, struct mm_struct * mm, unsigned long address)
+{
+ struct page * page = virt_to_page(ptep);
+
+ page->mm = mm;
+ page->index = address & ~((PTRS_PER_PTE * PAGE_SIZE) - 1);
+ inc_page_state(nr_page_table_pages);
+}
+
+static inline void pgtable_remove_rmap(pte_t * ptep)
+{
+ struct page * page = virt_to_page(ptep);
+
+ page->mm = NULL;
+ page->index = 0;
+ dec_page_state(nr_page_table_pages);
+}
+
+static inline struct mm_struct * ptep_to_mm(pte_t * ptep)
+{
+ struct page * page = virt_to_page(ptep);
+
+ return page->mm;
+}
+
+/* The page table takes half of the page */
+#define PTE_MASK ((PAGE_SIZE / 2) - 1)
+
+static inline unsigned long ptep_to_address(pte_t * ptep)
+{
+ struct page * page = virt_to_page(ptep);
+ unsigned long low_bits;
+
+ low_bits = ((unsigned long)ptep & PTE_MASK) * PTRS_PER_PTE;
+ return page->index + low_bits;
+}
+
+#endif /* _ARMV_RMAP_H */
diff --git a/include/asm-arm/rmap.h b/include/asm-arm/rmap.h
new file mode 100644
index 000000000000..d79cb373829b
--- /dev/null
+++ b/include/asm-arm/rmap.h
@@ -0,0 +1,6 @@
+#ifndef _ARM_RMAP_H
+#define _ARM_RMAP_H
+
+#include <asm/proc/rmap.h>
+
+#endif /* _ARM_RMAP_H */
diff --git a/include/asm-cris/rmap.h b/include/asm-cris/rmap.h
new file mode 100644
index 000000000000..c5bf2a811657
--- /dev/null
+++ b/include/asm-cris/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _CRIS_RMAP_H
+#define _CRIS_RMAP_H
+
+/* nothing to see, move along :) */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-generic/rmap.h b/include/asm-generic/rmap.h
new file mode 100644
index 000000000000..c7045f3e6923
--- /dev/null
+++ b/include/asm-generic/rmap.h
@@ -0,0 +1,54 @@
+#ifndef _GENERIC_RMAP_H
+#define _GENERIC_RMAP_H
+/*
+ * linux/include/asm-generic/rmap.h
+ *
+ * Architecture dependant parts of the reverse mapping code,
+ * this version should work for most architectures with a
+ * 'normal' page table layout.
+ *
+ * We use the struct page of the page table page to find out
+ * the process and full address of a page table entry:
+ * - page->mapping points to the process' mm_struct
+ * - page->index has the high bits of the address
+ * - the lower bits of the address are calculated from the
+ * offset of the page table entry within the page table page
+ */
+#include <linux/mm.h>
+
+static inline void pgtable_add_rmap(struct page * page, struct mm_struct * mm, unsigned long address)
+{
+#ifdef BROKEN_PPC_PTE_ALLOC_ONE
+ /* OK, so PPC calls pte_alloc() before mem_map[] is setup ... ;( */
+ extern int mem_init_done;
+
+ if (!mem_init_done)
+ return;
+#endif
+ page->mapping = (void *)mm;
+ page->index = address & ~((PTRS_PER_PTE * PAGE_SIZE) - 1);
+ inc_page_state(nr_page_table_pages);
+}
+
+static inline void pgtable_remove_rmap(struct page * page)
+{
+ page->mapping = NULL;
+ page->index = 0;
+ dec_page_state(nr_page_table_pages);
+}
+
+static inline struct mm_struct * ptep_to_mm(pte_t * ptep)
+{
+ struct page * page = virt_to_page(ptep);
+ return (struct mm_struct *) page->mapping;
+}
+
+static inline unsigned long ptep_to_address(pte_t * ptep)
+{
+ struct page * page = virt_to_page(ptep);
+ unsigned long low_bits;
+ low_bits = ((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE;
+ return page->index + low_bits;
+}
+
+#endif /* _GENERIC_RMAP_H */
diff --git a/include/asm-generic/smplock.h b/include/asm-generic/smplock.h
index 96565069c988..d77431f2cb25 100644
--- a/include/asm-generic/smplock.h
+++ b/include/asm-generic/smplock.h
@@ -13,11 +13,10 @@ extern spinlock_t kernel_flag;
/*
* Release global kernel lock and global interrupt lock
*/
-#define release_kernel_lock(task, cpu) \
+#define release_kernel_lock(task) \
do { \
if (task->lock_depth >= 0) \
spin_unlock(&kernel_flag); \
- release_irqlock(cpu); \
__sti(); \
} while (0)
diff --git a/include/asm-i386/hardirq.h b/include/asm-i386/hardirq.h
index ed73b0444f6b..cbd78d1dcaa1 100644
--- a/include/asm-i386/hardirq.h
+++ b/include/asm-i386/hardirq.h
@@ -8,8 +8,6 @@
/* assembly code in softirq.h is sensitive to the offsets of these fields */
typedef struct {
unsigned int __softirq_pending;
- unsigned int __local_irq_count;
- unsigned int __local_bh_count;
unsigned int __syscall_count;
struct task_struct * __ksoftirqd_task; /* waitqueue is too large */
unsigned long idle_timestamp;
@@ -18,77 +16,27 @@ typedef struct {
#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
+#define IRQ_OFFSET 64
+
/*
* Are we in an interrupt context? Either doing bottom half
* or hardware interrupt processing?
*/
-#define in_interrupt() ({ int __cpu = smp_processor_id(); \
- (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); })
-
-#define in_irq() (local_irq_count(smp_processor_id()) != 0)
-
-#ifndef CONFIG_SMP
-
-#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
-#define hardirq_endlock(cpu) do { } while (0)
+#define in_interrupt() \
+ ((preempt_count() & ~PREEMPT_ACTIVE) >= IRQ_OFFSET)
-#define irq_enter(cpu, irq) (local_irq_count(cpu)++)
-#define irq_exit(cpu, irq) (local_irq_count(cpu)--)
+#define in_irq in_interrupt
-#define synchronize_irq() barrier()
+#define hardirq_trylock() (!in_interrupt())
+#define hardirq_endlock() do { } while (0)
-#define release_irqlock(cpu) do { } while (0)
+#define irq_enter() (preempt_count() += IRQ_OFFSET)
+#define irq_exit() (preempt_count() -= IRQ_OFFSET)
+#ifndef CONFIG_SMP
+# define synchronize_irq(irq) barrier()
#else
-
-#include <asm/atomic.h>
-#include <asm/smp.h>
-
-extern unsigned char global_irq_holder;
-extern unsigned volatile long global_irq_lock; /* long for set_bit -RR */
-
-static inline int irqs_running (void)
-{
- int i;
-
- for (i = 0; i < NR_CPUS; i++)
- if (local_irq_count(i))
- return 1;
- return 0;
-}
-
-static inline void release_irqlock(int cpu)
-{
- /* if we didn't own the irq lock, just ignore.. */
- if (global_irq_holder == (unsigned char) cpu) {
- global_irq_holder = NO_PROC_ID;
- clear_bit(0,&global_irq_lock);
- }
-}
-
-static inline void irq_enter(int cpu, int irq)
-{
- ++local_irq_count(cpu);
-
- while (test_bit(0,&global_irq_lock)) {
- cpu_relax();
- }
-}
-
-static inline void irq_exit(int cpu, int irq)
-{
- --local_irq_count(cpu);
-}
-
-static inline int hardirq_trylock(int cpu)
-{
- return !local_irq_count(cpu) && !test_bit(0,&global_irq_lock);
-}
-
-#define hardirq_endlock(cpu) do { } while (0)
-
-extern void synchronize_irq(void);
-
+ extern void synchronize_irq(unsigned int irq);
#endif /* CONFIG_SMP */
#endif /* __ASM_HARDIRQ_H */
diff --git a/include/asm-i386/rmap.h b/include/asm-i386/rmap.h
new file mode 100644
index 000000000000..5989b2938b5b
--- /dev/null
+++ b/include/asm-i386/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _I386_RMAP_H
+#define _I386_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-i386/smplock.h b/include/asm-i386/smplock.h
index 888a7b82f103..8bee3fd434c0 100644
--- a/include/asm-i386/smplock.h
+++ b/include/asm-i386/smplock.h
@@ -12,15 +12,9 @@ extern spinlock_t kernel_flag;
#ifdef CONFIG_SMP
#define kernel_locked() spin_is_locked(&kernel_flag)
-#define check_irq_holder(cpu) \
-do { \
- if (global_irq_holder == (cpu)) \
- BUG(); \
-} while(0)
#else
#ifdef CONFIG_PREEMPT
-#define kernel_locked() preempt_get_count()
-#define check_irq_holder(cpu) do { } while(0)
+#define kernel_locked() preempt_count()
#else
#define kernel_locked() 1
#endif
@@ -29,12 +23,10 @@ do { \
/*
* Release global kernel lock and global interrupt lock
*/
-#define release_kernel_lock(task, cpu) \
+#define release_kernel_lock(task) \
do { \
- if (unlikely(task->lock_depth >= 0)) { \
+ if (unlikely(task->lock_depth >= 0)) \
spin_unlock(&kernel_flag); \
- check_irq_holder(cpu); \
- } \
} while (0)
/*
diff --git a/include/asm-i386/softirq.h b/include/asm-i386/softirq.h
index c62cbece6ce7..c28019d821af 100644
--- a/include/asm-i386/softirq.h
+++ b/include/asm-i386/softirq.h
@@ -1,50 +1,27 @@
#ifndef __ASM_SOFTIRQ_H
#define __ASM_SOFTIRQ_H
-#include <asm/atomic.h>
+#include <linux/preempt.h>
#include <asm/hardirq.h>
-#define __cpu_bh_enable(cpu) \
- do { barrier(); local_bh_count(cpu)--; preempt_enable(); } while (0)
-#define cpu_bh_disable(cpu) \
- do { preempt_disable(); local_bh_count(cpu)++; barrier(); } while (0)
+#define local_bh_disable() \
+ do { preempt_count() += IRQ_OFFSET; barrier(); } while (0)
+#define __local_bh_enable() \
+ do { barrier(); preempt_count() -= IRQ_OFFSET; } while (0)
-#define local_bh_disable() cpu_bh_disable(smp_processor_id())
-#define __local_bh_enable() __cpu_bh_enable(smp_processor_id())
-
-#define in_softirq() (local_bh_count(smp_processor_id()) != 0)
-
-/*
- * NOTE: this assembly code assumes:
- *
- * (char *)&local_bh_count - 8 == (char *)&softirq_pending
- *
- * If you change the offsets in irq_stat then you have to
- * update this code as well.
- */
-#define _local_bh_enable() \
+#define local_bh_enable() \
do { \
- unsigned int *ptr = &local_bh_count(smp_processor_id()); \
- \
- barrier(); \
- if (!--*ptr) \
- __asm__ __volatile__ ( \
- "cmpl $0, -8(%0);" \
- "jnz 2f;" \
- "1:;" \
- \
- LOCK_SECTION_START("") \
- "2: pushl %%eax; pushl %%ecx; pushl %%edx;" \
- "call %c1;" \
- "popl %%edx; popl %%ecx; popl %%eax;" \
- "jmp 1b;" \
- LOCK_SECTION_END \
- \
- : /* no output */ \
- : "r" (ptr), "i" (do_softirq) \
- /* no registers clobbered */ ); \
+ if (unlikely((preempt_count() == IRQ_OFFSET) && \
+ softirq_pending(smp_processor_id()))) { \
+ __local_bh_enable(); \
+ do_softirq(); \
+ preempt_check_resched(); \
+ } else { \
+ __local_bh_enable(); \
+ preempt_check_resched(); \
+ } \
} while (0)
-#define local_bh_enable() do { _local_bh_enable(); preempt_enable(); } while (0)
+#define in_softirq() in_interrupt()
#endif /* __ASM_SOFTIRQ_H */
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 851f090e4394..7d9fa1282e26 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -324,24 +324,14 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
#define local_irq_disable() __cli()
#define local_irq_enable() __sti()
-#ifdef CONFIG_SMP
-
-extern void __global_cli(void);
-extern void __global_sti(void);
-extern unsigned long __global_save_flags(void);
-extern void __global_restore_flags(unsigned long);
-#define cli() __global_cli()
-#define sti() __global_sti()
-#define save_flags(x) ((x)=__global_save_flags())
-#define restore_flags(x) __global_restore_flags(x)
-
-#else
-
-#define cli() __cli()
-#define sti() __sti()
-#define save_flags(x) __save_flags(x)
-#define restore_flags(x) __restore_flags(x)
-
+/*
+ * Compatibility macros - they will be removed after some time.
+ */
+#if !CONFIG_SMP
+# define sti() __sti()
+# define cli() __cli()
+# define save_flags(flags) __save_flags(flags)
+# define restore_flags(flags) __restore_flags(flags)
#endif
/*
diff --git a/include/asm-ia64/rmap.h b/include/asm-ia64/rmap.h
new file mode 100644
index 000000000000..6738fe9e228f
--- /dev/null
+++ b/include/asm-ia64/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _IA64_RMAP_H
+#define _IA64_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-m68k/rmap.h b/include/asm-m68k/rmap.h
new file mode 100644
index 000000000000..85119e4145b6
--- /dev/null
+++ b/include/asm-m68k/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _M68K_RMAP_H
+#define _M68K_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-mips/rmap.h b/include/asm-mips/rmap.h
new file mode 100644
index 000000000000..2dc334a3b5f7
--- /dev/null
+++ b/include/asm-mips/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _MIPS_RMAP_H
+#define _MIPS_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-mips64/rmap.h b/include/asm-mips64/rmap.h
new file mode 100644
index 000000000000..07df131559c1
--- /dev/null
+++ b/include/asm-mips64/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _MIPS64_RMAP_H
+#define _MIPS64_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-parisc/rmap.h b/include/asm-parisc/rmap.h
new file mode 100644
index 000000000000..4ea8eb454751
--- /dev/null
+++ b/include/asm-parisc/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _PARISC_RMAP_H
+#define _PARISC_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-ppc/rmap.h b/include/asm-ppc/rmap.h
new file mode 100644
index 000000000000..50556b5ff25c
--- /dev/null
+++ b/include/asm-ppc/rmap.h
@@ -0,0 +1,9 @@
+#ifndef _PPC_RMAP_H
+#define _PPC_RMAP_H
+
+/* PPC calls pte_alloc() before mem_map[] is setup ... */
+#define BROKEN_PPC_PTE_ALLOC_ONE
+
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-s390/rmap.h b/include/asm-s390/rmap.h
new file mode 100644
index 000000000000..43d6a87b6e86
--- /dev/null
+++ b/include/asm-s390/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _S390_RMAP_H
+#define _S390_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-s390x/rmap.h b/include/asm-s390x/rmap.h
new file mode 100644
index 000000000000..c41a23a18e4d
--- /dev/null
+++ b/include/asm-s390x/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _S390X_RMAP_H
+#define _S390X_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-sh/rmap.h b/include/asm-sh/rmap.h
new file mode 100644
index 000000000000..31db8cc07739
--- /dev/null
+++ b/include/asm-sh/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _SH_RMAP_H
+#define _SH_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-sparc/rmap.h b/include/asm-sparc/rmap.h
new file mode 100644
index 000000000000..06063cffe7d2
--- /dev/null
+++ b/include/asm-sparc/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _SPARC_RMAP_H
+#define _SPARC_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/asm-sparc64/rmap.h b/include/asm-sparc64/rmap.h
new file mode 100644
index 000000000000..681849b2dce5
--- /dev/null
+++ b/include/asm-sparc64/rmap.h
@@ -0,0 +1,7 @@
+#ifndef _SPARC64_RMAP_H
+#define _SPARC64_RMAP_H
+
+/* nothing to see, move along */
+#include <asm-generic/rmap.h>
+
+#endif
diff --git a/include/linux/adfs_fs_i.h b/include/linux/adfs_fs_i.h
index 442282509489..6341f7059b0b 100644
--- a/include/linux/adfs_fs_i.h
+++ b/include/linux/adfs_fs_i.h
@@ -11,7 +11,7 @@
* adfs file system inode data in memory
*/
struct adfs_inode_info {
- unsigned long mmu_private;
+ loff_t mmu_private;
unsigned long parent_id; /* object id of parent */
__u32 loadaddr; /* RISC OS load address */
__u32 execaddr; /* RISC OS exec address */
diff --git a/include/linux/affs_fs_i.h b/include/linux/affs_fs_i.h
index 89872f778538..3ad824b7f30f 100644
--- a/include/linux/affs_fs_i.h
+++ b/include/linux/affs_fs_i.h
@@ -35,7 +35,7 @@ struct affs_inode_info {
struct affs_ext_key *i_ac; /* associative cache of extended blocks */
u32 i_ext_last; /* last accessed extended block */
struct buffer_head *i_ext_bh; /* bh of last extended block */
- unsigned long mmu_private;
+ loff_t mmu_private;
u32 i_protect; /* unused attribute bits */
u32 i_lastalloc; /* last allocated block */
int i_pa_cnt; /* number of preallocated blocks */
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 10820786560e..ffd04e267abe 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -81,13 +81,13 @@ enum chipset_type {
HP_ZX1,
};
-typedef struct _agp_version {
+struct agp_version {
u16 major;
u16 minor;
-} agp_version;
+};
typedef struct _agp_kern_info {
- agp_version version;
+ struct agp_version version;
struct pci_dev *device;
enum chipset_type chipset;
unsigned long mode;
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index d18b71dc7357..af97a9c76da4 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -53,13 +53,13 @@
#include <linux/types.h>
#include <asm/types.h>
-typedef struct _agp_version {
+struct agp_version {
__u16 major;
__u16 minor;
-} agp_version;
+};
typedef struct _agp_info {
- agp_version version; /* version of the driver */
+ struct agp_version version; /* version of the driver */
__u32 bridge_id; /* bridge vendor/device */
__u32 agp_mode; /* mode info of bridge */
off_t aper_base; /* base of aperture */
@@ -117,7 +117,7 @@ typedef struct _agp_unbind {
#define AGP_LOCK_INIT() sema_init(&(agp_fe.agp_mutex), 1)
#ifndef _AGP_BACKEND_H
-typedef struct _agp_version {
+struct _agp_version {
u16 major;
u16 minor;
} agp_version;
@@ -125,7 +125,7 @@ typedef struct _agp_version {
#endif
typedef struct _agp_info {
- agp_version version; /* version of the driver */
+ struct agp_version version; /* version of the driver */
u32 bridge_id; /* bridge vendor/device */
u32 agp_mode; /* mode info of bridge */
off_t aper_base; /* base of aperture */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index fe17499f6144..314addb2329d 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -28,6 +28,7 @@ struct linux_binprm{
struct file * file;
int e_uid, e_gid;
kernel_cap_t cap_inheritable, cap_permitted, cap_effective;
+ void *security;
int argc, envc;
char * filename; /* Name of binary */
unsigned long loader, exec;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 297cb0ba10c1..7460a98bb0b3 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -389,20 +389,6 @@ extern inline unsigned int block_size(struct block_device *bdev)
return bdev->bd_block_size;
}
-static inline loff_t blkdev_size_in_bytes(kdev_t dev)
-{
-#if 0
- if (blk_size_in_bytes[major(dev)])
- return blk_size_in_bytes[major(dev)][minor(dev)];
- else
-#endif
- if (blk_size[major(dev)])
- return (loff_t) blk_size[major(dev)][minor(dev)]
- << BLOCK_SIZE_BITS;
- else
- return 0;
-}
-
typedef struct {struct page *v;} Sector;
unsigned char *read_dev_sector(struct block_device *, unsigned long, Sector *);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index b07e937f900b..f9c9aafdf036 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -178,7 +178,7 @@ int block_write_full_page(struct page*, get_block_t*);
int block_read_full_page(struct page*, get_block_t*);
int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
- unsigned long *);
+ loff_t *);
int generic_cont_expand(struct inode *inode, loff_t size) ;
int block_commit_write(struct page *page, unsigned from, unsigned to);
int block_sync_page(struct page *);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2ac85b8e28a3..b58c1b43f734 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -274,7 +274,6 @@ struct iattr {
*/
struct page;
struct address_space;
-struct kiobuf;
struct address_space_operations {
int (*writepage)(struct page *);
@@ -343,7 +342,7 @@ struct block_device {
struct inode * bd_inode;
dev_t bd_dev; /* not a kdev_t - it's a search key */
int bd_openers;
- const struct block_device_operations *bd_op;
+ struct block_device_operations *bd_op;
struct request_queue *bd_queue;
struct semaphore bd_sem; /* open/close mutex */
struct list_head bd_inodes;
@@ -351,6 +350,9 @@ struct block_device {
int bd_holders;
struct block_device * bd_contains;
unsigned bd_block_size;
+ unsigned long bd_offset;
+ struct semaphore bd_part_sem;
+ unsigned bd_part_count;
};
struct inode {
@@ -493,10 +495,6 @@ struct file {
/* needed for tty driver, and maybe others */
void *private_data;
-
- /* preallocated helper kiobuf to speedup O_DIRECT */
- struct kiobuf *f_iobuf;
- long f_iobuf_lock;
};
extern spinlock_t files_lock;
#define file_list_lock() spin_lock(&files_lock);
@@ -1087,7 +1085,7 @@ extern void bd_release(struct block_device *);
extern void blk_run_queues(void);
/* fs/devices.c */
-extern const struct block_device_operations *get_blkfops(unsigned int);
+extern struct block_device_operations *get_blkfops(unsigned int);
extern int register_chrdev(unsigned int, const char *, struct file_operations *);
extern int unregister_chrdev(unsigned int, const char *);
extern int chrdev_open(struct inode *, struct file *);
@@ -1297,5 +1295,31 @@ static inline ino_t parent_ino(struct dentry *dentry)
return res;
}
+/* NOTE NOTE NOTE: this interface _will_ change in a couple of patches */
+
+static inline int dev_lock_part(kdev_t dev)
+{
+ struct block_device *bdev = bdget(kdev_t_to_nr(dev));
+ if (!bdev)
+ return -ENOMEM;
+ if (!down_trylock(&bdev->bd_part_sem)) {
+ if (!bdev->bd_part_count)
+ return 0;
+ up(&bdev->bd_part_sem);
+ }
+ bdput(bdev);
+ return -EBUSY;
+}
+
+static inline void dev_unlock_part(kdev_t dev)
+{
+ struct block_device *bdev = bdget(kdev_t_to_nr(dev));
+ if (!bdev)
+ BUG();
+ up(&bdev->bd_part_sem);
+ bdput(bdev);
+ bdput(bdev);
+}
+
#endif /* __KERNEL__ */
#endif /* _LINUX_FS_H */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 44a954b2c370..93755fee7f36 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -90,8 +90,10 @@ struct gendisk {
extern void add_gendisk(struct gendisk *gp);
extern void del_gendisk(struct gendisk *gp);
extern struct gendisk *get_gendisk(kdev_t dev);
-extern unsigned long get_start_sect(kdev_t dev);
-extern unsigned long get_nr_sects(kdev_t dev);
+static inline unsigned long get_start_sect(struct block_device *bdev)
+{
+ return bdev->bd_offset;
+}
#endif /* __KERNEL__ */
diff --git a/include/linux/hfs_fs_i.h b/include/linux/hfs_fs_i.h
index 39312c9b8fad..119cc5200197 100644
--- a/include/linux/hfs_fs_i.h
+++ b/include/linux/hfs_fs_i.h
@@ -19,7 +19,7 @@
struct hfs_inode_info {
int magic; /* A magic number */
- unsigned long mmu_private;
+ loff_t mmu_private;
struct hfs_cat_entry *entry;
/* For a regular or header file */
diff --git a/include/linux/hpfs_fs_i.h b/include/linux/hpfs_fs_i.h
index c4d6cce5d607..ab72ea5b5248 100644
--- a/include/linux/hpfs_fs_i.h
+++ b/include/linux/hpfs_fs_i.h
@@ -2,7 +2,7 @@
#define _HPFS_FS_I
struct hpfs_inode_info {
- unsigned long mmu_private;
+ loff_t mmu_private;
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/irq_cpustat.h b/include/linux/irq_cpustat.h
index dfd73c5ec60d..6eab29be1d61 100644
--- a/include/linux/irq_cpustat.h
+++ b/include/linux/irq_cpustat.h
@@ -29,8 +29,6 @@ extern irq_cpustat_t irq_stat[]; /* defined in asm/hardirq.h */
/* arch independent irq_stat fields */
#define softirq_pending(cpu) __IRQ_STAT((cpu), __softirq_pending)
-#define local_irq_count(cpu) __IRQ_STAT((cpu), __local_irq_count)
-#define local_bh_count(cpu) __IRQ_STAT((cpu), __local_bh_count)
#define syscall_count(cpu) __IRQ_STAT((cpu), __syscall_count)
#define ksoftirqd_task(cpu) __IRQ_STAT((cpu), __ksoftirqd_task)
/* arch dependent irq_stat fields */
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index de592f2ba451..75533ee86b73 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -26,6 +26,11 @@ struct kernel_stat {
unsigned int dk_drive_wblk[DK_MAX_MAJOR][DK_MAX_DISK];
unsigned int pgpgin, pgpgout;
unsigned int pswpin, pswpout;
+ unsigned int pgalloc, pgfree;
+ unsigned int pgactivate, pgdeactivate;
+ unsigned int pgfault, pgmajfault;
+ unsigned int pgscan, pgsteal;
+ unsigned int pageoutrun, allocstall;
#if !defined(CONFIG_ARCH_S390)
unsigned int irqs[NR_CPUS][NR_IRQS];
#endif
@@ -35,6 +40,13 @@ extern struct kernel_stat kstat;
extern unsigned long nr_context_switches(void);
+/*
+ * Maybe we need to smp-ify kernel_stat some day. It would be nice to do
+ * that without having to modify all the code that increments the stats.
+ */
+#define KERNEL_STAT_INC(x) kstat.x++
+#define KERNEL_STAT_ADD(x, y) kstat.x += y
+
#if !defined(CONFIG_ARCH_S390)
/*
* Number of interrupts per specific IRQ source, since bootup
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 163e19fd7b33..685868b9e0e4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -130,6 +130,9 @@ struct vm_operations_struct {
struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int unused);
};
+/* forward declaration; pte_chain is meant to be internal to rmap.c */
+struct pte_chain;
+
/*
* Each physical page in the system has a struct page associated with
* it to keep track of whatever it is we are using the page for at the
@@ -154,6 +157,11 @@ struct page {
updated asynchronously */
struct list_head lru; /* Pageout list, eg. active_list;
protected by pagemap_lru_lock !! */
+ union {
+ struct pte_chain * chain; /* Reverse pte mapping pointer.
+ * protected by PG_chainlock */
+ pte_t * direct;
+ } pte;
unsigned long private; /* mapping-private opaque data */
/*
@@ -453,17 +461,16 @@ extern int filemap_sync(struct vm_area_struct *, unsigned long, size_t, unsigned
extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int);
/* mm/page-writeback.c */
-int generic_writepages(struct address_space *mapping, int *nr_to_write);
int write_one_page(struct page *page, int wait);
/* readahead.c */
#define VM_MAX_READAHEAD 128 /* kbytes */
#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */
-void do_page_cache_readahead(struct file *file,
+int do_page_cache_readahead(struct file *file,
unsigned long offset, unsigned long nr_to_read);
void page_cache_readahead(struct file *file, unsigned long offset);
void page_cache_readaround(struct file *file, unsigned long offset);
-void handle_ra_thrashing(struct file *file);
+void handle_ra_miss(struct file *file);
/* vma is the first one with address < vma->vm_end,
* and even address < vma->vm_start. Have to extend vma. */
diff --git a/include/linux/mpage.h b/include/linux/mpage.h
index 929fca427465..52253d90f55d 100644
--- a/include/linux/mpage.h
+++ b/include/linux/mpage.h
@@ -16,3 +16,8 @@ int mpage_readpage(struct page *page, get_block_t get_block);
int mpage_writepages(struct address_space *mapping,
int *nr_to_write, get_block_t get_block);
+static inline int
+generic_writepages(struct address_space *mapping, int *nr_to_write)
+{
+ return mpage_writepages(mapping, nr_to_write, NULL);
+}
diff --git a/include/linux/msdos_fs_i.h b/include/linux/msdos_fs_i.h
index 438afd880ccc..85f649402617 100644
--- a/include/linux/msdos_fs_i.h
+++ b/include/linux/msdos_fs_i.h
@@ -8,7 +8,7 @@
*/
struct msdos_inode_info {
- unsigned long mmu_private;
+ loff_t mmu_private;
int i_start; /* first cluster or 0 */
int i_logstart; /* logical first cluster */
int i_attrs; /* unused attribute bits */
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 4dfca8d4952c..4b64aebf312e 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -63,6 +63,35 @@ struct msginfo {
#ifdef __KERNEL__
+/* one msg_msg structure for each message */
+struct msg_msg {
+ struct list_head m_list;
+ long m_type;
+ int m_ts; /* message text size */
+ struct msg_msgseg* next;
+ /* the actual message follows immediately */
+};
+
+#define DATALEN_MSG (PAGE_SIZE-sizeof(struct msg_msg))
+#define DATALEN_SEG (PAGE_SIZE-sizeof(struct msg_msgseg))
+
+/* one msq_queue structure for each present queue on the system */
+struct msg_queue {
+ struct kern_ipc_perm q_perm;
+ time_t q_stime; /* last msgsnd time */
+ time_t q_rtime; /* last msgrcv time */
+ time_t q_ctime; /* last change time */
+ unsigned long q_cbytes; /* current number of bytes on queue */
+ unsigned long q_qnum; /* number of messages in queue */
+ unsigned long q_qbytes; /* max number of bytes on queue */
+ pid_t q_lspid; /* pid of last msgsnd */
+ pid_t q_lrpid; /* last receive pid */
+
+ struct list_head q_messages;
+ struct list_head q_receivers;
+ struct list_head q_senders;
+};
+
asmlinkage long sys_msgget (key_t key, int msgflg);
asmlinkage long sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg);
asmlinkage long sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, int msgflg);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 93a6f27cb454..f272b7d7f465 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -47,7 +47,7 @@
* locked- and dirty-page accounting. The top eight bits of page->flags are
* used for page->zone, so putting flag bits there doesn't work.
*/
-#define PG_locked 0 /* Page is locked. Don't touch. */
+#define PG_locked 0 /* Page is locked. Don't touch. */
#define PG_error 1
#define PG_referenced 2
#define PG_uptodate 3
@@ -64,7 +64,10 @@
#define PG_private 12 /* Has something at ->private */
#define PG_writeback 13 /* Page is under writeback */
-#define PG_nosave 15 /* Used for system suspend/resume */
+#define PG_nosave 14 /* Used for system suspend/resume */
+#define PG_chainlock 15 /* lock bit for ->pte_chain */
+
+#define PG_direct 16 /* ->pte_chain points directly at pte */
/*
* Global page accounting. One instance per CPU.
@@ -75,6 +78,9 @@ extern struct page_state {
unsigned long nr_pagecache;
unsigned long nr_active; /* on active_list LRU */
unsigned long nr_inactive; /* on inactive_list LRU */
+ unsigned long nr_page_table_pages;
+ unsigned long nr_pte_chain_pages;
+ unsigned long used_pte_chains_bytes;
} ____cacheline_aligned_in_smp page_states[NR_CPUS];
extern void get_page_state(struct page_state *ret);
@@ -216,6 +222,37 @@ extern void get_page_state(struct page_state *ret);
#define ClearPageNosave(page) clear_bit(PG_nosave, &(page)->flags)
#define TestClearPageNosave(page) test_and_clear_bit(PG_nosave, &(page)->flags)
+#define PageDirect(page) test_bit(PG_direct, &(page)->flags)
+#define SetPageDirect(page) set_bit(PG_direct, &(page)->flags)
+#define TestSetPageDirect(page) test_and_set_bit(PG_direct, &(page)->flags)
+#define ClearPageDirect(page) clear_bit(PG_direct, &(page)->flags)
+#define TestClearPageDirect(page) test_and_clear_bit(PG_direct, &(page)->flags)
+
+/*
+ * inlines for acquisition and release of PG_chainlock
+ */
+static inline void pte_chain_lock(struct page *page)
+{
+ /*
+ * Assuming the lock is uncontended, this never enters
+ * the body of the outer loop. If it is contended, then
+ * within the inner loop a non-atomic test is used to
+ * busywait with less bus contention for a good time to
+ * attempt to acquire the lock bit.
+ */
+ preempt_disable();
+ while (test_and_set_bit(PG_chainlock, &page->flags)) {
+ while (test_bit(PG_chainlock, &page->flags))
+ cpu_relax();
+ }
+}
+
+static inline void pte_chain_unlock(struct page *page)
+{
+ clear_bit(PG_chainlock, &page->flags);
+ preempt_enable();
+}
+
/*
* The PageSwapCache predicate doesn't use a PG_flag at this time,
* but it may again do so one day.
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index a3d37ab267ae..6c4ee12fb7ec 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -52,8 +52,6 @@ extern struct page * read_cache_page(struct address_space *mapping,
extern int add_to_page_cache(struct page *page,
struct address_space *mapping, unsigned long index);
-extern int add_to_page_cache_unique(struct page *page,
- struct address_space *mapping, unsigned long index);
static inline void ___add_to_page_cache(struct page *page,
struct address_space *mapping, unsigned long index)
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
new file mode 100644
index 000000000000..172471f0dbde
--- /dev/null
+++ b/include/linux/preempt.h
@@ -0,0 +1,46 @@
+#ifndef __LINUX_PREEMPT_H
+#define __LINUX_PREEMPT_H
+
+#include <linux/config.h>
+
+#define preempt_count() (current_thread_info()->preempt_count)
+
+#ifdef CONFIG_PREEMPT
+
+extern void preempt_schedule(void);
+
+#define preempt_disable() \
+do { \
+ preempt_count()++; \
+ barrier(); \
+} while (0)
+
+#define preempt_enable_no_resched() \
+do { \
+ preempt_count()--; \
+ barrier(); \
+} while (0)
+
+#define preempt_enable() \
+do { \
+ preempt_enable_no_resched(); \
+ if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
+ preempt_schedule(); \
+} while (0)
+
+#define preempt_check_resched() \
+do { \
+ if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
+ preempt_schedule(); \
+} while (0)
+
+#else
+
+#define preempt_disable() do { } while (0)
+#define preempt_enable_no_resched() do {} while(0)
+#define preempt_enable() do { } while (0)
+#define preempt_check_resched() do { } while (0)
+
+#endif
+
+#endif /* __LINUX_PREEMPT_H */
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index 06e0e6b51e4c..a84aa2091c2b 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -106,7 +106,7 @@ struct qnx4_sb_info {
struct qnx4_inode_info {
struct qnx4_inode_entry raw;
- unsigned long mmu_private;
+ loff_t mmu_private;
struct inode vfs_inode;
};
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2e38ae05d9d2..1d288587e44d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -354,6 +354,8 @@ struct task_struct {
void *notifier_data;
sigset_t *notifier_mask;
+ void *security;
+
/* Thread group tracking */
u32 parent_exec_id;
u32 self_exec_id;
@@ -587,10 +589,9 @@ extern int request_irq(unsigned int,
unsigned long, const char *, void *);
extern void free_irq(unsigned int, void *);
-/*
- * capable() checks for a particular capability.
- * See include/linux/capability.h for defined capabilities.
- */
+/* capable prototype and code moved to security.[hc] */
+#include <linux/security.h>
+#if 0
static inline int capable(int cap)
{
if (cap_raised(current->cap_effective, cap)) {
@@ -599,6 +600,7 @@ static inline int capable(int cap)
}
return 0;
}
+#endif /* if 0 */
/*
* Routines for handling mm_structs
diff --git a/include/linux/security.h b/include/linux/security.h
new file mode 100644
index 000000000000..3063323bd1fb
--- /dev/null
+++ b/include/linux/security.h
@@ -0,0 +1,383 @@
+/*
+ * Linux Security plug
+ *
+ * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com>
+ * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com>
+ * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com>
+ * Copyright (C) 2001 James Morris <jmorris@intercode.com.au>
+ * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group)
+ *
+ * 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.
+ *
+ * Due to this file being licensed under the GPL there is controversy over
+ * whether this permits you to write a module that #includes this file
+ * without placing your module under the GPL. Please consult a lawyer for
+ * advice before doing this.
+ *
+ */
+
+#ifndef __LINUX_SECURITY_H
+#define __LINUX_SECURITY_H
+
+#ifdef __KERNEL__
+
+#include <linux/fs.h>
+#include <linux/binfmts.h>
+#include <linux/signal.h>
+#include <linux/resource.h>
+#include <linux/sem.h>
+#include <linux/sysctl.h>
+#include <linux/shm.h>
+#include <linux/msg.h>
+
+/*
+ * Values used in the task_security_ops calls
+ */
+/* setuid or setgid, id0 == uid or gid */
+#define LSM_SETID_ID 1
+
+/* setreuid or setregid, id0 == real, id1 == eff */
+#define LSM_SETID_RE 2
+
+/* setresuid or setresgid, id0 == real, id1 == eff, uid2 == saved */
+#define LSM_SETID_RES 4
+
+/* setfsuid or setfsgid, id0 == fsuid or fsgid */
+#define LSM_SETID_FS 8
+
+/* forward declares to avoid warnings */
+struct sk_buff;
+struct net_device;
+struct nfsctl_arg;
+struct sched_param;
+struct swap_info_struct;
+
+/**
+ * struct security_operations - main security structure
+ *
+ * Security hooks for program execution operations.
+ *
+ * @bprm_alloc_security:
+ * Allocate and attach a security structure to the @bprm->security field.
+ * The security field is initialized to NULL when the bprm structure is
+ * allocated.
+ * @bprm contains the linux_binprm structure to be modified.
+ * Return 0 if operation was successful.
+ * @bprm_free_security:
+ * @bprm contains the linux_binprm structure to be modified.
+ * Deallocate and clear the @bprm->security field.
+ * @bprm_compute_creds:
+ * Compute and set the security attributes of a process being transformed
+ * by an execve operation based on the old attributes (current->security)
+ * and the information saved in @bprm->security by the set_security hook.
+ * Since this hook function (and its caller) are void, this hook can not
+ * return an error. However, it can leave the security attributes of the
+ * process unchanged if an access failure occurs at this point. It can
+ * also perform other state changes on the process (e.g. closing open
+ * file descriptors to which access is no longer granted if the attributes
+ * were changed).
+ * @bprm contains the linux_binprm structure.
+ * @bprm_set_security:
+ * Save security information in the bprm->security field, typically based
+ * on information about the bprm->file, for later use by the compute_creds
+ * hook. This hook may also optionally check permissions (e.g. for
+ * transitions between security domains).
+ * This hook may be called multiple times during a single execve, e.g. for
+ * interpreters. The hook can tell whether it has already been called by
+ * checking to see if @bprm->security is non-NULL. If so, then the hook
+ * may decide either to retain the security information saved earlier or
+ * to replace it.
+ * @bprm contains the linux_binprm structure.
+ * Return 0 if the hook is successful and permission is granted.
+ * @bprm_check_security:
+ * This hook mediates the point when a search for a binary handler will
+ * begin. It allows a check the @bprm->security value which is set in
+ * the preceding set_security call. The primary difference from
+ * set_security is that the argv list and envp list are reliably
+ * available in @bprm. This hook may be called multiple times
+ * during a single execve; and in each pass set_security is called
+ * first.
+ * @bprm contains the linux_binprm structure.
+ * Return 0 if the hook is successful and permission is granted.
+ *
+ * Security hooks for task operations.
+ *
+ * @task_create:
+ * Check permission before creating a child process. See the clone(2)
+ * manual page for definitions of the @clone_flags.
+ * @clone_flags contains the flags indicating what should be shared.
+ * Return 0 if permission is granted.
+ * @task_alloc_security:
+ * @p contains the task_struct for child process.
+ * Allocate and attach a security structure to the p->security field. The
+ * security field is initialized to NULL when the task structure is
+ * allocated.
+ * Return 0 if operation was successful.
+ * @task_free_security:
+ * @p contains the task_struct for process.
+ * Deallocate and clear the p->security field.
+ * @task_setuid:
+ * Check permission before setting one or more of the user identity
+ * attributes of the current process. The @flags parameter indicates
+ * which of the set*uid system calls invoked this hook and how to
+ * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
+ * definitions at the beginning of this file for the @flags values and
+ * their meanings.
+ * @id0 contains a uid.
+ * @id1 contains a uid.
+ * @id2 contains a uid.
+ * @flags contains one of the LSM_SETID_* values.
+ * Return 0 if permission is granted.
+ * @task_post_setuid:
+ * Update the module's state after setting one or more of the user
+ * identity attributes of the current process. The @flags parameter
+ * indicates which of the set*uid system calls invoked this hook. If
+ * @flags is LSM_SETID_FS, then @old_ruid is the old fs uid and the other
+ * parameters are not used.
+ * @old_ruid contains the old real uid (or fs uid if LSM_SETID_FS).
+ * @old_euid contains the old effective uid (or -1 if LSM_SETID_FS).
+ * @old_suid contains the old saved uid (or -1 if LSM_SETID_FS).
+ * @flags contains one of the LSM_SETID_* values.
+ * Return 0 on success.
+ * @task_setgid:
+ * Check permission before setting one or more of the group identity
+ * attributes of the current process. The @flags parameter indicates
+ * which of the set*gid system calls invoked this hook and how to
+ * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
+ * definitions at the beginning of this file for the @flags values and
+ * their meanings.
+ * @id0 contains a gid.
+ * @id1 contains a gid.
+ * @id2 contains a gid.
+ * @flags contains one of the LSM_SETID_* values.
+ * Return 0 if permission is granted.
+ * @task_setpgid:
+ * Check permission before setting the process group identifier of the
+ * process @p to @pgid.
+ * @p contains the task_struct for process being modified.
+ * @pgid contains the new pgid.
+ * Return 0 if permission is granted.
+ * @task_getpgid:
+ * Check permission before getting the process group identifier of the
+ * process @p.
+ * @p contains the task_struct for the process.
+ * Return 0 if permission is granted.
+ * @task_getsid:
+ * Check permission before getting the session identifier of the process
+ * @p.
+ * @p contains the task_struct for the process.
+ * Return 0 if permission is granted.
+ * @task_setgroups:
+ * Check permission before setting the supplementary group set of the
+ * current process to @grouplist.
+ * @gidsetsize contains the number of elements in @grouplist.
+ * @grouplist contains the array of gids.
+ * Return 0 if permission is granted.
+ * @task_setnice:
+ * Check permission before setting the nice value of @p to @nice.
+ * @p contains the task_struct of process.
+ * @nice contains the new nice value.
+ * Return 0 if permission is granted.
+ * @task_setrlimit:
+ * Check permission before setting the resource limits of the current
+ * process for @resource to @new_rlim. The old resource limit values can
+ * be examined by dereferencing (current->rlim + resource).
+ * @resource contains the resource whose limit is being set.
+ * @new_rlim contains the new limits for @resource.
+ * Return 0 if permission is granted.
+ * @task_setscheduler:
+ * Check permission before setting scheduling policy and/or parameters of
+ * process @p based on @policy and @lp.
+ * @p contains the task_struct for process.
+ * @policy contains the scheduling policy.
+ * @lp contains the scheduling parameters.
+ * Return 0 if permission is granted.
+ * @task_getscheduler:
+ * Check permission before obtaining scheduling information for process
+ * @p.
+ * @p contains the task_struct for process.
+ * Return 0 if permission is granted.
+ * @task_kill:
+ * Check permission before sending signal @sig to @p. @info can be NULL,
+ * the constant 1, or a pointer to a siginfo structure. If @info is 1 or
+ * SI_FROMKERNEL(info) is true, then the signal should be viewed as coming
+ * from the kernel and should typically be permitted.
+ * SIGIO signals are handled separately by the send_sigiotask hook in
+ * file_security_ops.
+ * @p contains the task_struct for process.
+ * @info contains the signal information.
+ * @sig contains the signal value.
+ * Return 0 if permission is granted.
+ * @task_wait:
+ * Check permission before allowing a process to reap a child process @p
+ * and collect its status information.
+ * @p contains the task_struct for process.
+ * Return 0 if permission is granted.
+ * @task_prctl:
+ * Check permission before performing a process control operation on the
+ * current process.
+ * @option contains the operation.
+ * @arg2 contains a argument.
+ * @arg3 contains a argument.
+ * @arg4 contains a argument.
+ * @arg5 contains a argument.
+ * Return 0 if permission is granted.
+ * @task_kmod_set_label:
+ * Set the security attributes in current->security for the kernel module
+ * loader thread, so that it has the permissions needed to perform its
+ * function.
+ * @task_reparent_to_init:
+ * Set the security attributes in @p->security for a kernel thread that
+ * is being reparented to the init task.
+ * @p contains the task_struct for the kernel thread.
+ *
+ * @ptrace:
+ * Check permission before allowing the @parent process to trace the
+ * @child process.
+ * Security modules may also want to perform a process tracing check
+ * during an execve in the set_security or compute_creds hooks of
+ * binprm_security_ops if the process is being traced and its security
+ * attributes would be changed by the execve.
+ * @parent contains the task_struct structure for parent process.
+ * @child contains the task_struct structure for child process.
+ * Return 0 if permission is granted.
+ * @capget:
+ * Get the @effective, @inheritable, and @permitted capability sets for
+ * the @target process. The hook may also perform permission checking to
+ * determine if the current process is allowed to see the capability sets
+ * of the @target process.
+ * @target contains the task_struct structure for target process.
+ * @effective contains the effective capability set.
+ * @inheritable contains the inheritable capability set.
+ * @permitted contains the permitted capability set.
+ * Return 0 if the capability sets were successfully obtained.
+ * @capset_check:
+ * Check permission before setting the @effective, @inheritable, and
+ * @permitted capability sets for the @target process.
+ * Caveat: @target is also set to current if a set of processes is
+ * specified (i.e. all processes other than current and init or a
+ * particular process group). Hence, the capset_set hook may need to
+ * revalidate permission to the actual target process.
+ * @target contains the task_struct structure for target process.
+ * @effective contains the effective capability set.
+ * @inheritable contains the inheritable capability set.
+ * @permitted contains the permitted capability set.
+ * Return 0 if permission is granted.
+ * @capset_set:
+ * Set the @effective, @inheritable, and @permitted capability sets for
+ * the @target process. Since capset_check cannot always check permission
+ * to the real @target process, this hook may also perform permission
+ * checking to determine if the current process is allowed to set the
+ * capability sets of the @target process. However, this hook has no way
+ * of returning an error due to the structure of the sys_capset code.
+ * @target contains the task_struct structure for target process.
+ * @effective contains the effective capability set.
+ * @inheritable contains the inheritable capability set.
+ * @permitted contains the permitted capability set.
+ * @capable:
+ * Check whether the @tsk process has the @cap capability.
+ * @tsk contains the task_struct for the process.
+ * @cap contains the capability <include/linux/capability.h>.
+ * Return 0 if the capability is granted for @tsk.
+ * @sys_security:
+ * Security modules may use this hook to implement new system calls for
+ * security-aware applications. The interface is similar to socketcall,
+ * but with an @id parameter to help identify the security module whose
+ * call is being invoked. The module is responsible for interpreting the
+ * parameters, and must copy in the @args array from user space if it is
+ * used.
+ * The recommended convention for creating the hexadecimal @id value is
+ * echo "Name_of_module" | md5sum | cut -c -8; by using this convention,
+ * there is no need for a central registry.
+ * @id contains the security module identifier.
+ * @call contains the call value.
+ * @args contains the call arguments (user space pointer).
+ * The module should return -ENOSYS if it does not implement any new
+ * system calls.
+ *
+ * @register_security:
+ * allow module stacking.
+ * @name contains the name of the security module being stacked.
+ * @ops contains a pointer to the struct security_operations of the module to stack.
+ * @unregister_security:
+ * remove a stacked module.
+ * @name contains the name of the security module being unstacked.
+ * @ops contains a pointer to the struct security_operations of the module to unstack.
+ *
+ * This is the main security structure.
+ */
+struct security_operations {
+ int (*ptrace) (struct task_struct * parent, struct task_struct * child);
+ int (*capget) (struct task_struct * target,
+ kernel_cap_t * effective,
+ kernel_cap_t * inheritable, kernel_cap_t * permitted);
+ int (*capset_check) (struct task_struct * target,
+ kernel_cap_t * effective,
+ kernel_cap_t * inheritable,
+ kernel_cap_t * permitted);
+ void (*capset_set) (struct task_struct * target,
+ kernel_cap_t * effective,
+ kernel_cap_t * inheritable,
+ kernel_cap_t * permitted);
+ int (*capable) (struct task_struct * tsk, int cap);
+ int (*sys_security) (unsigned int id, unsigned call,
+ unsigned long *args);
+
+ int (*bprm_alloc_security) (struct linux_binprm * bprm);
+ void (*bprm_free_security) (struct linux_binprm * bprm);
+ void (*bprm_compute_creds) (struct linux_binprm * bprm);
+ int (*bprm_set_security) (struct linux_binprm * bprm);
+ int (*bprm_check_security) (struct linux_binprm * bprm);
+
+ int (*task_create) (unsigned long clone_flags);
+ int (*task_alloc_security) (struct task_struct * p);
+ void (*task_free_security) (struct task_struct * p);
+ int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
+ int (*task_post_setuid) (uid_t old_ruid /* or fsuid */ ,
+ uid_t old_euid, uid_t old_suid, int flags);
+ int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
+ int (*task_setpgid) (struct task_struct * p, pid_t pgid);
+ int (*task_getpgid) (struct task_struct * p);
+ int (*task_getsid) (struct task_struct * p);
+ int (*task_setgroups) (int gidsetsize, gid_t * grouplist);
+ int (*task_setnice) (struct task_struct * p, int nice);
+ int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim);
+ int (*task_setscheduler) (struct task_struct * p, int policy,
+ struct sched_param * lp);
+ int (*task_getscheduler) (struct task_struct * p);
+ int (*task_kill) (struct task_struct * p,
+ struct siginfo * info, int sig);
+ int (*task_wait) (struct task_struct * p);
+ int (*task_prctl) (int option, unsigned long arg2,
+ unsigned long arg3, unsigned long arg4,
+ unsigned long arg5);
+ void (*task_kmod_set_label) (void);
+ void (*task_reparent_to_init) (struct task_struct * p);
+
+ /* allow module stacking */
+ int (*register_security) (const char *name,
+ struct security_operations *ops);
+ int (*unregister_security) (const char *name,
+ struct security_operations *ops);
+};
+
+
+/* prototypes */
+extern int security_scaffolding_startup (void);
+extern int register_security (struct security_operations *ops);
+extern int unregister_security (struct security_operations *ops);
+extern int mod_reg_security (const char *name, struct security_operations *ops);
+extern int mod_unreg_security (const char *name, struct security_operations *ops);
+extern int capable (int cap);
+
+/* global variables */
+extern struct security_operations *security_ops;
+
+
+#endif /* __KERNEL__ */
+
+#endif /* ! __LINUX_SECURITY_H */
+
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
new file mode 100644
index 000000000000..19ab829b67e3
--- /dev/null
+++ b/include/linux/serial_core.h
@@ -0,0 +1,395 @@
+/*
+ * linux/drivers/char/serial_core.h
+ *
+ * Copyright (C) 2000 Deep Blue Solutions Ltd.
+ *
+ * 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
+ *
+ * $Id: serial_core.h,v 1.49 2002/07/20 18:06:32 rmk Exp $
+ */
+
+/*
+ * The type definitions. These are from Ted Ts'o's serial.h
+ */
+#define PORT_UNKNOWN 0
+#define PORT_8250 1
+#define PORT_16450 2
+#define PORT_16550 3
+#define PORT_16550A 4
+#define PORT_CIRRUS 5
+#define PORT_16650 6
+#define PORT_16650V2 7
+#define PORT_16750 8
+#define PORT_STARTECH 9
+#define PORT_16C950 10
+#define PORT_16654 11
+#define PORT_16850 12
+#define PORT_RSA 13
+#define PORT_MAX_8250 13 /* max port ID */
+
+/*
+ * ARM specific type numbers. These are not currently guaranteed
+ * to be implemented, and will change in the future. These are
+ * separate so any additions to the old serial.c that occur before
+ * we are merged can be easily merged here.
+ */
+#define PORT_AMBA 32
+#define PORT_CLPS711X 33
+#define PORT_SA1100 34
+#define PORT_UART00 35
+#define PORT_21285 37
+
+#ifdef __KERNEL__
+
+#include <linux/config.h>
+#include <linux/interrupt.h>
+#include <linux/circ_buf.h>
+#include <linux/spinlock.h>
+
+struct uart_port;
+struct uart_info;
+struct serial_struct;
+
+/*
+ * This structure describes all the operations that can be
+ * done on the physical hardware.
+ */
+struct uart_ops {
+ unsigned int (*tx_empty)(struct uart_port *);
+ void (*set_mctrl)(struct uart_port *, unsigned int mctrl);
+ unsigned int (*get_mctrl)(struct uart_port *);
+ void (*stop_tx)(struct uart_port *, unsigned int tty_stop);
+ void (*start_tx)(struct uart_port *, unsigned int tty_start);
+ void (*send_xchar)(struct uart_port *, char ch);
+ void (*stop_rx)(struct uart_port *);
+ void (*enable_ms)(struct uart_port *);
+ void (*break_ctl)(struct uart_port *, int ctl);
+ int (*startup)(struct uart_port *);
+ void (*shutdown)(struct uart_port *);
+ void (*change_speed)(struct uart_port *, unsigned int cflag,
+ unsigned int iflag, unsigned int quot);
+ void (*pm)(struct uart_port *, unsigned int state,
+ unsigned int oldstate);
+ int (*set_wake)(struct uart_port *, unsigned int state);
+
+ /*
+ * Return a string describing the type of the port
+ */
+ const char *(*type)(struct uart_port *);
+
+ /*
+ * Release IO and memory resources used by the port.
+ * This includes iounmap if necessary.
+ */
+ void (*release_port)(struct uart_port *);
+
+ /*
+ * Request IO and memory resources used by the port.
+ * This includes iomapping the port if necessary.
+ */
+ int (*request_port)(struct uart_port *);
+ void (*config_port)(struct uart_port *, int);
+ int (*verify_port)(struct uart_port *, struct serial_struct *);
+ int (*ioctl)(struct uart_port *, unsigned int, unsigned long);
+};
+
+#define UART_CONFIG_TYPE (1 << 0)
+#define UART_CONFIG_IRQ (1 << 1)
+
+struct uart_icount {
+ __u32 cts;
+ __u32 dsr;
+ __u32 rng;
+ __u32 dcd;
+ __u32 rx;
+ __u32 tx;
+ __u32 frame;
+ __u32 overrun;
+ __u32 parity;
+ __u32 brk;
+ __u32 buf_overrun;
+};
+
+struct uart_port {
+ spinlock_t lock; /* port lock */
+ unsigned int iobase; /* in/out[bwl] */
+ char *membase; /* read/write[bwl] */
+ unsigned int irq; /* irq number */
+ unsigned int uartclk; /* base uart clock */
+ unsigned char fifosize; /* tx fifo size */
+ unsigned char x_char; /* xon/xoff char */
+ unsigned char regshift; /* reg offset shift */
+ unsigned char iotype; /* io access style */
+
+#define UPIO_PORT (0)
+#define UPIO_HUB6 (1)
+#define UPIO_MEM (2)
+
+ unsigned int read_status_mask; /* driver specific */
+ unsigned int ignore_status_mask; /* driver specific */
+ struct uart_info *info; /* pointer to parent info */
+ struct uart_icount icount; /* statistics */
+
+ struct console *cons; /* struct console, if any */
+#ifdef CONFIG_SERIAL_CORE_CONSOLE
+ unsigned long sysrq; /* sysrq timeout */
+#endif
+
+ unsigned int flags;
+
+#define UPF_HUP_NOTIFY (1 << 0)
+#define UPF_SAK (1 << 2)
+#define UPF_SPD_MASK (0x1030)
+#define UPF_SPD_HI (0x0010)
+#define UPF_SPD_VHI (0x0020)
+#define UPF_SPD_CUST (0x0030)
+#define UPF_SPD_SHI (0x1000)
+#define UPF_SPD_WARP (0x1010)
+#define UPF_SKIP_TEST (1 << 6)
+#define UPF_AUTO_IRQ (1 << 7)
+#define UPF_HARDPPS_CD (1 << 11)
+#define UPF_LOW_LATENCY (1 << 13)
+#define UPF_BUGGY_UART (1 << 14)
+#define UPF_AUTOPROBE (1 << 15)
+#define UPF_BOOT_AUTOCONF (1 << 28)
+
+#define UPF_FLAGS (0x7fff)
+#define UPF_USR_MASK (UPF_SPD_MASK|UPF_LOW_LATENCY)
+
+ unsigned int mctrl; /* current modem ctrl settings */
+ unsigned int timeout; /* character-based timeout */
+ unsigned int type; /* port type */
+ struct uart_ops *ops;
+ unsigned int line; /* port index */
+ unsigned long mapbase; /* for ioremap */
+ unsigned char hub6; /* this should be in the 8250 driver */
+ unsigned char unused[3];
+};
+
+/*
+ * This is the state information which is persistent across opens.
+ * The low level driver must not to touch any elements contained
+ * within.
+ */
+struct uart_state {
+ unsigned int close_delay;
+ unsigned int closing_wait;
+
+#define USF_CLOSING_WAIT_INF (0)
+#define USF_CLOSING_WAIT_NONE (65535)
+
+ unsigned int custom_divisor;
+
+ int count;
+ struct uart_info *info;
+ struct uart_port *port;
+
+#ifdef CONFIG_PM
+ struct pm_dev *pm;
+#endif
+};
+
+#define UART_XMIT_SIZE 1024
+/*
+ * This is the state information which is only valid when the port
+ * is open; it may be freed by the core driver once the device has
+ * been closed. Either the low level driver or the core can modify
+ * stuff here.
+ */
+struct uart_info {
+ struct uart_port *port;
+ struct uart_state *state;
+ struct tty_struct *tty;
+ struct circ_buf xmit;
+ unsigned int flags;
+
+/*
+ * These are the flags that specific to info->flags, and reflect our
+ * internal state. They can not be accessed via port->flags. Low
+ * level drivers must not change these, but may query them instead.
+ */
+#define UIF_CHECK_CD (1 << 25)
+#define UIF_CTS_FLOW (1 << 26)
+#define UIF_CLOSING (1 << 27)
+#define UIF_NORMAL_ACTIVE (1 << 29)
+#define UIF_INITIALIZED (1 << 31)
+
+ unsigned char *tmpbuf;
+ struct semaphore tmpbuf_sem;
+
+ unsigned long event;
+ int blocked_open;
+
+ struct tasklet_struct tlet;
+
+ wait_queue_head_t open_wait;
+ wait_queue_head_t delta_msr_wait;
+};
+
+/* number of characters left in xmit buffer before we ask for more */
+#define WAKEUP_CHARS 256
+
+#define EVT_WRITE_WAKEUP 0
+
+struct module;
+struct tty_driver;
+
+struct uart_driver {
+ struct module *owner;
+ const char *driver_name;
+ const char *dev_name;
+ int major;
+ int minor;
+ int nr;
+ struct console *cons;
+
+ /*
+ * these are private; the low level driver should not
+ * touch these; they should be initialised to NULL
+ */
+ struct uart_state *state;
+ struct tty_driver *tty_driver;
+};
+
+void uart_event(struct uart_port *port, int event);
+struct uart_port *uart_get_console(struct uart_port *ports, int nr,
+ struct console *c);
+void uart_parse_options(char *options, int *baud, int *parity, int *bits,
+ int *flow);
+int uart_set_options(struct uart_port *port, struct console *co, int baud,
+ int parity, int bits, int flow);
+int uart_register_driver(struct uart_driver *uart);
+void uart_unregister_driver(struct uart_driver *uart);
+void uart_unregister_port(struct uart_driver *reg, int line);
+int uart_register_port(struct uart_driver *reg, struct uart_port *port);
+int uart_add_one_port(struct uart_driver *reg, struct uart_port *port);
+int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
+
+#define uart_circ_empty(circ) ((circ)->head == (circ)->tail)
+#define uart_circ_clear(circ) ((circ)->head = (circ)->tail = 0)
+
+#define uart_circ_chars_pending(circ) \
+ (CIRC_CNT((circ)->head, (circ)->tail, UART_XMIT_SIZE))
+
+#define uart_circ_chars_free(circ) \
+ (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE))
+
+#define uart_tx_stopped(port) \
+ ((port)->info->tty->stopped || (port)->info->tty->hw_stopped)
+
+/*
+ * The following are helper functions for the low level drivers.
+ */
+#ifdef SUPPORT_SYSRQ
+static inline int
+uart_handle_sysrq_char(struct uart_port *port, unsigned int ch,
+ struct pt_regs *regs)
+{
+ if (port->sysrq) {
+ if (ch && time_before(jiffies, port->sysrq)) {
+ handle_sysrq(ch, regs, NULL);
+ port->sysrq = 0;
+ return 1;
+ }
+ port->sysrq = 0;
+ }
+ return 0;
+}
+#else
+#define uart_handle_sysrq_char(port,ch,regs) (0)
+#endif
+
+/*
+ * We do the SysRQ and SAK checking like this...
+ */
+static inline int uart_handle_break(struct uart_port *port)
+{
+ struct uart_info *info = port->info;
+#ifdef SUPPORT_SYSRQ
+ if (port->cons && port->cons->index == port->line) {
+ if (!port->sysrq) {
+ port->sysrq = jiffies + HZ*5;
+ return 1;
+ }
+ port->sysrq = 0;
+ }
+#endif
+ if (info->flags & UPF_SAK)
+ do_SAK(info->tty);
+ return 0;
+}
+
+/**
+ * uart_handle_dcd_change - handle a change of carrier detect state
+ * @port: uart_port structure for the open port
+ * @status: new carrier detect status, nonzero if active
+ */
+static inline void
+uart_handle_dcd_change(struct uart_port *port, unsigned int status)
+{
+ struct uart_info *info = port->info;
+
+ port->icount.dcd++;
+
+#ifdef CONFIG_HARD_PPS
+ if ((port->flags & UPF_HARDPPS_CD) && status)
+ hardpps();
+#endif
+
+ if (info->flags & UIF_CHECK_CD) {
+ if (status)
+ wake_up_interruptible(&info->open_wait);
+ else if (info->tty)
+ tty_hangup(info->tty);
+ }
+}
+
+/**
+ * uart_handle_cts_change - handle a change of clear-to-send state
+ * @port: uart_port structure for the open port
+ * @status: new clear to send status, nonzero if active
+ */
+static inline void
+uart_handle_cts_change(struct uart_port *port, unsigned int status)
+{
+ struct uart_info *info = port->info;
+ struct tty_struct *tty = info->tty;
+
+ port->icount.cts++;
+
+ if (info->flags & UIF_CTS_FLOW) {
+ if (tty->hw_stopped) {
+ if (status) {
+ tty->hw_stopped = 0;
+ port->ops->start_tx(port, 0);
+ uart_event(port, EVT_WRITE_WAKEUP);
+ }
+ } else {
+ if (!status) {
+ tty->hw_stopped = 1;
+ port->ops->stop_tx(port, 0);
+ }
+ }
+ }
+}
+
+/*
+ * UART_ENABLE_MS - determine if port should enable modem status irqs
+ */
+#define UART_ENABLE_MS(port,cflag) ((port)->flags & UPF_HARDPPS_CD || \
+ (cflag) & CRTSCTS || \
+ !(cflag) & CLOCAL)
+
+#endif
diff --git a/include/linux/shm.h b/include/linux/shm.h
index be3351619c2e..be7d433725ca 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -71,6 +71,19 @@ struct shm_info {
};
#ifdef __KERNEL__
+struct shmid_kernel /* private to the kernel */
+{
+ struct kern_ipc_perm shm_perm;
+ struct file * shm_file;
+ int id;
+ unsigned long shm_nattch;
+ unsigned long shm_segsz;
+ time_t shm_atim;
+ time_t shm_dtim;
+ time_t shm_ctim;
+ pid_t shm_cprid;
+ pid_t shm_lprid;
+};
/* shm_mode upper byte flags */
#define SHM_DEST 01000 /* segment will be destroyed on last detach */
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h
index 13d8c7ace0bb..cfb23f363e61 100644
--- a/include/linux/smp_lock.h
+++ b/include/linux/smp_lock.h
@@ -7,7 +7,7 @@
#define lock_kernel() do { } while(0)
#define unlock_kernel() do { } while(0)
-#define release_kernel_lock(task, cpu) do { } while(0)
+#define release_kernel_lock(task) do { } while(0)
#define reacquire_kernel_lock(task) do { } while(0)
#define kernel_locked() 1
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 194541968c6a..d9f4af4103e4 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -2,6 +2,7 @@
#define __LINUX_SPINLOCK_H
#include <linux/config.h>
+#include <linux/preempt.h>
#include <linux/linkage.h>
#include <linux/compiler.h>
#include <linux/thread_info.h>
@@ -120,36 +121,6 @@
#ifdef CONFIG_PREEMPT
-asmlinkage void preempt_schedule(void);
-
-#define preempt_get_count() (current_thread_info()->preempt_count)
-
-#define preempt_disable() \
-do { \
- ++current_thread_info()->preempt_count; \
- barrier(); \
-} while (0)
-
-#define preempt_enable_no_resched() \
-do { \
- --current_thread_info()->preempt_count; \
- barrier(); \
-} while (0)
-
-#define preempt_enable() \
-do { \
- --current_thread_info()->preempt_count; \
- barrier(); \
- if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
- preempt_schedule(); \
-} while (0)
-
-#define preempt_check_resched() \
-do { \
- if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
- preempt_schedule(); \
-} while (0)
-
#define spin_lock(lock) \
do { \
preempt_disable(); \
@@ -179,12 +150,6 @@ do { \
#else
-#define preempt_get_count() (0)
-#define preempt_disable() do { } while (0)
-#define preempt_enable_no_resched() do {} while(0)
-#define preempt_enable() do { } while (0)
-#define preempt_check_resched() do { } while (0)
-
#define spin_lock(lock) _raw_spin_lock(lock)
#define spin_trylock(lock) _raw_spin_trylock(lock)
#define spin_unlock(lock) _raw_spin_unlock(lock)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 0b448a811a39..8ba0854d69af 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -142,6 +142,19 @@ struct sysinfo;
struct address_space;
struct zone_t;
+/* linux/mm/rmap.c */
+extern int FASTCALL(page_referenced(struct page *));
+extern void FASTCALL(page_add_rmap(struct page *, pte_t *));
+extern void FASTCALL(page_remove_rmap(struct page *, pte_t *));
+extern int FASTCALL(try_to_unmap(struct page *));
+extern int FASTCALL(page_over_rsslimit(struct page *));
+
+/* return values of try_to_unmap */
+#define SWAP_SUCCESS 0
+#define SWAP_AGAIN 1
+#define SWAP_FAIL 2
+#define SWAP_ERROR 3
+
/* linux/mm/swap.c */
extern void FASTCALL(lru_cache_add(struct page *));
extern void FASTCALL(__lru_cache_del(struct page *));
@@ -168,6 +181,7 @@ int rw_swap_page_sync(int rw, swp_entry_t entry, struct page *page);
extern void show_swap_cache_info(void);
#endif
extern int add_to_swap_cache(struct page *, swp_entry_t);
+extern int add_to_swap(struct page *);
extern void __delete_from_swap_cache(struct page *page);
extern void delete_from_swap_cache(struct page *page);
extern int move_to_swap_cache(struct page *page, swp_entry_t entry);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index da8115ec58f6..01f1208ca449 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -72,7 +72,7 @@ enum
/* CTL_BUS names: */
enum
{
- BUS_ISA=1 /* ISA */
+ CTL_BUS_ISA=1 /* ISA */
};
/* CTL_KERN names: */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 11836df8a6ab..92496658baf5 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -431,6 +431,10 @@ extern void usb_free_dev(struct usb_device *);
/* for when layers above USB add new non-USB drivers */
extern void usb_scan_devices(void);
+/* for probe/disconnect with correct module usage counting */
+void *usb_bind_driver(struct usb_driver *driver, struct usb_device *dev, unsigned int ifnum);
+void usb_unbind_driver(struct usb_device *device, struct usb_interface *intf);
+
/* mostly for devices emulating SCSI over USB */
extern int usb_reset_device(struct usb_device *dev);
diff --git a/include/scsi/scsicam.h b/include/scsi/scsicam.h
index 8b0a3c197220..5a525fd995b2 100644
--- a/include/scsi/scsicam.h
+++ b/include/scsi/scsicam.h
@@ -12,9 +12,8 @@
#ifndef SCSICAM_H
#define SCSICAM_H
-#include <linux/kdev_t.h>
-extern int scsicam_bios_param (Disk *disk, kdev_t dev, int *ip);
+extern int scsicam_bios_param (Disk *disk, struct block_device *bdev, int *ip);
extern int scsi_partsize(unsigned char *buf, unsigned long capacity,
unsigned int *cyls, unsigned int *hds, unsigned int *secs);
-extern unsigned char *scsi_bios_ptable(kdev_t dev);
+extern unsigned char *scsi_bios_ptable(struct block_device *bdev);
#endif /* def SCSICAM_H */