aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-11-22 13:06:44 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-11-22 13:06:44 -0500
commit0bd2af46839ad6262d25714a6ec0365db9d6b98f (patch)
treedcced72d230d69fd0c5816ac6dd03ab84799a93e /include
parente138a5d2356729b8752e88520cc1525fae9794ac (diff)
parentf26b90440cd74c78fe10c9bd5160809704a9627c (diff)
Merge ../scsi-rc-fixes-2.6
Diffstat (limited to 'include')
-rw-r--r--include/acpi/pdc_intel.h9
-rw-r--r--include/acpi/processor.h18
-rw-r--r--include/asm-alpha/io.h13
-rw-r--r--include/asm-arm/arch-pxa/irqs.h2
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h9
-rw-r--r--include/asm-arm/arch-sa1100/jornada720.h14
-rw-r--r--include/asm-arm/arch-versatile/hardware.h4
-rw-r--r--include/asm-arm/io.h17
-rw-r--r--include/asm-arm/uaccess.h22
-rw-r--r--include/asm-avr32/atomic.h8
-rw-r--r--include/asm-avr32/io.h33
-rw-r--r--include/asm-avr32/irq_regs.h1
-rw-r--r--include/asm-avr32/unistd.h3
-rw-r--r--include/asm-frv/highmem.h27
-rw-r--r--include/asm-frv/io.h21
-rw-r--r--include/asm-generic/bitops/sched.h2
-rw-r--r--include/asm-generic/bug.h5
-rw-r--r--include/asm-generic/vmlinux.lds.h35
-rw-r--r--include/asm-i386/acpi.h1
-rw-r--r--include/asm-i386/io.h27
-rw-r--r--include/asm-i386/io_apic.h29
-rw-r--r--include/asm-i386/mach-visws/do_timer.h53
-rw-r--r--include/asm-i386/mach-visws/mach_apic.h5
-rw-r--r--include/asm-i386/processor.h2
-rw-r--r--include/asm-i386/uaccess.h67
-rw-r--r--include/asm-i386/unistd.h3
-rw-r--r--include/asm-i386/vic.h2
-rw-r--r--include/asm-i386/voyager.h160
-rw-r--r--include/asm-ia64/io.h4
-rw-r--r--include/asm-ia64/pal.h11
-rw-r--r--include/asm-ia64/sal.h1
-rw-r--r--include/asm-ia64/sn/addrs.h6
-rw-r--r--include/asm-ia64/uaccess.h2
-rw-r--r--include/asm-m32r/io.h32
-rw-r--r--include/asm-m68k/sun3mmu.h3
-rw-r--r--include/asm-m68k/uaccess.h16
-rw-r--r--include/asm-m68knommu/irq_regs.h1
-rw-r--r--include/asm-m68knommu/irqnode.h8
-rw-r--r--include/asm-m68knommu/machdep.h2
-rw-r--r--include/asm-m68knommu/unistd.h35
-rw-r--r--include/asm-mips/asm.h2
-rw-r--r--include/asm-mips/cacheflush.h19
-rw-r--r--include/asm-mips/div64.h21
-rw-r--r--include/asm-mips/fixmap.h14
-rw-r--r--include/asm-mips/io.h30
-rw-r--r--include/asm-mips/irq.h6
-rw-r--r--include/asm-mips/mipsmtregs.h2
-rw-r--r--include/asm-mips/pgalloc.h2
-rw-r--r--include/asm-mips/pgtable-64.h2
-rw-r--r--include/asm-mips/sibyte/sb1250.h2
-rw-r--r--include/asm-mips/stackframe.h64
-rw-r--r--include/asm-mips/system.h2
-rw-r--r--include/asm-mips/termbits.h12
-rw-r--r--include/asm-mips/time.h10
-rw-r--r--include/asm-mips/unistd.h22
-rw-r--r--include/asm-mips/vr41xx/vr41xx.h2
-rw-r--r--include/asm-powerpc/asm-compat.h52
-rw-r--r--include/asm-powerpc/cputable.h37
-rw-r--r--include/asm-powerpc/current.h12
-rw-r--r--include/asm-powerpc/firmware.h17
-rw-r--r--include/asm-powerpc/i8259.h1
-rw-r--r--include/asm-powerpc/io.h33
-rw-r--r--include/asm-powerpc/iommu.h22
-rw-r--r--include/asm-powerpc/oprofile_impl.h87
-rw-r--r--include/asm-powerpc/pmc.h13
-rw-r--r--include/asm-powerpc/ppc_asm.h18
-rw-r--r--include/asm-powerpc/prom.h10
-rw-r--r--include/asm-powerpc/reg.h26
-rw-r--r--include/asm-powerpc/systbl.h3
-rw-r--r--include/asm-powerpc/system.h6
-rw-r--r--include/asm-powerpc/tce.h3
-rw-r--r--include/asm-powerpc/time.h31
-rw-r--r--include/asm-powerpc/timex.h20
-rw-r--r--include/asm-powerpc/topology.h8
-rw-r--r--include/asm-powerpc/unistd.h5
-rw-r--r--include/asm-ppc/io.h16
-rw-r--r--include/asm-s390/cio.h6
-rw-r--r--include/asm-s390/pgtable.h50
-rw-r--r--include/asm-s390/timer.h2
-rw-r--r--include/asm-s390/unistd.h3
-rw-r--r--include/asm-sh/cpu-sh4/ubc.h37
-rw-r--r--include/asm-sh/edosk7705.h (renamed from include/asm-sh/edosk7705/io.h)0
-rw-r--r--include/asm-sh/hp6xx.h (renamed from include/asm-sh/hp6xx/hp6xx.h)0
-rw-r--r--include/asm-sh/hp6xx/ide.h8
-rw-r--r--include/asm-sh/hp6xx/io.h10
-rw-r--r--include/asm-sh/hs7751rvoip.h (renamed from include/asm-sh/hs7751rvoip/hs7751rvoip.h)0
-rw-r--r--include/asm-sh/hs7751rvoip/ide.h8
-rw-r--r--include/asm-sh/hw_irq.h4
-rw-r--r--include/asm-sh/io.h16
-rw-r--r--include/asm-sh/irq-sh7780.h10
-rw-r--r--include/asm-sh/irq.h43
-rw-r--r--include/asm-sh/irq_regs.h1
-rw-r--r--include/asm-sh/landisk/ide.h14
-rw-r--r--include/asm-sh/processor.h2
-rw-r--r--include/asm-sh/r7780rp.h (renamed from include/asm-sh/r7780rp/r7780rp.h)6
-rw-r--r--include/asm-sh/r7780rp/ide.h8
-rw-r--r--include/asm-sh/rts7751r2d.h (renamed from include/asm-sh/rts7751r2d/rts7751r2d.h)0
-rw-r--r--include/asm-sh/rts7751r2d/ide.h8
-rw-r--r--include/asm-sh/sh03/ide.h7
-rw-r--r--include/asm-sh/shmin.h (renamed from include/asm-sh/shmin/shmin.h)0
-rw-r--r--include/asm-sh/system.h7
-rw-r--r--include/asm-sh/timer.h13
-rw-r--r--include/asm-sh/unistd.h5
-rw-r--r--include/asm-sh64/io.h16
-rw-r--r--include/asm-sparc/elf.h41
-rw-r--r--include/asm-sparc/unistd.h9
-rw-r--r--include/asm-sparc64/compat.h7
-rw-r--r--include/asm-sparc64/futex.h18
-rw-r--r--include/asm-sparc64/io.h15
-rw-r--r--include/asm-sparc64/unistd.h10
-rw-r--r--include/asm-um/archparam-ppc.h9
-rw-r--r--include/asm-um/common.lds.S8
-rw-r--r--include/asm-x86_64/acpi.h1
-rw-r--r--include/asm-x86_64/hw_irq.h2
-rw-r--r--include/asm-x86_64/io.h27
-rw-r--r--include/asm-x86_64/io_apic.h34
-rw-r--r--include/asm-x86_64/pda.h9
-rw-r--r--include/asm-x86_64/pgtable.h1
-rw-r--r--include/asm-x86_64/processor.h2
-rw-r--r--include/asm-x86_64/proto.h2
-rw-r--r--include/asm-x86_64/vsyscall.h2
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/acpi.h3
-rw-r--r--include/linux/backing-dev.h7
-rw-r--r--include/linux/bitmap.h13
-rw-r--r--include/linux/blkdev.h23
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/carta_random32.h29
-rw-r--r--include/linux/compat.h6
-rw-r--r--include/linux/compat_ioctl.h25
-rw-r--r--include/linux/cpumask.h14
-rw-r--r--include/linux/crypto.h2
-rw-r--r--include/linux/dcache.h1
-rw-r--r--include/linux/device.h2
-rw-r--r--include/linux/dmi.h2
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/ext4_fs.h994
-rw-r--r--include/linux/ext4_fs_extents.h198
-rw-r--r--include/linux/ext4_fs_i.h158
-rw-r--r--include/linux/ext4_fs_sb.h94
-rw-r--r--include/linux/ext4_jbd2.h273
-rw-r--r--include/linux/fs.h13
-rw-r--r--include/linux/htirq.h16
-rw-r--r--include/linux/hugetlb.h11
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/in6.h12
-rw-r--r--include/linux/init.h36
-rw-r--r--include/linux/io.h27
-rw-r--r--include/linux/ipmi_msgdefs.h2
-rw-r--r--include/linux/ipx.h14
-rw-r--r--include/linux/irq.h21
-rw-r--r--include/linux/jbd2.h1107
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/libata.h3
-rw-r--r--include/linux/lockd/bind.h5
-rw-r--r--include/linux/lockd/lockd.h12
-rw-r--r--include/linux/lockd/share.h4
-rw-r--r--include/linux/lockd/xdr.h30
-rw-r--r--include/linux/lockd/xdr4.h26
-rw-r--r--include/linux/lockdep.h17
-rw-r--r--include/linux/magic.h1
-rw-r--r--include/linux/mempolicy.h2
-rw-r--r--include/linux/mm.h10
-rw-r--r--include/linux/mmzone.h12
-rw-r--r--include/linux/module.h3
-rw-r--r--include/linux/msdos_fs.h2
-rw-r--r--include/linux/mtd/nand.h2
-rw-r--r--include/linux/nbd.h2
-rw-r--r--include/linux/net.h7
-rw-r--r--include/linux/netfilter/x_tables.h16
-rw-r--r--include/linux/netfilter_arp/arp_tables.h25
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h27
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h27
-rw-r--r--include/linux/nfs_fs.h3
-rw-r--r--include/linux/nfs_xdr.h10
-rw-r--r--include/linux/nfsd/cache.h6
-rw-r--r--include/linux/nfsd/export.h4
-rw-r--r--include/linux/nfsd/nfsd.h45
-rw-r--r--include/linux/nfsd/nfsfh.h8
-rw-r--r--include/linux/nfsd/state.h12
-rw-r--r--include/linux/nfsd/xdr.h50
-rw-r--r--include/linux/nfsd/xdr3.h114
-rw-r--r--include/linux/nfsd/xdr4.h54
-rw-r--r--include/linux/nodemask.h14
-rw-r--r--include/linux/oom.h10
-rw-r--r--include/linux/pagemap.h14
-rw-r--r--include/linux/pci.h17
-rw-r--r--include/linux/pci_hotplug.h236
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/personality.h9
-rw-r--r--include/linux/pm.h4
-rw-r--r--include/linux/raid/bitmap.h20
-rw-r--r--include/linux/raid/md_p.h56
-rw-r--r--include/linux/random.h3
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/security.h24
-rw-r--r--include/linux/serio.h1
-rw-r--r--include/linux/sunrpc/msg_prot.h4
-rw-r--r--include/linux/sunrpc/svc.h2
-rw-r--r--include/linux/sunrpc/xdr.h1
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--include/linux/sysctl.h23
-rw-r--r--include/linux/taskstats_kern.h31
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/linux/tipc.h1
-rw-r--r--include/linux/ufs_fs.h2
-rw-r--r--include/linux/unwind.h2
-rw-r--r--include/linux/videodev2.h2
-rw-r--r--include/linux/vmalloc.h6
-rw-r--r--include/linux/wait.h9
-rw-r--r--include/linux/writeback.h1
-rw-r--r--include/net/bluetooth/hci_core.h17
-rw-r--r--include/net/dn.h5
-rw-r--r--include/net/flow.h5
-rw-r--r--include/net/ieee80211softmac.h35
-rw-r--r--include/net/inet_ecn.h2
-rw-r--r--include/net/inet_timewait_sock.h1
-rw-r--r--include/net/inetpeer.h24
-rw-r--r--include/net/ip6_route.h7
-rw-r--r--include/net/ip_fib.h5
-rw-r--r--include/net/ip_vs.h1
-rw-r--r--include/net/ipx.h26
-rw-r--r--include/net/netlabel.h62
-rw-r--r--include/net/sctp/sctp.h14
-rw-r--r--include/net/sctp/ulpevent.h1
-rw-r--r--include/net/sock.h3
-rw-r--r--include/net/timewait_sock.h7
-rw-r--r--include/net/xfrm.h3
-rw-r--r--include/rdma/ib_addr.h20
-rw-r--r--include/rdma/ib_user_verbs.h2
-rw-r--r--include/scsi/libiscsi.h3
-rw-r--r--include/scsi/scsi.h5
-rw-r--r--include/scsi/scsi_transport_iscsi.h4
-rw-r--r--include/sound/version.h2
235 files changed, 4754 insertions, 1479 deletions
diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h
index c5472be6f3a2..e72bfdd887f9 100644
--- a/include/acpi/pdc_intel.h
+++ b/include/acpi/pdc_intel.h
@@ -13,6 +13,7 @@
13#define ACPI_PDC_SMP_C_SWCOORD (0x0040) 13#define ACPI_PDC_SMP_C_SWCOORD (0x0040)
14#define ACPI_PDC_SMP_T_SWCOORD (0x0080) 14#define ACPI_PDC_SMP_T_SWCOORD (0x0080)
15#define ACPI_PDC_C_C1_FFH (0x0100) 15#define ACPI_PDC_C_C1_FFH (0x0100)
16#define ACPI_PDC_C_C2C3_FFH (0x0200)
16 17
17#define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \ 18#define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \
18 ACPI_PDC_C_C1_HALT | \ 19 ACPI_PDC_C_C1_HALT | \
@@ -23,8 +24,10 @@
23 ACPI_PDC_SMP_P_SWCOORD | \ 24 ACPI_PDC_SMP_P_SWCOORD | \
24 ACPI_PDC_P_FFH) 25 ACPI_PDC_P_FFH)
25 26
26#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ 27#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \
27 ACPI_PDC_SMP_C1PT | \ 28 ACPI_PDC_SMP_C1PT | \
28 ACPI_PDC_C_C1_HALT) 29 ACPI_PDC_C_C1_HALT | \
30 ACPI_PDC_C_C1_FFH | \
31 ACPI_PDC_C_C2C3_FFH)
29 32
30#endif /* __PDC_INTEL_H__ */ 33#endif /* __PDC_INTEL_H__ */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 9dd5b75961f8..7798d2a9f793 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -29,6 +29,9 @@
29#define DOMAIN_COORD_TYPE_SW_ANY 0xfd 29#define DOMAIN_COORD_TYPE_SW_ANY 0xfd
30#define DOMAIN_COORD_TYPE_HW_ALL 0xfe 30#define DOMAIN_COORD_TYPE_HW_ALL 0xfe
31 31
32#define ACPI_CSTATE_SYSTEMIO (0)
33#define ACPI_CSTATE_FFH (1)
34
32/* Power Management */ 35/* Power Management */
33 36
34struct acpi_processor_cx; 37struct acpi_processor_cx;
@@ -58,6 +61,8 @@ struct acpi_processor_cx {
58 u8 valid; 61 u8 valid;
59 u8 type; 62 u8 type;
60 u32 address; 63 u32 address;
64 u8 space_id;
65 u8 index;
61 u32 latency; 66 u32 latency;
62 u32 latency_ticks; 67 u32 latency_ticks;
63 u32 power; 68 u32 power;
@@ -206,6 +211,9 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr);
206#ifdef ARCH_HAS_POWER_INIT 211#ifdef ARCH_HAS_POWER_INIT
207void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, 212void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
208 unsigned int cpu); 213 unsigned int cpu);
214int acpi_processor_ffh_cstate_probe(unsigned int cpu,
215 struct acpi_processor_cx *cx, struct acpi_power_register *reg);
216void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cstate);
209#else 217#else
210static inline void acpi_processor_power_init_bm_check(struct 218static inline void acpi_processor_power_init_bm_check(struct
211 acpi_processor_flags 219 acpi_processor_flags
@@ -214,6 +222,16 @@ static inline void acpi_processor_power_init_bm_check(struct
214 flags->bm_check = 1; 222 flags->bm_check = 1;
215 return; 223 return;
216} 224}
225static inline int acpi_processor_ffh_cstate_probe(unsigned int cpu,
226 struct acpi_processor_cx *cx, struct acpi_power_register *reg)
227{
228 return -1;
229}
230static inline void acpi_processor_ffh_cstate_enter(
231 struct acpi_processor_cx *cstate)
232{
233 return;
234}
217#endif 235#endif
218 236
219/* in processor_perflib.c */ 237/* in processor_perflib.c */
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h
index f5ae98c25d1f..5d15af24573b 100644
--- a/include/asm-alpha/io.h
+++ b/include/asm-alpha/io.h
@@ -533,19 +533,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
533#define eth_io_copy_and_sum(skb,src,len,unused) \ 533#define eth_io_copy_and_sum(skb,src,len,unused) \
534 memcpy_fromio((skb)->data,src,len) 534 memcpy_fromio((skb)->data,src,len)
535 535
536static inline int
537check_signature(const volatile void __iomem *io_addr,
538 const unsigned char *signature, int length)
539{
540 do {
541 if (readb(io_addr) != *signature)
542 return 0;
543 io_addr++;
544 signature++;
545 } while (--length);
546 return 1;
547}
548
549/* 536/*
550 * The Alpha Jensen hardware for some rather strange reason puts 537 * The Alpha Jensen hardware for some rather strange reason puts
551 * the RTC clock at 0x170 instead of 0x70. Probably due to some 538 * the RTC clock at 0x170 instead of 0x70. Probably due to some
diff --git a/include/asm-arm/arch-pxa/irqs.h b/include/asm-arm/arch-pxa/irqs.h
index f3bc70eee35b..67ed43674c63 100644
--- a/include/asm-arm/arch-pxa/irqs.h
+++ b/include/asm-arm/arch-pxa/irqs.h
@@ -73,7 +73,7 @@
73#define IRQ_TO_GPIO(i) (((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i)) 73#define IRQ_TO_GPIO(i) (((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i))
74 74
75#if defined(CONFIG_PXA25x) 75#if defined(CONFIG_PXA25x)
76#define PXA_LAST_GPIO 80 76#define PXA_LAST_GPIO 84
77#elif defined(CONFIG_PXA27x) 77#elif defined(CONFIG_PXA27x)
78#define PXA_LAST_GPIO 127 78#define PXA_LAST_GPIO 127
79#endif 79#endif
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index f5cc65dd7d0d..cff752f35230 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -1681,6 +1681,7 @@
1681#define SSSR_TINT (1 << 19) /* Receiver Time-out Interrupt */ 1681#define SSSR_TINT (1 << 19) /* Receiver Time-out Interrupt */
1682#define SSSR_PINT (1 << 18) /* Peripheral Trailing Byte Interrupt */ 1682#define SSSR_PINT (1 << 18) /* Peripheral Trailing Byte Interrupt */
1683 1683
1684#define SSPSP_FSRT (1 << 25) /* Frame Sync Relative Timing */
1684#define SSPSP_DMYSTOP(x) (x << 23) /* Dummy Stop */ 1685#define SSPSP_DMYSTOP(x) (x << 23) /* Dummy Stop */
1685#define SSPSP_SFRMWDTH(x) (x << 16) /* Serial Frame Width */ 1686#define SSPSP_SFRMWDTH(x) (x << 16) /* Serial Frame Width */
1686#define SSPSP_SFRMDLY(x) (x << 9) /* Serial Frame Delay */ 1687#define SSPSP_SFRMDLY(x) (x << 9) /* Serial Frame Delay */
@@ -2241,7 +2242,7 @@
2241 2242
2242#define CICR1_TBIT (1 << 31) /* Transparency bit */ 2243#define CICR1_TBIT (1 << 31) /* Transparency bit */
2243#define CICR1_RGBT_CONV (0x3 << 30) /* RGBT conversion mask */ 2244#define CICR1_RGBT_CONV (0x3 << 30) /* RGBT conversion mask */
2244#define CICR1_PPL (0x3f << 15) /* Pixels per line mask */ 2245#define CICR1_PPL (0x7ff << 15) /* Pixels per line mask */
2245#define CICR1_RGB_CONV (0x7 << 12) /* RGB conversion mask */ 2246#define CICR1_RGB_CONV (0x7 << 12) /* RGB conversion mask */
2246#define CICR1_RGB_F (1 << 11) /* RGB format */ 2247#define CICR1_RGB_F (1 << 11) /* RGB format */
2247#define CICR1_YCBCR_F (1 << 10) /* YCbCr format */ 2248#define CICR1_YCBCR_F (1 << 10) /* YCbCr format */
@@ -2267,7 +2268,7 @@
2267#define CICR3_VSW (0x3f << 10) /* Vertical sync pulse width mask */ 2268#define CICR3_VSW (0x3f << 10) /* Vertical sync pulse width mask */
2268#define CICR3_BFPW (0x3f << 3) /* Beginning-of-frame pixel clock 2269#define CICR3_BFPW (0x3f << 3) /* Beginning-of-frame pixel clock
2269 wait count mask */ 2270 wait count mask */
2270#define CICR3_LPF (0x3ff << 0) /* Lines per frame mask */ 2271#define CICR3_LPF (0x7ff << 0) /* Lines per frame mask */
2271 2272
2272#define CICR4_MCLK_DLY (0x3 << 24) /* MCLK Data Capture Delay mask */ 2273#define CICR4_MCLK_DLY (0x3 << 24) /* MCLK Data Capture Delay mask */
2273#define CICR4_PCLK_EN (1 << 23) /* Pixel clock enable */ 2274#define CICR4_PCLK_EN (1 << 23) /* Pixel clock enable */
@@ -2288,8 +2289,8 @@
2288#define CISR_EOL (1 << 8) /* End of line */ 2289#define CISR_EOL (1 << 8) /* End of line */
2289#define CISR_PAR_ERR (1 << 7) /* Parity error */ 2290#define CISR_PAR_ERR (1 << 7) /* Parity error */
2290#define CISR_CQD (1 << 6) /* Camera interface quick disable */ 2291#define CISR_CQD (1 << 6) /* Camera interface quick disable */
2291#define CISR_SOF (1 << 5) /* Start of frame */ 2292#define CISR_CDD (1 << 5) /* Camera interface disable done */
2292#define CISR_CDD (1 << 4) /* Camera interface disable done */ 2293#define CISR_SOF (1 << 4) /* Start of frame */
2293#define CISR_EOF (1 << 3) /* End of frame */ 2294#define CISR_EOF (1 << 3) /* End of frame */
2294#define CISR_IFO_2 (1 << 2) /* FIFO overrun for Channel 2 */ 2295#define CISR_IFO_2 (1 << 2) /* FIFO overrun for Channel 2 */
2295#define CISR_IFO_1 (1 << 1) /* FIFO overrun for Channel 1 */ 2296#define CISR_IFO_1 (1 << 1) /* FIFO overrun for Channel 1 */
diff --git a/include/asm-arm/arch-sa1100/jornada720.h b/include/asm-arm/arch-sa1100/jornada720.h
index 1b8e8a304800..3f37ca07806d 100644
--- a/include/asm-arm/arch-sa1100/jornada720.h
+++ b/include/asm-arm/arch-sa1100/jornada720.h
@@ -19,6 +19,20 @@
19#define GPIO_JORNADA720_KEYBOARD_IRQ IRQ_GPIO0 19#define GPIO_JORNADA720_KEYBOARD_IRQ IRQ_GPIO0
20#define GPIO_JORNADA720_MOUSE_IRQ IRQ_GPIO9 20#define GPIO_JORNADA720_MOUSE_IRQ IRQ_GPIO9
21 21
22/* MCU COMMANDS */
23#define MCU_GetBatteryData 0xc0
24#define MCU_GetScanKeyCode 0x90
25#define MCU_GetTouchSamples 0xa0
26#define MCU_GetContrast 0xD0
27#define MCU_SetContrast 0xD1
28#define MCU_GetBrightness 0xD2
29#define MCU_SetBrightness 0xD3
30#define MCU_ContrastOff 0xD8
31#define MCU_BrightnessOff 0xD9
32#define MCU_PWMOFF 0xDF
33#define MCU_TxDummy 0x11
34#define MCU_ErrorCode 0x00
35
22#ifndef __ASSEMBLY__ 36#ifndef __ASSEMBLY__
23 37
24void jornada720_mcu_init(void); 38void jornada720_mcu_init(void);
diff --git a/include/asm-arm/arch-versatile/hardware.h b/include/asm-arm/arch-versatile/hardware.h
index 41c1bee342ad..edc06598d187 100644
--- a/include/asm-arm/arch-versatile/hardware.h
+++ b/include/asm-arm/arch-versatile/hardware.h
@@ -28,8 +28,8 @@
28/* 28/*
29 * PCI space virtual addresses 29 * PCI space virtual addresses
30 */ 30 */
31#define VERSATILE_PCI_VIRT_BASE 0xe8000000 31#define VERSATILE_PCI_VIRT_BASE (void __iomem *)0xe8000000ul
32#define VERSATILE_PCI_CFG_VIRT_BASE 0xe9000000 32#define VERSATILE_PCI_CFG_VIRT_BASE (void __iomem *)0xe9000000ul
33 33
34#if 0 34#if 0
35#define VERSATILE_PCI_VIRT_MEM_BASE0 0xf4000000 35#define VERSATILE_PCI_VIRT_MEM_BASE0 0xf4000000
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index 34aaaac4f617..ae999fd5dc67 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -193,23 +193,6 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
193#define eth_io_copy_and_sum(s,c,l,b) \ 193#define eth_io_copy_and_sum(s,c,l,b) \
194 eth_copy_and_sum((s),__mem_pci(c),(l),(b)) 194 eth_copy_and_sum((s),__mem_pci(c),(l),(b))
195 195
196static inline int
197check_signature(void __iomem *io_addr, const unsigned char *signature,
198 int length)
199{
200 int retval = 0;
201 do {
202 if (readb(io_addr) != *signature)
203 goto out;
204 io_addr++;
205 signature++;
206 length--;
207 } while (length);
208 retval = 1;
209out:
210 return retval;
211}
212
213#elif !defined(readb) 196#elif !defined(readb)
214 197
215#define readb(c) (__readwrite_bug("readb"),0) 198#define readb(c) (__readwrite_bug("readb"),0)
diff --git a/include/asm-arm/uaccess.h b/include/asm-arm/uaccess.h
index 87aba57a66c4..5f420a0149f1 100644
--- a/include/asm-arm/uaccess.h
+++ b/include/asm-arm/uaccess.h
@@ -110,7 +110,7 @@ extern int __get_user_4(void *);
110#define get_user(x,p) \ 110#define get_user(x,p) \
111 ({ \ 111 ({ \
112 const register typeof(*(p)) __user *__p asm("r0") = (p);\ 112 const register typeof(*(p)) __user *__p asm("r0") = (p);\
113 register unsigned int __r2 asm("r2"); \ 113 register unsigned long __r2 asm("r2"); \
114 register int __e asm("r0"); \ 114 register int __e asm("r0"); \
115 switch (sizeof(*(__p))) { \ 115 switch (sizeof(*(__p))) { \
116 case 1: \ 116 case 1: \
@@ -383,19 +383,19 @@ do { \
383 383
384 384
385#ifdef CONFIG_MMU 385#ifdef CONFIG_MMU
386extern unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n); 386extern unsigned long __must_check __copy_from_user(void *to, const void __user *from, unsigned long n);
387extern unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n); 387extern unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n);
388extern unsigned long __clear_user(void __user *addr, unsigned long n); 388extern unsigned long __must_check __clear_user(void __user *addr, unsigned long n);
389#else 389#else
390#define __copy_from_user(to,from,n) (memcpy(to, (void __force *)from, n), 0) 390#define __copy_from_user(to,from,n) (memcpy(to, (void __force *)from, n), 0)
391#define __copy_to_user(to,from,n) (memcpy((void __force *)to, from, n), 0) 391#define __copy_to_user(to,from,n) (memcpy((void __force *)to, from, n), 0)
392#define __clear_user(addr,n) (memset((void __force *)addr, 0, n), 0) 392#define __clear_user(addr,n) (memset((void __force *)addr, 0, n), 0)
393#endif 393#endif
394 394
395extern unsigned long __strncpy_from_user(char *to, const char __user *from, unsigned long count); 395extern unsigned long __must_check __strncpy_from_user(char *to, const char __user *from, unsigned long count);
396extern unsigned long __strnlen_user(const char __user *s, long n); 396extern unsigned long __must_check __strnlen_user(const char __user *s, long n);
397 397
398static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) 398static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n)
399{ 399{
400 if (access_ok(VERIFY_READ, from, n)) 400 if (access_ok(VERIFY_READ, from, n))
401 n = __copy_from_user(to, from, n); 401 n = __copy_from_user(to, from, n);
@@ -404,7 +404,7 @@ static inline unsigned long copy_from_user(void *to, const void __user *from, un
404 return n; 404 return n;
405} 405}
406 406
407static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) 407static inline unsigned long __must_check copy_to_user(void __user *to, const void *from, unsigned long n)
408{ 408{
409 if (access_ok(VERIFY_WRITE, to, n)) 409 if (access_ok(VERIFY_WRITE, to, n))
410 n = __copy_to_user(to, from, n); 410 n = __copy_to_user(to, from, n);
@@ -414,14 +414,14 @@ static inline unsigned long copy_to_user(void __user *to, const void *from, unsi
414#define __copy_to_user_inatomic __copy_to_user 414#define __copy_to_user_inatomic __copy_to_user
415#define __copy_from_user_inatomic __copy_from_user 415#define __copy_from_user_inatomic __copy_from_user
416 416
417static inline unsigned long clear_user(void __user *to, unsigned long n) 417static inline unsigned long __must_check clear_user(void __user *to, unsigned long n)
418{ 418{
419 if (access_ok(VERIFY_WRITE, to, n)) 419 if (access_ok(VERIFY_WRITE, to, n))
420 n = __clear_user(to, n); 420 n = __clear_user(to, n);
421 return n; 421 return n;
422} 422}
423 423
424static inline long strncpy_from_user(char *dst, const char __user *src, long count) 424static inline long __must_check strncpy_from_user(char *dst, const char __user *src, long count)
425{ 425{
426 long res = -EFAULT; 426 long res = -EFAULT;
427 if (access_ok(VERIFY_READ, src, 1)) 427 if (access_ok(VERIFY_READ, src, 1))
@@ -431,7 +431,7 @@ static inline long strncpy_from_user(char *dst, const char __user *src, long cou
431 431
432#define strlen_user(s) strnlen_user(s, ~0UL >> 1) 432#define strlen_user(s) strnlen_user(s, ~0UL >> 1)
433 433
434static inline long strnlen_user(const char __user *s, long n) 434static inline long __must_check strnlen_user(const char __user *s, long n)
435{ 435{
436 unsigned long res = 0; 436 unsigned long res = 0;
437 437
diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h
index e0b9c44c126c..c40b6032c480 100644
--- a/include/asm-avr32/atomic.h
+++ b/include/asm-avr32/atomic.h
@@ -41,7 +41,7 @@ static inline int atomic_sub_return(int i, atomic_t *v)
41 " stcond %1, %0\n" 41 " stcond %1, %0\n"
42 " brne 1b" 42 " brne 1b"
43 : "=&r"(result), "=o"(v->counter) 43 : "=&r"(result), "=o"(v->counter)
44 : "m"(v->counter), "ir"(i) 44 : "m"(v->counter), "rKs21"(i)
45 : "cc"); 45 : "cc");
46 46
47 return result; 47 return result;
@@ -58,7 +58,7 @@ static inline int atomic_add_return(int i, atomic_t *v)
58{ 58{
59 int result; 59 int result;
60 60
61 if (__builtin_constant_p(i)) 61 if (__builtin_constant_p(i) && (i >= -1048575) && (i <= 1048576))
62 result = atomic_sub_return(-i, v); 62 result = atomic_sub_return(-i, v);
63 else 63 else
64 asm volatile( 64 asm volatile(
@@ -101,7 +101,7 @@ static inline int atomic_sub_unless(atomic_t *v, int a, int u)
101 " mov %1, 1\n" 101 " mov %1, 1\n"
102 "1:" 102 "1:"
103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter) 103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter)
104 : "m"(v->counter), "ir"(a), "ir"(u) 104 : "m"(v->counter), "rKs21"(a), "rKs21"(u)
105 : "cc", "memory"); 105 : "cc", "memory");
106 106
107 return result; 107 return result;
@@ -121,7 +121,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
121{ 121{
122 int tmp, result; 122 int tmp, result;
123 123
124 if (__builtin_constant_p(a)) 124 if (__builtin_constant_p(a) && (a >= -1048575) && (a <= 1048576))
125 result = atomic_sub_unless(v, -a, u); 125 result = atomic_sub_unless(v, -a, u);
126 else { 126 else {
127 result = 0; 127 result = 0;
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index 2fc8f111dce9..eec47500fa66 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -76,6 +76,39 @@ static inline unsigned int readl(const volatile void __iomem *addr)
76#define readsw(p, d, l) __raw_readsw((unsigned int)p, d, l) 76#define readsw(p, d, l) __raw_readsw((unsigned int)p, d, l)
77#define readsl(p, d, l) __raw_readsl((unsigned int)p, d, l) 77#define readsl(p, d, l) __raw_readsl((unsigned int)p, d, l)
78 78
79
80/*
81 * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be
82 */
83#ifndef ioread8
84
85#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; })
86
87#define ioread16(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(p)); __v; })
88#define ioread16be(p) ({ unsigned int __v = be16_to_cpu(__raw_readw(p)); __v; })
89
90#define ioread32(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(p)); __v; })
91#define ioread32be(p) ({ unsigned int __v = be32_to_cpu(__raw_readl(p)); __v; })
92
93#define iowrite8(v,p) __raw_writeb(v, p)
94
95#define iowrite16(v,p) __raw_writew(cpu_to_le16(v), p)
96#define iowrite16be(v,p) __raw_writew(cpu_to_be16(v), p)
97
98#define iowrite32(v,p) __raw_writel(cpu_to_le32(v), p)
99#define iowrite32be(v,p) __raw_writel(cpu_to_be32(v), p)
100
101#define ioread8_rep(p,d,c) __raw_readsb(p,d,c)
102#define ioread16_rep(p,d,c) __raw_readsw(p,d,c)
103#define ioread32_rep(p,d,c) __raw_readsl(p,d,c)
104
105#define iowrite8_rep(p,s,c) __raw_writesb(p,s,c)
106#define iowrite16_rep(p,s,c) __raw_writesw(p,s,c)
107#define iowrite32_rep(p,s,c) __raw_writesl(p,s,c)
108
109#endif
110
111
79/* 112/*
80 * These two are only here because ALSA _thinks_ it needs them... 113 * These two are only here because ALSA _thinks_ it needs them...
81 */ 114 */
diff --git a/include/asm-avr32/irq_regs.h b/include/asm-avr32/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/include/asm-avr32/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/include/asm-avr32/unistd.h b/include/asm-avr32/unistd.h
index a50e5004550c..56ed1f9d348a 100644
--- a/include/asm-avr32/unistd.h
+++ b/include/asm-avr32/unistd.h
@@ -280,9 +280,10 @@
280#define __NR_sync_file_range 262 280#define __NR_sync_file_range 262
281#define __NR_tee 263 281#define __NR_tee 263
282#define __NR_vmsplice 264 282#define __NR_vmsplice 264
283#define __NR_epoll_pwait 265
283 284
284#ifdef __KERNEL__ 285#ifdef __KERNEL__
285#define NR_syscalls 265 286#define NR_syscalls 266
286 287
287 288
288#define __ARCH_WANT_IPC_PARSE_VERSION 289#define __ARCH_WANT_IPC_PARSE_VERSION
diff --git a/include/asm-frv/highmem.h b/include/asm-frv/highmem.h
index e2247c22a638..0f390f41f816 100644
--- a/include/asm-frv/highmem.h
+++ b/include/asm-frv/highmem.h
@@ -82,11 +82,11 @@ extern struct page *kmap_atomic_to_page(void *ptr);
82 dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \ 82 dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \
83 \ 83 \
84 if (type != __KM_CACHE) \ 84 if (type != __KM_CACHE) \
85 asm volatile("movgs %0,dampr"#ampr :: "r"(dampr)); \ 85 asm volatile("movgs %0,dampr"#ampr :: "r"(dampr) : "memory"); \
86 else \ 86 else \
87 asm volatile("movgs %0,iampr"#ampr"\n" \ 87 asm volatile("movgs %0,iampr"#ampr"\n" \
88 "movgs %0,dampr"#ampr"\n" \ 88 "movgs %0,dampr"#ampr"\n" \
89 :: "r"(dampr) \ 89 :: "r"(dampr) : "memory" \
90 ); \ 90 ); \
91 \ 91 \
92 asm("movsg damlr"#ampr",%0" : "=r"(damlr)); \ 92 asm("movsg damlr"#ampr",%0" : "=r"(damlr)); \
@@ -104,7 +104,7 @@ extern struct page *kmap_atomic_to_page(void *ptr);
104 asm volatile("movgs %0,tplr \n" \ 104 asm volatile("movgs %0,tplr \n" \
105 "movgs %1,tppr \n" \ 105 "movgs %1,tppr \n" \
106 "tlbpr %0,gr0,#2,#1" \ 106 "tlbpr %0,gr0,#2,#1" \
107 : : "r"(damlr), "r"(dampr)); \ 107 : : "r"(damlr), "r"(dampr) : "memory"); \
108 \ 108 \
109 /*printk("TLB: SECN sl=%d L=%08lx P=%08lx\n", slot, damlr, dampr);*/ \ 109 /*printk("TLB: SECN sl=%d L=%08lx P=%08lx\n", slot, damlr, dampr);*/ \
110 \ 110 \
@@ -115,7 +115,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
115{ 115{
116 unsigned long paddr; 116 unsigned long paddr;
117 117
118 preempt_disable(); 118 inc_preempt_count();
119 paddr = page_to_phys(page); 119 paddr = page_to_phys(page);
120 120
121 switch (type) { 121 switch (type) {
@@ -138,16 +138,16 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
138 } 138 }
139} 139}
140 140
141#define __kunmap_atomic_primary(type, ampr) \ 141#define __kunmap_atomic_primary(type, ampr) \
142do { \ 142do { \
143 asm volatile("movgs gr0,dampr"#ampr"\n"); \ 143 asm volatile("movgs gr0,dampr"#ampr"\n" ::: "memory"); \
144 if (type == __KM_CACHE) \ 144 if (type == __KM_CACHE) \
145 asm volatile("movgs gr0,iampr"#ampr"\n"); \ 145 asm volatile("movgs gr0,iampr"#ampr"\n" ::: "memory"); \
146} while(0) 146} while(0)
147 147
148#define __kunmap_atomic_secondary(slot, vaddr) \ 148#define __kunmap_atomic_secondary(slot, vaddr) \
149do { \ 149do { \
150 asm volatile("tlbpr %0,gr0,#4,#1" : : "r"(vaddr)); \ 150 asm volatile("tlbpr %0,gr0,#4,#1" : : "r"(vaddr) : "memory"); \
151} while(0) 151} while(0)
152 152
153static inline void kunmap_atomic(void *kvaddr, enum km_type type) 153static inline void kunmap_atomic(void *kvaddr, enum km_type type)
@@ -170,7 +170,8 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
170 default: 170 default:
171 BUG(); 171 BUG();
172 } 172 }
173 preempt_enable(); 173 dec_preempt_count();
174 preempt_check_resched();
174} 175}
175 176
176#endif /* !__ASSEMBLY__ */ 177#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h
index 7765f5528894..20e44fe00abf 100644
--- a/include/asm-frv/io.h
+++ b/include/asm-frv/io.h
@@ -385,27 +385,6 @@ static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
385 */ 385 */
386#define xlate_dev_kmem_ptr(p) p 386#define xlate_dev_kmem_ptr(p) p
387 387
388/*
389 * Check BIOS signature
390 */
391static inline int check_signature(volatile void __iomem *io_addr,
392 const unsigned char *signature, int length)
393{
394 int retval = 0;
395
396 do {
397 if (readb(io_addr) != *signature)
398 goto out;
399 io_addr++;
400 signature++;
401 length--;
402 } while (length);
403
404 retval = 1;
405out:
406 return retval;
407}
408
409#endif /* __KERNEL__ */ 388#endif /* __KERNEL__ */
410 389
411#endif /* _ASM_IO_H */ 390#endif /* _ASM_IO_H */
diff --git a/include/asm-generic/bitops/sched.h b/include/asm-generic/bitops/sched.h
index 5ef93a4d009f..815bb0148060 100644
--- a/include/asm-generic/bitops/sched.h
+++ b/include/asm-generic/bitops/sched.h
@@ -15,7 +15,7 @@ static inline int sched_find_first_bit(const unsigned long *b)
15#if BITS_PER_LONG == 64 15#if BITS_PER_LONG == 64
16 if (unlikely(b[0])) 16 if (unlikely(b[0]))
17 return __ffs(b[0]); 17 return __ffs(b[0]);
18 if (unlikely(b[1])) 18 if (likely(b[1]))
19 return __ffs(b[1]) + 64; 19 return __ffs(b[1]) + 64;
20 return __ffs(b[2]) + 128; 20 return __ffs(b[2]) + 128;
21#elif BITS_PER_LONG == 32 21#elif BITS_PER_LONG == 32
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 1d9573cf4a0b..c92ae0f166ff 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -37,7 +37,10 @@
37#endif 37#endif
38 38
39#ifndef HAVE_ARCH_WARN_ON 39#ifndef HAVE_ARCH_WARN_ON
40#define WARN_ON(condition) unlikely((condition)) 40#define WARN_ON(condition) ({ \
41 typeof(condition) __ret_warn_on = (condition); \
42 unlikely(__ret_warn_on); \
43})
41#endif 44#endif
42#endif 45#endif
43 46
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 69240b52f8e1..e60d6f21fa62 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -125,6 +125,10 @@
125 *(__param) \ 125 *(__param) \
126 VMLINUX_SYMBOL(__stop___param) = .; \ 126 VMLINUX_SYMBOL(__stop___param) = .; \
127 } \ 127 } \
128 \
129 /* Unwind data binary search table */ \
130 EH_FRAME_HDR \
131 \
128 __end_rodata = .; \ 132 __end_rodata = .; \
129 . = ALIGN(4096); 133 . = ALIGN(4096);
130 134
@@ -157,6 +161,18 @@
157 *(.kprobes.text) \ 161 *(.kprobes.text) \
158 VMLINUX_SYMBOL(__kprobes_text_end) = .; 162 VMLINUX_SYMBOL(__kprobes_text_end) = .;
159 163
164#ifdef CONFIG_STACK_UNWIND
165 /* Unwind data binary search table */
166#define EH_FRAME_HDR \
167 .eh_frame_hdr : AT(ADDR(.eh_frame_hdr) - LOAD_OFFSET) { \
168 VMLINUX_SYMBOL(__start_unwind_hdr) = .; \
169 *(.eh_frame_hdr) \
170 VMLINUX_SYMBOL(__end_unwind_hdr) = .; \
171 }
172#else
173#define EH_FRAME_HDR
174#endif
175
160 /* DWARF debug sections. 176 /* DWARF debug sections.
161 Symbols in the DWARF debugging sections are relative to 177 Symbols in the DWARF debugging sections are relative to
162 the beginning of the section so we begin them at 0. */ 178 the beginning of the section so we begin them at 0. */
@@ -197,3 +213,22 @@
197 213
198#define NOTES \ 214#define NOTES \
199 .notes : { *(.note.*) } :note 215 .notes : { *(.note.*) } :note
216
217#define INITCALLS \
218 *(.initcall0.init) \
219 *(.initcall0s.init) \
220 *(.initcall1.init) \
221 *(.initcall1s.init) \
222 *(.initcall2.init) \
223 *(.initcall2s.init) \
224 *(.initcall3.init) \
225 *(.initcall3s.init) \
226 *(.initcall4.init) \
227 *(.initcall4s.init) \
228 *(.initcall5.init) \
229 *(.initcall5s.init) \
230 *(.initcall6.init) \
231 *(.initcall6s.init) \
232 *(.initcall7.init) \
233 *(.initcall7s.init)
234
diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h
index 6016632d032f..c80b3a94511a 100644
--- a/include/asm-i386/acpi.h
+++ b/include/asm-i386/acpi.h
@@ -132,6 +132,7 @@ extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
132 132
133#ifdef CONFIG_X86_IO_APIC 133#ifdef CONFIG_X86_IO_APIC
134extern int acpi_skip_timer_override; 134extern int acpi_skip_timer_override;
135extern int acpi_use_timer_override;
135#endif 136#endif
136 137
137static inline void acpi_noirq_set(void) { acpi_noirq = 1; } 138static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index b3724fe93ff1..68df0dc3ab8f 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -224,33 +224,6 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
224 224
225#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d)) 225#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d))
226 226
227/**
228 * check_signature - find BIOS signatures
229 * @io_addr: mmio address to check
230 * @signature: signature block
231 * @length: length of signature
232 *
233 * Perform a signature comparison with the mmio address io_addr. This
234 * address should have been obtained by ioremap.
235 * Returns 1 on a match.
236 */
237
238static inline int check_signature(volatile void __iomem * io_addr,
239 const unsigned char *signature, int length)
240{
241 int retval = 0;
242 do {
243 if (readb(io_addr) != *signature)
244 goto out;
245 io_addr++;
246 signature++;
247 length--;
248 } while (length);
249 retval = 1;
250out:
251 return retval;
252}
253
254/* 227/*
255 * Cache management 228 * Cache management
256 * 229 *
diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h
index 276ea7e8144a..059a9ff28b4d 100644
--- a/include/asm-i386/io_apic.h
+++ b/include/asm-i386/io_apic.h
@@ -12,10 +12,6 @@
12 12
13#ifdef CONFIG_X86_IO_APIC 13#ifdef CONFIG_X86_IO_APIC
14 14
15#define IO_APIC_BASE(idx) \
16 ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \
17 + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK)))
18
19/* 15/*
20 * The structure of the IO-APIC: 16 * The structure of the IO-APIC:
21 */ 17 */
@@ -119,31 +115,8 @@ extern struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
119/* non-0 if default (table-less) MP configuration */ 115/* non-0 if default (table-less) MP configuration */
120extern int mpc_default_type; 116extern int mpc_default_type;
121 117
122static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) 118/* Older SiS APIC requires we rewrite the index register */
123{
124 *IO_APIC_BASE(apic) = reg;
125 return *(IO_APIC_BASE(apic)+4);
126}
127
128static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
129{
130 *IO_APIC_BASE(apic) = reg;
131 *(IO_APIC_BASE(apic)+4) = value;
132}
133
134/*
135 * Re-write a value: to be used for read-modify-write
136 * cycles where the read already set up the index register.
137 *
138 * Older SiS APIC requires we rewrite the index regiser
139 */
140extern int sis_apic_bug; 119extern int sis_apic_bug;
141static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value)
142{
143 if (sis_apic_bug)
144 *IO_APIC_BASE(apic) = reg;
145 *(IO_APIC_BASE(apic)+4) = value;
146}
147 120
148/* 1 if "noapic" boot option passed */ 121/* 1 if "noapic" boot option passed */
149extern int skip_ioapic_setup; 122extern int skip_ioapic_setup;
diff --git a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
deleted file mode 100644
index 21cd696d4d0f..000000000000
--- a/include/asm-i386/mach-visws/do_timer.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/* defines for inline arch setup functions */
2
3#include <asm/fixmap.h>
4#include <asm/i8259.h>
5#include "cobalt.h"
6
7static inline void do_timer_interrupt_hook(void)
8{
9 /* Clear the interrupt */
10 co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR);
11
12 do_timer(1);
13#ifndef CONFIG_SMP
14 update_process_times(user_mode_vm(irq_regs));
15#endif
16/*
17 * In the SMP case we use the local APIC timer interrupt to do the
18 * profiling, except when we simulate SMP mode on a uniprocessor
19 * system, in that case we have to call the local interrupt handler.
20 */
21#ifndef CONFIG_X86_LOCAL_APIC
22 profile_tick(CPU_PROFILING);
23#else
24 if (!using_apic_timer)
25 smp_local_timer_interrupt();
26#endif
27}
28
29static inline int do_timer_overflow(int count)
30{
31 int i;
32
33 spin_lock(&i8259A_lock);
34 /*
35 * This is tricky when I/O APICs are used;
36 * see do_timer_interrupt().
37 */
38 i = inb(0x20);
39 spin_unlock(&i8259A_lock);
40
41 /* assumption about timer being IRQ0 */
42 if (i & 0x01) {
43 /*
44 * We cannot detect lost timer interrupts ...
45 * well, that's why we call them lost, don't we? :)
46 * [hmm, on the Pentium and Alpha we can ... sort of]
47 */
48 count -= LATCH;
49 } else {
50 printk("do_slow_gettimeoffset(): hardware timer problem?\n");
51 }
52 return count;
53}
diff --git a/include/asm-i386/mach-visws/mach_apic.h b/include/asm-i386/mach-visws/mach_apic.h
index de438c7147a8..18afe6b6fc4d 100644
--- a/include/asm-i386/mach-visws/mach_apic.h
+++ b/include/asm-i386/mach-visws/mach_apic.h
@@ -51,6 +51,11 @@ static inline void clustered_apic_check(void)
51{ 51{
52} 52}
53 53
54static inline int apicid_to_node(int logical_apicid)
55{
56 return 0;
57}
58
54/* Mapping from cpu number to logical apicid */ 59/* Mapping from cpu number to logical apicid */
55static inline int cpu_to_logical_apicid(int cpu) 60static inline int cpu_to_logical_apicid(int cpu)
56{ 61{
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 2277127696d2..e0ddca94d50c 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -306,6 +306,8 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
306 : :"a" (eax), "c" (ecx)); 306 : :"a" (eax), "c" (ecx));
307} 307}
308 308
309extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
310
309/* from system description table in BIOS. Mostly for MCA use, but 311/* from system description table in BIOS. Mostly for MCA use, but
310others may find it useful. */ 312others may find it useful. */
311extern unsigned int machine_id; 313extern unsigned int machine_id;
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
index 54d905ebc63d..eef5133b9ce2 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -404,20 +404,6 @@ unsigned long __must_check __copy_from_user_ll_nocache_nozero(void *to,
404 * anything, so this is accurate. 404 * anything, so this is accurate.
405 */ 405 */
406 406
407/**
408 * __copy_to_user: - Copy a block of data into user space, with less checking.
409 * @to: Destination address, in user space.
410 * @from: Source address, in kernel space.
411 * @n: Number of bytes to copy.
412 *
413 * Context: User context only. This function may sleep.
414 *
415 * Copy data from kernel space to user space. Caller must check
416 * the specified block with access_ok() before calling this function.
417 *
418 * Returns number of bytes that could not be copied.
419 * On success, this will be zero.
420 */
421static __always_inline unsigned long __must_check 407static __always_inline unsigned long __must_check
422__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n) 408__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
423{ 409{
@@ -439,35 +425,27 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
439 return __copy_to_user_ll(to, from, n); 425 return __copy_to_user_ll(to, from, n);
440} 426}
441 427
442static __always_inline unsigned long __must_check
443__copy_to_user(void __user *to, const void *from, unsigned long n)
444{
445 might_sleep();
446 return __copy_to_user_inatomic(to, from, n);
447}
448
449/** 428/**
450 * __copy_from_user: - Copy a block of data from user space, with less checking. 429 * __copy_to_user: - Copy a block of data into user space, with less checking.
451 * @to: Destination address, in kernel space. 430 * @to: Destination address, in user space.
452 * @from: Source address, in user space. 431 * @from: Source address, in kernel space.
453 * @n: Number of bytes to copy. 432 * @n: Number of bytes to copy.
454 * 433 *
455 * Context: User context only. This function may sleep. 434 * Context: User context only. This function may sleep.
456 * 435 *
457 * Copy data from user space to kernel space. Caller must check 436 * Copy data from kernel space to user space. Caller must check
458 * the specified block with access_ok() before calling this function. 437 * the specified block with access_ok() before calling this function.
459 * 438 *
460 * Returns number of bytes that could not be copied. 439 * Returns number of bytes that could not be copied.
461 * On success, this will be zero. 440 * On success, this will be zero.
462 *
463 * If some data could not be copied, this function will pad the copied
464 * data to the requested size using zero bytes.
465 *
466 * An alternate version - __copy_from_user_inatomic() - may be called from
467 * atomic context and will fail rather than sleep. In this case the
468 * uncopied bytes will *NOT* be padded with zeros. See fs/filemap.h
469 * for explanation of why this is needed.
470 */ 441 */
442static __always_inline unsigned long __must_check
443__copy_to_user(void __user *to, const void *from, unsigned long n)
444{
445 might_sleep();
446 return __copy_to_user_inatomic(to, from, n);
447}
448
471static __always_inline unsigned long 449static __always_inline unsigned long
472__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n) 450__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
473{ 451{
@@ -493,6 +471,29 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
493 } 471 }
494 return __copy_from_user_ll_nozero(to, from, n); 472 return __copy_from_user_ll_nozero(to, from, n);
495} 473}
474
475/**
476 * __copy_from_user: - Copy a block of data from user space, with less checking.
477 * @to: Destination address, in kernel space.
478 * @from: Source address, in user space.
479 * @n: Number of bytes to copy.
480 *
481 * Context: User context only. This function may sleep.
482 *
483 * Copy data from user space to kernel space. Caller must check
484 * the specified block with access_ok() before calling this function.
485 *
486 * Returns number of bytes that could not be copied.
487 * On success, this will be zero.
488 *
489 * If some data could not be copied, this function will pad the copied
490 * data to the requested size using zero bytes.
491 *
492 * An alternate version - __copy_from_user_inatomic() - may be called from
493 * atomic context and will fail rather than sleep. In this case the
494 * uncopied bytes will *NOT* be padded with zeros. See fs/filemap.h
495 * for explanation of why this is needed.
496 */
496static __always_inline unsigned long 497static __always_inline unsigned long
497__copy_from_user(void *to, const void __user *from, unsigned long n) 498__copy_from_user(void *to, const void __user *from, unsigned long n)
498{ 499{
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index 3ca7ab963d7d..beeeaf6b054a 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -324,10 +324,11 @@
324#define __NR_vmsplice 316 324#define __NR_vmsplice 316
325#define __NR_move_pages 317 325#define __NR_move_pages 317
326#define __NR_getcpu 318 326#define __NR_getcpu 318
327#define __NR_epoll_pwait 319
327 328
328#ifdef __KERNEL__ 329#ifdef __KERNEL__
329 330
330#define NR_syscalls 319 331#define NR_syscalls 320
331#include <linux/err.h> 332#include <linux/err.h>
332 333
333/* 334/*
diff --git a/include/asm-i386/vic.h b/include/asm-i386/vic.h
index 4abfcfb91eb8..53100f353612 100644
--- a/include/asm-i386/vic.h
+++ b/include/asm-i386/vic.h
@@ -58,4 +58,4 @@ static const int VIC_CPI_Registers[] =
58 58
59#define VIC_BOOT_INTERRUPT_MASK 0xfe 59#define VIC_BOOT_INTERRUPT_MASK 0xfe
60 60
61extern void smp_vic_timer_interrupt(struct pt_regs *regs); 61extern void smp_vic_timer_interrupt(void);
diff --git a/include/asm-i386/voyager.h b/include/asm-i386/voyager.h
index e74c54aa757f..5b27838905b2 100644
--- a/include/asm-i386/voyager.h
+++ b/include/asm-i386/voyager.h
@@ -118,33 +118,33 @@ typedef struct voyager_module {
118} voyager_module_t; 118} voyager_module_t;
119 119
120typedef struct voyager_eeprom_hdr { 120typedef struct voyager_eeprom_hdr {
121 __u8 module_id[4] __attribute__((packed)); 121 __u8 module_id[4];
122 __u8 version_id __attribute__((packed)); 122 __u8 version_id;
123 __u8 config_id __attribute__((packed)); 123 __u8 config_id;
124 __u16 boundry_id __attribute__((packed)); /* boundary scan id */ 124 __u16 boundry_id; /* boundary scan id */
125 __u16 ee_size __attribute__((packed)); /* size of EEPROM */ 125 __u16 ee_size; /* size of EEPROM */
126 __u8 assembly[11] __attribute__((packed)); /* assembly # */ 126 __u8 assembly[11]; /* assembly # */
127 __u8 assembly_rev __attribute__((packed)); /* assembly rev */ 127 __u8 assembly_rev; /* assembly rev */
128 __u8 tracer[4] __attribute__((packed)); /* tracer number */ 128 __u8 tracer[4]; /* tracer number */
129 __u16 assembly_cksum __attribute__((packed)); /* asm checksum */ 129 __u16 assembly_cksum; /* asm checksum */
130 __u16 power_consump __attribute__((packed)); /* pwr requirements */ 130 __u16 power_consump; /* pwr requirements */
131 __u16 num_asics __attribute__((packed)); /* number of asics */ 131 __u16 num_asics; /* number of asics */
132 __u16 bist_time __attribute__((packed)); /* min. bist time */ 132 __u16 bist_time; /* min. bist time */
133 __u16 err_log_offset __attribute__((packed)); /* error log offset */ 133 __u16 err_log_offset; /* error log offset */
134 __u16 scan_path_offset __attribute__((packed));/* scan path offset */ 134 __u16 scan_path_offset;/* scan path offset */
135 __u16 cct_offset __attribute__((packed)); 135 __u16 cct_offset;
136 __u16 log_length __attribute__((packed)); /* length of err log */ 136 __u16 log_length; /* length of err log */
137 __u16 xsum_end __attribute__((packed)); /* offset to end of 137 __u16 xsum_end; /* offset to end of
138 checksum */ 138 checksum */
139 __u8 reserved[4] __attribute__((packed)); 139 __u8 reserved[4];
140 __u8 sflag __attribute__((packed)); /* starting sentinal */ 140 __u8 sflag; /* starting sentinal */
141 __u8 part_number[13] __attribute__((packed)); /* prom part number */ 141 __u8 part_number[13]; /* prom part number */
142 __u8 version[10] __attribute__((packed)); /* version number */ 142 __u8 version[10]; /* version number */
143 __u8 signature[8] __attribute__((packed)); 143 __u8 signature[8];
144 __u16 eeprom_chksum __attribute__((packed)); 144 __u16 eeprom_chksum;
145 __u32 data_stamp_offset __attribute__((packed)); 145 __u32 data_stamp_offset;
146 __u8 eflag __attribute__((packed)); /* ending sentinal */ 146 __u8 eflag ; /* ending sentinal */
147} voyager_eprom_hdr_t; 147} __attribute__((packed)) voyager_eprom_hdr_t;
148 148
149 149
150 150
@@ -155,30 +155,30 @@ typedef struct voyager_eeprom_hdr {
155 * in the module EPROMs. We really only care about the IDs and 155 * in the module EPROMs. We really only care about the IDs and
156 * offsets */ 156 * offsets */
157typedef struct voyager_sp_table { 157typedef struct voyager_sp_table {
158 __u8 asic_id __attribute__((packed)); 158 __u8 asic_id;
159 __u8 bypass_flag __attribute__((packed)); 159 __u8 bypass_flag;
160 __u16 asic_data_offset __attribute__((packed)); 160 __u16 asic_data_offset;
161 __u16 config_data_offset __attribute__((packed)); 161 __u16 config_data_offset;
162} voyager_sp_table_t; 162} __attribute__((packed)) voyager_sp_table_t;
163 163
164typedef struct voyager_jtag_table { 164typedef struct voyager_jtag_table {
165 __u8 icode[4] __attribute__((packed)); 165 __u8 icode[4];
166 __u8 runbist[4] __attribute__((packed)); 166 __u8 runbist[4];
167 __u8 intest[4] __attribute__((packed)); 167 __u8 intest[4];
168 __u8 samp_preld[4] __attribute__((packed)); 168 __u8 samp_preld[4];
169 __u8 ireg_len __attribute__((packed)); 169 __u8 ireg_len;
170} voyager_jtt_t; 170} __attribute__((packed)) voyager_jtt_t;
171 171
172typedef struct voyager_asic_data_table { 172typedef struct voyager_asic_data_table {
173 __u8 jtag_id[4] __attribute__((packed)); 173 __u8 jtag_id[4];
174 __u16 length_bsr __attribute__((packed)); 174 __u16 length_bsr;
175 __u16 length_bist_reg __attribute__((packed)); 175 __u16 length_bist_reg;
176 __u32 bist_clk __attribute__((packed)); 176 __u32 bist_clk;
177 __u16 subaddr_bits __attribute__((packed)); 177 __u16 subaddr_bits;
178 __u16 seed_bits __attribute__((packed)); 178 __u16 seed_bits;
179 __u16 sig_bits __attribute__((packed)); 179 __u16 sig_bits;
180 __u16 jtag_offset __attribute__((packed)); 180 __u16 jtag_offset;
181} voyager_at_t; 181} __attribute__((packed)) voyager_at_t;
182 182
183/* Voyager Interrupt Controller (VIC) registers */ 183/* Voyager Interrupt Controller (VIC) registers */
184 184
@@ -328,52 +328,52 @@ struct voyager_bios_info {
328#define NUMBER_OF_POS_REGS 8 328#define NUMBER_OF_POS_REGS 8
329 329
330typedef struct { 330typedef struct {
331 __u8 MC_Slot __attribute__((packed)); 331 __u8 MC_Slot;
332 __u8 POS_Values[NUMBER_OF_POS_REGS] __attribute__((packed)); 332 __u8 POS_Values[NUMBER_OF_POS_REGS];
333} MC_SlotInformation_t; 333} __attribute__((packed)) MC_SlotInformation_t;
334 334
335struct QuadDescription { 335struct QuadDescription {
336 __u8 Type __attribute__((packed)); /* for type 0 (DYADIC or MONADIC) all fields 336 __u8 Type; /* for type 0 (DYADIC or MONADIC) all fields
337 * will be zero except for slot */ 337 * will be zero except for slot */
338 __u8 StructureVersion __attribute__((packed)); 338 __u8 StructureVersion;
339 __u32 CPI_BaseAddress __attribute__((packed)); 339 __u32 CPI_BaseAddress;
340 __u32 LARC_BankSize __attribute__((packed)); 340 __u32 LARC_BankSize;
341 __u32 LocalMemoryStateBits __attribute__((packed)); 341 __u32 LocalMemoryStateBits;
342 __u8 Slot __attribute__((packed)); /* Processor slots 1 - 4 */ 342 __u8 Slot; /* Processor slots 1 - 4 */
343}; 343} __attribute__((packed));
344 344
345struct ProcBoardInfo { 345struct ProcBoardInfo {
346 __u8 Type __attribute__((packed)); 346 __u8 Type;
347 __u8 StructureVersion __attribute__((packed)); 347 __u8 StructureVersion;
348 __u8 NumberOfBoards __attribute__((packed)); 348 __u8 NumberOfBoards;
349 struct QuadDescription QuadData[MAX_PROCESSOR_BOARDS] __attribute__((packed)); 349 struct QuadDescription QuadData[MAX_PROCESSOR_BOARDS];
350}; 350} __attribute__((packed));
351 351
352struct CacheDescription { 352struct CacheDescription {
353 __u8 Level __attribute__((packed)); 353 __u8 Level;
354 __u32 TotalSize __attribute__((packed)); 354 __u32 TotalSize;
355 __u16 LineSize __attribute__((packed)); 355 __u16 LineSize;
356 __u8 Associativity __attribute__((packed)); 356 __u8 Associativity;
357 __u8 CacheType __attribute__((packed)); 357 __u8 CacheType;
358 __u8 WriteType __attribute__((packed)); 358 __u8 WriteType;
359 __u8 Number_CPUs_SharedBy __attribute__((packed)); 359 __u8 Number_CPUs_SharedBy;
360 __u8 Shared_CPUs_Hardware_IDs[MAX_SHARED_CPUS] __attribute__((packed)); 360 __u8 Shared_CPUs_Hardware_IDs[MAX_SHARED_CPUS];
361 361
362}; 362} __attribute__((packed));
363 363
364struct CPU_Description { 364struct CPU_Description {
365 __u8 CPU_HardwareId __attribute__((packed)); 365 __u8 CPU_HardwareId;
366 char *FRU_String __attribute__((packed)); 366 char *FRU_String;
367 __u8 NumberOfCacheLevels __attribute__((packed)); 367 __u8 NumberOfCacheLevels;
368 struct CacheDescription CacheLevelData[MAX_CACHE_LEVELS] __attribute__((packed)); 368 struct CacheDescription CacheLevelData[MAX_CACHE_LEVELS];
369}; 369} __attribute__((packed));
370 370
371struct CPU_Info { 371struct CPU_Info {
372 __u8 Type __attribute__((packed)); 372 __u8 Type;
373 __u8 StructureVersion __attribute__((packed)); 373 __u8 StructureVersion;
374 __u8 NumberOf_CPUs __attribute__((packed)); 374 __u8 NumberOf_CPUs;
375 struct CPU_Description CPU_Data[MAX_CPUS] __attribute__((packed)); 375 struct CPU_Description CPU_Data[MAX_CPUS];
376}; 376} __attribute__((packed));
377 377
378 378
379/* 379/*
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index 43bfff6c6b87..855c30af72a9 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -417,6 +417,8 @@ __writeq (unsigned long val, volatile void __iomem *addr)
417# define outl_p outl 417# define outl_p outl
418#endif 418#endif
419 419
420# ifdef __KERNEL__
421
420extern void __iomem * ioremap(unsigned long offset, unsigned long size); 422extern void __iomem * ioremap(unsigned long offset, unsigned long size);
421extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); 423extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
422 424
@@ -430,8 +432,6 @@ iounmap (volatile void __iomem *addr)
430#define dmi_iounmap(x,l) iounmap(x) 432#define dmi_iounmap(x,l) iounmap(x)
431#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC) 433#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
432 434
433# ifdef __KERNEL__
434
435/* 435/*
436 * String version of IO memory access ops: 436 * String version of IO memory access ops:
437 */ 437 */
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index 2c8fd92d0ece..4283ddcc25fb 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -764,7 +764,7 @@ struct ia64_pal_retval {
764 * (generally 0) MUST be passed. Reserved parameters are not optional 764 * (generally 0) MUST be passed. Reserved parameters are not optional
765 * parameters. 765 * parameters.
766 */ 766 */
767extern struct ia64_pal_retval ia64_pal_call_static (u64, u64, u64, u64, u64); 767extern struct ia64_pal_retval ia64_pal_call_static (u64, u64, u64, u64);
768extern struct ia64_pal_retval ia64_pal_call_stacked (u64, u64, u64, u64); 768extern struct ia64_pal_retval ia64_pal_call_stacked (u64, u64, u64, u64);
769extern struct ia64_pal_retval ia64_pal_call_phys_static (u64, u64, u64, u64); 769extern struct ia64_pal_retval ia64_pal_call_phys_static (u64, u64, u64, u64);
770extern struct ia64_pal_retval ia64_pal_call_phys_stacked (u64, u64, u64, u64); 770extern struct ia64_pal_retval ia64_pal_call_phys_stacked (u64, u64, u64, u64);
@@ -774,14 +774,7 @@ extern void ia64_load_scratch_fpregs (struct ia64_fpreg *);
774#define PAL_CALL(iprv,a0,a1,a2,a3) do { \ 774#define PAL_CALL(iprv,a0,a1,a2,a3) do { \
775 struct ia64_fpreg fr[6]; \ 775 struct ia64_fpreg fr[6]; \
776 ia64_save_scratch_fpregs(fr); \ 776 ia64_save_scratch_fpregs(fr); \
777 iprv = ia64_pal_call_static(a0, a1, a2, a3, 0); \ 777 iprv = ia64_pal_call_static(a0, a1, a2, a3); \
778 ia64_load_scratch_fpregs(fr); \
779} while (0)
780
781#define PAL_CALL_IC_OFF(iprv,a0,a1,a2,a3) do { \
782 struct ia64_fpreg fr[6]; \
783 ia64_save_scratch_fpregs(fr); \
784 iprv = ia64_pal_call_static(a0, a1, a2, a3, 1); \
785 ia64_load_scratch_fpregs(fr); \ 778 ia64_load_scratch_fpregs(fr); \
786} while (0) 779} while (0)
787 780
diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h
index 0b210abbe003..d000689d9142 100644
--- a/include/asm-ia64/sal.h
+++ b/include/asm-ia64/sal.h
@@ -659,6 +659,7 @@ ia64_sal_freq_base (unsigned long which, unsigned long *ticks_per_second,
659} 659}
660 660
661extern s64 ia64_sal_cache_flush (u64 cache_type); 661extern s64 ia64_sal_cache_flush (u64 cache_type);
662extern void __init check_sal_cache_flush (void);
662 663
663/* Initialize all the processor and platform level instruction and data caches */ 664/* Initialize all the processor and platform level instruction and data caches */
664static inline s64 665static inline s64
diff --git a/include/asm-ia64/sn/addrs.h b/include/asm-ia64/sn/addrs.h
index 1d9efe541662..e715c794b186 100644
--- a/include/asm-ia64/sn/addrs.h
+++ b/include/asm-ia64/sn/addrs.h
@@ -136,9 +136,13 @@
136 */ 136 */
137#define TO_PHYS(x) (TO_PHYS_MASK & (x)) 137#define TO_PHYS(x) (TO_PHYS_MASK & (x))
138#define TO_CAC(x) (CAC_BASE | TO_PHYS(x)) 138#define TO_CAC(x) (CAC_BASE | TO_PHYS(x))
139#ifdef CONFIG_SGI_SN
139#define TO_AMO(x) (AMO_BASE | TO_PHYS(x)) 140#define TO_AMO(x) (AMO_BASE | TO_PHYS(x))
140#define TO_GET(x) (GET_BASE | TO_PHYS(x)) 141#define TO_GET(x) (GET_BASE | TO_PHYS(x))
141 142#else
143#define TO_AMO(x) ({ BUG(); x; })
144#define TO_GET(x) ({ BUG(); x; })
145#endif
142 146
143/* 147/*
144 * Covert from processor physical address to II/TIO physical address: 148 * Covert from processor physical address to II/TIO physical address:
diff --git a/include/asm-ia64/uaccess.h b/include/asm-ia64/uaccess.h
index 9adb51211c22..449c8c0fa2bd 100644
--- a/include/asm-ia64/uaccess.h
+++ b/include/asm-ia64/uaccess.h
@@ -389,7 +389,7 @@ xlate_dev_kmem_ptr (char * p)
389 struct page *page; 389 struct page *page;
390 char * ptr; 390 char * ptr;
391 391
392 page = virt_to_page((unsigned long)p >> PAGE_SHIFT); 392 page = virt_to_page((unsigned long)p);
393 if (PageUncached(page)) 393 if (PageUncached(page))
394 ptr = (char *)__pa(p) + __IA64_UNCACHED_OFFSET; 394 ptr = (char *)__pa(p) + __IA64_UNCACHED_OFFSET;
395 else 395 else
diff --git a/include/asm-m32r/io.h b/include/asm-m32r/io.h
index 70ad1c949c2b..d06933bd6318 100644
--- a/include/asm-m32r/io.h
+++ b/include/asm-m32r/io.h
@@ -166,38 +166,6 @@ static inline void _writel(unsigned long l, unsigned long addr)
166 166
167#define flush_write_buffers() do { } while (0) /* M32R_FIXME */ 167#define flush_write_buffers() do { } while (0) /* M32R_FIXME */
168 168
169/**
170 * check_signature - find BIOS signatures
171 * @io_addr: mmio address to check
172 * @signature: signature block
173 * @length: length of signature
174 *
175 * Perform a signature comparison with the ISA mmio address io_addr.
176 * Returns 1 on a match.
177 *
178 * This function is deprecated. New drivers should use ioremap and
179 * check_signature.
180 */
181
182static inline int check_signature(void __iomem *io_addr,
183 const unsigned char *signature, int length)
184{
185 int retval = 0;
186#if 0
187printk("check_signature\n");
188 do {
189 if (readb(io_addr) != *signature)
190 goto out;
191 io_addr++;
192 signature++;
193 length--;
194 } while (length);
195 retval = 1;
196out:
197#endif
198 return retval;
199}
200
201static inline void 169static inline void
202memset_io(volatile void __iomem *addr, unsigned char val, int count) 170memset_io(volatile void __iomem *addr, unsigned char val, int count)
203{ 171{
diff --git a/include/asm-m68k/sun3mmu.h b/include/asm-m68k/sun3mmu.h
index 6c8c17d047a1..d8f17a0d8c9f 100644
--- a/include/asm-m68k/sun3mmu.h
+++ b/include/asm-m68k/sun3mmu.h
@@ -4,6 +4,7 @@
4#ifndef __SUN3_MMU_H__ 4#ifndef __SUN3_MMU_H__
5#define __SUN3_MMU_H__ 5#define __SUN3_MMU_H__
6 6
7#include <linux/types.h>
7#include <asm/movs.h> 8#include <asm/movs.h>
8#include <asm/sun3-head.h> 9#include <asm/sun3-head.h>
9 10
@@ -160,7 +161,7 @@ static inline void sun3_put_context(unsigned char c)
160 return; 161 return;
161} 162}
162 163
163extern void *sun3_ioremap(unsigned long phys, unsigned long size, 164extern void __iomem *sun3_ioremap(unsigned long phys, unsigned long size,
164 unsigned long type); 165 unsigned long type);
165 166
166extern int sun3_map_test(unsigned long addr, char *val); 167extern int sun3_map_test(unsigned long addr, char *val);
diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h
index 88b1f47400e1..e4c9f080ff20 100644
--- a/include/asm-m68k/uaccess.h
+++ b/include/asm-m68k/uaccess.h
@@ -76,7 +76,7 @@ asm volatile ("\n" \
76 break; \ 76 break; \
77 case 8: \ 77 case 8: \
78 { \ 78 { \
79 const void *__pu_ptr = (ptr); \ 79 const void __user *__pu_ptr = (ptr); \
80 asm volatile ("\n" \ 80 asm volatile ("\n" \
81 "1: moves.l %2,(%1)+\n" \ 81 "1: moves.l %2,(%1)+\n" \
82 "2: moves.l %R2,(%1)\n" \ 82 "2: moves.l %R2,(%1)\n" \
@@ -125,7 +125,7 @@ asm volatile ("\n" \
125 " .previous" \ 125 " .previous" \
126 : "+d" (res), "=&" #reg (__gu_val) \ 126 : "+d" (res), "=&" #reg (__gu_val) \
127 : "m" (*(ptr)), "i" (err)); \ 127 : "m" (*(ptr)), "i" (err)); \
128 (x) = (typeof(*(ptr)))(long)__gu_val; \ 128 (x) = (typeof(*(ptr)))(unsigned long)__gu_val; \
129}) 129})
130 130
131#define __get_user(x, ptr) \ 131#define __get_user(x, ptr) \
@@ -221,16 +221,16 @@ __constant_copy_from_user(void *to, const void __user *from, unsigned long n)
221 221
222 switch (n) { 222 switch (n) {
223 case 1: 223 case 1:
224 __get_user_asm(res, *(u8 *)to, (u8 *)from, u8, b, d, 1); 224 __get_user_asm(res, *(u8 *)to, (u8 __user *)from, u8, b, d, 1);
225 break; 225 break;
226 case 2: 226 case 2:
227 __get_user_asm(res, *(u16 *)to, (u16 *)from, u16, w, d, 2); 227 __get_user_asm(res, *(u16 *)to, (u16 __user *)from, u16, w, d, 2);
228 break; 228 break;
229 case 3: 229 case 3:
230 __constant_copy_from_user_asm(res, to, from, tmp, 3, w, b,); 230 __constant_copy_from_user_asm(res, to, from, tmp, 3, w, b,);
231 break; 231 break;
232 case 4: 232 case 4:
233 __get_user_asm(res, *(u32 *)to, (u32 *)from, u32, l, r, 4); 233 __get_user_asm(res, *(u32 *)to, (u32 __user *)from, u32, l, r, 4);
234 break; 234 break;
235 case 5: 235 case 5:
236 __constant_copy_from_user_asm(res, to, from, tmp, 5, l, b,); 236 __constant_copy_from_user_asm(res, to, from, tmp, 5, l, b,);
@@ -302,16 +302,16 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n)
302 302
303 switch (n) { 303 switch (n) {
304 case 1: 304 case 1:
305 __put_user_asm(res, *(u8 *)from, (u8 *)to, b, d, 1); 305 __put_user_asm(res, *(u8 *)from, (u8 __user *)to, b, d, 1);
306 break; 306 break;
307 case 2: 307 case 2:
308 __put_user_asm(res, *(u16 *)from, (u16 *)to, w, d, 2); 308 __put_user_asm(res, *(u16 *)from, (u16 __user *)to, w, d, 2);
309 break; 309 break;
310 case 3: 310 case 3:
311 __constant_copy_to_user_asm(res, to, from, tmp, 3, w, b,); 311 __constant_copy_to_user_asm(res, to, from, tmp, 3, w, b,);
312 break; 312 break;
313 case 4: 313 case 4:
314 __put_user_asm(res, *(u32 *)from, (u32 *)to, l, r, 4); 314 __put_user_asm(res, *(u32 *)from, (u32 __user *)to, l, r, 4);
315 break; 315 break;
316 case 5: 316 case 5:
317 __constant_copy_to_user_asm(res, to, from, tmp, 5, l, b,); 317 __constant_copy_to_user_asm(res, to, from, tmp, 5, l, b,);
diff --git a/include/asm-m68knommu/irq_regs.h b/include/asm-m68knommu/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/include/asm-m68knommu/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/include/asm-m68knommu/irqnode.h b/include/asm-m68knommu/irqnode.h
index a2503dfc554c..6132a9858b52 100644
--- a/include/asm-m68knommu/irqnode.h
+++ b/include/asm-m68knommu/irqnode.h
@@ -8,7 +8,7 @@
8 * interrupt source (if it supports chaining). 8 * interrupt source (if it supports chaining).
9 */ 9 */
10typedef struct irq_node { 10typedef struct irq_node {
11 irqreturn_t (*handler)(int, void *, struct pt_regs *); 11 irq_handler_t handler;
12 unsigned long flags; 12 unsigned long flags;
13 void *dev_id; 13 void *dev_id;
14 const char *devname; 14 const char *devname;
@@ -18,12 +18,12 @@ typedef struct irq_node {
18/* 18/*
19 * This structure has only 4 elements for speed reasons 19 * This structure has only 4 elements for speed reasons
20 */ 20 */
21typedef struct irq_handler { 21struct irq_entry {
22 irqreturn_t (*handler)(int, void *, struct pt_regs *); 22 irq_handler_t handler;
23 unsigned long flags; 23 unsigned long flags;
24 void *dev_id; 24 void *dev_id;
25 const char *devname; 25 const char *devname;
26} irq_handler_t; 26};
27 27
28/* count of spurious interrupts */ 28/* count of spurious interrupts */
29extern volatile unsigned int num_spurious; 29extern volatile unsigned int num_spurious;
diff --git a/include/asm-m68knommu/machdep.h b/include/asm-m68knommu/machdep.h
index 27c90afd3339..6ce28f8e0ead 100644
--- a/include/asm-m68knommu/machdep.h
+++ b/include/asm-m68knommu/machdep.h
@@ -18,7 +18,7 @@ extern int (*mach_kbdrate) (struct kbd_repeat *);
18extern void (*mach_kbd_leds) (unsigned int); 18extern void (*mach_kbd_leds) (unsigned int);
19/* machine dependent irq functions */ 19/* machine dependent irq functions */
20extern void (*mach_init_IRQ) (void); 20extern void (*mach_init_IRQ) (void);
21extern irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *); 21extern irq_handler_t mach_default_handler;
22extern int (*mach_request_irq) (unsigned int irq, void (*handler)(int, void *, struct pt_regs *), 22extern int (*mach_request_irq) (unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
23 unsigned long flags, const char *devname, void *dev_id); 23 unsigned long flags, const char *devname, void *dev_id);
24extern void (*mach_free_irq) (unsigned int irq, void *dev_id); 24extern void (*mach_free_irq) (unsigned int irq, void *dev_id);
diff --git a/include/asm-m68knommu/unistd.h b/include/asm-m68knommu/unistd.h
index daafb5d43ef1..ebaf03197114 100644
--- a/include/asm-m68knommu/unistd.h
+++ b/include/asm-m68knommu/unistd.h
@@ -281,14 +281,43 @@
281#define __NR_mq_notify 275 281#define __NR_mq_notify 275
282#define __NR_mq_getsetattr 276 282#define __NR_mq_getsetattr 276
283#define __NR_waitid 277 283#define __NR_waitid 277
284#define __NR_sys_setaltroot 278 284#define __NR_vserver 278
285#define __NR_add_key 279 285#define __NR_add_key 279
286#define __NR_request_key 280 286#define __NR_request_key 280
287#define __NR_keyctl 281 287#define __NR_keyctl 281
288 288#define __NR_ioprio_set 282
289#define __NR_ioprio_get 283
290#define __NR_inotify_init 284
291#define __NR_inotify_add_watch 285
292#define __NR_inotify_rm_watch 286
293#define __NR_migrate_pages 287
294#define __NR_openat 288
295#define __NR_mkdirat 289
296#define __NR_mknodat 290
297#define __NR_fchownat 291
298#define __NR_futimesat 292
299#define __NR_fstatat64 293
300#define __NR_unlinkat 294
301#define __NR_renameat 295
302#define __NR_linkat 296
303#define __NR_symlinkat 297
304#define __NR_readlinkat 298
305#define __NR_fchmodat 299
306#define __NR_faccessat 300
307#define __NR_pselect6 301
308#define __NR_ppoll 302
309#define __NR_unshare 303
310#define __NR_set_robust_list 304
311#define __NR_get_robust_list 305
312#define __NR_splice 306
313#define __NR_sync_file_range 307
314#define __NR_tee 308
315#define __NR_vmsplice 309
316#define __NR_move_pages 310
317
289#ifdef __KERNEL__ 318#ifdef __KERNEL__
290 319
291#define NR_syscalls 282 320#define NR_syscalls 311
292#include <linux/err.h> 321#include <linux/err.h>
293 322
294/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see 323/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
diff --git a/include/asm-mips/asm.h b/include/asm-mips/asm.h
index e3038a4599ee..838eb3144d81 100644
--- a/include/asm-mips/asm.h
+++ b/include/asm-mips/asm.h
@@ -344,6 +344,7 @@ symbol = value
344#define PTR_L lw 344#define PTR_L lw
345#define PTR_S sw 345#define PTR_S sw
346#define PTR_LA la 346#define PTR_LA la
347#define PTR_LI li
347#define PTR_SLL sll 348#define PTR_SLL sll
348#define PTR_SLLV sllv 349#define PTR_SLLV sllv
349#define PTR_SRL srl 350#define PTR_SRL srl
@@ -368,6 +369,7 @@ symbol = value
368#define PTR_L ld 369#define PTR_L ld
369#define PTR_S sd 370#define PTR_S sd
370#define PTR_LA dla 371#define PTR_LA dla
372#define PTR_LI dli
371#define PTR_SLL dsll 373#define PTR_SLL dsll
372#define PTR_SLLV dsllv 374#define PTR_SLLV dsllv
373#define PTR_SRL dsrl 375#define PTR_SRL dsrl
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index 9ab59e2bb233..e3c9925876a3 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -55,24 +55,13 @@ extern void (*flush_icache_range)(unsigned long start, unsigned long end);
55#define flush_cache_vmap(start, end) flush_cache_all() 55#define flush_cache_vmap(start, end) flush_cache_all()
56#define flush_cache_vunmap(start, end) flush_cache_all() 56#define flush_cache_vunmap(start, end) flush_cache_all()
57 57
58static inline void copy_to_user_page(struct vm_area_struct *vma, 58extern void copy_to_user_page(struct vm_area_struct *vma,
59 struct page *page, unsigned long vaddr, void *dst, const void *src, 59 struct page *page, unsigned long vaddr, void *dst, const void *src,
60 unsigned long len) 60 unsigned long len);
61{
62 if (cpu_has_dc_aliases)
63 flush_cache_page(vma, vaddr, page_to_pfn(page));
64 memcpy(dst, src, len);
65 __flush_icache_page(vma, page);
66}
67 61
68static inline void copy_from_user_page(struct vm_area_struct *vma, 62extern void copy_from_user_page(struct vm_area_struct *vma,
69 struct page *page, unsigned long vaddr, void *dst, const void *src, 63 struct page *page, unsigned long vaddr, void *dst, const void *src,
70 unsigned long len) 64 unsigned long len);
71{
72 if (cpu_has_dc_aliases)
73 flush_cache_page(vma, vaddr, page_to_pfn(page));
74 memcpy(dst, src, len);
75}
76 65
77extern void (*flush_cache_sigtramp)(unsigned long addr); 66extern void (*flush_cache_sigtramp)(unsigned long addr);
78extern void (*flush_icache_all)(void); 67extern void (*flush_icache_all)(void);
diff --git a/include/asm-mips/div64.h b/include/asm-mips/div64.h
index 5f7dcf5452e7..d107832de1b6 100644
--- a/include/asm-mips/div64.h
+++ b/include/asm-mips/div64.h
@@ -83,27 +83,6 @@
83#if (_MIPS_SZLONG == 64) 83#if (_MIPS_SZLONG == 64)
84 84
85/* 85/*
86 * Don't use this one in new code
87 */
88#define do_div64_32(res, high, low, base) ({ \
89 unsigned int __quot, __mod; \
90 unsigned long __div; \
91 unsigned int __low, __high, __base; \
92 \
93 __high = (high); \
94 __low = (low); \
95 __div = __high; \
96 __div = __div << 32 | __low; \
97 __base = (base); \
98 \
99 __mod = __div % __base; \
100 __div = __div / __base; \
101 \
102 __quot = __div; \
103 (res) = __quot; \
104 __mod; })
105
106/*
107 * Hey, we're already 64-bit, no 86 * Hey, we're already 64-bit, no
108 * need to play games.. 87 * need to play games..
109 */ 88 */
diff --git a/include/asm-mips/fixmap.h b/include/asm-mips/fixmap.h
index 6959bdb59310..02c8a13fc894 100644
--- a/include/asm-mips/fixmap.h
+++ b/include/asm-mips/fixmap.h
@@ -45,8 +45,16 @@
45 * fix-mapped? 45 * fix-mapped?
46 */ 46 */
47enum fixed_addresses { 47enum fixed_addresses {
48#define FIX_N_COLOURS 8
49 FIX_CMAP_BEGIN,
50#ifdef CONFIG_MIPS_MT_SMTC
51 FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS),
52#else
53 FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
54#endif
48#ifdef CONFIG_HIGHMEM 55#ifdef CONFIG_HIGHMEM
49 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ 56 /* reserved pte's for temporary kernel mappings */
57 FIX_KMAP_BEGIN = FIX_CMAP_END + 1,
50 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, 58 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
51#endif 59#endif
52 __end_of_fixed_addresses 60 __end_of_fixed_addresses
@@ -70,9 +78,9 @@ extern void __set_fixmap (enum fixed_addresses idx,
70 * at the top of mem.. 78 * at the top of mem..
71 */ 79 */
72#if defined(CONFIG_CPU_TX39XX) || defined(CONFIG_CPU_TX49XX) 80#if defined(CONFIG_CPU_TX39XX) || defined(CONFIG_CPU_TX49XX)
73#define FIXADDR_TOP (0xff000000UL - 0x2000) 81#define FIXADDR_TOP ((unsigned long)(long)(int)(0xff000000 - 0x20000))
74#else 82#else
75#define FIXADDR_TOP (0xffffe000UL) 83#define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000)
76#endif 84#endif
77#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 85#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
78#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 86#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index df624e1ee6e2..bc5f3c53155f 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -172,7 +172,7 @@ extern unsigned long isa_slot_offset;
172#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) 172#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
173 173
174extern void __iomem * __ioremap(phys_t offset, phys_t size, unsigned long flags); 174extern void __iomem * __ioremap(phys_t offset, phys_t size, unsigned long flags);
175extern void __iounmap(volatile void __iomem *addr); 175extern void __iounmap(const volatile void __iomem *addr);
176 176
177static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size, 177static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
178 unsigned long flags) 178 unsigned long flags)
@@ -279,7 +279,7 @@ static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
279#define ioremap_uncached_accelerated(offset, size) \ 279#define ioremap_uncached_accelerated(offset, size) \
280 __ioremap_mode((offset), (size), _CACHE_UNCACHED_ACCELERATED) 280 __ioremap_mode((offset), (size), _CACHE_UNCACHED_ACCELERATED)
281 281
282static inline void iounmap(volatile void __iomem *addr) 282static inline void iounmap(const volatile void __iomem *addr)
283{ 283{
284#define __IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1) 284#define __IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1)
285 285
@@ -562,32 +562,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
562#define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len)) 562#define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len))
563 563
564/* 564/*
565 * check_signature - find BIOS signatures
566 * @io_addr: mmio address to check
567 * @signature: signature block
568 * @length: length of signature
569 *
570 * Perform a signature comparison with the mmio address io_addr. This
571 * address should have been obtained by ioremap.
572 * Returns 1 on a match.
573 */
574static inline int check_signature(char __iomem *io_addr,
575 const unsigned char *signature, int length)
576{
577 int retval = 0;
578 do {
579 if (readb(io_addr) != *signature)
580 goto out;
581 io_addr++;
582 signature++;
583 length--;
584 } while (length);
585 retval = 1;
586out:
587 return retval;
588}
589
590/*
591 * The caches on some architectures aren't dma-coherent and have need to 565 * The caches on some architectures aren't dma-coherent and have need to
592 * handle this in software. There are three types of operations that 566 * handle this in software. There are three types of operations that
593 * can be applied to dma buffers. 567 * can be applied to dma buffers.
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index 1a9804c65369..35a05ca5560c 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -24,8 +24,6 @@ static inline int irq_canonicalize(int irq)
24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */ 24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
25#endif 25#endif
26 26
27struct pt_regs;
28
29extern asmlinkage unsigned int do_IRQ(unsigned int irq); 27extern asmlinkage unsigned int do_IRQ(unsigned int irq);
30 28
31#ifdef CONFIG_MIPS_MT_SMTC 29#ifdef CONFIG_MIPS_MT_SMTC
@@ -76,4 +74,8 @@ extern int setup_irq_smtc(unsigned int irq, struct irqaction * new,
76 unsigned long hwmask); 74 unsigned long hwmask);
77#endif /* CONFIG_MIPS_MT_SMTC */ 75#endif /* CONFIG_MIPS_MT_SMTC */
78 76
77extern int allocate_irqno(void);
78extern void alloc_legacy_irqno(void);
79extern void free_irqno(unsigned int irq);
80
79#endif /* _ASM_IRQ_H */ 81#endif /* _ASM_IRQ_H */
diff --git a/include/asm-mips/mipsmtregs.h b/include/asm-mips/mipsmtregs.h
index f637ce70758f..3e9468f424f4 100644
--- a/include/asm-mips/mipsmtregs.h
+++ b/include/asm-mips/mipsmtregs.h
@@ -352,6 +352,8 @@ do { \
352#define write_vpe_c0_vpecontrol(val) mttc0(1, 1, val) 352#define write_vpe_c0_vpecontrol(val) mttc0(1, 1, val)
353#define read_vpe_c0_vpeconf0() mftc0(1, 2) 353#define read_vpe_c0_vpeconf0() mftc0(1, 2)
354#define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val) 354#define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val)
355#define read_vpe_c0_count() mftc0(9, 0)
356#define write_vpe_c0_count(val) mttc0(9, 0, val)
355#define read_vpe_c0_status() mftc0(12, 0) 357#define read_vpe_c0_status() mftc0(12, 0)
356#define write_vpe_c0_status(val) mttc0(12, 0, val) 358#define write_vpe_c0_status(val) mttc0(12, 0, val)
357#define read_vpe_c0_cause() mftc0(13, 0) 359#define read_vpe_c0_cause() mftc0(13, 0)
diff --git a/include/asm-mips/pgalloc.h b/include/asm-mips/pgalloc.h
index 582c1fe6cc4a..af121c67dc71 100644
--- a/include/asm-mips/pgalloc.h
+++ b/include/asm-mips/pgalloc.h
@@ -48,7 +48,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
48 48
49 ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER); 49 ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER);
50 if (ret) { 50 if (ret) {
51 init = pgd_offset(&init_mm, 0); 51 init = pgd_offset(&init_mm, 0UL);
52 pgd_init((unsigned long)ret); 52 pgd_init((unsigned long)ret);
53 memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, 53 memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
54 (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); 54 (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index d05fb6f38aa7..7e7320300aa3 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -174,7 +174,7 @@ static inline void pud_clear(pud_t *pudp)
174#define __pmd_offset(address) pmd_index(address) 174#define __pmd_offset(address) pmd_index(address)
175 175
176/* to find an entry in a kernel page-table-directory */ 176/* to find an entry in a kernel page-table-directory */
177#define pgd_offset_k(address) pgd_offset(&init_mm, 0) 177#define pgd_offset_k(address) pgd_offset(&init_mm, 0UL)
178 178
179#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 179#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
180#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) 180#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
diff --git a/include/asm-mips/sibyte/sb1250.h b/include/asm-mips/sibyte/sb1250.h
index b09e16c93ca0..2ba6988ddc8e 100644
--- a/include/asm-mips/sibyte/sb1250.h
+++ b/include/asm-mips/sibyte/sb1250.h
@@ -51,8 +51,8 @@ extern void sb1250_mask_irq(int cpu, int irq);
51extern void sb1250_unmask_irq(int cpu, int irq); 51extern void sb1250_unmask_irq(int cpu, int irq);
52extern void sb1250_smp_finish(void); 52extern void sb1250_smp_finish(void);
53 53
54extern void bcm1480_hpt_setup(void);
54extern void bcm1480_time_init(void); 55extern void bcm1480_time_init(void);
55extern unsigned long bcm1480_gettimeoffset(void);
56extern void bcm1480_mask_irq(int cpu, int irq); 56extern void bcm1480_mask_irq(int cpu, int irq);
57extern void bcm1480_unmask_irq(int cpu, int irq); 57extern void bcm1480_unmask_irq(int cpu, int irq);
58extern void bcm1480_smp_finish(void); 58extern void bcm1480_smp_finish(void);
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index 158a4cd12e46..1fae5dc58138 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -59,69 +59,43 @@
59 .endm 59 .endm
60 60
61#ifdef CONFIG_SMP 61#ifdef CONFIG_SMP
62 .macro get_saved_sp /* SMP variation */
63#ifdef CONFIG_32BIT
64#ifdef CONFIG_MIPS_MT_SMTC 62#ifdef CONFIG_MIPS_MT_SMTC
65 .set mips32 63#define PTEBASE_SHIFT 19 /* TCBIND */
66 mfc0 k0, CP0_TCBIND;
67 .set mips0
68 lui k1, %hi(kernelsp)
69 srl k0, k0, 19
70 /* No need to shift down and up to clear bits 0-1 */
71#else 64#else
72 mfc0 k0, CP0_CONTEXT 65#define PTEBASE_SHIFT 23 /* CONTEXT */
73 lui k1, %hi(kernelsp)
74 srl k0, k0, 23
75#endif
76 addu k1, k0
77 LONG_L k1, %lo(kernelsp)(k1)
78#endif 66#endif
79#ifdef CONFIG_64BIT 67 .macro get_saved_sp /* SMP variation */
80#ifdef CONFIG_MIPS_MT_SMTC 68#ifdef CONFIG_MIPS_MT_SMTC
81 .set mips64 69 mfc0 k0, CP0_TCBIND
82 mfc0 k0, CP0_TCBIND;
83 .set mips0
84 lui k0, %highest(kernelsp)
85 dsrl k1, 19
86 /* No need to shift down and up to clear bits 0-2 */
87#else 70#else
88 MFC0 k1, CP0_CONTEXT 71 MFC0 k0, CP0_CONTEXT
89 lui k0, %highest(kernelsp) 72#endif
90 dsrl k1, 23 73#if defined(CONFIG_BUILD_ELF64) || (defined(CONFIG_64BIT) && __GNUC__ < 4)
91 daddiu k0, %higher(kernelsp) 74 lui k1, %highest(kernelsp)
92 dsll k0, k0, 16 75 daddiu k1, %higher(kernelsp)
93 daddiu k0, %hi(kernelsp) 76 dsll k1, 16
94 dsll k0, k0, 16 77 daddiu k1, %hi(kernelsp)
95#endif /* CONFIG_MIPS_MT_SMTC */ 78 dsll k1, 16
96 daddu k1, k1, k0 79#else
80 lui k1, %hi(kernelsp)
81#endif
82 LONG_SRL k0, PTEBASE_SHIFT
83 LONG_ADDU k1, k0
97 LONG_L k1, %lo(kernelsp)(k1) 84 LONG_L k1, %lo(kernelsp)(k1)
98#endif /* CONFIG_64BIT */
99 .endm 85 .endm
100 86
101 .macro set_saved_sp stackp temp temp2 87 .macro set_saved_sp stackp temp temp2
102#ifdef CONFIG_32BIT
103#ifdef CONFIG_MIPS_MT_SMTC
104 mfc0 \temp, CP0_TCBIND
105 srl \temp, 19
106#else
107 mfc0 \temp, CP0_CONTEXT
108 srl \temp, 23
109#endif
110#endif
111#ifdef CONFIG_64BIT
112#ifdef CONFIG_MIPS_MT_SMTC 88#ifdef CONFIG_MIPS_MT_SMTC
113 mfc0 \temp, CP0_TCBIND 89 mfc0 \temp, CP0_TCBIND
114 dsrl \temp, 19
115#else 90#else
116 MFC0 \temp, CP0_CONTEXT 91 MFC0 \temp, CP0_CONTEXT
117 dsrl \temp, 23
118#endif
119#endif 92#endif
93 LONG_SRL \temp, PTEBASE_SHIFT
120 LONG_S \stackp, kernelsp(\temp) 94 LONG_S \stackp, kernelsp(\temp)
121 .endm 95 .endm
122#else 96#else
123 .macro get_saved_sp /* Uniprocessor variation */ 97 .macro get_saved_sp /* Uniprocessor variation */
124#ifdef CONFIG_64BIT 98#if defined(CONFIG_BUILD_ELF64) || (defined(CONFIG_64BIT) && __GNUC__ < 4)
125 lui k1, %highest(kernelsp) 99 lui k1, %highest(kernelsp)
126 daddiu k1, %higher(kernelsp) 100 daddiu k1, %higher(kernelsp)
127 dsll k1, k1, 16 101 dsll k1, k1, 16
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index dcb4701d5728..3056feed5a36 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -392,7 +392,7 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
392{ 392{
393 __u64 retval; 393 __u64 retval;
394 394
395 if (cpu_has_llsc) { 395 if (cpu_has_llsc && R10000_LLSC_WAR) {
396 __asm__ __volatile__( 396 __asm__ __volatile__(
397 " .set push \n" 397 " .set push \n"
398 " .set noat \n" 398 " .set noat \n"
diff --git a/include/asm-mips/termbits.h b/include/asm-mips/termbits.h
index fa6d04dac56b..b62ec7c521cc 100644
--- a/include/asm-mips/termbits.h
+++ b/include/asm-mips/termbits.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1995, 1996, 1999, 2001 Ralf Baechle 6 * Copyright (C) 1995, 96, 99, 2001, 06 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc. 7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc. 8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */ 9 */
@@ -13,14 +13,8 @@
13#include <linux/posix_types.h> 13#include <linux/posix_types.h>
14 14
15typedef unsigned char cc_t; 15typedef unsigned char cc_t;
16#if (_MIPS_SZLONG == 32) 16typedef unsigned int speed_t;
17typedef unsigned long speed_t; 17typedef unsigned int tcflag_t;
18typedef unsigned long tcflag_t;
19#endif
20#if (_MIPS_SZLONG == 64)
21typedef __u32 speed_t;
22typedef __u32 tcflag_t;
23#endif
24 18
25/* 19/*
26 * The ABI says nothing about NCC but seems to use NCCS as 20 * The ABI says nothing about NCC but seems to use NCCS as
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index 28512ba2266e..625acd337bc3 100644
--- a/include/asm-mips/time.h
+++ b/include/asm-mips/time.h
@@ -48,7 +48,8 @@ extern void (*mips_timer_ack)(void);
48 * If mips_hpt_read is NULL, an R4k-compatible timer setup is attempted. 48 * If mips_hpt_read is NULL, an R4k-compatible timer setup is attempted.
49 */ 49 */
50extern unsigned int (*mips_hpt_read)(void); 50extern unsigned int (*mips_hpt_read)(void);
51extern void (*mips_hpt_init)(unsigned int); 51extern void (*mips_hpt_init)(void);
52extern unsigned int mips_hpt_mask;
52 53
53/* 54/*
54 * to_tm() converts system time back to (year, mon, day, hour, min, sec). 55 * to_tm() converts system time back to (year, mon, day, hour, min, sec).
@@ -58,13 +59,6 @@ extern void (*mips_hpt_init)(unsigned int);
58extern void to_tm(unsigned long tim, struct rtc_time *tm); 59extern void to_tm(unsigned long tim, struct rtc_time *tm);
59 60
60/* 61/*
61 * do_gettimeoffset(). By default, this func pointer points to
62 * do_null_gettimeoffset(), which leads to the same resolution as HZ.
63 * Higher resolution versions are available, which give ~1us resolution.
64 */
65extern unsigned long (*do_gettimeoffset)(void);
66
67/*
68 * high-level timer interrupt routines. 62 * high-level timer interrupt routines.
69 */ 63 */
70extern irqreturn_t timer_interrupt(int irq, void *dev_id); 64extern irqreturn_t timer_interrupt(int irq, void *dev_id);
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 685c91467e63..ec56aa52f669 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -331,16 +331,19 @@
331#define __NR_move_pages (__NR_Linux + 308) 331#define __NR_move_pages (__NR_Linux + 308)
332#define __NR_set_robust_list (__NR_Linux + 309) 332#define __NR_set_robust_list (__NR_Linux + 309)
333#define __NR_get_robust_list (__NR_Linux + 310) 333#define __NR_get_robust_list (__NR_Linux + 310)
334#define __NR_kexec_load (__NR_Linux + 311)
335#define __NR_getcpu (__NR_Linux + 312)
336#define __NR_epoll_pwait (__NR_Linux + 313)
334 337
335/* 338/*
336 * Offset of the last Linux o32 flavoured syscall 339 * Offset of the last Linux o32 flavoured syscall
337 */ 340 */
338#define __NR_Linux_syscalls 310 341#define __NR_Linux_syscalls 313
339 342
340#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 343#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
341 344
342#define __NR_O32_Linux 4000 345#define __NR_O32_Linux 4000
343#define __NR_O32_Linux_syscalls 310 346#define __NR_O32_Linux_syscalls 313
344 347
345#if _MIPS_SIM == _MIPS_SIM_ABI64 348#if _MIPS_SIM == _MIPS_SIM_ABI64
346 349
@@ -618,16 +621,19 @@
618#define __NR_move_pages (__NR_Linux + 267) 621#define __NR_move_pages (__NR_Linux + 267)
619#define __NR_set_robust_list (__NR_Linux + 268) 622#define __NR_set_robust_list (__NR_Linux + 268)
620#define __NR_get_robust_list (__NR_Linux + 269) 623#define __NR_get_robust_list (__NR_Linux + 269)
624#define __NR_kexec_load (__NR_Linux + 270)
625#define __NR_getcpu (__NR_Linux + 271)
626#define __NR_epoll_pwait (__NR_Linux + 272)
621 627
622/* 628/*
623 * Offset of the last Linux 64-bit flavoured syscall 629 * Offset of the last Linux 64-bit flavoured syscall
624 */ 630 */
625#define __NR_Linux_syscalls 269 631#define __NR_Linux_syscalls 272
626 632
627#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 633#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
628 634
629#define __NR_64_Linux 5000 635#define __NR_64_Linux 5000
630#define __NR_64_Linux_syscalls 269 636#define __NR_64_Linux_syscalls 272
631 637
632#if _MIPS_SIM == _MIPS_SIM_NABI32 638#if _MIPS_SIM == _MIPS_SIM_NABI32
633 639
@@ -909,16 +915,19 @@
909#define __NR_move_pages (__NR_Linux + 271) 915#define __NR_move_pages (__NR_Linux + 271)
910#define __NR_set_robust_list (__NR_Linux + 272) 916#define __NR_set_robust_list (__NR_Linux + 272)
911#define __NR_get_robust_list (__NR_Linux + 273) 917#define __NR_get_robust_list (__NR_Linux + 273)
918#define __NR_kexec_load (__NR_Linux + 274)
919#define __NR_getcpu (__NR_Linux + 275)
920#define __NR_epoll_pwait (__NR_Linux + 276)
912 921
913/* 922/*
914 * Offset of the last N32 flavoured syscall 923 * Offset of the last N32 flavoured syscall
915 */ 924 */
916#define __NR_Linux_syscalls 273 925#define __NR_Linux_syscalls 276
917 926
918#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 927#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
919 928
920#define __NR_N32_Linux 6000 929#define __NR_N32_Linux 6000
921#define __NR_N32_Linux_syscalls 273 930#define __NR_N32_Linux_syscalls 276
922 931
923#ifdef __KERNEL__ 932#ifdef __KERNEL__
924 933
@@ -1186,6 +1195,7 @@ type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
1186#endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */ 1195#endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */
1187 1196
1188 1197
1198#define __ARCH_OMIT_COMPAT_SYS_GETDENTS64
1189#define __ARCH_WANT_IPC_PARSE_VERSION 1199#define __ARCH_WANT_IPC_PARSE_VERSION
1190#define __ARCH_WANT_OLD_READDIR 1200#define __ARCH_WANT_OLD_READDIR
1191#define __ARCH_WANT_SYS_ALARM 1201#define __ARCH_WANT_SYS_ALARM
diff --git a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h
index dd3eb3dc5886..88b492f6ea9c 100644
--- a/include/asm-mips/vr41xx/vr41xx.h
+++ b/include/asm-mips/vr41xx/vr41xx.h
@@ -75,7 +75,7 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock);
75 * Interrupt Control Unit 75 * Interrupt Control Unit
76 */ 76 */
77extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign); 77extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign);
78extern int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int, struct pt_regs *)); 78extern int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int));
79 79
80#define PIUINT_COMMAND 0x0040 80#define PIUINT_COMMAND 0x0040
81#define PIUINT_DATA 0x0020 81#define PIUINT_DATA 0x0020
diff --git a/include/asm-powerpc/asm-compat.h b/include/asm-powerpc/asm-compat.h
index 8e64be0cc47d..c89bd58ee283 100644
--- a/include/asm-powerpc/asm-compat.h
+++ b/include/asm-powerpc/asm-compat.h
@@ -14,6 +14,58 @@
14# define ASM_CONST(x) __ASM_CONST(x) 14# define ASM_CONST(x) __ASM_CONST(x)
15#endif 15#endif
16 16
17
18/*
19 * Feature section common macros
20 *
21 * Note that the entries now contain offsets between the table entry
22 * and the code rather than absolute code pointers in order to be
23 * useable with the vdso shared library. There is also an assumption
24 * that values will be negative, that is, the fixup table has to be
25 * located after the code it fixes up.
26 */
27#ifdef CONFIG_PPC64
28#ifdef __powerpc64__
29/* 64 bits kernel, 64 bits code */
30#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
3199: \
32 .section sect,"a"; \
33 .align 3; \
3498: \
35 .llong msk; \
36 .llong val; \
37 .llong label##b-98b; \
38 .llong 99b-98b; \
39 .previous
40#else /* __powerpc64__ */
41/* 64 bits kernel, 32 bits code (ie. vdso32) */
42#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
4399: \
44 .section sect,"a"; \
45 .align 3; \
4698: \
47 .llong msk; \
48 .llong val; \
49 .long 0xffffffff; \
50 .long label##b-98b; \
51 .long 0xffffffff; \
52 .long 99b-98b; \
53 .previous
54#endif /* !__powerpc64__ */
55#else /* CONFIG_PPC64 */
56/* 32 bits kernel, 32 bits code */
57#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
5899: \
59 .section sect,"a"; \
60 .align 2; \
6198: \
62 .long msk; \
63 .long val; \
64 .long label##b-98b; \
65 .long 99b-98b; \
66 .previous
67#endif /* !CONFIG_PPC64 */
68
17#ifdef __powerpc64__ 69#ifdef __powerpc64__
18 70
19/* operations for longs and pointers */ 71/* operations for longs and pointers */
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 12707ab9dc98..a9a40149a7c0 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -89,8 +89,11 @@ struct cpu_spec {
89 89
90extern struct cpu_spec *cur_cpu_spec; 90extern struct cpu_spec *cur_cpu_spec;
91 91
92extern void identify_cpu(unsigned long offset, unsigned long cpu); 92extern unsigned int __start___ftr_fixup, __stop___ftr_fixup;
93extern void do_cpu_ftr_fixups(unsigned long offset); 93
94extern struct cpu_spec *identify_cpu(unsigned long offset);
95extern void do_feature_fixups(unsigned long value, void *fixup_start,
96 void *fixup_end);
94 97
95#endif /* __ASSEMBLY__ */ 98#endif /* __ASSEMBLY__ */
96 99
@@ -144,6 +147,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
144#define CPU_FTR_CI_LARGE_PAGE LONG_ASM_CONST(0x0000100000000000) 147#define CPU_FTR_CI_LARGE_PAGE LONG_ASM_CONST(0x0000100000000000)
145#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000) 148#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000)
146#define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000) 149#define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000)
150#define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000800000000000)
147 151
148#ifndef __ASSEMBLY__ 152#ifndef __ASSEMBLY__
149 153
@@ -332,7 +336,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
332#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 336#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
333 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 337 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
334 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 338 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
335 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE) 339 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_CELL_TB_BUG)
336#define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 340#define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
337 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 341 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
338 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \ 342 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
@@ -431,29 +435,12 @@ static inline int cpu_has_feature(unsigned long feature)
431 435
432#ifdef __ASSEMBLY__ 436#ifdef __ASSEMBLY__
433 437
434#define BEGIN_FTR_SECTION 98: 438#define BEGIN_FTR_SECTION_NESTED(label) label:
435 439#define BEGIN_FTR_SECTION BEGIN_FTR_SECTION_NESTED(97)
436#ifndef __powerpc64__ 440#define END_FTR_SECTION_NESTED(msk, val, label) \
441 MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup)
437#define END_FTR_SECTION(msk, val) \ 442#define END_FTR_SECTION(msk, val) \
43899: \ 443 END_FTR_SECTION_NESTED(msk, val, 97)
439 .section __ftr_fixup,"a"; \
440 .align 2; \
441 .long msk; \
442 .long val; \
443 .long 98b; \
444 .long 99b; \
445 .previous
446#else /* __powerpc64__ */
447#define END_FTR_SECTION(msk, val) \
44899: \
449 .section __ftr_fixup,"a"; \
450 .align 3; \
451 .llong msk; \
452 .llong val; \
453 .llong 98b; \
454 .llong 99b; \
455 .previous
456#endif /* __powerpc64__ */
457 444
458#define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk)) 445#define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk))
459#define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0) 446#define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0)
diff --git a/include/asm-powerpc/current.h b/include/asm-powerpc/current.h
index 1938d6abd255..b8708aedf925 100644
--- a/include/asm-powerpc/current.h
+++ b/include/asm-powerpc/current.h
@@ -14,7 +14,17 @@ struct task_struct;
14#ifdef __powerpc64__ 14#ifdef __powerpc64__
15#include <asm/paca.h> 15#include <asm/paca.h>
16 16
17#define current (get_paca()->__current) 17static inline struct task_struct *get_current(void)
18{
19 struct task_struct *task;
20
21 __asm__ __volatile__("ld %0,%1(13)"
22 : "=r" (task)
23 : "i" (offsetof(struct paca_struct, __current)));
24
25 return task;
26}
27#define current get_current()
18 28
19#else 29#else
20 30
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h
index 1022737f4f34..fdf9aff71150 100644
--- a/include/asm-powerpc/firmware.h
+++ b/include/asm-powerpc/firmware.h
@@ -96,19 +96,16 @@ extern void machine_check_fwnmi(void);
96/* This is true if we are using the firmware NMI handler (typically LPAR) */ 96/* This is true if we are using the firmware NMI handler (typically LPAR) */
97extern int fwnmi_active; 97extern int fwnmi_active;
98 98
99#else /* __ASSEMBLY__ */ 99extern unsigned int __start___fw_ftr_fixup, __stop___fw_ftr_fixup;
100 100
101#define BEGIN_FW_FTR_SECTION 96: 101#else /* __ASSEMBLY__ */
102 102
103#define BEGIN_FW_FTR_SECTION_NESTED(label) label:
104#define BEGIN_FW_FTR_SECTION BEGIN_FW_FTR_SECTION_NESTED(97)
105#define END_FW_FTR_SECTION_NESTED(msk, val, label) \
106 MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup)
103#define END_FW_FTR_SECTION(msk, val) \ 107#define END_FW_FTR_SECTION(msk, val) \
10497: \ 108 END_FW_FTR_SECTION_NESTED(msk, val, 97)
105 .section __fw_ftr_fixup,"a"; \
106 .align 3; \
107 .llong msk; \
108 .llong val; \
109 .llong 96b; \
110 .llong 97b; \
111 .previous
112 109
113#define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk)) 110#define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk))
114#define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0) 111#define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0)
diff --git a/include/asm-powerpc/i8259.h b/include/asm-powerpc/i8259.h
index 78489fb8d140..db1362f8c603 100644
--- a/include/asm-powerpc/i8259.h
+++ b/include/asm-powerpc/i8259.h
@@ -7,6 +7,7 @@
7#ifdef CONFIG_PPC_MERGE 7#ifdef CONFIG_PPC_MERGE
8extern void i8259_init(struct device_node *node, unsigned long intack_addr); 8extern void i8259_init(struct device_node *node, unsigned long intack_addr);
9extern unsigned int i8259_irq(void); 9extern unsigned int i8259_irq(void);
10extern struct irq_host *i8259_get_host(void);
10#else 11#else
11extern void i8259_init(unsigned long intack_addr, int offset); 12extern void i8259_init(unsigned long intack_addr, int offset);
12extern int i8259_irq(void); 13extern int i8259_irq(void);
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index cbbd8c648df1..c2c5f14b5f5f 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -163,8 +163,11 @@ extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count);
163 163
164static inline void mmiowb(void) 164static inline void mmiowb(void)
165{ 165{
166 __asm__ __volatile__ ("sync" : : : "memory"); 166 unsigned long tmp;
167 get_paca()->io_sync = 0; 167
168 __asm__ __volatile__("sync; li %0,0; stb %0,%1(13)"
169 : "=&r" (tmp) : "i" (offsetof(struct paca_struct, io_sync))
170 : "memory");
168} 171}
169 172
170/* 173/*
@@ -404,32 +407,6 @@ static inline void __out_be64(volatile unsigned long __iomem *addr, unsigned lon
404 407
405#include <asm/eeh.h> 408#include <asm/eeh.h>
406 409
407/**
408 * check_signature - find BIOS signatures
409 * @io_addr: mmio address to check
410 * @signature: signature block
411 * @length: length of signature
412 *
413 * Perform a signature comparison with the mmio address io_addr. This
414 * address should have been obtained by ioremap.
415 * Returns 1 on a match.
416 */
417static inline int check_signature(const volatile void __iomem * io_addr,
418 const unsigned char *signature, int length)
419{
420 int retval = 0;
421 do {
422 if (readb(io_addr) != *signature)
423 goto out;
424 io_addr++;
425 signature++;
426 length--;
427 } while (length);
428 retval = 1;
429out:
430 return retval;
431}
432
433/* Nothing to do */ 410/* Nothing to do */
434 411
435#define dma_cache_inv(_start,_size) do { } while (0) 412#define dma_cache_inv(_start,_size) do { } while (0)
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index a5e98641a2ae..39fad685ffab 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -22,17 +22,35 @@
22#define _ASM_IOMMU_H 22#define _ASM_IOMMU_H
23#ifdef __KERNEL__ 23#ifdef __KERNEL__
24 24
25#include <asm/types.h> 25#include <linux/compiler.h>
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/device.h> 27#include <linux/device.h>
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <asm/types.h>
30#include <asm/bitops.h>
31
32#define IOMMU_PAGE_SHIFT 12
33#define IOMMU_PAGE_SIZE (ASM_CONST(1) << IOMMU_PAGE_SHIFT)
34#define IOMMU_PAGE_MASK (~((1 << IOMMU_PAGE_SHIFT) - 1))
35#define IOMMU_PAGE_ALIGN(addr) _ALIGN_UP(addr, IOMMU_PAGE_SIZE)
36
37#ifndef __ASSEMBLY__
38
39/* Pure 2^n version of get_order */
40static __inline__ __attribute_const__ int get_iommu_order(unsigned long size)
41{
42 return __ilog2((size - 1) >> IOMMU_PAGE_SHIFT) + 1;
43}
44
45#endif /* __ASSEMBLY__ */
46
29 47
30/* 48/*
31 * IOMAP_MAX_ORDER defines the largest contiguous block 49 * IOMAP_MAX_ORDER defines the largest contiguous block
32 * of dma space we can get. IOMAP_MAX_ORDER = 13 50 * of dma space we can get. IOMAP_MAX_ORDER = 13
33 * allows up to 2**12 pages (4096 * 4096) = 16 MB 51 * allows up to 2**12 pages (4096 * 4096) = 16 MB
34 */ 52 */
35#define IOMAP_MAX_ORDER 13 53#define IOMAP_MAX_ORDER 13
36 54
37struct iommu_table { 55struct iommu_table {
38 unsigned long it_busno; /* Bus number this table belongs to */ 56 unsigned long it_busno; /* Bus number this table belongs to */
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 5b33994cd488..07a10e590c1d 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -42,7 +42,7 @@ struct op_powerpc_model {
42 void (*reg_setup) (struct op_counter_config *, 42 void (*reg_setup) (struct op_counter_config *,
43 struct op_system_config *, 43 struct op_system_config *,
44 int num_counters); 44 int num_counters);
45 void (*cpu_setup) (void *); 45 void (*cpu_setup) (struct op_counter_config *);
46 void (*start) (struct op_counter_config *); 46 void (*start) (struct op_counter_config *);
47 void (*stop) (void); 47 void (*stop) (void);
48 void (*handle_interrupt) (struct pt_regs *, 48 void (*handle_interrupt) (struct pt_regs *,
@@ -121,7 +121,90 @@ static inline void ctr_write(unsigned int i, unsigned int val)
121 break; 121 break;
122 } 122 }
123} 123}
124#endif /* !CONFIG_FSL_BOOKE */ 124#else /* CONFIG_FSL_BOOKE */
125static inline u32 get_pmlca(int ctr)
126{
127 u32 pmlca;
128
129 switch (ctr) {
130 case 0:
131 pmlca = mfpmr(PMRN_PMLCA0);
132 break;
133 case 1:
134 pmlca = mfpmr(PMRN_PMLCA1);
135 break;
136 case 2:
137 pmlca = mfpmr(PMRN_PMLCA2);
138 break;
139 case 3:
140 pmlca = mfpmr(PMRN_PMLCA3);
141 break;
142 default:
143 panic("Bad ctr number\n");
144 }
145
146 return pmlca;
147}
148
149static inline void set_pmlca(int ctr, u32 pmlca)
150{
151 switch (ctr) {
152 case 0:
153 mtpmr(PMRN_PMLCA0, pmlca);
154 break;
155 case 1:
156 mtpmr(PMRN_PMLCA1, pmlca);
157 break;
158 case 2:
159 mtpmr(PMRN_PMLCA2, pmlca);
160 break;
161 case 3:
162 mtpmr(PMRN_PMLCA3, pmlca);
163 break;
164 default:
165 panic("Bad ctr number\n");
166 }
167}
168
169static inline unsigned int ctr_read(unsigned int i)
170{
171 switch(i) {
172 case 0:
173 return mfpmr(PMRN_PMC0);
174 case 1:
175 return mfpmr(PMRN_PMC1);
176 case 2:
177 return mfpmr(PMRN_PMC2);
178 case 3:
179 return mfpmr(PMRN_PMC3);
180 default:
181 return 0;
182 }
183}
184
185static inline void ctr_write(unsigned int i, unsigned int val)
186{
187 switch(i) {
188 case 0:
189 mtpmr(PMRN_PMC0, val);
190 break;
191 case 1:
192 mtpmr(PMRN_PMC1, val);
193 break;
194 case 2:
195 mtpmr(PMRN_PMC2, val);
196 break;
197 case 3:
198 mtpmr(PMRN_PMC3, val);
199 break;
200 default:
201 break;
202 }
203}
204
205
206#endif /* CONFIG_FSL_BOOKE */
207
125 208
126extern void op_powerpc_backtrace(struct pt_regs * const regs, unsigned int depth); 209extern void op_powerpc_backtrace(struct pt_regs * const regs, unsigned int depth);
127 210
diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h
index 07d6a4279319..8588be68e0ad 100644
--- a/include/asm-powerpc/pmc.h
+++ b/include/asm-powerpc/pmc.h
@@ -32,18 +32,5 @@ void release_pmc_hardware(void);
32void power4_enable_pmcs(void); 32void power4_enable_pmcs(void);
33#endif 33#endif
34 34
35#ifdef CONFIG_FSL_BOOKE
36void init_pmc_stop(int ctr);
37void set_pmc_event(int ctr, int event);
38void set_pmc_user_kernel(int ctr, int user, int kernel);
39void set_pmc_marked(int ctr, int mark0, int mark1);
40void pmc_start_ctr(int ctr, int enable);
41void pmc_start_ctrs(int enable);
42void pmc_stop_ctrs(void);
43void dump_pmcs(void);
44
45extern struct op_powerpc_model op_model_fsl_booke;
46#endif
47
48#endif /* __KERNEL__ */ 35#endif /* __KERNEL__ */
49#endif /* _POWERPC_PMC_H */ 36#endif /* _POWERPC_PMC_H */
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h
index a940cfe040da..fa083d8e4663 100644
--- a/include/asm-powerpc/ppc_asm.h
+++ b/include/asm-powerpc/ppc_asm.h
@@ -30,9 +30,9 @@ BEGIN_FTR_SECTION; \
30 mfspr ra,SPRN_PURR; /* get processor util. reg */ \ 30 mfspr ra,SPRN_PURR; /* get processor util. reg */ \
31END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ 31END_FTR_SECTION_IFSET(CPU_FTR_PURR); \
32BEGIN_FTR_SECTION; \ 32BEGIN_FTR_SECTION; \
33 mftb ra; /* or get TB if no PURR */ \ 33 MFTB(ra); /* or get TB if no PURR */ \
34END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ 34END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
35 ld rb,PACA_STARTPURR(r13); \ 35 ld rb,PACA_STARTPURR(r13); \
36 std ra,PACA_STARTPURR(r13); \ 36 std ra,PACA_STARTPURR(r13); \
37 subf rb,rb,ra; /* subtract start value */ \ 37 subf rb,rb,ra; /* subtract start value */ \
38 ld ra,PACA_USER_TIME(r13); \ 38 ld ra,PACA_USER_TIME(r13); \
@@ -45,9 +45,9 @@ BEGIN_FTR_SECTION; \
45 mfspr ra,SPRN_PURR; /* get processor util. reg */ \ 45 mfspr ra,SPRN_PURR; /* get processor util. reg */ \
46END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ 46END_FTR_SECTION_IFSET(CPU_FTR_PURR); \
47BEGIN_FTR_SECTION; \ 47BEGIN_FTR_SECTION; \
48 mftb ra; /* or get TB if no PURR */ \ 48 MFTB(ra); /* or get TB if no PURR */ \
49END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ 49END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
50 ld rb,PACA_STARTPURR(r13); \ 50 ld rb,PACA_STARTPURR(r13); \
51 std ra,PACA_STARTPURR(r13); \ 51 std ra,PACA_STARTPURR(r13); \
52 subf rb,rb,ra; /* subtract start value */ \ 52 subf rb,rb,ra; /* subtract start value */ \
53 ld ra,PACA_SYSTEM_TIME(r13); \ 53 ld ra,PACA_SYSTEM_TIME(r13); \
@@ -274,6 +274,16 @@ END_FTR_SECTION_IFSET(CPU_FTR_601)
274#define ISYNC_601 274#define ISYNC_601
275#endif 275#endif
276 276
277#ifdef CONFIG_PPC_CELL
278#define MFTB(dest) \
27990: mftb dest; \
280BEGIN_FTR_SECTION_NESTED(96); \
281 cmpwi dest,0; \
282 beq- 90b; \
283END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96)
284#else
285#define MFTB(dest) mftb dest
286#endif
277 287
278#ifndef CONFIG_SMP 288#ifndef CONFIG_SMP
279#define TLBSYNC 289#define TLBSYNC
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 524629769336..ec11d44eaeb5 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -134,7 +134,7 @@ extern struct device_node *of_find_all_nodes(struct device_node *prev);
134extern struct device_node *of_get_parent(const struct device_node *node); 134extern struct device_node *of_get_parent(const struct device_node *node);
135extern struct device_node *of_get_next_child(const struct device_node *node, 135extern struct device_node *of_get_next_child(const struct device_node *node,
136 struct device_node *prev); 136 struct device_node *prev);
137extern struct property *of_find_property(struct device_node *np, 137extern struct property *of_find_property(const struct device_node *np,
138 const char *name, 138 const char *name,
139 int *lenp); 139 int *lenp);
140extern struct device_node *of_node_get(struct device_node *node); 140extern struct device_node *of_node_get(struct device_node *node);
@@ -158,10 +158,12 @@ extern void of_detach_node(const struct device_node *);
158extern void finish_device_tree(void); 158extern void finish_device_tree(void);
159extern void unflatten_device_tree(void); 159extern void unflatten_device_tree(void);
160extern void early_init_devtree(void *); 160extern void early_init_devtree(void *);
161extern int device_is_compatible(struct device_node *device, const char *); 161extern int device_is_compatible(const struct device_node *device,
162 const char *);
162extern int machine_is_compatible(const char *compat); 163extern int machine_is_compatible(const char *compat);
163extern const void *get_property(struct device_node *node, const char *name, 164extern const void *get_property(const struct device_node *node,
164 int *lenp); 165 const char *name,
166 int *lenp);
165extern void print_properties(struct device_node *node); 167extern void print_properties(struct device_node *node);
166extern int prom_n_addr_cells(struct device_node* np); 168extern int prom_n_addr_cells(struct device_node* np);
167extern int prom_n_size_cells(struct device_node* np); 169extern int prom_n_size_cells(struct device_node* np);
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index 8fb96811b55d..6faae7b14d55 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -591,6 +591,7 @@
591#define PV_630 0x0040 591#define PV_630 0x0040
592#define PV_630p 0x0041 592#define PV_630p 0x0041
593#define PV_970MP 0x0044 593#define PV_970MP 0x0044
594#define PV_970GX 0x0045
594#define PV_BE 0x0070 595#define PV_BE 0x0070
595#define PV_PA6T 0x0090 596#define PV_PA6T 0x0090
596 597
@@ -618,10 +619,35 @@
618 : "=r" (rval)); rval;}) 619 : "=r" (rval)); rval;})
619#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v)) 620#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v))
620 621
622#ifdef __powerpc64__
623#ifdef CONFIG_PPC_CELL
624#define mftb() ({unsigned long rval; \
625 asm volatile( \
626 "90: mftb %0;\n" \
627 "97: cmpwi %0,0;\n" \
628 " beq- 90b;\n" \
629 "99:\n" \
630 ".section __ftr_fixup,\"a\"\n" \
631 ".align 3\n" \
632 "98:\n" \
633 " .llong %1\n" \
634 " .llong %1\n" \
635 " .llong 97b-98b\n" \
636 " .llong 99b-98b\n" \
637 ".previous" \
638 : "=r" (rval) : "i" (CPU_FTR_CELL_TB_BUG)); rval;})
639#else
621#define mftb() ({unsigned long rval; \ 640#define mftb() ({unsigned long rval; \
622 asm volatile("mftb %0" : "=r" (rval)); rval;}) 641 asm volatile("mftb %0" : "=r" (rval)); rval;})
642#endif /* !CONFIG_PPC_CELL */
643
644#else /* __powerpc64__ */
645
623#define mftbl() ({unsigned long rval; \ 646#define mftbl() ({unsigned long rval; \
624 asm volatile("mftbl %0" : "=r" (rval)); rval;}) 647 asm volatile("mftbl %0" : "=r" (rval)); rval;})
648#define mftbu() ({unsigned long rval; \
649 asm volatile("mftbu %0" : "=r" (rval)); rval;})
650#endif /* !__powerpc64__ */
625 651
626#define mttbl(v) asm volatile("mttbl %0":: "r"(v)) 652#define mttbl(v) asm volatile("mttbl %0":: "r"(v))
627#define mttbu(v) asm volatile("mttbu %0":: "r"(v)) 653#define mttbu(v) asm volatile("mttbu %0":: "r"(v))
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index eac85ce101b6..97b435484177 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -261,7 +261,7 @@ SYSX(sys_ni_syscall, ppc_fadvise64_64, ppc_fadvise64_64)
261PPC_SYS_SPU(rtas) 261PPC_SYS_SPU(rtas)
262OLDSYS(debug_setcontext) 262OLDSYS(debug_setcontext)
263SYSCALL(ni_syscall) 263SYSCALL(ni_syscall)
264SYSCALL(ni_syscall) 264COMPAT_SYS(migrate_pages)
265COMPAT_SYS(mbind) 265COMPAT_SYS(mbind)
266COMPAT_SYS(get_mempolicy) 266COMPAT_SYS(get_mempolicy)
267COMPAT_SYS(set_mempolicy) 267COMPAT_SYS(set_mempolicy)
@@ -304,3 +304,4 @@ SYSCALL_SPU(fchmodat)
304SYSCALL_SPU(faccessat) 304SYSCALL_SPU(faccessat)
305COMPAT_SYS_SPU(get_robust_list) 305COMPAT_SYS_SPU(get_robust_list)
306COMPAT_SYS_SPU(set_robust_list) 306COMPAT_SYS_SPU(set_robust_list)
307COMPAT_SYS(move_pages)
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 43627596003b..f7b1227d6454 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -25,8 +25,8 @@
25 * 25 *
26 * We have to use the sync instructions for mb(), since lwsync doesn't 26 * We have to use the sync instructions for mb(), since lwsync doesn't
27 * order loads with respect to previous stores. Lwsync is fine for 27 * order loads with respect to previous stores. Lwsync is fine for
28 * rmb(), though. Note that lwsync is interpreted as sync by 28 * rmb(), though. Note that rmb() actually uses a sync on 32-bit
29 * 32-bit and older 64-bit CPUs. 29 * architectures.
30 * 30 *
31 * For wmb(), we use sync since wmb is used in drivers to order 31 * For wmb(), we use sync since wmb is used in drivers to order
32 * stores to system memory with respect to writes to the device. 32 * stores to system memory with respect to writes to the device.
@@ -34,7 +34,7 @@
34 * SMP since it is only used to order updates to system memory. 34 * SMP since it is only used to order updates to system memory.
35 */ 35 */
36#define mb() __asm__ __volatile__ ("sync" : : : "memory") 36#define mb() __asm__ __volatile__ ("sync" : : : "memory")
37#define rmb() __asm__ __volatile__ ("lwsync" : : : "memory") 37#define rmb() __asm__ __volatile__ (__stringify(LWSYNC) : : : "memory")
38#define wmb() __asm__ __volatile__ ("sync" : : : "memory") 38#define wmb() __asm__ __volatile__ ("sync" : : : "memory")
39#define read_barrier_depends() do { } while(0) 39#define read_barrier_depends() do { } while(0)
40 40
diff --git a/include/asm-powerpc/tce.h b/include/asm-powerpc/tce.h
index c9483adbf599..f663634cccc9 100644
--- a/include/asm-powerpc/tce.h
+++ b/include/asm-powerpc/tce.h
@@ -22,6 +22,8 @@
22#define _ASM_POWERPC_TCE_H 22#define _ASM_POWERPC_TCE_H
23#ifdef __KERNEL__ 23#ifdef __KERNEL__
24 24
25#include <asm/iommu.h>
26
25/* 27/*
26 * Tces come in two formats, one for the virtual bus and a different 28 * Tces come in two formats, one for the virtual bus and a different
27 * format for PCI 29 * format for PCI
@@ -33,7 +35,6 @@
33 35
34#define TCE_SHIFT 12 36#define TCE_SHIFT 12
35#define TCE_PAGE_SIZE (1 << TCE_SHIFT) 37#define TCE_PAGE_SIZE (1 << TCE_SHIFT)
36#define TCE_PAGE_FACTOR (PAGE_SHIFT - TCE_SHIFT)
37 38
38#define TCE_ENTRY_SIZE 8 /* each TCE is 64 bits */ 39#define TCE_ENTRY_SIZE 8 /* each TCE is 64 bits */
39 40
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index b051d4c88c3b..4cff977ad526 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -39,10 +39,6 @@ extern void generic_calibrate_decr(void);
39extern void wakeup_decrementer(void); 39extern void wakeup_decrementer(void);
40extern void snapshot_timebase(void); 40extern void snapshot_timebase(void);
41 41
42#ifdef CONFIG_RTC_CLASS
43extern int __init rtc_class_hookup(void);
44#endif
45
46/* Some sane defaults: 125 MHz timebase, 1GHz processor */ 42/* Some sane defaults: 125 MHz timebase, 1GHz processor */
47extern unsigned long ppc_proc_freq; 43extern unsigned long ppc_proc_freq;
48#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) 44#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8)
@@ -82,30 +78,35 @@ struct div_result {
82#define __USE_RTC() 0 78#define __USE_RTC() 0
83#endif 79#endif
84 80
85/* On ppc64 this gets us the whole timebase; on ppc32 just the lower half */ 81#ifdef CONFIG_PPC64
82
83/* For compatibility, get_tbl() is defined as get_tb() on ppc64 */
84#define get_tbl get_tb
85
86#else
87
86static inline unsigned long get_tbl(void) 88static inline unsigned long get_tbl(void)
87{ 89{
88 unsigned long tbl;
89
90#if defined(CONFIG_403GCX) 90#if defined(CONFIG_403GCX)
91 unsigned long tbl;
91 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl)); 92 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
93 return tbl;
92#else 94#else
93 asm volatile("mftb %0" : "=r" (tbl)); 95 return mftbl();
94#endif 96#endif
95 return tbl;
96} 97}
97 98
98static inline unsigned int get_tbu(void) 99static inline unsigned int get_tbu(void)
99{ 100{
101#ifdef CONFIG_403GCX
100 unsigned int tbu; 102 unsigned int tbu;
101
102#if defined(CONFIG_403GCX)
103 asm volatile("mfspr %0, 0x3dc" : "=r" (tbu)); 103 asm volatile("mfspr %0, 0x3dc" : "=r" (tbu));
104 return tbu;
104#else 105#else
105 asm volatile("mftbu %0" : "=r" (tbu)); 106 return mftbu();
106#endif 107#endif
107 return tbu;
108} 108}
109#endif /* !CONFIG_PPC64 */
109 110
110static inline unsigned int get_rtcl(void) 111static inline unsigned int get_rtcl(void)
111{ 112{
@@ -131,7 +132,7 @@ static inline u64 get_tb(void)
131{ 132{
132 return mftb(); 133 return mftb();
133} 134}
134#else 135#else /* CONFIG_PPC64 */
135static inline u64 get_tb(void) 136static inline u64 get_tb(void)
136{ 137{
137 unsigned int tbhi, tblo, tbhi2; 138 unsigned int tbhi, tblo, tbhi2;
@@ -144,7 +145,7 @@ static inline u64 get_tb(void)
144 145
145 return ((u64)tbhi << 32) | tblo; 146 return ((u64)tbhi << 32) | tblo;
146} 147}
147#endif 148#endif /* !CONFIG_PPC64 */
148 149
149static inline void set_tb(unsigned int upper, unsigned int lower) 150static inline void set_tb(unsigned int upper, unsigned int lower)
150{ 151{
diff --git a/include/asm-powerpc/timex.h b/include/asm-powerpc/timex.h
index 3b9a8e786806..92dedde761d1 100644
--- a/include/asm-powerpc/timex.h
+++ b/include/asm-powerpc/timex.h
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <asm/cputable.h> 10#include <asm/cputable.h>
11#include <asm/reg.h>
11 12
12#define CLOCK_TICK_RATE 1024000 /* Underlying HZ */ 13#define CLOCK_TICK_RATE 1024000 /* Underlying HZ */
13 14
@@ -15,13 +16,11 @@ typedef unsigned long cycles_t;
15 16
16static inline cycles_t get_cycles(void) 17static inline cycles_t get_cycles(void)
17{ 18{
18 cycles_t ret;
19
20#ifdef __powerpc64__ 19#ifdef __powerpc64__
21 20 return mftb();
22 __asm__ __volatile__("mftb %0" : "=r" (ret) : );
23
24#else 21#else
22 cycles_t ret;
23
25 /* 24 /*
26 * For the "cycle" counter we use the timebase lower half. 25 * For the "cycle" counter we use the timebase lower half.
27 * Currently only used on SMP. 26 * Currently only used on SMP.
@@ -30,18 +29,19 @@ static inline cycles_t get_cycles(void)
30 ret = 0; 29 ret = 0;
31 30
32 __asm__ __volatile__( 31 __asm__ __volatile__(
33 "98: mftb %0\n" 32 "97: mftb %0\n"
34 "99:\n" 33 "99:\n"
35 ".section __ftr_fixup,\"a\"\n" 34 ".section __ftr_fixup,\"a\"\n"
35 ".align 2\n"
36 "98:\n"
36 " .long %1\n" 37 " .long %1\n"
37 " .long 0\n" 38 " .long 0\n"
38 " .long 98b\n" 39 " .long 97b-98b\n"
39 " .long 99b\n" 40 " .long 99b-98b\n"
40 ".previous" 41 ".previous"
41 : "=r" (ret) : "i" (CPU_FTR_601)); 42 : "=r" (ret) : "i" (CPU_FTR_601));
42#endif
43
44 return ret; 43 return ret;
44#endif
45} 45}
46 46
47#endif /* __KERNEL__ */ 47#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index 8f7ee16781a4..9fe7894ee035 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -96,7 +96,13 @@ static inline void sysfs_remove_device_from_node(struct sys_device *dev,
96 96
97#ifdef CONFIG_SMP 97#ifdef CONFIG_SMP
98#include <asm/cputable.h> 98#include <asm/cputable.h>
99#define smt_capable() (cpu_has_feature(CPU_FTR_SMT)) 99#define smt_capable() (cpu_has_feature(CPU_FTR_SMT))
100
101#ifdef CONFIG_PPC64
102#include <asm/smp.h>
103
104#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
105#endif
100#endif 106#endif
101 107
102#endif /* __KERNEL__ */ 108#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index 464a48cce7f5..0e4ea37f6466 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -276,7 +276,7 @@
276#define __NR_rtas 255 276#define __NR_rtas 255
277#define __NR_sys_debug_setcontext 256 277#define __NR_sys_debug_setcontext 256
278/* Number 257 is reserved for vserver */ 278/* Number 257 is reserved for vserver */
279/* 258 currently unused */ 279#define __NR_migrate_pages 258
280#define __NR_mbind 259 280#define __NR_mbind 259
281#define __NR_get_mempolicy 260 281#define __NR_get_mempolicy 260
282#define __NR_set_mempolicy 261 282#define __NR_set_mempolicy 261
@@ -323,10 +323,11 @@
323#define __NR_faccessat 298 323#define __NR_faccessat 298
324#define __NR_get_robust_list 299 324#define __NR_get_robust_list 299
325#define __NR_set_robust_list 300 325#define __NR_set_robust_list 300
326#define __NR_move_pages 301
326 327
327#ifdef __KERNEL__ 328#ifdef __KERNEL__
328 329
329#define __NR_syscalls 301 330#define __NR_syscalls 302
330 331
331#define __NR__exit __NR_exit 332#define __NR__exit __NR_exit
332#define NR_syscalls __NR_syscalls 333#define NR_syscalls __NR_syscalls
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 3d9a9e6f3321..a4c411b753ef 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -439,22 +439,6 @@ extern inline void * phys_to_virt(unsigned long address)
439#define iobarrier_r() eieio() 439#define iobarrier_r() eieio()
440#define iobarrier_w() eieio() 440#define iobarrier_w() eieio()
441 441
442static inline int check_signature(volatile void __iomem * io_addr,
443 const unsigned char *signature, int length)
444{
445 int retval = 0;
446 do {
447 if (readb(io_addr) != *signature)
448 goto out;
449 io_addr++;
450 signature++;
451 length--;
452 } while (length);
453 retval = 1;
454out:
455 return retval;
456}
457
458/* 442/*
459 * Here comes the ppc implementation of the IOMAP 443 * Here comes the ppc implementation of the IOMAP
460 * interfaces. 444 * interfaces.
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h
index da063cd5f0a0..81287d86329d 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -275,6 +275,12 @@ struct ccw_dev_id {
275 u16 devno; 275 u16 devno;
276}; 276};
277 277
278static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
279 struct ccw_dev_id *dev_id2)
280{
281 return !memcmp(dev_id1, dev_id2, sizeof(struct ccw_dev_id));
282}
283
278extern int diag210(struct diag210 *addr); 284extern int diag210(struct diag210 *addr);
279 285
280extern void wait_cons_dev(void); 286extern void wait_cons_dev(void);
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 519f0a5ff181..36bb6dacf008 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -200,18 +200,45 @@ extern char empty_zero_page[PAGE_SIZE];
200 */ 200 */
201 201
202/* Hardware bits in the page table entry */ 202/* Hardware bits in the page table entry */
203#define _PAGE_RO 0x200 /* HW read-only */ 203#define _PAGE_RO 0x200 /* HW read-only bit */
204#define _PAGE_INVALID 0x400 /* HW invalid */ 204#define _PAGE_INVALID 0x400 /* HW invalid bit */
205#define _PAGE_SWT 0x001 /* SW pte type bit t */
206#define _PAGE_SWX 0x002 /* SW pte type bit x */
205 207
206/* Mask and six different types of pages. */ 208/* Six different types of pages. */
207#define _PAGE_TYPE_MASK 0x601
208#define _PAGE_TYPE_EMPTY 0x400 209#define _PAGE_TYPE_EMPTY 0x400
209#define _PAGE_TYPE_NONE 0x401 210#define _PAGE_TYPE_NONE 0x401
210#define _PAGE_TYPE_SWAP 0x600 211#define _PAGE_TYPE_SWAP 0x403
211#define _PAGE_TYPE_FILE 0x601 212#define _PAGE_TYPE_FILE 0x601 /* bit 0x002 is used for offset !! */
212#define _PAGE_TYPE_RO 0x200 213#define _PAGE_TYPE_RO 0x200
213#define _PAGE_TYPE_RW 0x000 214#define _PAGE_TYPE_RW 0x000
214 215
216/*
217 * PTE type bits are rather complicated. handle_pte_fault uses pte_present,
218 * pte_none and pte_file to find out the pte type WITHOUT holding the page
219 * table lock. ptep_clear_flush on the other hand uses ptep_clear_flush to
220 * invalidate a given pte. ipte sets the hw invalid bit and clears all tlbs
221 * for the page. The page table entry is set to _PAGE_TYPE_EMPTY afterwards.
222 * This change is done while holding the lock, but the intermediate step
223 * of a previously valid pte with the hw invalid bit set can be observed by
224 * handle_pte_fault. That makes it necessary that all valid pte types with
225 * the hw invalid bit set must be distinguishable from the four pte types
226 * empty, none, swap and file.
227 *
228 * irxt ipte irxt
229 * _PAGE_TYPE_EMPTY 1000 -> 1000
230 * _PAGE_TYPE_NONE 1001 -> 1001
231 * _PAGE_TYPE_SWAP 1011 -> 1011
232 * _PAGE_TYPE_FILE 11?1 -> 11?1
233 * _PAGE_TYPE_RO 0100 -> 1100
234 * _PAGE_TYPE_RW 0000 -> 1000
235 *
236 * pte_none is true for bits combinations 1000, 1100
237 * pte_present is true for bits combinations 0000, 0010, 0100, 0110, 1001
238 * pte_file is true for bits combinations 1101, 1111
239 * swap pte is 1011 and 0001, 0011, 0101, 0111, 1010 and 1110 are invalid.
240 */
241
215#ifndef __s390x__ 242#ifndef __s390x__
216 243
217/* Bits in the segment table entry */ 244/* Bits in the segment table entry */
@@ -365,18 +392,21 @@ static inline int pmd_bad(pmd_t pmd)
365 392
366static inline int pte_none(pte_t pte) 393static inline int pte_none(pte_t pte)
367{ 394{
368 return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_EMPTY; 395 return (pte_val(pte) & _PAGE_INVALID) && !(pte_val(pte) & _PAGE_SWT);
369} 396}
370 397
371static inline int pte_present(pte_t pte) 398static inline int pte_present(pte_t pte)
372{ 399{
373 return !(pte_val(pte) & _PAGE_INVALID) || 400 unsigned long mask = _PAGE_RO | _PAGE_INVALID | _PAGE_SWT | _PAGE_SWX;
374 (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_NONE; 401 return (pte_val(pte) & mask) == _PAGE_TYPE_NONE ||
402 (!(pte_val(pte) & _PAGE_INVALID) &&
403 !(pte_val(pte) & _PAGE_SWT));
375} 404}
376 405
377static inline int pte_file(pte_t pte) 406static inline int pte_file(pte_t pte)
378{ 407{
379 return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_FILE; 408 unsigned long mask = _PAGE_RO | _PAGE_INVALID | _PAGE_SWT;
409 return (pte_val(pte) & mask) == _PAGE_TYPE_FILE;
380} 410}
381 411
382#define pte_same(a,b) (pte_val(a) == pte_val(b)) 412#define pte_same(a,b) (pte_val(a) == pte_val(b))
diff --git a/include/asm-s390/timer.h b/include/asm-s390/timer.h
index fcd6c256a2d1..30e5cbe570f2 100644
--- a/include/asm-s390/timer.h
+++ b/include/asm-s390/timer.h
@@ -26,7 +26,7 @@ struct vtimer_list {
26 spinlock_t lock; 26 spinlock_t lock;
27 unsigned long magic; 27 unsigned long magic;
28 28
29 void (*function)(unsigned long, struct pt_regs*); 29 void (*function)(unsigned long);
30 unsigned long data; 30 unsigned long data;
31}; 31};
32 32
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index a19238cbcffa..71d3c21b84f0 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -249,8 +249,9 @@
249#define __NR_vmsplice 309 249#define __NR_vmsplice 309
250/* Number 310 is reserved for new sys_move_pages */ 250/* Number 310 is reserved for new sys_move_pages */
251#define __NR_getcpu 311 251#define __NR_getcpu 311
252#define __NR_epoll_pwait 312
252 253
253#define NR_syscalls 312 254#define NR_syscalls 313
254 255
255/* 256/*
256 * There are some system calls that are not present on 64 bit, some 257 * There are some system calls that are not present on 64 bit, some
diff --git a/include/asm-sh/cpu-sh4/ubc.h b/include/asm-sh/cpu-sh4/ubc.h
index 3d0943167659..c86e17050935 100644
--- a/include/asm-sh/cpu-sh4/ubc.h
+++ b/include/asm-sh/cpu-sh4/ubc.h
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 1999 Niibe Yutaka 4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2003 Paul Mundt 5 * Copyright (C) 2003 Paul Mundt
6 * Copyright (C) 2006 Lineo Solutions Inc. support SH4A UBC
6 * 7 *
7 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -11,6 +12,41 @@
11#ifndef __ASM_CPU_SH4_UBC_H 12#ifndef __ASM_CPU_SH4_UBC_H
12#define __ASM_CPU_SH4_UBC_H 13#define __ASM_CPU_SH4_UBC_H
13 14
15#if defined(CONFIG_CPU_SH4A)
16#define UBC_CBR0 0xff200000
17#define UBC_CRR0 0xff200004
18#define UBC_CAR0 0xff200008
19#define UBC_CAMR0 0xff20000c
20#define UBC_CBR1 0xff200020
21#define UBC_CRR1 0xff200024
22#define UBC_CAR1 0xff200028
23#define UBC_CAMR1 0xff20002c
24#define UBC_CDR1 0xff200030
25#define UBC_CDMR1 0xff200034
26#define UBC_CETR1 0xff200038
27#define UBC_CCMFR 0xff200600
28#define UBC_CBCR 0xff200620
29
30/* CBR */
31#define UBC_CBR_AIE (0x01<<30)
32#define UBC_CBR_ID_INST (0x01<<4)
33#define UBC_CBR_RW_READ (0x01<<1)
34#define UBC_CBR_CE (0x01)
35
36#define UBC_CBR_AIV_MASK (0x00FF0000)
37#define UBC_CBR_AIV_SHIFT (16)
38#define UBC_CBR_AIV_SET(asid) (((asid)<<UBC_CBR_AIV_SHIFT) & UBC_CBR_AIV_MASK)
39
40#define UBC_CBR_INIT 0x20000000
41
42/* CRR */
43#define UBC_CRR_RES (0x01<<13)
44#define UBC_CRR_PCB (0x01<<1)
45#define UBC_CRR_BIE (0x01)
46
47#define UBC_CRR_INIT 0x00002000
48
49#else /* CONFIG_CPU_SH4 */
14#define UBC_BARA 0xff200000 50#define UBC_BARA 0xff200000
15#define UBC_BAMRA 0xff200004 51#define UBC_BAMRA 0xff200004
16#define UBC_BBRA 0xff200008 52#define UBC_BBRA 0xff200008
@@ -22,6 +58,7 @@
22#define UBC_BDRB 0xff200018 58#define UBC_BDRB 0xff200018
23#define UBC_BDMRB 0xff20001c 59#define UBC_BDMRB 0xff20001c
24#define UBC_BRCR 0xff200020 60#define UBC_BRCR 0xff200020
61#endif /* CONFIG_CPU_SH4 */
25 62
26#endif /* __ASM_CPU_SH4_UBC_H */ 63#endif /* __ASM_CPU_SH4_UBC_H */
27 64
diff --git a/include/asm-sh/edosk7705/io.h b/include/asm-sh/edosk7705.h
index a1089a65bc36..a1089a65bc36 100644
--- a/include/asm-sh/edosk7705/io.h
+++ b/include/asm-sh/edosk7705.h
diff --git a/include/asm-sh/hp6xx/hp6xx.h b/include/asm-sh/hp6xx.h
index f35134c159dd..f35134c159dd 100644
--- a/include/asm-sh/hp6xx/hp6xx.h
+++ b/include/asm-sh/hp6xx.h
diff --git a/include/asm-sh/hp6xx/ide.h b/include/asm-sh/hp6xx/ide.h
deleted file mode 100644
index 570395a5ebe5..000000000000
--- a/include/asm-sh/hp6xx/ide.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_SH_HP6XX_IDE_H
2#define __ASM_SH_HP6XX_IDE_H
3
4#define IRQ_CFCARD 93
5#define IRQ_PCMCIA 94
6
7#endif /* __ASM_SH_HP6XX_IDE_H */
8
diff --git a/include/asm-sh/hp6xx/io.h b/include/asm-sh/hp6xx/io.h
deleted file mode 100644
index 2044476ab199..000000000000
--- a/include/asm-sh/hp6xx/io.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __ASM_SH_HP6XX_IO_H
2#define __ASM_SH_HP6XX_IO_H
3
4/*
5 * Nothing special here.. just use the generic cchip io routines.
6 */
7#include <asm/hd64461.h>
8
9#endif /* __ASM_SH_HP6XX_IO_H */
10
diff --git a/include/asm-sh/hs7751rvoip/hs7751rvoip.h b/include/asm-sh/hs7751rvoip.h
index c4cff9d33927..c4cff9d33927 100644
--- a/include/asm-sh/hs7751rvoip/hs7751rvoip.h
+++ b/include/asm-sh/hs7751rvoip.h
diff --git a/include/asm-sh/hs7751rvoip/ide.h b/include/asm-sh/hs7751rvoip/ide.h
deleted file mode 100644
index 65ad1d0f763b..000000000000
--- a/include/asm-sh/hs7751rvoip/ide.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_SH_HS7751RVOIP_IDE_H
2#define __ASM_SH_HS7751RVOIP_IDE_H
3
4/* Nothing to see here.. */
5#include <asm/hs7751rvoip/hs7751rvoip.h>
6
7#endif /* __ASM_SH_HS7751RVOIP_IDE_H */
8
diff --git a/include/asm-sh/hw_irq.h b/include/asm-sh/hw_irq.h
index fed26616967a..80ee1cda7498 100644
--- a/include/asm-sh/hw_irq.h
+++ b/include/asm-sh/hw_irq.h
@@ -1,4 +1,8 @@
1#ifndef __ASM_SH_HW_IRQ_H 1#ifndef __ASM_SH_HW_IRQ_H
2#define __ASM_SH_HW_IRQ_H 2#define __ASM_SH_HW_IRQ_H
3 3
4#include <asm/atomic.h>
5
6extern atomic_t irq_err_count;
7
4#endif /* __ASM_SH_HW_IRQ_H */ 8#endif /* __ASM_SH_HW_IRQ_H */
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index ed12d38e8c00..a0e55b09e4fd 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -304,22 +304,6 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
304#define iounmap(addr) \ 304#define iounmap(addr) \
305 __iounmap((addr)) 305 __iounmap((addr))
306 306
307static inline int check_signature(char __iomem *io_addr,
308 const unsigned char *signature, int length)
309{
310 int retval = 0;
311 do {
312 if (readb(io_addr) != *signature)
313 goto out;
314 io_addr++;
315 signature++;
316 length--;
317 } while (length);
318 retval = 1;
319out:
320 return retval;
321}
322
323/* 307/*
324 * The caches on some architectures aren't dma-coherent and have need to 308 * The caches on some architectures aren't dma-coherent and have need to
325 * handle this in software. There are three types of operations that 309 * handle this in software. There are three types of operations that
diff --git a/include/asm-sh/irq-sh7780.h b/include/asm-sh/irq-sh7780.h
index 895c5780e454..19912ae6a7f7 100644
--- a/include/asm-sh/irq-sh7780.h
+++ b/include/asm-sh/irq-sh7780.h
@@ -6,16 +6,6 @@
6 * 6 *
7 * Copyright (C) 2004 Takashi SHUDO <shudo@hitachi-ul.co.jp> 7 * Copyright (C) 2004 Takashi SHUDO <shudo@hitachi-ul.co.jp>
8 */ 8 */
9
10#ifdef CONFIG_IDE
11# ifndef IRQ_CFCARD
12# define IRQ_CFCARD 14
13# endif
14# ifndef IRQ_PCMCIA
15# define IRQ_PCMCIA 15
16# endif
17#endif
18
19#define INTC_BASE 0xffd00000 9#define INTC_BASE 0xffd00000
20#define INTC_ICR0 (INTC_BASE+0x0) 10#define INTC_ICR0 (INTC_BASE+0x0)
21#define INTC_ICR1 (INTC_BASE+0x1c) 11#define INTC_ICR1 (INTC_BASE+0x1c)
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
index 0e5f365aff70..6cd3e9e2a76a 100644
--- a/include/asm-sh/irq.h
+++ b/include/asm-sh/irq.h
@@ -14,16 +14,6 @@
14#include <asm/machvec.h> 14#include <asm/machvec.h>
15#include <asm/ptrace.h> /* for pt_regs */ 15#include <asm/ptrace.h> /* for pt_regs */
16 16
17#if defined(CONFIG_SH_HP6XX) || \
18 defined(CONFIG_SH_RTS7751R2D) || \
19 defined(CONFIG_SH_HS7751RVOIP) || \
20 defined(CONFIG_SH_HS7751RVOIP) || \
21 defined(CONFIG_SH_SH03) || \
22 defined(CONFIG_SH_R7780RP) || \
23 defined(CONFIG_SH_LANDISK)
24#include <asm/mach/ide.h>
25#endif
26
27#ifndef CONFIG_CPU_SUBTYPE_SH7780 17#ifndef CONFIG_CPU_SUBTYPE_SH7780
28 18
29#define INTC_DMAC0_MSK 0 19#define INTC_DMAC0_MSK 0
@@ -38,15 +28,6 @@
38#define INTC_IPRD 0xffd00010UL 28#define INTC_IPRD 0xffd00010UL
39#endif 29#endif
40 30
41#ifdef CONFIG_IDE
42# ifndef IRQ_CFCARD
43# define IRQ_CFCARD 14
44# endif
45# ifndef IRQ_PCMCIA
46# define IRQ_PCMCIA 15
47# endif
48#endif
49
50#define TIMER_IRQ 16 31#define TIMER_IRQ 16
51#define TIMER_IPR_ADDR INTC_IPRA 32#define TIMER_IPR_ADDR INTC_IPRA
52#define TIMER_IPR_POS 3 33#define TIMER_IPR_POS 3
@@ -346,11 +327,17 @@ extern unsigned short *irq_mask_register;
346 */ 327 */
347void init_IRQ_pint(void); 328void init_IRQ_pint(void);
348 329
330struct ipr_data {
331 unsigned int irq;
332 unsigned int addr; /* Address of Interrupt Priority Register */
333 int shift; /* Shifts of the 16-bit data */
334 int priority; /* The priority */
335};
336
349/* 337/*
350 * Function for "on chip support modules". 338 * Function for "on chip support modules".
351 */ 339 */
352extern void make_ipr_irq(unsigned int irq, unsigned int addr, 340extern void make_ipr_irq(struct ipr_data *table, unsigned int nr_irqs);
353 int pos, int priority);
354extern void make_imask_irq(unsigned int irq); 341extern void make_imask_irq(unsigned int irq);
355 342
356#if defined(CONFIG_CPU_SUBTYPE_SH7300) 343#if defined(CONFIG_CPU_SUBTYPE_SH7300)
@@ -697,13 +684,15 @@ extern int ipr_irq_demux(int irq);
697 684
698#define INTC2_INTPRI_OFFSET 0x00 685#define INTC2_INTPRI_OFFSET 0x00
699 686
700void make_intc2_irq(unsigned int irq, 687struct intc2_data {
701 unsigned int ipr_offset, unsigned int ipr_shift, 688 unsigned short irq;
702 unsigned int msk_offset, unsigned int msk_shift, 689 unsigned char ipr_offset, ipr_shift;
703 unsigned int priority); 690 unsigned char msk_offset, msk_shift;
704void init_IRQ_intc2(void); 691 unsigned char priority;
705void intc2_add_clear_irq(int irq, int (*fn)(int)); 692};
706 693
694void make_intc2_irq(struct intc2_data *, unsigned int nr_irqs);
695void init_IRQ_intc2(void);
707#endif 696#endif
708 697
709extern int shmse_irq_demux(int irq); 698extern int shmse_irq_demux(int irq);
diff --git a/include/asm-sh/irq_regs.h b/include/asm-sh/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/include/asm-sh/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/include/asm-sh/landisk/ide.h b/include/asm-sh/landisk/ide.h
deleted file mode 100644
index 6490e28415ed..000000000000
--- a/include/asm-sh/landisk/ide.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * modifed by kogiidena
3 * 2005.03.03
4 */
5
6#ifndef __ASM_SH_LANDISK_IDE_H
7#define __ASM_SH_LANDISK_IDE_H
8
9/* Nothing to see here.. */
10#include <asm/landisk/iodata_landisk.h>
11#define IRQ_CFCARD IRQ_FATA /* CF Card IRQ */
12#define IRQ_PCMCIA IRQ_ATA /* PCMCIA IRQ */
13
14#endif /* __ASM_SH_LANDISK_IDE_H */
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
index 474773853cd1..45bb74e35d32 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -255,6 +255,8 @@ extern void save_fpu(struct task_struct *__tsk, struct pt_regs *regs);
255 */ 255 */
256#define thread_saved_pc(tsk) (tsk->thread.pc) 256#define thread_saved_pc(tsk) (tsk->thread.pc)
257 257
258void show_trace(struct task_struct *tsk, unsigned long *sp,
259 struct pt_regs *regs);
258extern unsigned long get_wchan(struct task_struct *p); 260extern unsigned long get_wchan(struct task_struct *p);
259 261
260#define KSTK_EIP(tsk) ((tsk)->thread.pc) 262#define KSTK_EIP(tsk) ((tsk)->thread.pc)
diff --git a/include/asm-sh/r7780rp/r7780rp.h b/include/asm-sh/r7780rp.h
index f95d9dba31a2..c18f648a7995 100644
--- a/include/asm-sh/r7780rp/r7780rp.h
+++ b/include/asm-sh/r7780rp.h
@@ -72,8 +72,6 @@
72 72
73#define PA_AX88796L 0xa4100400 /* AX88796L Area */ 73#define PA_AX88796L 0xa4100400 /* AX88796L Area */
74#define PA_SC1602BSLB 0xa6000000 /* SC1602BSLB Area */ 74#define PA_SC1602BSLB 0xa6000000 /* SC1602BSLB Area */
75#define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */
76#define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */
77#define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */ 75#define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */
78#define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */ 76#define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */
79 77
@@ -83,7 +81,6 @@
83#define IRQ_PCISLOT2 66 /* PCI Slot #2 IRQ */ 81#define IRQ_PCISLOT2 66 /* PCI Slot #2 IRQ */
84#define IRQ_PCISLOT3 67 /* PCI Slot #3 IRQ */ 82#define IRQ_PCISLOT3 67 /* PCI Slot #3 IRQ */
85#define IRQ_PCISLOT4 68 /* PCI Slot #4 IRQ */ 83#define IRQ_PCISLOT4 68 /* PCI Slot #4 IRQ */
86#define IRQ_CFCARD 1 /* CF Card IRQ */
87// #define IRQ_CFINST 0 /* CF Card Insert IRQ */ 84// #define IRQ_CFINST 0 /* CF Card Insert IRQ */
88#define IRQ_TP 2 /* Touch Panel IRQ */ 85#define IRQ_TP 2 /* Touch Panel IRQ */
89#define IRQ_SCI1 3 /* SCI1 IRQ */ 86#define IRQ_SCI1 3 /* SCI1 IRQ */
@@ -146,8 +143,6 @@
146 143
147#define PA_AX88796L 0xa5800400 /* AX88796L Area */ 144#define PA_AX88796L 0xa5800400 /* AX88796L Area */
148#define PA_SC1602BSLB 0xa6000000 /* SC1602BSLB Area */ 145#define PA_SC1602BSLB 0xa6000000 /* SC1602BSLB Area */
149#define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */
150#define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */
151#define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */ 146#define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */
152#define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */ 147#define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */
153 148
@@ -157,7 +152,6 @@
157#define IRQ_PCISLOT2 1 /* PCI Slot #2 IRQ */ 152#define IRQ_PCISLOT2 1 /* PCI Slot #2 IRQ */
158#define IRQ_PCISLOT3 2 /* PCI Slot #3 IRQ */ 153#define IRQ_PCISLOT3 2 /* PCI Slot #3 IRQ */
159#define IRQ_PCISLOT4 3 /* PCI Slot #4 IRQ */ 154#define IRQ_PCISLOT4 3 /* PCI Slot #4 IRQ */
160#define IRQ_CFCARD 4 /* CF Card IRQ */
161#define IRQ_CFINST 5 /* CF Card Insert IRQ */ 155#define IRQ_CFINST 5 /* CF Card Insert IRQ */
162#define IRQ_M66596 6 /* M66596 IRQ */ 156#define IRQ_M66596 6 /* M66596 IRQ */
163#define IRQ_SDCARD 7 /* SD Card IRQ */ 157#define IRQ_SDCARD 7 /* SD Card IRQ */
diff --git a/include/asm-sh/r7780rp/ide.h b/include/asm-sh/r7780rp/ide.h
deleted file mode 100644
index a1ed78e0f617..000000000000
--- a/include/asm-sh/r7780rp/ide.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_SH_R7780RP_IDE_H
2#define __ASM_SH_R7780RP_IDE_H
3
4/* Nothing to see here.. */
5#include <asm/mach/r7780rp.h>
6
7#endif /* __ASM_SH_R7780RP_IDE_H */
8
diff --git a/include/asm-sh/rts7751r2d/rts7751r2d.h b/include/asm-sh/rts7751r2d.h
index 796b8fcb81a8..796b8fcb81a8 100644
--- a/include/asm-sh/rts7751r2d/rts7751r2d.h
+++ b/include/asm-sh/rts7751r2d.h
diff --git a/include/asm-sh/rts7751r2d/ide.h b/include/asm-sh/rts7751r2d/ide.h
deleted file mode 100644
index 416f96b407cb..000000000000
--- a/include/asm-sh/rts7751r2d/ide.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_SH_RTS7751R2D_IDE_H
2#define __ASM_SH_RTS7751R2D_IDE_H
3
4/* Nothing to see here.. */
5#include <asm/rts7751r2d/rts7751r2d.h>
6
7#endif /* __ASM_SH_RTS7751R2D_IDE_H */
8
diff --git a/include/asm-sh/sh03/ide.h b/include/asm-sh/sh03/ide.h
deleted file mode 100644
index 73ee92e5c79e..000000000000
--- a/include/asm-sh/sh03/ide.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_SH_SH03_IDE_H
2#define __ASM_SH_SH03_IDE_H
3
4#define IRQ_CFCARD 8
5#define IRQ_PCMCIA 8
6
7#endif /* __ASM_SH_SH03_IDE_H */
diff --git a/include/asm-sh/shmin/shmin.h b/include/asm-sh/shmin.h
index 36ba138a81fb..36ba138a81fb 100644
--- a/include/asm-sh/shmin/shmin.h
+++ b/include/asm-sh/shmin.h
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index 6c1f8fde5ac4..3340126f4e0f 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -353,6 +353,13 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
353 (unsigned long)_n_, sizeof(*(ptr))); \ 353 (unsigned long)_n_, sizeof(*(ptr))); \
354 }) 354 })
355 355
356extern void *set_exception_table_vec(unsigned int vec, void *handler);
357
358static inline void *set_exception_table_evt(unsigned int evt, void *handler)
359{
360 return set_exception_table_vec(evt >> 5, handler);
361}
362
356/* XXX 363/* XXX
357 * disable hlt during certain critical i/o operations 364 * disable hlt during certain critical i/o operations
358 */ 365 */
diff --git a/include/asm-sh/timer.h b/include/asm-sh/timer.h
index c7ab28095ba0..5df842bcf7b6 100644
--- a/include/asm-sh/timer.h
+++ b/include/asm-sh/timer.h
@@ -8,8 +8,9 @@ struct sys_timer_ops {
8 int (*init)(void); 8 int (*init)(void);
9 int (*start)(void); 9 int (*start)(void);
10 int (*stop)(void); 10 int (*stop)(void);
11#ifndef CONFIG_GENERIC_TIME
11 unsigned long (*get_offset)(void); 12 unsigned long (*get_offset)(void);
12 unsigned long (*get_frequency)(void); 13#endif
13}; 14};
14 15
15struct sys_timer { 16struct sys_timer {
@@ -24,21 +25,17 @@ struct sys_timer {
24extern struct sys_timer tmu_timer; 25extern struct sys_timer tmu_timer;
25extern struct sys_timer *sys_timer; 26extern struct sys_timer *sys_timer;
26 27
28#ifndef CONFIG_GENERIC_TIME
27static inline unsigned long get_timer_offset(void) 29static inline unsigned long get_timer_offset(void)
28{ 30{
29 return sys_timer->ops->get_offset(); 31 return sys_timer->ops->get_offset();
30} 32}
31 33#endif
32static inline unsigned long get_timer_frequency(void)
33{
34 return sys_timer->ops->get_frequency();
35}
36 34
37/* arch/sh/kernel/timers/timer.c */ 35/* arch/sh/kernel/timers/timer.c */
38struct sys_timer *get_sys_timer(void); 36struct sys_timer *get_sys_timer(void);
39 37
40/* arch/sh/kernel/time.c */ 38/* arch/sh/kernel/time.c */
41void handle_timer_tick(struct pt_regs *); 39void handle_timer_tick(void);
42 40
43#endif /* __ASM_SH_TIMER_H */ 41#endif /* __ASM_SH_TIMER_H */
44
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index f1a0cbc966be..1c2abde122cd 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -324,8 +324,11 @@
324#define __NR_sync_file_range 314 324#define __NR_sync_file_range 314
325#define __NR_tee 315 325#define __NR_tee 315
326#define __NR_vmsplice 316 326#define __NR_vmsplice 316
327#define __NR_move_pages 317
328#define __NR_getcpu 318
329#define __NR_epoll_pwait 319
327 330
328#define NR_syscalls 317 331#define NR_syscalls 320
329 332
330#ifdef __KERNEL__ 333#ifdef __KERNEL__
331 334
diff --git a/include/asm-sh64/io.h b/include/asm-sh64/io.h
index 252fedbb6621..14d8e7b4bf4b 100644
--- a/include/asm-sh64/io.h
+++ b/include/asm-sh64/io.h
@@ -178,22 +178,6 @@ extern void iounmap(void *addr);
178unsigned long onchip_remap(unsigned long addr, unsigned long size, const char* name); 178unsigned long onchip_remap(unsigned long addr, unsigned long size, const char* name);
179extern void onchip_unmap(unsigned long vaddr); 179extern void onchip_unmap(unsigned long vaddr);
180 180
181static __inline__ int check_signature(volatile void __iomem *io_addr,
182 const unsigned char *signature, int length)
183{
184 int retval = 0;
185 do {
186 if (readb(io_addr) != *signature)
187 goto out;
188 io_addr++;
189 signature++;
190 length--;
191 } while (length);
192 retval = 1;
193out:
194 return retval;
195}
196
197/* 181/*
198 * The caches on some architectures aren't dma-coherent and have need to 182 * The caches on some architectures aren't dma-coherent and have need to
199 * handle this in software. There are three types of operations that 183 * handle this in software. There are three types of operations that
diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h
index 83a3dd15a6ed..aaf6ef40ee2f 100644
--- a/include/asm-sparc/elf.h
+++ b/include/asm-sparc/elf.h
@@ -8,11 +8,6 @@
8 8
9#include <asm/ptrace.h> 9#include <asm/ptrace.h>
10 10
11#ifdef __KERNEL__
12#include <asm/mbus.h>
13#include <asm/uaccess.h>
14#endif
15
16/* 11/*
17 * Sparc section types 12 * Sparc section types
18 */ 13 */
@@ -77,6 +72,23 @@ typedef unsigned long elf_greg_t;
77#define ELF_NGREG 38 72#define ELF_NGREG 38
78typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 73typedef elf_greg_t elf_gregset_t[ELF_NGREG];
79 74
75typedef struct {
76 union {
77 unsigned long pr_regs[32];
78 double pr_dregs[16];
79 } pr_fr;
80 unsigned long __unused;
81 unsigned long pr_fsr;
82 unsigned char pr_qcnt;
83 unsigned char pr_q_entrysize;
84 unsigned char pr_en;
85 unsigned int pr_q[64];
86} elf_fpregset_t;
87
88#ifdef __KERNEL__
89#include <asm/mbus.h>
90#include <asm/uaccess.h>
91
80/* Format is: 92/* Format is:
81 * G0 --> G7 93 * G0 --> G7
82 * O0 --> O7 94 * O0 --> O7
@@ -99,20 +111,7 @@ do { unsigned long *dest = &(__elf_regs[0]); \
99 dest[34] = src->npc; \ 111 dest[34] = src->npc; \
100 dest[35] = src->y; \ 112 dest[35] = src->y; \
101 dest[36] = dest[37] = 0; /* XXX */ \ 113 dest[36] = dest[37] = 0; /* XXX */ \
102} while(0); /* Janitors: Don't touch this colon. */ 114} while(0); /* Janitors: Don't touch this semicolon. */
103
104typedef struct {
105 union {
106 unsigned long pr_regs[32];
107 double pr_dregs[16];
108 } pr_fr;
109 unsigned long __unused;
110 unsigned long pr_fsr;
111 unsigned char pr_qcnt;
112 unsigned char pr_q_entrysize;
113 unsigned char pr_en;
114 unsigned int pr_q[64];
115} elf_fpregset_t;
116 115
117#define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \ 116#define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \
118 ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread.kregs); 1; }) 117 ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread.kregs); 1; })
@@ -165,8 +164,8 @@ typedef struct {
165 164
166#define ELF_PLATFORM (NULL) 165#define ELF_PLATFORM (NULL)
167 166
168#ifdef __KERNEL__
169#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 167#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
170#endif 168
169#endif /* __KERNEL__ */
171 170
172#endif /* !(__ASMSPARC_ELF_H) */ 171#endif /* !(__ASMSPARC_ELF_H) */
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index c7a495afc82e..f7827fa4cd5e 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -318,12 +318,15 @@
318#define __NR_unshare 299 318#define __NR_unshare 299
319#define __NR_set_robust_list 300 319#define __NR_set_robust_list 300
320#define __NR_get_robust_list 301 320#define __NR_get_robust_list 301
321#define __NR_migrate_pages 302
322
323#define NR_SYSCALLS 303
321 324
322#ifdef __KERNEL__ 325#ifdef __KERNEL__
323/* WARNING: You MAY NOT add syscall numbers larger than 301, since 326/* WARNING: You MAY NOT add syscall numbers larger than 302, since
324 * all of the syscall tables in the Sparc kernel are 327 * all of the syscall tables in the Sparc kernel are
325 * sized to have 301 entries (starting at zero). Therefore 328 * sized to have 302 entries (starting at zero). Therefore
326 * find a free slot in the 0-301 range. 329 * find a free slot in the 0-302 range.
327 */ 330 */
328 331
329#define _syscall0(type,name) \ 332#define _syscall0(type,name) \
diff --git a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h
index c73935dc7ba1..36511ca51416 100644
--- a/include/asm-sparc64/compat.h
+++ b/include/asm-sparc64/compat.h
@@ -164,7 +164,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
164 return (u32)(unsigned long)uptr; 164 return (u32)(unsigned long)uptr;
165} 165}
166 166
167static __inline__ void __user *compat_alloc_user_space(long len) 167static inline void __user *compat_alloc_user_space(long len)
168{ 168{
169 struct pt_regs *regs = current_thread_info()->kregs; 169 struct pt_regs *regs = current_thread_info()->kregs;
170 unsigned long usp = regs->u_regs[UREG_I6]; 170 unsigned long usp = regs->u_regs[UREG_I6];
@@ -174,7 +174,10 @@ static __inline__ void __user *compat_alloc_user_space(long len)
174 else 174 else
175 usp &= 0xffffffffUL; 175 usp &= 0xffffffffUL;
176 176
177 return (void __user *) (usp - len); 177 usp -= len;
178 usp &= ~0x7UL;
179
180 return (void __user *) usp;
178} 181}
179 182
180struct compat_ipc64_perm { 183struct compat_ipc64_perm {
diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h
index dee40206b221..7392fc4a954e 100644
--- a/include/asm-sparc64/futex.h
+++ b/include/asm-sparc64/futex.h
@@ -87,24 +87,22 @@ static inline int
87futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) 87futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
88{ 88{
89 __asm__ __volatile__( 89 __asm__ __volatile__(
90 "\n1: lduwa [%2] %%asi, %0\n" 90 "\n1: casa [%3] %%asi, %2, %0\n"
91 "2: casa [%2] %%asi, %0, %1\n" 91 "2:\n"
92 "3:\n"
93 " .section .fixup,#alloc,#execinstr\n" 92 " .section .fixup,#alloc,#execinstr\n"
94 " .align 4\n" 93 " .align 4\n"
95 "4: ba 3b\n" 94 "3: ba 2b\n"
96 " mov %3, %0\n" 95 " mov %4, %0\n"
97 " .previous\n" 96 " .previous\n"
98 " .section __ex_table,\"a\"\n" 97 " .section __ex_table,\"a\"\n"
99 " .align 4\n" 98 " .align 4\n"
100 " .word 1b, 4b\n" 99 " .word 1b, 3b\n"
101 " .word 2b, 4b\n"
102 " .previous\n" 100 " .previous\n"
103 : "=&r" (oldval) 101 : "=r" (newval)
104 : "r" (newval), "r" (uaddr), "i" (-EFAULT) 102 : "0" (newval), "r" (oldval), "r" (uaddr), "i" (-EFAULT)
105 : "memory"); 103 : "memory");
106 104
107 return oldval; 105 return newval;
108} 106}
109 107
110#endif /* !(_SPARC64_FUTEX_H) */ 108#endif /* !(_SPARC64_FUTEX_H) */
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index 0056770e83ad..30b912d8e8bc 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -440,21 +440,6 @@ _memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
440 440
441#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz) 441#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz)
442 442
443static inline int check_signature(void __iomem *io_addr,
444 const unsigned char *signature,
445 int length)
446{
447 int retval = 0;
448 do {
449 if (readb(io_addr) != *signature++)
450 goto out;
451 io_addr++;
452 } while (--length);
453 retval = 1;
454out:
455 return retval;
456}
457
458#define mmiowb() 443#define mmiowb()
459 444
460#ifdef __KERNEL__ 445#ifdef __KERNEL__
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index 124cf076717f..63669dad0d72 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -320,12 +320,16 @@
320#define __NR_unshare 299 320#define __NR_unshare 299
321#define __NR_set_robust_list 300 321#define __NR_set_robust_list 300
322#define __NR_get_robust_list 301 322#define __NR_get_robust_list 301
323#define __NR_migrate_pages 302
324
325#define NR_SYSCALLS 303
323 326
324#ifdef __KERNEL__ 327#ifdef __KERNEL__
325/* WARNING: You MAY NOT add syscall numbers larger than 301, since 328
329/* WARNING: You MAY NOT add syscall numbers larger than 302, since
326 * all of the syscall tables in the Sparc kernel are 330 * all of the syscall tables in the Sparc kernel are
327 * sized to have 301 entries (starting at zero). Therefore 331 * sized to have 302 entries (starting at zero). Therefore
328 * find a free slot in the 0-301 range. 332 * find a free slot in the 0-302 range.
329 */ 333 */
330 334
331#define _syscall0(type,name) \ 335#define _syscall0(type,name) \
diff --git a/include/asm-um/archparam-ppc.h b/include/asm-um/archparam-ppc.h
index 172cd6ffacc4..4269d8a37b4f 100644
--- a/include/asm-um/archparam-ppc.h
+++ b/include/asm-um/archparam-ppc.h
@@ -1,15 +1,6 @@
1#ifndef __UM_ARCHPARAM_PPC_H 1#ifndef __UM_ARCHPARAM_PPC_H
2#define __UM_ARCHPARAM_PPC_H 2#define __UM_ARCHPARAM_PPC_H
3 3
4/********* Bits for asm-um/hw_irq.h **********/
5
6struct hw_interrupt_type;
7
8/********* Bits for asm-um/hardirq.h **********/
9
10#define irq_enter(cpu, irq) hardirq_enter(cpu)
11#define irq_exit(cpu, irq) hardirq_exit(cpu)
12
13/********* Bits for asm-um/string.h **********/ 4/********* Bits for asm-um/string.h **********/
14 5
15#define __HAVE_ARCH_STRRCHR 6#define __HAVE_ARCH_STRRCHR
diff --git a/include/asm-um/common.lds.S b/include/asm-um/common.lds.S
index 1010153faaf9..f0454516dd31 100644
--- a/include/asm-um/common.lds.S
+++ b/include/asm-um/common.lds.S
@@ -42,13 +42,7 @@
42 42
43 __initcall_start = .; 43 __initcall_start = .;
44 .initcall.init : { 44 .initcall.init : {
45 *(.initcall1.init) 45 INITCALLS
46 *(.initcall2.init)
47 *(.initcall3.init)
48 *(.initcall4.init)
49 *(.initcall5.init)
50 *(.initcall6.init)
51 *(.initcall7.init)
52 } 46 }
53 __initcall_end = .; 47 __initcall_end = .;
54 48
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h
index ed59aa4c6ff9..9d1916e59c04 100644
--- a/include/asm-x86_64/acpi.h
+++ b/include/asm-x86_64/acpi.h
@@ -163,6 +163,7 @@ extern u8 x86_acpiid_to_apicid[];
163#define ARCH_HAS_POWER_INIT 1 163#define ARCH_HAS_POWER_INIT 1
164 164
165extern int acpi_skip_timer_override; 165extern int acpi_skip_timer_override;
166extern int acpi_use_timer_override;
166 167
167#endif /*__KERNEL__*/ 168#endif /*__KERNEL__*/
168 169
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 792dd52fcd70..179cce755aa7 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -76,6 +76,8 @@
76#ifndef __ASSEMBLY__ 76#ifndef __ASSEMBLY__
77typedef int vector_irq_t[NR_VECTORS]; 77typedef int vector_irq_t[NR_VECTORS];
78DECLARE_PER_CPU(vector_irq_t, vector_irq); 78DECLARE_PER_CPU(vector_irq_t, vector_irq);
79extern void __setup_vector_irq(int cpu);
80extern spinlock_t vector_lock;
79 81
80/* 82/*
81 * Various low-level irq details needed by irq.c, process.c, 83 * Various low-level irq details needed by irq.c, process.c,
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index 70e91fe76344..6ee9fadaaacb 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -254,33 +254,6 @@ void memset_io(volatile void __iomem *a, int b, size_t c);
254 254
255#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d)) 255#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d))
256 256
257/**
258 * check_signature - find BIOS signatures
259 * @io_addr: mmio address to check
260 * @signature: signature block
261 * @length: length of signature
262 *
263 * Perform a signature comparison with the mmio address io_addr. This
264 * address should have been obtained by ioremap.
265 * Returns 1 on a match.
266 */
267
268static inline int check_signature(void __iomem *io_addr,
269 const unsigned char *signature, int length)
270{
271 int retval = 0;
272 do {
273 if (readb(io_addr) != *signature)
274 goto out;
275 io_addr++;
276 signature++;
277 length--;
278 } while (length);
279 retval = 1;
280out:
281 return retval;
282}
283
284/* Nothing to do */ 257/* Nothing to do */
285 258
286#define dma_cache_inv(_start,_size) do { } while (0) 259#define dma_cache_inv(_start,_size) do { } while (0)
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h
index 171ec2dc8c04..561ecbfd4cb5 100644
--- a/include/asm-x86_64/io_apic.h
+++ b/include/asm-x86_64/io_apic.h
@@ -12,10 +12,6 @@
12 12
13#define APIC_MISMATCH_DEBUG 13#define APIC_MISMATCH_DEBUG
14 14
15#define IO_APIC_BASE(idx) \
16 ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \
17 + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK)))
18
19/* 15/*
20 * The structure of the IO-APIC: 16 * The structure of the IO-APIC:
21 */ 17 */
@@ -119,36 +115,6 @@ extern struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
119/* non-0 if default (table-less) MP configuration */ 115/* non-0 if default (table-less) MP configuration */
120extern int mpc_default_type; 116extern int mpc_default_type;
121 117
122static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
123{
124 *IO_APIC_BASE(apic) = reg;
125 return *(IO_APIC_BASE(apic)+4);
126}
127
128static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
129{
130 *IO_APIC_BASE(apic) = reg;
131 *(IO_APIC_BASE(apic)+4) = value;
132}
133
134/*
135 * Re-write a value: to be used for read-modify-write
136 * cycles where the read already set up the index register.
137 */
138static inline void io_apic_modify(unsigned int apic, unsigned int value)
139{
140 *(IO_APIC_BASE(apic)+4) = value;
141}
142
143/*
144 * Synchronize the IO-APIC and the CPU by doing
145 * a dummy read from the IO-APIC
146 */
147static inline void io_apic_sync(unsigned int apic)
148{
149 (void) *(IO_APIC_BASE(apic)+4);
150}
151
152/* 1 if "noapic" boot option passed */ 118/* 1 if "noapic" boot option passed */
153extern int skip_ioapic_setup; 119extern int skip_ioapic_setup;
154 120
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
index 14996d962bac..5642634843c4 100644
--- a/include/asm-x86_64/pda.h
+++ b/include/asm-x86_64/pda.h
@@ -109,6 +109,15 @@ extern struct x8664_pda _proxy_pda;
109#define sub_pda(field,val) pda_to_op("sub",field,val) 109#define sub_pda(field,val) pda_to_op("sub",field,val)
110#define or_pda(field,val) pda_to_op("or",field,val) 110#define or_pda(field,val) pda_to_op("or",field,val)
111 111
112/* This is not atomic against other CPUs -- CPU preemption needs to be off */
113#define test_and_clear_bit_pda(bit,field) ({ \
114 int old__; \
115 asm volatile("btr %2,%%gs:%c3\n\tsbbl %0,%0" \
116 : "=r" (old__), "+m" (_proxy_pda.field) \
117 : "dIr" (bit), "i" (pda_offset(field)) : "memory"); \
118 old__; \
119})
120
112#endif 121#endif
113 122
114#define PDA_STACKOFFSET (5*8) 123#define PDA_STACKOFFSET (5*8)
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 6899e770b173..0555c1c4d8fa 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -366,6 +366,7 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
366{ 366{
367 pte_t pte; 367 pte_t pte;
368 pte_val(pte) = physpage | pgprot_val(pgprot); 368 pte_val(pte) = physpage | pgprot_val(pgprot);
369 pte_val(pte) &= __supported_pte_mask;
369 return pte; 370 return pte;
370} 371}
371 372
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index de9c3147ee4c..cef17e0f828c 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -475,6 +475,8 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
475 : :"a" (eax), "c" (ecx)); 475 : :"a" (eax), "c" (ecx));
476} 476}
477 477
478extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
479
478#define stack_current() \ 480#define stack_current() \
479({ \ 481({ \
480 struct thread_info *ti; \ 482 struct thread_info *ti; \
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index c181fef786e4..e72cfcdf5344 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -122,6 +122,8 @@ extern int fix_aperture;
122extern int reboot_force; 122extern int reboot_force;
123extern int notsc_setup(char *); 123extern int notsc_setup(char *);
124 124
125extern int timer_over_8254;
126
125extern int gsi_irq_sharing(int gsi); 127extern int gsi_irq_sharing(int gsi);
126 128
127extern void smp_local_timer_interrupt(void); 129extern void smp_local_timer_interrupt(void);
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h
index fd452fc2c037..01d1c17e2849 100644
--- a/include/asm-x86_64/vsyscall.h
+++ b/include/asm-x86_64/vsyscall.h
@@ -59,8 +59,6 @@ extern seqlock_t xtime_lock;
59 59
60extern int sysctl_vsyscall; 60extern int sysctl_vsyscall;
61 61
62extern void vsyscall_set_cpu(int cpu);
63
64#define ARCH_HAVE_XTIME_LOCK 1 62#define ARCH_HAVE_XTIME_LOCK 1
65 63
66#endif /* __KERNEL__ */ 64#endif /* __KERNEL__ */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 5114ff18101d..a1155a2beb32 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -120,6 +120,7 @@ header-y += netrom.h
120header-y += nfs2.h 120header-y += nfs2.h
121header-y += nfs4_mount.h 121header-y += nfs4_mount.h
122header-y += nfs_mount.h 122header-y += nfs_mount.h
123header-y += oom.h
123header-y += param.h 124header-y += param.h
124header-y += pci_ids.h 125header-y += pci_ids.h
125header-y += pci_regs.h 126header-y += pci_regs.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 88b5dfd8ee12..2b0c955590fe 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -494,6 +494,9 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
494 494
495extern int ec_read(u8 addr, u8 *val); 495extern int ec_read(u8 addr, u8 *val);
496extern int ec_write(u8 addr, u8 val); 496extern int ec_write(u8 addr, u8 val);
497extern int ec_transaction(u8 command,
498 const u8 *wdata, unsigned wdata_len,
499 u8 *rdata, unsigned rdata_len);
497 500
498#endif /*CONFIG_ACPI_EC*/ 501#endif /*CONFIG_ACPI_EC*/
499 502
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index f7a1390d67f5..7011d6255593 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -10,6 +10,8 @@
10 10
11#include <asm/atomic.h> 11#include <asm/atomic.h>
12 12
13struct page;
14
13/* 15/*
14 * Bits in backing_dev_info.state 16 * Bits in backing_dev_info.state
15 */ 17 */
@@ -88,6 +90,11 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi)
88 (1 << BDI_write_congested)); 90 (1 << BDI_write_congested));
89} 91}
90 92
93void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
94void set_bdi_congested(struct backing_dev_info *bdi, int rw);
95long congestion_wait(int rw, long timeout);
96void congestion_end(int rw);
97
91#define bdi_cap_writeback_dirty(bdi) \ 98#define bdi_cap_writeback_dirty(bdi) \
92 (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK)) 99 (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK))
93 100
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index dcc5de7cc487..64b4641904fe 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -46,7 +46,8 @@
46 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) 46 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src)
47 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit) 47 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit)
48 * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf 48 * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf
49 * bitmap_parse(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf 49 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf
50 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
50 * bitmap_scnlistprintf(buf, len, src, nbits) Print bitmap src as list to buf 51 * bitmap_scnlistprintf(buf, len, src, nbits) Print bitmap src as list to buf
51 * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from list 52 * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from list
52 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region 53 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region
@@ -106,7 +107,9 @@ extern int __bitmap_weight(const unsigned long *bitmap, int bits);
106 107
107extern int bitmap_scnprintf(char *buf, unsigned int len, 108extern int bitmap_scnprintf(char *buf, unsigned int len,
108 const unsigned long *src, int nbits); 109 const unsigned long *src, int nbits);
109extern int bitmap_parse(const char __user *ubuf, unsigned int ulen, 110extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user,
111 unsigned long *dst, int nbits);
112extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen,
110 unsigned long *dst, int nbits); 113 unsigned long *dst, int nbits);
111extern int bitmap_scnlistprintf(char *buf, unsigned int len, 114extern int bitmap_scnlistprintf(char *buf, unsigned int len,
112 const unsigned long *src, int nbits); 115 const unsigned long *src, int nbits);
@@ -270,6 +273,12 @@ static inline void bitmap_shift_left(unsigned long *dst,
270 __bitmap_shift_left(dst, src, n, nbits); 273 __bitmap_shift_left(dst, src, n, nbits);
271} 274}
272 275
276static inline int bitmap_parse(const char *buf, unsigned int buflen,
277 unsigned long *maskp, int nmaskbits)
278{
279 return __bitmap_parse(buf, buflen, 0, maskp, nmaskbits);
280}
281
273#endif /* __ASSEMBLY__ */ 282#endif /* __ASSEMBLY__ */
274 283
275#endif /* __LINUX_BITMAP_H */ 284#endif /* __LINUX_BITMAP_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 26f7856ff812..7bfcde2d5578 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -157,6 +157,7 @@ enum rq_cmd_type_bits {
157 REQ_TYPE_ATA_CMD, 157 REQ_TYPE_ATA_CMD,
158 REQ_TYPE_ATA_TASK, 158 REQ_TYPE_ATA_TASK,
159 REQ_TYPE_ATA_TASKFILE, 159 REQ_TYPE_ATA_TASKFILE,
160 REQ_TYPE_ATA_PC,
160}; 161};
161 162
162/* 163/*
@@ -650,6 +651,26 @@ extern void blk_recount_segments(request_queue_t *, struct bio *);
650extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *); 651extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
651extern int sg_scsi_ioctl(struct file *, struct request_queue *, 652extern int sg_scsi_ioctl(struct file *, struct request_queue *,
652 struct gendisk *, struct scsi_ioctl_command __user *); 653 struct gendisk *, struct scsi_ioctl_command __user *);
654
655/*
656 * A queue has just exitted congestion. Note this in the global counter of
657 * congested queues, and wake up anyone who was waiting for requests to be
658 * put back.
659 */
660static inline void blk_clear_queue_congested(request_queue_t *q, int rw)
661{
662 clear_bdi_congested(&q->backing_dev_info, rw);
663}
664
665/*
666 * A queue has just entered congestion. Flag that in the queue's VM-visible
667 * state flags and increment the global gounter of congested queues.
668 */
669static inline void blk_set_queue_congested(request_queue_t *q, int rw)
670{
671 set_bdi_congested(&q->backing_dev_info, rw);
672}
673
653extern void blk_start_queue(request_queue_t *q); 674extern void blk_start_queue(request_queue_t *q);
654extern void blk_stop_queue(request_queue_t *q); 675extern void blk_stop_queue(request_queue_t *q);
655extern void blk_sync_queue(struct request_queue *q); 676extern void blk_sync_queue(struct request_queue *q);
@@ -764,10 +785,8 @@ extern int blk_queue_init_tags(request_queue_t *, int, struct blk_queue_tag *);
764extern void blk_queue_free_tags(request_queue_t *); 785extern void blk_queue_free_tags(request_queue_t *);
765extern int blk_queue_resize_tags(request_queue_t *, int); 786extern int blk_queue_resize_tags(request_queue_t *, int);
766extern void blk_queue_invalidate_tags(request_queue_t *); 787extern void blk_queue_invalidate_tags(request_queue_t *);
767extern long blk_congestion_wait(int rw, long timeout);
768extern struct blk_queue_tag *blk_init_tags(int); 788extern struct blk_queue_tag *blk_init_tags(int);
769extern void blk_free_tags(struct blk_queue_tag *); 789extern void blk_free_tags(struct blk_queue_tag *);
770extern void blk_congestion_end(int rw);
771 790
772static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt, 791static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
773 int tag) 792 int tag)
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 131ffd37e716..5d9fb0e94156 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -69,6 +69,8 @@ struct buffer_head {
69 bh_end_io_t *b_end_io; /* I/O completion */ 69 bh_end_io_t *b_end_io; /* I/O completion */
70 void *b_private; /* reserved for b_end_io */ 70 void *b_private; /* reserved for b_end_io */
71 struct list_head b_assoc_buffers; /* associated with another mapping */ 71 struct list_head b_assoc_buffers; /* associated with another mapping */
72 struct address_space *b_assoc_map; /* mapping this buffer is
73 associated with */
72 atomic_t b_count; /* users using this buffer_head */ 74 atomic_t b_count; /* users using this buffer_head */
73}; 75};
74 76
diff --git a/include/linux/carta_random32.h b/include/linux/carta_random32.h
new file mode 100644
index 000000000000..f6f3bd9f20b5
--- /dev/null
+++ b/include/linux/carta_random32.h
@@ -0,0 +1,29 @@
1/*
2 * Fast, simple, yet decent quality random number generator based on
3 * a paper by David G. Carta ("Two Fast Implementations of the
4 * `Minimal Standard' Random Number Generator," Communications of the
5 * ACM, January, 1990).
6 *
7 * Copyright (c) 2002-2006 Hewlett-Packard Development Company, L.P.
8 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 * 02111-1307 USA
23 */
24#ifndef _LINUX_CARTA_RANDOM32_H_
25#define _LINUX_CARTA_RANDOM32_H_
26
27u64 carta_random32(u64 seed);
28
29#endif /* _LINUX_CARTA_RANDOM32_H_ */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index f4ebf96f5308..80b17f440ec1 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -196,7 +196,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
196#define BITS_TO_COMPAT_LONGS(bits) \ 196#define BITS_TO_COMPAT_LONGS(bits) \
197 (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG) 197 (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG)
198 198
199long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask, 199long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
200 unsigned long bitmap_size); 200 unsigned long bitmap_size);
201long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, 201long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
202 unsigned long bitmap_size); 202 unsigned long bitmap_size);
@@ -230,5 +230,9 @@ asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
230extern int compat_printk(const char *fmt, ...); 230extern int compat_printk(const char *fmt, ...);
231extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); 231extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat);
232 232
233asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
234 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
235 const compat_ulong_t __user *new_nodes);
236
233#endif /* CONFIG_COMPAT */ 237#endif /* CONFIG_COMPAT */
234#endif /* _LINUX_COMPAT_H */ 238#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index 4e1663d7691e..c26c3adcfacf 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -61,17 +61,23 @@ COMPATIBLE_IOCTL(FIGETBSZ)
61 * Some need translations, these do not. 61 * Some need translations, these do not.
62 */ 62 */
63COMPATIBLE_IOCTL(HDIO_GET_IDENTITY) 63COMPATIBLE_IOCTL(HDIO_GET_IDENTITY)
64COMPATIBLE_IOCTL(HDIO_SET_DMA)
65COMPATIBLE_IOCTL(HDIO_SET_UNMASKINTR)
66COMPATIBLE_IOCTL(HDIO_SET_NOWERR)
67COMPATIBLE_IOCTL(HDIO_SET_32BIT)
68COMPATIBLE_IOCTL(HDIO_SET_MULTCOUNT)
69COMPATIBLE_IOCTL(HDIO_DRIVE_CMD)
70COMPATIBLE_IOCTL(HDIO_DRIVE_TASK) 64COMPATIBLE_IOCTL(HDIO_DRIVE_TASK)
71COMPATIBLE_IOCTL(HDIO_SET_PIO_MODE) 65COMPATIBLE_IOCTL(HDIO_DRIVE_CMD)
72COMPATIBLE_IOCTL(HDIO_SET_NICE) 66ULONG_IOCTL(HDIO_SET_MULTCOUNT)
73COMPATIBLE_IOCTL(HDIO_SET_KEEPSETTINGS) 67ULONG_IOCTL(HDIO_SET_UNMASKINTR)
68ULONG_IOCTL(HDIO_SET_KEEPSETTINGS)
69ULONG_IOCTL(HDIO_SET_32BIT)
70ULONG_IOCTL(HDIO_SET_NOWERR)
71ULONG_IOCTL(HDIO_SET_DMA)
72ULONG_IOCTL(HDIO_SET_PIO_MODE)
73ULONG_IOCTL(HDIO_SET_NICE)
74ULONG_IOCTL(HDIO_SET_WCACHE)
75ULONG_IOCTL(HDIO_SET_ACOUSTIC)
76ULONG_IOCTL(HDIO_SET_BUSSTATE)
77ULONG_IOCTL(HDIO_SET_ADDRESS)
74COMPATIBLE_IOCTL(HDIO_SCAN_HWIF) 78COMPATIBLE_IOCTL(HDIO_SCAN_HWIF)
79/* 0x330 is reserved -- it used to be HDIO_GETGEO_BIG */
80COMPATIBLE_IOCTL(0x330)
75/* 0x02 -- Floppy ioctls */ 81/* 0x02 -- Floppy ioctls */
76COMPATIBLE_IOCTL(FDMSGON) 82COMPATIBLE_IOCTL(FDMSGON)
77COMPATIBLE_IOCTL(FDMSGOFF) 83COMPATIBLE_IOCTL(FDMSGOFF)
@@ -125,6 +131,7 @@ COMPATIBLE_IOCTL(RUN_ARRAY)
125COMPATIBLE_IOCTL(STOP_ARRAY) 131COMPATIBLE_IOCTL(STOP_ARRAY)
126COMPATIBLE_IOCTL(STOP_ARRAY_RO) 132COMPATIBLE_IOCTL(STOP_ARRAY_RO)
127COMPATIBLE_IOCTL(RESTART_ARRAY_RW) 133COMPATIBLE_IOCTL(RESTART_ARRAY_RW)
134COMPATIBLE_IOCTL(GET_BITMAP_FILE)
128ULONG_IOCTL(SET_BITMAP_FILE) 135ULONG_IOCTL(SET_BITMAP_FILE)
129/* DM */ 136/* DM */
130COMPATIBLE_IOCTL(DM_VERSION_32) 137COMPATIBLE_IOCTL(DM_VERSION_32)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index b268a3c0c376..d0e8c8b0e34d 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -8,8 +8,8 @@
8 * See detailed comments in the file linux/bitmap.h describing the 8 * See detailed comments in the file linux/bitmap.h describing the
9 * data type on which these cpumasks are based. 9 * data type on which these cpumasks are based.
10 * 10 *
11 * For details of cpumask_scnprintf() and cpumask_parse(), 11 * For details of cpumask_scnprintf() and cpumask_parse_user(),
12 * see bitmap_scnprintf() and bitmap_parse() in lib/bitmap.c. 12 * see bitmap_scnprintf() and bitmap_parse_user() in lib/bitmap.c.
13 * For details of cpulist_scnprintf() and cpulist_parse(), see 13 * For details of cpulist_scnprintf() and cpulist_parse(), see
14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. 14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
15 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c 15 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c
@@ -49,7 +49,7 @@
49 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask 49 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask
50 * 50 *
51 * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing 51 * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
52 * int cpumask_parse(ubuf, ulen, mask) Parse ascii string as cpumask 52 * int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask
53 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing 53 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
54 * int cpulist_parse(buf, map) Parse ascii string as cpulist 54 * int cpulist_parse(buf, map) Parse ascii string as cpulist
55 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit) 55 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
@@ -273,12 +273,12 @@ static inline int __cpumask_scnprintf(char *buf, int len,
273 return bitmap_scnprintf(buf, len, srcp->bits, nbits); 273 return bitmap_scnprintf(buf, len, srcp->bits, nbits);
274} 274}
275 275
276#define cpumask_parse(ubuf, ulen, dst) \ 276#define cpumask_parse_user(ubuf, ulen, dst) \
277 __cpumask_parse((ubuf), (ulen), &(dst), NR_CPUS) 277 __cpumask_parse_user((ubuf), (ulen), &(dst), NR_CPUS)
278static inline int __cpumask_parse(const char __user *buf, int len, 278static inline int __cpumask_parse_user(const char __user *buf, int len,
279 cpumask_t *dstp, int nbits) 279 cpumask_t *dstp, int nbits)
280{ 280{
281 return bitmap_parse(buf, len, dstp->bits, nbits); 281 return bitmap_parse_user(buf, len, dstp->bits, nbits);
282} 282}
283 283
284#define cpulist_scnprintf(buf, len, src) \ 284#define cpulist_scnprintf(buf, len, src) \
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 8f2ffa4caabf..6485e9716b36 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -245,7 +245,7 @@ int crypto_alg_available(const char *name, u32 flags)
245 __deprecated_for_modules; 245 __deprecated_for_modules;
246int crypto_has_alg(const char *name, u32 type, u32 mask); 246int crypto_has_alg(const char *name, u32 type, u32 mask);
247#else 247#else
248static int crypto_alg_available(const char *name, u32 flags); 248static int crypto_alg_available(const char *name, u32 flags)
249 __deprecated_for_modules; 249 __deprecated_for_modules;
250static inline int crypto_alg_available(const char *name, u32 flags) 250static inline int crypto_alg_available(const char *name, u32 flags)
251{ 251{
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 44605be59409..63f64a9a5bf7 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -230,6 +230,7 @@ extern struct dentry * d_alloc_anon(struct inode *);
230extern struct dentry * d_splice_alias(struct inode *, struct dentry *); 230extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
231extern void shrink_dcache_sb(struct super_block *); 231extern void shrink_dcache_sb(struct super_block *);
232extern void shrink_dcache_parent(struct dentry *); 232extern void shrink_dcache_parent(struct dentry *);
233extern void shrink_dcache_for_umount(struct super_block *);
233extern int d_invalidate(struct dentry *); 234extern int d_invalidate(struct dentry *);
234 235
235/* only used at mount-time */ 236/* only used at mount-time */
diff --git a/include/linux/device.h b/include/linux/device.h
index 662e6a10144e..9d4f6a963936 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -393,7 +393,7 @@ extern void device_unregister(struct device * dev);
393extern void device_initialize(struct device * dev); 393extern void device_initialize(struct device * dev);
394extern int __must_check device_add(struct device * dev); 394extern int __must_check device_add(struct device * dev);
395extern void device_del(struct device * dev); 395extern void device_del(struct device * dev);
396extern int __must_check device_for_each_child(struct device *, void *, 396extern int device_for_each_child(struct device *, void *,
397 int (*fn)(struct device *, void *)); 397 int (*fn)(struct device *, void *));
398extern int device_rename(struct device *dev, char *new_name); 398extern int device_rename(struct device *dev, char *new_name);
399 399
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 38dc403be70b..904bf3d2d90b 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -69,6 +69,7 @@ extern struct dmi_device * dmi_find_device(int type, const char *name,
69 struct dmi_device *from); 69 struct dmi_device *from);
70extern void dmi_scan_machine(void); 70extern void dmi_scan_machine(void);
71extern int dmi_get_year(int field); 71extern int dmi_get_year(int field);
72extern int dmi_name_in_vendors(char *str);
72 73
73#else 74#else
74 75
@@ -77,6 +78,7 @@ static inline char * dmi_get_system_info(int field) { return NULL; }
77static inline struct dmi_device * dmi_find_device(int type, const char *name, 78static inline struct dmi_device * dmi_find_device(int type, const char *name,
78 struct dmi_device *from) { return NULL; } 79 struct dmi_device *from) { return NULL; }
79static inline int dmi_get_year(int year) { return 0; } 80static inline int dmi_get_year(int year) { return 0; }
81static inline int dmi_name_in_vendors(char *s) { return 0; }
80 82
81#endif 83#endif
82 84
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index b3370ef5164d..2fa9f1144228 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -70,7 +70,6 @@ struct elevator_type
70{ 70{
71 struct list_head list; 71 struct list_head list;
72 struct elevator_ops ops; 72 struct elevator_ops ops;
73 struct elevator_type *elevator_type;
74 struct elv_fs_entry *elevator_attrs; 73 struct elv_fs_entry *elevator_attrs;
75 char elevator_name[ELV_NAME_MAX]; 74 char elevator_name[ELV_NAME_MAX];
76 struct module *elevator_owner; 75 struct module *elevator_owner;
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
new file mode 100644
index 000000000000..498503ee613d
--- /dev/null
+++ b/include/linux/ext4_fs.h
@@ -0,0 +1,994 @@
1/*
2 * linux/include/linux/ext4_fs.h
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *
9 * from
10 *
11 * linux/include/linux/minix_fs.h
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 */
15
16#ifndef _LINUX_EXT4_FS_H
17#define _LINUX_EXT4_FS_H
18
19#include <linux/types.h>
20#include <linux/blkdev.h>
21#include <linux/magic.h>
22
23/*
24 * The second extended filesystem constants/structures
25 */
26
27/*
28 * Define EXT4FS_DEBUG to produce debug messages
29 */
30#undef EXT4FS_DEBUG
31
32/*
33 * Define EXT4_RESERVATION to reserve data blocks for expanding files
34 */
35#define EXT4_DEFAULT_RESERVE_BLOCKS 8
36/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
37#define EXT4_MAX_RESERVE_BLOCKS 1027
38#define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0
39/*
40 * Always enable hashed directories
41 */
42#define CONFIG_EXT4_INDEX
43
44/*
45 * Debug code
46 */
47#ifdef EXT4FS_DEBUG
48#define ext4_debug(f, a...) \
49 do { \
50 printk (KERN_DEBUG "EXT4-fs DEBUG (%s, %d): %s:", \
51 __FILE__, __LINE__, __FUNCTION__); \
52 printk (KERN_DEBUG f, ## a); \
53 } while (0)
54#else
55#define ext4_debug(f, a...) do {} while (0)
56#endif
57
58/*
59 * Special inodes numbers
60 */
61#define EXT4_BAD_INO 1 /* Bad blocks inode */
62#define EXT4_ROOT_INO 2 /* Root inode */
63#define EXT4_BOOT_LOADER_INO 5 /* Boot loader inode */
64#define EXT4_UNDEL_DIR_INO 6 /* Undelete directory inode */
65#define EXT4_RESIZE_INO 7 /* Reserved group descriptors inode */
66#define EXT4_JOURNAL_INO 8 /* Journal inode */
67
68/* First non-reserved inode for old ext4 filesystems */
69#define EXT4_GOOD_OLD_FIRST_INO 11
70
71/*
72 * Maximal count of links to a file
73 */
74#define EXT4_LINK_MAX 32000
75
76/*
77 * Macro-instructions used to manage several block sizes
78 */
79#define EXT4_MIN_BLOCK_SIZE 1024
80#define EXT4_MAX_BLOCK_SIZE 4096
81#define EXT4_MIN_BLOCK_LOG_SIZE 10
82#ifdef __KERNEL__
83# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize)
84#else
85# define EXT4_BLOCK_SIZE(s) (EXT4_MIN_BLOCK_SIZE << (s)->s_log_block_size)
86#endif
87#define EXT4_ADDR_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / sizeof (__u32))
88#ifdef __KERNEL__
89# define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
90#else
91# define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
92#endif
93#ifdef __KERNEL__
94#define EXT4_ADDR_PER_BLOCK_BITS(s) (EXT4_SB(s)->s_addr_per_block_bits)
95#define EXT4_INODE_SIZE(s) (EXT4_SB(s)->s_inode_size)
96#define EXT4_FIRST_INO(s) (EXT4_SB(s)->s_first_ino)
97#else
98#define EXT4_INODE_SIZE(s) (((s)->s_rev_level == EXT4_GOOD_OLD_REV) ? \
99 EXT4_GOOD_OLD_INODE_SIZE : \
100 (s)->s_inode_size)
101#define EXT4_FIRST_INO(s) (((s)->s_rev_level == EXT4_GOOD_OLD_REV) ? \
102 EXT4_GOOD_OLD_FIRST_INO : \
103 (s)->s_first_ino)
104#endif
105
106/*
107 * Macro-instructions used to manage fragments
108 */
109#define EXT4_MIN_FRAG_SIZE 1024
110#define EXT4_MAX_FRAG_SIZE 4096
111#define EXT4_MIN_FRAG_LOG_SIZE 10
112#ifdef __KERNEL__
113# define EXT4_FRAG_SIZE(s) (EXT4_SB(s)->s_frag_size)
114# define EXT4_FRAGS_PER_BLOCK(s) (EXT4_SB(s)->s_frags_per_block)
115#else
116# define EXT4_FRAG_SIZE(s) (EXT4_MIN_FRAG_SIZE << (s)->s_log_frag_size)
117# define EXT4_FRAGS_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / EXT4_FRAG_SIZE(s))
118#endif
119
120/*
121 * Structure of a blocks group descriptor
122 */
123struct ext4_group_desc
124{
125 __le32 bg_block_bitmap; /* Blocks bitmap block */
126 __le32 bg_inode_bitmap; /* Inodes bitmap block */
127 __le32 bg_inode_table; /* Inodes table block */
128 __le16 bg_free_blocks_count; /* Free blocks count */
129 __le16 bg_free_inodes_count; /* Free inodes count */
130 __le16 bg_used_dirs_count; /* Directories count */
131 __u16 bg_flags;
132 __u32 bg_reserved[3];
133 __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
134 __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
135 __le32 bg_inode_table_hi; /* Inodes table block MSB */
136};
137
138#ifdef __KERNEL__
139#include <linux/ext4_fs_i.h>
140#include <linux/ext4_fs_sb.h>
141#endif
142/*
143 * Macro-instructions used to manage group descriptors
144 */
145#define EXT4_MIN_DESC_SIZE 32
146#define EXT4_MIN_DESC_SIZE_64BIT 64
147#define EXT4_MAX_DESC_SIZE EXT4_MIN_BLOCK_SIZE
148#define EXT4_DESC_SIZE(s) (EXT4_SB(s)->s_desc_size)
149#ifdef __KERNEL__
150# define EXT4_BLOCKS_PER_GROUP(s) (EXT4_SB(s)->s_blocks_per_group)
151# define EXT4_DESC_PER_BLOCK(s) (EXT4_SB(s)->s_desc_per_block)
152# define EXT4_INODES_PER_GROUP(s) (EXT4_SB(s)->s_inodes_per_group)
153# define EXT4_DESC_PER_BLOCK_BITS(s) (EXT4_SB(s)->s_desc_per_block_bits)
154#else
155# define EXT4_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
156# define EXT4_DESC_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / EXT4_DESC_SIZE(s))
157# define EXT4_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
158#endif
159
160/*
161 * Constants relative to the data blocks
162 */
163#define EXT4_NDIR_BLOCKS 12
164#define EXT4_IND_BLOCK EXT4_NDIR_BLOCKS
165#define EXT4_DIND_BLOCK (EXT4_IND_BLOCK + 1)
166#define EXT4_TIND_BLOCK (EXT4_DIND_BLOCK + 1)
167#define EXT4_N_BLOCKS (EXT4_TIND_BLOCK + 1)
168
169/*
170 * Inode flags
171 */
172#define EXT4_SECRM_FL 0x00000001 /* Secure deletion */
173#define EXT4_UNRM_FL 0x00000002 /* Undelete */
174#define EXT4_COMPR_FL 0x00000004 /* Compress file */
175#define EXT4_SYNC_FL 0x00000008 /* Synchronous updates */
176#define EXT4_IMMUTABLE_FL 0x00000010 /* Immutable file */
177#define EXT4_APPEND_FL 0x00000020 /* writes to file may only append */
178#define EXT4_NODUMP_FL 0x00000040 /* do not dump file */
179#define EXT4_NOATIME_FL 0x00000080 /* do not update atime */
180/* Reserved for compression usage... */
181#define EXT4_DIRTY_FL 0x00000100
182#define EXT4_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
183#define EXT4_NOCOMPR_FL 0x00000400 /* Don't compress */
184#define EXT4_ECOMPR_FL 0x00000800 /* Compression error */
185/* End compression flags --- maybe not all used */
186#define EXT4_INDEX_FL 0x00001000 /* hash-indexed directory */
187#define EXT4_IMAGIC_FL 0x00002000 /* AFS directory */
188#define EXT4_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
189#define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */
190#define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
191#define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
192#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
193#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
194
195#define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */
196#define EXT4_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
197
198/*
199 * Inode dynamic state flags
200 */
201#define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */
202#define EXT4_STATE_NEW 0x00000002 /* inode is newly created */
203#define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */
204
205/* Used to pass group descriptor data when online resize is done */
206struct ext4_new_group_input {
207 __u32 group; /* Group number for this data */
208 __u64 block_bitmap; /* Absolute block number of block bitmap */
209 __u64 inode_bitmap; /* Absolute block number of inode bitmap */
210 __u64 inode_table; /* Absolute block number of inode table start */
211 __u32 blocks_count; /* Total number of blocks in this group */
212 __u16 reserved_blocks; /* Number of reserved blocks in this group */
213 __u16 unused;
214};
215
216/* The struct ext4_new_group_input in kernel space, with free_blocks_count */
217struct ext4_new_group_data {
218 __u32 group;
219 __u64 block_bitmap;
220 __u64 inode_bitmap;
221 __u64 inode_table;
222 __u32 blocks_count;
223 __u16 reserved_blocks;
224 __u16 unused;
225 __u32 free_blocks_count;
226};
227
228
229/*
230 * ioctl commands
231 */
232#define EXT4_IOC_GETFLAGS FS_IOC_GETFLAGS
233#define EXT4_IOC_SETFLAGS FS_IOC_SETFLAGS
234#define EXT4_IOC_GETVERSION _IOR('f', 3, long)
235#define EXT4_IOC_SETVERSION _IOW('f', 4, long)
236#define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
237#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input)
238#define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION
239#define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION
240#ifdef CONFIG_JBD_DEBUG
241#define EXT4_IOC_WAIT_FOR_READONLY _IOR('f', 99, long)
242#endif
243#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long)
244#define EXT4_IOC_SETRSVSZ _IOW('f', 6, long)
245
246/*
247 * ioctl commands in 32 bit emulation
248 */
249#define EXT4_IOC32_GETFLAGS FS_IOC32_GETFLAGS
250#define EXT4_IOC32_SETFLAGS FS_IOC32_SETFLAGS
251#define EXT4_IOC32_GETVERSION _IOR('f', 3, int)
252#define EXT4_IOC32_SETVERSION _IOW('f', 4, int)
253#define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int)
254#define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int)
255#define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
256#ifdef CONFIG_JBD_DEBUG
257#define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
258#endif
259#define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
260#define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
261
262
263/*
264 * Mount options
265 */
266struct ext4_mount_options {
267 unsigned long s_mount_opt;
268 uid_t s_resuid;
269 gid_t s_resgid;
270 unsigned long s_commit_interval;
271#ifdef CONFIG_QUOTA
272 int s_jquota_fmt;
273 char *s_qf_names[MAXQUOTAS];
274#endif
275};
276
277/*
278 * Structure of an inode on the disk
279 */
280struct ext4_inode {
281 __le16 i_mode; /* File mode */
282 __le16 i_uid; /* Low 16 bits of Owner Uid */
283 __le32 i_size; /* Size in bytes */
284 __le32 i_atime; /* Access time */
285 __le32 i_ctime; /* Creation time */
286 __le32 i_mtime; /* Modification time */
287 __le32 i_dtime; /* Deletion Time */
288 __le16 i_gid; /* Low 16 bits of Group Id */
289 __le16 i_links_count; /* Links count */
290 __le32 i_blocks; /* Blocks count */
291 __le32 i_flags; /* File flags */
292 union {
293 struct {
294 __u32 l_i_reserved1;
295 } linux1;
296 struct {
297 __u32 h_i_translator;
298 } hurd1;
299 struct {
300 __u32 m_i_reserved1;
301 } masix1;
302 } osd1; /* OS dependent 1 */
303 __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */
304 __le32 i_generation; /* File version (for NFS) */
305 __le32 i_file_acl; /* File ACL */
306 __le32 i_dir_acl; /* Directory ACL */
307 __le32 i_faddr; /* Fragment address */
308 union {
309 struct {
310 __u8 l_i_frag; /* Fragment number */
311 __u8 l_i_fsize; /* Fragment size */
312 __le16 l_i_file_acl_high;
313 __le16 l_i_uid_high; /* these 2 fields */
314 __le16 l_i_gid_high; /* were reserved2[0] */
315 __u32 l_i_reserved2;
316 } linux2;
317 struct {
318 __u8 h_i_frag; /* Fragment number */
319 __u8 h_i_fsize; /* Fragment size */
320 __u16 h_i_mode_high;
321 __u16 h_i_uid_high;
322 __u16 h_i_gid_high;
323 __u32 h_i_author;
324 } hurd2;
325 struct {
326 __u8 m_i_frag; /* Fragment number */
327 __u8 m_i_fsize; /* Fragment size */
328 __le16 m_i_file_acl_high;
329 __u32 m_i_reserved2[2];
330 } masix2;
331 } osd2; /* OS dependent 2 */
332 __le16 i_extra_isize;
333 __le16 i_pad1;
334};
335
336#define i_size_high i_dir_acl
337
338#if defined(__KERNEL__) || defined(__linux__)
339#define i_reserved1 osd1.linux1.l_i_reserved1
340#define i_frag osd2.linux2.l_i_frag
341#define i_fsize osd2.linux2.l_i_fsize
342#define i_file_acl_high osd2.linux2.l_i_file_acl_high
343#define i_uid_low i_uid
344#define i_gid_low i_gid
345#define i_uid_high osd2.linux2.l_i_uid_high
346#define i_gid_high osd2.linux2.l_i_gid_high
347#define i_reserved2 osd2.linux2.l_i_reserved2
348
349#elif defined(__GNU__)
350
351#define i_translator osd1.hurd1.h_i_translator
352#define i_frag osd2.hurd2.h_i_frag;
353#define i_fsize osd2.hurd2.h_i_fsize;
354#define i_uid_high osd2.hurd2.h_i_uid_high
355#define i_gid_high osd2.hurd2.h_i_gid_high
356#define i_author osd2.hurd2.h_i_author
357
358#elif defined(__masix__)
359
360#define i_reserved1 osd1.masix1.m_i_reserved1
361#define i_frag osd2.masix2.m_i_frag
362#define i_fsize osd2.masix2.m_i_fsize
363#define i_file_acl_high osd2.masix2.m_i_file_acl_high
364#define i_reserved2 osd2.masix2.m_i_reserved2
365
366#endif /* defined(__KERNEL__) || defined(__linux__) */
367
368/*
369 * File system states
370 */
371#define EXT4_VALID_FS 0x0001 /* Unmounted cleanly */
372#define EXT4_ERROR_FS 0x0002 /* Errors detected */
373#define EXT4_ORPHAN_FS 0x0004 /* Orphans being recovered */
374
375/*
376 * Mount flags
377 */
378#define EXT4_MOUNT_CHECK 0x00001 /* Do mount-time checks */
379#define EXT4_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */
380#define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */
381#define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */
382#define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
383#define EXT4_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */
384#define EXT4_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */
385#define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */
386#define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/
387#define EXT4_MOUNT_ABORT 0x00200 /* Fatal error detected */
388#define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */
389#define EXT4_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */
390#define EXT4_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */
391#define EXT4_MOUNT_WRITEBACK_DATA 0x00C00 /* No data ordering */
392#define EXT4_MOUNT_UPDATE_JOURNAL 0x01000 /* Update the journal format */
393#define EXT4_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */
394#define EXT4_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */
395#define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
396#define EXT4_MOUNT_RESERVATION 0x10000 /* Preallocation */
397#define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */
398#define EXT4_MOUNT_NOBH 0x40000 /* No bufferheads */
399#define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
400#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
401#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
402#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */
403
404/* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */
405#ifndef _LINUX_EXT2_FS_H
406#define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt
407#define set_opt(o, opt) o |= EXT4_MOUNT_##opt
408#define test_opt(sb, opt) (EXT4_SB(sb)->s_mount_opt & \
409 EXT4_MOUNT_##opt)
410#else
411#define EXT2_MOUNT_NOLOAD EXT4_MOUNT_NOLOAD
412#define EXT2_MOUNT_ABORT EXT4_MOUNT_ABORT
413#define EXT2_MOUNT_DATA_FLAGS EXT4_MOUNT_DATA_FLAGS
414#endif
415
416#define ext4_set_bit ext2_set_bit
417#define ext4_set_bit_atomic ext2_set_bit_atomic
418#define ext4_clear_bit ext2_clear_bit
419#define ext4_clear_bit_atomic ext2_clear_bit_atomic
420#define ext4_test_bit ext2_test_bit
421#define ext4_find_first_zero_bit ext2_find_first_zero_bit
422#define ext4_find_next_zero_bit ext2_find_next_zero_bit
423
424/*
425 * Maximal mount counts between two filesystem checks
426 */
427#define EXT4_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
428#define EXT4_DFL_CHECKINTERVAL 0 /* Don't use interval check */
429
430/*
431 * Behaviour when detecting errors
432 */
433#define EXT4_ERRORS_CONTINUE 1 /* Continue execution */
434#define EXT4_ERRORS_RO 2 /* Remount fs read-only */
435#define EXT4_ERRORS_PANIC 3 /* Panic */
436#define EXT4_ERRORS_DEFAULT EXT4_ERRORS_CONTINUE
437
438/*
439 * Structure of the super block
440 */
441struct ext4_super_block {
442/*00*/ __le32 s_inodes_count; /* Inodes count */
443 __le32 s_blocks_count; /* Blocks count */
444 __le32 s_r_blocks_count; /* Reserved blocks count */
445 __le32 s_free_blocks_count; /* Free blocks count */
446/*10*/ __le32 s_free_inodes_count; /* Free inodes count */
447 __le32 s_first_data_block; /* First Data Block */
448 __le32 s_log_block_size; /* Block size */
449 __le32 s_log_frag_size; /* Fragment size */
450/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */
451 __le32 s_frags_per_group; /* # Fragments per group */
452 __le32 s_inodes_per_group; /* # Inodes per group */
453 __le32 s_mtime; /* Mount time */
454/*30*/ __le32 s_wtime; /* Write time */
455 __le16 s_mnt_count; /* Mount count */
456 __le16 s_max_mnt_count; /* Maximal mount count */
457 __le16 s_magic; /* Magic signature */
458 __le16 s_state; /* File system state */
459 __le16 s_errors; /* Behaviour when detecting errors */
460 __le16 s_minor_rev_level; /* minor revision level */
461/*40*/ __le32 s_lastcheck; /* time of last check */
462 __le32 s_checkinterval; /* max. time between checks */
463 __le32 s_creator_os; /* OS */
464 __le32 s_rev_level; /* Revision level */
465/*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */
466 __le16 s_def_resgid; /* Default gid for reserved blocks */
467 /*
468 * These fields are for EXT4_DYNAMIC_REV superblocks only.
469 *
470 * Note: the difference between the compatible feature set and
471 * the incompatible feature set is that if there is a bit set
472 * in the incompatible feature set that the kernel doesn't
473 * know about, it should refuse to mount the filesystem.
474 *
475 * e2fsck's requirements are more strict; if it doesn't know
476 * about a feature in either the compatible or incompatible
477 * feature set, it must abort and not try to meddle with
478 * things it doesn't understand...
479 */
480 __le32 s_first_ino; /* First non-reserved inode */
481 __le16 s_inode_size; /* size of inode structure */
482 __le16 s_block_group_nr; /* block group # of this superblock */
483 __le32 s_feature_compat; /* compatible feature set */
484/*60*/ __le32 s_feature_incompat; /* incompatible feature set */
485 __le32 s_feature_ro_compat; /* readonly-compatible feature set */
486/*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
487/*78*/ char s_volume_name[16]; /* volume name */
488/*88*/ char s_last_mounted[64]; /* directory where last mounted */
489/*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */
490 /*
491 * Performance hints. Directory preallocation should only
492 * happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
493 */
494 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
495 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
496 __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
497 /*
498 * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
499 */
500/*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
501/*E0*/ __le32 s_journal_inum; /* inode number of journal file */
502 __le32 s_journal_dev; /* device number of journal file */
503 __le32 s_last_orphan; /* start of list of inodes to delete */
504 __le32 s_hash_seed[4]; /* HTREE hash seed */
505 __u8 s_def_hash_version; /* Default hash version to use */
506 __u8 s_reserved_char_pad;
507 __le16 s_desc_size; /* size of group descriptor */
508/*100*/ __le32 s_default_mount_opts;
509 __le32 s_first_meta_bg; /* First metablock block group */
510 __le32 s_mkfs_time; /* When the filesystem was created */
511 __le32 s_jnl_blocks[17]; /* Backup of the journal inode */
512 /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
513/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
514 __le32 s_r_blocks_count_hi; /* Reserved blocks count */
515 __le32 s_free_blocks_count_hi; /* Free blocks count */
516 __u32 s_reserved[169]; /* Padding to the end of the block */
517};
518
519#ifdef __KERNEL__
520static inline struct ext4_sb_info * EXT4_SB(struct super_block *sb)
521{
522 return sb->s_fs_info;
523}
524static inline struct ext4_inode_info *EXT4_I(struct inode *inode)
525{
526 return container_of(inode, struct ext4_inode_info, vfs_inode);
527}
528
529static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
530{
531 return ino == EXT4_ROOT_INO ||
532 ino == EXT4_JOURNAL_INO ||
533 ino == EXT4_RESIZE_INO ||
534 (ino >= EXT4_FIRST_INO(sb) &&
535 ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count));
536}
537#else
538/* Assume that user mode programs are passing in an ext4fs superblock, not
539 * a kernel struct super_block. This will allow us to call the feature-test
540 * macros from user land. */
541#define EXT4_SB(sb) (sb)
542#endif
543
544#define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
545
546/*
547 * Codes for operating systems
548 */
549#define EXT4_OS_LINUX 0
550#define EXT4_OS_HURD 1
551#define EXT4_OS_MASIX 2
552#define EXT4_OS_FREEBSD 3
553#define EXT4_OS_LITES 4
554
555/*
556 * Revision levels
557 */
558#define EXT4_GOOD_OLD_REV 0 /* The good old (original) format */
559#define EXT4_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
560
561#define EXT4_CURRENT_REV EXT4_GOOD_OLD_REV
562#define EXT4_MAX_SUPP_REV EXT4_DYNAMIC_REV
563
564#define EXT4_GOOD_OLD_INODE_SIZE 128
565
566/*
567 * Feature set definitions
568 */
569
570#define EXT4_HAS_COMPAT_FEATURE(sb,mask) \
571 ( EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
572#define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \
573 ( EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
574#define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \
575 ( EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
576#define EXT4_SET_COMPAT_FEATURE(sb,mask) \
577 EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
578#define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \
579 EXT4_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
580#define EXT4_SET_INCOMPAT_FEATURE(sb,mask) \
581 EXT4_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
582#define EXT4_CLEAR_COMPAT_FEATURE(sb,mask) \
583 EXT4_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
584#define EXT4_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
585 EXT4_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
586#define EXT4_CLEAR_INCOMPAT_FEATURE(sb,mask) \
587 EXT4_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
588
589#define EXT4_FEATURE_COMPAT_DIR_PREALLOC 0x0001
590#define EXT4_FEATURE_COMPAT_IMAGIC_INODES 0x0002
591#define EXT4_FEATURE_COMPAT_HAS_JOURNAL 0x0004
592#define EXT4_FEATURE_COMPAT_EXT_ATTR 0x0008
593#define EXT4_FEATURE_COMPAT_RESIZE_INODE 0x0010
594#define EXT4_FEATURE_COMPAT_DIR_INDEX 0x0020
595
596#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
597#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
598#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
599
600#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001
601#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002
602#define EXT4_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
603#define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
604#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010
605#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
606#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
607
608#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
609#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \
610 EXT4_FEATURE_INCOMPAT_RECOVER| \
611 EXT4_FEATURE_INCOMPAT_META_BG| \
612 EXT4_FEATURE_INCOMPAT_EXTENTS| \
613 EXT4_FEATURE_INCOMPAT_64BIT)
614#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
615 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
616 EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
617
618/*
619 * Default values for user and/or group using reserved blocks
620 */
621#define EXT4_DEF_RESUID 0
622#define EXT4_DEF_RESGID 0
623
624/*
625 * Default mount options
626 */
627#define EXT4_DEFM_DEBUG 0x0001
628#define EXT4_DEFM_BSDGROUPS 0x0002
629#define EXT4_DEFM_XATTR_USER 0x0004
630#define EXT4_DEFM_ACL 0x0008
631#define EXT4_DEFM_UID16 0x0010
632#define EXT4_DEFM_JMODE 0x0060
633#define EXT4_DEFM_JMODE_DATA 0x0020
634#define EXT4_DEFM_JMODE_ORDERED 0x0040
635#define EXT4_DEFM_JMODE_WBACK 0x0060
636
637/*
638 * Structure of a directory entry
639 */
640#define EXT4_NAME_LEN 255
641
642struct ext4_dir_entry {
643 __le32 inode; /* Inode number */
644 __le16 rec_len; /* Directory entry length */
645 __le16 name_len; /* Name length */
646 char name[EXT4_NAME_LEN]; /* File name */
647};
648
649/*
650 * The new version of the directory entry. Since EXT4 structures are
651 * stored in intel byte order, and the name_len field could never be
652 * bigger than 255 chars, it's safe to reclaim the extra byte for the
653 * file_type field.
654 */
655struct ext4_dir_entry_2 {
656 __le32 inode; /* Inode number */
657 __le16 rec_len; /* Directory entry length */
658 __u8 name_len; /* Name length */
659 __u8 file_type;
660 char name[EXT4_NAME_LEN]; /* File name */
661};
662
663/*
664 * Ext4 directory file types. Only the low 3 bits are used. The
665 * other bits are reserved for now.
666 */
667#define EXT4_FT_UNKNOWN 0
668#define EXT4_FT_REG_FILE 1
669#define EXT4_FT_DIR 2
670#define EXT4_FT_CHRDEV 3
671#define EXT4_FT_BLKDEV 4
672#define EXT4_FT_FIFO 5
673#define EXT4_FT_SOCK 6
674#define EXT4_FT_SYMLINK 7
675
676#define EXT4_FT_MAX 8
677
678/*
679 * EXT4_DIR_PAD defines the directory entries boundaries
680 *
681 * NOTE: It must be a multiple of 4
682 */
683#define EXT4_DIR_PAD 4
684#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1)
685#define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \
686 ~EXT4_DIR_ROUND)
687/*
688 * Hash Tree Directory indexing
689 * (c) Daniel Phillips, 2001
690 */
691
692#ifdef CONFIG_EXT4_INDEX
693 #define is_dx(dir) (EXT4_HAS_COMPAT_FEATURE(dir->i_sb, \
694 EXT4_FEATURE_COMPAT_DIR_INDEX) && \
695 (EXT4_I(dir)->i_flags & EXT4_INDEX_FL))
696#define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX)
697#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
698#else
699 #define is_dx(dir) 0
700#define EXT4_DIR_LINK_MAX(dir) ((dir)->i_nlink >= EXT4_LINK_MAX)
701#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2)
702#endif
703
704/* Legal values for the dx_root hash_version field: */
705
706#define DX_HASH_LEGACY 0
707#define DX_HASH_HALF_MD4 1
708#define DX_HASH_TEA 2
709
710#ifdef __KERNEL__
711
712/* hash info structure used by the directory hash */
713struct dx_hash_info
714{
715 u32 hash;
716 u32 minor_hash;
717 int hash_version;
718 u32 *seed;
719};
720
721#define EXT4_HTREE_EOF 0x7fffffff
722
723/*
724 * Control parameters used by ext4_htree_next_block
725 */
726#define HASH_NB_ALWAYS 1
727
728
729/*
730 * Describe an inode's exact location on disk and in memory
731 */
732struct ext4_iloc
733{
734 struct buffer_head *bh;
735 unsigned long offset;
736 unsigned long block_group;
737};
738
739static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc)
740{
741 return (struct ext4_inode *) (iloc->bh->b_data + iloc->offset);
742}
743
744/*
745 * This structure is stuffed into the struct file's private_data field
746 * for directories. It is where we put information so that we can do
747 * readdir operations in hash tree order.
748 */
749struct dir_private_info {
750 struct rb_root root;
751 struct rb_node *curr_node;
752 struct fname *extra_fname;
753 loff_t last_pos;
754 __u32 curr_hash;
755 __u32 curr_minor_hash;
756 __u32 next_hash;
757};
758
759/* calculate the first block number of the group */
760static inline ext4_fsblk_t
761ext4_group_first_block_no(struct super_block *sb, unsigned long group_no)
762{
763 return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) +
764 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
765}
766
767/*
768 * Special error return code only used by dx_probe() and its callers.
769 */
770#define ERR_BAD_DX_DIR -75000
771
772void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
773 unsigned long *blockgrpp, ext4_grpblk_t *offsetp);
774
775/*
776 * Function prototypes
777 */
778
779/*
780 * Ok, these declarations are also in <linux/kernel.h> but none of the
781 * ext4 source programs needs to include it so they are duplicated here.
782 */
783# define NORET_TYPE /**/
784# define ATTRIB_NORET __attribute__((noreturn))
785# define NORET_AND noreturn,
786
787/* balloc.c */
788extern unsigned int ext4_block_group(struct super_block *sb,
789 ext4_fsblk_t blocknr);
790extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb,
791 ext4_fsblk_t blocknr);
792extern int ext4_bg_has_super(struct super_block *sb, int group);
793extern unsigned long ext4_bg_num_gdb(struct super_block *sb, int group);
794extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode,
795 ext4_fsblk_t goal, int *errp);
796extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode,
797 ext4_fsblk_t goal, unsigned long *count, int *errp);
798extern void ext4_free_blocks (handle_t *handle, struct inode *inode,
799 ext4_fsblk_t block, unsigned long count);
800extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb,
801 ext4_fsblk_t block, unsigned long count,
802 unsigned long *pdquot_freed_blocks);
803extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *);
804extern void ext4_check_blocks_bitmap (struct super_block *);
805extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
806 unsigned int block_group,
807 struct buffer_head ** bh);
808extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
809extern void ext4_init_block_alloc_info(struct inode *);
810extern void ext4_rsv_window_add(struct super_block *sb, struct ext4_reserve_window_node *rsv);
811
812/* dir.c */
813extern int ext4_check_dir_entry(const char *, struct inode *,
814 struct ext4_dir_entry_2 *,
815 struct buffer_head *, unsigned long);
816extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash,
817 __u32 minor_hash,
818 struct ext4_dir_entry_2 *dirent);
819extern void ext4_htree_free_dir_info(struct dir_private_info *p);
820
821/* fsync.c */
822extern int ext4_sync_file (struct file *, struct dentry *, int);
823
824/* hash.c */
825extern int ext4fs_dirhash(const char *name, int len, struct
826 dx_hash_info *hinfo);
827
828/* ialloc.c */
829extern struct inode * ext4_new_inode (handle_t *, struct inode *, int);
830extern void ext4_free_inode (handle_t *, struct inode *);
831extern struct inode * ext4_orphan_get (struct super_block *, unsigned long);
832extern unsigned long ext4_count_free_inodes (struct super_block *);
833extern unsigned long ext4_count_dirs (struct super_block *);
834extern void ext4_check_inodes_bitmap (struct super_block *);
835extern unsigned long ext4_count_free (struct buffer_head *, unsigned);
836
837
838/* inode.c */
839int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
840 struct buffer_head *bh, ext4_fsblk_t blocknr);
841struct buffer_head * ext4_getblk (handle_t *, struct inode *, long, int, int *);
842struct buffer_head * ext4_bread (handle_t *, struct inode *, int, int, int *);
843int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
844 sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result,
845 int create, int extend_disksize);
846
847extern void ext4_read_inode (struct inode *);
848extern int ext4_write_inode (struct inode *, int);
849extern int ext4_setattr (struct dentry *, struct iattr *);
850extern void ext4_delete_inode (struct inode *);
851extern int ext4_sync_inode (handle_t *, struct inode *);
852extern void ext4_discard_reservation (struct inode *);
853extern void ext4_dirty_inode(struct inode *);
854extern int ext4_change_inode_journal_flag(struct inode *, int);
855extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
856extern void ext4_truncate (struct inode *);
857extern void ext4_set_inode_flags(struct inode *);
858extern void ext4_set_aops(struct inode *inode);
859extern int ext4_writepage_trans_blocks(struct inode *);
860extern int ext4_block_truncate_page(handle_t *handle, struct page *page,
861 struct address_space *mapping, loff_t from);
862
863/* ioctl.c */
864extern int ext4_ioctl (struct inode *, struct file *, unsigned int,
865 unsigned long);
866extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long);
867
868/* namei.c */
869extern int ext4_orphan_add(handle_t *, struct inode *);
870extern int ext4_orphan_del(handle_t *, struct inode *);
871extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
872 __u32 start_minor_hash, __u32 *next_hash);
873
874/* resize.c */
875extern int ext4_group_add(struct super_block *sb,
876 struct ext4_new_group_data *input);
877extern int ext4_group_extend(struct super_block *sb,
878 struct ext4_super_block *es,
879 ext4_fsblk_t n_blocks_count);
880
881/* super.c */
882extern void ext4_error (struct super_block *, const char *, const char *, ...)
883 __attribute__ ((format (printf, 3, 4)));
884extern void __ext4_std_error (struct super_block *, const char *, int);
885extern void ext4_abort (struct super_block *, const char *, const char *, ...)
886 __attribute__ ((format (printf, 3, 4)));
887extern void ext4_warning (struct super_block *, const char *, const char *, ...)
888 __attribute__ ((format (printf, 3, 4)));
889extern void ext4_update_dynamic_rev (struct super_block *sb);
890extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
891 struct ext4_group_desc *bg);
892extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,
893 struct ext4_group_desc *bg);
894extern ext4_fsblk_t ext4_inode_table(struct super_block *sb,
895 struct ext4_group_desc *bg);
896extern void ext4_block_bitmap_set(struct super_block *sb,
897 struct ext4_group_desc *bg, ext4_fsblk_t blk);
898extern void ext4_inode_bitmap_set(struct super_block *sb,
899 struct ext4_group_desc *bg, ext4_fsblk_t blk);
900extern void ext4_inode_table_set(struct super_block *sb,
901 struct ext4_group_desc *bg, ext4_fsblk_t blk);
902
903static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es)
904{
905 return ((ext4_fsblk_t)le32_to_cpu(es->s_blocks_count_hi) << 32) |
906 le32_to_cpu(es->s_blocks_count);
907}
908
909static inline ext4_fsblk_t ext4_r_blocks_count(struct ext4_super_block *es)
910{
911 return ((ext4_fsblk_t)le32_to_cpu(es->s_r_blocks_count_hi) << 32) |
912 le32_to_cpu(es->s_r_blocks_count);
913}
914
915static inline ext4_fsblk_t ext4_free_blocks_count(struct ext4_super_block *es)
916{
917 return ((ext4_fsblk_t)le32_to_cpu(es->s_free_blocks_count_hi) << 32) |
918 le32_to_cpu(es->s_free_blocks_count);
919}
920
921static inline void ext4_blocks_count_set(struct ext4_super_block *es,
922 ext4_fsblk_t blk)
923{
924 es->s_blocks_count = cpu_to_le32((u32)blk);
925 es->s_blocks_count_hi = cpu_to_le32(blk >> 32);
926}
927
928static inline void ext4_free_blocks_count_set(struct ext4_super_block *es,
929 ext4_fsblk_t blk)
930{
931 es->s_free_blocks_count = cpu_to_le32((u32)blk);
932 es->s_free_blocks_count_hi = cpu_to_le32(blk >> 32);
933}
934
935static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
936 ext4_fsblk_t blk)
937{
938 es->s_r_blocks_count = cpu_to_le32((u32)blk);
939 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
940}
941
942
943
944#define ext4_std_error(sb, errno) \
945do { \
946 if ((errno)) \
947 __ext4_std_error((sb), __FUNCTION__, (errno)); \
948} while (0)
949
950/*
951 * Inodes and files operations
952 */
953
954/* dir.c */
955extern const struct file_operations ext4_dir_operations;
956
957/* file.c */
958extern struct inode_operations ext4_file_inode_operations;
959extern const struct file_operations ext4_file_operations;
960
961/* namei.c */
962extern struct inode_operations ext4_dir_inode_operations;
963extern struct inode_operations ext4_special_inode_operations;
964
965/* symlink.c */
966extern struct inode_operations ext4_symlink_inode_operations;
967extern struct inode_operations ext4_fast_symlink_inode_operations;
968
969/* extents.c */
970extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
971extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
972extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
973 ext4_fsblk_t iblock,
974 unsigned long max_blocks, struct buffer_head *bh_result,
975 int create, int extend_disksize);
976extern void ext4_ext_truncate(struct inode *, struct page *);
977extern void ext4_ext_init(struct super_block *);
978extern void ext4_ext_release(struct super_block *);
979static inline int
980ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block,
981 unsigned long max_blocks, struct buffer_head *bh,
982 int create, int extend_disksize)
983{
984 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
985 return ext4_ext_get_blocks(handle, inode, block, max_blocks,
986 bh, create, extend_disksize);
987 return ext4_get_blocks_handle(handle, inode, block, max_blocks, bh,
988 create, extend_disksize);
989}
990
991
992#endif /* __KERNEL__ */
993
994#endif /* _LINUX_EXT4_FS_H */
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
new file mode 100644
index 000000000000..a41cc24568ca
--- /dev/null
+++ b/include/linux/ext4_fs_extents.h
@@ -0,0 +1,198 @@
1/*
2 * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com
3 * Written by Alex Tomas <alex@clusterfs.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public Licens
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-
17 */
18
19#ifndef _LINUX_EXT4_EXTENTS
20#define _LINUX_EXT4_EXTENTS
21
22#include <linux/ext4_fs.h>
23
24/*
25 * With AGRESSIVE_TEST defined, the capacity of index/leaf blocks
26 * becomes very small, so index split, in-depth growing and
27 * other hard changes happen much more often.
28 * This is for debug purposes only.
29 */
30#define AGRESSIVE_TEST_
31
32/*
33 * With EXTENTS_STATS defined, the number of blocks and extents
34 * are collected in the truncate path. They'll be shown at
35 * umount time.
36 */
37#define EXTENTS_STATS__
38
39/*
40 * If CHECK_BINSEARCH is defined, then the results of the binary search
41 * will also be checked by linear search.
42 */
43#define CHECK_BINSEARCH__
44
45/*
46 * If EXT_DEBUG is defined you can use the 'extdebug' mount option
47 * to get lots of info about what's going on.
48 */
49#define EXT_DEBUG__
50#ifdef EXT_DEBUG
51#define ext_debug(a...) printk(a)
52#else
53#define ext_debug(a...)
54#endif
55
56/*
57 * If EXT_STATS is defined then stats numbers are collected.
58 * These number will be displayed at umount time.
59 */
60#define EXT_STATS_
61
62
63/*
64 * ext4_inode has i_block array (60 bytes total).
65 * The first 12 bytes store ext4_extent_header;
66 * the remainder stores an array of ext4_extent.
67 */
68
69/*
70 * This is the extent on-disk structure.
71 * It's used at the bottom of the tree.
72 */
73struct ext4_extent {
74 __le32 ee_block; /* first logical block extent covers */
75 __le16 ee_len; /* number of blocks covered by extent */
76 __le16 ee_start_hi; /* high 16 bits of physical block */
77 __le32 ee_start; /* low 32 bits of physical block */
78};
79
80/*
81 * This is index on-disk structure.
82 * It's used at all the levels except the bottom.
83 */
84struct ext4_extent_idx {
85 __le32 ei_block; /* index covers logical blocks from 'block' */
86 __le32 ei_leaf; /* pointer to the physical block of the next *
87 * level. leaf or next index could be there */
88 __le16 ei_leaf_hi; /* high 16 bits of physical block */
89 __u16 ei_unused;
90};
91
92/*
93 * Each block (leaves and indexes), even inode-stored has header.
94 */
95struct ext4_extent_header {
96 __le16 eh_magic; /* probably will support different formats */
97 __le16 eh_entries; /* number of valid entries */
98 __le16 eh_max; /* capacity of store in entries */
99 __le16 eh_depth; /* has tree real underlying blocks? */
100 __le32 eh_generation; /* generation of the tree */
101};
102
103#define EXT4_EXT_MAGIC cpu_to_le16(0xf30a)
104
105/*
106 * Array of ext4_ext_path contains path to some extent.
107 * Creation/lookup routines use it for traversal/splitting/etc.
108 * Truncate uses it to simulate recursive walking.
109 */
110struct ext4_ext_path {
111 ext4_fsblk_t p_block;
112 __u16 p_depth;
113 struct ext4_extent *p_ext;
114 struct ext4_extent_idx *p_idx;
115 struct ext4_extent_header *p_hdr;
116 struct buffer_head *p_bh;
117};
118
119/*
120 * structure for external API
121 */
122
123#define EXT4_EXT_CACHE_NO 0
124#define EXT4_EXT_CACHE_GAP 1
125#define EXT4_EXT_CACHE_EXTENT 2
126
127/*
128 * to be called by ext4_ext_walk_space()
129 * negative retcode - error
130 * positive retcode - signal for ext4_ext_walk_space(), see below
131 * callback must return valid extent (passed or newly created)
132 */
133typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
134 struct ext4_ext_cache *,
135 void *);
136
137#define EXT_CONTINUE 0
138#define EXT_BREAK 1
139#define EXT_REPEAT 2
140
141
142#define EXT_MAX_BLOCK 0xffffffff
143
144#define EXT_MAX_LEN ((1UL << 15) - 1)
145
146
147#define EXT_FIRST_EXTENT(__hdr__) \
148 ((struct ext4_extent *) (((char *) (__hdr__)) + \
149 sizeof(struct ext4_extent_header)))
150#define EXT_FIRST_INDEX(__hdr__) \
151 ((struct ext4_extent_idx *) (((char *) (__hdr__)) + \
152 sizeof(struct ext4_extent_header)))
153#define EXT_HAS_FREE_INDEX(__path__) \
154 (le16_to_cpu((__path__)->p_hdr->eh_entries) \
155 < le16_to_cpu((__path__)->p_hdr->eh_max))
156#define EXT_LAST_EXTENT(__hdr__) \
157 (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1)
158#define EXT_LAST_INDEX(__hdr__) \
159 (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1)
160#define EXT_MAX_EXTENT(__hdr__) \
161 (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)
162#define EXT_MAX_INDEX(__hdr__) \
163 (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)
164
165static inline struct ext4_extent_header *ext_inode_hdr(struct inode *inode)
166{
167 return (struct ext4_extent_header *) EXT4_I(inode)->i_data;
168}
169
170static inline struct ext4_extent_header *ext_block_hdr(struct buffer_head *bh)
171{
172 return (struct ext4_extent_header *) bh->b_data;
173}
174
175static inline unsigned short ext_depth(struct inode *inode)
176{
177 return le16_to_cpu(ext_inode_hdr(inode)->eh_depth);
178}
179
180static inline void ext4_ext_tree_changed(struct inode *inode)
181{
182 EXT4_I(inode)->i_ext_generation++;
183}
184
185static inline void
186ext4_ext_invalidate_cache(struct inode *inode)
187{
188 EXT4_I(inode)->i_cached_extent.ec_type = EXT4_EXT_CACHE_NO;
189}
190
191extern int ext4_extent_tree_init(handle_t *, struct inode *);
192extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *);
193extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
194extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *);
195extern struct ext4_ext_path * ext4_ext_find_extent(struct inode *, int, struct ext4_ext_path *);
196
197#endif /* _LINUX_EXT4_EXTENTS */
198
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h
new file mode 100644
index 000000000000..bb42379cb7fd
--- /dev/null
+++ b/include/linux/ext4_fs_i.h
@@ -0,0 +1,158 @@
1/*
2 * linux/include/linux/ext4_fs_i.h
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *
9 * from
10 *
11 * linux/include/linux/minix_fs_i.h
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 */
15
16#ifndef _LINUX_EXT4_FS_I
17#define _LINUX_EXT4_FS_I
18
19#include <linux/rwsem.h>
20#include <linux/rbtree.h>
21#include <linux/seqlock.h>
22#include <linux/mutex.h>
23
24/* data type for block offset of block group */
25typedef int ext4_grpblk_t;
26
27/* data type for filesystem-wide blocks number */
28typedef unsigned long long ext4_fsblk_t;
29
30struct ext4_reserve_window {
31 ext4_fsblk_t _rsv_start; /* First byte reserved */
32 ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */
33};
34
35struct ext4_reserve_window_node {
36 struct rb_node rsv_node;
37 __u32 rsv_goal_size;
38 __u32 rsv_alloc_hit;
39 struct ext4_reserve_window rsv_window;
40};
41
42struct ext4_block_alloc_info {
43 /* information about reservation window */
44 struct ext4_reserve_window_node rsv_window_node;
45 /*
46 * was i_next_alloc_block in ext4_inode_info
47 * is the logical (file-relative) number of the
48 * most-recently-allocated block in this file.
49 * We use this for detecting linearly ascending allocation requests.
50 */
51 __u32 last_alloc_logical_block;
52 /*
53 * Was i_next_alloc_goal in ext4_inode_info
54 * is the *physical* companion to i_next_alloc_block.
55 * it the the physical block number of the block which was most-recentl
56 * allocated to this file. This give us the goal (target) for the next
57 * allocation when we detect linearly ascending requests.
58 */
59 ext4_fsblk_t last_alloc_physical_block;
60};
61
62#define rsv_start rsv_window._rsv_start
63#define rsv_end rsv_window._rsv_end
64
65/*
66 * storage for cached extent
67 */
68struct ext4_ext_cache {
69 ext4_fsblk_t ec_start;
70 __u32 ec_block;
71 __u32 ec_len; /* must be 32bit to return holes */
72 __u32 ec_type;
73};
74
75/*
76 * third extended file system inode data in memory
77 */
78struct ext4_inode_info {
79 __le32 i_data[15]; /* unconverted */
80 __u32 i_flags;
81#ifdef EXT4_FRAGMENTS
82 __u32 i_faddr;
83 __u8 i_frag_no;
84 __u8 i_frag_size;
85#endif
86 ext4_fsblk_t i_file_acl;
87 __u32 i_dir_acl;
88 __u32 i_dtime;
89
90 /*
91 * i_block_group is the number of the block group which contains
92 * this file's inode. Constant across the lifetime of the inode,
93 * it is ued for making block allocation decisions - we try to
94 * place a file's data blocks near its inode block, and new inodes
95 * near to their parent directory's inode.
96 */
97 __u32 i_block_group;
98 __u32 i_state; /* Dynamic state flags for ext4 */
99
100 /* block reservation info */
101 struct ext4_block_alloc_info *i_block_alloc_info;
102
103 __u32 i_dir_start_lookup;
104#ifdef CONFIG_EXT4DEV_FS_XATTR
105 /*
106 * Extended attributes can be read independently of the main file
107 * data. Taking i_mutex even when reading would cause contention
108 * between readers of EAs and writers of regular file data, so
109 * instead we synchronize on xattr_sem when reading or changing
110 * EAs.
111 */
112 struct rw_semaphore xattr_sem;
113#endif
114#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL
115 struct posix_acl *i_acl;
116 struct posix_acl *i_default_acl;
117#endif
118
119 struct list_head i_orphan; /* unlinked but open inodes */
120
121 /*
122 * i_disksize keeps track of what the inode size is ON DISK, not
123 * in memory. During truncate, i_size is set to the new size by
124 * the VFS prior to calling ext4_truncate(), but the filesystem won't
125 * set i_disksize to 0 until the truncate is actually under way.
126 *
127 * The intent is that i_disksize always represents the blocks which
128 * are used by this file. This allows recovery to restart truncate
129 * on orphans if we crash during truncate. We actually write i_disksize
130 * into the on-disk inode when writing inodes out, instead of i_size.
131 *
132 * The only time when i_disksize and i_size may be different is when
133 * a truncate is in progress. The only things which change i_disksize
134 * are ext4_get_block (growth) and ext4_truncate (shrinkth).
135 */
136 loff_t i_disksize;
137
138 /* on-disk additional length */
139 __u16 i_extra_isize;
140
141 /*
142 * truncate_mutex is for serialising ext4_truncate() against
143 * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's
144 * data tree are chopped off during truncate. We can't do that in
145 * ext4 because whenever we perform intermediate commits during
146 * truncate, the inode and all the metadata blocks *must* be in a
147 * consistent state which allows truncation of the orphans to restart
148 * during recovery. Hence we must fix the get_block-vs-truncate race
149 * by other means, so we have truncate_mutex.
150 */
151 struct mutex truncate_mutex;
152 struct inode vfs_inode;
153
154 unsigned long i_ext_generation;
155 struct ext4_ext_cache i_cached_extent;
156};
157
158#endif /* _LINUX_EXT4_FS_I */
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h
new file mode 100644
index 000000000000..691a713139ce
--- /dev/null
+++ b/include/linux/ext4_fs_sb.h
@@ -0,0 +1,94 @@
1/*
2 * linux/include/linux/ext4_fs_sb.h
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *
9 * from
10 *
11 * linux/include/linux/minix_fs_sb.h
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 */
15
16#ifndef _LINUX_EXT4_FS_SB
17#define _LINUX_EXT4_FS_SB
18
19#ifdef __KERNEL__
20#include <linux/timer.h>
21#include <linux/wait.h>
22#include <linux/blockgroup_lock.h>
23#include <linux/percpu_counter.h>
24#endif
25#include <linux/rbtree.h>
26
27/*
28 * third extended-fs super-block data in memory
29 */
30struct ext4_sb_info {
31 unsigned long s_frag_size; /* Size of a fragment in bytes */
32 unsigned long s_desc_size; /* Size of a group descriptor in bytes */
33 unsigned long s_frags_per_block;/* Number of fragments per block */
34 unsigned long s_inodes_per_block;/* Number of inodes per block */
35 unsigned long s_frags_per_group;/* Number of fragments in a group */
36 unsigned long s_blocks_per_group;/* Number of blocks in a group */
37 unsigned long s_inodes_per_group;/* Number of inodes in a group */
38 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
39 unsigned long s_gdb_count; /* Number of group descriptor blocks */
40 unsigned long s_desc_per_block; /* Number of group descriptors per block */
41 unsigned long s_groups_count; /* Number of groups in the fs */
42 struct buffer_head * s_sbh; /* Buffer containing the super block */
43 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */
44 struct buffer_head ** s_group_desc;
45 unsigned long s_mount_opt;
46 uid_t s_resuid;
47 gid_t s_resgid;
48 unsigned short s_mount_state;
49 unsigned short s_pad;
50 int s_addr_per_block_bits;
51 int s_desc_per_block_bits;
52 int s_inode_size;
53 int s_first_ino;
54 spinlock_t s_next_gen_lock;
55 u32 s_next_generation;
56 u32 s_hash_seed[4];
57 int s_def_hash_version;
58 struct percpu_counter s_freeblocks_counter;
59 struct percpu_counter s_freeinodes_counter;
60 struct percpu_counter s_dirs_counter;
61 struct blockgroup_lock s_blockgroup_lock;
62
63 /* root of the per fs reservation window tree */
64 spinlock_t s_rsv_window_lock;
65 struct rb_root s_rsv_window_root;
66 struct ext4_reserve_window_node s_rsv_window_head;
67
68 /* Journaling */
69 struct inode * s_journal_inode;
70 struct journal_s * s_journal;
71 struct list_head s_orphan;
72 unsigned long s_commit_interval;
73 struct block_device *journal_bdev;
74#ifdef CONFIG_JBD_DEBUG
75 struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
76 wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
77#endif
78#ifdef CONFIG_QUOTA
79 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
80 int s_jquota_fmt; /* Format of quota to use */
81#endif
82
83#ifdef EXTENTS_STATS
84 /* ext4 extents stats */
85 unsigned long s_ext_min;
86 unsigned long s_ext_max;
87 unsigned long s_depth_max;
88 spinlock_t s_ext_stats_lock;
89 unsigned long s_ext_blocks;
90 unsigned long s_ext_extents;
91#endif
92};
93
94#endif /* _LINUX_EXT4_FS_SB */
diff --git a/include/linux/ext4_jbd2.h b/include/linux/ext4_jbd2.h
new file mode 100644
index 000000000000..72dd631912e4
--- /dev/null
+++ b/include/linux/ext4_jbd2.h
@@ -0,0 +1,273 @@
1/*
2 * linux/include/linux/ext4_jbd2.h
3 *
4 * Written by Stephen C. Tweedie <sct@redhat.com>, 1999
5 *
6 * Copyright 1998--1999 Red Hat corp --- All Rights Reserved
7 *
8 * This file is part of the Linux kernel and is made available under
9 * the terms of the GNU General Public License, version 2, or at your
10 * option, any later version, incorporated herein by reference.
11 *
12 * Ext4-specific journaling extensions.
13 */
14
15#ifndef _LINUX_EXT4_JBD_H
16#define _LINUX_EXT4_JBD_H
17
18#include <linux/fs.h>
19#include <linux/jbd2.h>
20#include <linux/ext4_fs.h>
21
22#define EXT4_JOURNAL(inode) (EXT4_SB((inode)->i_sb)->s_journal)
23
24/* Define the number of blocks we need to account to a transaction to
25 * modify one block of data.
26 *
27 * We may have to touch one inode, one bitmap buffer, up to three
28 * indirection blocks, the group and superblock summaries, and the data
29 * block to complete the transaction.
30 *
31 * For extents-enabled fs we may have to allocate and modify up to
32 * 5 levels of tree + root which are stored in the inode. */
33
34#define EXT4_SINGLEDATA_TRANS_BLOCKS(sb) \
35 (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
36 || test_opt(sb, EXTENTS) ? 27U : 8U)
37
38/* Extended attribute operations touch at most two data buffers,
39 * two bitmap buffers, and two group summaries, in addition to the inode
40 * and the superblock, which are already accounted for. */
41
42#define EXT4_XATTR_TRANS_BLOCKS 6U
43
44/* Define the minimum size for a transaction which modifies data. This
45 * needs to take into account the fact that we may end up modifying two
46 * quota files too (one for the group, one for the user quota). The
47 * superblock only gets updated once, of course, so don't bother
48 * counting that again for the quota updates. */
49
50#define EXT4_DATA_TRANS_BLOCKS(sb) (EXT4_SINGLEDATA_TRANS_BLOCKS(sb) + \
51 EXT4_XATTR_TRANS_BLOCKS - 2 + \
52 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
53
54/* Delete operations potentially hit one directory's namespace plus an
55 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be
56 * generous. We can grow the delete transaction later if necessary. */
57
58#define EXT4_DELETE_TRANS_BLOCKS(sb) (2 * EXT4_DATA_TRANS_BLOCKS(sb) + 64)
59
60/* Define an arbitrary limit for the amount of data we will anticipate
61 * writing to any given transaction. For unbounded transactions such as
62 * write(2) and truncate(2) we can write more than this, but we always
63 * start off at the maximum transaction size and grow the transaction
64 * optimistically as we go. */
65
66#define EXT4_MAX_TRANS_DATA 64U
67
68/* We break up a large truncate or write transaction once the handle's
69 * buffer credits gets this low, we need either to extend the
70 * transaction or to start a new one. Reserve enough space here for
71 * inode, bitmap, superblock, group and indirection updates for at least
72 * one block, plus two quota updates. Quota allocations are not
73 * needed. */
74
75#define EXT4_RESERVE_TRANS_BLOCKS 12U
76
77#define EXT4_INDEX_EXTRA_TRANS_BLOCKS 8
78
79#ifdef CONFIG_QUOTA
80/* Amount of blocks needed for quota update - we know that the structure was
81 * allocated so we need to update only inode+data */
82#define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0)
83/* Amount of blocks needed for quota insert/delete - we do some block writes
84 * but inode, sb and group updates are done only once */
85#define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
86 (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_INIT_REWRITE) : 0)
87#define EXT4_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
88 (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_DEL_REWRITE) : 0)
89#else
90#define EXT4_QUOTA_TRANS_BLOCKS(sb) 0
91#define EXT4_QUOTA_INIT_BLOCKS(sb) 0
92#define EXT4_QUOTA_DEL_BLOCKS(sb) 0
93#endif
94
95int
96ext4_mark_iloc_dirty(handle_t *handle,
97 struct inode *inode,
98 struct ext4_iloc *iloc);
99
100/*
101 * On success, We end up with an outstanding reference count against
102 * iloc->bh. This _must_ be cleaned up later.
103 */
104
105int ext4_reserve_inode_write(handle_t *handle, struct inode *inode,
106 struct ext4_iloc *iloc);
107
108int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode);
109
110/*
111 * Wrapper functions with which ext4 calls into JBD. The intent here is
112 * to allow these to be turned into appropriate stubs so ext4 can control
113 * ext2 filesystems, so ext2+ext4 systems only nee one fs. This work hasn't
114 * been done yet.
115 */
116
117void ext4_journal_abort_handle(const char *caller, const char *err_fn,
118 struct buffer_head *bh, handle_t *handle, int err);
119
120static inline int
121__ext4_journal_get_undo_access(const char *where, handle_t *handle,
122 struct buffer_head *bh)
123{
124 int err = jbd2_journal_get_undo_access(handle, bh);
125 if (err)
126 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
127 return err;
128}
129
130static inline int
131__ext4_journal_get_write_access(const char *where, handle_t *handle,
132 struct buffer_head *bh)
133{
134 int err = jbd2_journal_get_write_access(handle, bh);
135 if (err)
136 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
137 return err;
138}
139
140static inline void
141ext4_journal_release_buffer(handle_t *handle, struct buffer_head *bh)
142{
143 jbd2_journal_release_buffer(handle, bh);
144}
145
146static inline int
147__ext4_journal_forget(const char *where, handle_t *handle, struct buffer_head *bh)
148{
149 int err = jbd2_journal_forget(handle, bh);
150 if (err)
151 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
152 return err;
153}
154
155static inline int
156__ext4_journal_revoke(const char *where, handle_t *handle,
157 ext4_fsblk_t blocknr, struct buffer_head *bh)
158{
159 int err = jbd2_journal_revoke(handle, blocknr, bh);
160 if (err)
161 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
162 return err;
163}
164
165static inline int
166__ext4_journal_get_create_access(const char *where,
167 handle_t *handle, struct buffer_head *bh)
168{
169 int err = jbd2_journal_get_create_access(handle, bh);
170 if (err)
171 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
172 return err;
173}
174
175static inline int
176__ext4_journal_dirty_metadata(const char *where,
177 handle_t *handle, struct buffer_head *bh)
178{
179 int err = jbd2_journal_dirty_metadata(handle, bh);
180 if (err)
181 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
182 return err;
183}
184
185
186#define ext4_journal_get_undo_access(handle, bh) \
187 __ext4_journal_get_undo_access(__FUNCTION__, (handle), (bh))
188#define ext4_journal_get_write_access(handle, bh) \
189 __ext4_journal_get_write_access(__FUNCTION__, (handle), (bh))
190#define ext4_journal_revoke(handle, blocknr, bh) \
191 __ext4_journal_revoke(__FUNCTION__, (handle), (blocknr), (bh))
192#define ext4_journal_get_create_access(handle, bh) \
193 __ext4_journal_get_create_access(__FUNCTION__, (handle), (bh))
194#define ext4_journal_dirty_metadata(handle, bh) \
195 __ext4_journal_dirty_metadata(__FUNCTION__, (handle), (bh))
196#define ext4_journal_forget(handle, bh) \
197 __ext4_journal_forget(__FUNCTION__, (handle), (bh))
198
199int ext4_journal_dirty_data(handle_t *handle, struct buffer_head *bh);
200
201handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks);
202int __ext4_journal_stop(const char *where, handle_t *handle);
203
204static inline handle_t *ext4_journal_start(struct inode *inode, int nblocks)
205{
206 return ext4_journal_start_sb(inode->i_sb, nblocks);
207}
208
209#define ext4_journal_stop(handle) \
210 __ext4_journal_stop(__FUNCTION__, (handle))
211
212static inline handle_t *ext4_journal_current_handle(void)
213{
214 return journal_current_handle();
215}
216
217static inline int ext4_journal_extend(handle_t *handle, int nblocks)
218{
219 return jbd2_journal_extend(handle, nblocks);
220}
221
222static inline int ext4_journal_restart(handle_t *handle, int nblocks)
223{
224 return jbd2_journal_restart(handle, nblocks);
225}
226
227static inline int ext4_journal_blocks_per_page(struct inode *inode)
228{
229 return jbd2_journal_blocks_per_page(inode);
230}
231
232static inline int ext4_journal_force_commit(journal_t *journal)
233{
234 return jbd2_journal_force_commit(journal);
235}
236
237/* super.c */
238int ext4_force_commit(struct super_block *sb);
239
240static inline int ext4_should_journal_data(struct inode *inode)
241{
242 if (!S_ISREG(inode->i_mode))
243 return 1;
244 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
245 return 1;
246 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
247 return 1;
248 return 0;
249}
250
251static inline int ext4_should_order_data(struct inode *inode)
252{
253 if (!S_ISREG(inode->i_mode))
254 return 0;
255 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
256 return 0;
257 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
258 return 1;
259 return 0;
260}
261
262static inline int ext4_should_writeback_data(struct inode *inode)
263{
264 if (!S_ISREG(inode->i_mode))
265 return 0;
266 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
267 return 0;
268 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
269 return 1;
270 return 0;
271}
272
273#endif /* _LINUX_EXT4_JBD_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 34406ed467c3..2fe6e3f900ba 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -623,6 +623,9 @@ enum inode_i_mutex_lock_class
623 I_MUTEX_QUOTA 623 I_MUTEX_QUOTA
624}; 624};
625 625
626extern void inode_double_lock(struct inode *inode1, struct inode *inode2);
627extern void inode_double_unlock(struct inode *inode1, struct inode *inode2);
628
626/* 629/*
627 * NOTE: in a 32bit arch with a preemptable kernel and 630 * NOTE: in a 32bit arch with a preemptable kernel and
628 * an UP compile the i_size_read/write must be atomic 631 * an UP compile the i_size_read/write must be atomic
@@ -656,7 +659,11 @@ static inline loff_t i_size_read(struct inode *inode)
656#endif 659#endif
657} 660}
658 661
659 662/*
663 * NOTE: unlike i_size_read(), i_size_write() does need locking around it
664 * (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount
665 * can be lost, resulting in subsequent i_size_read() calls spinning forever.
666 */
660static inline void i_size_write(struct inode *inode, loff_t i_size) 667static inline void i_size_write(struct inode *inode, loff_t i_size)
661{ 668{
662#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 669#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
@@ -1705,6 +1712,8 @@ extern void __iget(struct inode * inode);
1705extern void clear_inode(struct inode *); 1712extern void clear_inode(struct inode *);
1706extern void destroy_inode(struct inode *); 1713extern void destroy_inode(struct inode *);
1707extern struct inode *new_inode(struct super_block *); 1714extern struct inode *new_inode(struct super_block *);
1715extern int __remove_suid(struct dentry *, int);
1716extern int should_remove_suid(struct dentry *);
1708extern int remove_suid(struct dentry *); 1717extern int remove_suid(struct dentry *);
1709extern void remove_dquot_ref(struct super_block *, int, struct list_head *); 1718extern void remove_dquot_ref(struct super_block *, int, struct list_head *);
1710 1719
@@ -1751,6 +1760,8 @@ extern ssize_t generic_file_splice_read(struct file *, loff_t *,
1751 struct pipe_inode_info *, size_t, unsigned int); 1760 struct pipe_inode_info *, size_t, unsigned int);
1752extern ssize_t generic_file_splice_write(struct pipe_inode_info *, 1761extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
1753 struct file *, loff_t *, size_t, unsigned int); 1762 struct file *, loff_t *, size_t, unsigned int);
1763extern ssize_t generic_file_splice_write_nolock(struct pipe_inode_info *,
1764 struct file *, loff_t *, size_t, unsigned int);
1754extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 1765extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
1755 struct file *out, loff_t *, size_t len, unsigned int flags); 1766 struct file *out, loff_t *, size_t len, unsigned int flags);
1756extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, 1767extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
diff --git a/include/linux/htirq.h b/include/linux/htirq.h
index 1f15ce279a23..c96ea46737d0 100644
--- a/include/linux/htirq.h
+++ b/include/linux/htirq.h
@@ -1,15 +1,23 @@
1#ifndef LINUX_HTIRQ_H 1#ifndef LINUX_HTIRQ_H
2#define LINUX_HTIRQ_H 2#define LINUX_HTIRQ_H
3 3
4struct ht_irq_msg {
5 u32 address_lo; /* low 32 bits of the ht irq message */
6 u32 address_hi; /* high 32 bits of the it irq message */
7};
8
4/* Helper functions.. */ 9/* Helper functions.. */
5void write_ht_irq_low(unsigned int irq, u32 data); 10void fetch_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg);
6void write_ht_irq_high(unsigned int irq, u32 data); 11void write_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg);
7u32 read_ht_irq_low(unsigned int irq);
8u32 read_ht_irq_high(unsigned int irq);
9void mask_ht_irq(unsigned int irq); 12void mask_ht_irq(unsigned int irq);
10void unmask_ht_irq(unsigned int irq); 13void unmask_ht_irq(unsigned int irq);
11 14
12/* The arch hook for getting things started */ 15/* The arch hook for getting things started */
13int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev); 16int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev);
14 17
18/* For drivers of buggy hardware */
19typedef void (ht_irq_update_t)(struct pci_dev *dev, int irq,
20 struct ht_irq_msg *msg);
21int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update);
22
15#endif /* LINUX_HTIRQ_H */ 23#endif /* LINUX_HTIRQ_H */
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index c25a38d8f600..ace64e57e17f 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -17,6 +17,7 @@ int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *
17int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 17int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
18int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int); 18int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int);
19void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); 19void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
20void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
20int hugetlb_prefault(struct address_space *, struct vm_area_struct *); 21int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
21int hugetlb_report_meminfo(char *); 22int hugetlb_report_meminfo(char *);
22int hugetlb_report_node_meminfo(int, char *); 23int hugetlb_report_node_meminfo(int, char *);
@@ -59,8 +60,11 @@ void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
59 * If the arch doesn't supply something else, assume that hugepage 60 * If the arch doesn't supply something else, assume that hugepage
60 * size aligned regions are ok without further preparation. 61 * size aligned regions are ok without further preparation.
61 */ 62 */
62static inline int prepare_hugepage_range(unsigned long addr, unsigned long len) 63static inline int prepare_hugepage_range(unsigned long addr, unsigned long len,
64 pgoff_t pgoff)
63{ 65{
66 if (pgoff & (~HPAGE_MASK >> PAGE_SHIFT))
67 return -EINVAL;
64 if (len & ~HPAGE_MASK) 68 if (len & ~HPAGE_MASK)
65 return -EINVAL; 69 return -EINVAL;
66 if (addr & ~HPAGE_MASK) 70 if (addr & ~HPAGE_MASK)
@@ -68,7 +72,8 @@ static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
68 return 0; 72 return 0;
69} 73}
70#else 74#else
71int prepare_hugepage_range(unsigned long addr, unsigned long len); 75int prepare_hugepage_range(unsigned long addr, unsigned long len,
76 pgoff_t pgoff);
72#endif 77#endif
73 78
74#ifndef ARCH_HAS_SETCLEAR_HUGE_PTE 79#ifndef ARCH_HAS_SETCLEAR_HUGE_PTE
@@ -106,7 +111,7 @@ static inline unsigned long hugetlb_total_pages(void)
106#define hugetlb_report_meminfo(buf) 0 111#define hugetlb_report_meminfo(buf) 0
107#define hugetlb_report_node_meminfo(n, buf) 0 112#define hugetlb_report_node_meminfo(n, buf) 0
108#define follow_huge_pmd(mm, addr, pmd, write) NULL 113#define follow_huge_pmd(mm, addr, pmd, write) NULL
109#define prepare_hugepage_range(addr, len) (-EINVAL) 114#define prepare_hugepage_range(addr,len,pgoff) (-EINVAL)
110#define pmd_huge(x) 0 115#define pmd_huge(x) 0
111#define is_hugepage_only_range(mm, addr, len) 0 116#define is_hugepage_only_range(mm, addr, len) 0
112#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) 117#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 03f43e2893a4..21dd56905271 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -191,7 +191,7 @@ struct ip_mc_list
191#define IGMPV3_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value)) 191#define IGMPV3_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value))
192#define IGMPV3_EXP(thresh, nbmant, nbexp, value) \ 192#define IGMPV3_EXP(thresh, nbmant, nbexp, value) \
193 ((value) < (thresh) ? (value) : \ 193 ((value) < (thresh) ? (value) : \
194 ((IGMPV3_MASK(value, nbmant) | (1<<(nbmant+nbexp))) << \ 194 ((IGMPV3_MASK(value, nbmant) | (1<<(nbmant))) << \
195 (IGMPV3_MASK((value) >> (nbmant), nbexp) + (nbexp)))) 195 (IGMPV3_MASK((value) >> (nbmant), nbexp) + (nbexp))))
196 196
197#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) 197#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 9be6a4756f0b..f28621f638e0 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -225,7 +225,7 @@ struct in6_flowlabel_req
225#endif 225#endif
226 226
227/* 227/*
228 * Netfilter 228 * Netfilter (1)
229 * 229 *
230 * Following socket options are used in ip6_tables; 230 * Following socket options are used in ip6_tables;
231 * see include/linux/netfilter_ipv6/ip6_tables.h. 231 * see include/linux/netfilter_ipv6/ip6_tables.h.
@@ -240,4 +240,14 @@ struct in6_flowlabel_req
240#define IPV6_RECVTCLASS 66 240#define IPV6_RECVTCLASS 66
241#define IPV6_TCLASS 67 241#define IPV6_TCLASS 67
242 242
243/*
244 * Netfilter (2)
245 *
246 * Following socket options are used in ip6_tables;
247 * see include/linux/netfilter_ipv6/ip6_tables.h.
248 *
249 * IP6T_SO_GET_REVISION_MATCH 68
250 * IP6T_SO_GET_REVISION_TARGET 69
251 */
252
243#endif 253#endif
diff --git a/include/linux/init.h b/include/linux/init.h
index e92b1455d7af..5eb5d24b7680 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -84,19 +84,37 @@ extern void setup_arch(char **);
84 * by link order. 84 * by link order.
85 * For backwards compatibility, initcall() puts the call in 85 * For backwards compatibility, initcall() puts the call in
86 * the device init subsection. 86 * the device init subsection.
87 *
88 * The `id' arg to __define_initcall() is needed so that multiple initcalls
89 * can point at the same handler without causing duplicate-symbol build errors.
87 */ 90 */
88 91
89#define __define_initcall(level,fn) \ 92#define __define_initcall(level,fn,id) \
90 static initcall_t __initcall_##fn __attribute_used__ \ 93 static initcall_t __initcall_##fn##id __attribute_used__ \
91 __attribute__((__section__(".initcall" level ".init"))) = fn 94 __attribute__((__section__(".initcall" level ".init"))) = fn
92 95
93#define core_initcall(fn) __define_initcall("1",fn) 96/*
94#define postcore_initcall(fn) __define_initcall("2",fn) 97 * A "pure" initcall has no dependencies on anything else, and purely
95#define arch_initcall(fn) __define_initcall("3",fn) 98 * initializes variables that couldn't be statically initialized.
96#define subsys_initcall(fn) __define_initcall("4",fn) 99 *
97#define fs_initcall(fn) __define_initcall("5",fn) 100 * This only exists for built-in code, not for modules.
98#define device_initcall(fn) __define_initcall("6",fn) 101 */
99#define late_initcall(fn) __define_initcall("7",fn) 102#define pure_initcall(fn) __define_initcall("0",fn,1)
103
104#define core_initcall(fn) __define_initcall("1",fn,1)
105#define core_initcall_sync(fn) __define_initcall("1s",fn,1s)
106#define postcore_initcall(fn) __define_initcall("2",fn,2)
107#define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s)
108#define arch_initcall(fn) __define_initcall("3",fn,3)
109#define arch_initcall_sync(fn) __define_initcall("3s",fn,3s)
110#define subsys_initcall(fn) __define_initcall("4",fn,4)
111#define subsys_initcall_sync(fn) __define_initcall("4s",fn,4s)
112#define fs_initcall(fn) __define_initcall("5",fn,5)
113#define fs_initcall_sync(fn) __define_initcall("5s",fn,5s)
114#define device_initcall(fn) __define_initcall("6",fn,6)
115#define device_initcall_sync(fn) __define_initcall("6s",fn,6s)
116#define late_initcall(fn) __define_initcall("7",fn,7)
117#define late_initcall_sync(fn) __define_initcall("7s",fn,7s)
100 118
101#define __initcall(fn) device_initcall(fn) 119#define __initcall(fn) device_initcall(fn)
102 120
diff --git a/include/linux/io.h b/include/linux/io.h
index 2ad96c3f0e4e..81877ea39309 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -28,4 +28,31 @@ void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
28int ioremap_page_range(unsigned long addr, unsigned long end, 28int ioremap_page_range(unsigned long addr, unsigned long end,
29 unsigned long phys_addr, pgprot_t prot); 29 unsigned long phys_addr, pgprot_t prot);
30 30
31/**
32 * check_signature - find BIOS signatures
33 * @io_addr: mmio address to check
34 * @signature: signature block
35 * @length: length of signature
36 *
37 * Perform a signature comparison with the mmio address io_addr. This
38 * address should have been obtained by ioremap.
39 * Returns 1 on a match.
40 */
41
42static inline int check_signature(const volatile void __iomem *io_addr,
43 const unsigned char *signature, int length)
44{
45 int retval = 0;
46 do {
47 if (readb(io_addr) != *signature)
48 goto out;
49 io_addr++;
50 signature++;
51 length--;
52 } while (length);
53 retval = 1;
54out:
55 return retval;
56}
57
31#endif /* _LINUX_IO_H */ 58#endif /* _LINUX_IO_H */
diff --git a/include/linux/ipmi_msgdefs.h b/include/linux/ipmi_msgdefs.h
index 22f5e2afda4f..4d04d8b58a0a 100644
--- a/include/linux/ipmi_msgdefs.h
+++ b/include/linux/ipmi_msgdefs.h
@@ -75,6 +75,8 @@
75#define IPMI_INVALID_COMMAND_ERR 0xc1 75#define IPMI_INVALID_COMMAND_ERR 0xc1
76#define IPMI_ERR_MSG_TRUNCATED 0xc6 76#define IPMI_ERR_MSG_TRUNCATED 0xc6
77#define IPMI_LOST_ARBITRATION_ERR 0x81 77#define IPMI_LOST_ARBITRATION_ERR 0x81
78#define IPMI_BUS_ERR 0x82
79#define IPMI_NAK_ON_WRITE_ERR 0x83
78#define IPMI_ERR_UNSPECIFIED 0xff 80#define IPMI_ERR_UNSPECIFIED 0xff
79 81
80#define IPMI_CHANNEL_PROTOCOL_IPMB 1 82#define IPMI_CHANNEL_PROTOCOL_IPMB 1
diff --git a/include/linux/ipx.h b/include/linux/ipx.h
index 4f29c60964c4..eb19b4ea84f4 100644
--- a/include/linux/ipx.h
+++ b/include/linux/ipx.h
@@ -7,8 +7,8 @@
7 7
8struct sockaddr_ipx { 8struct sockaddr_ipx {
9 sa_family_t sipx_family; 9 sa_family_t sipx_family;
10 __u16 sipx_port; 10 __be16 sipx_port;
11 __u32 sipx_network; 11 __be32 sipx_network;
12 unsigned char sipx_node[IPX_NODE_LEN]; 12 unsigned char sipx_node[IPX_NODE_LEN];
13 __u8 sipx_type; 13 __u8 sipx_type;
14 unsigned char sipx_zero; /* 16 byte fill */ 14 unsigned char sipx_zero; /* 16 byte fill */
@@ -23,13 +23,13 @@ struct sockaddr_ipx {
23#define IPX_CRTITF 1 23#define IPX_CRTITF 1
24 24
25struct ipx_route_definition { 25struct ipx_route_definition {
26 __u32 ipx_network; 26 __be32 ipx_network;
27 __u32 ipx_router_network; 27 __be32 ipx_router_network;
28 unsigned char ipx_router_node[IPX_NODE_LEN]; 28 unsigned char ipx_router_node[IPX_NODE_LEN];
29}; 29};
30 30
31struct ipx_interface_definition { 31struct ipx_interface_definition {
32 __u32 ipx_network; 32 __be32 ipx_network;
33 unsigned char ipx_device[16]; 33 unsigned char ipx_device[16];
34 unsigned char ipx_dlink_type; 34 unsigned char ipx_dlink_type;
35#define IPX_FRAME_NONE 0 35#define IPX_FRAME_NONE 0
@@ -55,8 +55,8 @@ struct ipx_config_data {
55 */ 55 */
56 56
57struct ipx_route_def { 57struct ipx_route_def {
58 __u32 ipx_network; 58 __be32 ipx_network;
59 __u32 ipx_router_network; 59 __be32 ipx_router_network;
60#define IPX_ROUTE_NO_ROUTER 0 60#define IPX_ROUTE_NO_ROUTER 0
61 unsigned char ipx_router_node[IPX_NODE_LEN]; 61 unsigned char ipx_router_node[IPX_NODE_LEN];
62 unsigned char ipx_device[16]; 62 unsigned char ipx_device[16];
diff --git a/include/linux/irq.h b/include/linux/irq.h
index c64f3cc7e870..52fc4052a0ae 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -141,6 +141,7 @@ struct irq_chip {
141 * @pending_mask: pending rebalanced interrupts 141 * @pending_mask: pending rebalanced interrupts
142 * @dir: /proc/irq/ procfs entry 142 * @dir: /proc/irq/ procfs entry
143 * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP 143 * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP
144 * @name: flow handler name for /proc/interrupts output
144 * 145 *
145 * Pad this out to 32 bytes for cache and indexing reasons. 146 * Pad this out to 32 bytes for cache and indexing reasons.
146 */ 147 */
@@ -165,8 +166,9 @@ struct irq_desc {
165 cpumask_t pending_mask; 166 cpumask_t pending_mask;
166#endif 167#endif
167#ifdef CONFIG_PROC_FS 168#ifdef CONFIG_PROC_FS
168 struct proc_dir_entry *dir; 169 struct proc_dir_entry *dir;
169#endif 170#endif
171 const char *name;
170} ____cacheline_aligned; 172} ____cacheline_aligned;
171 173
172extern struct irq_desc irq_desc[NR_IRQS]; 174extern struct irq_desc irq_desc[NR_IRQS];
@@ -272,12 +274,6 @@ extern void fastcall handle_percpu_irq(unsigned int irq, struct irq_desc *desc);
272extern void fastcall handle_bad_irq(unsigned int irq, struct irq_desc *desc); 274extern void fastcall handle_bad_irq(unsigned int irq, struct irq_desc *desc);
273 275
274/* 276/*
275 * Get a descriptive string for the highlevel handler, for
276 * /proc/interrupts output:
277 */
278extern const char *handle_irq_name(irq_flow_handler_t handle);
279
280/*
281 * Monolithic do_IRQ implementation. 277 * Monolithic do_IRQ implementation.
282 * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly) 278 * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly)
283 */ 279 */
@@ -329,7 +325,12 @@ extern void
329set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip, 325set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
330 irq_flow_handler_t handle); 326 irq_flow_handler_t handle);
331extern void 327extern void
332__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained); 328set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
329 irq_flow_handler_t handle, const char *name);
330
331extern void
332__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
333 const char *name);
333 334
334/* 335/*
335 * Set a highlevel flow handler for a given IRQ: 336 * Set a highlevel flow handler for a given IRQ:
@@ -337,7 +338,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained);
337static inline void 338static inline void
338set_irq_handler(unsigned int irq, irq_flow_handler_t handle) 339set_irq_handler(unsigned int irq, irq_flow_handler_t handle)
339{ 340{
340 __set_irq_handler(irq, handle, 0); 341 __set_irq_handler(irq, handle, 0, NULL);
341} 342}
342 343
343/* 344/*
@@ -349,7 +350,7 @@ static inline void
349set_irq_chained_handler(unsigned int irq, 350set_irq_chained_handler(unsigned int irq,
350 irq_flow_handler_t handle) 351 irq_flow_handler_t handle)
351{ 352{
352 __set_irq_handler(irq, handle, 1); 353 __set_irq_handler(irq, handle, 1, NULL);
353} 354}
354 355
355/* Handle dynamic irq creation and destruction */ 356/* Handle dynamic irq creation and destruction */
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
new file mode 100644
index 000000000000..ddb128795781
--- /dev/null
+++ b/include/linux/jbd2.h
@@ -0,0 +1,1107 @@
1/*
2 * linux/include/linux/jbd2.h
3 *
4 * Written by Stephen C. Tweedie <sct@redhat.com>
5 *
6 * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
7 *
8 * This file is part of the Linux kernel and is made available under
9 * the terms of the GNU General Public License, version 2, or at your
10 * option, any later version, incorporated herein by reference.
11 *
12 * Definitions for transaction data structures for the buffer cache
13 * filesystem journaling support.
14 */
15
16#ifndef _LINUX_JBD_H
17#define _LINUX_JBD_H
18
19/* Allow this file to be included directly into e2fsprogs */
20#ifndef __KERNEL__
21#include "jfs_compat.h"
22#define JBD2_DEBUG
23#define jfs_debug jbd_debug
24#else
25
26#include <linux/types.h>
27#include <linux/buffer_head.h>
28#include <linux/journal-head.h>
29#include <linux/stddef.h>
30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h>
32#include <linux/timer.h>
33
34#include <asm/semaphore.h>
35#endif
36
37#define journal_oom_retry 1
38
39/*
40 * Define JBD_PARANIOD_IOFAIL to cause a kernel BUG() if ext3 finds
41 * certain classes of error which can occur due to failed IOs. Under
42 * normal use we want ext3 to continue after such errors, because
43 * hardware _can_ fail, but for debugging purposes when running tests on
44 * known-good hardware we may want to trap these errors.
45 */
46#undef JBD_PARANOID_IOFAIL
47
48/*
49 * The default maximum commit age, in seconds.
50 */
51#define JBD_DEFAULT_MAX_COMMIT_AGE 5
52
53#ifdef CONFIG_JBD_DEBUG
54/*
55 * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal
56 * consistency checks. By default we don't do this unless
57 * CONFIG_JBD_DEBUG is on.
58 */
59#define JBD_EXPENSIVE_CHECKING
60extern int jbd2_journal_enable_debug;
61
62#define jbd_debug(n, f, a...) \
63 do { \
64 if ((n) <= jbd2_journal_enable_debug) { \
65 printk (KERN_DEBUG "(%s, %d): %s: ", \
66 __FILE__, __LINE__, __FUNCTION__); \
67 printk (f, ## a); \
68 } \
69 } while (0)
70#else
71#define jbd_debug(f, a...) /**/
72#endif
73
74extern void * __jbd2_kmalloc (const char *where, size_t size, gfp_t flags, int retry);
75extern void * jbd2_slab_alloc(size_t size, gfp_t flags);
76extern void jbd2_slab_free(void *ptr, size_t size);
77
78#define jbd_kmalloc(size, flags) \
79 __jbd2_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry)
80#define jbd_rep_kmalloc(size, flags) \
81 __jbd2_kmalloc(__FUNCTION__, (size), (flags), 1)
82
83#define JBD2_MIN_JOURNAL_BLOCKS 1024
84
85#ifdef __KERNEL__
86
87/**
88 * typedef handle_t - The handle_t type represents a single atomic update being performed by some process.
89 *
90 * All filesystem modifications made by the process go
91 * through this handle. Recursive operations (such as quota operations)
92 * are gathered into a single update.
93 *
94 * The buffer credits field is used to account for journaled buffers
95 * being modified by the running process. To ensure that there is
96 * enough log space for all outstanding operations, we need to limit the
97 * number of outstanding buffers possible at any time. When the
98 * operation completes, any buffer credits not used are credited back to
99 * the transaction, so that at all times we know how many buffers the
100 * outstanding updates on a transaction might possibly touch.
101 *
102 * This is an opaque datatype.
103 **/
104typedef struct handle_s handle_t; /* Atomic operation type */
105
106
107/**
108 * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem.
109 *
110 * journal_t is linked to from the fs superblock structure.
111 *
112 * We use the journal_t to keep track of all outstanding transaction
113 * activity on the filesystem, and to manage the state of the log
114 * writing process.
115 *
116 * This is an opaque datatype.
117 **/
118typedef struct journal_s journal_t; /* Journal control structure */
119#endif
120
121/*
122 * Internal structures used by the logging mechanism:
123 */
124
125#define JBD2_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
126
127/*
128 * On-disk structures
129 */
130
131/*
132 * Descriptor block types:
133 */
134
135#define JBD2_DESCRIPTOR_BLOCK 1
136#define JBD2_COMMIT_BLOCK 2
137#define JBD2_SUPERBLOCK_V1 3
138#define JBD2_SUPERBLOCK_V2 4
139#define JBD2_REVOKE_BLOCK 5
140
141/*
142 * Standard header for all descriptor blocks:
143 */
144typedef struct journal_header_s
145{
146 __be32 h_magic;
147 __be32 h_blocktype;
148 __be32 h_sequence;
149} journal_header_t;
150
151
152/*
153 * The block tag: used to describe a single buffer in the journal.
154 * t_blocknr_high is only used if INCOMPAT_64BIT is set, so this
155 * raw struct shouldn't be used for pointer math or sizeof() - use
156 * journal_tag_bytes(journal) instead to compute this.
157 */
158typedef struct journal_block_tag_s
159{
160 __be32 t_blocknr; /* The on-disk block number */
161 __be32 t_flags; /* See below */
162 __be32 t_blocknr_high; /* most-significant high 32bits. */
163} journal_block_tag_t;
164
165#define JBD_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high))
166#define JBD_TAG_SIZE64 (sizeof(journal_block_tag_t))
167
168/*
169 * The revoke descriptor: used on disk to describe a series of blocks to
170 * be revoked from the log
171 */
172typedef struct jbd2_journal_revoke_header_s
173{
174 journal_header_t r_header;
175 __be32 r_count; /* Count of bytes used in the block */
176} jbd2_journal_revoke_header_t;
177
178
179/* Definitions for the journal tag flags word: */
180#define JBD2_FLAG_ESCAPE 1 /* on-disk block is escaped */
181#define JBD2_FLAG_SAME_UUID 2 /* block has same uuid as previous */
182#define JBD2_FLAG_DELETED 4 /* block deleted by this transaction */
183#define JBD2_FLAG_LAST_TAG 8 /* last tag in this descriptor block */
184
185
186/*
187 * The journal superblock. All fields are in big-endian byte order.
188 */
189typedef struct journal_superblock_s
190{
191/* 0x0000 */
192 journal_header_t s_header;
193
194/* 0x000C */
195 /* Static information describing the journal */
196 __be32 s_blocksize; /* journal device blocksize */
197 __be32 s_maxlen; /* total blocks in journal file */
198 __be32 s_first; /* first block of log information */
199
200/* 0x0018 */
201 /* Dynamic information describing the current state of the log */
202 __be32 s_sequence; /* first commit ID expected in log */
203 __be32 s_start; /* blocknr of start of log */
204
205/* 0x0020 */
206 /* Error value, as set by jbd2_journal_abort(). */
207 __be32 s_errno;
208
209/* 0x0024 */
210 /* Remaining fields are only valid in a version-2 superblock */
211 __be32 s_feature_compat; /* compatible feature set */
212 __be32 s_feature_incompat; /* incompatible feature set */
213 __be32 s_feature_ro_compat; /* readonly-compatible feature set */
214/* 0x0030 */
215 __u8 s_uuid[16]; /* 128-bit uuid for journal */
216
217/* 0x0040 */
218 __be32 s_nr_users; /* Nr of filesystems sharing log */
219
220 __be32 s_dynsuper; /* Blocknr of dynamic superblock copy*/
221
222/* 0x0048 */
223 __be32 s_max_transaction; /* Limit of journal blocks per trans.*/
224 __be32 s_max_trans_data; /* Limit of data blocks per trans. */
225
226/* 0x0050 */
227 __u32 s_padding[44];
228
229/* 0x0100 */
230 __u8 s_users[16*48]; /* ids of all fs'es sharing the log */
231/* 0x0400 */
232} journal_superblock_t;
233
234#define JBD2_HAS_COMPAT_FEATURE(j,mask) \
235 ((j)->j_format_version >= 2 && \
236 ((j)->j_superblock->s_feature_compat & cpu_to_be32((mask))))
237#define JBD2_HAS_RO_COMPAT_FEATURE(j,mask) \
238 ((j)->j_format_version >= 2 && \
239 ((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask))))
240#define JBD2_HAS_INCOMPAT_FEATURE(j,mask) \
241 ((j)->j_format_version >= 2 && \
242 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
243
244#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001
245#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
246
247/* Features known to this kernel version: */
248#define JBD2_KNOWN_COMPAT_FEATURES 0
249#define JBD2_KNOWN_ROCOMPAT_FEATURES 0
250#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \
251 JBD2_FEATURE_INCOMPAT_64BIT)
252
253#ifdef __KERNEL__
254
255#include <linux/fs.h>
256#include <linux/sched.h>
257
258#define JBD_ASSERTIONS
259#ifdef JBD_ASSERTIONS
260#define J_ASSERT(assert) \
261do { \
262 if (!(assert)) { \
263 printk (KERN_EMERG \
264 "Assertion failure in %s() at %s:%d: \"%s\"\n", \
265 __FUNCTION__, __FILE__, __LINE__, # assert); \
266 BUG(); \
267 } \
268} while (0)
269
270#if defined(CONFIG_BUFFER_DEBUG)
271void buffer_assertion_failure(struct buffer_head *bh);
272#define J_ASSERT_BH(bh, expr) \
273 do { \
274 if (!(expr)) \
275 buffer_assertion_failure(bh); \
276 J_ASSERT(expr); \
277 } while (0)
278#define J_ASSERT_JH(jh, expr) J_ASSERT_BH(jh2bh(jh), expr)
279#else
280#define J_ASSERT_BH(bh, expr) J_ASSERT(expr)
281#define J_ASSERT_JH(jh, expr) J_ASSERT(expr)
282#endif
283
284#else
285#define J_ASSERT(assert) do { } while (0)
286#endif /* JBD_ASSERTIONS */
287
288#if defined(JBD_PARANOID_IOFAIL)
289#define J_EXPECT(expr, why...) J_ASSERT(expr)
290#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr)
291#define J_EXPECT_JH(jh, expr, why...) J_ASSERT_JH(jh, expr)
292#else
293#define __journal_expect(expr, why...) \
294 ({ \
295 int val = (expr); \
296 if (!val) { \
297 printk(KERN_ERR \
298 "EXT3-fs unexpected failure: %s;\n",# expr); \
299 printk(KERN_ERR why "\n"); \
300 } \
301 val; \
302 })
303#define J_EXPECT(expr, why...) __journal_expect(expr, ## why)
304#define J_EXPECT_BH(bh, expr, why...) __journal_expect(expr, ## why)
305#define J_EXPECT_JH(jh, expr, why...) __journal_expect(expr, ## why)
306#endif
307
308enum jbd_state_bits {
309 BH_JBD /* Has an attached ext3 journal_head */
310 = BH_PrivateStart,
311 BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
312 BH_Freed, /* Has been freed (truncated) */
313 BH_Revoked, /* Has been revoked from the log */
314 BH_RevokeValid, /* Revoked flag is valid */
315 BH_JBDDirty, /* Is dirty but journaled */
316 BH_State, /* Pins most journal_head state */
317 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
318 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
319};
320
321BUFFER_FNS(JBD, jbd)
322BUFFER_FNS(JWrite, jwrite)
323BUFFER_FNS(JBDDirty, jbddirty)
324TAS_BUFFER_FNS(JBDDirty, jbddirty)
325BUFFER_FNS(Revoked, revoked)
326TAS_BUFFER_FNS(Revoked, revoked)
327BUFFER_FNS(RevokeValid, revokevalid)
328TAS_BUFFER_FNS(RevokeValid, revokevalid)
329BUFFER_FNS(Freed, freed)
330
331static inline struct buffer_head *jh2bh(struct journal_head *jh)
332{
333 return jh->b_bh;
334}
335
336static inline struct journal_head *bh2jh(struct buffer_head *bh)
337{
338 return bh->b_private;
339}
340
341static inline void jbd_lock_bh_state(struct buffer_head *bh)
342{
343 bit_spin_lock(BH_State, &bh->b_state);
344}
345
346static inline int jbd_trylock_bh_state(struct buffer_head *bh)
347{
348 return bit_spin_trylock(BH_State, &bh->b_state);
349}
350
351static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
352{
353 return bit_spin_is_locked(BH_State, &bh->b_state);
354}
355
356static inline void jbd_unlock_bh_state(struct buffer_head *bh)
357{
358 bit_spin_unlock(BH_State, &bh->b_state);
359}
360
361static inline void jbd_lock_bh_journal_head(struct buffer_head *bh)
362{
363 bit_spin_lock(BH_JournalHead, &bh->b_state);
364}
365
366static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
367{
368 bit_spin_unlock(BH_JournalHead, &bh->b_state);
369}
370
371struct jbd2_revoke_table_s;
372
373/**
374 * struct handle_s - The handle_s type is the concrete type associated with
375 * handle_t.
376 * @h_transaction: Which compound transaction is this update a part of?
377 * @h_buffer_credits: Number of remaining buffers we are allowed to dirty.
378 * @h_ref: Reference count on this handle
379 * @h_err: Field for caller's use to track errors through large fs operations
380 * @h_sync: flag for sync-on-close
381 * @h_jdata: flag to force data journaling
382 * @h_aborted: flag indicating fatal error on handle
383 **/
384
385/* Docbook can't yet cope with the bit fields, but will leave the documentation
386 * in so it can be fixed later.
387 */
388
389struct handle_s
390{
391 /* Which compound transaction is this update a part of? */
392 transaction_t *h_transaction;
393
394 /* Number of remaining buffers we are allowed to dirty: */
395 int h_buffer_credits;
396
397 /* Reference count on this handle */
398 int h_ref;
399
400 /* Field for caller's use to track errors through large fs */
401 /* operations */
402 int h_err;
403
404 /* Flags [no locking] */
405 unsigned int h_sync: 1; /* sync-on-close */
406 unsigned int h_jdata: 1; /* force data journaling */
407 unsigned int h_aborted: 1; /* fatal error on handle */
408};
409
410
411/* The transaction_t type is the guts of the journaling mechanism. It
412 * tracks a compound transaction through its various states:
413 *
414 * RUNNING: accepting new updates
415 * LOCKED: Updates still running but we don't accept new ones
416 * RUNDOWN: Updates are tidying up but have finished requesting
417 * new buffers to modify (state not used for now)
418 * FLUSH: All updates complete, but we are still writing to disk
419 * COMMIT: All data on disk, writing commit record
420 * FINISHED: We still have to keep the transaction for checkpointing.
421 *
422 * The transaction keeps track of all of the buffers modified by a
423 * running transaction, and all of the buffers committed but not yet
424 * flushed to home for finished transactions.
425 */
426
427/*
428 * Lock ranking:
429 *
430 * j_list_lock
431 * ->jbd_lock_bh_journal_head() (This is "innermost")
432 *
433 * j_state_lock
434 * ->jbd_lock_bh_state()
435 *
436 * jbd_lock_bh_state()
437 * ->j_list_lock
438 *
439 * j_state_lock
440 * ->t_handle_lock
441 *
442 * j_state_lock
443 * ->j_list_lock (journal_unmap_buffer)
444 *
445 */
446
447struct transaction_s
448{
449 /* Pointer to the journal for this transaction. [no locking] */
450 journal_t *t_journal;
451
452 /* Sequence number for this transaction [no locking] */
453 tid_t t_tid;
454
455 /*
456 * Transaction's current state
457 * [no locking - only kjournald2 alters this]
458 * FIXME: needs barriers
459 * KLUDGE: [use j_state_lock]
460 */
461 enum {
462 T_RUNNING,
463 T_LOCKED,
464 T_RUNDOWN,
465 T_FLUSH,
466 T_COMMIT,
467 T_FINISHED
468 } t_state;
469
470 /*
471 * Where in the log does this transaction's commit start? [no locking]
472 */
473 unsigned long t_log_start;
474
475 /* Number of buffers on the t_buffers list [j_list_lock] */
476 int t_nr_buffers;
477
478 /*
479 * Doubly-linked circular list of all buffers reserved but not yet
480 * modified by this transaction [j_list_lock]
481 */
482 struct journal_head *t_reserved_list;
483
484 /*
485 * Doubly-linked circular list of all buffers under writeout during
486 * commit [j_list_lock]
487 */
488 struct journal_head *t_locked_list;
489
490 /*
491 * Doubly-linked circular list of all metadata buffers owned by this
492 * transaction [j_list_lock]
493 */
494 struct journal_head *t_buffers;
495
496 /*
497 * Doubly-linked circular list of all data buffers still to be
498 * flushed before this transaction can be committed [j_list_lock]
499 */
500 struct journal_head *t_sync_datalist;
501
502 /*
503 * Doubly-linked circular list of all forget buffers (superseded
504 * buffers which we can un-checkpoint once this transaction commits)
505 * [j_list_lock]
506 */
507 struct journal_head *t_forget;
508
509 /*
510 * Doubly-linked circular list of all buffers still to be flushed before
511 * this transaction can be checkpointed. [j_list_lock]
512 */
513 struct journal_head *t_checkpoint_list;
514
515 /*
516 * Doubly-linked circular list of all buffers submitted for IO while
517 * checkpointing. [j_list_lock]
518 */
519 struct journal_head *t_checkpoint_io_list;
520
521 /*
522 * Doubly-linked circular list of temporary buffers currently undergoing
523 * IO in the log [j_list_lock]
524 */
525 struct journal_head *t_iobuf_list;
526
527 /*
528 * Doubly-linked circular list of metadata buffers being shadowed by log
529 * IO. The IO buffers on the iobuf list and the shadow buffers on this
530 * list match each other one for one at all times. [j_list_lock]
531 */
532 struct journal_head *t_shadow_list;
533
534 /*
535 * Doubly-linked circular list of control buffers being written to the
536 * log. [j_list_lock]
537 */
538 struct journal_head *t_log_list;
539
540 /*
541 * Protects info related to handles
542 */
543 spinlock_t t_handle_lock;
544
545 /*
546 * Number of outstanding updates running on this transaction
547 * [t_handle_lock]
548 */
549 int t_updates;
550
551 /*
552 * Number of buffers reserved for use by all handles in this transaction
553 * handle but not yet modified. [t_handle_lock]
554 */
555 int t_outstanding_credits;
556
557 /*
558 * Forward and backward links for the circular list of all transactions
559 * awaiting checkpoint. [j_list_lock]
560 */
561 transaction_t *t_cpnext, *t_cpprev;
562
563 /*
564 * When will the transaction expire (become due for commit), in jiffies?
565 * [no locking]
566 */
567 unsigned long t_expires;
568
569 /*
570 * How many handles used this transaction? [t_handle_lock]
571 */
572 int t_handle_count;
573
574};
575
576/**
577 * struct journal_s - The journal_s type is the concrete type associated with
578 * journal_t.
579 * @j_flags: General journaling state flags
580 * @j_errno: Is there an outstanding uncleared error on the journal (from a
581 * prior abort)?
582 * @j_sb_buffer: First part of superblock buffer
583 * @j_superblock: Second part of superblock buffer
584 * @j_format_version: Version of the superblock format
585 * @j_state_lock: Protect the various scalars in the journal
586 * @j_barrier_count: Number of processes waiting to create a barrier lock
587 * @j_barrier: The barrier lock itself
588 * @j_running_transaction: The current running transaction..
589 * @j_committing_transaction: the transaction we are pushing to disk
590 * @j_checkpoint_transactions: a linked circular list of all transactions
591 * waiting for checkpointing
592 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
593 * to start committing, or for a barrier lock to be released
594 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete
595 * @j_wait_done_commit: Wait queue for waiting for commit to complete
596 * @j_wait_checkpoint: Wait queue to trigger checkpointing
597 * @j_wait_commit: Wait queue to trigger commit
598 * @j_wait_updates: Wait queue to wait for updates to complete
599 * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
600 * @j_head: Journal head - identifies the first unused block in the journal
601 * @j_tail: Journal tail - identifies the oldest still-used block in the
602 * journal.
603 * @j_free: Journal free - how many free blocks are there in the journal?
604 * @j_first: The block number of the first usable block
605 * @j_last: The block number one beyond the last usable block
606 * @j_dev: Device where we store the journal
607 * @j_blocksize: blocksize for the location where we store the journal.
608 * @j_blk_offset: starting block offset for into the device where we store the
609 * journal
610 * @j_fs_dev: Device which holds the client fs. For internal journal this will
611 * be equal to j_dev
612 * @j_maxlen: Total maximum capacity of the journal region on disk.
613 * @j_list_lock: Protects the buffer lists and internal buffer state.
614 * @j_inode: Optional inode where we store the journal. If present, all journal
615 * block numbers are mapped into this inode via bmap().
616 * @j_tail_sequence: Sequence number of the oldest transaction in the log
617 * @j_transaction_sequence: Sequence number of the next transaction to grant
618 * @j_commit_sequence: Sequence number of the most recently committed
619 * transaction
620 * @j_commit_request: Sequence number of the most recent transaction wanting
621 * commit
622 * @j_uuid: Uuid of client object.
623 * @j_task: Pointer to the current commit thread for this journal
624 * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a
625 * single compound commit transaction
626 * @j_commit_interval: What is the maximum transaction lifetime before we begin
627 * a commit?
628 * @j_commit_timer: The timer used to wakeup the commit thread
629 * @j_revoke_lock: Protect the revoke table
630 * @j_revoke: The revoke table - maintains the list of revoked blocks in the
631 * current transaction.
632 * @j_revoke_table: alternate revoke tables for j_revoke
633 * @j_wbuf: array of buffer_heads for jbd2_journal_commit_transaction
634 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
635 * number that will fit in j_blocksize
636 * @j_last_sync_writer: most recent pid which did a synchronous write
637 * @j_private: An opaque pointer to fs-private information.
638 */
639
640struct journal_s
641{
642 /* General journaling state flags [j_state_lock] */
643 unsigned long j_flags;
644
645 /*
646 * Is there an outstanding uncleared error on the journal (from a prior
647 * abort)? [j_state_lock]
648 */
649 int j_errno;
650
651 /* The superblock buffer */
652 struct buffer_head *j_sb_buffer;
653 journal_superblock_t *j_superblock;
654
655 /* Version of the superblock format */
656 int j_format_version;
657
658 /*
659 * Protect the various scalars in the journal
660 */
661 spinlock_t j_state_lock;
662
663 /*
664 * Number of processes waiting to create a barrier lock [j_state_lock]
665 */
666 int j_barrier_count;
667
668 /* The barrier lock itself */
669 struct mutex j_barrier;
670
671 /*
672 * Transactions: The current running transaction...
673 * [j_state_lock] [caller holding open handle]
674 */
675 transaction_t *j_running_transaction;
676
677 /*
678 * the transaction we are pushing to disk
679 * [j_state_lock] [caller holding open handle]
680 */
681 transaction_t *j_committing_transaction;
682
683 /*
684 * ... and a linked circular list of all transactions waiting for
685 * checkpointing. [j_list_lock]
686 */
687 transaction_t *j_checkpoint_transactions;
688
689 /*
690 * Wait queue for waiting for a locked transaction to start committing,
691 * or for a barrier lock to be released
692 */
693 wait_queue_head_t j_wait_transaction_locked;
694
695 /* Wait queue for waiting for checkpointing to complete */
696 wait_queue_head_t j_wait_logspace;
697
698 /* Wait queue for waiting for commit to complete */
699 wait_queue_head_t j_wait_done_commit;
700
701 /* Wait queue to trigger checkpointing */
702 wait_queue_head_t j_wait_checkpoint;
703
704 /* Wait queue to trigger commit */
705 wait_queue_head_t j_wait_commit;
706
707 /* Wait queue to wait for updates to complete */
708 wait_queue_head_t j_wait_updates;
709
710 /* Semaphore for locking against concurrent checkpoints */
711 struct mutex j_checkpoint_mutex;
712
713 /*
714 * Journal head: identifies the first unused block in the journal.
715 * [j_state_lock]
716 */
717 unsigned long j_head;
718
719 /*
720 * Journal tail: identifies the oldest still-used block in the journal.
721 * [j_state_lock]
722 */
723 unsigned long j_tail;
724
725 /*
726 * Journal free: how many free blocks are there in the journal?
727 * [j_state_lock]
728 */
729 unsigned long j_free;
730
731 /*
732 * Journal start and end: the block numbers of the first usable block
733 * and one beyond the last usable block in the journal. [j_state_lock]
734 */
735 unsigned long j_first;
736 unsigned long j_last;
737
738 /*
739 * Device, blocksize and starting block offset for the location where we
740 * store the journal.
741 */
742 struct block_device *j_dev;
743 int j_blocksize;
744 unsigned long long j_blk_offset;
745
746 /*
747 * Device which holds the client fs. For internal journal this will be
748 * equal to j_dev.
749 */
750 struct block_device *j_fs_dev;
751
752 /* Total maximum capacity of the journal region on disk. */
753 unsigned int j_maxlen;
754
755 /*
756 * Protects the buffer lists and internal buffer state.
757 */
758 spinlock_t j_list_lock;
759
760 /* Optional inode where we store the journal. If present, all */
761 /* journal block numbers are mapped into this inode via */
762 /* bmap(). */
763 struct inode *j_inode;
764
765 /*
766 * Sequence number of the oldest transaction in the log [j_state_lock]
767 */
768 tid_t j_tail_sequence;
769
770 /*
771 * Sequence number of the next transaction to grant [j_state_lock]
772 */
773 tid_t j_transaction_sequence;
774
775 /*
776 * Sequence number of the most recently committed transaction
777 * [j_state_lock].
778 */
779 tid_t j_commit_sequence;
780
781 /*
782 * Sequence number of the most recent transaction wanting commit
783 * [j_state_lock]
784 */
785 tid_t j_commit_request;
786
787 /*
788 * Journal uuid: identifies the object (filesystem, LVM volume etc)
789 * backed by this journal. This will eventually be replaced by an array
790 * of uuids, allowing us to index multiple devices within a single
791 * journal and to perform atomic updates across them.
792 */
793 __u8 j_uuid[16];
794
795 /* Pointer to the current commit thread for this journal */
796 struct task_struct *j_task;
797
798 /*
799 * Maximum number of metadata buffers to allow in a single compound
800 * commit transaction
801 */
802 int j_max_transaction_buffers;
803
804 /*
805 * What is the maximum transaction lifetime before we begin a commit?
806 */
807 unsigned long j_commit_interval;
808
809 /* The timer used to wakeup the commit thread: */
810 struct timer_list j_commit_timer;
811
812 /*
813 * The revoke table: maintains the list of revoked blocks in the
814 * current transaction. [j_revoke_lock]
815 */
816 spinlock_t j_revoke_lock;
817 struct jbd2_revoke_table_s *j_revoke;
818 struct jbd2_revoke_table_s *j_revoke_table[2];
819
820 /*
821 * array of bhs for jbd2_journal_commit_transaction
822 */
823 struct buffer_head **j_wbuf;
824 int j_wbufsize;
825
826 pid_t j_last_sync_writer;
827
828 /*
829 * An opaque pointer to fs-private information. ext3 puts its
830 * superblock pointer here
831 */
832 void *j_private;
833};
834
835/*
836 * Journal flag definitions
837 */
838#define JBD2_UNMOUNT 0x001 /* Journal thread is being destroyed */
839#define JBD2_ABORT 0x002 /* Journaling has been aborted for errors. */
840#define JBD2_ACK_ERR 0x004 /* The errno in the sb has been acked */
841#define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */
842#define JBD2_LOADED 0x010 /* The journal superblock has been loaded */
843#define JBD2_BARRIER 0x020 /* Use IDE barriers */
844
845/*
846 * Function declarations for the journaling transaction and buffer
847 * management
848 */
849
850/* Filing buffers */
851extern void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh);
852extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *);
853extern void __jbd2_journal_unfile_buffer(struct journal_head *);
854extern void __jbd2_journal_refile_buffer(struct journal_head *);
855extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *);
856extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
857extern void __journal_free_buffer(struct journal_head *bh);
858extern void jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
859extern void __journal_clean_data_list(transaction_t *transaction);
860
861/* Log buffer allocation */
862extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *);
863int jbd2_journal_next_log_block(journal_t *, unsigned long long *);
864
865/* Commit management */
866extern void jbd2_journal_commit_transaction(journal_t *);
867
868/* Checkpoint list management */
869int __jbd2_journal_clean_checkpoint_list(journal_t *journal);
870int __jbd2_journal_remove_checkpoint(struct journal_head *);
871void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
872
873/* Buffer IO */
874extern int
875jbd2_journal_write_metadata_buffer(transaction_t *transaction,
876 struct journal_head *jh_in,
877 struct journal_head **jh_out,
878 unsigned long long blocknr);
879
880/* Transaction locking */
881extern void __wait_on_journal (journal_t *);
882
883/*
884 * Journal locking.
885 *
886 * We need to lock the journal during transaction state changes so that nobody
887 * ever tries to take a handle on the running transaction while we are in the
888 * middle of moving it to the commit phase. j_state_lock does this.
889 *
890 * Note that the locking is completely interrupt unsafe. We never touch
891 * journal structures from interrupts.
892 */
893
894static inline handle_t *journal_current_handle(void)
895{
896 return current->journal_info;
897}
898
899/* The journaling code user interface:
900 *
901 * Create and destroy handles
902 * Register buffer modifications against the current transaction.
903 */
904
905extern handle_t *jbd2_journal_start(journal_t *, int nblocks);
906extern int jbd2_journal_restart (handle_t *, int nblocks);
907extern int jbd2_journal_extend (handle_t *, int nblocks);
908extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
909extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
910extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *);
911extern int jbd2_journal_dirty_data (handle_t *, struct buffer_head *);
912extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
913extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *);
914extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
915extern void journal_sync_buffer (struct buffer_head *);
916extern void jbd2_journal_invalidatepage(journal_t *,
917 struct page *, unsigned long);
918extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
919extern int jbd2_journal_stop(handle_t *);
920extern int jbd2_journal_flush (journal_t *);
921extern void jbd2_journal_lock_updates (journal_t *);
922extern void jbd2_journal_unlock_updates (journal_t *);
923
924extern journal_t * jbd2_journal_init_dev(struct block_device *bdev,
925 struct block_device *fs_dev,
926 unsigned long long start, int len, int bsize);
927extern journal_t * jbd2_journal_init_inode (struct inode *);
928extern int jbd2_journal_update_format (journal_t *);
929extern int jbd2_journal_check_used_features
930 (journal_t *, unsigned long, unsigned long, unsigned long);
931extern int jbd2_journal_check_available_features
932 (journal_t *, unsigned long, unsigned long, unsigned long);
933extern int jbd2_journal_set_features
934 (journal_t *, unsigned long, unsigned long, unsigned long);
935extern int jbd2_journal_create (journal_t *);
936extern int jbd2_journal_load (journal_t *journal);
937extern void jbd2_journal_destroy (journal_t *);
938extern int jbd2_journal_recover (journal_t *journal);
939extern int jbd2_journal_wipe (journal_t *, int);
940extern int jbd2_journal_skip_recovery (journal_t *);
941extern void jbd2_journal_update_superblock (journal_t *, int);
942extern void __jbd2_journal_abort_hard (journal_t *);
943extern void jbd2_journal_abort (journal_t *, int);
944extern int jbd2_journal_errno (journal_t *);
945extern void jbd2_journal_ack_err (journal_t *);
946extern int jbd2_journal_clear_err (journal_t *);
947extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
948extern int jbd2_journal_force_commit(journal_t *);
949
950/*
951 * journal_head management
952 */
953struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh);
954struct journal_head *jbd2_journal_grab_journal_head(struct buffer_head *bh);
955void jbd2_journal_remove_journal_head(struct buffer_head *bh);
956void jbd2_journal_put_journal_head(struct journal_head *jh);
957
958/*
959 * handle management
960 */
961extern kmem_cache_t *jbd2_handle_cache;
962
963static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags)
964{
965 return kmem_cache_alloc(jbd2_handle_cache, gfp_flags);
966}
967
968static inline void jbd_free_handle(handle_t *handle)
969{
970 kmem_cache_free(jbd2_handle_cache, handle);
971}
972
973/* Primary revoke support */
974#define JOURNAL_REVOKE_DEFAULT_HASH 256
975extern int jbd2_journal_init_revoke(journal_t *, int);
976extern void jbd2_journal_destroy_revoke_caches(void);
977extern int jbd2_journal_init_revoke_caches(void);
978
979extern void jbd2_journal_destroy_revoke(journal_t *);
980extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *);
981extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *);
982extern void jbd2_journal_write_revoke_records(journal_t *, transaction_t *);
983
984/* Recovery revoke support */
985extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
986extern int jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t);
987extern void jbd2_journal_clear_revoke(journal_t *);
988extern void jbd2_journal_switch_revoke_table(journal_t *journal);
989
990/*
991 * The log thread user interface:
992 *
993 * Request space in the current transaction, and force transaction commit
994 * transitions on demand.
995 */
996
997int __jbd2_log_space_left(journal_t *); /* Called with journal locked */
998int jbd2_log_start_commit(journal_t *journal, tid_t tid);
999int __jbd2_log_start_commit(journal_t *journal, tid_t tid);
1000int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);
1001int jbd2_journal_force_commit_nested(journal_t *journal);
1002int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
1003int jbd2_log_do_checkpoint(journal_t *journal);
1004
1005void __jbd2_log_wait_for_space(journal_t *journal);
1006extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *);
1007extern int jbd2_cleanup_journal_tail(journal_t *);
1008
1009/* Debugging code only: */
1010
1011#define jbd_ENOSYS() \
1012do { \
1013 printk (KERN_ERR "JBD unimplemented function %s\n", __FUNCTION__); \
1014 current->state = TASK_UNINTERRUPTIBLE; \
1015 schedule(); \
1016} while (1)
1017
1018/*
1019 * is_journal_abort
1020 *
1021 * Simple test wrapper function to test the JBD2_ABORT state flag. This
1022 * bit, when set, indicates that we have had a fatal error somewhere,
1023 * either inside the journaling layer or indicated to us by the client
1024 * (eg. ext3), and that we and should not commit any further
1025 * transactions.
1026 */
1027
1028static inline int is_journal_aborted(journal_t *journal)
1029{
1030 return journal->j_flags & JBD2_ABORT;
1031}
1032
1033static inline int is_handle_aborted(handle_t *handle)
1034{
1035 if (handle->h_aborted)
1036 return 1;
1037 return is_journal_aborted(handle->h_transaction->t_journal);
1038}
1039
1040static inline void jbd2_journal_abort_handle(handle_t *handle)
1041{
1042 handle->h_aborted = 1;
1043}
1044
1045#endif /* __KERNEL__ */
1046
1047/* Comparison functions for transaction IDs: perform comparisons using
1048 * modulo arithmetic so that they work over sequence number wraps. */
1049
1050static inline int tid_gt(tid_t x, tid_t y)
1051{
1052 int difference = (x - y);
1053 return (difference > 0);
1054}
1055
1056static inline int tid_geq(tid_t x, tid_t y)
1057{
1058 int difference = (x - y);
1059 return (difference >= 0);
1060}
1061
1062extern int jbd2_journal_blocks_per_page(struct inode *inode);
1063extern size_t journal_tag_bytes(journal_t *journal);
1064
1065/*
1066 * Return the minimum number of blocks which must be free in the journal
1067 * before a new transaction may be started. Must be called under j_state_lock.
1068 */
1069static inline int jbd_space_needed(journal_t *journal)
1070{
1071 int nblocks = journal->j_max_transaction_buffers;
1072 if (journal->j_committing_transaction)
1073 nblocks += journal->j_committing_transaction->
1074 t_outstanding_credits;
1075 return nblocks;
1076}
1077
1078/*
1079 * Definitions which augment the buffer_head layer
1080 */
1081
1082/* journaling buffer types */
1083#define BJ_None 0 /* Not journaled */
1084#define BJ_SyncData 1 /* Normal data: flush before commit */
1085#define BJ_Metadata 2 /* Normal journaled metadata */
1086#define BJ_Forget 3 /* Buffer superseded by this transaction */
1087#define BJ_IO 4 /* Buffer is for temporary IO use */
1088#define BJ_Shadow 5 /* Buffer contents being shadowed to the log */
1089#define BJ_LogCtl 6 /* Buffer contains log descriptors */
1090#define BJ_Reserved 7 /* Buffer is reserved for access by journal */
1091#define BJ_Locked 8 /* Locked for I/O during commit */
1092#define BJ_Types 9
1093
1094extern int jbd_blocks_per_page(struct inode *inode);
1095
1096#ifdef __KERNEL__
1097
1098#define buffer_trace_init(bh) do {} while (0)
1099#define print_buffer_fields(bh) do {} while (0)
1100#define print_buffer_trace(bh) do {} while (0)
1101#define BUFFER_TRACE(bh, info) do {} while (0)
1102#define BUFFER_TRACE2(bh, bh2, info) do {} while (0)
1103#define JBUFFER_TRACE(jh, info) do {} while (0)
1104
1105#endif /* __KERNEL__ */
1106
1107#endif /* _LINUX_JBD_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 80f39cab470a..24b611147adb 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -171,6 +171,8 @@ __attribute_const__ roundup_pow_of_two(unsigned long x)
171 171
172extern int printk_ratelimit(void); 172extern int printk_ratelimit(void);
173extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); 173extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst);
174extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
175 unsigned int interval_msec);
174 176
175static inline void console_silent(void) 177static inline void console_silent(void)
176{ 178{
diff --git a/include/linux/libata.h b/include/linux/libata.h
index d0a7ad5ed518..abd2debebca2 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -143,7 +143,7 @@ enum {
143 ATA_DFLAG_CFG_MASK = (1 << 8) - 1, 143 ATA_DFLAG_CFG_MASK = (1 << 8) - 1,
144 144
145 ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */ 145 ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */
146 ATA_DFLAG_NCQ_OFF = (1 << 9), /* devied limited to non-NCQ mode */ 146 ATA_DFLAG_NCQ_OFF = (1 << 9), /* device limited to non-NCQ mode */
147 ATA_DFLAG_SUSPENDED = (1 << 10), /* device suspended */ 147 ATA_DFLAG_SUSPENDED = (1 << 10), /* device suspended */
148 ATA_DFLAG_INIT_MASK = (1 << 16) - 1, 148 ATA_DFLAG_INIT_MASK = (1 << 16) - 1,
149 149
@@ -702,7 +702,6 @@ extern int ata_std_prereset(struct ata_port *ap);
702extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes); 702extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes);
703extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class); 703extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class);
704extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); 704extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes);
705extern int ata_dev_revalidate(struct ata_device *dev, int post_reset);
706extern void ata_port_disable(struct ata_port *); 705extern void ata_port_disable(struct ata_port *);
707extern void ata_std_ports(struct ata_ioports *ioaddr); 706extern void ata_std_ports(struct ata_ioports *ioaddr);
708#ifdef CONFIG_PCI 707#ifdef CONFIG_PCI
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 81e3a185f951..aa50d89eacd7 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -10,6 +10,11 @@
10#define LINUX_LOCKD_BIND_H 10#define LINUX_LOCKD_BIND_H
11 11
12#include <linux/lockd/nlm.h> 12#include <linux/lockd/nlm.h>
13/* need xdr-encoded error codes too, so... */
14#include <linux/lockd/xdr.h>
15#ifdef CONFIG_LOCKD_V4
16#include <linux/lockd/xdr4.h>
17#endif
13 18
14/* Dummy declarations */ 19/* Dummy declarations */
15struct svc_rqst; 20struct svc_rqst;
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 2909619c0295..862d9730a60d 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -154,7 +154,7 @@ int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *);
154struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); 154struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl);
155void nlmclnt_finish_block(struct nlm_wait *block); 155void nlmclnt_finish_block(struct nlm_wait *block);
156int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); 156int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
157u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); 157__be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *);
158void nlmclnt_recovery(struct nlm_host *); 158void nlmclnt_recovery(struct nlm_host *);
159int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 159int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
160void nlmclnt_next_cookie(struct nlm_cookie *); 160void nlmclnt_next_cookie(struct nlm_cookie *);
@@ -184,12 +184,12 @@ typedef int (*nlm_host_match_fn_t)(struct nlm_host *cur, struct nlm_host *ref)
184/* 184/*
185 * Server-side lock handling 185 * Server-side lock handling
186 */ 186 */
187u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 187__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
188 struct nlm_lock *, int, struct nlm_cookie *); 188 struct nlm_lock *, int, struct nlm_cookie *);
189u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 189__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
190u32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *, 190__be32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *,
191 struct nlm_lock *); 191 struct nlm_lock *);
192u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); 192__be32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
193unsigned long nlmsvc_retry_blocked(void); 193unsigned long nlmsvc_retry_blocked(void);
194void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, 194void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
195 nlm_host_match_fn_t match); 195 nlm_host_match_fn_t match);
@@ -198,7 +198,7 @@ void nlmsvc_grant_reply(struct nlm_cookie *, u32);
198/* 198/*
199 * File handling for the server personality 199 * File handling for the server personality
200 */ 200 */
201u32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **, 201__be32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **,
202 struct nfs_fh *); 202 struct nfs_fh *);
203void nlm_release_file(struct nlm_file *); 203void nlm_release_file(struct nlm_file *);
204void nlmsvc_mark_resources(void); 204void nlmsvc_mark_resources(void);
diff --git a/include/linux/lockd/share.h b/include/linux/lockd/share.h
index cd7816e74c05..630c5bf69b07 100644
--- a/include/linux/lockd/share.h
+++ b/include/linux/lockd/share.h
@@ -21,9 +21,9 @@ struct nlm_share {
21 u32 s_mode; /* deny mode */ 21 u32 s_mode; /* deny mode */
22}; 22};
23 23
24u32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *, 24__be32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *,
25 struct nlm_args *); 25 struct nlm_args *);
26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *, 26__be32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *,
27 struct nlm_args *); 27 struct nlm_args *);
28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, 28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *,
29 nlm_host_match_fn_t); 29 nlm_host_match_fn_t);
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index bb0a0f1caa91..29e7d9fc9dad 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -13,6 +13,8 @@
13#include <linux/nfs.h> 13#include <linux/nfs.h>
14#include <linux/sunrpc/xdr.h> 14#include <linux/sunrpc/xdr.h>
15 15
16struct svc_rqst;
17
16#define NLM_MAXCOOKIELEN 32 18#define NLM_MAXCOOKIELEN 32
17#define NLM_MAXSTRLEN 1024 19#define NLM_MAXSTRLEN 1024
18 20
@@ -22,6 +24,8 @@
22#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED) 24#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED)
23#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD) 25#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD)
24 26
27#define nlm_drop_reply __constant_htonl(30000)
28
25/* Lock info passed via NLM */ 29/* Lock info passed via NLM */
26struct nlm_lock { 30struct nlm_lock {
27 char * caller; 31 char * caller;
@@ -86,19 +90,19 @@ struct nlm_reboot {
86 */ 90 */
87#define NLMSVC_XDRSIZE sizeof(struct nlm_args) 91#define NLMSVC_XDRSIZE sizeof(struct nlm_args)
88 92
89int nlmsvc_decode_testargs(struct svc_rqst *, u32 *, struct nlm_args *); 93int nlmsvc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *);
90int nlmsvc_encode_testres(struct svc_rqst *, u32 *, struct nlm_res *); 94int nlmsvc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *);
91int nlmsvc_decode_lockargs(struct svc_rqst *, u32 *, struct nlm_args *); 95int nlmsvc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
92int nlmsvc_decode_cancargs(struct svc_rqst *, u32 *, struct nlm_args *); 96int nlmsvc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *);
93int nlmsvc_decode_unlockargs(struct svc_rqst *, u32 *, struct nlm_args *); 97int nlmsvc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
94int nlmsvc_encode_res(struct svc_rqst *, u32 *, struct nlm_res *); 98int nlmsvc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
95int nlmsvc_decode_res(struct svc_rqst *, u32 *, struct nlm_res *); 99int nlmsvc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
96int nlmsvc_encode_void(struct svc_rqst *, u32 *, void *); 100int nlmsvc_encode_void(struct svc_rqst *, __be32 *, void *);
97int nlmsvc_decode_void(struct svc_rqst *, u32 *, void *); 101int nlmsvc_decode_void(struct svc_rqst *, __be32 *, void *);
98int nlmsvc_decode_shareargs(struct svc_rqst *, u32 *, struct nlm_args *); 102int nlmsvc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *);
99int nlmsvc_encode_shareres(struct svc_rqst *, u32 *, struct nlm_res *); 103int nlmsvc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *);
100int nlmsvc_decode_notify(struct svc_rqst *, u32 *, struct nlm_args *); 104int nlmsvc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *);
101int nlmsvc_decode_reboot(struct svc_rqst *, u32 *, struct nlm_reboot *); 105int nlmsvc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *);
102/* 106/*
103int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *); 107int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
104int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 108int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h
index 3cc1ae25009b..dd12b4c9e613 100644
--- a/include/linux/lockd/xdr4.h
+++ b/include/linux/lockd/xdr4.h
@@ -23,19 +23,19 @@
23 23
24 24
25 25
26int nlm4svc_decode_testargs(struct svc_rqst *, u32 *, struct nlm_args *); 26int nlm4svc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *);
27int nlm4svc_encode_testres(struct svc_rqst *, u32 *, struct nlm_res *); 27int nlm4svc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *);
28int nlm4svc_decode_lockargs(struct svc_rqst *, u32 *, struct nlm_args *); 28int nlm4svc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
29int nlm4svc_decode_cancargs(struct svc_rqst *, u32 *, struct nlm_args *); 29int nlm4svc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *);
30int nlm4svc_decode_unlockargs(struct svc_rqst *, u32 *, struct nlm_args *); 30int nlm4svc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
31int nlm4svc_encode_res(struct svc_rqst *, u32 *, struct nlm_res *); 31int nlm4svc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
32int nlm4svc_decode_res(struct svc_rqst *, u32 *, struct nlm_res *); 32int nlm4svc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
33int nlm4svc_encode_void(struct svc_rqst *, u32 *, void *); 33int nlm4svc_encode_void(struct svc_rqst *, __be32 *, void *);
34int nlm4svc_decode_void(struct svc_rqst *, u32 *, void *); 34int nlm4svc_decode_void(struct svc_rqst *, __be32 *, void *);
35int nlm4svc_decode_shareargs(struct svc_rqst *, u32 *, struct nlm_args *); 35int nlm4svc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *);
36int nlm4svc_encode_shareres(struct svc_rqst *, u32 *, struct nlm_res *); 36int nlm4svc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *);
37int nlm4svc_decode_notify(struct svc_rqst *, u32 *, struct nlm_args *); 37int nlm4svc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *);
38int nlm4svc_decode_reboot(struct svc_rqst *, u32 *, struct nlm_reboot *); 38int nlm4svc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *);
39/* 39/*
40int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *); 40int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
41int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 41int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 1314ca0f29be..819f08f1310d 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -202,7 +202,7 @@ extern int lockdep_internal(void);
202 */ 202 */
203 203
204extern void lockdep_init_map(struct lockdep_map *lock, const char *name, 204extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
205 struct lock_class_key *key); 205 struct lock_class_key *key, int subclass);
206 206
207/* 207/*
208 * Reinitialize a lock key - for cases where there is special locking or 208 * Reinitialize a lock key - for cases where there is special locking or
@@ -211,9 +211,14 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
211 * or they are too narrow (they suffer from a false class-split): 211 * or they are too narrow (they suffer from a false class-split):
212 */ 212 */
213#define lockdep_set_class(lock, key) \ 213#define lockdep_set_class(lock, key) \
214 lockdep_init_map(&(lock)->dep_map, #key, key) 214 lockdep_init_map(&(lock)->dep_map, #key, key, 0)
215#define lockdep_set_class_and_name(lock, key, name) \ 215#define lockdep_set_class_and_name(lock, key, name) \
216 lockdep_init_map(&(lock)->dep_map, name, key) 216 lockdep_init_map(&(lock)->dep_map, name, key, 0)
217#define lockdep_set_class_and_subclass(lock, key, sub) \
218 lockdep_init_map(&(lock)->dep_map, #key, key, sub)
219#define lockdep_set_subclass(lock, sub) \
220 lockdep_init_map(&(lock)->dep_map, #lock, \
221 (lock)->dep_map.key, sub)
217 222
218/* 223/*
219 * Acquire a lock. 224 * Acquire a lock.
@@ -257,10 +262,14 @@ static inline int lockdep_internal(void)
257# define lock_release(l, n, i) do { } while (0) 262# define lock_release(l, n, i) do { } while (0)
258# define lockdep_init() do { } while (0) 263# define lockdep_init() do { } while (0)
259# define lockdep_info() do { } while (0) 264# define lockdep_info() do { } while (0)
260# define lockdep_init_map(lock, name, key) do { (void)(key); } while (0) 265# define lockdep_init_map(lock, name, key, sub) do { (void)(key); } while (0)
261# define lockdep_set_class(lock, key) do { (void)(key); } while (0) 266# define lockdep_set_class(lock, key) do { (void)(key); } while (0)
262# define lockdep_set_class_and_name(lock, key, name) \ 267# define lockdep_set_class_and_name(lock, key, name) \
263 do { (void)(key); } while (0) 268 do { (void)(key); } while (0)
269#define lockdep_set_class_and_subclass(lock, key, sub) \
270 do { (void)(key); } while (0)
271#define lockdep_set_subclass(lock, sub) do { } while (0)
272
264# define INIT_LOCKDEP 273# define INIT_LOCKDEP
265# define lockdep_reset() do { debug_locks = 1; } while (0) 274# define lockdep_reset() do { debug_locks = 1; } while (0)
266# define lockdep_free_key_range(start, size) do { } while (0) 275# define lockdep_free_key_range(start, size) do { } while (0)
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 22036dd2ba36..156c40fc664e 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -8,6 +8,7 @@
8#define EFS_SUPER_MAGIC 0x414A53 8#define EFS_SUPER_MAGIC 0x414A53
9#define EXT2_SUPER_MAGIC 0xEF53 9#define EXT2_SUPER_MAGIC 0xEF53
10#define EXT3_SUPER_MAGIC 0xEF53 10#define EXT3_SUPER_MAGIC 0xEF53
11#define EXT4_SUPER_MAGIC 0xEF53
11#define HPFS_SUPER_MAGIC 0xf995e849 12#define HPFS_SUPER_MAGIC 0xf995e849
12#define ISOFS_SUPER_MAGIC 0x9660 13#define ISOFS_SUPER_MAGIC 0x9660
13#define JFFS2_SUPER_MAGIC 0x72b6 14#define JFFS2_SUPER_MAGIC 0x72b6
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 09f0f575ddff..daabb3aa1ec6 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -150,7 +150,7 @@ extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
150extern void mpol_fix_fork_child_flag(struct task_struct *p); 150extern void mpol_fix_fork_child_flag(struct task_struct *p);
151#define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x)) 151#define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x))
152 152
153#ifdef CONFIG_CPUSET 153#ifdef CONFIG_CPUSETS
154#define current_cpuset_is_being_rebound() \ 154#define current_cpuset_is_being_rebound() \
155 (cpuset_being_rebound == current->cpuset) 155 (cpuset_being_rebound == current->cpuset)
156#else 156#else
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 26146623be2f..d538de901965 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1103,12 +1103,7 @@ static inline void vm_stat_account(struct mm_struct *mm,
1103 1103
1104#ifndef CONFIG_DEBUG_PAGEALLOC 1104#ifndef CONFIG_DEBUG_PAGEALLOC
1105static inline void 1105static inline void
1106kernel_map_pages(struct page *page, int numpages, int enable) 1106kernel_map_pages(struct page *page, int numpages, int enable) {}
1107{
1108 if (!PageHighMem(page) && !enable)
1109 debug_check_no_locks_freed(page_address(page),
1110 numpages * PAGE_SIZE);
1111}
1112#endif 1107#endif
1113 1108
1114extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); 1109extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk);
@@ -1120,9 +1115,6 @@ int in_gate_area_no_task(unsigned long addr);
1120#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) 1115#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
1121#endif /* __HAVE_ARCH_GATE_AREA */ 1116#endif /* __HAVE_ARCH_GATE_AREA */
1122 1117
1123/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
1124#define OOM_DISABLE -17
1125
1126int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, 1118int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
1127 void __user *, size_t *, loff_t *); 1119 void __user *, size_t *, loff_t *);
1128unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, 1120unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 59855b8718a0..e06683e2bea3 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -218,13 +218,9 @@ struct zone {
218 * under - it drives the swappiness decision: whether to unmap mapped 218 * under - it drives the swappiness decision: whether to unmap mapped
219 * pages. 219 * pages.
220 * 220 *
221 * temp_priority is used to remember the scanning priority at which 221 * Access to both this field is quite racy even on uniprocessor. But
222 * this zone was successfully refilled to free_pages == pages_high.
223 *
224 * Access to both these fields is quite racy even on uniprocessor. But
225 * it is expected to average out OK. 222 * it is expected to average out OK.
226 */ 223 */
227 int temp_priority;
228 int prev_priority; 224 int prev_priority;
229 225
230 226
@@ -674,6 +670,12 @@ void sparse_init(void);
674#define sparse_index_init(_sec, _nid) do {} while (0) 670#define sparse_index_init(_sec, _nid) do {} while (0)
675#endif /* CONFIG_SPARSEMEM */ 671#endif /* CONFIG_SPARSEMEM */
676 672
673#ifdef CONFIG_NODES_SPAN_OTHER_NODES
674#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid))
675#else
676#define early_pfn_in_nid(pfn, nid) (1)
677#endif
678
677#ifndef early_pfn_valid 679#ifndef early_pfn_valid
678#define early_pfn_valid(pfn) (1) 680#define early_pfn_valid(pfn) (1)
679#endif 681#endif
diff --git a/include/linux/module.h b/include/linux/module.h
index 4b2d8091a410..d1d00ce8f4ed 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -317,9 +317,6 @@ struct module
317 /* Am I unsafe to unload? */ 317 /* Am I unsafe to unload? */
318 int unsafe; 318 int unsafe;
319 319
320 /* Am I GPL-compatible */
321 int license_gplok;
322
323 unsigned int taints; /* same bits as kernel:tainted */ 320 unsigned int taints; /* same bits as kernel:tainted */
324 321
325#ifdef CONFIG_MODULE_UNLOAD 322#ifdef CONFIG_MODULE_UNLOAD
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index ce6c85815cbd..24a9ef1506b6 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -402,6 +402,8 @@ extern const struct file_operations fat_file_operations;
402extern struct inode_operations fat_file_inode_operations; 402extern struct inode_operations fat_file_inode_operations;
403extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); 403extern int fat_notify_change(struct dentry * dentry, struct iattr * attr);
404extern void fat_truncate(struct inode *inode); 404extern void fat_truncate(struct inode *inode);
405extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry,
406 struct kstat *stat);
405 407
406/* fat/inode.c */ 408/* fat/inode.c */
407extern void fat_attach(struct inode *inode, loff_t i_pos); 409extern void fat_attach(struct inode *inode, loff_t i_pos);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 70420bbae82b..8b3ef4187219 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -355,7 +355,7 @@ struct nand_buffers {
355 * @priv: [OPTIONAL] pointer to private chip date 355 * @priv: [OPTIONAL] pointer to private chip date
356 * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks 356 * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks
357 * (determine if errors are correctable) 357 * (determine if errors are correctable)
358 * @write_page [REPLACEABLE] High-level page write function 358 * @write_page: [REPLACEABLE] High-level page write function
359 */ 359 */
360 360
361struct nand_chip { 361struct nand_chip {
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index e712e7d47cc2..d6b6dc09ad97 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -15,6 +15,8 @@
15#ifndef LINUX_NBD_H 15#ifndef LINUX_NBD_H
16#define LINUX_NBD_H 16#define LINUX_NBD_H
17 17
18#include <linux/types.h>
19
18#define NBD_SET_SOCK _IO( 0xab, 0 ) 20#define NBD_SET_SOCK _IO( 0xab, 0 )
19#define NBD_SET_BLKSIZE _IO( 0xab, 1 ) 21#define NBD_SET_BLKSIZE _IO( 0xab, 1 )
20#define NBD_SET_SIZE _IO( 0xab, 2 ) 22#define NBD_SET_SIZE _IO( 0xab, 2 )
diff --git a/include/linux/net.h b/include/linux/net.h
index c257f716e00f..15c733b816f0 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -19,6 +19,7 @@
19#define _LINUX_NET_H 19#define _LINUX_NET_H
20 20
21#include <linux/wait.h> 21#include <linux/wait.h>
22#include <linux/random.h>
22#include <asm/socket.h> 23#include <asm/socket.h>
23 24
24struct poll_table_struct; 25struct poll_table_struct;
@@ -193,9 +194,9 @@ extern int sock_map_fd(struct socket *sock);
193extern struct socket *sockfd_lookup(int fd, int *err); 194extern struct socket *sockfd_lookup(int fd, int *err);
194#define sockfd_put(sock) fput(sock->file) 195#define sockfd_put(sock) fput(sock->file)
195extern int net_ratelimit(void); 196extern int net_ratelimit(void);
196extern unsigned long net_random(void); 197
197extern void net_srandom(unsigned long); 198#define net_random() random32()
198extern void net_random_init(void); 199#define net_srandom(seed) srandom32(seed)
199 200
200extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg, 201extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
201 struct kvec *vec, size_t num, size_t len); 202 struct kvec *vec, size_t num, size_t len);
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 04319a76103a..022edfa97ed9 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -96,22 +96,6 @@ struct _xt_align
96/* Error verdict. */ 96/* Error verdict. */
97#define XT_ERROR_TARGET "ERROR" 97#define XT_ERROR_TARGET "ERROR"
98 98
99/*
100 * New IP firewall options for [gs]etsockopt at the RAW IP level.
101 * Unlike BSD Linux inherits IP options so you don't have to use a raw
102 * socket for this. Instead we check rights in the calls. */
103#define XT_BASE_CTL 64 /* base for firewall socket options */
104
105#define XT_SO_SET_REPLACE (XT_BASE_CTL)
106#define XT_SO_SET_ADD_COUNTERS (XT_BASE_CTL + 1)
107#define XT_SO_SET_MAX XT_SO_SET_ADD_COUNTERS
108
109#define XT_SO_GET_INFO (XT_BASE_CTL)
110#define XT_SO_GET_ENTRIES (XT_BASE_CTL + 1)
111#define XT_SO_GET_REVISION_MATCH (XT_BASE_CTL + 2)
112#define XT_SO_GET_REVISION_TARGET (XT_BASE_CTL + 3)
113#define XT_SO_GET_MAX XT_SO_GET_REVISION_TARGET
114
115#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0) 99#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
116#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0) 100#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
117 101
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 44e39b61d9e7..0be235418a2f 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -112,19 +112,20 @@ struct arpt_entry
112 * New IP firewall options for [gs]etsockopt at the RAW IP level. 112 * New IP firewall options for [gs]etsockopt at the RAW IP level.
113 * Unlike BSD Linux inherits IP options so you don't have to use a raw 113 * Unlike BSD Linux inherits IP options so you don't have to use a raw
114 * socket for this. Instead we check rights in the calls. 114 * socket for this. Instead we check rights in the calls.
115 *
116 * ATTENTION: check linux/in.h before adding new number here.
115 */ 117 */
116#define ARPT_CTL_OFFSET 32 118#define ARPT_BASE_CTL 96
117#define ARPT_BASE_CTL (XT_BASE_CTL+ARPT_CTL_OFFSET) 119
118 120#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL)
119#define ARPT_SO_SET_REPLACE (XT_SO_SET_REPLACE+ARPT_CTL_OFFSET) 121#define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1)
120#define ARPT_SO_SET_ADD_COUNTERS (XT_SO_SET_ADD_COUNTERS+ARPT_CTL_OFFSET) 122#define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS
121#define ARPT_SO_SET_MAX (XT_SO_SET_MAX+ARPT_CTL_OFFSET) 123
122 124#define ARPT_SO_GET_INFO (ARPT_BASE_CTL)
123#define ARPT_SO_GET_INFO (XT_SO_GET_INFO+ARPT_CTL_OFFSET) 125#define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1)
124#define ARPT_SO_GET_ENTRIES (XT_SO_GET_ENTRIES+ARPT_CTL_OFFSET) 126/* #define ARPT_SO_GET_REVISION_MATCH (APRT_BASE_CTL + 2) */
125/* #define ARPT_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH */ 127#define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3)
126#define ARPT_SO_GET_REVISION_TARGET (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET) 128#define ARPT_SO_GET_MAX (ARPT_SO_GET_REVISION_TARGET)
127#define ARPT_SO_GET_MAX (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET)
128 129
129/* CONTINUE verdict for targets */ 130/* CONTINUE verdict for targets */
130#define ARPT_CONTINUE XT_CONTINUE 131#define ARPT_CONTINUE XT_CONTINUE
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index a536bbdef145..4f06dad0bde9 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -101,18 +101,21 @@ struct ipt_entry
101/* 101/*
102 * New IP firewall options for [gs]etsockopt at the RAW IP level. 102 * New IP firewall options for [gs]etsockopt at the RAW IP level.
103 * Unlike BSD Linux inherits IP options so you don't have to use a raw 103 * Unlike BSD Linux inherits IP options so you don't have to use a raw
104 * socket for this. Instead we check rights in the calls. */ 104 * socket for this. Instead we check rights in the calls.
105#define IPT_BASE_CTL XT_BASE_CTL 105 *
106 106 * ATTENTION: check linux/in.h before adding new number here.
107#define IPT_SO_SET_REPLACE XT_SO_SET_REPLACE 107 */
108#define IPT_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS 108#define IPT_BASE_CTL 64
109#define IPT_SO_SET_MAX XT_SO_SET_MAX 109
110 110#define IPT_SO_SET_REPLACE (IPT_BASE_CTL)
111#define IPT_SO_GET_INFO XT_SO_GET_INFO 111#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1)
112#define IPT_SO_GET_ENTRIES XT_SO_GET_ENTRIES 112#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS
113#define IPT_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH 113
114#define IPT_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET 114#define IPT_SO_GET_INFO (IPT_BASE_CTL)
115#define IPT_SO_GET_MAX XT_SO_GET_REVISION_TARGET 115#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1)
116#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2)
117#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3)
118#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET
116 119
117#define IPT_CONTINUE XT_CONTINUE 120#define IPT_CONTINUE XT_CONTINUE
118#define IPT_RETURN XT_RETURN 121#define IPT_RETURN XT_RETURN
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index d7a8e9c0dad0..4aed340401db 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -107,18 +107,21 @@ struct ip6t_entry
107/* 107/*
108 * New IP firewall options for [gs]etsockopt at the RAW IP level. 108 * New IP firewall options for [gs]etsockopt at the RAW IP level.
109 * Unlike BSD Linux inherits IP options so you don't have to use 109 * Unlike BSD Linux inherits IP options so you don't have to use
110 * a raw socket for this. Instead we check rights in the calls. */ 110 * a raw socket for this. Instead we check rights in the calls.
111#define IP6T_BASE_CTL XT_BASE_CTL 111 *
112 112 * ATTENTION: check linux/in6.h before adding new number here.
113#define IP6T_SO_SET_REPLACE XT_SO_SET_REPLACE 113 */
114#define IP6T_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS 114#define IP6T_BASE_CTL 64
115#define IP6T_SO_SET_MAX XT_SO_SET_MAX 115
116 116#define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL)
117#define IP6T_SO_GET_INFO XT_SO_GET_INFO 117#define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1)
118#define IP6T_SO_GET_ENTRIES XT_SO_GET_ENTRIES 118#define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS
119#define IP6T_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH 119
120#define IP6T_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET 120#define IP6T_SO_GET_INFO (IP6T_BASE_CTL)
121#define IP6T_SO_GET_MAX XT_SO_GET_REVISION_TARGET 121#define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1)
122#define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 4)
123#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5)
124#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET
122 125
123/* CONTINUE verdict for targets */ 126/* CONTINUE verdict for targets */
124#define IP6T_CONTINUE XT_CONTINUE 127#define IP6T_CONTINUE XT_CONTINUE
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 76ff54846ada..45228c1a1195 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -157,7 +157,7 @@ struct nfs_inode {
157 * This is the cookie verifier used for NFSv3 readdir 157 * This is the cookie verifier used for NFSv3 readdir
158 * operations 158 * operations
159 */ 159 */
160 __u32 cookieverf[2]; 160 __be32 cookieverf[2];
161 161
162 /* 162 /*
163 * This is the list of dirty unwritten pages. 163 * This is the list of dirty unwritten pages.
@@ -290,6 +290,7 @@ static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long
290 * linux/fs/nfs/inode.c 290 * linux/fs/nfs/inode.c
291 */ 291 */
292extern int nfs_sync_mapping(struct address_space *mapping); 292extern int nfs_sync_mapping(struct address_space *mapping);
293extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);
293extern void nfs_zap_caches(struct inode *); 294extern void nfs_zap_caches(struct inode *);
294extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 295extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
295 struct nfs_fattr *); 296 struct nfs_fattr *);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index dc5397d9d23c..768c1ad5ff6f 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -266,7 +266,7 @@ struct nfs_writeargs {
266 266
267struct nfs_writeverf { 267struct nfs_writeverf {
268 enum nfs3_stable_how committed; 268 enum nfs3_stable_how committed;
269 __u32 verifier[2]; 269 __be32 verifier[2];
270}; 270};
271 271
272struct nfs_writeres { 272struct nfs_writeres {
@@ -420,7 +420,7 @@ struct nfs3_createargs {
420 unsigned int len; 420 unsigned int len;
421 struct iattr * sattr; 421 struct iattr * sattr;
422 enum nfs3_createmode createmode; 422 enum nfs3_createmode createmode;
423 __u32 verifier[2]; 423 __be32 verifier[2];
424}; 424};
425 425
426struct nfs3_mkdirargs { 426struct nfs3_mkdirargs {
@@ -467,7 +467,7 @@ struct nfs3_linkargs {
467struct nfs3_readdirargs { 467struct nfs3_readdirargs {
468 struct nfs_fh * fh; 468 struct nfs_fh * fh;
469 __u64 cookie; 469 __u64 cookie;
470 __u32 verf[2]; 470 __be32 verf[2];
471 int plus; 471 int plus;
472 unsigned int count; 472 unsigned int count;
473 struct page ** pages; 473 struct page ** pages;
@@ -503,7 +503,7 @@ struct nfs3_linkres {
503 503
504struct nfs3_readdirres { 504struct nfs3_readdirres {
505 struct nfs_fattr * dir_attr; 505 struct nfs_fattr * dir_attr;
506 __u32 * verf; 506 __be32 * verf;
507 int plus; 507 int plus;
508}; 508};
509 509
@@ -811,7 +811,7 @@ struct nfs_rpc_ops {
811 int (*pathconf) (struct nfs_server *, struct nfs_fh *, 811 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
812 struct nfs_pathconf *); 812 struct nfs_pathconf *);
813 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 813 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
814 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); 814 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
815 void (*read_setup) (struct nfs_read_data *); 815 void (*read_setup) (struct nfs_read_data *);
816 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 816 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
817 void (*write_setup) (struct nfs_write_data *, int how); 817 void (*write_setup) (struct nfs_write_data *, int how);
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
index c3a3557c2a5b..007480cd6a60 100644
--- a/include/linux/nfsd/cache.h
+++ b/include/linux/nfsd/cache.h
@@ -26,14 +26,14 @@ struct svc_cacherep {
26 c_type, /* status, buffer */ 26 c_type, /* status, buffer */
27 c_secure : 1; /* req came from port < 1024 */ 27 c_secure : 1; /* req came from port < 1024 */
28 struct sockaddr_in c_addr; 28 struct sockaddr_in c_addr;
29 u32 c_xid; 29 __be32 c_xid;
30 u32 c_prot; 30 u32 c_prot;
31 u32 c_proc; 31 u32 c_proc;
32 u32 c_vers; 32 u32 c_vers;
33 unsigned long c_timestamp; 33 unsigned long c_timestamp;
34 union { 34 union {
35 struct kvec u_vec; 35 struct kvec u_vec;
36 u32 u_status; 36 __be32 u_status;
37 } c_u; 37 } c_u;
38}; 38};
39 39
@@ -75,7 +75,7 @@ enum {
75void nfsd_cache_init(void); 75void nfsd_cache_init(void);
76void nfsd_cache_shutdown(void); 76void nfsd_cache_shutdown(void);
77int nfsd_cache_lookup(struct svc_rqst *, int); 77int nfsd_cache_lookup(struct svc_rqst *, int);
78void nfsd_cache_update(struct svc_rqst *, int, u32 *); 78void nfsd_cache_update(struct svc_rqst *, int, __be32 *);
79 79
80#endif /* __KERNEL__ */ 80#endif /* __KERNEL__ */
81#endif /* NFSCACHE_H */ 81#endif /* NFSCACHE_H */
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 6e78ea969f49..045e38cdbe64 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -117,8 +117,8 @@ struct svc_export * exp_parent(struct auth_domain *clp,
117 struct cache_req *reqp); 117 struct cache_req *reqp);
118int exp_rootfh(struct auth_domain *, 118int exp_rootfh(struct auth_domain *,
119 char *path, struct knfsd_fh *, int maxsize); 119 char *path, struct knfsd_fh *, int maxsize);
120int exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq); 120__be32 exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq);
121int nfserrno(int errno); 121__be32 nfserrno(int errno);
122 122
123extern struct cache_detail svc_export_cache; 123extern struct cache_detail svc_export_cache;
124 124
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index d0d4aae7085f..edb54c3171b3 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -50,7 +50,7 @@
50 * Callback function for readdir 50 * Callback function for readdir
51 */ 51 */
52struct readdir_cd { 52struct readdir_cd {
53 int err; /* 0, nfserr, or nfserr_eof */ 53 __be32 err; /* 0, nfserr, or nfserr_eof */
54}; 54};
55typedef int (*encode_dent_fn)(struct readdir_cd *, const char *, 55typedef int (*encode_dent_fn)(struct readdir_cd *, const char *,
56 int, loff_t, ino_t, unsigned int); 56 int, loff_t, ino_t, unsigned int);
@@ -64,7 +64,7 @@ extern struct svc_serv *nfsd_serv;
64 * Function prototypes. 64 * Function prototypes.
65 */ 65 */
66int nfsd_svc(unsigned short port, int nrservs); 66int nfsd_svc(unsigned short port, int nrservs);
67int nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp); 67int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp);
68 68
69/* nfsd/vfs.c */ 69/* nfsd/vfs.c */
70int fh_lock_parent(struct svc_fh *, struct dentry *); 70int fh_lock_parent(struct svc_fh *, struct dentry *);
@@ -72,57 +72,57 @@ int nfsd_racache_init(int);
72void nfsd_racache_shutdown(void); 72void nfsd_racache_shutdown(void);
73int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, 73int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
74 struct svc_export **expp); 74 struct svc_export **expp);
75int nfsd_lookup(struct svc_rqst *, struct svc_fh *, 75__be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *,
76 const char *, int, struct svc_fh *); 76 const char *, int, struct svc_fh *);
77int nfsd_setattr(struct svc_rqst *, struct svc_fh *, 77__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *,
78 struct iattr *, int, time_t); 78 struct iattr *, int, time_t);
79#ifdef CONFIG_NFSD_V4 79#ifdef CONFIG_NFSD_V4
80int nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *, 80__be32 nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *,
81 struct nfs4_acl *); 81 struct nfs4_acl *);
82int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **); 82int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **);
83#endif /* CONFIG_NFSD_V4 */ 83#endif /* CONFIG_NFSD_V4 */
84int nfsd_create(struct svc_rqst *, struct svc_fh *, 84__be32 nfsd_create(struct svc_rqst *, struct svc_fh *,
85 char *name, int len, struct iattr *attrs, 85 char *name, int len, struct iattr *attrs,
86 int type, dev_t rdev, struct svc_fh *res); 86 int type, dev_t rdev, struct svc_fh *res);
87#ifdef CONFIG_NFSD_V3 87#ifdef CONFIG_NFSD_V3
88int nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *); 88__be32 nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *);
89int nfsd_create_v3(struct svc_rqst *, struct svc_fh *, 89__be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *,
90 char *name, int len, struct iattr *attrs, 90 char *name, int len, struct iattr *attrs,
91 struct svc_fh *res, int createmode, 91 struct svc_fh *res, int createmode,
92 u32 *verifier, int *truncp); 92 u32 *verifier, int *truncp, int *created);
93int nfsd_commit(struct svc_rqst *, struct svc_fh *, 93__be32 nfsd_commit(struct svc_rqst *, struct svc_fh *,
94 loff_t, unsigned long); 94 loff_t, unsigned long);
95#endif /* CONFIG_NFSD_V3 */ 95#endif /* CONFIG_NFSD_V3 */
96int nfsd_open(struct svc_rqst *, struct svc_fh *, int, 96__be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int,
97 int, struct file **); 97 int, struct file **);
98void nfsd_close(struct file *); 98void nfsd_close(struct file *);
99int nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, 99__be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *,
100 loff_t, struct kvec *, int, unsigned long *); 100 loff_t, struct kvec *, int, unsigned long *);
101int nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, 101__be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *,
102 loff_t, struct kvec *,int, unsigned long, int *); 102 loff_t, struct kvec *,int, unsigned long, int *);
103int nfsd_readlink(struct svc_rqst *, struct svc_fh *, 103__be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *,
104 char *, int *); 104 char *, int *);
105int nfsd_symlink(struct svc_rqst *, struct svc_fh *, 105__be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *,
106 char *name, int len, char *path, int plen, 106 char *name, int len, char *path, int plen,
107 struct svc_fh *res, struct iattr *); 107 struct svc_fh *res, struct iattr *);
108int nfsd_link(struct svc_rqst *, struct svc_fh *, 108__be32 nfsd_link(struct svc_rqst *, struct svc_fh *,
109 char *, int, struct svc_fh *); 109 char *, int, struct svc_fh *);
110int nfsd_rename(struct svc_rqst *, 110__be32 nfsd_rename(struct svc_rqst *,
111 struct svc_fh *, char *, int, 111 struct svc_fh *, char *, int,
112 struct svc_fh *, char *, int); 112 struct svc_fh *, char *, int);
113int nfsd_remove(struct svc_rqst *, 113__be32 nfsd_remove(struct svc_rqst *,
114 struct svc_fh *, char *, int); 114 struct svc_fh *, char *, int);
115int nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, 115__be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type,
116 char *name, int len); 116 char *name, int len);
117int nfsd_truncate(struct svc_rqst *, struct svc_fh *, 117int nfsd_truncate(struct svc_rqst *, struct svc_fh *,
118 unsigned long size); 118 unsigned long size);
119int nfsd_readdir(struct svc_rqst *, struct svc_fh *, 119__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *,
120 loff_t *, struct readdir_cd *, encode_dent_fn); 120 loff_t *, struct readdir_cd *, encode_dent_fn);
121int nfsd_statfs(struct svc_rqst *, struct svc_fh *, 121__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *,
122 struct kstatfs *); 122 struct kstatfs *);
123 123
124int nfsd_notify_change(struct inode *, struct iattr *); 124int nfsd_notify_change(struct inode *, struct iattr *);
125int nfsd_permission(struct svc_export *, struct dentry *, int); 125__be32 nfsd_permission(struct svc_export *, struct dentry *, int);
126int nfsd_sync_dir(struct dentry *dp); 126int nfsd_sync_dir(struct dentry *dp);
127 127
128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
@@ -238,6 +238,7 @@ void nfsd_lockd_shutdown(void);
238#define nfserr_badname __constant_htonl(NFSERR_BADNAME) 238#define nfserr_badname __constant_htonl(NFSERR_BADNAME)
239#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) 239#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN)
240#define nfserr_locked __constant_htonl(NFSERR_LOCKED) 240#define nfserr_locked __constant_htonl(NFSERR_LOCKED)
241#define nfserr_replay_me __constant_htonl(NFSERR_REPLAY_ME)
241 242
242/* error codes for internal use */ 243/* error codes for internal use */
243/* if a request fails due to kmalloc failure, it gets dropped. 244/* if a request fails due to kmalloc failure, it gets dropped.
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index 069257ea99a0..f3b51d62ec7d 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -157,7 +157,7 @@ typedef struct svc_fh {
157 __u64 fh_post_size; /* i_size */ 157 __u64 fh_post_size; /* i_size */
158 unsigned long fh_post_blocks; /* i_blocks */ 158 unsigned long fh_post_blocks; /* i_blocks */
159 unsigned long fh_post_blksize;/* i_blksize */ 159 unsigned long fh_post_blksize;/* i_blksize */
160 __u32 fh_post_rdev[2];/* i_rdev */ 160 __be32 fh_post_rdev[2];/* i_rdev */
161 struct timespec fh_post_atime; /* i_atime */ 161 struct timespec fh_post_atime; /* i_atime */
162 struct timespec fh_post_mtime; /* i_mtime */ 162 struct timespec fh_post_mtime; /* i_mtime */
163 struct timespec fh_post_ctime; /* i_ctime */ 163 struct timespec fh_post_ctime; /* i_ctime */
@@ -209,9 +209,9 @@ extern char * SVCFH_fmt(struct svc_fh *fhp);
209/* 209/*
210 * Function prototypes 210 * Function prototypes
211 */ 211 */
212u32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int); 212__be32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int);
213int fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); 213__be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *);
214int fh_update(struct svc_fh *); 214__be32 fh_update(struct svc_fh *);
215void fh_put(struct svc_fh *); 215void fh_put(struct svc_fh *);
216 216
217static __inline__ struct svc_fh * 217static __inline__ struct svc_fh *
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 8bf23cf8b603..c3673f487e84 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -125,7 +125,7 @@ struct nfs4_client {
125 char cl_recdir[HEXDIR_LEN]; /* recovery dir */ 125 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
126 nfs4_verifier cl_verifier; /* generated by client */ 126 nfs4_verifier cl_verifier; /* generated by client */
127 time_t cl_time; /* time of last lease renewal */ 127 time_t cl_time; /* time of last lease renewal */
128 u32 cl_addr; /* client ipaddress */ 128 __be32 cl_addr; /* client ipaddress */
129 struct svc_cred cl_cred; /* setclientid principal */ 129 struct svc_cred cl_cred; /* setclientid principal */
130 clientid_t cl_clientid; /* generated by server */ 130 clientid_t cl_clientid; /* generated by server */
131 nfs4_verifier cl_confirm; /* generated by server */ 131 nfs4_verifier cl_confirm; /* generated by server */
@@ -164,7 +164,7 @@ update_stateid(stateid_t *stateid)
164 * is cached. 164 * is cached.
165 */ 165 */
166struct nfs4_replay { 166struct nfs4_replay {
167 u32 rp_status; 167 __be32 rp_status;
168 unsigned int rp_buflen; 168 unsigned int rp_buflen;
169 char *rp_buf; 169 char *rp_buf;
170 unsigned intrp_allocated; 170 unsigned intrp_allocated;
@@ -273,19 +273,19 @@ struct nfs4_stateid {
273 ((err) != nfserr_stale_stateid) && \ 273 ((err) != nfserr_stale_stateid) && \
274 ((err) != nfserr_bad_stateid)) 274 ((err) != nfserr_bad_stateid))
275 275
276extern int nfsd4_renew(clientid_t *clid); 276extern __be32 nfsd4_renew(clientid_t *clid);
277extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, 277extern __be32 nfs4_preprocess_stateid_op(struct svc_fh *current_fh,
278 stateid_t *stateid, int flags, struct file **filp); 278 stateid_t *stateid, int flags, struct file **filp);
279extern void nfs4_lock_state(void); 279extern void nfs4_lock_state(void);
280extern void nfs4_unlock_state(void); 280extern void nfs4_unlock_state(void);
281extern int nfs4_in_grace(void); 281extern int nfs4_in_grace(void);
282extern int nfs4_check_open_reclaim(clientid_t *clid); 282extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
283extern void put_nfs4_client(struct nfs4_client *clp); 283extern void put_nfs4_client(struct nfs4_client *clp);
284extern void nfs4_free_stateowner(struct kref *kref); 284extern void nfs4_free_stateowner(struct kref *kref);
285extern void nfsd4_probe_callback(struct nfs4_client *clp); 285extern void nfsd4_probe_callback(struct nfs4_client *clp);
286extern void nfsd4_cb_recall(struct nfs4_delegation *dp); 286extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
287extern void nfs4_put_delegation(struct nfs4_delegation *dp); 287extern void nfs4_put_delegation(struct nfs4_delegation *dp);
288extern int nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); 288extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
289extern void nfsd4_init_recdir(char *recdir_name); 289extern void nfsd4_init_recdir(char *recdir_name);
290extern int nfsd4_recdir_load(void); 290extern int nfsd4_recdir_load(void);
291extern void nfsd4_shutdown_recdir(void); 291extern void nfsd4_shutdown_recdir(void);
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index 0e53de87d886..877192d3ae79 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -81,7 +81,7 @@ struct nfsd_readdirargs {
81 struct svc_fh fh; 81 struct svc_fh fh;
82 __u32 cookie; 82 __u32 cookie;
83 __u32 count; 83 __u32 count;
84 u32 * buffer; 84 __be32 * buffer;
85}; 85};
86 86
87struct nfsd_attrstat { 87struct nfsd_attrstat {
@@ -108,9 +108,9 @@ struct nfsd_readdirres {
108 int count; 108 int count;
109 109
110 struct readdir_cd common; 110 struct readdir_cd common;
111 u32 * buffer; 111 __be32 * buffer;
112 int buflen; 112 int buflen;
113 u32 * offset; 113 __be32 * offset;
114}; 114};
115 115
116struct nfsd_statfsres { 116struct nfsd_statfsres {
@@ -135,43 +135,43 @@ union nfsd_xdrstore {
135#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) 135#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
136 136
137 137
138int nfssvc_decode_void(struct svc_rqst *, u32 *, void *); 138int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *);
139int nfssvc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); 139int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
140int nfssvc_decode_sattrargs(struct svc_rqst *, u32 *, 140int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *,
141 struct nfsd_sattrargs *); 141 struct nfsd_sattrargs *);
142int nfssvc_decode_diropargs(struct svc_rqst *, u32 *, 142int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *,
143 struct nfsd_diropargs *); 143 struct nfsd_diropargs *);
144int nfssvc_decode_readargs(struct svc_rqst *, u32 *, 144int nfssvc_decode_readargs(struct svc_rqst *, __be32 *,
145 struct nfsd_readargs *); 145 struct nfsd_readargs *);
146int nfssvc_decode_writeargs(struct svc_rqst *, u32 *, 146int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *,
147 struct nfsd_writeargs *); 147 struct nfsd_writeargs *);
148int nfssvc_decode_createargs(struct svc_rqst *, u32 *, 148int nfssvc_decode_createargs(struct svc_rqst *, __be32 *,
149 struct nfsd_createargs *); 149 struct nfsd_createargs *);
150int nfssvc_decode_renameargs(struct svc_rqst *, u32 *, 150int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *,
151 struct nfsd_renameargs *); 151 struct nfsd_renameargs *);
152int nfssvc_decode_readlinkargs(struct svc_rqst *, u32 *, 152int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *,
153 struct nfsd_readlinkargs *); 153 struct nfsd_readlinkargs *);
154int nfssvc_decode_linkargs(struct svc_rqst *, u32 *, 154int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *,
155 struct nfsd_linkargs *); 155 struct nfsd_linkargs *);
156int nfssvc_decode_symlinkargs(struct svc_rqst *, u32 *, 156int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *,
157 struct nfsd_symlinkargs *); 157 struct nfsd_symlinkargs *);
158int nfssvc_decode_readdirargs(struct svc_rqst *, u32 *, 158int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *,
159 struct nfsd_readdirargs *); 159 struct nfsd_readdirargs *);
160int nfssvc_encode_void(struct svc_rqst *, u32 *, void *); 160int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *);
161int nfssvc_encode_attrstat(struct svc_rqst *, u32 *, struct nfsd_attrstat *); 161int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *);
162int nfssvc_encode_diropres(struct svc_rqst *, u32 *, struct nfsd_diropres *); 162int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *);
163int nfssvc_encode_readlinkres(struct svc_rqst *, u32 *, struct nfsd_readlinkres *); 163int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *);
164int nfssvc_encode_readres(struct svc_rqst *, u32 *, struct nfsd_readres *); 164int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *);
165int nfssvc_encode_statfsres(struct svc_rqst *, u32 *, struct nfsd_statfsres *); 165int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *);
166int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *); 166int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *);
167 167
168int nfssvc_encode_entry(struct readdir_cd *, const char *name, 168int nfssvc_encode_entry(struct readdir_cd *, const char *name,
169 int namlen, loff_t offset, ino_t ino, unsigned int); 169 int namlen, loff_t offset, ino_t ino, unsigned int);
170 170
171int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); 171int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
172 172
173/* Helper functions for NFSv2 ACL code */ 173/* Helper functions for NFSv2 ACL code */
174u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp); 174__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp);
175u32 *nfs2svc_decode_fh(u32 *p, struct svc_fh *fhp); 175__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp);
176 176
177#endif /* LINUX_NFSD_H */ 177#endif /* LINUX_NFSD_H */
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index 474d882dc2f3..79963867b0d7 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -51,7 +51,7 @@ struct nfsd3_createargs {
51 int len; 51 int len;
52 int createmode; 52 int createmode;
53 struct iattr attrs; 53 struct iattr attrs;
54 __u32 * verf; 54 __be32 * verf;
55}; 55};
56 56
57struct nfsd3_mknodargs { 57struct nfsd3_mknodargs {
@@ -98,8 +98,8 @@ struct nfsd3_readdirargs {
98 __u64 cookie; 98 __u64 cookie;
99 __u32 dircount; 99 __u32 dircount;
100 __u32 count; 100 __u32 count;
101 __u32 * verf; 101 __be32 * verf;
102 u32 * buffer; 102 __be32 * buffer;
103}; 103};
104 104
105struct nfsd3_commitargs { 105struct nfsd3_commitargs {
@@ -122,79 +122,79 @@ struct nfsd3_setaclargs {
122}; 122};
123 123
124struct nfsd3_attrstat { 124struct nfsd3_attrstat {
125 __u32 status; 125 __be32 status;
126 struct svc_fh fh; 126 struct svc_fh fh;
127 struct kstat stat; 127 struct kstat stat;
128}; 128};
129 129
130/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */ 130/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
131struct nfsd3_diropres { 131struct nfsd3_diropres {
132 __u32 status; 132 __be32 status;
133 struct svc_fh dirfh; 133 struct svc_fh dirfh;
134 struct svc_fh fh; 134 struct svc_fh fh;
135}; 135};
136 136
137struct nfsd3_accessres { 137struct nfsd3_accessres {
138 __u32 status; 138 __be32 status;
139 struct svc_fh fh; 139 struct svc_fh fh;
140 __u32 access; 140 __u32 access;
141}; 141};
142 142
143struct nfsd3_readlinkres { 143struct nfsd3_readlinkres {
144 __u32 status; 144 __be32 status;
145 struct svc_fh fh; 145 struct svc_fh fh;
146 __u32 len; 146 __u32 len;
147}; 147};
148 148
149struct nfsd3_readres { 149struct nfsd3_readres {
150 __u32 status; 150 __be32 status;
151 struct svc_fh fh; 151 struct svc_fh fh;
152 unsigned long count; 152 unsigned long count;
153 int eof; 153 int eof;
154}; 154};
155 155
156struct nfsd3_writeres { 156struct nfsd3_writeres {
157 __u32 status; 157 __be32 status;
158 struct svc_fh fh; 158 struct svc_fh fh;
159 unsigned long count; 159 unsigned long count;
160 int committed; 160 int committed;
161}; 161};
162 162
163struct nfsd3_renameres { 163struct nfsd3_renameres {
164 __u32 status; 164 __be32 status;
165 struct svc_fh ffh; 165 struct svc_fh ffh;
166 struct svc_fh tfh; 166 struct svc_fh tfh;
167}; 167};
168 168
169struct nfsd3_linkres { 169struct nfsd3_linkres {
170 __u32 status; 170 __be32 status;
171 struct svc_fh tfh; 171 struct svc_fh tfh;
172 struct svc_fh fh; 172 struct svc_fh fh;
173}; 173};
174 174
175struct nfsd3_readdirres { 175struct nfsd3_readdirres {
176 __u32 status; 176 __be32 status;
177 struct svc_fh fh; 177 struct svc_fh fh;
178 int count; 178 int count;
179 __u32 verf[2]; 179 __be32 verf[2];
180 180
181 struct readdir_cd common; 181 struct readdir_cd common;
182 u32 * buffer; 182 __be32 * buffer;
183 int buflen; 183 int buflen;
184 u32 * offset; 184 __be32 * offset;
185 u32 * offset1; 185 __be32 * offset1;
186 struct svc_rqst * rqstp; 186 struct svc_rqst * rqstp;
187 187
188}; 188};
189 189
190struct nfsd3_fsstatres { 190struct nfsd3_fsstatres {
191 __u32 status; 191 __be32 status;
192 struct kstatfs stats; 192 struct kstatfs stats;
193 __u32 invarsec; 193 __u32 invarsec;
194}; 194};
195 195
196struct nfsd3_fsinfores { 196struct nfsd3_fsinfores {
197 __u32 status; 197 __be32 status;
198 __u32 f_rtmax; 198 __u32 f_rtmax;
199 __u32 f_rtpref; 199 __u32 f_rtpref;
200 __u32 f_rtmult; 200 __u32 f_rtmult;
@@ -207,7 +207,7 @@ struct nfsd3_fsinfores {
207}; 207};
208 208
209struct nfsd3_pathconfres { 209struct nfsd3_pathconfres {
210 __u32 status; 210 __be32 status;
211 __u32 p_link_max; 211 __u32 p_link_max;
212 __u32 p_name_max; 212 __u32 p_name_max;
213 __u32 p_no_trunc; 213 __u32 p_no_trunc;
@@ -217,12 +217,12 @@ struct nfsd3_pathconfres {
217}; 217};
218 218
219struct nfsd3_commitres { 219struct nfsd3_commitres {
220 __u32 status; 220 __be32 status;
221 struct svc_fh fh; 221 struct svc_fh fh;
222}; 222};
223 223
224struct nfsd3_getaclres { 224struct nfsd3_getaclres {
225 __u32 status; 225 __be32 status;
226 struct svc_fh fh; 226 struct svc_fh fh;
227 int mask; 227 int mask;
228 struct posix_acl *acl_access; 228 struct posix_acl *acl_access;
@@ -266,70 +266,70 @@ union nfsd3_xdrstore {
266 266
267#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) 267#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
268 268
269int nfs3svc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); 269int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
270int nfs3svc_decode_sattrargs(struct svc_rqst *, u32 *, 270int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *,
271 struct nfsd3_sattrargs *); 271 struct nfsd3_sattrargs *);
272int nfs3svc_decode_diropargs(struct svc_rqst *, u32 *, 272int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *,
273 struct nfsd3_diropargs *); 273 struct nfsd3_diropargs *);
274int nfs3svc_decode_accessargs(struct svc_rqst *, u32 *, 274int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *,
275 struct nfsd3_accessargs *); 275 struct nfsd3_accessargs *);
276int nfs3svc_decode_readargs(struct svc_rqst *, u32 *, 276int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *,
277 struct nfsd3_readargs *); 277 struct nfsd3_readargs *);
278int nfs3svc_decode_writeargs(struct svc_rqst *, u32 *, 278int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *,
279 struct nfsd3_writeargs *); 279 struct nfsd3_writeargs *);
280int nfs3svc_decode_createargs(struct svc_rqst *, u32 *, 280int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *,
281 struct nfsd3_createargs *); 281 struct nfsd3_createargs *);
282int nfs3svc_decode_mkdirargs(struct svc_rqst *, u32 *, 282int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *,
283 struct nfsd3_createargs *); 283 struct nfsd3_createargs *);
284int nfs3svc_decode_mknodargs(struct svc_rqst *, u32 *, 284int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *,
285 struct nfsd3_mknodargs *); 285 struct nfsd3_mknodargs *);
286int nfs3svc_decode_renameargs(struct svc_rqst *, u32 *, 286int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *,
287 struct nfsd3_renameargs *); 287 struct nfsd3_renameargs *);
288int nfs3svc_decode_readlinkargs(struct svc_rqst *, u32 *, 288int nfs3svc_decode_readlinkargs(struct svc_rqst *, __be32 *,
289 struct nfsd3_readlinkargs *); 289 struct nfsd3_readlinkargs *);
290int nfs3svc_decode_linkargs(struct svc_rqst *, u32 *, 290int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *,
291 struct nfsd3_linkargs *); 291 struct nfsd3_linkargs *);
292int nfs3svc_decode_symlinkargs(struct svc_rqst *, u32 *, 292int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *,
293 struct nfsd3_symlinkargs *); 293 struct nfsd3_symlinkargs *);
294int nfs3svc_decode_readdirargs(struct svc_rqst *, u32 *, 294int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *,
295 struct nfsd3_readdirargs *); 295 struct nfsd3_readdirargs *);
296int nfs3svc_decode_readdirplusargs(struct svc_rqst *, u32 *, 296int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *,
297 struct nfsd3_readdirargs *); 297 struct nfsd3_readdirargs *);
298int nfs3svc_decode_commitargs(struct svc_rqst *, u32 *, 298int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *,
299 struct nfsd3_commitargs *); 299 struct nfsd3_commitargs *);
300int nfs3svc_encode_voidres(struct svc_rqst *, u32 *, void *); 300int nfs3svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
301int nfs3svc_encode_attrstat(struct svc_rqst *, u32 *, 301int nfs3svc_encode_attrstat(struct svc_rqst *, __be32 *,
302 struct nfsd3_attrstat *); 302 struct nfsd3_attrstat *);
303int nfs3svc_encode_wccstat(struct svc_rqst *, u32 *, 303int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *,
304 struct nfsd3_attrstat *); 304 struct nfsd3_attrstat *);
305int nfs3svc_encode_diropres(struct svc_rqst *, u32 *, 305int nfs3svc_encode_diropres(struct svc_rqst *, __be32 *,
306 struct nfsd3_diropres *); 306 struct nfsd3_diropres *);
307int nfs3svc_encode_accessres(struct svc_rqst *, u32 *, 307int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *,
308 struct nfsd3_accessres *); 308 struct nfsd3_accessres *);
309int nfs3svc_encode_readlinkres(struct svc_rqst *, u32 *, 309int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *,
310 struct nfsd3_readlinkres *); 310 struct nfsd3_readlinkres *);
311int nfs3svc_encode_readres(struct svc_rqst *, u32 *, struct nfsd3_readres *); 311int nfs3svc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd3_readres *);
312int nfs3svc_encode_writeres(struct svc_rqst *, u32 *, struct nfsd3_writeres *); 312int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *, struct nfsd3_writeres *);
313int nfs3svc_encode_createres(struct svc_rqst *, u32 *, 313int nfs3svc_encode_createres(struct svc_rqst *, __be32 *,
314 struct nfsd3_diropres *); 314 struct nfsd3_diropres *);
315int nfs3svc_encode_renameres(struct svc_rqst *, u32 *, 315int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *,
316 struct nfsd3_renameres *); 316 struct nfsd3_renameres *);
317int nfs3svc_encode_linkres(struct svc_rqst *, u32 *, 317int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *,
318 struct nfsd3_linkres *); 318 struct nfsd3_linkres *);
319int nfs3svc_encode_readdirres(struct svc_rqst *, u32 *, 319int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *,
320 struct nfsd3_readdirres *); 320 struct nfsd3_readdirres *);
321int nfs3svc_encode_fsstatres(struct svc_rqst *, u32 *, 321int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *,
322 struct nfsd3_fsstatres *); 322 struct nfsd3_fsstatres *);
323int nfs3svc_encode_fsinfores(struct svc_rqst *, u32 *, 323int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *,
324 struct nfsd3_fsinfores *); 324 struct nfsd3_fsinfores *);
325int nfs3svc_encode_pathconfres(struct svc_rqst *, u32 *, 325int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *,
326 struct nfsd3_pathconfres *); 326 struct nfsd3_pathconfres *);
327int nfs3svc_encode_commitres(struct svc_rqst *, u32 *, 327int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *,
328 struct nfsd3_commitres *); 328 struct nfsd3_commitres *);
329 329
330int nfs3svc_release_fhandle(struct svc_rqst *, u32 *, 330int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *,
331 struct nfsd3_attrstat *); 331 struct nfsd3_attrstat *);
332int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *, 332int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *,
333 struct nfsd3_fhandle_pair *); 333 struct nfsd3_fhandle_pair *);
334int nfs3svc_encode_entry(struct readdir_cd *, const char *name, 334int nfs3svc_encode_entry(struct readdir_cd *, const char *name,
335 int namlen, loff_t offset, ino_t ino, 335 int namlen, loff_t offset, ino_t ino,
@@ -338,9 +338,9 @@ int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name,
338 int namlen, loff_t offset, ino_t ino, 338 int namlen, loff_t offset, ino_t ino,
339 unsigned int); 339 unsigned int);
340/* Helper functions for NFSv3 ACL code */ 340/* Helper functions for NFSv3 ACL code */
341u32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, 341__be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p,
342 struct svc_fh *fhp); 342 struct svc_fh *fhp);
343u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp); 343__be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp);
344 344
345 345
346#endif /* _LINUX_NFSD_XDR3_H */ 346#endif /* _LINUX_NFSD_XDR3_H */
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 66e642762a07..45ca01b5f844 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -258,9 +258,9 @@ struct nfsd4_readdir {
258 struct svc_fh * rd_fhp; /* response */ 258 struct svc_fh * rd_fhp; /* response */
259 259
260 struct readdir_cd common; 260 struct readdir_cd common;
261 u32 * buffer; 261 __be32 * buffer;
262 int buflen; 262 int buflen;
263 u32 * offset; 263 __be32 * offset;
264}; 264};
265 265
266struct nfsd4_release_lockowner { 266struct nfsd4_release_lockowner {
@@ -334,7 +334,7 @@ struct nfsd4_write {
334 334
335struct nfsd4_op { 335struct nfsd4_op {
336 int opnum; 336 int opnum;
337 int status; 337 __be32 status;
338 union { 338 union {
339 struct nfsd4_access access; 339 struct nfsd4_access access;
340 struct nfsd4_close close; 340 struct nfsd4_close close;
@@ -371,12 +371,12 @@ struct nfsd4_op {
371 371
372struct nfsd4_compoundargs { 372struct nfsd4_compoundargs {
373 /* scratch variables for XDR decode */ 373 /* scratch variables for XDR decode */
374 u32 * p; 374 __be32 * p;
375 u32 * end; 375 __be32 * end;
376 struct page ** pagelist; 376 struct page ** pagelist;
377 int pagelen; 377 int pagelen;
378 u32 tmp[8]; 378 __be32 tmp[8];
379 u32 * tmpp; 379 __be32 * tmpp;
380 struct tmpbuf { 380 struct tmpbuf {
381 struct tmpbuf *next; 381 struct tmpbuf *next;
382 void (*release)(const void *); 382 void (*release)(const void *);
@@ -395,15 +395,15 @@ struct nfsd4_compoundargs {
395 395
396struct nfsd4_compoundres { 396struct nfsd4_compoundres {
397 /* scratch variables for XDR encode */ 397 /* scratch variables for XDR encode */
398 u32 * p; 398 __be32 * p;
399 u32 * end; 399 __be32 * end;
400 struct xdr_buf * xbuf; 400 struct xdr_buf * xbuf;
401 struct svc_rqst * rqstp; 401 struct svc_rqst * rqstp;
402 402
403 u32 taglen; 403 u32 taglen;
404 char * tag; 404 char * tag;
405 u32 opcnt; 405 u32 opcnt;
406 u32 * tagp; /* where to encode tag and opcount */ 406 __be32 * tagp; /* where to encode tag and opcount */
407}; 407};
408 408
409#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) 409#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
@@ -419,45 +419,45 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
419 cinfo->after_ctime_nsec = fhp->fh_post_ctime.tv_nsec; 419 cinfo->after_ctime_nsec = fhp->fh_post_ctime.tv_nsec;
420} 420}
421 421
422int nfs4svc_encode_voidres(struct svc_rqst *, u32 *, void *); 422int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
423int nfs4svc_decode_compoundargs(struct svc_rqst *, u32 *, 423int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *,
424 struct nfsd4_compoundargs *); 424 struct nfsd4_compoundargs *);
425int nfs4svc_encode_compoundres(struct svc_rqst *, u32 *, 425int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *,
426 struct nfsd4_compoundres *); 426 struct nfsd4_compoundres *);
427void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *); 427void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
428void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op); 428void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op);
429int nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, 429__be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
430 struct dentry *dentry, u32 *buffer, int *countp, 430 struct dentry *dentry, __be32 *buffer, int *countp,
431 u32 *bmval, struct svc_rqst *); 431 u32 *bmval, struct svc_rqst *);
432extern int nfsd4_setclientid(struct svc_rqst *rqstp, 432extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
433 struct nfsd4_setclientid *setclid); 433 struct nfsd4_setclientid *setclid);
434extern int nfsd4_setclientid_confirm(struct svc_rqst *rqstp, 434extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
435 struct nfsd4_setclientid_confirm *setclientid_confirm); 435 struct nfsd4_setclientid_confirm *setclientid_confirm);
436extern int nfsd4_process_open1(struct nfsd4_open *open); 436extern __be32 nfsd4_process_open1(struct nfsd4_open *open);
437extern int nfsd4_process_open2(struct svc_rqst *rqstp, 437extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
438 struct svc_fh *current_fh, struct nfsd4_open *open); 438 struct svc_fh *current_fh, struct nfsd4_open *open);
439extern int nfsd4_open_confirm(struct svc_rqst *rqstp, 439extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
440 struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, 440 struct svc_fh *current_fh, struct nfsd4_open_confirm *oc,
441 struct nfs4_stateowner **); 441 struct nfs4_stateowner **);
442extern int nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, 442extern __be32 nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh,
443 struct nfsd4_close *close, 443 struct nfsd4_close *close,
444 struct nfs4_stateowner **replay_owner); 444 struct nfs4_stateowner **replay_owner);
445extern int nfsd4_open_downgrade(struct svc_rqst *rqstp, 445extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp,
446 struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, 446 struct svc_fh *current_fh, struct nfsd4_open_downgrade *od,
447 struct nfs4_stateowner **replay_owner); 447 struct nfs4_stateowner **replay_owner);
448extern int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, 448extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh,
449 struct nfsd4_lock *lock, 449 struct nfsd4_lock *lock,
450 struct nfs4_stateowner **replay_owner); 450 struct nfs4_stateowner **replay_owner);
451extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, 451extern __be32 nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh,
452 struct nfsd4_lockt *lockt); 452 struct nfsd4_lockt *lockt);
453extern int nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, 453extern __be32 nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh,
454 struct nfsd4_locku *locku, 454 struct nfsd4_locku *locku,
455 struct nfs4_stateowner **replay_owner); 455 struct nfs4_stateowner **replay_owner);
456extern int 456extern __be32
457nfsd4_release_lockowner(struct svc_rqst *rqstp, 457nfsd4_release_lockowner(struct svc_rqst *rqstp,
458 struct nfsd4_release_lockowner *rlockowner); 458 struct nfsd4_release_lockowner *rlockowner);
459extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *); 459extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *);
460extern int nfsd4_delegreturn(struct svc_rqst *rqstp, 460extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp,
461 struct svc_fh *current_fh, struct nfsd4_delegreturn *dr); 461 struct svc_fh *current_fh, struct nfsd4_delegreturn *dr);
462#endif 462#endif
463 463
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 5dce5c21822c..b1063e9cdb1b 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -8,8 +8,8 @@
8 * See detailed comments in the file linux/bitmap.h describing the 8 * See detailed comments in the file linux/bitmap.h describing the
9 * data type on which these nodemasks are based. 9 * data type on which these nodemasks are based.
10 * 10 *
11 * For details of nodemask_scnprintf() and nodemask_parse(), 11 * For details of nodemask_scnprintf() and nodemask_parse_user(),
12 * see bitmap_scnprintf() and bitmap_parse() in lib/bitmap.c. 12 * see bitmap_scnprintf() and bitmap_parse_user() in lib/bitmap.c.
13 * For details of nodelist_scnprintf() and nodelist_parse(), see 13 * For details of nodelist_scnprintf() and nodelist_parse(), see
14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. 14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
15 * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c. 15 * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c.
@@ -51,7 +51,7 @@
51 * unsigned long *nodes_addr(mask) Array of unsigned long's in mask 51 * unsigned long *nodes_addr(mask) Array of unsigned long's in mask
52 * 52 *
53 * int nodemask_scnprintf(buf, len, mask) Format nodemask for printing 53 * int nodemask_scnprintf(buf, len, mask) Format nodemask for printing
54 * int nodemask_parse(ubuf, ulen, mask) Parse ascii string as nodemask 54 * int nodemask_parse_user(ubuf, ulen, mask) Parse ascii string as nodemask
55 * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing 55 * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing
56 * int nodelist_parse(buf, map) Parse ascii string as nodelist 56 * int nodelist_parse(buf, map) Parse ascii string as nodelist
57 * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit) 57 * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
@@ -288,12 +288,12 @@ static inline int __nodemask_scnprintf(char *buf, int len,
288 return bitmap_scnprintf(buf, len, srcp->bits, nbits); 288 return bitmap_scnprintf(buf, len, srcp->bits, nbits);
289} 289}
290 290
291#define nodemask_parse(ubuf, ulen, dst) \ 291#define nodemask_parse_user(ubuf, ulen, dst) \
292 __nodemask_parse((ubuf), (ulen), &(dst), MAX_NUMNODES) 292 __nodemask_parse_user((ubuf), (ulen), &(dst), MAX_NUMNODES)
293static inline int __nodemask_parse(const char __user *buf, int len, 293static inline int __nodemask_parse_user(const char __user *buf, int len,
294 nodemask_t *dstp, int nbits) 294 nodemask_t *dstp, int nbits)
295{ 295{
296 return bitmap_parse(buf, len, dstp->bits, nbits); 296 return bitmap_parse_user(buf, len, dstp->bits, nbits);
297} 297}
298 298
299#define nodelist_scnprintf(buf, len, src) \ 299#define nodelist_scnprintf(buf, len, src) \
diff --git a/include/linux/oom.h b/include/linux/oom.h
new file mode 100644
index 000000000000..ad76463629a0
--- /dev/null
+++ b/include/linux/oom.h
@@ -0,0 +1,10 @@
1#ifndef __INCLUDE_LINUX_OOM_H
2#define __INCLUDE_LINUX_OOM_H
3
4/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
5#define OOM_DISABLE (-17)
6/* inclusive */
7#define OOM_ADJUST_MIN (-16)
8#define OOM_ADJUST_MAX 15
9
10#endif
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 64f950925151..c3e255bf8594 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -52,19 +52,23 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
52void release_pages(struct page **pages, int nr, int cold); 52void release_pages(struct page **pages, int nr, int cold);
53 53
54#ifdef CONFIG_NUMA 54#ifdef CONFIG_NUMA
55extern struct page *page_cache_alloc(struct address_space *x); 55extern struct page *__page_cache_alloc(gfp_t gfp);
56extern struct page *page_cache_alloc_cold(struct address_space *x);
57#else 56#else
57static inline struct page *__page_cache_alloc(gfp_t gfp)
58{
59 return alloc_pages(gfp, 0);
60}
61#endif
62
58static inline struct page *page_cache_alloc(struct address_space *x) 63static inline struct page *page_cache_alloc(struct address_space *x)
59{ 64{
60 return alloc_pages(mapping_gfp_mask(x), 0); 65 return __page_cache_alloc(mapping_gfp_mask(x));
61} 66}
62 67
63static inline struct page *page_cache_alloc_cold(struct address_space *x) 68static inline struct page *page_cache_alloc_cold(struct address_space *x)
64{ 69{
65 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0); 70 return __page_cache_alloc(mapping_gfp_mask(x)|__GFP_COLD);
66} 71}
67#endif
68 72
69typedef int filler_t(void *, struct page *); 73typedef int filler_t(void *, struct page *);
70 74
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5c604f5fad67..09be0f81b27b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -443,6 +443,7 @@ extern void pci_remove_bus(struct pci_bus *b);
443extern void pci_remove_bus_device(struct pci_dev *dev); 443extern void pci_remove_bus_device(struct pci_dev *dev);
444extern void pci_stop_bus_device(struct pci_dev *dev); 444extern void pci_stop_bus_device(struct pci_dev *dev);
445void pci_setup_cardbus(struct pci_bus *bus); 445void pci_setup_cardbus(struct pci_bus *bus);
446extern void pci_sort_breadthfirst(void);
446 447
447/* Generic PCI functions exported to card drivers */ 448/* Generic PCI functions exported to card drivers */
448 449
@@ -452,13 +453,18 @@ struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn);
452int pci_find_capability (struct pci_dev *dev, int cap); 453int pci_find_capability (struct pci_dev *dev, int cap);
453int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); 454int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap);
454int pci_find_ext_capability (struct pci_dev *dev, int cap); 455int pci_find_ext_capability (struct pci_dev *dev, int cap);
455struct pci_bus * pci_find_next_bus(const struct pci_bus *from); 456struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
457
458struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
459 struct pci_dev *from);
460struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device,
461 struct pci_dev *from);
456 462
457struct pci_dev *pci_get_device (unsigned int vendor, unsigned int device, struct pci_dev *from);
458struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, 463struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device,
459 unsigned int ss_vendor, unsigned int ss_device, 464 unsigned int ss_vendor, unsigned int ss_device,
460 struct pci_dev *from); 465 struct pci_dev *from);
461struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn); 466struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn);
467struct pci_dev *pci_get_bus_and_slot (unsigned int bus, unsigned int devfn);
462struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from); 468struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from);
463int pci_dev_present(const struct pci_device_id *ids); 469int pci_dev_present(const struct pci_device_id *ids);
464 470
@@ -658,7 +664,12 @@ static inline struct pci_dev *pci_find_device(unsigned int vendor, unsigned int
658static inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) 664static inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn)
659{ return NULL; } 665{ return NULL; }
660 666
661static inline struct pci_dev *pci_get_device (unsigned int vendor, unsigned int device, struct pci_dev *from) 667static inline struct pci_dev *pci_get_device(unsigned int vendor,
668 unsigned int device, struct pci_dev *from)
669{ return NULL; }
670
671static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor,
672 unsigned int device, struct pci_dev *from)
662{ return NULL; } 673{ return NULL; }
663 674
664static inline struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, 675static inline struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device,
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
new file mode 100644
index 000000000000..a675a05c4091
--- /dev/null
+++ b/include/linux/pci_hotplug.h
@@ -0,0 +1,236 @@
1/*
2 * PCI HotPlug Core Functions
3 *
4 * Copyright (C) 1995,2001 Compaq Computer Corporation
5 * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
6 * Copyright (C) 2001 IBM Corp.
7 *
8 * All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or (at
13 * your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
18 * NON INFRINGEMENT. See the GNU General Public License for more
19 * details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 * Send feedback to <kristen.c.accardi@intel.com>
26 *
27 */
28#ifndef _PCI_HOTPLUG_H
29#define _PCI_HOTPLUG_H
30
31
32/* These values come from the PCI Hotplug Spec */
33enum pci_bus_speed {
34 PCI_SPEED_33MHz = 0x00,
35 PCI_SPEED_66MHz = 0x01,
36 PCI_SPEED_66MHz_PCIX = 0x02,
37 PCI_SPEED_100MHz_PCIX = 0x03,
38 PCI_SPEED_133MHz_PCIX = 0x04,
39 PCI_SPEED_66MHz_PCIX_ECC = 0x05,
40 PCI_SPEED_100MHz_PCIX_ECC = 0x06,
41 PCI_SPEED_133MHz_PCIX_ECC = 0x07,
42 PCI_SPEED_66MHz_PCIX_266 = 0x09,
43 PCI_SPEED_100MHz_PCIX_266 = 0x0a,
44 PCI_SPEED_133MHz_PCIX_266 = 0x0b,
45 PCI_SPEED_66MHz_PCIX_533 = 0x11,
46 PCI_SPEED_100MHz_PCIX_533 = 0x12,
47 PCI_SPEED_133MHz_PCIX_533 = 0x13,
48 PCI_SPEED_UNKNOWN = 0xff,
49};
50
51/* These values come from the PCI Express Spec */
52enum pcie_link_width {
53 PCIE_LNK_WIDTH_RESRV = 0x00,
54 PCIE_LNK_X1 = 0x01,
55 PCIE_LNK_X2 = 0x02,
56 PCIE_LNK_X4 = 0x04,
57 PCIE_LNK_X8 = 0x08,
58 PCIE_LNK_X12 = 0x0C,
59 PCIE_LNK_X16 = 0x10,
60 PCIE_LNK_X32 = 0x20,
61 PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
62};
63
64enum pcie_link_speed {
65 PCIE_2PT5GB = 0x14,
66 PCIE_LNK_SPEED_UNKNOWN = 0xFF,
67};
68
69struct hotplug_slot;
70struct hotplug_slot_attribute {
71 struct attribute attr;
72 ssize_t (*show)(struct hotplug_slot *, char *);
73 ssize_t (*store)(struct hotplug_slot *, const char *, size_t);
74};
75#define to_hotplug_attr(n) container_of(n, struct hotplug_slot_attribute, attr);
76
77/**
78 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
79 * @owner: The module owner of this structure
80 * @enable_slot: Called when the user wants to enable a specific pci slot
81 * @disable_slot: Called when the user wants to disable a specific pci slot
82 * @set_attention_status: Called to set the specific slot's attention LED to
83 * the specified value
84 * @hardware_test: Called to run a specified hardware test on the specified
85 * slot.
86 * @get_power_status: Called to get the current power status of a slot.
87 * If this field is NULL, the value passed in the struct hotplug_slot_info
88 * will be used when this value is requested by a user.
89 * @get_attention_status: Called to get the current attention status of a slot.
90 * If this field is NULL, the value passed in the struct hotplug_slot_info
91 * will be used when this value is requested by a user.
92 * @get_latch_status: Called to get the current latch status of a slot.
93 * If this field is NULL, the value passed in the struct hotplug_slot_info
94 * will be used when this value is requested by a user.
95 * @get_adapter_status: Called to get see if an adapter is present in the slot or not.
96 * If this field is NULL, the value passed in the struct hotplug_slot_info
97 * will be used when this value is requested by a user.
98 * @get_address: Called to get pci address of a slot.
99 * If this field is NULL, the value passed in the struct hotplug_slot_info
100 * will be used when this value is requested by a user.
101 * @get_max_bus_speed: Called to get the max bus speed for a slot.
102 * If this field is NULL, the value passed in the struct hotplug_slot_info
103 * will be used when this value is requested by a user.
104 * @get_cur_bus_speed: Called to get the current bus speed for a slot.
105 * If this field is NULL, the value passed in the struct hotplug_slot_info
106 * will be used when this value is requested by a user.
107 *
108 * The table of function pointers that is passed to the hotplug pci core by a
109 * hotplug pci driver. These functions are called by the hotplug pci core when
110 * the user wants to do something to a specific slot (query it for information,
111 * set an LED, enable / disable power, etc.)
112 */
113struct hotplug_slot_ops {
114 struct module *owner;
115 int (*enable_slot) (struct hotplug_slot *slot);
116 int (*disable_slot) (struct hotplug_slot *slot);
117 int (*set_attention_status) (struct hotplug_slot *slot, u8 value);
118 int (*hardware_test) (struct hotplug_slot *slot, u32 value);
119 int (*get_power_status) (struct hotplug_slot *slot, u8 *value);
120 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value);
121 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value);
122 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value);
123 int (*get_address) (struct hotplug_slot *slot, u32 *value);
124 int (*get_max_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value);
125 int (*get_cur_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value);
126};
127
128/**
129 * struct hotplug_slot_info - used to notify the hotplug pci core of the state of the slot
130 * @power: if power is enabled or not (1/0)
131 * @attention_status: if the attention light is enabled or not (1/0)
132 * @latch_status: if the latch (if any) is open or closed (1/0)
133 * @adapter_present: if there is a pci board present in the slot or not (1/0)
134 * @address: (domain << 16 | bus << 8 | dev)
135 *
136 * Used to notify the hotplug pci core of the status of a specific slot.
137 */
138struct hotplug_slot_info {
139 u8 power_status;
140 u8 attention_status;
141 u8 latch_status;
142 u8 adapter_status;
143 u32 address;
144 enum pci_bus_speed max_bus_speed;
145 enum pci_bus_speed cur_bus_speed;
146};
147
148/**
149 * struct hotplug_slot - used to register a physical slot with the hotplug pci core
150 * @name: the name of the slot being registered. This string must
151 * be unique amoung slots registered on this system.
152 * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot
153 * @info: pointer to the &struct hotplug_slot_info for the initial values for
154 * this slot.
155 * @release: called during pci_hp_deregister to free memory allocated in a
156 * hotplug_slot structure.
157 * @private: used by the hotplug pci controller driver to store whatever it
158 * needs.
159 */
160struct hotplug_slot {
161 char *name;
162 struct hotplug_slot_ops *ops;
163 struct hotplug_slot_info *info;
164 void (*release) (struct hotplug_slot *slot);
165 void *private;
166
167 /* Variables below this are for use only by the hotplug pci core. */
168 struct list_head slot_list;
169 struct kobject kobj;
170};
171#define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj)
172
173extern int pci_hp_register (struct hotplug_slot *slot);
174extern int pci_hp_deregister (struct hotplug_slot *slot);
175extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
176 struct hotplug_slot_info *info);
177extern struct subsystem pci_hotplug_slots_subsys;
178
179/* PCI Setting Record (Type 0) */
180struct hpp_type0 {
181 u32 revision;
182 u8 cache_line_size;
183 u8 latency_timer;
184 u8 enable_serr;
185 u8 enable_perr;
186};
187
188/* PCI-X Setting Record (Type 1) */
189struct hpp_type1 {
190 u32 revision;
191 u8 max_mem_read;
192 u8 avg_max_split;
193 u16 tot_max_split;
194};
195
196/* PCI Express Setting Record (Type 2) */
197struct hpp_type2 {
198 u32 revision;
199 u32 unc_err_mask_and;
200 u32 unc_err_mask_or;
201 u32 unc_err_sever_and;
202 u32 unc_err_sever_or;
203 u32 cor_err_mask_and;
204 u32 cor_err_mask_or;
205 u32 adv_err_cap_and;
206 u32 adv_err_cap_or;
207 u16 pci_exp_devctl_and;
208 u16 pci_exp_devctl_or;
209 u16 pci_exp_lnkctl_and;
210 u16 pci_exp_lnkctl_or;
211 u32 sec_unc_err_sever_and;
212 u32 sec_unc_err_sever_or;
213 u32 sec_unc_err_mask_and;
214 u32 sec_unc_err_mask_or;
215};
216
217struct hotplug_params {
218 struct hpp_type0 *t0; /* Type0: NULL if not available */
219 struct hpp_type1 *t1; /* Type1: NULL if not available */
220 struct hpp_type2 *t2; /* Type2: NULL if not available */
221 struct hpp_type0 type0_data;
222 struct hpp_type1 type1_data;
223 struct hpp_type2 type2_data;
224};
225
226#ifdef CONFIG_ACPI
227#include <acpi/acpi.h>
228#include <acpi/acpi_bus.h>
229#include <acpi/actypes.h>
230extern acpi_status acpi_run_oshp(acpi_handle handle);
231extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
232 struct hotplug_params *hpp);
233int acpi_root_bridge(acpi_handle handle);
234#endif
235#endif
236
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f069df245469..fa4e1d799782 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1213,6 +1213,7 @@
1213#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 1213#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
1214#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 1214#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452
1215#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453 1215#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453
1216#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560
1216 1217
1217#define PCI_VENDOR_ID_IMS 0x10e0 1218#define PCI_VENDOR_ID_IMS 0x10e0
1218#define PCI_DEVICE_ID_IMS_TT128 0x9128 1219#define PCI_DEVICE_ID_IMS_TT128 0x9128
@@ -2351,3 +2352,5 @@
2351#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897 2352#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897
2352#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898 2353#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898
2353 2354
2355#define PCI_VENDOR_ID_QUICKNET 0x15E2
2356#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index c312a12ad2d6..c321316f1bc7 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -371,6 +371,7 @@
371#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ 371#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
372#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ 372#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
373#define PCI_EXP_LNKCTL 16 /* Link Control */ 373#define PCI_EXP_LNKCTL 16 /* Link Control */
374#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */
374#define PCI_EXP_LNKSTA 18 /* Link Status */ 375#define PCI_EXP_LNKSTA 18 /* Link Status */
375#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ 376#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
376#define PCI_EXP_SLTCTL 24 /* Slot Control */ 377#define PCI_EXP_SLTCTL 24 /* Slot Control */
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 80d780e5a8f5..012cd558189b 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_PERSONALITY_H 1#ifndef _LINUX_PERSONALITY_H
2#define _LINUX_PERSONALITY_H 2#define _LINUX_PERSONALITY_H
3 3
4#ifdef __KERNEL__
5
4/* 6/*
5 * Handling of different ABIs (personalities). 7 * Handling of different ABIs (personalities).
6 */ 8 */
@@ -12,6 +14,8 @@ extern int register_exec_domain(struct exec_domain *);
12extern int unregister_exec_domain(struct exec_domain *); 14extern int unregister_exec_domain(struct exec_domain *);
13extern int __set_personality(unsigned long); 15extern int __set_personality(unsigned long);
14 16
17#endif /* __KERNEL__ */
18
15/* 19/*
16 * Flags for bug emulation. 20 * Flags for bug emulation.
17 * 21 *
@@ -71,6 +75,7 @@ enum {
71 PER_MASK = 0x00ff, 75 PER_MASK = 0x00ff,
72}; 76};
73 77
78#ifdef __KERNEL__
74 79
75/* 80/*
76 * Description of an execution domain. 81 * Description of an execution domain.
@@ -109,6 +114,8 @@ struct exec_domain {
109 * Change personality of the currently running process. 114 * Change personality of the currently running process.
110 */ 115 */
111#define set_personality(pers) \ 116#define set_personality(pers) \
112 ((current->personality == pers) ? 0 : __set_personality(pers)) 117 ((current->personality == (pers)) ? 0 : __set_personality(pers))
118
119#endif /* __KERNEL__ */
113 120
114#endif /* _LINUX_PERSONALITY_H */ 121#endif /* _LINUX_PERSONALITY_H */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 6b27e07aef19..070394e846d0 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -116,7 +116,9 @@ typedef int __bitwise suspend_disk_method_t;
116#define PM_DISK_PLATFORM ((__force suspend_disk_method_t) 2) 116#define PM_DISK_PLATFORM ((__force suspend_disk_method_t) 2)
117#define PM_DISK_SHUTDOWN ((__force suspend_disk_method_t) 3) 117#define PM_DISK_SHUTDOWN ((__force suspend_disk_method_t) 3)
118#define PM_DISK_REBOOT ((__force suspend_disk_method_t) 4) 118#define PM_DISK_REBOOT ((__force suspend_disk_method_t) 4)
119#define PM_DISK_MAX ((__force suspend_disk_method_t) 5) 119#define PM_DISK_TEST ((__force suspend_disk_method_t) 5)
120#define PM_DISK_TESTPROC ((__force suspend_disk_method_t) 6)
121#define PM_DISK_MAX ((__force suspend_disk_method_t) 7)
120 122
121struct pm_ops { 123struct pm_ops {
122 suspend_disk_method_t pm_disk_mode; 124 suspend_disk_method_t pm_disk_mode;
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 84d887751855..ebd42a3710b4 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -146,16 +146,16 @@ enum bitmap_state {
146 146
147/* the superblock at the front of the bitmap file -- little endian */ 147/* the superblock at the front of the bitmap file -- little endian */
148typedef struct bitmap_super_s { 148typedef struct bitmap_super_s {
149 __u32 magic; /* 0 BITMAP_MAGIC */ 149 __le32 magic; /* 0 BITMAP_MAGIC */
150 __u32 version; /* 4 the bitmap major for now, could change... */ 150 __le32 version; /* 4 the bitmap major for now, could change... */
151 __u8 uuid[16]; /* 8 128 bit uuid - must match md device uuid */ 151 __u8 uuid[16]; /* 8 128 bit uuid - must match md device uuid */
152 __u64 events; /* 24 event counter for the bitmap (1)*/ 152 __le64 events; /* 24 event counter for the bitmap (1)*/
153 __u64 events_cleared;/*32 event counter when last bit cleared (2) */ 153 __le64 events_cleared;/*32 event counter when last bit cleared (2) */
154 __u64 sync_size; /* 40 the size of the md device's sync range(3) */ 154 __le64 sync_size; /* 40 the size of the md device's sync range(3) */
155 __u32 state; /* 48 bitmap state information */ 155 __le32 state; /* 48 bitmap state information */
156 __u32 chunksize; /* 52 the bitmap chunk size in bytes */ 156 __le32 chunksize; /* 52 the bitmap chunk size in bytes */
157 __u32 daemon_sleep; /* 56 seconds between disk flushes */ 157 __le32 daemon_sleep; /* 56 seconds between disk flushes */
158 __u32 write_behind; /* 60 number of outstanding write-behind writes */ 158 __le32 write_behind; /* 60 number of outstanding write-behind writes */
159 159
160 __u8 pad[256 - 64]; /* set to zero */ 160 __u8 pad[256 - 64]; /* set to zero */
161} bitmap_super_t; 161} bitmap_super_t;
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index b6ebc69bae54..3f2cd98c508b 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -206,52 +206,52 @@ static inline __u64 md_event(mdp_super_t *sb) {
206 */ 206 */
207struct mdp_superblock_1 { 207struct mdp_superblock_1 {
208 /* constant array information - 128 bytes */ 208 /* constant array information - 128 bytes */
209 __u32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */ 209 __le32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */
210 __u32 major_version; /* 1 */ 210 __le32 major_version; /* 1 */
211 __u32 feature_map; /* bit 0 set if 'bitmap_offset' is meaningful */ 211 __le32 feature_map; /* bit 0 set if 'bitmap_offset' is meaningful */
212 __u32 pad0; /* always set to 0 when writing */ 212 __le32 pad0; /* always set to 0 when writing */
213 213
214 __u8 set_uuid[16]; /* user-space generated. */ 214 __u8 set_uuid[16]; /* user-space generated. */
215 char set_name[32]; /* set and interpreted by user-space */ 215 char set_name[32]; /* set and interpreted by user-space */
216 216
217 __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ 217 __le64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/
218 __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ 218 __le32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */
219 __u32 layout; /* only for raid5 and raid10 currently */ 219 __le32 layout; /* only for raid5 and raid10 currently */
220 __u64 size; /* used size of component devices, in 512byte sectors */ 220 __le64 size; /* used size of component devices, in 512byte sectors */
221 221
222 __u32 chunksize; /* in 512byte sectors */ 222 __le32 chunksize; /* in 512byte sectors */
223 __u32 raid_disks; 223 __le32 raid_disks;
224 __u32 bitmap_offset; /* sectors after start of superblock that bitmap starts 224 __le32 bitmap_offset; /* sectors after start of superblock that bitmap starts
225 * NOTE: signed, so bitmap can be before superblock 225 * NOTE: signed, so bitmap can be before superblock
226 * only meaningful of feature_map[0] is set. 226 * only meaningful of feature_map[0] is set.
227 */ 227 */
228 228
229 /* These are only valid with feature bit '4' */ 229 /* These are only valid with feature bit '4' */
230 __u32 new_level; /* new level we are reshaping to */ 230 __le32 new_level; /* new level we are reshaping to */
231 __u64 reshape_position; /* next address in array-space for reshape */ 231 __le64 reshape_position; /* next address in array-space for reshape */
232 __u32 delta_disks; /* change in number of raid_disks */ 232 __le32 delta_disks; /* change in number of raid_disks */
233 __u32 new_layout; /* new layout */ 233 __le32 new_layout; /* new layout */
234 __u32 new_chunk; /* new chunk size (bytes) */ 234 __le32 new_chunk; /* new chunk size (bytes) */
235 __u8 pad1[128-124]; /* set to 0 when written */ 235 __u8 pad1[128-124]; /* set to 0 when written */
236 236
237 /* constant this-device information - 64 bytes */ 237 /* constant this-device information - 64 bytes */
238 __u64 data_offset; /* sector start of data, often 0 */ 238 __le64 data_offset; /* sector start of data, often 0 */
239 __u64 data_size; /* sectors in this device that can be used for data */ 239 __le64 data_size; /* sectors in this device that can be used for data */
240 __u64 super_offset; /* sector start of this superblock */ 240 __le64 super_offset; /* sector start of this superblock */
241 __u64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */ 241 __le64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */
242 __u32 dev_number; /* permanent identifier of this device - not role in raid */ 242 __le32 dev_number; /* permanent identifier of this device - not role in raid */
243 __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ 243 __le32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */
244 __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ 244 __u8 device_uuid[16]; /* user-space setable, ignored by kernel */
245 __u8 devflags; /* per-device flags. Only one defined...*/ 245 __u8 devflags; /* per-device flags. Only one defined...*/
246#define WriteMostly1 1 /* mask for writemostly flag in above */ 246#define WriteMostly1 1 /* mask for writemostly flag in above */
247 __u8 pad2[64-57]; /* set to 0 when writing */ 247 __u8 pad2[64-57]; /* set to 0 when writing */
248 248
249 /* array state information - 64 bytes */ 249 /* array state information - 64 bytes */
250 __u64 utime; /* 40 bits second, 24 btes microseconds */ 250 __le64 utime; /* 40 bits second, 24 btes microseconds */
251 __u64 events; /* incremented when superblock updated */ 251 __le64 events; /* incremented when superblock updated */
252 __u64 resync_offset; /* data before this offset (from data_offset) known to be in sync */ 252 __le64 resync_offset; /* data before this offset (from data_offset) known to be in sync */
253 __u32 sb_csum; /* checksum upto devs[max_dev] */ 253 __le32 sb_csum; /* checksum upto devs[max_dev] */
254 __u32 max_dev; /* size of devs[] array to consider */ 254 __le32 max_dev; /* size of devs[] array to consider */
255 __u8 pad3[64-32]; /* set to 0 when writing */ 255 __u8 pad3[64-32]; /* set to 0 when writing */
256 256
257 /* device state information. Indexed by dev_number. 257 /* device state information. Indexed by dev_number.
@@ -260,7 +260,7 @@ struct mdp_superblock_1 {
260 * into the 'roles' value. If a device is spare or faulty, then it doesn't 260 * into the 'roles' value. If a device is spare or faulty, then it doesn't
261 * have a meaningful role. 261 * have a meaningful role.
262 */ 262 */
263 __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ 263 __le16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */
264}; 264};
265 265
266/* feature_map bits */ 266/* feature_map bits */
diff --git a/include/linux/random.h b/include/linux/random.h
index 5d6456bcdeba..0248b30e306d 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -69,6 +69,9 @@ extern struct file_operations random_fops, urandom_fops;
69unsigned int get_random_int(void); 69unsigned int get_random_int(void);
70unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len); 70unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
71 71
72u32 random32(void);
73void srandom32(u32 seed);
74
72#endif /* __KERNEL___ */ 75#endif /* __KERNEL___ */
73 76
74#endif /* _LINUX_RANDOM_H */ 77#endif /* _LINUX_RANDOM_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6735c1cf334c..eafe4a7b8237 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -466,7 +466,6 @@ struct signal_struct {
466 struct pacct_struct pacct; /* per-process accounting information */ 466 struct pacct_struct pacct; /* per-process accounting information */
467#endif 467#endif
468#ifdef CONFIG_TASKSTATS 468#ifdef CONFIG_TASKSTATS
469 spinlock_t stats_lock;
470 struct taskstats *stats; 469 struct taskstats *stats;
471#endif 470#endif
472}; 471};
diff --git a/include/linux/security.h b/include/linux/security.h
index 9b5fea81f55e..b200b9856f32 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -882,7 +882,8 @@ struct request_sock;
882 * Check permission when a flow selects a xfrm_policy for processing 882 * Check permission when a flow selects a xfrm_policy for processing
883 * XFRMs on a packet. The hook is called when selecting either a 883 * XFRMs on a packet. The hook is called when selecting either a
884 * per-socket policy or a generic xfrm policy. 884 * per-socket policy or a generic xfrm policy.
885 * Return 0 if permission is granted. 885 * Return 0 if permission is granted, -ESRCH otherwise, or -errno
886 * on other errors.
886 * @xfrm_state_pol_flow_match: 887 * @xfrm_state_pol_flow_match:
887 * @x contains the state to match. 888 * @x contains the state to match.
888 * @xp contains the policy to check for a match. 889 * @xp contains the policy to check for a match.
@@ -891,6 +892,7 @@ struct request_sock;
891 * @xfrm_flow_state_match: 892 * @xfrm_flow_state_match:
892 * @fl contains the flow key to match. 893 * @fl contains the flow key to match.
893 * @xfrm points to the xfrm_state to match. 894 * @xfrm points to the xfrm_state to match.
895 * @xp points to the xfrm_policy to match.
894 * Return 1 if there is a match. 896 * Return 1 if there is a match.
895 * @xfrm_decode_session: 897 * @xfrm_decode_session:
896 * @skb points to skb to decode. 898 * @skb points to skb to decode.
@@ -1388,7 +1390,8 @@ struct security_operations {
1388 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir); 1390 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
1389 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, 1391 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
1390 struct xfrm_policy *xp, struct flowi *fl); 1392 struct xfrm_policy *xp, struct flowi *fl);
1391 int (*xfrm_flow_state_match)(struct flowi *fl, struct xfrm_state *xfrm); 1393 int (*xfrm_flow_state_match)(struct flowi *fl, struct xfrm_state *xfrm,
1394 struct xfrm_policy *xp);
1392 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); 1395 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
1393#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1396#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1394 1397
@@ -3120,11 +3123,6 @@ static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm
3120 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx, NULL); 3123 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx, NULL);
3121} 3124}
3122 3125
3123static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk)
3124{
3125 return security_ops->xfrm_policy_alloc_security(xp, NULL, sk);
3126}
3127
3128static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) 3126static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
3129{ 3127{
3130 return security_ops->xfrm_policy_clone_security(old, new); 3128 return security_ops->xfrm_policy_clone_security(old, new);
@@ -3175,9 +3173,10 @@ static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3175 return security_ops->xfrm_state_pol_flow_match(x, xp, fl); 3173 return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
3176} 3174}
3177 3175
3178static inline int security_xfrm_flow_state_match(struct flowi *fl, struct xfrm_state *xfrm) 3176static inline int security_xfrm_flow_state_match(struct flowi *fl,
3177 struct xfrm_state *xfrm, struct xfrm_policy *xp)
3179{ 3178{
3180 return security_ops->xfrm_flow_state_match(fl, xfrm); 3179 return security_ops->xfrm_flow_state_match(fl, xfrm, xp);
3181} 3180}
3182 3181
3183static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) 3182static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
@@ -3197,11 +3196,6 @@ static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm
3197 return 0; 3196 return 0;
3198} 3197}
3199 3198
3200static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk)
3201{
3202 return 0;
3203}
3204
3205static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) 3199static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
3206{ 3200{
3207 return 0; 3201 return 0;
@@ -3249,7 +3243,7 @@ static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3249} 3243}
3250 3244
3251static inline int security_xfrm_flow_state_match(struct flowi *fl, 3245static inline int security_xfrm_flow_state_match(struct flowi *fl,
3252 struct xfrm_state *xfrm) 3246 struct xfrm_state *xfrm, struct xfrm_policy *xp)
3253{ 3247{
3254 return 1; 3248 return 1;
3255} 3249}
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 3a697cc6ecae..b99c5ca9708d 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -41,6 +41,7 @@ struct serio {
41 void (*stop)(struct serio *); 41 void (*stop)(struct serio *);
42 42
43 struct serio *parent, *child; 43 struct serio *parent, *child;
44 unsigned int depth; /* level of nesting in serio hierarchy */
44 45
45 struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock and serio->sem */ 46 struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock and serio->sem */
46 struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ 47 struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index 1e65f2dd80e5..606cb2165232 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -56,7 +56,9 @@ enum rpc_accept_stat {
56 RPC_PROG_MISMATCH = 2, 56 RPC_PROG_MISMATCH = 2,
57 RPC_PROC_UNAVAIL = 3, 57 RPC_PROC_UNAVAIL = 3,
58 RPC_GARBAGE_ARGS = 4, 58 RPC_GARBAGE_ARGS = 4,
59 RPC_SYSTEM_ERR = 5 59 RPC_SYSTEM_ERR = 5,
60 /* internal use only */
61 RPC_DROP_REPLY = 60000,
60}; 62};
61 63
62enum rpc_reject_stat { 64enum rpc_reject_stat {
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 9c9a8ad92477..965d6c20086e 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -335,7 +335,7 @@ struct svc_version {
335/* 335/*
336 * RPC procedure info 336 * RPC procedure info
337 */ 337 */
338typedef int (*svc_procfunc)(struct svc_rqst *, void *argp, void *resp); 338typedef __be32 (*svc_procfunc)(struct svc_rqst *, void *argp, void *resp);
339struct svc_procedure { 339struct svc_procedure {
340 svc_procfunc pc_func; /* process the request */ 340 svc_procfunc pc_func; /* process the request */
341 kxdrproc_t pc_decode; /* XDR decode args */ 341 kxdrproc_t pc_decode; /* XDR decode args */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 953723b09bc6..ac69e5511606 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -74,6 +74,7 @@ struct xdr_buf {
74#define rpc_proc_unavail __constant_htonl(RPC_PROC_UNAVAIL) 74#define rpc_proc_unavail __constant_htonl(RPC_PROC_UNAVAIL)
75#define rpc_garbage_args __constant_htonl(RPC_GARBAGE_ARGS) 75#define rpc_garbage_args __constant_htonl(RPC_GARBAGE_ARGS)
76#define rpc_system_err __constant_htonl(RPC_SYSTEM_ERR) 76#define rpc_system_err __constant_htonl(RPC_SYSTEM_ERR)
77#define rpc_drop_reply __constant_htonl(RPC_DROP_REPLY)
77 78
78#define rpc_auth_ok __constant_htonl(RPC_AUTH_OK) 79#define rpc_auth_ok __constant_htonl(RPC_AUTH_OK)
79#define rpc_autherr_badcred __constant_htonl(RPC_AUTH_BADCRED) 80#define rpc_autherr_badcred __constant_htonl(RPC_AUTH_BADCRED)
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index b0ace3fd7eb9..1912c6cbef55 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -431,6 +431,10 @@ asmlinkage long sys_epoll_ctl(int epfd, int op, int fd,
431 struct epoll_event __user *event); 431 struct epoll_event __user *event);
432asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events, 432asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events,
433 int maxevents, int timeout); 433 int maxevents, int timeout);
434asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
435 int maxevents, int timeout,
436 const sigset_t __user *sigmask,
437 size_t sigsetsize);
434asmlinkage long sys_gethostname(char __user *name, int len); 438asmlinkage long sys_gethostname(char __user *name, int len);
435asmlinkage long sys_sethostname(char __user *name, int len); 439asmlinkage long sys_sethostname(char __user *name, int len);
436asmlinkage long sys_setdomainname(char __user *name, int len); 440asmlinkage long sys_setdomainname(char __user *name, int len);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 1b24bd45e080..d98562f1df76 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -6,10 +6,17 @@
6 **************************************************************** 6 ****************************************************************
7 **************************************************************** 7 ****************************************************************
8 ** 8 **
9 ** WARNING:
9 ** The values in this file are exported to user space via 10 ** The values in this file are exported to user space via
10 ** the sysctl() binary interface. However this interface 11 ** the sysctl() binary interface. Do *NOT* change the
11 ** is unstable and deprecated and will be removed in the future. 12 ** numbering of any existing values here, and do not change
12 ** For a stable interface use /proc/sys. 13 ** any numbers within any one set of values. If you have to
14 ** have to redefine an existing interface, use a new number for it.
15 ** The kernel will then return -ENOTDIR to any application using
16 ** the old binary interface.
17 **
18 ** For new interfaces unless you really need a binary number
19 ** please use CTL_UNNUMBERED.
13 ** 20 **
14 **************************************************************** 21 ****************************************************************
15 **************************************************************** 22 ****************************************************************
@@ -48,6 +55,7 @@ struct __sysctl_args {
48#ifdef __KERNEL__ 55#ifdef __KERNEL__
49#define CTL_ANY -1 /* Matches any name */ 56#define CTL_ANY -1 /* Matches any name */
50#define CTL_NONE 0 57#define CTL_NONE 0
58#define CTL_UNNUMBERED CTL_NONE /* sysctl without a binary number */
51#endif 59#endif
52 60
53enum 61enum
@@ -961,8 +969,8 @@ extern ctl_handler sysctl_ms_jiffies;
961/* 969/*
962 * Register a set of sysctl names by calling register_sysctl_table 970 * Register a set of sysctl names by calling register_sysctl_table
963 * with an initialised array of ctl_table's. An entry with zero 971 * with an initialised array of ctl_table's. An entry with zero
964 * ctl_name terminates the table. table->de will be set up by the 972 * ctl_name and NULL procname terminates the table. table->de will be
965 * registration and need not be initialised in advance. 973 * set up by the registration and need not be initialised in advance.
966 * 974 *
967 * sysctl names can be mirrored automatically under /proc/sys. The 975 * sysctl names can be mirrored automatically under /proc/sys. The
968 * procname supplied controls /proc naming. 976 * procname supplied controls /proc naming.
@@ -973,7 +981,10 @@ extern ctl_handler sysctl_ms_jiffies;
973 * Leaf nodes in the sysctl tree will be represented by a single file 981 * Leaf nodes in the sysctl tree will be represented by a single file
974 * under /proc; non-leaf nodes will be represented by directories. A 982 * under /proc; non-leaf nodes will be represented by directories. A
975 * null procname disables /proc mirroring at this node. 983 * null procname disables /proc mirroring at this node.
976 * 984 *
985 * sysctl entries with a zero ctl_name will not be available through
986 * the binary sysctl interface.
987 *
977 * sysctl(2) can automatically manage read and write requests through 988 * sysctl(2) can automatically manage read and write requests through
978 * the sysctl table. The data and maxlen fields of the ctl_table 989 * the sysctl table. The data and maxlen fields of the ctl_table
979 * struct enable minimal validation of the values being written to be 990 * struct enable minimal validation of the values being written to be
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
index 16894b7edcc8..6562a2050a25 100644
--- a/include/linux/taskstats_kern.h
+++ b/include/linux/taskstats_kern.h
@@ -23,25 +23,26 @@ static inline void taskstats_exit_free(struct taskstats *tidstats)
23 23
24static inline void taskstats_tgid_init(struct signal_struct *sig) 24static inline void taskstats_tgid_init(struct signal_struct *sig)
25{ 25{
26 spin_lock_init(&sig->stats_lock);
27 sig->stats = NULL; 26 sig->stats = NULL;
28} 27}
29 28
30static inline void taskstats_tgid_alloc(struct signal_struct *sig) 29static inline void taskstats_tgid_alloc(struct task_struct *tsk)
31{ 30{
31 struct signal_struct *sig = tsk->signal;
32 struct taskstats *stats; 32 struct taskstats *stats;
33 unsigned long flags;
34 33
35 stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); 34 if (sig->stats != NULL)
36 if (!stats)
37 return; 35 return;
38 36
39 spin_lock_irqsave(&sig->stats_lock, flags); 37 /* No problem if kmem_cache_zalloc() fails */
38 stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
39
40 spin_lock_irq(&tsk->sighand->siglock);
40 if (!sig->stats) { 41 if (!sig->stats) {
41 sig->stats = stats; 42 sig->stats = stats;
42 stats = NULL; 43 stats = NULL;
43 } 44 }
44 spin_unlock_irqrestore(&sig->stats_lock, flags); 45 spin_unlock_irq(&tsk->sighand->siglock);
45 46
46 if (stats) 47 if (stats)
47 kmem_cache_free(taskstats_cache, stats); 48 kmem_cache_free(taskstats_cache, stats);
@@ -49,23 +50,13 @@ static inline void taskstats_tgid_alloc(struct signal_struct *sig)
49 50
50static inline void taskstats_tgid_free(struct signal_struct *sig) 51static inline void taskstats_tgid_free(struct signal_struct *sig)
51{ 52{
52 struct taskstats *stats = NULL; 53 if (sig->stats)
53 unsigned long flags; 54 kmem_cache_free(taskstats_cache, sig->stats);
54
55 spin_lock_irqsave(&sig->stats_lock, flags);
56 if (sig->stats) {
57 stats = sig->stats;
58 sig->stats = NULL;
59 }
60 spin_unlock_irqrestore(&sig->stats_lock, flags);
61 if (stats)
62 kmem_cache_free(taskstats_cache, stats);
63} 55}
64 56
65extern void taskstats_exit_alloc(struct taskstats **, unsigned int *); 57extern void taskstats_exit_alloc(struct taskstats **, unsigned int *);
66extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int); 58extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int);
67extern void taskstats_init_early(void); 59extern void taskstats_init_early(void);
68extern void taskstats_tgid_alloc(struct signal_struct *);
69#else 60#else
70static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu) 61static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu)
71{} 62{}
@@ -77,7 +68,7 @@ static inline void taskstats_exit_send(struct task_struct *tsk,
77{} 68{}
78static inline void taskstats_tgid_init(struct signal_struct *sig) 69static inline void taskstats_tgid_init(struct signal_struct *sig)
79{} 70{}
80static inline void taskstats_tgid_alloc(struct signal_struct *sig) 71static inline void taskstats_tgid_alloc(struct task_struct *tsk)
81{} 72{}
82static inline void taskstats_tgid_free(struct signal_struct *sig) 73static inline void taskstats_tgid_free(struct signal_struct *sig)
83{} 74{}
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 0e058a2d1c6d..2d36f6db3706 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -342,6 +342,8 @@ struct tcp_sock {
342 342
343 unsigned long last_synq_overflow; 343 unsigned long last_synq_overflow;
344 344
345 __u32 tso_deferred;
346
345/* Receiver side RTT estimation */ 347/* Receiver side RTT estimation */
346 struct { 348 struct {
347 __u32 rtt; 349 __u32 rtt;
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index 243a15f54002..bea469455a0c 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -129,6 +129,7 @@ static inline unsigned int tipc_node(__u32 addr)
129 129
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ 130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ 131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */
132#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */
132#if 0 133#if 0
133/* The following filter options are not currently implemented */ 134/* The following filter options are not currently implemented */
134#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */ 135#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index 61eef508b041..28967eda9d7b 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -908,7 +908,7 @@ struct ufs_super_block_third {
908 __fs64 fs_csaddr; /* blk addr of cyl grp summary area */ 908 __fs64 fs_csaddr; /* blk addr of cyl grp summary area */
909 __fs64 fs_pendingblocks;/* blocks in process of being freed */ 909 __fs64 fs_pendingblocks;/* blocks in process of being freed */
910 __fs32 fs_pendinginodes;/*inodes in process of being freed */ 910 __fs32 fs_pendinginodes;/*inodes in process of being freed */
911 } fs_u2; 911 } __attribute__ ((packed)) fs_u2;
912 } fs_un1; 912 } fs_un1;
913 union { 913 union {
914 struct { 914 struct {
diff --git a/include/linux/unwind.h b/include/linux/unwind.h
index 73e1751d03dd..749928c161fb 100644
--- a/include/linux/unwind.h
+++ b/include/linux/unwind.h
@@ -26,6 +26,7 @@ struct module;
26 * Initialize unwind support. 26 * Initialize unwind support.
27 */ 27 */
28extern void unwind_init(void); 28extern void unwind_init(void);
29extern void unwind_setup(void);
29 30
30#ifdef CONFIG_MODULES 31#ifdef CONFIG_MODULES
31 32
@@ -73,6 +74,7 @@ extern int unwind_to_user(struct unwind_frame_info *);
73struct unwind_frame_info {}; 74struct unwind_frame_info {};
74 75
75static inline void unwind_init(void) {} 76static inline void unwind_init(void) {}
77static inline void unwind_setup(void) {}
76 78
77#ifdef CONFIG_MODULES 79#ifdef CONFIG_MODULES
78 80
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c5fdf6259548..df5c4654360d 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -243,7 +243,7 @@ struct v4l2_pix_format
243#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ 243#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */
244#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ 244#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */
245#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ 245#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */
246#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:1:1 16x16 macroblocks */ 246#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:2:0 16x16 macroblocks */
247 247
248/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 248/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
249#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ 249#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index ce5f1482e6be..924e502905d4 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -23,13 +23,14 @@ struct vm_area_struct;
23#endif 23#endif
24 24
25struct vm_struct { 25struct vm_struct {
26 /* keep next,addr,size together to speedup lookups */
27 struct vm_struct *next;
26 void *addr; 28 void *addr;
27 unsigned long size; 29 unsigned long size;
28 unsigned long flags; 30 unsigned long flags;
29 struct page **pages; 31 struct page **pages;
30 unsigned int nr_pages; 32 unsigned int nr_pages;
31 unsigned long phys_addr; 33 unsigned long phys_addr;
32 struct vm_struct *next;
33}; 34};
34 35
35/* 36/*
@@ -60,7 +61,8 @@ extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
60extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 61extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
61 unsigned long start, unsigned long end); 62 unsigned long start, unsigned long end);
62extern struct vm_struct *get_vm_area_node(unsigned long size, 63extern struct vm_struct *get_vm_area_node(unsigned long size,
63 unsigned long flags, int node); 64 unsigned long flags, int node,
65 gfp_t gfp_mask);
64extern struct vm_struct *remove_vm_area(void *addr); 66extern struct vm_struct *remove_vm_area(void *addr);
65extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 67extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
66 struct page ***pages); 68 struct page ***pages);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index b3b9048421d8..e820d00e1383 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -79,6 +79,15 @@ struct task_struct;
79 79
80extern void init_waitqueue_head(wait_queue_head_t *q); 80extern void init_waitqueue_head(wait_queue_head_t *q);
81 81
82#ifdef CONFIG_LOCKDEP
83# define __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) \
84 ({ init_waitqueue_head(&name); name; })
85# define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) \
86 wait_queue_head_t name = __WAIT_QUEUE_HEAD_INIT_ONSTACK(name)
87#else
88# define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) DECLARE_WAIT_QUEUE_HEAD(name)
89#endif
90
82static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) 91static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p)
83{ 92{
84 q->flags = 0; 93 q->flags = 0;
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index a341c8032866..fc35e6bdfb93 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -85,7 +85,6 @@ int wakeup_pdflush(long nr_pages);
85void laptop_io_completion(void); 85void laptop_io_completion(void);
86void laptop_sync_completion(void); 86void laptop_sync_completion(void);
87void throttle_vm_writeout(void); 87void throttle_vm_writeout(void);
88void writeback_congestion_end(void);
89 88
90/* These are exported to sysctl. */ 89/* These are exported to sysctl. */
91extern int dirty_background_ratio; 90extern int dirty_background_ratio;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index df22efcfcc0b..c0fc39620f36 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -153,6 +153,7 @@ struct hci_conn {
153 __u8 mode; 153 __u8 mode;
154 __u8 type; 154 __u8 type;
155 __u8 out; 155 __u8 out;
156 __u8 attempt;
156 __u8 dev_class[3]; 157 __u8 dev_class[3];
157 __u8 features[8]; 158 __u8 features[8];
158 __u16 interval; 159 __u16 interval;
@@ -289,6 +290,22 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
289 return NULL; 290 return NULL;
290} 291}
291 292
293static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
294 __u8 type, __u16 state)
295{
296 struct hci_conn_hash *h = &hdev->conn_hash;
297 struct list_head *p;
298 struct hci_conn *c;
299
300 list_for_each(p, &h->list) {
301 c = list_entry(p, struct hci_conn, list);
302 if (c->type == type && c->state == state)
303 return c;
304 }
305 return NULL;
306}
307
308void hci_acl_connect(struct hci_conn *conn);
292void hci_acl_disconn(struct hci_conn *conn, __u8 reason); 309void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
293void hci_add_sco(struct hci_conn *conn, __u16 handle); 310void hci_add_sco(struct hci_conn *conn, __u16 handle);
294 311
diff --git a/include/net/dn.h b/include/net/dn.h
index 465b78302782..ac4ce9091747 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -199,11 +199,6 @@ static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp)
199{ 199{
200 fl->uli_u.dnports.sport = scp->addrloc; 200 fl->uli_u.dnports.sport = scp->addrloc;
201 fl->uli_u.dnports.dport = scp->addrrem; 201 fl->uli_u.dnports.dport = scp->addrrem;
202 fl->uli_u.dnports.objnum = scp->addr.sdn_objnum;
203 if (fl->uli_u.dnports.objnum == 0) {
204 fl->uli_u.dnports.objnamel = (__u8)dn_ntohs(scp->addr.sdn_objnamel);
205 memcpy(fl->uli_u.dnports.objname, scp->addr.sdn_objname, 16);
206 }
207} 202}
208 203
209extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu); 204extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu);
diff --git a/include/net/flow.h b/include/net/flow.h
index ddf5f3ca1720..5cda27cd9deb 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -68,9 +68,6 @@ struct flowi {
68 struct { 68 struct {
69 __le16 sport; 69 __le16 sport;
70 __le16 dport; 70 __le16 dport;
71 __u8 objnum;
72 __u8 objnamel; /* Not 16 bits since max val is 16 */
73 __u8 objname[16]; /* Not zero terminated */
74 } dnports; 71 } dnports;
75 72
76 __be32 spi; 73 __be32 spi;
@@ -97,7 +94,7 @@ struct flowi {
97#define FLOW_DIR_FWD 2 94#define FLOW_DIR_FWD 2
98 95
99struct sock; 96struct sock;
100typedef void (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, 97typedef int (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir,
101 void **objp, atomic_t **obj_refp); 98 void **objp, atomic_t **obj_refp);
102 99
103extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, 100extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir,
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h
index 425b3a57ac74..617b672b1132 100644
--- a/include/net/ieee80211softmac.h
+++ b/include/net/ieee80211softmac.h
@@ -63,13 +63,11 @@ struct ieee80211softmac_wpa {
63 63
64/* 64/*
65 * Information about association 65 * Information about association
66 *
67 * Do we need a lock for this?
68 * We only ever use this structure inlined
69 * into our global struct. I've used its lock,
70 * but maybe we need a local one here?
71 */ 66 */
72struct ieee80211softmac_assoc_info { 67struct ieee80211softmac_assoc_info {
68
69 struct mutex mutex;
70
73 /* 71 /*
74 * This is the requested ESSID. It is written 72 * This is the requested ESSID. It is written
75 * only by the WX handlers. 73 * only by the WX handlers.
@@ -99,12 +97,13 @@ struct ieee80211softmac_assoc_info {
99 * 97 *
100 * bssfixed is used for SIOCSIWAP. 98 * bssfixed is used for SIOCSIWAP.
101 */ 99 */
102 u8 static_essid:1, 100 u8 static_essid;
103 short_preamble_available:1, 101 u8 short_preamble_available;
104 associating:1, 102 u8 associating;
105 assoc_wait:1, 103 u8 associated;
106 bssvalid:1, 104 u8 assoc_wait;
107 bssfixed:1; 105 u8 bssvalid;
106 u8 bssfixed;
108 107
109 /* Scan retries remaining */ 108 /* Scan retries remaining */
110 int scan_retry; 109 int scan_retry;
@@ -229,12 +228,10 @@ struct ieee80211softmac_device {
229 /* private stuff follows */ 228 /* private stuff follows */
230 /* this lock protects this structure */ 229 /* this lock protects this structure */
231 spinlock_t lock; 230 spinlock_t lock;
232 231
233 /* couple of flags */ 232 u8 running; /* SoftMAC started? */
234 u8 scanning:1, /* protects scanning from being done multiple times at once */ 233 u8 scanning;
235 associated:1, 234
236 running:1;
237
238 struct ieee80211softmac_scaninfo *scaninfo; 235 struct ieee80211softmac_scaninfo *scaninfo;
239 struct ieee80211softmac_assoc_info associnfo; 236 struct ieee80211softmac_assoc_info associnfo;
240 struct ieee80211softmac_bss_info bssinfo; 237 struct ieee80211softmac_bss_info bssinfo;
@@ -250,7 +247,7 @@ struct ieee80211softmac_device {
250 247
251 /* we need to keep a list of network structs we copied */ 248 /* we need to keep a list of network structs we copied */
252 struct list_head network_list; 249 struct list_head network_list;
253 250
254 /* This must be the last item so that it points to the data 251 /* This must be the last item so that it points to the data
255 * allocated beyond this structure by alloc_ieee80211 */ 252 * allocated beyond this structure by alloc_ieee80211 */
256 u8 priv[0]; 253 u8 priv[0];
@@ -295,7 +292,7 @@ static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device
295{ 292{
296 struct ieee80211softmac_txrates *txrates = &mac->txrates; 293 struct ieee80211softmac_txrates *txrates = &mac->txrates;
297 294
298 if (!mac->associated) 295 if (!mac->associnfo.associated)
299 return txrates->mgt_mcast_rate; 296 return txrates->mgt_mcast_rate;
300 297
301 /* We are associated, sending unicast frame */ 298 /* We are associated, sending unicast frame */
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index d599c6bfbb86..7849844a4911 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -48,7 +48,7 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
48 48
49#define IP6_ECN_flow_xmit(sk, label) do { \ 49#define IP6_ECN_flow_xmit(sk, label) do { \
50 if (INET_ECN_is_capable(inet_sk(sk)->tos)) \ 50 if (INET_ECN_is_capable(inet_sk(sk)->tos)) \
51 (label) |= __constant_htons(INET_ECN_ECT_0 << 4); \ 51 (label) |= htonl(INET_ECN_ECT_0 << 20); \
52 } while (0) 52 } while (0)
53 53
54static inline int IP_ECN_set_ce(struct iphdr *iph) 54static inline int IP_ECN_set_ce(struct iphdr *iph)
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 6d14c22a00c5..5f48748fe017 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -196,6 +196,7 @@ static inline void inet_twsk_put(struct inet_timewait_sock *tw)
196{ 196{
197 if (atomic_dec_and_test(&tw->tw_refcnt)) { 197 if (atomic_dec_and_test(&tw->tw_refcnt)) {
198 struct module *owner = tw->tw_prot->owner; 198 struct module *owner = tw->tw_prot->owner;
199 twsk_destructor((struct sock *)tw);
199#ifdef SOCK_REFCNT_DEBUG 200#ifdef SOCK_REFCNT_DEBUG
200 printk(KERN_DEBUG "%s timewait_sock %p released\n", 201 printk(KERN_DEBUG "%s timewait_sock %p released\n",
201 tw->tw_prot->name, tw); 202 tw->tw_prot->name, tw);
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 925573fd2aed..aa10a8178e70 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -17,14 +17,15 @@
17 17
18struct inet_peer 18struct inet_peer
19{ 19{
20 /* group together avl_left,avl_right,v4daddr to speedup lookups */
20 struct inet_peer *avl_left, *avl_right; 21 struct inet_peer *avl_left, *avl_right;
21 struct inet_peer *unused_next, **unused_prevp;
22 unsigned long dtime; /* the time of last use of not
23 * referenced entries */
24 atomic_t refcnt;
25 __be32 v4daddr; /* peer's address */ 22 __be32 v4daddr; /* peer's address */
26 __u16 avl_height; 23 __u16 avl_height;
27 __u16 ip_id_count; /* IP ID for the next packet */ 24 __u16 ip_id_count; /* IP ID for the next packet */
25 struct inet_peer *unused_next, **unused_prevp;
26 __u32 dtime; /* the time of last use of not
27 * referenced entries */
28 atomic_t refcnt;
28 atomic_t rid; /* Frag reception counter */ 29 atomic_t rid; /* Frag reception counter */
29 __u32 tcp_ts; 30 __u32 tcp_ts;
30 unsigned long tcp_ts_stamp; 31 unsigned long tcp_ts_stamp;
@@ -35,21 +36,8 @@ void inet_initpeers(void) __init;
35/* can be called with or without local BH being disabled */ 36/* can be called with or without local BH being disabled */
36struct inet_peer *inet_getpeer(__be32 daddr, int create); 37struct inet_peer *inet_getpeer(__be32 daddr, int create);
37 38
38extern spinlock_t inet_peer_unused_lock;
39extern struct inet_peer **inet_peer_unused_tailp;
40/* can be called from BH context or outside */ 39/* can be called from BH context or outside */
41static inline void inet_putpeer(struct inet_peer *p) 40extern void inet_putpeer(struct inet_peer *p);
42{
43 spin_lock_bh(&inet_peer_unused_lock);
44 if (atomic_dec_and_test(&p->refcnt)) {
45 p->unused_prevp = inet_peer_unused_tailp;
46 p->unused_next = NULL;
47 *inet_peer_unused_tailp = p;
48 inet_peer_unused_tailp = &p->unused_next;
49 p->dtime = jiffies;
50 }
51 spin_unlock_bh(&inet_peer_unused_lock);
52}
53 41
54extern spinlock_t inet_peer_idlock; 42extern spinlock_t inet_peer_idlock;
55/* can be called with or without local BH being disabled */ 43/* can be called with or without local BH being disabled */
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 6ca6b71dfe0f..c14b70ed4c57 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -36,13 +36,6 @@ struct route_info {
36#define RT6_LOOKUP_F_REACHABLE 0x2 36#define RT6_LOOKUP_F_REACHABLE 0x2
37#define RT6_LOOKUP_F_HAS_SADDR 0x4 37#define RT6_LOOKUP_F_HAS_SADDR 0x4
38 38
39struct pol_chain {
40 int type;
41 int priority;
42 struct fib6_node *rules;
43 struct pol_chain *next;
44};
45
46extern struct rt6_info ip6_null_entry; 39extern struct rt6_info ip6_null_entry;
47 40
48#ifdef CONFIG_IPV6_MULTIPLE_TABLES 41#ifdef CONFIG_IPV6_MULTIPLE_TABLES
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 82229146bac7..949b932d2f08 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -21,17 +21,14 @@
21#include <net/fib_rules.h> 21#include <net/fib_rules.h>
22 22
23struct fib_config { 23struct fib_config {
24 u8 fc_family;
25 u8 fc_dst_len; 24 u8 fc_dst_len;
26 u8 fc_src_len;
27 u8 fc_tos; 25 u8 fc_tos;
28 u8 fc_protocol; 26 u8 fc_protocol;
29 u8 fc_scope; 27 u8 fc_scope;
30 u8 fc_type; 28 u8 fc_type;
31 /* 1 byte unused */ 29 /* 3 bytes unused */
32 u32 fc_table; 30 u32 fc_table;
33 __be32 fc_dst; 31 __be32 fc_dst;
34 __be32 fc_src;
35 __be32 fc_gw; 32 __be32 fc_gw;
36 int fc_oif; 33 int fc_oif;
37 u32 fc_flags; 34 u32 fc_flags;
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 49c717e3b040..903108e583f8 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -7,6 +7,7 @@
7#define _IP_VS_H 7#define _IP_VS_H
8 8
9#include <asm/types.h> /* For __uXX types */ 9#include <asm/types.h> /* For __uXX types */
10#include <linux/types.h> /* For __beXX types in userland */
10 11
11#define IP_VS_VERSION_CODE 0x010201 12#define IP_VS_VERSION_CODE 0x010201
12#define NVERSION(version) \ 13#define NVERSION(version) \
diff --git a/include/net/ipx.h b/include/net/ipx.h
index 5c0cf33826c5..c6b2ee610866 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -15,9 +15,9 @@
15#include <linux/list.h> 15#include <linux/list.h>
16 16
17struct ipx_address { 17struct ipx_address {
18 __u32 net; 18 __be32 net;
19 __u8 node[IPX_NODE_LEN]; 19 __u8 node[IPX_NODE_LEN];
20 __u16 sock; 20 __be16 sock;
21}; 21};
22 22
23#define ipx_broadcast_node "\377\377\377\377\377\377" 23#define ipx_broadcast_node "\377\377\377\377\377\377"
@@ -26,9 +26,9 @@ struct ipx_address {
26#define IPX_MAX_PPROP_HOPS 8 26#define IPX_MAX_PPROP_HOPS 8
27 27
28struct ipxhdr { 28struct ipxhdr {
29 __u16 ipx_checksum __attribute__ ((packed)); 29 __be16 ipx_checksum __attribute__ ((packed));
30#define IPX_NO_CHECKSUM 0xFFFF 30#define IPX_NO_CHECKSUM __constant_htons(0xFFFF)
31 __u16 ipx_pktsize __attribute__ ((packed)); 31 __be16 ipx_pktsize __attribute__ ((packed));
32 __u8 ipx_tctrl; 32 __u8 ipx_tctrl;
33 __u8 ipx_type; 33 __u8 ipx_type;
34#define IPX_TYPE_UNKNOWN 0x00 34#define IPX_TYPE_UNKNOWN 0x00
@@ -48,14 +48,14 @@ static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
48 48
49struct ipx_interface { 49struct ipx_interface {
50 /* IPX address */ 50 /* IPX address */
51 __u32 if_netnum; 51 __be32 if_netnum;
52 unsigned char if_node[IPX_NODE_LEN]; 52 unsigned char if_node[IPX_NODE_LEN];
53 atomic_t refcnt; 53 atomic_t refcnt;
54 54
55 /* physical device info */ 55 /* physical device info */
56 struct net_device *if_dev; 56 struct net_device *if_dev;
57 struct datalink_proto *if_dlink; 57 struct datalink_proto *if_dlink;
58 unsigned short if_dlink_type; 58 __be16 if_dlink_type;
59 59
60 /* socket support */ 60 /* socket support */
61 unsigned short if_sknum; 61 unsigned short if_sknum;
@@ -71,7 +71,7 @@ struct ipx_interface {
71}; 71};
72 72
73struct ipx_route { 73struct ipx_route {
74 __u32 ir_net; 74 __be32 ir_net;
75 struct ipx_interface *ir_intrfc; 75 struct ipx_interface *ir_intrfc;
76 unsigned char ir_routed; 76 unsigned char ir_routed;
77 unsigned char ir_router_node[IPX_NODE_LEN]; 77 unsigned char ir_router_node[IPX_NODE_LEN];
@@ -82,10 +82,10 @@ struct ipx_route {
82#ifdef __KERNEL__ 82#ifdef __KERNEL__
83struct ipx_cb { 83struct ipx_cb {
84 u8 ipx_tctrl; 84 u8 ipx_tctrl;
85 u32 ipx_dest_net; 85 __be32 ipx_dest_net;
86 u32 ipx_source_net; 86 __be32 ipx_source_net;
87 struct { 87 struct {
88 u32 netnum; 88 __be32 netnum;
89 int index; 89 int index;
90 } last_hop; 90 } last_hop;
91}; 91};
@@ -97,7 +97,7 @@ struct ipx_sock {
97 struct sock sk; 97 struct sock sk;
98 struct ipx_address dest_addr; 98 struct ipx_address dest_addr;
99 struct ipx_interface *intrfc; 99 struct ipx_interface *intrfc;
100 unsigned short port; 100 __be16 port;
101#ifdef CONFIG_IPX_INTERN 101#ifdef CONFIG_IPX_INTERN
102 unsigned char node[IPX_NODE_LEN]; 102 unsigned char node[IPX_NODE_LEN];
103#endif 103#endif
@@ -132,7 +132,7 @@ extern struct ipx_interface *ipx_primary_net;
132extern int ipx_proc_init(void); 132extern int ipx_proc_init(void);
133extern void ipx_proc_exit(void); 133extern void ipx_proc_exit(void);
134 134
135extern const char *ipx_frame_name(unsigned short); 135extern const char *ipx_frame_name(__be16);
136extern const char *ipx_device_name(struct ipx_interface *intrfc); 136extern const char *ipx_device_name(struct ipx_interface *intrfc);
137 137
138static __inline__ void ipxitf_hold(struct ipx_interface *intrfc) 138static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index c63a58058e21..12c214b9eadf 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -34,6 +34,7 @@
34#include <linux/net.h> 34#include <linux/net.h>
35#include <linux/skbuff.h> 35#include <linux/skbuff.h>
36#include <net/netlink.h> 36#include <net/netlink.h>
37#include <asm/atomic.h>
37 38
38/* 39/*
39 * NetLabel - A management interface for maintaining network packet label 40 * NetLabel - A management interface for maintaining network packet label
@@ -106,6 +107,7 @@ int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info);
106 107
107/* LSM security attributes */ 108/* LSM security attributes */
108struct netlbl_lsm_cache { 109struct netlbl_lsm_cache {
110 atomic_t refcount;
109 void (*free) (const void *data); 111 void (*free) (const void *data);
110 void *data; 112 void *data;
111}; 113};
@@ -117,7 +119,7 @@ struct netlbl_lsm_secattr {
117 unsigned char *mls_cat; 119 unsigned char *mls_cat;
118 size_t mls_cat_len; 120 size_t mls_cat_len;
119 121
120 struct netlbl_lsm_cache cache; 122 struct netlbl_lsm_cache *cache;
121}; 123};
122 124
123/* 125/*
@@ -126,6 +128,43 @@ struct netlbl_lsm_secattr {
126 128
127 129
128/** 130/**
131 * netlbl_secattr_cache_alloc - Allocate and initialize a secattr cache
132 * @flags: the memory allocation flags
133 *
134 * Description:
135 * Allocate and initialize a netlbl_lsm_cache structure. Returns a pointer
136 * on success, NULL on failure.
137 *
138 */
139static inline struct netlbl_lsm_cache *netlbl_secattr_cache_alloc(gfp_t flags)
140{
141 struct netlbl_lsm_cache *cache;
142
143 cache = kzalloc(sizeof(*cache), flags);
144 if (cache)
145 atomic_set(&cache->refcount, 1);
146 return cache;
147}
148
149/**
150 * netlbl_secattr_cache_free - Frees a netlbl_lsm_cache struct
151 * @cache: the struct to free
152 *
153 * Description:
154 * Frees @secattr including all of the internal buffers.
155 *
156 */
157static inline void netlbl_secattr_cache_free(struct netlbl_lsm_cache *cache)
158{
159 if (!atomic_dec_and_test(&cache->refcount))
160 return;
161
162 if (cache->free)
163 cache->free(cache->data);
164 kfree(cache);
165}
166
167/**
129 * netlbl_secattr_init - Initialize a netlbl_lsm_secattr struct 168 * netlbl_secattr_init - Initialize a netlbl_lsm_secattr struct
130 * @secattr: the struct to initialize 169 * @secattr: the struct to initialize
131 * 170 *
@@ -143,20 +182,16 @@ static inline int netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
143/** 182/**
144 * netlbl_secattr_destroy - Clears a netlbl_lsm_secattr struct 183 * netlbl_secattr_destroy - Clears a netlbl_lsm_secattr struct
145 * @secattr: the struct to clear 184 * @secattr: the struct to clear
146 * @clear_cache: cache clear flag
147 * 185 *
148 * Description: 186 * Description:
149 * Destroys the @secattr struct, including freeing all of the internal buffers. 187 * Destroys the @secattr struct, including freeing all of the internal buffers.
150 * If @clear_cache is true then free the cache fields, otherwise leave them 188 * The struct must be reset with a call to netlbl_secattr_init() before reuse.
151 * intact. The struct must be reset with a call to netlbl_secattr_init()
152 * before reuse.
153 * 189 *
154 */ 190 */
155static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr, 191static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr)
156 u32 clear_cache)
157{ 192{
158 if (clear_cache && secattr->cache.data != NULL && secattr->cache.free) 193 if (secattr->cache)
159 secattr->cache.free(secattr->cache.data); 194 netlbl_secattr_cache_free(secattr->cache);
160 kfree(secattr->domain); 195 kfree(secattr->domain);
161 kfree(secattr->mls_cat); 196 kfree(secattr->mls_cat);
162} 197}
@@ -178,17 +213,14 @@ static inline struct netlbl_lsm_secattr *netlbl_secattr_alloc(int flags)
178/** 213/**
179 * netlbl_secattr_free - Frees a netlbl_lsm_secattr struct 214 * netlbl_secattr_free - Frees a netlbl_lsm_secattr struct
180 * @secattr: the struct to free 215 * @secattr: the struct to free
181 * @clear_cache: cache clear flag
182 * 216 *
183 * Description: 217 * Description:
184 * Frees @secattr including all of the internal buffers. If @clear_cache is 218 * Frees @secattr including all of the internal buffers.
185 * true then free the cache fields, otherwise leave them intact.
186 * 219 *
187 */ 220 */
188static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr, 221static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr)
189 u32 clear_cache)
190{ 222{
191 netlbl_secattr_destroy(secattr, clear_cache); 223 netlbl_secattr_destroy(secattr);
192 kfree(secattr); 224 kfree(secattr);
193} 225}
194 226
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index ee68a3124076..764e3af5be93 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -139,6 +139,7 @@ int sctp_inet_listen(struct socket *sock, int backlog);
139void sctp_write_space(struct sock *sk); 139void sctp_write_space(struct sock *sk);
140unsigned int sctp_poll(struct file *file, struct socket *sock, 140unsigned int sctp_poll(struct file *file, struct socket *sock,
141 poll_table *wait); 141 poll_table *wait);
142void sctp_sock_rfree(struct sk_buff *skb);
142 143
143/* 144/*
144 * sctp/primitive.c 145 * sctp/primitive.c
@@ -444,6 +445,19 @@ static inline struct list_head *sctp_list_dequeue(struct list_head *list)
444 return result; 445 return result;
445} 446}
446 447
448/* SCTP version of skb_set_owner_r. We need this one because
449 * of the way we have to do receive buffer accounting on bundled
450 * chunks.
451 */
452static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
453{
454 struct sctp_ulpevent *event = sctp_skb2event(skb);
455
456 skb->sk = sk;
457 skb->destructor = sctp_sock_rfree;
458 atomic_add(event->rmem_len, &sk->sk_rmem_alloc);
459}
460
447/* Tests if the list has one and only one entry. */ 461/* Tests if the list has one and only one entry. */
448static inline int sctp_list_single_entry(struct list_head *head) 462static inline int sctp_list_single_entry(struct list_head *head)
449{ 463{
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 6c40cfc4832d..1a4ddc1ec7d2 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -63,6 +63,7 @@ struct sctp_ulpevent {
63 __u32 cumtsn; 63 __u32 cumtsn;
64 int msg_flags; 64 int msg_flags;
65 int iif; 65 int iif;
66 unsigned int rmem_len;
66}; 67};
67 68
68/* Retrieve the skb this event sits inside of. */ 69/* Retrieve the skb this event sits inside of. */
diff --git a/include/net/sock.h b/include/net/sock.h
index 40bb90ebb2d1..ac286a353032 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -884,8 +884,7 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
884 884
885/** 885/**
886 * sk_filter_release: Release a socket filter 886 * sk_filter_release: Release a socket filter
887 * @sk: socket 887 * @rcu: rcu_head that contains the sk_filter info to remove
888 * @fp: filter to remove
889 * 888 *
890 * Remove a filter from a socket and release its resources. 889 * Remove a filter from a socket and release its resources.
891 */ 890 */
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h
index 2544281e1d5e..be293d795e38 100644
--- a/include/net/timewait_sock.h
+++ b/include/net/timewait_sock.h
@@ -19,6 +19,7 @@ struct timewait_sock_ops {
19 unsigned int twsk_obj_size; 19 unsigned int twsk_obj_size;
20 int (*twsk_unique)(struct sock *sk, 20 int (*twsk_unique)(struct sock *sk,
21 struct sock *sktw, void *twp); 21 struct sock *sktw, void *twp);
22 void (*twsk_destructor)(struct sock *sk);
22}; 23};
23 24
24static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp) 25static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
@@ -28,4 +29,10 @@ static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
28 return 0; 29 return 0;
29} 30}
30 31
32static inline void twsk_destructor(struct sock *sk)
33{
34 if (sk->sk_prot->twsk_prot->twsk_destructor != NULL)
35 sk->sk_prot->twsk_prot->twsk_destructor(sk);
36}
37
31#endif /* _TIMEWAIT_SOCK_H */ 38#endif /* _TIMEWAIT_SOCK_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 1e2a4ddec96e..737fdb2ee8a4 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -995,7 +995,8 @@ struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
995 int create, unsigned short family); 995 int create, unsigned short family);
996extern void xfrm_policy_flush(u8 type); 996extern void xfrm_policy_flush(u8 type);
997extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 997extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
998extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family, int strict); 998extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
999 struct flowi *fl, int family, int strict);
999extern void xfrm_init_pmtu(struct dst_entry *dst); 1000extern void xfrm_init_pmtu(struct dst_entry *dst);
1000 1001
1001extern wait_queue_head_t km_waitq; 1002extern wait_queue_head_t km_waitq;
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index 81b62307621d..c094e5012862 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -36,6 +36,22 @@
36#include <linux/socket.h> 36#include <linux/socket.h>
37#include <rdma/ib_verbs.h> 37#include <rdma/ib_verbs.h>
38 38
39struct rdma_addr_client {
40 atomic_t refcount;
41 struct completion comp;
42};
43
44/**
45 * rdma_addr_register_client - Register an address client.
46 */
47void rdma_addr_register_client(struct rdma_addr_client *client);
48
49/**
50 * rdma_addr_unregister_client - Deregister an address client.
51 * @client: Client object to deregister.
52 */
53void rdma_addr_unregister_client(struct rdma_addr_client *client);
54
39struct rdma_dev_addr { 55struct rdma_dev_addr {
40 unsigned char src_dev_addr[MAX_ADDR_LEN]; 56 unsigned char src_dev_addr[MAX_ADDR_LEN];
41 unsigned char dst_dev_addr[MAX_ADDR_LEN]; 57 unsigned char dst_dev_addr[MAX_ADDR_LEN];
@@ -52,6 +68,7 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr);
52/** 68/**
53 * rdma_resolve_ip - Resolve source and destination IP addresses to 69 * rdma_resolve_ip - Resolve source and destination IP addresses to
54 * RDMA hardware addresses. 70 * RDMA hardware addresses.
71 * @client: Address client associated with request.
55 * @src_addr: An optional source address to use in the resolution. If a 72 * @src_addr: An optional source address to use in the resolution. If a
56 * source address is not provided, a usable address will be returned via 73 * source address is not provided, a usable address will be returned via
57 * the callback. 74 * the callback.
@@ -64,7 +81,8 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr);
64 * or been canceled. A status of 0 indicates success. 81 * or been canceled. A status of 0 indicates success.
65 * @context: User-specified context associated with the call. 82 * @context: User-specified context associated with the call.
66 */ 83 */
67int rdma_resolve_ip(struct sockaddr *src_addr, struct sockaddr *dst_addr, 84int rdma_resolve_ip(struct rdma_addr_client *client,
85 struct sockaddr *src_addr, struct sockaddr *dst_addr,
68 struct rdma_dev_addr *addr, int timeout_ms, 86 struct rdma_dev_addr *addr, int timeout_ms,
69 void (*callback)(int status, struct sockaddr *src_addr, 87 void (*callback)(int status, struct sockaddr *src_addr,
70 struct rdma_dev_addr *addr, void *context), 88 struct rdma_dev_addr *addr, void *context),
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h
index db1b814b62cc..64a721fcbc1c 100644
--- a/include/rdma/ib_user_verbs.h
+++ b/include/rdma/ib_user_verbs.h
@@ -458,7 +458,7 @@ struct ib_uverbs_query_qp_resp {
458 __u8 cur_qp_state; 458 __u8 cur_qp_state;
459 __u8 path_mtu; 459 __u8 path_mtu;
460 __u8 path_mig_state; 460 __u8 path_mig_state;
461 __u8 en_sqd_async_notify; 461 __u8 sq_draining;
462 __u8 max_rd_atomic; 462 __u8 max_rd_atomic;
463 __u8 max_dest_rd_atomic; 463 __u8 max_dest_rd_atomic;
464 __u8 min_rnr_timer; 464 __u8 min_rnr_timer;
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 401192e56e50..61eebec00a7b 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -136,7 +136,6 @@ struct iscsi_conn {
136 136
137 /* control data */ 137 /* control data */
138 int id; /* CID */ 138 int id; /* CID */
139 struct list_head item; /* maintains list of conns */
140 int c_stage; /* connection state */ 139 int c_stage; /* connection state */
141 /* 140 /*
142 * Preallocated buffer for pdus that have data but do not 141 * Preallocated buffer for pdus that have data but do not
@@ -235,10 +234,8 @@ struct iscsi_session {
235 * - mgmtpool, * 234 * - mgmtpool, *
236 * - r2tpool */ 235 * - r2tpool */
237 int state; /* session state */ 236 int state; /* session state */
238 struct list_head item;
239 int age; /* counts session re-opens */ 237 int age; /* counts session re-opens */
240 238
241 struct list_head connections; /* list of connections */
242 int cmds_max; /* size of cmds array */ 239 int cmds_max; /* size of cmds array */
243 struct iscsi_cmd_task **cmds; /* Original Cmds arr */ 240 struct iscsi_cmd_task **cmds; /* Original Cmds arr */
244 struct iscsi_queue cmdpool; /* PDU's pool */ 241 struct iscsi_queue cmdpool; /* PDU's pool */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 84a6d5fe0920..5c0e9791441c 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -97,6 +97,7 @@ extern const unsigned char scsi_command_size[8];
97#define PERSISTENT_RESERVE_IN 0x5e 97#define PERSISTENT_RESERVE_IN 0x5e
98#define PERSISTENT_RESERVE_OUT 0x5f 98#define PERSISTENT_RESERVE_OUT 0x5f
99#define REPORT_LUNS 0xa0 99#define REPORT_LUNS 0xa0
100#define MAINTENANCE_IN 0xa3
100#define MOVE_MEDIUM 0xa5 101#define MOVE_MEDIUM 0xa5
101#define EXCHANGE_MEDIUM 0xa6 102#define EXCHANGE_MEDIUM 0xa6
102#define READ_12 0xa8 103#define READ_12 0xa8
@@ -114,6 +115,8 @@ extern const unsigned char scsi_command_size[8];
114#define SERVICE_ACTION_IN 0x9e 115#define SERVICE_ACTION_IN 0x9e
115/* values for service action in */ 116/* values for service action in */
116#define SAI_READ_CAPACITY_16 0x10 117#define SAI_READ_CAPACITY_16 0x10
118/* values for maintenance in */
119#define MI_REPORT_TARGET_PGS 0x0a
117 120
118/* Values for T10/04-262r7 */ 121/* Values for T10/04-262r7 */
119#define ATA_16 0x85 /* 16-byte pass-thru */ 122#define ATA_16 0x85 /* 16-byte pass-thru */
@@ -430,7 +433,7 @@ struct scsi_lun {
430#define SCSI_IOCTL_GET_PCI 0x5387 433#define SCSI_IOCTL_GET_PCI 0x5387
431 434
432/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */ 435/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */
433static inline u32 scsi_to_u32(u8 *ptr) 436static inline __u32 scsi_to_u32(__u8 *ptr)
434{ 437{
435 return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3]; 438 return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3];
436} 439}
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 39e833260bd0..4b95c89c95c9 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -29,7 +29,6 @@
29struct scsi_transport_template; 29struct scsi_transport_template;
30struct iscsi_transport; 30struct iscsi_transport;
31struct Scsi_Host; 31struct Scsi_Host;
32struct mempool_zone;
33struct iscsi_cls_conn; 32struct iscsi_cls_conn;
34struct iscsi_conn; 33struct iscsi_conn;
35struct iscsi_cmd_task; 34struct iscsi_cmd_task;
@@ -157,9 +156,6 @@ struct iscsi_cls_conn {
157 156
158 int active; /* must be accessed with the connlock */ 157 int active; /* must be accessed with the connlock */
159 struct device dev; /* sysfs transport/container device */ 158 struct device dev; /* sysfs transport/container device */
160 struct mempool_zone *z_error;
161 struct mempool_zone *z_pdu;
162 struct list_head freequeue;
163}; 159};
164 160
165#define iscsi_dev_to_conn(_dev) \ 161#define iscsi_dev_to_conn(_dev) \
diff --git a/include/sound/version.h b/include/sound/version.h
index 4ad86eb6440b..52fd6879b86e 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by alsa/ksync script. */ 1/* include/version.h. Generated by alsa/ksync script. */
2#define CONFIG_SND_VERSION "1.0.13" 2#define CONFIG_SND_VERSION "1.0.13"
3#define CONFIG_SND_DATE " (Fri Oct 06 18:28:19 2006 UTC)" 3#define CONFIG_SND_DATE " (Sun Oct 22 08:56:16 2006 UTC)"