aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/unaligned.h13
-rw-r--r--include/asm-arm/arch-orion5x/io.h9
-rw-r--r--include/asm-arm/arch-pxa/irqs.h5
-rw-r--r--include/asm-arm/arch-pxa/magician.h49
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h196
-rw-r--r--include/asm-arm/arch-pxa/pxafb.h71
-rw-r--r--include/asm-arm/arch-pxa/regs-lcd.h171
-rw-r--r--include/asm-arm/arch-pxa/system.h2
-rw-r--r--include/asm-arm/page.h8
-rw-r--r--include/asm-arm/unaligned.h174
-rw-r--r--include/asm-avr32/unaligned.h13
-rw-r--r--include/asm-blackfin/unaligned.h13
-rw-r--r--include/asm-cris/unaligned.h17
-rw-r--r--include/asm-frv/unaligned.h196
-rw-r--r--include/asm-generic/bitops.h4
-rw-r--r--include/asm-generic/futex.h5
-rw-r--r--include/asm-generic/ioctl.h33
-rw-r--r--include/asm-generic/memory_model.h2
-rw-r--r--include/asm-generic/page.h2
-rw-r--r--include/asm-generic/rtc.h3
-rw-r--r--include/asm-generic/unaligned.h124
-rw-r--r--include/asm-h8300/unaligned.h20
-rw-r--r--include/asm-ia64/dma-mapping.h28
-rw-r--r--include/asm-ia64/futex.h2
-rw-r--r--include/asm-ia64/machvec.h50
-rw-r--r--include/asm-ia64/machvec_hpzx1.h16
-rw-r--r--include/asm-ia64/machvec_hpzx1_swiotlb.h16
-rw-r--r--include/asm-ia64/machvec_sn2.h16
-rw-r--r--include/asm-ia64/thread_info.h5
-rw-r--r--include/asm-ia64/topology.h2
-rw-r--r--include/asm-ia64/unaligned.h7
-rw-r--r--include/asm-ia64/uncached.h6
-rw-r--r--include/asm-m32r/unaligned.h27
-rw-r--r--include/asm-m68k/unaligned.h17
-rw-r--r--include/asm-m68knommu/unaligned.h22
-rw-r--r--include/asm-mips/futex.h2
-rw-r--r--include/asm-mips/unaligned.h37
-rw-r--r--include/asm-mn10300/unaligned.h130
-rw-r--r--include/asm-parisc/futex.h2
-rw-r--r--include/asm-parisc/unaligned.h12
-rw-r--r--include/asm-powerpc/futex.h2
-rw-r--r--include/asm-powerpc/irq.h2
-rw-r--r--include/asm-powerpc/processor.h6
-rw-r--r--include/asm-powerpc/rio.h (renamed from include/asm-ppc/rio.h)0
-rw-r--r--include/asm-powerpc/system.h24
-rw-r--r--include/asm-powerpc/unaligned.h11
-rw-r--r--include/asm-s390/ccwgroup.h7
-rw-r--r--include/asm-s390/hugetlb.h183
-rw-r--r--include/asm-s390/page.h49
-rw-r--r--include/asm-s390/pgtable.h21
-rw-r--r--include/asm-s390/processor.h9
-rw-r--r--include/asm-s390/ptrace.h2
-rw-r--r--include/asm-s390/qdio.h1
-rw-r--r--include/asm-s390/setup.h39
-rw-r--r--include/asm-s390/smp.h12
-rw-r--r--include/asm-s390/sparsemem.h18
-rw-r--r--include/asm-s390/sysinfo.h5
-rw-r--r--include/asm-s390/system.h18
-rw-r--r--include/asm-s390/thread_info.h2
-rw-r--r--include/asm-s390/tlbflush.h1
-rw-r--r--include/asm-s390/topology.h4
-rw-r--r--include/asm-s390/unaligned.h25
-rw-r--r--include/asm-sh/futex.h2
-rw-r--r--include/asm-sh/unaligned.h20
-rw-r--r--include/asm-sparc/head.h11
-rw-r--r--include/asm-sparc/kgdb.h116
-rw-r--r--include/asm-sparc/smp.h2
-rw-r--r--include/asm-sparc/system.h2
-rw-r--r--include/asm-sparc/unaligned.h10
-rw-r--r--include/asm-sparc64/futex.h2
-rw-r--r--include/asm-sparc64/kgdb.h1
-rw-r--r--include/asm-sparc64/pil.h7
-rw-r--r--include/asm-sparc64/system.h5
-rw-r--r--include/asm-sparc64/ttable.h6
-rw-r--r--include/asm-sparc64/unaligned.h10
-rw-r--r--include/asm-um/unaligned.h6
-rw-r--r--include/asm-v850/unaligned.h124
-rw-r--r--include/asm-x86/futex.h2
-rw-r--r--include/asm-x86/olpc.h132
-rw-r--r--include/asm-x86/pci.h2
-rw-r--r--include/asm-x86/thread_info_32.h13
-rw-r--r--include/asm-x86/thread_info_64.h13
-rw-r--r--include/asm-x86/time.h1
-rw-r--r--include/asm-x86/topology.h20
-rw-r--r--include/asm-x86/tsc.h2
-rw-r--r--include/asm-x86/unaligned.h31
-rw-r--r--include/asm-xtensa/unaligned.h35
-rw-r--r--include/linux/Kbuild11
-rw-r--r--include/linux/acpi.h5
-rw-r--r--include/linux/agp_backend.h3
-rw-r--r--include/linux/aio.h19
-rw-r--r--include/linux/audit.h28
-rw-r--r--include/linux/backing-dev.h102
-rw-r--r--include/linux/binfmts.h4
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/bitops.h117
-rw-r--r--include/linux/blkdev.h51
-rw-r--r--include/linux/buffer_head.h1
-rw-r--r--include/linux/byteorder/Kbuild6
-rw-r--r--include/linux/byteorder/big_endian.h2
-rw-r--r--include/linux/byteorder/generic.h8
-rw-r--r--include/linux/byteorder/little_endian.h2
-rw-r--r--include/linux/capability.h12
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/cgroup.h80
-rw-r--r--include/linux/cgroup_subsys.h6
-rw-r--r--include/linux/coda_fs_i.h2
-rw-r--r--include/linux/coda_linux.h3
-rw-r--r--include/linux/compiler-gcc.h5
-rw-r--r--include/linux/concap.h3
-rw-r--r--include/linux/configfs.h4
-rw-r--r--include/linux/console.h4
-rw-r--r--include/linux/console_struct.h1
-rw-r--r--include/linux/cpu.h2
-rw-r--r--include/linux/cpufreq.h6
-rw-r--r--include/linux/crc-ccitt.h2
-rw-r--r--include/linux/dcache.h4
-rw-r--r--include/linux/debugobjects.h90
-rw-r--r--include/linux/device-mapper.h3
-rw-r--r--include/linux/device_cgroup.h12
-rw-r--r--include/linux/devpts_fs.h4
-rw-r--r--include/linux/dma-attrs.h74
-rw-r--r--include/linux/dma-mapping.h17
-rw-r--r--include/linux/edac.h14
-rw-r--r--include/linux/elf.h2
-rw-r--r--include/linux/eventfd.h5
-rw-r--r--include/linux/ext4_fs.h1207
-rw-r--r--include/linux/ext4_fs_extents.h232
-rw-r--r--include/linux/ext4_fs_i.h167
-rw-r--r--include/linux/ext4_fs_sb.h148
-rw-r--r--include/linux/ext4_jbd2.h231
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/fsl_devices.h2
-rw-r--r--include/linux/fsnotify.h4
-rw-r--r--include/linux/generic_serial.h2
-rw-r--r--include/linux/gfp.h6
-rw-r--r--include/linux/hrtimer.h15
-rw-r--r--include/linux/hw_random.h2
-rw-r--r--include/linux/i2c-id.h3
-rw-r--r--include/linux/i2c.h17
-rw-r--r--include/linux/i2o.h3
-rw-r--r--include/linux/idr.h3
-rw-r--r--include/linux/if_macvlan.h3
-rw-r--r--include/linux/inet.h2
-rw-r--r--include/linux/init.h2
-rw-r--r--include/linux/interrupt.h1
-rw-r--r--include/linux/ipc_namespace.h24
-rw-r--r--include/linux/ipmi.h85
-rw-r--r--include/linux/ipmi_smi.h10
-rw-r--r--include/linux/isicom.h7
-rw-r--r--include/linux/kbuild.h15
-rw-r--r--include/linux/kernel.h96
-rw-r--r--include/linux/key.h30
-rw-r--r--include/linux/keyctl.h1
-rw-r--r--include/linux/kfifo.h5
-rw-r--r--include/linux/kobj_map.h4
-rw-r--r--include/linux/kobject.h3
-rw-r--r--include/linux/kref.h3
-rw-r--r--include/linux/libata.h12
-rw-r--r--include/linux/list.h10
-rw-r--r--include/linux/lmb.h4
-rw-r--r--include/linux/mca-legacy.h1
-rw-r--r--include/linux/memcontrol.h16
-rw-r--r--include/linux/memory.h7
-rw-r--r--include/linux/mlx4/device.h3
-rw-r--r--include/linux/mm.h15
-rw-r--r--include/linux/mm_types.h11
-rw-r--r--include/linux/mmzone.h3
-rw-r--r--include/linux/mod_devicetable.h11
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/msg.h14
-rw-r--r--include/linux/msi.h1
-rw-r--r--include/linux/nbd.h10
-rw-r--r--include/linux/ncp_fs_i.h4
-rw-r--r--include/linux/netlink.h1
-rw-r--r--include/linux/notifier.h4
-rw-r--r--include/linux/of_device.h2
-rw-r--r--include/linux/pci.h21
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/percpu.h1
-rw-r--r--include/linux/personality.h4
-rw-r--r--include/linux/phantom.h11
-rw-r--r--include/linux/pid.h8
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/pm.h4
-rw-r--r--include/linux/pnp.h4
-rw-r--r--include/linux/poison.h7
-rw-r--r--include/linux/proc_fs.h61
-rw-r--r--include/linux/profile.h4
-rw-r--r--include/linux/proportions.h13
-rw-r--r--include/linux/ptrace.h4
-rw-r--r--include/linux/raid/md.h1
-rw-r--r--include/linux/raid/md_k.h4
-rw-r--r--include/linux/rcuclassic.h3
-rw-r--r--include/linux/rcupdate.h3
-rw-r--r--include/linux/rcupreempt.h3
-rw-r--r--include/linux/rcupreempt_trace.h2
-rw-r--r--include/linux/reiserfs_fs_sb.h1
-rw-r--r--include/linux/res_counter.h29
-rw-r--r--include/linux/resource.h1
-rw-r--r--include/linux/rio.h41
-rw-r--r--include/linux/rio_drv.h3
-rw-r--r--include/linux/rwsem.h3
-rw-r--r--include/linux/sched.h31
-rw-r--r--include/linux/security.h69
-rw-r--r--include/linux/seq_file.h2
-rw-r--r--include/linux/serial_core.h6
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/slab.h10
-rw-r--r--include/linux/smb.h1
-rw-r--r--include/linux/smb_fs_i.h2
-rw-r--r--include/linux/smb_fs_sb.h4
-rw-r--r--include/linux/svga.h3
-rw-r--r--include/linux/syscalls.h30
-rw-r--r--include/linux/sysctl.h14
-rw-r--r--include/linux/sysv_fs.h6
-rw-r--r--include/linux/textsearch.h4
-rw-r--r--include/linux/thread_info.h27
-rw-r--r--include/linux/timer.h23
-rw-r--r--include/linux/tty.h34
-rw-r--r--include/linux/tty_driver.h106
-rw-r--r--include/linux/unaligned/access_ok.h67
-rw-r--r--include/linux/unaligned/be_byteshift.h70
-rw-r--r--include/linux/unaligned/be_memmove.h36
-rw-r--r--include/linux/unaligned/be_struct.h36
-rw-r--r--include/linux/unaligned/generic.h68
-rw-r--r--include/linux/unaligned/le_byteshift.h70
-rw-r--r--include/linux/unaligned/le_memmove.h36
-rw-r--r--include/linux/unaligned/le_struct.h36
-rw-r--r--include/linux/unaligned/memmove.h45
-rw-r--r--include/linux/unaligned/packed_struct.h46
-rw-r--r--include/linux/writeback.h3
-rw-r--r--include/linux/xattr.h6
-rw-r--r--include/media/v4l2-chip-ident.h1
-rw-r--r--include/media/v4l2-common.h4
-rw-r--r--include/media/v4l2-i2c-drv-legacy.h2
-rw-r--r--include/media/v4l2-i2c-drv.h2
-rw-r--r--include/net/compat.h3
-rw-r--r--include/net/ip_vs.h3
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h10
-rw-r--r--include/net/netlabel.h1
-rw-r--r--include/net/route.h2
-rw-r--r--include/net/xfrm.h23
-rw-r--r--include/rdma/ib_umem.h4
-rw-r--r--include/rdma/ib_verbs.h33
-rw-r--r--include/scsi/libiscsi.h1
-rw-r--r--include/sound/mpu401.h1
247 files changed, 2869 insertions, 4081 deletions
diff --git a/include/asm-alpha/unaligned.h b/include/asm-alpha/unaligned.h
index a1d72846f61c..3787c60aed3f 100644
--- a/include/asm-alpha/unaligned.h
+++ b/include/asm-alpha/unaligned.h
@@ -1,6 +1,11 @@
1#ifndef __ALPHA_UNALIGNED_H 1#ifndef _ASM_ALPHA_UNALIGNED_H
2#define __ALPHA_UNALIGNED_H 2#define _ASM_ALPHA_UNALIGNED_H
3 3
4#include <asm-generic/unaligned.h> 4#include <linux/unaligned/le_struct.h>
5#include <linux/unaligned/be_byteshift.h>
6#include <linux/unaligned/generic.h>
5 7
6#endif 8#define get_unaligned __get_unaligned_le
9#define put_unaligned __put_unaligned_le
10
11#endif /* _ASM_ALPHA_UNALIGNED_H */
diff --git a/include/asm-arm/arch-orion5x/io.h b/include/asm-arm/arch-orion5x/io.h
index 5148ab7ad1f8..50f8c8802206 100644
--- a/include/asm-arm/arch-orion5x/io.h
+++ b/include/asm-arm/arch-orion5x/io.h
@@ -20,11 +20,10 @@ static inline void __iomem *
20__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype) 20__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype)
21{ 21{
22 void __iomem *retval; 22 void __iomem *retval;
23 23 unsigned long offs = paddr - ORION5X_REGS_PHYS_BASE;
24 if (mtype == MT_DEVICE && size && paddr >= ORION5X_REGS_PHYS_BASE && 24 if (mtype == MT_DEVICE && size && offs < ORION5X_REGS_SIZE &&
25 paddr + size <= ORION5X_REGS_PHYS_BASE + ORION5X_REGS_SIZE) { 25 size <= ORION5X_REGS_SIZE && offs + size <= ORION5X_REGS_SIZE) {
26 retval = (void __iomem *)ORION5X_REGS_VIRT_BASE + 26 retval = (void __iomem *)ORION5X_REGS_VIRT_BASE + offs;
27 (paddr - ORION5X_REGS_PHYS_BASE);
28 } else { 27 } else {
29 retval = __arm_ioremap(paddr, size, mtype); 28 retval = __arm_ioremap(paddr, size, mtype);
30 } 29 }
diff --git a/include/asm-arm/arch-pxa/irqs.h b/include/asm-arm/arch-pxa/irqs.h
index 50c77eacbd5e..b6c8fe377683 100644
--- a/include/asm-arm/arch-pxa/irqs.h
+++ b/include/asm-arm/arch-pxa/irqs.h
@@ -239,7 +239,7 @@
239/* ITE8152 irqs */ 239/* ITE8152 irqs */
240/* add IT8152 IRQs beyond BOARD_END */ 240/* add IT8152 IRQs beyond BOARD_END */
241#ifdef CONFIG_PCI_HOST_ITE8152 241#ifdef CONFIG_PCI_HOST_ITE8152
242#define IT8152_IRQ(x) (IRQ_GPIO(IRQ_BOARD_END) + 1 + (x)) 242#define IT8152_IRQ(x) (IRQ_BOARD_END + (x))
243 243
244/* IRQ-sources in 3 groups - local devices, LPC (serial), and external PCI */ 244/* IRQ-sources in 3 groups - local devices, LPC (serial), and external PCI */
245#define IT8152_LD_IRQ_COUNT 9 245#define IT8152_LD_IRQ_COUNT 9
@@ -253,6 +253,9 @@
253 253
254#define IT8152_LAST_IRQ IT8152_LD_IRQ(IT8152_LD_IRQ_COUNT - 1) 254#define IT8152_LAST_IRQ IT8152_LD_IRQ(IT8152_LD_IRQ_COUNT - 1)
255 255
256#if NR_IRQS < (IT8152_LAST_IRQ+1)
256#undef NR_IRQS 257#undef NR_IRQS
257#define NR_IRQS (IT8152_LAST_IRQ+1) 258#define NR_IRQS (IT8152_LAST_IRQ+1)
258#endif 259#endif
260
261#endif /* CONFIG_PCI_HOST_ITE8152 */
diff --git a/include/asm-arm/arch-pxa/magician.h b/include/asm-arm/arch-pxa/magician.h
index b34fd5683e2d..169b374f9921 100644
--- a/include/asm-arm/arch-pxa/magician.h
+++ b/include/asm-arm/arch-pxa/magician.h
@@ -13,7 +13,6 @@
13#define _MAGICIAN_H_ 13#define _MAGICIAN_H_
14 14
15#include <asm/arch/irqs.h> 15#include <asm/arch/irqs.h>
16#include <asm/arch/pxa2xx-gpio.h>
17 16
18/* 17/*
19 * PXA GPIOs 18 * PXA GPIOs
@@ -64,54 +63,6 @@
64#define GPIO120_MAGICIAN_UNKNOWN 120 63#define GPIO120_MAGICIAN_UNKNOWN 120
65 64
66/* 65/*
67 * PXA GPIO alternate function mode & direction
68 */
69
70#define GPIO0_MAGICIAN_KEY_POWER_MD (0 | GPIO_IN)
71#define GPIO9_MAGICIAN_UNKNOWN_MD (9 | GPIO_IN)
72#define GPIO10_MAGICIAN_GSM_IRQ_MD (10 | GPIO_IN)
73#define GPIO11_MAGICIAN_GSM_OUT1_MD (11 | GPIO_OUT)
74#define GPIO13_MAGICIAN_CPLD_IRQ_MD (13 | GPIO_IN)
75#define GPIO18_MAGICIAN_UNKNOWN_MD (18 | GPIO_OUT)
76#define GPIO22_MAGICIAN_VIBRA_EN_MD (22 | GPIO_OUT)
77#define GPIO26_MAGICIAN_GSM_POWER_MD (26 | GPIO_OUT)
78#define GPIO27_MAGICIAN_USBC_PUEN_MD (27 | GPIO_OUT)
79#define GPIO30_MAGICIAN_nCHARGE_EN_MD (30 | GPIO_OUT)
80#define GPIO37_MAGICIAN_KEY_HANGUP_MD (37 | GPIO_OUT)
81#define GPIO38_MAGICIAN_KEY_CONTACTS_MD (38 | GPIO_OUT)
82#define GPIO40_MAGICIAN_GSM_OUT2_MD (40 | GPIO_OUT)
83#define GPIO48_MAGICIAN_UNKNOWN_MD (48 | GPIO_OUT)
84#define GPIO56_MAGICIAN_UNKNOWN_MD (56 | GPIO_OUT)
85#define GPIO57_MAGICIAN_CAM_RESET_MD (57 | GPIO_OUT)
86#define GPIO75_MAGICIAN_SAMSUNG_POWER_MD (75 | GPIO_OUT)
87#define GPIO83_MAGICIAN_nIR_EN_MD (83 | GPIO_OUT)
88#define GPIO86_MAGICIAN_GSM_RESET_MD (86 | GPIO_OUT)
89#define GPIO87_MAGICIAN_GSM_SELECT_MD (87 | GPIO_OUT)
90#define GPIO90_MAGICIAN_KEY_CALENDAR_MD (90 | GPIO_OUT)
91#define GPIO91_MAGICIAN_KEY_CAMERA_MD (91 | GPIO_OUT)
92#define GPIO93_MAGICIAN_KEY_UP_MD (93 | GPIO_IN)
93#define GPIO94_MAGICIAN_KEY_DOWN_MD (94 | GPIO_IN)
94#define GPIO95_MAGICIAN_KEY_LEFT_MD (95 | GPIO_IN)
95#define GPIO96_MAGICIAN_KEY_RIGHT_MD (96 | GPIO_IN)
96#define GPIO97_MAGICIAN_KEY_ENTER_MD (97 | GPIO_IN)
97#define GPIO98_MAGICIAN_KEY_RECORD_MD (98 | GPIO_IN)
98#define GPIO99_MAGICIAN_HEADPHONE_IN_MD (99 | GPIO_IN)
99#define GPIO100_MAGICIAN_KEY_VOL_UP_MD (100 | GPIO_IN)
100#define GPIO101_MAGICIAN_KEY_VOL_DOWN_MD (101 | GPIO_IN)
101#define GPIO102_MAGICIAN_KEY_PHONE_MD (102 | GPIO_IN)
102#define GPIO103_MAGICIAN_LED_KP_MD (103 | GPIO_OUT)
103#define GPIO104_MAGICIAN_LCD_POWER_1_MD (104 | GPIO_OUT)
104#define GPIO105_MAGICIAN_LCD_POWER_2_MD (105 | GPIO_OUT)
105#define GPIO106_MAGICIAN_LCD_POWER_3_MD (106 | GPIO_OUT)
106#define GPIO107_MAGICIAN_DS1WM_IRQ_MD (107 | GPIO_IN)
107#define GPIO108_MAGICIAN_GSM_READY_MD (108 | GPIO_IN)
108#define GPIO114_MAGICIAN_UNKNOWN_MD (114 | GPIO_OUT)
109#define GPIO115_MAGICIAN_nPEN_IRQ_MD (115 | GPIO_IN)
110#define GPIO116_MAGICIAN_nCAM_EN_MD (116 | GPIO_OUT)
111#define GPIO119_MAGICIAN_UNKNOWN_MD (119 | GPIO_OUT)
112#define GPIO120_MAGICIAN_UNKNOWN_MD (120 | GPIO_OUT)
113
114/*
115 * CPLD IRQs 66 * CPLD IRQs
116 */ 67 */
117 68
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index a322012f16ac..4b2ea1e95c57 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -1406,202 +1406,6 @@
1406#define OSCC_OON (1 << 1) /* 32.768kHz OON (write-once only bit) */ 1406#define OSCC_OON (1 << 1) /* 32.768kHz OON (write-once only bit) */
1407#define OSCC_OOK (1 << 0) /* 32.768kHz OOK (read-only bit) */ 1407#define OSCC_OOK (1 << 0) /* 32.768kHz OOK (read-only bit) */
1408 1408
1409
1410/*
1411 * LCD
1412 */
1413
1414#define LCCR0 __REG(0x44000000) /* LCD Controller Control Register 0 */
1415#define LCCR1 __REG(0x44000004) /* LCD Controller Control Register 1 */
1416#define LCCR2 __REG(0x44000008) /* LCD Controller Control Register 2 */
1417#define LCCR3 __REG(0x4400000C) /* LCD Controller Control Register 3 */
1418#define LCCR4 __REG(0x44000010) /* LCD Controller Control Register 3 */
1419#define DFBR0 __REG(0x44000020) /* DMA Channel 0 Frame Branch Register */
1420#define DFBR1 __REG(0x44000024) /* DMA Channel 1 Frame Branch Register */
1421#define LCSR __REG(0x44000038) /* LCD Controller Status Register */
1422#define LIIDR __REG(0x4400003C) /* LCD Controller Interrupt ID Register */
1423#define TMEDRGBR __REG(0x44000040) /* TMED RGB Seed Register */
1424#define TMEDCR __REG(0x44000044) /* TMED Control Register */
1425
1426#define LCCR3_1BPP (0 << 24)
1427#define LCCR3_2BPP (1 << 24)
1428#define LCCR3_4BPP (2 << 24)
1429#define LCCR3_8BPP (3 << 24)
1430#define LCCR3_16BPP (4 << 24)
1431
1432#define LCCR3_PDFOR_0 (0 << 30)
1433#define LCCR3_PDFOR_1 (1 << 30)
1434#define LCCR3_PDFOR_2 (2 << 30)
1435#define LCCR3_PDFOR_3 (3 << 30)
1436
1437#define LCCR4_PAL_FOR_0 (0 << 15)
1438#define LCCR4_PAL_FOR_1 (1 << 15)
1439#define LCCR4_PAL_FOR_2 (2 << 15)
1440#define LCCR4_PAL_FOR_MASK (3 << 15)
1441
1442#define FDADR0 __REG(0x44000200) /* DMA Channel 0 Frame Descriptor Address Register */
1443#define FSADR0 __REG(0x44000204) /* DMA Channel 0 Frame Source Address Register */
1444#define FIDR0 __REG(0x44000208) /* DMA Channel 0 Frame ID Register */
1445#define LDCMD0 __REG(0x4400020C) /* DMA Channel 0 Command Register */
1446#define FDADR1 __REG(0x44000210) /* DMA Channel 1 Frame Descriptor Address Register */
1447#define FSADR1 __REG(0x44000214) /* DMA Channel 1 Frame Source Address Register */
1448#define FIDR1 __REG(0x44000218) /* DMA Channel 1 Frame ID Register */
1449#define LDCMD1 __REG(0x4400021C) /* DMA Channel 1 Command Register */
1450
1451#define LCCR0_ENB (1 << 0) /* LCD Controller enable */
1452#define LCCR0_CMS (1 << 1) /* Color/Monochrome Display Select */
1453#define LCCR0_Color (LCCR0_CMS*0) /* Color display */
1454#define LCCR0_Mono (LCCR0_CMS*1) /* Monochrome display */
1455#define LCCR0_SDS (1 << 2) /* Single/Dual Panel Display */
1456 /* Select */
1457#define LCCR0_Sngl (LCCR0_SDS*0) /* Single panel display */
1458#define LCCR0_Dual (LCCR0_SDS*1) /* Dual panel display */
1459
1460#define LCCR0_LDM (1 << 3) /* LCD Disable Done Mask */
1461#define LCCR0_SFM (1 << 4) /* Start of frame mask */
1462#define LCCR0_IUM (1 << 5) /* Input FIFO underrun mask */
1463#define LCCR0_EFM (1 << 6) /* End of Frame mask */
1464#define LCCR0_PAS (1 << 7) /* Passive/Active display Select */
1465#define LCCR0_Pas (LCCR0_PAS*0) /* Passive display (STN) */
1466#define LCCR0_Act (LCCR0_PAS*1) /* Active display (TFT) */
1467#define LCCR0_DPD (1 << 9) /* Double Pixel Data (monochrome */
1468 /* display mode) */
1469#define LCCR0_4PixMono (LCCR0_DPD*0) /* 4-Pixel/clock Monochrome */
1470 /* display */
1471#define LCCR0_8PixMono (LCCR0_DPD*1) /* 8-Pixel/clock Monochrome */
1472 /* display */
1473#define LCCR0_DIS (1 << 10) /* LCD Disable */
1474#define LCCR0_QDM (1 << 11) /* LCD Quick Disable mask */
1475#define LCCR0_PDD (0xff << 12) /* Palette DMA request delay */
1476#define LCCR0_PDD_S 12
1477#define LCCR0_BM (1 << 20) /* Branch mask */
1478#define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */
1479#define LCCR0_LCDT (1 << 22) /* LCD panel type */
1480#define LCCR0_RDSTM (1 << 23) /* Read status interrupt mask */
1481#define LCCR0_CMDIM (1 << 24) /* Command interrupt mask */
1482#define LCCR0_OUC (1 << 25) /* Overlay Underlay control bit */
1483#define LCCR0_LDDALT (1 << 26) /* LDD alternate mapping control */
1484
1485#define LCCR1_PPL Fld (10, 0) /* Pixels Per Line - 1 */
1486#define LCCR1_DisWdth(Pixel) /* Display Width [1..800 pix.] */ \
1487 (((Pixel) - 1) << FShft (LCCR1_PPL))
1488
1489#define LCCR1_HSW Fld (6, 10) /* Horizontal Synchronization */
1490#define LCCR1_HorSnchWdth(Tpix) /* Horizontal Synchronization */ \
1491 /* pulse Width [1..64 Tpix] */ \
1492 (((Tpix) - 1) << FShft (LCCR1_HSW))
1493
1494#define LCCR1_ELW Fld (8, 16) /* End-of-Line pixel clock Wait */
1495 /* count - 1 [Tpix] */
1496#define LCCR1_EndLnDel(Tpix) /* End-of-Line Delay */ \
1497 /* [1..256 Tpix] */ \
1498 (((Tpix) - 1) << FShft (LCCR1_ELW))
1499
1500#define LCCR1_BLW Fld (8, 24) /* Beginning-of-Line pixel clock */
1501 /* Wait count - 1 [Tpix] */
1502#define LCCR1_BegLnDel(Tpix) /* Beginning-of-Line Delay */ \
1503 /* [1..256 Tpix] */ \
1504 (((Tpix) - 1) << FShft (LCCR1_BLW))
1505
1506
1507#define LCCR2_LPP Fld (10, 0) /* Line Per Panel - 1 */
1508#define LCCR2_DisHght(Line) /* Display Height [1..1024 lines] */ \
1509 (((Line) - 1) << FShft (LCCR2_LPP))
1510
1511#define LCCR2_VSW Fld (6, 10) /* Vertical Synchronization pulse */
1512 /* Width - 1 [Tln] (L_FCLK) */
1513#define LCCR2_VrtSnchWdth(Tln) /* Vertical Synchronization pulse */ \
1514 /* Width [1..64 Tln] */ \
1515 (((Tln) - 1) << FShft (LCCR2_VSW))
1516
1517#define LCCR2_EFW Fld (8, 16) /* End-of-Frame line clock Wait */
1518 /* count [Tln] */
1519#define LCCR2_EndFrmDel(Tln) /* End-of-Frame Delay */ \
1520 /* [0..255 Tln] */ \
1521 ((Tln) << FShft (LCCR2_EFW))
1522
1523#define LCCR2_BFW Fld (8, 24) /* Beginning-of-Frame line clock */
1524 /* Wait count [Tln] */
1525#define LCCR2_BegFrmDel(Tln) /* Beginning-of-Frame Delay */ \
1526 /* [0..255 Tln] */ \
1527 ((Tln) << FShft (LCCR2_BFW))
1528
1529#if 0
1530#define LCCR3_PCD (0xff) /* Pixel clock divisor */
1531#define LCCR3_ACB (0xff << 8) /* AC Bias pin frequency */
1532#define LCCR3_ACB_S 8
1533#endif
1534
1535#define LCCR3_API (0xf << 16) /* AC Bias pin trasitions per interrupt */
1536#define LCCR3_API_S 16
1537#define LCCR3_VSP (1 << 20) /* vertical sync polarity */
1538#define LCCR3_HSP (1 << 21) /* horizontal sync polarity */
1539#define LCCR3_PCP (1 << 22) /* Pixel Clock Polarity (L_PCLK) */
1540#define LCCR3_PixRsEdg (LCCR3_PCP*0) /* Pixel clock Rising-Edge */
1541#define LCCR3_PixFlEdg (LCCR3_PCP*1) /* Pixel clock Falling-Edge */
1542
1543#define LCCR3_OEP (1 << 23) /* Output Enable Polarity (L_BIAS, */
1544 /* active display mode) */
1545#define LCCR3_OutEnH (LCCR3_OEP*0) /* Output Enable active High */
1546#define LCCR3_OutEnL (LCCR3_OEP*1) /* Output Enable active Low */
1547
1548#if 0
1549#define LCCR3_BPP (7 << 24) /* bits per pixel */
1550#define LCCR3_BPP_S 24
1551#endif
1552#define LCCR3_DPC (1 << 27) /* double pixel clock mode */
1553
1554
1555#define LCCR3_PCD Fld (8, 0) /* Pixel Clock Divisor */
1556#define LCCR3_PixClkDiv(Div) /* Pixel Clock Divisor */ \
1557 (((Div) << FShft (LCCR3_PCD)))
1558
1559
1560#define LCCR3_BPP Fld (3, 24) /* Bit Per Pixel */
1561#define LCCR3_Bpp(Bpp) /* Bit Per Pixel */ \
1562 (((Bpp) << FShft (LCCR3_BPP)))
1563
1564#define LCCR3_ACB Fld (8, 8) /* AC Bias */
1565#define LCCR3_Acb(Acb) /* BAC Bias */ \
1566 (((Acb) << FShft (LCCR3_ACB)))
1567
1568#define LCCR3_HorSnchH (LCCR3_HSP*0) /* Horizontal Synchronization */
1569 /* pulse active High */
1570#define LCCR3_HorSnchL (LCCR3_HSP*1) /* Horizontal Synchronization */
1571
1572#define LCCR3_VrtSnchH (LCCR3_VSP*0) /* Vertical Synchronization pulse */
1573 /* active High */
1574#define LCCR3_VrtSnchL (LCCR3_VSP*1) /* Vertical Synchronization pulse */
1575 /* active Low */
1576
1577#define LCSR_LDD (1 << 0) /* LCD Disable Done */
1578#define LCSR_SOF (1 << 1) /* Start of frame */
1579#define LCSR_BER (1 << 2) /* Bus error */
1580#define LCSR_ABC (1 << 3) /* AC Bias count */
1581#define LCSR_IUL (1 << 4) /* input FIFO underrun Lower panel */
1582#define LCSR_IUU (1 << 5) /* input FIFO underrun Upper panel */
1583#define LCSR_OU (1 << 6) /* output FIFO underrun */
1584#define LCSR_QD (1 << 7) /* quick disable */
1585#define LCSR_EOF (1 << 8) /* end of frame */
1586#define LCSR_BS (1 << 9) /* branch status */
1587#define LCSR_SINT (1 << 10) /* subsequent interrupt */
1588
1589#define LDCMD_PAL (1 << 26) /* instructs DMA to load palette buffer */
1590
1591#define LCSR_LDD (1 << 0) /* LCD Disable Done */
1592#define LCSR_SOF (1 << 1) /* Start of frame */
1593#define LCSR_BER (1 << 2) /* Bus error */
1594#define LCSR_ABC (1 << 3) /* AC Bias count */
1595#define LCSR_IUL (1 << 4) /* input FIFO underrun Lower panel */
1596#define LCSR_IUU (1 << 5) /* input FIFO underrun Upper panel */
1597#define LCSR_OU (1 << 6) /* output FIFO underrun */
1598#define LCSR_QD (1 << 7) /* quick disable */
1599#define LCSR_EOF (1 << 8) /* end of frame */
1600#define LCSR_BS (1 << 9) /* branch status */
1601#define LCSR_SINT (1 << 10) /* subsequent interrupt */
1602
1603#define LDCMD_PAL (1 << 26) /* instructs DMA to load palette buffer */
1604
1605#ifdef CONFIG_PXA27x 1409#ifdef CONFIG_PXA27x
1606 1410
1607/* Camera Interface */ 1411/* Camera Interface */
diff --git a/include/asm-arm/arch-pxa/pxafb.h b/include/asm-arm/arch-pxa/pxafb.h
index ea2336aa70e4..bbd22396841a 100644
--- a/include/asm-arm/arch-pxa/pxafb.h
+++ b/include/asm-arm/arch-pxa/pxafb.h
@@ -13,6 +13,50 @@
13 */ 13 */
14 14
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <asm/arch/regs-lcd.h>
17
18/*
19 * Supported LCD connections
20 *
21 * bits 0 - 3: for LCD panel type:
22 *
23 * STN - for passive matrix
24 * DSTN - for dual scan passive matrix
25 * TFT - for active matrix
26 *
27 * bits 4 - 9 : for bus width
28 * bits 10-17 : for AC Bias Pin Frequency
29 * bit 18 : for output enable polarity
30 * bit 19 : for pixel clock edge
31 */
32#define LCD_CONN_TYPE(_x) ((_x) & 0x0f)
33#define LCD_CONN_WIDTH(_x) (((_x) >> 4) & 0x1f)
34
35#define LCD_TYPE_UNKNOWN 0
36#define LCD_TYPE_MONO_STN 1
37#define LCD_TYPE_MONO_DSTN 2
38#define LCD_TYPE_COLOR_STN 3
39#define LCD_TYPE_COLOR_DSTN 4
40#define LCD_TYPE_COLOR_TFT 5
41#define LCD_TYPE_SMART_PANEL 6
42#define LCD_TYPE_MAX 7
43
44#define LCD_MONO_STN_4BPP ((4 << 4) | LCD_TYPE_MONO_STN)
45#define LCD_MONO_STN_8BPP ((8 << 4) | LCD_TYPE_MONO_STN)
46#define LCD_MONO_DSTN_8BPP ((8 << 4) | LCD_TYPE_MONO_DSTN)
47#define LCD_COLOR_STN_8BPP ((8 << 4) | LCD_TYPE_COLOR_STN)
48#define LCD_COLOR_DSTN_16BPP ((16 << 4) | LCD_TYPE_COLOR_DSTN)
49#define LCD_COLOR_TFT_16BPP ((16 << 4) | LCD_TYPE_COLOR_TFT)
50#define LCD_COLOR_TFT_18BPP ((18 << 4) | LCD_TYPE_COLOR_TFT)
51#define LCD_SMART_PANEL_8BPP ((8 << 4) | LCD_TYPE_SMART_PANEL)
52#define LCD_SMART_PANEL_16BPP ((16 << 4) | LCD_TYPE_SMART_PANEL)
53#define LCD_SMART_PANEL_18BPP ((18 << 4) | LCD_TYPE_SMART_PANEL)
54
55#define LCD_AC_BIAS_FREQ(x) (((x) & 0xff) << 10)
56#define LCD_BIAS_ACTIVE_HIGH (0 << 17)
57#define LCD_BIAS_ACTIVE_LOW (1 << 17)
58#define LCD_PCLK_EDGE_RISE (0 << 18)
59#define LCD_PCLK_EDGE_FALL (1 << 18)
16 60
17/* 61/*
18 * This structure describes the machine which we are running on. 62 * This structure describes the machine which we are running on.
@@ -26,6 +70,10 @@ struct pxafb_mode_info {
26 u_short yres; 70 u_short yres;
27 71
28 u_char bpp; 72 u_char bpp;
73 u_int cmap_greyscale:1,
74 unused:31;
75
76 /* Parallel Mode Timing */
29 u_char hsync_len; 77 u_char hsync_len;
30 u_char left_margin; 78 u_char left_margin;
31 u_char right_margin; 79 u_char right_margin;
@@ -35,14 +83,28 @@ struct pxafb_mode_info {
35 u_char lower_margin; 83 u_char lower_margin;
36 u_char sync; 84 u_char sync;
37 85
38 u_int cmap_greyscale:1, 86 /* Smart Panel Mode Timing - see PXA27x DM 7.4.15.0.3 for details
39 unused:31; 87 * Note:
88 * 1. all parameters in nanosecond (ns)
89 * 2. a0cs{rd,wr}_set_hld are controlled by the same register bits
90 * in pxa27x and pxa3xx, initialize them to the same value or
91 * the larger one will be used
92 * 3. same to {rd,wr}_pulse_width
93 */
94 unsigned a0csrd_set_hld; /* A0 and CS Setup/Hold Time before/after L_FCLK_RD */
95 unsigned a0cswr_set_hld; /* A0 and CS Setup/Hold Time before/after L_PCLK_WR */
96 unsigned wr_pulse_width; /* L_PCLK_WR pulse width */
97 unsigned rd_pulse_width; /* L_FCLK_RD pulse width */
98 unsigned cmd_inh_time; /* Command Inhibit time between two writes */
99 unsigned op_hold_time; /* Output Hold time from L_FCLK_RD negation */
40}; 100};
41 101
42struct pxafb_mach_info { 102struct pxafb_mach_info {
43 struct pxafb_mode_info *modes; 103 struct pxafb_mode_info *modes;
44 unsigned int num_modes; 104 unsigned int num_modes;
45 105
106 unsigned int lcd_conn;
107
46 u_int fixed_modes:1, 108 u_int fixed_modes:1,
47 cmap_inverse:1, 109 cmap_inverse:1,
48 cmap_static:1, 110 cmap_static:1,
@@ -78,8 +140,11 @@ struct pxafb_mach_info {
78 u_int lccr4; 140 u_int lccr4;
79 void (*pxafb_backlight_power)(int); 141 void (*pxafb_backlight_power)(int);
80 void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *); 142 void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *);
81 143 void (*smart_update)(struct fb_info *);
82}; 144};
83void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); 145void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info);
84void set_pxa_fb_parent(struct device *parent_dev); 146void set_pxa_fb_parent(struct device *parent_dev);
85unsigned long pxafb_get_hsync_time(struct device *dev); 147unsigned long pxafb_get_hsync_time(struct device *dev);
148
149extern int pxafb_smart_queue(struct fb_info *info, uint16_t *cmds, int);
150extern int pxafb_smart_flush(struct fb_info *info);
diff --git a/include/asm-arm/arch-pxa/regs-lcd.h b/include/asm-arm/arch-pxa/regs-lcd.h
new file mode 100644
index 000000000000..f762493f5141
--- /dev/null
+++ b/include/asm-arm/arch-pxa/regs-lcd.h
@@ -0,0 +1,171 @@
1#ifndef __ASM_ARCH_REGS_LCD_H
2#define __ASM_ARCH_REGS_LCD_H
3/*
4 * LCD Controller Registers and Bits Definitions
5 */
6#define LCCR0 (0x000) /* LCD Controller Control Register 0 */
7#define LCCR1 (0x004) /* LCD Controller Control Register 1 */
8#define LCCR2 (0x008) /* LCD Controller Control Register 2 */
9#define LCCR3 (0x00C) /* LCD Controller Control Register 3 */
10#define LCCR4 (0x010) /* LCD Controller Control Register 4 */
11#define LCCR5 (0x014) /* LCD Controller Control Register 5 */
12#define DFBR0 (0x020) /* DMA Channel 0 Frame Branch Register */
13#define DFBR1 (0x024) /* DMA Channel 1 Frame Branch Register */
14#define LCSR (0x038) /* LCD Controller Status Register */
15#define LIIDR (0x03C) /* LCD Controller Interrupt ID Register */
16#define TMEDRGBR (0x040) /* TMED RGB Seed Register */
17#define TMEDCR (0x044) /* TMED Control Register */
18
19#define CMDCR (0x100) /* Command Control Register */
20#define PRSR (0x104) /* Panel Read Status Register */
21
22#define LCCR3_1BPP (0 << 24)
23#define LCCR3_2BPP (1 << 24)
24#define LCCR3_4BPP (2 << 24)
25#define LCCR3_8BPP (3 << 24)
26#define LCCR3_16BPP (4 << 24)
27
28#define LCCR3_PDFOR_0 (0 << 30)
29#define LCCR3_PDFOR_1 (1 << 30)
30#define LCCR3_PDFOR_2 (2 << 30)
31#define LCCR3_PDFOR_3 (3 << 30)
32
33#define LCCR4_PAL_FOR_0 (0 << 15)
34#define LCCR4_PAL_FOR_1 (1 << 15)
35#define LCCR4_PAL_FOR_2 (2 << 15)
36#define LCCR4_PAL_FOR_MASK (3 << 15)
37
38#define FDADR0 (0x200) /* DMA Channel 0 Frame Descriptor Address Register */
39#define FSADR0 (0x204) /* DMA Channel 0 Frame Source Address Register */
40#define FIDR0 (0x208) /* DMA Channel 0 Frame ID Register */
41#define LDCMD0 (0x20C) /* DMA Channel 0 Command Register */
42#define FDADR1 (0x210) /* DMA Channel 1 Frame Descriptor Address Register */
43#define FSADR1 (0x214) /* DMA Channel 1 Frame Source Address Register */
44#define FIDR1 (0x218) /* DMA Channel 1 Frame ID Register */
45#define LDCMD1 (0x21C) /* DMA Channel 1 Command Register */
46#define FDADR6 (0x260) /* DMA Channel 6 Frame Descriptor Address Register */
47#define FSADR6 (0x264) /* DMA Channel 6 Frame Source Address Register */
48#define FIDR6 (0x268) /* DMA Channel 6 Frame ID Register */
49
50#define LCCR0_ENB (1 << 0) /* LCD Controller enable */
51#define LCCR0_CMS (1 << 1) /* Color/Monochrome Display Select */
52#define LCCR0_Color (LCCR0_CMS*0) /* Color display */
53#define LCCR0_Mono (LCCR0_CMS*1) /* Monochrome display */
54#define LCCR0_SDS (1 << 2) /* Single/Dual Panel Display Select */
55#define LCCR0_Sngl (LCCR0_SDS*0) /* Single panel display */
56#define LCCR0_Dual (LCCR0_SDS*1) /* Dual panel display */
57
58#define LCCR0_LDM (1 << 3) /* LCD Disable Done Mask */
59#define LCCR0_SFM (1 << 4) /* Start of frame mask */
60#define LCCR0_IUM (1 << 5) /* Input FIFO underrun mask */
61#define LCCR0_EFM (1 << 6) /* End of Frame mask */
62#define LCCR0_PAS (1 << 7) /* Passive/Active display Select */
63#define LCCR0_Pas (LCCR0_PAS*0) /* Passive display (STN) */
64#define LCCR0_Act (LCCR0_PAS*1) /* Active display (TFT) */
65#define LCCR0_DPD (1 << 9) /* Double Pixel Data (monochrome) */
66#define LCCR0_4PixMono (LCCR0_DPD*0) /* 4-Pixel/clock Monochrome display */
67#define LCCR0_8PixMono (LCCR0_DPD*1) /* 8-Pixel/clock Monochrome display */
68#define LCCR0_DIS (1 << 10) /* LCD Disable */
69#define LCCR0_QDM (1 << 11) /* LCD Quick Disable mask */
70#define LCCR0_PDD (0xff << 12) /* Palette DMA request delay */
71#define LCCR0_PDD_S 12
72#define LCCR0_BM (1 << 20) /* Branch mask */
73#define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */
74#define LCCR0_LCDT (1 << 22) /* LCD panel type */
75#define LCCR0_RDSTM (1 << 23) /* Read status interrupt mask */
76#define LCCR0_CMDIM (1 << 24) /* Command interrupt mask */
77#define LCCR0_OUC (1 << 25) /* Overlay Underlay control bit */
78#define LCCR0_LDDALT (1 << 26) /* LDD alternate mapping control */
79
80#define LCCR1_PPL Fld (10, 0) /* Pixels Per Line - 1 */
81#define LCCR1_DisWdth(Pixel) (((Pixel) - 1) << FShft (LCCR1_PPL))
82
83#define LCCR1_HSW Fld (6, 10) /* Horizontal Synchronization */
84#define LCCR1_HorSnchWdth(Tpix) (((Tpix) - 1) << FShft (LCCR1_HSW))
85
86#define LCCR1_ELW Fld (8, 16) /* End-of-Line pixel clock Wait - 1 */
87#define LCCR1_EndLnDel(Tpix) (((Tpix) - 1) << FShft (LCCR1_ELW))
88
89#define LCCR1_BLW Fld (8, 24) /* Beginning-of-Line pixel clock */
90#define LCCR1_BegLnDel(Tpix) (((Tpix) - 1) << FShft (LCCR1_BLW))
91
92#define LCCR2_LPP Fld (10, 0) /* Line Per Panel - 1 */
93#define LCCR2_DisHght(Line) (((Line) - 1) << FShft (LCCR2_LPP))
94
95#define LCCR2_VSW Fld (6, 10) /* Vertical Synchronization pulse - 1 */
96#define LCCR2_VrtSnchWdth(Tln) (((Tln) - 1) << FShft (LCCR2_VSW))
97
98#define LCCR2_EFW Fld (8, 16) /* End-of-Frame line clock Wait */
99#define LCCR2_EndFrmDel(Tln) ((Tln) << FShft (LCCR2_EFW))
100
101#define LCCR2_BFW Fld (8, 24) /* Beginning-of-Frame line clock */
102#define LCCR2_BegFrmDel(Tln) ((Tln) << FShft (LCCR2_BFW))
103
104#define LCCR3_API (0xf << 16) /* AC Bias pin trasitions per interrupt */
105#define LCCR3_API_S 16
106#define LCCR3_VSP (1 << 20) /* vertical sync polarity */
107#define LCCR3_HSP (1 << 21) /* horizontal sync polarity */
108#define LCCR3_PCP (1 << 22) /* Pixel Clock Polarity (L_PCLK) */
109#define LCCR3_PixRsEdg (LCCR3_PCP*0) /* Pixel clock Rising-Edge */
110#define LCCR3_PixFlEdg (LCCR3_PCP*1) /* Pixel clock Falling-Edge */
111
112#define LCCR3_OEP (1 << 23) /* Output Enable Polarity */
113#define LCCR3_OutEnH (LCCR3_OEP*0) /* Output Enable active High */
114#define LCCR3_OutEnL (LCCR3_OEP*1) /* Output Enable active Low */
115
116#define LCCR3_DPC (1 << 27) /* double pixel clock mode */
117#define LCCR3_PCD Fld (8, 0) /* Pixel Clock Divisor */
118#define LCCR3_PixClkDiv(Div) (((Div) << FShft (LCCR3_PCD)))
119
120#define LCCR3_BPP Fld (3, 24) /* Bit Per Pixel */
121#define LCCR3_Bpp(Bpp) (((Bpp) << FShft (LCCR3_BPP)))
122
123#define LCCR3_ACB Fld (8, 8) /* AC Bias */
124#define LCCR3_Acb(Acb) (((Acb) << FShft (LCCR3_ACB)))
125
126#define LCCR3_HorSnchH (LCCR3_HSP*0) /* HSP Active High */
127#define LCCR3_HorSnchL (LCCR3_HSP*1) /* HSP Active Low */
128
129#define LCCR3_VrtSnchH (LCCR3_VSP*0) /* VSP Active High */
130#define LCCR3_VrtSnchL (LCCR3_VSP*1) /* VSP Active Low */
131
132#define LCCR5_IUM(x) (1 << ((x) + 23)) /* input underrun mask */
133#define LCCR5_BSM(x) (1 << ((x) + 15)) /* branch mask */
134#define LCCR5_EOFM(x) (1 << ((x) + 7)) /* end of frame mask */
135#define LCCR5_SOFM(x) (1 << ((x) + 0)) /* start of frame mask */
136
137#define LCSR_LDD (1 << 0) /* LCD Disable Done */
138#define LCSR_SOF (1 << 1) /* Start of frame */
139#define LCSR_BER (1 << 2) /* Bus error */
140#define LCSR_ABC (1 << 3) /* AC Bias count */
141#define LCSR_IUL (1 << 4) /* input FIFO underrun Lower panel */
142#define LCSR_IUU (1 << 5) /* input FIFO underrun Upper panel */
143#define LCSR_OU (1 << 6) /* output FIFO underrun */
144#define LCSR_QD (1 << 7) /* quick disable */
145#define LCSR_EOF (1 << 8) /* end of frame */
146#define LCSR_BS (1 << 9) /* branch status */
147#define LCSR_SINT (1 << 10) /* subsequent interrupt */
148#define LCSR_RD_ST (1 << 11) /* read status */
149#define LCSR_CMD_INT (1 << 12) /* command interrupt */
150
151#define LDCMD_PAL (1 << 26) /* instructs DMA to load palette buffer */
152
153/* smartpanel related */
154#define PRSR_DATA(x) ((x) & 0xff) /* Panel Data */
155#define PRSR_A0 (1 << 8) /* Read Data Source */
156#define PRSR_ST_OK (1 << 9) /* Status OK */
157#define PRSR_CON_NT (1 << 10) /* Continue to Next Command */
158
159#define SMART_CMD_A0 (0x1 << 8)
160#define SMART_CMD_READ_STATUS_REG (0x0 << 9)
161#define SMART_CMD_READ_FRAME_BUFFER ((0x0 << 9) | SMART_CMD_A0)
162#define SMART_CMD_WRITE_COMMAND (0x1 << 9)
163#define SMART_CMD_WRITE_DATA ((0x1 << 9) | SMART_CMD_A0)
164#define SMART_CMD_WRITE_FRAME ((0x2 << 9) | SMART_CMD_A0)
165#define SMART_CMD_WAIT_FOR_VSYNC (0x3 << 9)
166#define SMART_CMD_NOOP (0x4 << 9)
167#define SMART_CMD_INTERRUPT (0x5 << 9)
168
169#define SMART_CMD(x) (SMART_CMD_WRITE_COMMAND | ((x) & 0xff))
170#define SMART_DAT(x) (SMART_CMD_WRITE_DATA | ((x) & 0xff))
171#endif /* __ASM_ARCH_REGS_LCD_H */
diff --git a/include/asm-arm/arch-pxa/system.h b/include/asm-arm/arch-pxa/system.h
index 1d56a3ef89fd..a758a719180f 100644
--- a/include/asm-arm/arch-pxa/system.h
+++ b/include/asm-arm/arch-pxa/system.h
@@ -22,6 +22,8 @@ static inline void arch_idle(void)
22 22
23static inline void arch_reset(char mode) 23static inline void arch_reset(char mode)
24{ 24{
25 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
26
25 if (mode == 's') { 27 if (mode == 's') {
26 /* Jump into ROM at address 0 */ 28 /* Jump into ROM at address 0 */
27 cpu_reset(0); 29 cpu_reset(0);
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index c86f68ee6511..5c22b0112106 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -71,6 +71,14 @@
71# endif 71# endif
72#endif 72#endif
73 73
74#ifdef CONFIG_CPU_COPY_FEROCEON
75# ifdef _USER
76# define MULTI_USER 1
77# else
78# define _USER feroceon
79# endif
80#endif
81
74#ifdef CONFIG_CPU_SA1100 82#ifdef CONFIG_CPU_SA1100
75# ifdef _USER 83# ifdef _USER
76# define MULTI_USER 1 84# define MULTI_USER 1
diff --git a/include/asm-arm/unaligned.h b/include/asm-arm/unaligned.h
index 5db03cf3b905..44593a894903 100644
--- a/include/asm-arm/unaligned.h
+++ b/include/asm-arm/unaligned.h
@@ -1,171 +1,9 @@
1#ifndef __ASM_ARM_UNALIGNED_H 1#ifndef _ASM_ARM_UNALIGNED_H
2#define __ASM_ARM_UNALIGNED_H 2#define _ASM_ARM_UNALIGNED_H
3 3
4#include <asm/types.h> 4#include <linux/unaligned/le_byteshift.h>
5 5#include <linux/unaligned/be_byteshift.h>
6extern int __bug_unaligned_x(const void *ptr); 6#include <linux/unaligned/generic.h>
7
8/*
9 * What is the most efficient way of loading/storing an unaligned value?
10 *
11 * That is the subject of this file. Efficiency here is defined as
12 * minimum code size with minimum register usage for the common cases.
13 * It is currently not believed that long longs are common, so we
14 * trade efficiency for the chars, shorts and longs against the long
15 * longs.
16 *
17 * Current stats with gcc 2.7.2.2 for these functions:
18 *
19 * ptrsize get: code regs put: code regs
20 * 1 1 1 1 2
21 * 2 3 2 3 2
22 * 4 7 3 7 3
23 * 8 20 6 16 6
24 *
25 * gcc 2.95.1 seems to code differently:
26 *
27 * ptrsize get: code regs put: code regs
28 * 1 1 1 1 2
29 * 2 3 2 3 2
30 * 4 7 4 7 4
31 * 8 19 8 15 6
32 *
33 * which may or may not be more efficient (depending upon whether
34 * you can afford the extra registers). Hopefully the gcc 2.95
35 * is inteligent enough to decide if it is better to use the
36 * extra register, but evidence so far seems to suggest otherwise.
37 *
38 * Unfortunately, gcc is not able to optimise the high word
39 * out of long long >> 32, or the low word from long long << 32
40 */
41
42#define __get_unaligned_2_le(__p) \
43 (unsigned int)(__p[0] | __p[1] << 8)
44
45#define __get_unaligned_2_be(__p) \
46 (unsigned int)(__p[0] << 8 | __p[1])
47
48#define __get_unaligned_4_le(__p) \
49 (unsigned int)(__p[0] | __p[1] << 8 | __p[2] << 16 | __p[3] << 24)
50
51#define __get_unaligned_4_be(__p) \
52 (unsigned int)(__p[0] << 24 | __p[1] << 16 | __p[2] << 8 | __p[3])
53
54#define __get_unaligned_8_le(__p) \
55 ((unsigned long long)__get_unaligned_4_le((__p+4)) << 32 | \
56 __get_unaligned_4_le(__p))
57
58#define __get_unaligned_8_be(__p) \
59 ((unsigned long long)__get_unaligned_4_be(__p) << 32 | \
60 __get_unaligned_4_be((__p+4)))
61
62#define __get_unaligned_le(ptr) \
63 ((__force typeof(*(ptr)))({ \
64 const __u8 *__p = (const __u8 *)(ptr); \
65 __builtin_choose_expr(sizeof(*(ptr)) == 1, *__p, \
66 __builtin_choose_expr(sizeof(*(ptr)) == 2, __get_unaligned_2_le(__p), \
67 __builtin_choose_expr(sizeof(*(ptr)) == 4, __get_unaligned_4_le(__p), \
68 __builtin_choose_expr(sizeof(*(ptr)) == 8, __get_unaligned_8_le(__p), \
69 (void)__bug_unaligned_x(__p))))); \
70 }))
71
72#define __get_unaligned_be(ptr) \
73 ((__force typeof(*(ptr)))({ \
74 const __u8 *__p = (const __u8 *)(ptr); \
75 __builtin_choose_expr(sizeof(*(ptr)) == 1, *__p, \
76 __builtin_choose_expr(sizeof(*(ptr)) == 2, __get_unaligned_2_be(__p), \
77 __builtin_choose_expr(sizeof(*(ptr)) == 4, __get_unaligned_4_be(__p), \
78 __builtin_choose_expr(sizeof(*(ptr)) == 8, __get_unaligned_8_be(__p), \
79 (void)__bug_unaligned_x(__p))))); \
80 }))
81
82
83static inline void __put_unaligned_2_le(__u32 __v, register __u8 *__p)
84{
85 *__p++ = __v;
86 *__p++ = __v >> 8;
87}
88
89static inline void __put_unaligned_2_be(__u32 __v, register __u8 *__p)
90{
91 *__p++ = __v >> 8;
92 *__p++ = __v;
93}
94
95static inline void __put_unaligned_4_le(__u32 __v, register __u8 *__p)
96{
97 __put_unaligned_2_le(__v >> 16, __p + 2);
98 __put_unaligned_2_le(__v, __p);
99}
100
101static inline void __put_unaligned_4_be(__u32 __v, register __u8 *__p)
102{
103 __put_unaligned_2_be(__v >> 16, __p);
104 __put_unaligned_2_be(__v, __p + 2);
105}
106
107static inline void __put_unaligned_8_le(const unsigned long long __v, register __u8 *__p)
108{
109 /*
110 * tradeoff: 8 bytes of stack for all unaligned puts (2
111 * instructions), or an extra register in the long long
112 * case - go for the extra register.
113 */
114 __put_unaligned_4_le(__v >> 32, __p+4);
115 __put_unaligned_4_le(__v, __p);
116}
117
118static inline void __put_unaligned_8_be(const unsigned long long __v, register __u8 *__p)
119{
120 /*
121 * tradeoff: 8 bytes of stack for all unaligned puts (2
122 * instructions), or an extra register in the long long
123 * case - go for the extra register.
124 */
125 __put_unaligned_4_be(__v >> 32, __p);
126 __put_unaligned_4_be(__v, __p+4);
127}
128
129/*
130 * Try to store an unaligned value as efficiently as possible.
131 */
132#define __put_unaligned_le(val,ptr) \
133 ({ \
134 (void)sizeof(*(ptr) = (val)); \
135 switch (sizeof(*(ptr))) { \
136 case 1: \
137 *(ptr) = (val); \
138 break; \
139 case 2: __put_unaligned_2_le((__force u16)(val),(__u8 *)(ptr)); \
140 break; \
141 case 4: __put_unaligned_4_le((__force u32)(val),(__u8 *)(ptr)); \
142 break; \
143 case 8: __put_unaligned_8_le((__force u64)(val),(__u8 *)(ptr)); \
144 break; \
145 default: __bug_unaligned_x(ptr); \
146 break; \
147 } \
148 (void) 0; \
149 })
150
151#define __put_unaligned_be(val,ptr) \
152 ({ \
153 (void)sizeof(*(ptr) = (val)); \
154 switch (sizeof(*(ptr))) { \
155 case 1: \
156 *(ptr) = (val); \
157 break; \
158 case 2: __put_unaligned_2_be((__force u16)(val),(__u8 *)(ptr)); \
159 break; \
160 case 4: __put_unaligned_4_be((__force u32)(val),(__u8 *)(ptr)); \
161 break; \
162 case 8: __put_unaligned_8_be((__force u64)(val),(__u8 *)(ptr)); \
163 break; \
164 default: __bug_unaligned_x(ptr); \
165 break; \
166 } \
167 (void) 0; \
168 })
169 7
170/* 8/*
171 * Select endianness 9 * Select endianness
@@ -178,4 +16,4 @@ static inline void __put_unaligned_8_be(const unsigned long long __v, register _
178#define put_unaligned __put_unaligned_be 16#define put_unaligned __put_unaligned_be
179#endif 17#endif
180 18
181#endif 19#endif /* _ASM_ARM_UNALIGNED_H */
diff --git a/include/asm-avr32/unaligned.h b/include/asm-avr32/unaligned.h
index 36f5fd430543..041877290470 100644
--- a/include/asm-avr32/unaligned.h
+++ b/include/asm-avr32/unaligned.h
@@ -1,5 +1,5 @@
1#ifndef __ASM_AVR32_UNALIGNED_H 1#ifndef _ASM_AVR32_UNALIGNED_H
2#define __ASM_AVR32_UNALIGNED_H 2#define _ASM_AVR32_UNALIGNED_H
3 3
4/* 4/*
5 * AVR32 can handle some unaligned accesses, depending on the 5 * AVR32 can handle some unaligned accesses, depending on the
@@ -11,6 +11,11 @@
11 * optimize word loads in general. 11 * optimize word loads in general.
12 */ 12 */
13 13
14#include <asm-generic/unaligned.h> 14#include <linux/unaligned/be_struct.h>
15#include <linux/unaligned/le_byteshift.h>
16#include <linux/unaligned/generic.h>
15 17
16#endif /* __ASM_AVR32_UNALIGNED_H */ 18#define get_unaligned __get_unaligned_be
19#define put_unaligned __put_unaligned_be
20
21#endif /* _ASM_AVR32_UNALIGNED_H */
diff --git a/include/asm-blackfin/unaligned.h b/include/asm-blackfin/unaligned.h
index 10081dc241ef..fd8a1d634945 100644
--- a/include/asm-blackfin/unaligned.h
+++ b/include/asm-blackfin/unaligned.h
@@ -1,6 +1,11 @@
1#ifndef __BFIN_UNALIGNED_H 1#ifndef _ASM_BLACKFIN_UNALIGNED_H
2#define __BFIN_UNALIGNED_H 2#define _ASM_BLACKFIN_UNALIGNED_H
3 3
4#include <asm-generic/unaligned.h> 4#include <linux/unaligned/le_struct.h>
5#include <linux/unaligned/be_byteshift.h>
6#include <linux/unaligned/generic.h>
5 7
6#endif /* __BFIN_UNALIGNED_H */ 8#define get_unaligned __get_unaligned_le
9#define put_unaligned __put_unaligned_le
10
11#endif /* _ASM_BLACKFIN_UNALIGNED_H */
diff --git a/include/asm-cris/unaligned.h b/include/asm-cris/unaligned.h
index 7fbbb399f6f1..7b3f3fec567c 100644
--- a/include/asm-cris/unaligned.h
+++ b/include/asm-cris/unaligned.h
@@ -1,16 +1,13 @@
1#ifndef __CRIS_UNALIGNED_H 1#ifndef _ASM_CRIS_UNALIGNED_H
2#define __CRIS_UNALIGNED_H 2#define _ASM_CRIS_UNALIGNED_H
3 3
4/* 4/*
5 * CRIS can do unaligned accesses itself. 5 * CRIS can do unaligned accesses itself.
6 *
7 * The strange macros are there to make sure these can't
8 * be misused in a way that makes them not work on other
9 * architectures where unaligned accesses aren't as simple.
10 */ 6 */
7#include <linux/unaligned/access_ok.h>
8#include <linux/unaligned/generic.h>
11 9
12#define get_unaligned(ptr) (*(ptr)) 10#define get_unaligned __get_unaligned_le
11#define put_unaligned __put_unaligned_le
13 12
14#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) 13#endif /* _ASM_CRIS_UNALIGNED_H */
15
16#endif
diff --git a/include/asm-frv/unaligned.h b/include/asm-frv/unaligned.h
index dc8e9c9bf6bd..64ccc736f2d8 100644
--- a/include/asm-frv/unaligned.h
+++ b/include/asm-frv/unaligned.h
@@ -9,194 +9,14 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _ASM_UNALIGNED_H 12#ifndef _ASM_FRV_UNALIGNED_H
13#define _ASM_UNALIGNED_H 13#define _ASM_FRV_UNALIGNED_H
14 14
15#include <linux/unaligned/le_byteshift.h>
16#include <linux/unaligned/be_byteshift.h>
17#include <linux/unaligned/generic.h>
15 18
16/* 19#define get_unaligned __get_unaligned_be
17 * Unaligned accesses on uClinux can't be performed in a fault handler - the 20#define put_unaligned __put_unaligned_be
18 * CPU detects them as imprecise exceptions making this impossible.
19 *
20 * With the FR451, however, they are precise, and so we used to fix them up in
21 * the memory access fault handler. However, instruction bundling make this
22 * impractical. So, now we fall back to using memcpy.
23 */
24#ifdef CONFIG_MMU
25
26/*
27 * The asm statement in the macros below is a way to get GCC to copy a
28 * value from one variable to another without having any clue it's
29 * actually doing so, so that it won't have any idea that the values
30 * in the two variables are related.
31 */
32
33#define get_unaligned(ptr) ({ \
34 typeof((*(ptr))) __x; \
35 void *__ptrcopy; \
36 asm("" : "=r" (__ptrcopy) : "0" (ptr)); \
37 memcpy(&__x, __ptrcopy, sizeof(*(ptr))); \
38 __x; \
39})
40
41#define put_unaligned(val, ptr) ({ \
42 typeof((*(ptr))) __x = (val); \
43 void *__ptrcopy; \
44 asm("" : "=r" (__ptrcopy) : "0" (ptr)); \
45 memcpy(__ptrcopy, &__x, sizeof(*(ptr))); \
46})
47
48extern int handle_misalignment(unsigned long esr0, unsigned long ear0, unsigned long epcr0);
49
50#else
51
52#define get_unaligned(ptr) \
53({ \
54 typeof(*(ptr)) x; \
55 const char *__p = (const char *) (ptr); \
56 \
57 switch (sizeof(x)) { \
58 case 1: \
59 x = *(ptr); \
60 break; \
61 case 2: \
62 { \
63 uint8_t a; \
64 asm(" ldub%I2 %M2,%0 \n" \
65 " ldub%I3.p %M3,%1 \n" \
66 " slli %0,#8,%0 \n" \
67 " or %0,%1,%0 \n" \
68 : "=&r"(x), "=&r"(a) \
69 : "m"(__p[0]), "m"(__p[1]) \
70 ); \
71 break; \
72 } \
73 \
74 case 4: \
75 { \
76 uint8_t a; \
77 asm(" ldub%I2 %M2,%0 \n" \
78 " ldub%I3.p %M3,%1 \n" \
79 " slli %0,#8,%0 \n" \
80 " or %0,%1,%0 \n" \
81 " ldub%I4.p %M4,%1 \n" \
82 " slli %0,#8,%0 \n" \
83 " or %0,%1,%0 \n" \
84 " ldub%I5.p %M5,%1 \n" \
85 " slli %0,#8,%0 \n" \
86 " or %0,%1,%0 \n" \
87 : "=&r"(x), "=&r"(a) \
88 : "m"(__p[0]), "m"(__p[1]), "m"(__p[2]), "m"(__p[3]) \
89 ); \
90 break; \
91 } \
92 \
93 case 8: \
94 { \
95 union { uint64_t x; u32 y[2]; } z; \
96 uint8_t a; \
97 asm(" ldub%I3 %M3,%0 \n" \
98 " ldub%I4.p %M4,%2 \n" \
99 " slli %0,#8,%0 \n" \
100 " or %0,%2,%0 \n" \
101 " ldub%I5.p %M5,%2 \n" \
102 " slli %0,#8,%0 \n" \
103 " or %0,%2,%0 \n" \
104 " ldub%I6.p %M6,%2 \n" \
105 " slli %0,#8,%0 \n" \
106 " or %0,%2,%0 \n" \
107 " ldub%I7 %M7,%1 \n" \
108 " ldub%I8.p %M8,%2 \n" \
109 " slli %1,#8,%1 \n" \
110 " or %1,%2,%1 \n" \
111 " ldub%I9.p %M9,%2 \n" \
112 " slli %1,#8,%1 \n" \
113 " or %1,%2,%1 \n" \
114 " ldub%I10.p %M10,%2 \n" \
115 " slli %1,#8,%1 \n" \
116 " or %1,%2,%1 \n" \
117 : "=&r"(z.y[0]), "=&r"(z.y[1]), "=&r"(a) \
118 : "m"(__p[0]), "m"(__p[1]), "m"(__p[2]), "m"(__p[3]), \
119 "m"(__p[4]), "m"(__p[5]), "m"(__p[6]), "m"(__p[7]) \
120 ); \
121 x = z.x; \
122 break; \
123 } \
124 \
125 default: \
126 x = 0; \
127 BUG(); \
128 break; \
129 } \
130 \
131 x; \
132})
133
134#define put_unaligned(val, ptr) \
135do { \
136 char *__p = (char *) (ptr); \
137 int x; \
138 \
139 switch (sizeof(*ptr)) { \
140 case 2: \
141 { \
142 asm(" stb%I1.p %0,%M1 \n" \
143 " srli %0,#8,%0 \n" \
144 " stb%I2 %0,%M2 \n" \
145 : "=r"(x), "=m"(__p[1]), "=m"(__p[0]) \
146 : "0"(val) \
147 ); \
148 break; \
149 } \
150 \
151 case 4: \
152 { \
153 asm(" stb%I1.p %0,%M1 \n" \
154 " srli %0,#8,%0 \n" \
155 " stb%I2.p %0,%M2 \n" \
156 " srli %0,#8,%0 \n" \
157 " stb%I3.p %0,%M3 \n" \
158 " srli %0,#8,%0 \n" \
159 " stb%I4 %0,%M4 \n" \
160 : "=r"(x), "=m"(__p[3]), "=m"(__p[2]), "=m"(__p[1]), "=m"(__p[0]) \
161 : "0"(val) \
162 ); \
163 break; \
164 } \
165 \
166 case 8: \
167 { \
168 uint32_t __high, __low; \
169 __high = (uint64_t)val >> 32; \
170 __low = val & 0xffffffff; \
171 asm(" stb%I2.p %0,%M2 \n" \
172 " srli %0,#8,%0 \n" \
173 " stb%I3.p %0,%M3 \n" \
174 " srli %0,#8,%0 \n" \
175 " stb%I4.p %0,%M4 \n" \
176 " srli %0,#8,%0 \n" \
177 " stb%I5.p %0,%M5 \n" \
178 " srli %0,#8,%0 \n" \
179 " stb%I6.p %1,%M6 \n" \
180 " srli %1,#8,%1 \n" \
181 " stb%I7.p %1,%M7 \n" \
182 " srli %1,#8,%1 \n" \
183 " stb%I8.p %1,%M8 \n" \
184 " srli %1,#8,%1 \n" \
185 " stb%I9 %1,%M9 \n" \
186 : "=&r"(__low), "=&r"(__high), "=m"(__p[7]), "=m"(__p[6]), \
187 "=m"(__p[5]), "=m"(__p[4]), "=m"(__p[3]), "=m"(__p[2]), \
188 "=m"(__p[1]), "=m"(__p[0]) \
189 : "0"(__low), "1"(__high) \
190 ); \
191 break; \
192 } \
193 \
194 default: \
195 *(ptr) = (val); \
196 break; \
197 } \
198} while(0)
199
200#endif
201 21
202#endif 22#endif /* _ASM_FRV_UNALIGNED_H */
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index 15e6f253dda4..c9f369c4bd7e 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
@@ -17,8 +17,6 @@
17#include <asm-generic/bitops/fls64.h> 17#include <asm-generic/bitops/fls64.h>
18#include <asm-generic/bitops/find.h> 18#include <asm-generic/bitops/find.h>
19 19
20#ifdef __KERNEL__
21
22#ifndef _LINUX_BITOPS_H 20#ifndef _LINUX_BITOPS_H
23#error only <linux/bitops.h> can be included directly 21#error only <linux/bitops.h> can be included directly
24#endif 22#endif
@@ -32,6 +30,4 @@
32#include <asm-generic/bitops/ext2-atomic.h> 30#include <asm-generic/bitops/ext2-atomic.h>
33#include <asm-generic/bitops/minix.h> 31#include <asm-generic/bitops/minix.h>
34 32
35#endif /* __KERNEL__ */
36
37#endif /* _ASM_GENERIC_BITOPS_H */ 33#endif /* _ASM_GENERIC_BITOPS_H */
diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h
index f422df0956a2..3c2344f48136 100644
--- a/include/asm-generic/futex.h
+++ b/include/asm-generic/futex.h
@@ -1,11 +1,9 @@
1#ifndef _ASM_GENERIC_FUTEX_H 1#ifndef _ASM_GENERIC_FUTEX_H
2#define _ASM_GENERIC_FUTEX_H 2#define _ASM_GENERIC_FUTEX_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/futex.h> 4#include <linux/futex.h>
5#include <linux/uaccess.h>
7#include <asm/errno.h> 6#include <asm/errno.h>
8#include <asm/uaccess.h>
9 7
10static inline int 8static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr) 9futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
@@ -56,4 +54,3 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
56} 54}
57 55
58#endif 56#endif
59#endif
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h
index cd027298beb1..864181385579 100644
--- a/include/asm-generic/ioctl.h
+++ b/include/asm-generic/ioctl.h
@@ -21,8 +21,19 @@
21 */ 21 */
22#define _IOC_NRBITS 8 22#define _IOC_NRBITS 8
23#define _IOC_TYPEBITS 8 23#define _IOC_TYPEBITS 8
24#define _IOC_SIZEBITS 14 24
25#define _IOC_DIRBITS 2 25/*
26 * Let any architecture override either of the following before
27 * including this file.
28 */
29
30#ifndef _IOC_SIZEBITS
31# define _IOC_SIZEBITS 14
32#endif
33
34#ifndef _IOC_DIRBITS
35# define _IOC_DIRBITS 2
36#endif
26 37
27#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) 38#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
28#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) 39#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
@@ -35,11 +46,21 @@
35#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) 46#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
36 47
37/* 48/*
38 * Direction bits. 49 * Direction bits, which any architecture can choose to override
50 * before including this file.
39 */ 51 */
40#define _IOC_NONE 0U 52
41#define _IOC_WRITE 1U 53#ifndef _IOC_NONE
42#define _IOC_READ 2U 54# define _IOC_NONE 0U
55#endif
56
57#ifndef _IOC_WRITE
58# define _IOC_WRITE 1U
59#endif
60
61#ifndef _IOC_READ
62# define _IOC_READ 2U
63#endif
43 64
44#define _IOC(dir,type,nr,size) \ 65#define _IOC(dir,type,nr,size) \
45 (((dir) << _IOC_DIRSHIFT) | \ 66 (((dir) << _IOC_DIRSHIFT) | \
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index 52226e14bd7d..ae060c62aff1 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -1,7 +1,6 @@
1#ifndef __ASM_MEMORY_MODEL_H 1#ifndef __ASM_MEMORY_MODEL_H
2#define __ASM_MEMORY_MODEL_H 2#define __ASM_MEMORY_MODEL_H
3 3
4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
6 5
7#if defined(CONFIG_FLATMEM) 6#if defined(CONFIG_FLATMEM)
@@ -81,6 +80,5 @@ extern unsigned long page_to_pfn(struct page *page);
81#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */ 80#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */
82 81
83#endif /* __ASSEMBLY__ */ 82#endif /* __ASSEMBLY__ */
84#endif /* __KERNEL__ */
85 83
86#endif 84#endif
diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h
index a96b5d986b6e..14db733b8e68 100644
--- a/include/asm-generic/page.h
+++ b/include/asm-generic/page.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_GENERIC_PAGE_H 1#ifndef _ASM_GENERIC_PAGE_H
2#define _ASM_GENERIC_PAGE_H 2#define _ASM_GENERIC_PAGE_H
3 3
4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
6 5
7#include <linux/compiler.h> 6#include <linux/compiler.h>
@@ -21,6 +20,5 @@ static __inline__ __attribute_const__ int get_order(unsigned long size)
21} 20}
22 21
23#endif /* __ASSEMBLY__ */ 22#endif /* __ASSEMBLY__ */
24#endif /* __KERNEL__ */
25 23
26#endif /* _ASM_GENERIC_PAGE_H */ 24#endif /* _ASM_GENERIC_PAGE_H */
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index dd1bed860e64..be4af0029ac0 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -12,8 +12,6 @@
12#ifndef __ASM_RTC_H__ 12#ifndef __ASM_RTC_H__
13#define __ASM_RTC_H__ 13#define __ASM_RTC_H__
14 14
15#ifdef __KERNEL__
16
17#include <linux/mc146818rtc.h> 15#include <linux/mc146818rtc.h>
18#include <linux/rtc.h> 16#include <linux/rtc.h>
19#include <linux/bcd.h> 17#include <linux/bcd.h>
@@ -213,5 +211,4 @@ static inline int set_rtc_pll(struct rtc_pll_info *pll)
213 return -EINVAL; 211 return -EINVAL;
214} 212}
215 213
216#endif /* __KERNEL__ */
217#endif /* __ASM_RTC_H__ */ 214#endif /* __ASM_RTC_H__ */
diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
deleted file mode 100644
index 2fe1b2e67f01..000000000000
--- a/include/asm-generic/unaligned.h
+++ /dev/null
@@ -1,124 +0,0 @@
1#ifndef _ASM_GENERIC_UNALIGNED_H_
2#define _ASM_GENERIC_UNALIGNED_H_
3
4/*
5 * For the benefit of those who are trying to port Linux to another
6 * architecture, here are some C-language equivalents.
7 *
8 * This is based almost entirely upon Richard Henderson's
9 * asm-alpha/unaligned.h implementation. Some comments were
10 * taken from David Mosberger's asm-ia64/unaligned.h header.
11 */
12
13#include <linux/types.h>
14
15/*
16 * The main single-value unaligned transfer routines.
17 */
18#define get_unaligned(ptr) \
19 __get_unaligned((ptr), sizeof(*(ptr)))
20#define put_unaligned(x,ptr) \
21 ((void)sizeof(*(ptr)=(x)),\
22 __put_unaligned((__force __u64)(x), (ptr), sizeof(*(ptr))))
23
24/*
25 * This function doesn't actually exist. The idea is that when
26 * someone uses the macros below with an unsupported size (datatype),
27 * the linker will alert us to the problem via an unresolved reference
28 * error.
29 */
30extern void bad_unaligned_access_length(void) __attribute__((noreturn));
31
32struct __una_u64 { __u64 x __attribute__((packed)); };
33struct __una_u32 { __u32 x __attribute__((packed)); };
34struct __una_u16 { __u16 x __attribute__((packed)); };
35
36/*
37 * Elemental unaligned loads
38 */
39
40static inline __u64 __uldq(const __u64 *addr)
41{
42 const struct __una_u64 *ptr = (const struct __una_u64 *) addr;
43 return ptr->x;
44}
45
46static inline __u32 __uldl(const __u32 *addr)
47{
48 const struct __una_u32 *ptr = (const struct __una_u32 *) addr;
49 return ptr->x;
50}
51
52static inline __u16 __uldw(const __u16 *addr)
53{
54 const struct __una_u16 *ptr = (const struct __una_u16 *) addr;
55 return ptr->x;
56}
57
58/*
59 * Elemental unaligned stores
60 */
61
62static inline void __ustq(__u64 val, __u64 *addr)
63{
64 struct __una_u64 *ptr = (struct __una_u64 *) addr;
65 ptr->x = val;
66}
67
68static inline void __ustl(__u32 val, __u32 *addr)
69{
70 struct __una_u32 *ptr = (struct __una_u32 *) addr;
71 ptr->x = val;
72}
73
74static inline void __ustw(__u16 val, __u16 *addr)
75{
76 struct __una_u16 *ptr = (struct __una_u16 *) addr;
77 ptr->x = val;
78}
79
80#define __get_unaligned(ptr, size) ({ \
81 const void *__gu_p = ptr; \
82 __u64 __val; \
83 switch (size) { \
84 case 1: \
85 __val = *(const __u8 *)__gu_p; \
86 break; \
87 case 2: \
88 __val = __uldw(__gu_p); \
89 break; \
90 case 4: \
91 __val = __uldl(__gu_p); \
92 break; \
93 case 8: \
94 __val = __uldq(__gu_p); \
95 break; \
96 default: \
97 bad_unaligned_access_length(); \
98 }; \
99 (__force __typeof__(*(ptr)))__val; \
100})
101
102#define __put_unaligned(val, ptr, size) \
103({ \
104 void *__gu_p = ptr; \
105 switch (size) { \
106 case 1: \
107 *(__u8 *)__gu_p = (__force __u8)val; \
108 break; \
109 case 2: \
110 __ustw((__force __u16)val, __gu_p); \
111 break; \
112 case 4: \
113 __ustl((__force __u32)val, __gu_p); \
114 break; \
115 case 8: \
116 __ustq(val, __gu_p); \
117 break; \
118 default: \
119 bad_unaligned_access_length(); \
120 }; \
121 (void)0; \
122})
123
124#endif /* _ASM_GENERIC_UNALIGNED_H */
diff --git a/include/asm-h8300/unaligned.h b/include/asm-h8300/unaligned.h
index ffb67f472070..b8d06c70c2da 100644
--- a/include/asm-h8300/unaligned.h
+++ b/include/asm-h8300/unaligned.h
@@ -1,15 +1,11 @@
1#ifndef __H8300_UNALIGNED_H 1#ifndef _ASM_H8300_UNALIGNED_H
2#define __H8300_UNALIGNED_H 2#define _ASM_H8300_UNALIGNED_H
3 3
4#include <linux/unaligned/be_memmove.h>
5#include <linux/unaligned/le_byteshift.h>
6#include <linux/unaligned/generic.h>
4 7
5/* Use memmove here, so gcc does not insert a __builtin_memcpy. */ 8#define get_unaligned __get_unaligned_be
9#define put_unaligned __put_unaligned_be
6 10
7#define get_unaligned(ptr) \ 11#endif /* _ASM_H8300_UNALIGNED_H */
8 ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
9
10#define put_unaligned(val, ptr) \
11 ({ __typeof__(*(ptr)) __tmp = (val); \
12 memmove((ptr), &__tmp, sizeof(*(ptr))); \
13 (void)0; })
14
15#endif
diff --git a/include/asm-ia64/dma-mapping.h b/include/asm-ia64/dma-mapping.h
index f1735a22d0ea..9f0df9bd46b7 100644
--- a/include/asm-ia64/dma-mapping.h
+++ b/include/asm-ia64/dma-mapping.h
@@ -23,10 +23,30 @@ dma_free_noncoherent(struct device *dev, size_t size, void *cpu_addr,
23{ 23{
24 dma_free_coherent(dev, size, cpu_addr, dma_handle); 24 dma_free_coherent(dev, size, cpu_addr, dma_handle);
25} 25}
26#define dma_map_single platform_dma_map_single 26#define dma_map_single_attrs platform_dma_map_single_attrs
27#define dma_map_sg platform_dma_map_sg 27static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
28#define dma_unmap_single platform_dma_unmap_single 28 size_t size, int dir)
29#define dma_unmap_sg platform_dma_unmap_sg 29{
30 return dma_map_single_attrs(dev, cpu_addr, size, dir, NULL);
31}
32#define dma_map_sg_attrs platform_dma_map_sg_attrs
33static inline int dma_map_sg(struct device *dev, struct scatterlist *sgl,
34 int nents, int dir)
35{
36 return dma_map_sg_attrs(dev, sgl, nents, dir, NULL);
37}
38#define dma_unmap_single_attrs platform_dma_unmap_single_attrs
39static inline void dma_unmap_single(struct device *dev, dma_addr_t cpu_addr,
40 size_t size, int dir)
41{
42 return dma_unmap_single_attrs(dev, cpu_addr, size, dir, NULL);
43}
44#define dma_unmap_sg_attrs platform_dma_unmap_sg_attrs
45static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
46 int nents, int dir)
47{
48 return dma_unmap_sg_attrs(dev, sgl, nents, dir, NULL);
49}
30#define dma_sync_single_for_cpu platform_dma_sync_single_for_cpu 50#define dma_sync_single_for_cpu platform_dma_sync_single_for_cpu
31#define dma_sync_sg_for_cpu platform_dma_sync_sg_for_cpu 51#define dma_sync_sg_for_cpu platform_dma_sync_sg_for_cpu
32#define dma_sync_single_for_device platform_dma_sync_single_for_device 52#define dma_sync_single_for_device platform_dma_sync_single_for_device
diff --git a/include/asm-ia64/futex.h b/include/asm-ia64/futex.h
index 8a98a2654139..c7f0f062239c 100644
--- a/include/asm-ia64/futex.h
+++ b/include/asm-ia64/futex.h
@@ -2,9 +2,9 @@
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#include <linux/futex.h> 4#include <linux/futex.h>
5#include <linux/uaccess.h>
5#include <asm/errno.h> 6#include <asm/errno.h>
6#include <asm/system.h> 7#include <asm/system.h>
7#include <asm/uaccess.h>
8 8
9#define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \ 9#define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \
10do { \ 10do { \
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index c201a2020aa4..9f020eb825c5 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -22,6 +22,7 @@ struct pci_bus;
22struct task_struct; 22struct task_struct;
23struct pci_dev; 23struct pci_dev;
24struct msi_desc; 24struct msi_desc;
25struct dma_attrs;
25 26
26typedef void ia64_mv_setup_t (char **); 27typedef void ia64_mv_setup_t (char **);
27typedef void ia64_mv_cpu_init_t (void); 28typedef void ia64_mv_cpu_init_t (void);
@@ -56,6 +57,11 @@ typedef void ia64_mv_dma_sync_sg_for_device (struct device *, struct scatterlist
56typedef int ia64_mv_dma_mapping_error (dma_addr_t dma_addr); 57typedef int ia64_mv_dma_mapping_error (dma_addr_t dma_addr);
57typedef int ia64_mv_dma_supported (struct device *, u64); 58typedef int ia64_mv_dma_supported (struct device *, u64);
58 59
60typedef dma_addr_t ia64_mv_dma_map_single_attrs (struct device *, void *, size_t, int, struct dma_attrs *);
61typedef void ia64_mv_dma_unmap_single_attrs (struct device *, dma_addr_t, size_t, int, struct dma_attrs *);
62typedef int ia64_mv_dma_map_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *);
63typedef void ia64_mv_dma_unmap_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *);
64
59/* 65/*
60 * WARNING: The legacy I/O space is _architected_. Platforms are 66 * WARNING: The legacy I/O space is _architected_. Platforms are
61 * expected to follow this architected model (see Section 10.7 in the 67 * expected to follow this architected model (see Section 10.7 in the
@@ -136,10 +142,10 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
136# define platform_dma_init ia64_mv.dma_init 142# define platform_dma_init ia64_mv.dma_init
137# define platform_dma_alloc_coherent ia64_mv.dma_alloc_coherent 143# define platform_dma_alloc_coherent ia64_mv.dma_alloc_coherent
138# define platform_dma_free_coherent ia64_mv.dma_free_coherent 144# define platform_dma_free_coherent ia64_mv.dma_free_coherent
139# define platform_dma_map_single ia64_mv.dma_map_single 145# define platform_dma_map_single_attrs ia64_mv.dma_map_single_attrs
140# define platform_dma_unmap_single ia64_mv.dma_unmap_single 146# define platform_dma_unmap_single_attrs ia64_mv.dma_unmap_single_attrs
141# define platform_dma_map_sg ia64_mv.dma_map_sg 147# define platform_dma_map_sg_attrs ia64_mv.dma_map_sg_attrs
142# define platform_dma_unmap_sg ia64_mv.dma_unmap_sg 148# define platform_dma_unmap_sg_attrs ia64_mv.dma_unmap_sg_attrs
143# define platform_dma_sync_single_for_cpu ia64_mv.dma_sync_single_for_cpu 149# define platform_dma_sync_single_for_cpu ia64_mv.dma_sync_single_for_cpu
144# define platform_dma_sync_sg_for_cpu ia64_mv.dma_sync_sg_for_cpu 150# define platform_dma_sync_sg_for_cpu ia64_mv.dma_sync_sg_for_cpu
145# define platform_dma_sync_single_for_device ia64_mv.dma_sync_single_for_device 151# define platform_dma_sync_single_for_device ia64_mv.dma_sync_single_for_device
@@ -190,10 +196,10 @@ struct ia64_machine_vector {
190 ia64_mv_dma_init *dma_init; 196 ia64_mv_dma_init *dma_init;
191 ia64_mv_dma_alloc_coherent *dma_alloc_coherent; 197 ia64_mv_dma_alloc_coherent *dma_alloc_coherent;
192 ia64_mv_dma_free_coherent *dma_free_coherent; 198 ia64_mv_dma_free_coherent *dma_free_coherent;
193 ia64_mv_dma_map_single *dma_map_single; 199 ia64_mv_dma_map_single_attrs *dma_map_single_attrs;
194 ia64_mv_dma_unmap_single *dma_unmap_single; 200 ia64_mv_dma_unmap_single_attrs *dma_unmap_single_attrs;
195 ia64_mv_dma_map_sg *dma_map_sg; 201 ia64_mv_dma_map_sg_attrs *dma_map_sg_attrs;
196 ia64_mv_dma_unmap_sg *dma_unmap_sg; 202 ia64_mv_dma_unmap_sg_attrs *dma_unmap_sg_attrs;
197 ia64_mv_dma_sync_single_for_cpu *dma_sync_single_for_cpu; 203 ia64_mv_dma_sync_single_for_cpu *dma_sync_single_for_cpu;
198 ia64_mv_dma_sync_sg_for_cpu *dma_sync_sg_for_cpu; 204 ia64_mv_dma_sync_sg_for_cpu *dma_sync_sg_for_cpu;
199 ia64_mv_dma_sync_single_for_device *dma_sync_single_for_device; 205 ia64_mv_dma_sync_single_for_device *dma_sync_single_for_device;
@@ -240,10 +246,10 @@ struct ia64_machine_vector {
240 platform_dma_init, \ 246 platform_dma_init, \
241 platform_dma_alloc_coherent, \ 247 platform_dma_alloc_coherent, \
242 platform_dma_free_coherent, \ 248 platform_dma_free_coherent, \
243 platform_dma_map_single, \ 249 platform_dma_map_single_attrs, \
244 platform_dma_unmap_single, \ 250 platform_dma_unmap_single_attrs, \
245 platform_dma_map_sg, \ 251 platform_dma_map_sg_attrs, \
246 platform_dma_unmap_sg, \ 252 platform_dma_unmap_sg_attrs, \
247 platform_dma_sync_single_for_cpu, \ 253 platform_dma_sync_single_for_cpu, \
248 platform_dma_sync_sg_for_cpu, \ 254 platform_dma_sync_sg_for_cpu, \
249 platform_dma_sync_single_for_device, \ 255 platform_dma_sync_single_for_device, \
@@ -292,9 +298,13 @@ extern ia64_mv_dma_init swiotlb_init;
292extern ia64_mv_dma_alloc_coherent swiotlb_alloc_coherent; 298extern ia64_mv_dma_alloc_coherent swiotlb_alloc_coherent;
293extern ia64_mv_dma_free_coherent swiotlb_free_coherent; 299extern ia64_mv_dma_free_coherent swiotlb_free_coherent;
294extern ia64_mv_dma_map_single swiotlb_map_single; 300extern ia64_mv_dma_map_single swiotlb_map_single;
301extern ia64_mv_dma_map_single_attrs swiotlb_map_single_attrs;
295extern ia64_mv_dma_unmap_single swiotlb_unmap_single; 302extern ia64_mv_dma_unmap_single swiotlb_unmap_single;
303extern ia64_mv_dma_unmap_single_attrs swiotlb_unmap_single_attrs;
296extern ia64_mv_dma_map_sg swiotlb_map_sg; 304extern ia64_mv_dma_map_sg swiotlb_map_sg;
305extern ia64_mv_dma_map_sg_attrs swiotlb_map_sg_attrs;
297extern ia64_mv_dma_unmap_sg swiotlb_unmap_sg; 306extern ia64_mv_dma_unmap_sg swiotlb_unmap_sg;
307extern ia64_mv_dma_unmap_sg_attrs swiotlb_unmap_sg_attrs;
298extern ia64_mv_dma_sync_single_for_cpu swiotlb_sync_single_for_cpu; 308extern ia64_mv_dma_sync_single_for_cpu swiotlb_sync_single_for_cpu;
299extern ia64_mv_dma_sync_sg_for_cpu swiotlb_sync_sg_for_cpu; 309extern ia64_mv_dma_sync_sg_for_cpu swiotlb_sync_sg_for_cpu;
300extern ia64_mv_dma_sync_single_for_device swiotlb_sync_single_for_device; 310extern ia64_mv_dma_sync_single_for_device swiotlb_sync_single_for_device;
@@ -340,17 +350,17 @@ extern ia64_mv_dma_supported swiotlb_dma_supported;
340#ifndef platform_dma_free_coherent 350#ifndef platform_dma_free_coherent
341# define platform_dma_free_coherent swiotlb_free_coherent 351# define platform_dma_free_coherent swiotlb_free_coherent
342#endif 352#endif
343#ifndef platform_dma_map_single 353#ifndef platform_dma_map_single_attrs
344# define platform_dma_map_single swiotlb_map_single 354# define platform_dma_map_single_attrs swiotlb_map_single_attrs
345#endif 355#endif
346#ifndef platform_dma_unmap_single 356#ifndef platform_dma_unmap_single_attrs
347# define platform_dma_unmap_single swiotlb_unmap_single 357# define platform_dma_unmap_single_attrs swiotlb_unmap_single_attrs
348#endif 358#endif
349#ifndef platform_dma_map_sg 359#ifndef platform_dma_map_sg_attrs
350# define platform_dma_map_sg swiotlb_map_sg 360# define platform_dma_map_sg_attrs swiotlb_map_sg_attrs
351#endif 361#endif
352#ifndef platform_dma_unmap_sg 362#ifndef platform_dma_unmap_sg_attrs
353# define platform_dma_unmap_sg swiotlb_unmap_sg 363# define platform_dma_unmap_sg_attrs swiotlb_unmap_sg_attrs
354#endif 364#endif
355#ifndef platform_dma_sync_single_for_cpu 365#ifndef platform_dma_sync_single_for_cpu
356# define platform_dma_sync_single_for_cpu swiotlb_sync_single_for_cpu 366# define platform_dma_sync_single_for_cpu swiotlb_sync_single_for_cpu
diff --git a/include/asm-ia64/machvec_hpzx1.h b/include/asm-ia64/machvec_hpzx1.h
index e90daf9ce340..2f57f5144b9f 100644
--- a/include/asm-ia64/machvec_hpzx1.h
+++ b/include/asm-ia64/machvec_hpzx1.h
@@ -4,10 +4,10 @@
4extern ia64_mv_setup_t dig_setup; 4extern ia64_mv_setup_t dig_setup;
5extern ia64_mv_dma_alloc_coherent sba_alloc_coherent; 5extern ia64_mv_dma_alloc_coherent sba_alloc_coherent;
6extern ia64_mv_dma_free_coherent sba_free_coherent; 6extern ia64_mv_dma_free_coherent sba_free_coherent;
7extern ia64_mv_dma_map_single sba_map_single; 7extern ia64_mv_dma_map_single_attrs sba_map_single_attrs;
8extern ia64_mv_dma_unmap_single sba_unmap_single; 8extern ia64_mv_dma_unmap_single_attrs sba_unmap_single_attrs;
9extern ia64_mv_dma_map_sg sba_map_sg; 9extern ia64_mv_dma_map_sg_attrs sba_map_sg_attrs;
10extern ia64_mv_dma_unmap_sg sba_unmap_sg; 10extern ia64_mv_dma_unmap_sg_attrs sba_unmap_sg_attrs;
11extern ia64_mv_dma_supported sba_dma_supported; 11extern ia64_mv_dma_supported sba_dma_supported;
12extern ia64_mv_dma_mapping_error sba_dma_mapping_error; 12extern ia64_mv_dma_mapping_error sba_dma_mapping_error;
13 13
@@ -23,10 +23,10 @@ extern ia64_mv_dma_mapping_error sba_dma_mapping_error;
23#define platform_dma_init machvec_noop 23#define platform_dma_init machvec_noop
24#define platform_dma_alloc_coherent sba_alloc_coherent 24#define platform_dma_alloc_coherent sba_alloc_coherent
25#define platform_dma_free_coherent sba_free_coherent 25#define platform_dma_free_coherent sba_free_coherent
26#define platform_dma_map_single sba_map_single 26#define platform_dma_map_single_attrs sba_map_single_attrs
27#define platform_dma_unmap_single sba_unmap_single 27#define platform_dma_unmap_single_attrs sba_unmap_single_attrs
28#define platform_dma_map_sg sba_map_sg 28#define platform_dma_map_sg_attrs sba_map_sg_attrs
29#define platform_dma_unmap_sg sba_unmap_sg 29#define platform_dma_unmap_sg_attrs sba_unmap_sg_attrs
30#define platform_dma_sync_single_for_cpu machvec_dma_sync_single 30#define platform_dma_sync_single_for_cpu machvec_dma_sync_single
31#define platform_dma_sync_sg_for_cpu machvec_dma_sync_sg 31#define platform_dma_sync_sg_for_cpu machvec_dma_sync_sg
32#define platform_dma_sync_single_for_device machvec_dma_sync_single 32#define platform_dma_sync_single_for_device machvec_dma_sync_single
diff --git a/include/asm-ia64/machvec_hpzx1_swiotlb.h b/include/asm-ia64/machvec_hpzx1_swiotlb.h
index f00a34a148ff..a842cdda827b 100644
--- a/include/asm-ia64/machvec_hpzx1_swiotlb.h
+++ b/include/asm-ia64/machvec_hpzx1_swiotlb.h
@@ -4,10 +4,10 @@
4extern ia64_mv_setup_t dig_setup; 4extern ia64_mv_setup_t dig_setup;
5extern ia64_mv_dma_alloc_coherent hwsw_alloc_coherent; 5extern ia64_mv_dma_alloc_coherent hwsw_alloc_coherent;
6extern ia64_mv_dma_free_coherent hwsw_free_coherent; 6extern ia64_mv_dma_free_coherent hwsw_free_coherent;
7extern ia64_mv_dma_map_single hwsw_map_single; 7extern ia64_mv_dma_map_single_attrs hwsw_map_single_attrs;
8extern ia64_mv_dma_unmap_single hwsw_unmap_single; 8extern ia64_mv_dma_unmap_single_attrs hwsw_unmap_single_attrs;
9extern ia64_mv_dma_map_sg hwsw_map_sg; 9extern ia64_mv_dma_map_sg_attrs hwsw_map_sg_attrs;
10extern ia64_mv_dma_unmap_sg hwsw_unmap_sg; 10extern ia64_mv_dma_unmap_sg_attrs hwsw_unmap_sg_attrs;
11extern ia64_mv_dma_supported hwsw_dma_supported; 11extern ia64_mv_dma_supported hwsw_dma_supported;
12extern ia64_mv_dma_mapping_error hwsw_dma_mapping_error; 12extern ia64_mv_dma_mapping_error hwsw_dma_mapping_error;
13extern ia64_mv_dma_sync_single_for_cpu hwsw_sync_single_for_cpu; 13extern ia64_mv_dma_sync_single_for_cpu hwsw_sync_single_for_cpu;
@@ -28,10 +28,10 @@ extern ia64_mv_dma_sync_sg_for_device hwsw_sync_sg_for_device;
28#define platform_dma_init machvec_noop 28#define platform_dma_init machvec_noop
29#define platform_dma_alloc_coherent hwsw_alloc_coherent 29#define platform_dma_alloc_coherent hwsw_alloc_coherent
30#define platform_dma_free_coherent hwsw_free_coherent 30#define platform_dma_free_coherent hwsw_free_coherent
31#define platform_dma_map_single hwsw_map_single 31#define platform_dma_map_single_attrs hwsw_map_single_attrs
32#define platform_dma_unmap_single hwsw_unmap_single 32#define platform_dma_unmap_single_attrs hwsw_unmap_single_attrs
33#define platform_dma_map_sg hwsw_map_sg 33#define platform_dma_map_sg_attrs hwsw_map_sg_attrs
34#define platform_dma_unmap_sg hwsw_unmap_sg 34#define platform_dma_unmap_sg_attrs hwsw_unmap_sg_attrs
35#define platform_dma_supported hwsw_dma_supported 35#define platform_dma_supported hwsw_dma_supported
36#define platform_dma_mapping_error hwsw_dma_mapping_error 36#define platform_dma_mapping_error hwsw_dma_mapping_error
37#define platform_dma_sync_single_for_cpu hwsw_sync_single_for_cpu 37#define platform_dma_sync_single_for_cpu hwsw_sync_single_for_cpu
diff --git a/include/asm-ia64/machvec_sn2.h b/include/asm-ia64/machvec_sn2.h
index 61439a7f5b08..781308ea7b88 100644
--- a/include/asm-ia64/machvec_sn2.h
+++ b/include/asm-ia64/machvec_sn2.h
@@ -57,10 +57,10 @@ extern ia64_mv_readl_t __sn_readl_relaxed;
57extern ia64_mv_readq_t __sn_readq_relaxed; 57extern ia64_mv_readq_t __sn_readq_relaxed;
58extern ia64_mv_dma_alloc_coherent sn_dma_alloc_coherent; 58extern ia64_mv_dma_alloc_coherent sn_dma_alloc_coherent;
59extern ia64_mv_dma_free_coherent sn_dma_free_coherent; 59extern ia64_mv_dma_free_coherent sn_dma_free_coherent;
60extern ia64_mv_dma_map_single sn_dma_map_single; 60extern ia64_mv_dma_map_single_attrs sn_dma_map_single_attrs;
61extern ia64_mv_dma_unmap_single sn_dma_unmap_single; 61extern ia64_mv_dma_unmap_single_attrs sn_dma_unmap_single_attrs;
62extern ia64_mv_dma_map_sg sn_dma_map_sg; 62extern ia64_mv_dma_map_sg_attrs sn_dma_map_sg_attrs;
63extern ia64_mv_dma_unmap_sg sn_dma_unmap_sg; 63extern ia64_mv_dma_unmap_sg_attrs sn_dma_unmap_sg_attrs;
64extern ia64_mv_dma_sync_single_for_cpu sn_dma_sync_single_for_cpu; 64extern ia64_mv_dma_sync_single_for_cpu sn_dma_sync_single_for_cpu;
65extern ia64_mv_dma_sync_sg_for_cpu sn_dma_sync_sg_for_cpu; 65extern ia64_mv_dma_sync_sg_for_cpu sn_dma_sync_sg_for_cpu;
66extern ia64_mv_dma_sync_single_for_device sn_dma_sync_single_for_device; 66extern ia64_mv_dma_sync_single_for_device sn_dma_sync_single_for_device;
@@ -113,10 +113,10 @@ extern ia64_mv_pci_fixup_bus_t sn_pci_fixup_bus;
113#define platform_dma_init machvec_noop 113#define platform_dma_init machvec_noop
114#define platform_dma_alloc_coherent sn_dma_alloc_coherent 114#define platform_dma_alloc_coherent sn_dma_alloc_coherent
115#define platform_dma_free_coherent sn_dma_free_coherent 115#define platform_dma_free_coherent sn_dma_free_coherent
116#define platform_dma_map_single sn_dma_map_single 116#define platform_dma_map_single_attrs sn_dma_map_single_attrs
117#define platform_dma_unmap_single sn_dma_unmap_single 117#define platform_dma_unmap_single_attrs sn_dma_unmap_single_attrs
118#define platform_dma_map_sg sn_dma_map_sg 118#define platform_dma_map_sg_attrs sn_dma_map_sg_attrs
119#define platform_dma_unmap_sg sn_dma_unmap_sg 119#define platform_dma_unmap_sg_attrs sn_dma_unmap_sg_attrs
120#define platform_dma_sync_single_for_cpu sn_dma_sync_single_for_cpu 120#define platform_dma_sync_single_for_cpu sn_dma_sync_single_for_cpu
121#define platform_dma_sync_sg_for_cpu sn_dma_sync_sg_for_cpu 121#define platform_dma_sync_sg_for_cpu sn_dma_sync_sg_for_cpu
122#define platform_dma_sync_single_for_device sn_dma_sync_single_for_device 122#define platform_dma_sync_single_for_device sn_dma_sync_single_for_device
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h
index 6da8069a0f77..f30e05583869 100644
--- a/include/asm-ia64/thread_info.h
+++ b/include/asm-ia64/thread_info.h
@@ -101,7 +101,6 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk);
101#define TIF_SYSCALL_TRACE 2 /* syscall trace active */ 101#define TIF_SYSCALL_TRACE 2 /* syscall trace active */
102#define TIF_SYSCALL_AUDIT 3 /* syscall auditing active */ 102#define TIF_SYSCALL_AUDIT 3 /* syscall auditing active */
103#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ 103#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
104#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
105#define TIF_NOTIFY_RESUME 6 /* resumption notification requested */ 104#define TIF_NOTIFY_RESUME 6 /* resumption notification requested */
106#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 105#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
107#define TIF_MEMDIE 17 106#define TIF_MEMDIE 17
@@ -109,6 +108,7 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk);
109#define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */ 108#define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */
110#define TIF_FREEZE 20 /* is freezing for suspend */ 109#define TIF_FREEZE 20 /* is freezing for suspend */
111#define TIF_RESTORE_RSE 21 /* user RBS is newer than kernel RBS */ 110#define TIF_RESTORE_RSE 21 /* user RBS is newer than kernel RBS */
111#define TIF_RESTORE_SIGMASK 22 /* restore signal mask in do_signal() */
112 112
113#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 113#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
114#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 114#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
@@ -126,8 +126,7 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk);
126 126
127/* "work to do on user-return" bits */ 127/* "work to do on user-return" bits */
128#define TIF_ALLWORK_MASK (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SYSCALL_AUDIT|\ 128#define TIF_ALLWORK_MASK (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SYSCALL_AUDIT|\
129 _TIF_NEED_RESCHED| _TIF_SYSCALL_TRACE|\ 129 _TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE)
130 _TIF_RESTORE_SIGMASK)
131/* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */ 130/* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */
132#define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)) 131#define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
133 132
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
index f2f72ef2a897..32863b3bb1d3 100644
--- a/include/asm-ia64/topology.h
+++ b/include/asm-ia64/topology.h
@@ -116,6 +116,8 @@ void build_cpu_to_node_map(void);
116#define smt_capable() (smp_num_siblings > 1) 116#define smt_capable() (smp_num_siblings > 1)
117#endif 117#endif
118 118
119extern void arch_fix_phys_package_id(int num, u32 slot);
120
119#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \ 121#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
120 CPU_MASK_ALL : \ 122 CPU_MASK_ALL : \
121 node_to_cpumask(pcibus_to_node(bus)) \ 123 node_to_cpumask(pcibus_to_node(bus)) \
diff --git a/include/asm-ia64/unaligned.h b/include/asm-ia64/unaligned.h
index bb8559888103..7bddc7f58584 100644
--- a/include/asm-ia64/unaligned.h
+++ b/include/asm-ia64/unaligned.h
@@ -1,6 +1,11 @@
1#ifndef _ASM_IA64_UNALIGNED_H 1#ifndef _ASM_IA64_UNALIGNED_H
2#define _ASM_IA64_UNALIGNED_H 2#define _ASM_IA64_UNALIGNED_H
3 3
4#include <asm-generic/unaligned.h> 4#include <linux/unaligned/le_struct.h>
5#include <linux/unaligned/be_byteshift.h>
6#include <linux/unaligned/generic.h>
7
8#define get_unaligned __get_unaligned_le
9#define put_unaligned __put_unaligned_le
5 10
6#endif /* _ASM_IA64_UNALIGNED_H */ 11#endif /* _ASM_IA64_UNALIGNED_H */
diff --git a/include/asm-ia64/uncached.h b/include/asm-ia64/uncached.h
index b82d923b73c1..13d7e65ca3cc 100644
--- a/include/asm-ia64/uncached.h
+++ b/include/asm-ia64/uncached.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2001-2005 Silicon Graphics, Inc. All rights reserved. 2 * Copyright (C) 2001-2008 Silicon Graphics, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License 5 * under the terms of version 2 of the GNU General Public License
@@ -8,5 +8,5 @@
8 * Prototypes for the uncached page allocator 8 * Prototypes for the uncached page allocator
9 */ 9 */
10 10
11extern unsigned long uncached_alloc_page(int nid); 11extern unsigned long uncached_alloc_page(int starting_nid, int n_pages);
12extern void uncached_free_page(unsigned long); 12extern void uncached_free_page(unsigned long uc_addr, int n_pages);
diff --git a/include/asm-m32r/unaligned.h b/include/asm-m32r/unaligned.h
index fccc180c3913..377eb20d1ec6 100644
--- a/include/asm-m32r/unaligned.h
+++ b/include/asm-m32r/unaligned.h
@@ -1,19 +1,18 @@
1#ifndef _ASM_M32R_UNALIGNED_H 1#ifndef _ASM_M32R_UNALIGNED_H
2#define _ASM_M32R_UNALIGNED_H 2#define _ASM_M32R_UNALIGNED_H
3 3
4/* 4#if defined(__LITTLE_ENDIAN__)
5 * For the benefit of those who are trying to port Linux to another 5# include <linux/unaligned/le_memmove.h>
6 * architecture, here are some C-language equivalents. 6# include <linux/unaligned/be_byteshift.h>
7 */ 7# include <linux/unaligned/generic.h>
8 8# define get_unaligned __get_unaligned_le
9#include <asm/string.h> 9# define put_unaligned __put_unaligned_le
10 10#else
11#define get_unaligned(ptr) \ 11# include <linux/unaligned/be_memmove.h>
12 ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) 12# include <linux/unaligned/le_byteshift.h>
13 13# include <linux/unaligned/generic.h>
14#define put_unaligned(val, ptr) \ 14# define get_unaligned __get_unaligned_be
15 ({ __typeof__(*(ptr)) __tmp = (val); \ 15# define put_unaligned __put_unaligned_be
16 memmove((ptr), &__tmp, sizeof(*(ptr))); \ 16#endif
17 (void)0; })
18 17
19#endif /* _ASM_M32R_UNALIGNED_H */ 18#endif /* _ASM_M32R_UNALIGNED_H */
diff --git a/include/asm-m68k/unaligned.h b/include/asm-m68k/unaligned.h
index 804cb3f888fe..77698f2dc33c 100644
--- a/include/asm-m68k/unaligned.h
+++ b/include/asm-m68k/unaligned.h
@@ -1,16 +1,13 @@
1#ifndef __M68K_UNALIGNED_H 1#ifndef _ASM_M68K_UNALIGNED_H
2#define __M68K_UNALIGNED_H 2#define _ASM_M68K_UNALIGNED_H
3 3
4/* 4/*
5 * The m68k can do unaligned accesses itself. 5 * The m68k can do unaligned accesses itself.
6 *
7 * The strange macros are there to make sure these can't
8 * be misused in a way that makes them not work on other
9 * architectures where unaligned accesses aren't as simple.
10 */ 6 */
7#include <linux/unaligned/access_ok.h>
8#include <linux/unaligned/generic.h>
11 9
12#define get_unaligned(ptr) (*(ptr)) 10#define get_unaligned __get_unaligned_be
11#define put_unaligned __put_unaligned_be
13 12
14#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) 13#endif /* _ASM_M68K_UNALIGNED_H */
15
16#endif
diff --git a/include/asm-m68knommu/unaligned.h b/include/asm-m68knommu/unaligned.h
index 869e9dd24f54..eb1ea4cb9a59 100644
--- a/include/asm-m68knommu/unaligned.h
+++ b/include/asm-m68knommu/unaligned.h
@@ -1,23 +1,25 @@
1#ifndef __M68K_UNALIGNED_H 1#ifndef _ASM_M68KNOMMU_UNALIGNED_H
2#define __M68K_UNALIGNED_H 2#define _ASM_M68KNOMMU_UNALIGNED_H
3 3
4 4
5#ifdef CONFIG_COLDFIRE 5#ifdef CONFIG_COLDFIRE
6#include <linux/unaligned/be_struct.h>
7#include <linux/unaligned/le_byteshift.h>
8#include <linux/unaligned/generic.h>
6 9
7#include <asm-generic/unaligned.h> 10#define get_unaligned __get_unaligned_be
11#define put_unaligned __put_unaligned_be
8 12
9#else 13#else
10/* 14/*
11 * The m68k can do unaligned accesses itself. 15 * The m68k can do unaligned accesses itself.
12 *
13 * The strange macros are there to make sure these can't
14 * be misused in a way that makes them not work on other
15 * architectures where unaligned accesses aren't as simple.
16 */ 16 */
17#include <linux/unaligned/access_ok.h>
18#include <linux/unaligned/generic.h>
17 19
18#define get_unaligned(ptr) (*(ptr)) 20#define get_unaligned __get_unaligned_be
19#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) 21#define put_unaligned __put_unaligned_be
20 22
21#endif 23#endif
22 24
23#endif 25#endif /* _ASM_M68KNOMMU_UNALIGNED_H */
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h
index 17f082cfea85..b9cce90346cf 100644
--- a/include/asm-mips/futex.h
+++ b/include/asm-mips/futex.h
@@ -11,9 +11,9 @@
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13#include <linux/futex.h> 13#include <linux/futex.h>
14#include <linux/uaccess.h>
14#include <asm/barrier.h> 15#include <asm/barrier.h>
15#include <asm/errno.h> 16#include <asm/errno.h>
16#include <asm/uaccess.h>
17#include <asm/war.h> 17#include <asm/war.h>
18 18
19#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ 19#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
diff --git a/include/asm-mips/unaligned.h b/include/asm-mips/unaligned.h
index 3249049e93aa..792404948571 100644
--- a/include/asm-mips/unaligned.h
+++ b/include/asm-mips/unaligned.h
@@ -5,25 +5,24 @@
5 * 5 *
6 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org) 6 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
7 */ 7 */
8#ifndef __ASM_GENERIC_UNALIGNED_H 8#ifndef _ASM_MIPS_UNALIGNED_H
9#define __ASM_GENERIC_UNALIGNED_H 9#define _ASM_MIPS_UNALIGNED_H
10 10
11#include <linux/compiler.h> 11#include <linux/compiler.h>
12#if defined(__MIPSEB__)
13# include <linux/unaligned/be_struct.h>
14# include <linux/unaligned/le_byteshift.h>
15# include <linux/unaligned/generic.h>
16# define get_unaligned __get_unaligned_be
17# define put_unaligned __put_unaligned_be
18#elif defined(__MIPSEL__)
19# include <linux/unaligned/le_struct.h>
20# include <linux/unaligned/be_byteshift.h>
21# include <linux/unaligned/generic.h>
22# define get_unaligned __get_unaligned_le
23# define put_unaligned __put_unaligned_le
24#else
25# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
26#endif
12 27
13#define get_unaligned(ptr) \ 28#endif /* _ASM_MIPS_UNALIGNED_H */
14({ \
15 struct __packed { \
16 typeof(*(ptr)) __v; \
17 } *__p = (void *) (ptr); \
18 __p->__v; \
19})
20
21#define put_unaligned(val, ptr) \
22do { \
23 struct __packed { \
24 typeof(*(ptr)) __v; \
25 } *__p = (void *) (ptr); \
26 __p->__v = (val); \
27} while(0)
28
29#endif /* __ASM_GENERIC_UNALIGNED_H */
diff --git a/include/asm-mn10300/unaligned.h b/include/asm-mn10300/unaligned.h
index cad3afbd035f..0df671318ae4 100644
--- a/include/asm-mn10300/unaligned.h
+++ b/include/asm-mn10300/unaligned.h
@@ -8,129 +8,13 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version. 9 * 2 of the Licence, or (at your option) any later version.
10 */ 10 */
11#ifndef _ASM_UNALIGNED_H 11#ifndef _ASM_MN10300_UNALIGNED_H
12#define _ASM_UNALIGNED_H 12#define _ASM_MN10300_UNALIGNED_H
13 13
14#include <asm/types.h> 14#include <linux/unaligned/access_ok.h>
15#include <linux/unaligned/generic.h>
15 16
16#if 0 17#define get_unaligned __get_unaligned_le
17extern int __bug_unaligned_x(void *ptr); 18#define put_unaligned __put_unaligned_le
18 19
19/* 20#endif /* _ASM_MN10300_UNALIGNED_H */
20 * What is the most efficient way of loading/storing an unaligned value?
21 *
22 * That is the subject of this file. Efficiency here is defined as
23 * minimum code size with minimum register usage for the common cases.
24 * It is currently not believed that long longs are common, so we
25 * trade efficiency for the chars, shorts and longs against the long
26 * longs.
27 *
28 * Current stats with gcc 2.7.2.2 for these functions:
29 *
30 * ptrsize get: code regs put: code regs
31 * 1 1 1 1 2
32 * 2 3 2 3 2
33 * 4 7 3 7 3
34 * 8 20 6 16 6
35 *
36 * gcc 2.95.1 seems to code differently:
37 *
38 * ptrsize get: code regs put: code regs
39 * 1 1 1 1 2
40 * 2 3 2 3 2
41 * 4 7 4 7 4
42 * 8 19 8 15 6
43 *
44 * which may or may not be more efficient (depending upon whether
45 * you can afford the extra registers). Hopefully the gcc 2.95
46 * is inteligent enough to decide if it is better to use the
47 * extra register, but evidence so far seems to suggest otherwise.
48 *
49 * Unfortunately, gcc is not able to optimise the high word
50 * out of long long >> 32, or the low word from long long << 32
51 */
52
53#define __get_unaligned_2(__p) \
54 (__p[0] | __p[1] << 8)
55
56#define __get_unaligned_4(__p) \
57 (__p[0] | __p[1] << 8 | __p[2] << 16 | __p[3] << 24)
58
59#define get_unaligned(ptr) \
60({ \
61 unsigned int __v1, __v2; \
62 __typeof__(*(ptr)) __v; \
63 __u8 *__p = (__u8 *)(ptr); \
64 \
65 switch (sizeof(*(ptr))) { \
66 case 1: __v = *(ptr); break; \
67 case 2: __v = __get_unaligned_2(__p); break; \
68 case 4: __v = __get_unaligned_4(__p); break; \
69 case 8: \
70 __v2 = __get_unaligned_4((__p+4)); \
71 __v1 = __get_unaligned_4(__p); \
72 __v = ((unsigned long long)__v2 << 32 | __v1); \
73 break; \
74 default: __v = __bug_unaligned_x(__p); break; \
75 } \
76 __v; \
77})
78
79
80static inline void __put_unaligned_2(__u32 __v, register __u8 *__p)
81{
82 *__p++ = __v;
83 *__p++ = __v >> 8;
84}
85
86static inline void __put_unaligned_4(__u32 __v, register __u8 *__p)
87{
88 __put_unaligned_2(__v >> 16, __p + 2);
89 __put_unaligned_2(__v, __p);
90}
91
92static inline void __put_unaligned_8(const unsigned long long __v, __u8 *__p)
93{
94 /*
95 * tradeoff: 8 bytes of stack for all unaligned puts (2
96 * instructions), or an extra register in the long long
97 * case - go for the extra register.
98 */
99 __put_unaligned_4(__v >> 32, __p + 4);
100 __put_unaligned_4(__v, __p);
101}
102
103/*
104 * Try to store an unaligned value as efficiently as possible.
105 */
106#define put_unaligned(val, ptr) \
107 ({ \
108 switch (sizeof(*(ptr))) { \
109 case 1: \
110 *(ptr) = (val); \
111 break; \
112 case 2: \
113 __put_unaligned_2((val), (__u8 *)(ptr)); \
114 break; \
115 case 4: \
116 __put_unaligned_4((val), (__u8 *)(ptr)); \
117 break; \
118 case 8: \
119 __put_unaligned_8((val), (__u8 *)(ptr)); \
120 break; \
121 default: \
122 __bug_unaligned_x(ptr); \
123 break; \
124 } \
125 (void) 0; \
126 })
127
128
129#else
130
131#define get_unaligned(ptr) (*(ptr))
132#define put_unaligned(val, ptr) ({ *(ptr) = (val); (void) 0; })
133
134#endif
135
136#endif
diff --git a/include/asm-parisc/futex.h b/include/asm-parisc/futex.h
index fdc6d055ef7f..0c705c3a55ef 100644
--- a/include/asm-parisc/futex.h
+++ b/include/asm-parisc/futex.h
@@ -4,8 +4,8 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/futex.h> 6#include <linux/futex.h>
7#include <linux/uaccess.h>
7#include <asm/errno.h> 8#include <asm/errno.h>
8#include <asm/uaccess.h>
9 9
10static inline int 10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr) 11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
diff --git a/include/asm-parisc/unaligned.h b/include/asm-parisc/unaligned.h
index 53c905838d93..dfc5d3321a54 100644
--- a/include/asm-parisc/unaligned.h
+++ b/include/asm-parisc/unaligned.h
@@ -1,7 +1,11 @@
1#ifndef _ASM_PARISC_UNALIGNED_H_ 1#ifndef _ASM_PARISC_UNALIGNED_H
2#define _ASM_PARISC_UNALIGNED_H_ 2#define _ASM_PARISC_UNALIGNED_H
3 3
4#include <asm-generic/unaligned.h> 4#include <linux/unaligned/be_struct.h>
5#include <linux/unaligned/le_byteshift.h>
6#include <linux/unaligned/generic.h>
7#define get_unaligned __get_unaligned_be
8#define put_unaligned __put_unaligned_be
5 9
6#ifdef __KERNEL__ 10#ifdef __KERNEL__
7struct pt_regs; 11struct pt_regs;
@@ -9,4 +13,4 @@ void handle_unaligned(struct pt_regs *regs);
9int check_unaligned(struct pt_regs *regs); 13int check_unaligned(struct pt_regs *regs);
10#endif 14#endif
11 15
12#endif /* _ASM_PARISC_UNALIGNED_H_ */ 16#endif /* _ASM_PARISC_UNALIGNED_H */
diff --git a/include/asm-powerpc/futex.h b/include/asm-powerpc/futex.h
index 3f3673fd3ff3..6d406c5c5de4 100644
--- a/include/asm-powerpc/futex.h
+++ b/include/asm-powerpc/futex.h
@@ -4,9 +4,9 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/futex.h> 6#include <linux/futex.h>
7#include <linux/uaccess.h>
7#include <asm/errno.h> 8#include <asm/errno.h>
8#include <asm/synch.h> 9#include <asm/synch.h>
9#include <asm/uaccess.h>
10#include <asm/asm-compat.h> 10#include <asm/asm-compat.h>
11 11
12#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ 12#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index b5c03127a9b9..5089deb8fec3 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -619,8 +619,6 @@ struct pt_regs;
619 619
620#define __ARCH_HAS_DO_SOFTIRQ 620#define __ARCH_HAS_DO_SOFTIRQ
621 621
622extern void __do_softirq(void);
623
624#ifdef CONFIG_IRQSTACKS 622#ifdef CONFIG_IRQSTACKS
625/* 623/*
626 * Per-cpu stacks for handling hard and soft interrupts. 624 * Per-cpu stacks for handling hard and soft interrupts.
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index fd98ca998b4f..cf83f2d7e2a5 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -138,6 +138,8 @@ typedef struct {
138 138
139struct thread_struct { 139struct thread_struct {
140 unsigned long ksp; /* Kernel stack pointer */ 140 unsigned long ksp; /* Kernel stack pointer */
141 unsigned long ksp_limit; /* if ksp <= ksp_limit stack overflow */
142
141#ifdef CONFIG_PPC64 143#ifdef CONFIG_PPC64
142 unsigned long ksp_vsid; 144 unsigned long ksp_vsid;
143#endif 145#endif
@@ -182,11 +184,14 @@ struct thread_struct {
182#define ARCH_MIN_TASKALIGN 16 184#define ARCH_MIN_TASKALIGN 16
183 185
184#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack) 186#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
187#define INIT_SP_LIMIT \
188 (_ALIGN_UP(sizeof(init_thread_info), 16) + (unsigned long) &init_stack)
185 189
186 190
187#ifdef CONFIG_PPC32 191#ifdef CONFIG_PPC32
188#define INIT_THREAD { \ 192#define INIT_THREAD { \
189 .ksp = INIT_SP, \ 193 .ksp = INIT_SP, \
194 .ksp_limit = INIT_SP_LIMIT, \
190 .fs = KERNEL_DS, \ 195 .fs = KERNEL_DS, \
191 .pgdir = swapper_pg_dir, \ 196 .pgdir = swapper_pg_dir, \
192 .fpexc_mode = MSR_FE0 | MSR_FE1, \ 197 .fpexc_mode = MSR_FE0 | MSR_FE1, \
@@ -194,6 +199,7 @@ struct thread_struct {
194#else 199#else
195#define INIT_THREAD { \ 200#define INIT_THREAD { \
196 .ksp = INIT_SP, \ 201 .ksp = INIT_SP, \
202 .ksp_limit = INIT_SP_LIMIT, \
197 .regs = (struct pt_regs *)INIT_SP - 1, /* XXX bogus, I think */ \ 203 .regs = (struct pt_regs *)INIT_SP - 1, /* XXX bogus, I think */ \
198 .fs = KERNEL_DS, \ 204 .fs = KERNEL_DS, \
199 .fpr = {0}, \ 205 .fpr = {0}, \
diff --git a/include/asm-ppc/rio.h b/include/asm-powerpc/rio.h
index 0018bf80cb25..0018bf80cb25 100644
--- a/include/asm-ppc/rio.h
+++ b/include/asm-powerpc/rio.h
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index fab1674b31b6..2b6559a6d113 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -204,7 +204,7 @@ extern int powersave_nap; /* set if nap mode can be used in idle loop */
204 * Changes the memory location '*ptr' to be val and returns 204 * Changes the memory location '*ptr' to be val and returns
205 * the previous value stored there. 205 * the previous value stored there.
206 */ 206 */
207static __inline__ unsigned long 207static __always_inline unsigned long
208__xchg_u32(volatile void *p, unsigned long val) 208__xchg_u32(volatile void *p, unsigned long val)
209{ 209{
210 unsigned long prev; 210 unsigned long prev;
@@ -229,7 +229,7 @@ __xchg_u32(volatile void *p, unsigned long val)
229 * Changes the memory location '*ptr' to be val and returns 229 * Changes the memory location '*ptr' to be val and returns
230 * the previous value stored there. 230 * the previous value stored there.
231 */ 231 */
232static __inline__ unsigned long 232static __always_inline unsigned long
233__xchg_u32_local(volatile void *p, unsigned long val) 233__xchg_u32_local(volatile void *p, unsigned long val)
234{ 234{
235 unsigned long prev; 235 unsigned long prev;
@@ -247,7 +247,7 @@ __xchg_u32_local(volatile void *p, unsigned long val)
247} 247}
248 248
249#ifdef CONFIG_PPC64 249#ifdef CONFIG_PPC64
250static __inline__ unsigned long 250static __always_inline unsigned long
251__xchg_u64(volatile void *p, unsigned long val) 251__xchg_u64(volatile void *p, unsigned long val)
252{ 252{
253 unsigned long prev; 253 unsigned long prev;
@@ -266,7 +266,7 @@ __xchg_u64(volatile void *p, unsigned long val)
266 return prev; 266 return prev;
267} 267}
268 268
269static __inline__ unsigned long 269static __always_inline unsigned long
270__xchg_u64_local(volatile void *p, unsigned long val) 270__xchg_u64_local(volatile void *p, unsigned long val)
271{ 271{
272 unsigned long prev; 272 unsigned long prev;
@@ -290,7 +290,7 @@ __xchg_u64_local(volatile void *p, unsigned long val)
290 */ 290 */
291extern void __xchg_called_with_bad_pointer(void); 291extern void __xchg_called_with_bad_pointer(void);
292 292
293static __inline__ unsigned long 293static __always_inline unsigned long
294__xchg(volatile void *ptr, unsigned long x, unsigned int size) 294__xchg(volatile void *ptr, unsigned long x, unsigned int size)
295{ 295{
296 switch (size) { 296 switch (size) {
@@ -305,7 +305,7 @@ __xchg(volatile void *ptr, unsigned long x, unsigned int size)
305 return x; 305 return x;
306} 306}
307 307
308static __inline__ unsigned long 308static __always_inline unsigned long
309__xchg_local(volatile void *ptr, unsigned long x, unsigned int size) 309__xchg_local(volatile void *ptr, unsigned long x, unsigned int size)
310{ 310{
311 switch (size) { 311 switch (size) {
@@ -338,7 +338,7 @@ __xchg_local(volatile void *ptr, unsigned long x, unsigned int size)
338 */ 338 */
339#define __HAVE_ARCH_CMPXCHG 1 339#define __HAVE_ARCH_CMPXCHG 1
340 340
341static __inline__ unsigned long 341static __always_inline unsigned long
342__cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new) 342__cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
343{ 343{
344 unsigned int prev; 344 unsigned int prev;
@@ -361,7 +361,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
361 return prev; 361 return prev;
362} 362}
363 363
364static __inline__ unsigned long 364static __always_inline unsigned long
365__cmpxchg_u32_local(volatile unsigned int *p, unsigned long old, 365__cmpxchg_u32_local(volatile unsigned int *p, unsigned long old,
366 unsigned long new) 366 unsigned long new)
367{ 367{
@@ -384,7 +384,7 @@ __cmpxchg_u32_local(volatile unsigned int *p, unsigned long old,
384} 384}
385 385
386#ifdef CONFIG_PPC64 386#ifdef CONFIG_PPC64
387static __inline__ unsigned long 387static __always_inline unsigned long
388__cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new) 388__cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new)
389{ 389{
390 unsigned long prev; 390 unsigned long prev;
@@ -406,7 +406,7 @@ __cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new)
406 return prev; 406 return prev;
407} 407}
408 408
409static __inline__ unsigned long 409static __always_inline unsigned long
410__cmpxchg_u64_local(volatile unsigned long *p, unsigned long old, 410__cmpxchg_u64_local(volatile unsigned long *p, unsigned long old,
411 unsigned long new) 411 unsigned long new)
412{ 412{
@@ -432,7 +432,7 @@ __cmpxchg_u64_local(volatile unsigned long *p, unsigned long old,
432 if something tries to do an invalid cmpxchg(). */ 432 if something tries to do an invalid cmpxchg(). */
433extern void __cmpxchg_called_with_bad_pointer(void); 433extern void __cmpxchg_called_with_bad_pointer(void);
434 434
435static __inline__ unsigned long 435static __always_inline unsigned long
436__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, 436__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new,
437 unsigned int size) 437 unsigned int size)
438{ 438{
@@ -448,7 +448,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new,
448 return old; 448 return old;
449} 449}
450 450
451static __inline__ unsigned long 451static __always_inline unsigned long
452__cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new, 452__cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new,
453 unsigned int size) 453 unsigned int size)
454{ 454{
diff --git a/include/asm-powerpc/unaligned.h b/include/asm-powerpc/unaligned.h
index 6c95dfa2652f..5f1b1e3c2137 100644
--- a/include/asm-powerpc/unaligned.h
+++ b/include/asm-powerpc/unaligned.h
@@ -5,15 +5,12 @@
5 5
6/* 6/*
7 * The PowerPC can do unaligned accesses itself in big endian mode. 7 * The PowerPC can do unaligned accesses itself in big endian mode.
8 *
9 * The strange macros are there to make sure these can't
10 * be misused in a way that makes them not work on other
11 * architectures where unaligned accesses aren't as simple.
12 */ 8 */
9#include <linux/unaligned/access_ok.h>
10#include <linux/unaligned/generic.h>
13 11
14#define get_unaligned(ptr) (*(ptr)) 12#define get_unaligned __get_unaligned_be
15 13#define put_unaligned __put_unaligned_be
16#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
17 14
18#endif /* __KERNEL__ */ 15#endif /* __KERNEL__ */
19#endif /* _ASM_POWERPC_UNALIGNED_H */ 16#endif /* _ASM_POWERPC_UNALIGNED_H */
diff --git a/include/asm-s390/ccwgroup.h b/include/asm-s390/ccwgroup.h
index 289053ef5e60..a27f68985a79 100644
--- a/include/asm-s390/ccwgroup.h
+++ b/include/asm-s390/ccwgroup.h
@@ -57,10 +57,9 @@ struct ccwgroup_driver {
57 57
58extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver); 58extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver);
59extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver); 59extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver);
60extern int ccwgroup_create (struct device *root, 60int ccwgroup_create_from_string(struct device *root, unsigned int creator_id,
61 unsigned int creator_id, 61 struct ccw_driver *cdrv, int num_devices,
62 struct ccw_driver *gdrv, 62 const char *buf);
63 int argc, char *argv[]);
64 63
65extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev); 64extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev);
66extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev); 65extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev);
diff --git a/include/asm-s390/hugetlb.h b/include/asm-s390/hugetlb.h
new file mode 100644
index 000000000000..600a776f8f75
--- /dev/null
+++ b/include/asm-s390/hugetlb.h
@@ -0,0 +1,183 @@
1/*
2 * IBM System z Huge TLB Page Support for Kernel.
3 *
4 * Copyright IBM Corp. 2008
5 * Author(s): Gerald Schaefer <gerald.schaefer@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_HUGETLB_H
9#define _ASM_S390_HUGETLB_H
10
11#include <asm/page.h>
12#include <asm/pgtable.h>
13
14
15#define is_hugepage_only_range(mm, addr, len) 0
16#define hugetlb_free_pgd_range free_pgd_range
17
18void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
19 pte_t *ptep, pte_t pte);
20
21/*
22 * If the arch doesn't supply something else, assume that hugepage
23 * size aligned regions are ok without further preparation.
24 */
25static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
26{
27 if (len & ~HPAGE_MASK)
28 return -EINVAL;
29 if (addr & ~HPAGE_MASK)
30 return -EINVAL;
31 return 0;
32}
33
34#define hugetlb_prefault_arch_hook(mm) do { } while (0)
35
36int arch_prepare_hugepage(struct page *page);
37void arch_release_hugepage(struct page *page);
38
39static inline pte_t pte_mkhuge(pte_t pte)
40{
41 /*
42 * PROT_NONE needs to be remapped from the pte type to the ste type.
43 * The HW invalid bit is also different for pte and ste. The pte
44 * invalid bit happens to be the same as the ste _SEGMENT_ENTRY_LARGE
45 * bit, so we don't have to clear it.
46 */
47 if (pte_val(pte) & _PAGE_INVALID) {
48 if (pte_val(pte) & _PAGE_SWT)
49 pte_val(pte) |= _HPAGE_TYPE_NONE;
50 pte_val(pte) |= _SEGMENT_ENTRY_INV;
51 }
52 /*
53 * Clear SW pte bits SWT and SWX, there are no SW bits in a segment
54 * table entry.
55 */
56 pte_val(pte) &= ~(_PAGE_SWT | _PAGE_SWX);
57 /*
58 * Also set the change-override bit because we don't need dirty bit
59 * tracking for hugetlbfs pages.
60 */
61 pte_val(pte) |= (_SEGMENT_ENTRY_LARGE | _SEGMENT_ENTRY_CO);
62 return pte;
63}
64
65static inline pte_t huge_pte_wrprotect(pte_t pte)
66{
67 pte_val(pte) |= _PAGE_RO;
68 return pte;
69}
70
71static inline int huge_pte_none(pte_t pte)
72{
73 return (pte_val(pte) & _SEGMENT_ENTRY_INV) &&
74 !(pte_val(pte) & _SEGMENT_ENTRY_RO);
75}
76
77static inline pte_t huge_ptep_get(pte_t *ptep)
78{
79 pte_t pte = *ptep;
80 unsigned long mask;
81
82 if (!MACHINE_HAS_HPAGE) {
83 ptep = (pte_t *) (pte_val(pte) & _SEGMENT_ENTRY_ORIGIN);
84 if (ptep) {
85 mask = pte_val(pte) &
86 (_SEGMENT_ENTRY_INV | _SEGMENT_ENTRY_RO);
87 pte = pte_mkhuge(*ptep);
88 pte_val(pte) |= mask;
89 }
90 }
91 return pte;
92}
93
94static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
95 unsigned long addr, pte_t *ptep)
96{
97 pte_t pte = huge_ptep_get(ptep);
98
99 pmd_clear((pmd_t *) ptep);
100 return pte;
101}
102
103static inline void __pmd_csp(pmd_t *pmdp)
104{
105 register unsigned long reg2 asm("2") = pmd_val(*pmdp);
106 register unsigned long reg3 asm("3") = pmd_val(*pmdp) |
107 _SEGMENT_ENTRY_INV;
108 register unsigned long reg4 asm("4") = ((unsigned long) pmdp) + 5;
109
110 asm volatile(
111 " csp %1,%3"
112 : "=m" (*pmdp)
113 : "d" (reg2), "d" (reg3), "d" (reg4), "m" (*pmdp) : "cc");
114 pmd_val(*pmdp) = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY;
115}
116
117static inline void __pmd_idte(unsigned long address, pmd_t *pmdp)
118{
119 unsigned long sto = (unsigned long) pmdp -
120 pmd_index(address) * sizeof(pmd_t);
121
122 if (!(pmd_val(*pmdp) & _SEGMENT_ENTRY_INV)) {
123 asm volatile(
124 " .insn rrf,0xb98e0000,%2,%3,0,0"
125 : "=m" (*pmdp)
126 : "m" (*pmdp), "a" (sto),
127 "a" ((address & HPAGE_MASK))
128 );
129 }
130 pmd_val(*pmdp) = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY;
131}
132
133static inline void huge_ptep_invalidate(struct mm_struct *mm,
134 unsigned long address, pte_t *ptep)
135{
136 pmd_t *pmdp = (pmd_t *) ptep;
137
138 if (!MACHINE_HAS_IDTE) {
139 __pmd_csp(pmdp);
140 if (mm->context.noexec) {
141 pmdp = get_shadow_table(pmdp);
142 __pmd_csp(pmdp);
143 }
144 return;
145 }
146
147 __pmd_idte(address, pmdp);
148 if (mm->context.noexec) {
149 pmdp = get_shadow_table(pmdp);
150 __pmd_idte(address, pmdp);
151 }
152 return;
153}
154
155#define huge_ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty) \
156({ \
157 int __changed = !pte_same(huge_ptep_get(__ptep), __entry); \
158 if (__changed) { \
159 huge_ptep_invalidate((__vma)->vm_mm, __addr, __ptep); \
160 set_huge_pte_at((__vma)->vm_mm, __addr, __ptep, __entry); \
161 } \
162 __changed; \
163})
164
165#define huge_ptep_set_wrprotect(__mm, __addr, __ptep) \
166({ \
167 pte_t __pte = huge_ptep_get(__ptep); \
168 if (pte_write(__pte)) { \
169 if (atomic_read(&(__mm)->mm_users) > 1 || \
170 (__mm) != current->active_mm) \
171 huge_ptep_invalidate(__mm, __addr, __ptep); \
172 set_huge_pte_at(__mm, __addr, __ptep, \
173 huge_pte_wrprotect(__pte)); \
174 } \
175})
176
177static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
178 unsigned long address, pte_t *ptep)
179{
180 huge_ptep_invalidate(vma->vm_mm, address, ptep);
181}
182
183#endif /* _ASM_S390_HUGETLB_H */
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
index fe7f92b6ae6d..f0f4579eac13 100644
--- a/include/asm-s390/page.h
+++ b/include/asm-s390/page.h
@@ -19,17 +19,34 @@
19#define PAGE_DEFAULT_ACC 0 19#define PAGE_DEFAULT_ACC 0
20#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4) 20#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4)
21 21
22#define HPAGE_SHIFT 20
23#define HPAGE_SIZE (1UL << HPAGE_SHIFT)
24#define HPAGE_MASK (~(HPAGE_SIZE - 1))
25#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
26
27#define ARCH_HAS_SETCLEAR_HUGE_PTE
28#define ARCH_HAS_HUGE_PTE_TYPE
29#define ARCH_HAS_PREPARE_HUGEPAGE
30#define ARCH_HAS_HUGEPAGE_CLEAR_FLUSH
31
22#include <asm/setup.h> 32#include <asm/setup.h>
23#ifndef __ASSEMBLY__ 33#ifndef __ASSEMBLY__
24 34
25static inline void clear_page(void *page) 35static inline void clear_page(void *page)
26{ 36{
27 register unsigned long reg1 asm ("1") = 0; 37 if (MACHINE_HAS_PFMF) {
28 register void *reg2 asm ("2") = page; 38 asm volatile(
29 register unsigned long reg3 asm ("3") = 4096; 39 " .insn rre,0xb9af0000,%0,%1"
30 asm volatile( 40 : : "d" (0x10000), "a" (page) : "memory", "cc");
31 " mvcl 2,0" 41 } else {
32 : "+d" (reg2), "+d" (reg3) : "d" (reg1) : "memory", "cc"); 42 register unsigned long reg1 asm ("1") = 0;
43 register void *reg2 asm ("2") = page;
44 register unsigned long reg3 asm ("3") = 4096;
45 asm volatile(
46 " mvcl 2,0"
47 : "+d" (reg2), "+d" (reg3) : "d" (reg1)
48 : "memory", "cc");
49 }
33} 50}
34 51
35static inline void copy_page(void *to, void *from) 52static inline void copy_page(void *to, void *from)
@@ -108,26 +125,6 @@ page_get_storage_key(unsigned long addr)
108 return skey; 125 return skey;
109} 126}
110 127
111extern unsigned long max_pfn;
112
113static inline int pfn_valid(unsigned long pfn)
114{
115 unsigned long dummy;
116 int ccode;
117
118 if (pfn >= max_pfn)
119 return 0;
120
121 asm volatile(
122 " lra %0,0(%2)\n"
123 " ipm %1\n"
124 " srl %1,28\n"
125 : "=d" (dummy), "=d" (ccode)
126 : "a" (pfn << PAGE_SHIFT)
127 : "cc");
128 return !ccode;
129}
130
131#endif /* !__ASSEMBLY__ */ 128#endif /* !__ASSEMBLY__ */
132 129
133/* to align the pointer to the (next) page boundary */ 130/* to align the pointer to the (next) page boundary */
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index f8347ce9c5a1..c7f4f8e3e297 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -129,7 +129,7 @@ extern char empty_zero_page[PAGE_SIZE];
129#define VMEM_MAX_PAGES ((VMEM_MAP_END - VMALLOC_END) / sizeof(struct page)) 129#define VMEM_MAX_PAGES ((VMEM_MAP_END - VMALLOC_END) / sizeof(struct page))
130#define VMEM_MAX_PFN min(VMALLOC_START >> PAGE_SHIFT, VMEM_MAX_PAGES) 130#define VMEM_MAX_PFN min(VMALLOC_START >> PAGE_SHIFT, VMEM_MAX_PAGES)
131#define VMEM_MAX_PHYS ((VMEM_MAX_PFN << PAGE_SHIFT) & ~((16 << 20) - 1)) 131#define VMEM_MAX_PHYS ((VMEM_MAX_PFN << PAGE_SHIFT) & ~((16 << 20) - 1))
132#define VMEM_MAP ((struct page *) VMALLOC_END) 132#define vmemmap ((struct page *) VMALLOC_END)
133 133
134/* 134/*
135 * A 31 bit pagetable entry of S390 has following format: 135 * A 31 bit pagetable entry of S390 has following format:
@@ -234,6 +234,15 @@ extern char empty_zero_page[PAGE_SIZE];
234#define _PAGE_TYPE_EX_RW 0x002 234#define _PAGE_TYPE_EX_RW 0x002
235 235
236/* 236/*
237 * Only four types for huge pages, using the invalid bit and protection bit
238 * of a segment table entry.
239 */
240#define _HPAGE_TYPE_EMPTY 0x020 /* _SEGMENT_ENTRY_INV */
241#define _HPAGE_TYPE_NONE 0x220
242#define _HPAGE_TYPE_RO 0x200 /* _SEGMENT_ENTRY_RO */
243#define _HPAGE_TYPE_RW 0x000
244
245/*
237 * PTE type bits are rather complicated. handle_pte_fault uses pte_present, 246 * PTE type bits are rather complicated. handle_pte_fault uses pte_present,
238 * pte_none and pte_file to find out the pte type WITHOUT holding the page 247 * pte_none and pte_file to find out the pte type WITHOUT holding the page
239 * table lock. ptep_clear_flush on the other hand uses ptep_clear_flush to 248 * table lock. ptep_clear_flush on the other hand uses ptep_clear_flush to
@@ -325,6 +334,9 @@ extern char empty_zero_page[PAGE_SIZE];
325#define _SEGMENT_ENTRY (0) 334#define _SEGMENT_ENTRY (0)
326#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INV) 335#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INV)
327 336
337#define _SEGMENT_ENTRY_LARGE 0x400 /* STE-format control, large page */
338#define _SEGMENT_ENTRY_CO 0x100 /* change-recording override */
339
328#endif /* __s390x__ */ 340#endif /* __s390x__ */
329 341
330/* 342/*
@@ -1063,8 +1075,8 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
1063 1075
1064#define kern_addr_valid(addr) (1) 1076#define kern_addr_valid(addr) (1)
1065 1077
1066extern int add_shared_memory(unsigned long start, unsigned long size); 1078extern int vmem_add_mapping(unsigned long start, unsigned long size);
1067extern int remove_shared_memory(unsigned long start, unsigned long size); 1079extern int vmem_remove_mapping(unsigned long start, unsigned long size);
1068extern int s390_enable_sie(void); 1080extern int s390_enable_sie(void);
1069 1081
1070/* 1082/*
@@ -1072,9 +1084,6 @@ extern int s390_enable_sie(void);
1072 */ 1084 */
1073#define pgtable_cache_init() do { } while (0) 1085#define pgtable_cache_init() do { } while (0)
1074 1086
1075#define __HAVE_ARCH_MEMMAP_INIT
1076extern void memmap_init(unsigned long, int, unsigned long, unsigned long);
1077
1078#include <asm-generic/pgtable.h> 1087#include <asm-generic/pgtable.h>
1079 1088
1080#endif /* _S390_PAGE_H */ 1089#endif /* _S390_PAGE_H */
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index 8eaf343a12a8..a00f79dd323b 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -172,16 +172,7 @@ extern unsigned long thread_saved_pc(struct task_struct *t);
172 */ 172 */
173extern void task_show_regs(struct seq_file *m, struct task_struct *task); 173extern void task_show_regs(struct seq_file *m, struct task_struct *task);
174 174
175extern void show_registers(struct pt_regs *regs);
176extern void show_code(struct pt_regs *regs); 175extern void show_code(struct pt_regs *regs);
177extern void show_trace(struct task_struct *task, unsigned long *sp);
178#ifdef CONFIG_64BIT
179extern void show_last_breaking_event(struct pt_regs *regs);
180#else
181static inline void show_last_breaking_event(struct pt_regs *regs)
182{
183}
184#endif
185 176
186unsigned long get_wchan(struct task_struct *p); 177unsigned long get_wchan(struct task_struct *p);
187#define task_pt_regs(tsk) ((struct pt_regs *) \ 178#define task_pt_regs(tsk) ((struct pt_regs *) \
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h
index 61f6952f2e35..441d7c260857 100644
--- a/include/asm-s390/ptrace.h
+++ b/include/asm-s390/ptrace.h
@@ -463,8 +463,6 @@ struct user_regs_struct
463}; 463};
464 464
465#ifdef __KERNEL__ 465#ifdef __KERNEL__
466#define __ARCH_SYS_PTRACE 1
467
468/* 466/*
469 * These are defined as per linux/ptrace.h, which see. 467 * These are defined as per linux/ptrace.h, which see.
470 */ 468 */
diff --git a/include/asm-s390/qdio.h b/include/asm-s390/qdio.h
index 4b8ff55f680e..11240342a0f4 100644
--- a/include/asm-s390/qdio.h
+++ b/include/asm-s390/qdio.h
@@ -127,6 +127,7 @@ extern int do_QDIO(struct ccw_device*, unsigned int flags,
127 unsigned int qidx,unsigned int count, 127 unsigned int qidx,unsigned int count,
128 struct qdio_buffer *buffers); 128 struct qdio_buffer *buffers);
129 129
130extern int qdio_get_ssqd_pct(struct ccw_device*);
130extern int qdio_synchronize(struct ccw_device*, unsigned int flags, 131extern int qdio_synchronize(struct ccw_device*, unsigned int flags,
131 unsigned int queue_number); 132 unsigned int queue_number);
132 133
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h
index aaf4b518b940..ba69674012a7 100644
--- a/include/asm-s390/setup.h
+++ b/include/asm-s390/setup.h
@@ -59,23 +59,42 @@ extern unsigned int s390_noexec;
59 */ 59 */
60extern unsigned long machine_flags; 60extern unsigned long machine_flags;
61 61
62#define MACHINE_IS_VM (machine_flags & 1) 62#define MACHINE_FLAG_VM (1UL << 0)
63#define MACHINE_IS_P390 (machine_flags & 4) 63#define MACHINE_FLAG_IEEE (1UL << 1)
64#define MACHINE_HAS_MVPG (machine_flags & 16) 64#define MACHINE_FLAG_P390 (1UL << 2)
65#define MACHINE_IS_KVM (machine_flags & 64) 65#define MACHINE_FLAG_CSP (1UL << 3)
66#define MACHINE_HAS_IDTE (machine_flags & 128) 66#define MACHINE_FLAG_MVPG (1UL << 4)
67#define MACHINE_HAS_DIAG9C (machine_flags & 256) 67#define MACHINE_FLAG_DIAG44 (1UL << 5)
68#define MACHINE_FLAG_IDTE (1UL << 6)
69#define MACHINE_FLAG_DIAG9C (1UL << 7)
70#define MACHINE_FLAG_MVCOS (1UL << 8)
71#define MACHINE_FLAG_KVM (1UL << 9)
72#define MACHINE_FLAG_HPAGE (1UL << 10)
73#define MACHINE_FLAG_PFMF (1UL << 11)
74
75#define MACHINE_IS_VM (machine_flags & MACHINE_FLAG_VM)
76#define MACHINE_IS_KVM (machine_flags & MACHINE_FLAG_KVM)
77#define MACHINE_IS_P390 (machine_flags & MACHINE_FLAG_P390)
78#define MACHINE_HAS_DIAG9C (machine_flags & MACHINE_FLAG_DIAG9C)
68 79
69#ifndef __s390x__ 80#ifndef __s390x__
70#define MACHINE_HAS_IEEE (machine_flags & 2) 81#define MACHINE_HAS_IEEE (machine_flags & MACHINE_FLAG_IEEE)
71#define MACHINE_HAS_CSP (machine_flags & 8) 82#define MACHINE_HAS_CSP (machine_flags & MACHINE_FLAG_CSP)
83#define MACHINE_HAS_IDTE (0)
72#define MACHINE_HAS_DIAG44 (1) 84#define MACHINE_HAS_DIAG44 (1)
85#define MACHINE_HAS_MVPG (machine_flags & MACHINE_FLAG_MVPG)
73#define MACHINE_HAS_MVCOS (0) 86#define MACHINE_HAS_MVCOS (0)
87#define MACHINE_HAS_HPAGE (0)
88#define MACHINE_HAS_PFMF (0)
74#else /* __s390x__ */ 89#else /* __s390x__ */
75#define MACHINE_HAS_IEEE (1) 90#define MACHINE_HAS_IEEE (1)
76#define MACHINE_HAS_CSP (1) 91#define MACHINE_HAS_CSP (1)
77#define MACHINE_HAS_DIAG44 (machine_flags & 32) 92#define MACHINE_HAS_IDTE (machine_flags & MACHINE_FLAG_IDTE)
78#define MACHINE_HAS_MVCOS (machine_flags & 512) 93#define MACHINE_HAS_DIAG44 (machine_flags & MACHINE_FLAG_DIAG44)
94#define MACHINE_HAS_MVPG (1)
95#define MACHINE_HAS_MVCOS (machine_flags & MACHINE_FLAG_MVCOS)
96#define MACHINE_HAS_HPAGE (machine_flags & MACHINE_FLAG_HPAGE)
97#define MACHINE_HAS_PFMF (machine_flags & MACHINE_FLAG_PFMF)
79#endif /* __s390x__ */ 98#endif /* __s390x__ */
80 99
81#define MACHINE_HAS_SCLP (!MACHINE_IS_P390) 100#define MACHINE_HAS_SCLP (!MACHINE_IS_P390)
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h
index 6f3821a6a902..ae89cf2478fc 100644
--- a/include/asm-s390/smp.h
+++ b/include/asm-s390/smp.h
@@ -19,6 +19,7 @@
19#include <asm/lowcore.h> 19#include <asm/lowcore.h>
20#include <asm/sigp.h> 20#include <asm/sigp.h>
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/system.h>
22 23
23/* 24/*
24 s390 specific smp.c headers 25 s390 specific smp.c headers
@@ -53,10 +54,7 @@ extern void machine_power_off_smp(void);
53 54
54static inline __u16 hard_smp_processor_id(void) 55static inline __u16 hard_smp_processor_id(void)
55{ 56{
56 __u16 cpu_address; 57 return stap();
57
58 asm volatile("stap %0" : "=m" (cpu_address));
59 return cpu_address;
60} 58}
61 59
62/* 60/*
@@ -108,5 +106,11 @@ static inline void smp_send_stop(void)
108#define smp_cpu_not_running(cpu) 1 106#define smp_cpu_not_running(cpu) 1
109#endif 107#endif
110 108
109#ifdef CONFIG_HOTPLUG_CPU
110extern int smp_rescan_cpus(void);
111#else
112static inline int smp_rescan_cpus(void) { return 0; }
113#endif
114
111extern union save_area *zfcpdump_save_areas[NR_CPUS + 1]; 115extern union save_area *zfcpdump_save_areas[NR_CPUS + 1];
112#endif 116#endif
diff --git a/include/asm-s390/sparsemem.h b/include/asm-s390/sparsemem.h
new file mode 100644
index 000000000000..06dfdab6c0e8
--- /dev/null
+++ b/include/asm-s390/sparsemem.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_S390_SPARSEMEM_H
2#define _ASM_S390_SPARSEMEM_H
3
4#define SECTION_SIZE_BITS 25
5
6#ifdef CONFIG_64BIT
7
8#define MAX_PHYSADDR_BITS 42
9#define MAX_PHYSMEM_BITS 42
10
11#else
12
13#define MAX_PHYSADDR_BITS 31
14#define MAX_PHYSMEM_BITS 31
15
16#endif /* CONFIG_64BIT */
17
18#endif /* _ASM_S390_SPARSEMEM_H */
diff --git a/include/asm-s390/sysinfo.h b/include/asm-s390/sysinfo.h
index abe10ae15e46..79d01343f8b0 100644
--- a/include/asm-s390/sysinfo.h
+++ b/include/asm-s390/sysinfo.h
@@ -11,6 +11,9 @@
11 * Christian Borntraeger <borntraeger@de.ibm.com> 11 * Christian Borntraeger <borntraeger@de.ibm.com>
12 */ 12 */
13 13
14#ifndef __ASM_S390_SYSINFO_H
15#define __ASM_S390_SYSINFO_H
16
14struct sysinfo_1_1_1 { 17struct sysinfo_1_1_1 {
15 char reserved_0[32]; 18 char reserved_0[32];
16 char manufacturer[16]; 19 char manufacturer[16];
@@ -114,3 +117,5 @@ static inline int stsi(void *sysinfo, int fc, int sel1, int sel2)
114 : "cc", "memory"); 117 : "cc", "memory");
115 return r0; 118 return r0;
116} 119}
120
121#endif /* __ASM_S390_SYSINFO_H */
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index 92098df4d6e3..c819ae25a842 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -16,6 +16,7 @@
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/setup.h> 17#include <asm/setup.h>
18#include <asm/processor.h> 18#include <asm/processor.h>
19#include <asm/lowcore.h>
19 20
20#ifdef __KERNEL__ 21#ifdef __KERNEL__
21 22
@@ -422,6 +423,23 @@ extern void smp_ctl_clear_bit(int cr, int bit);
422 423
423#endif /* CONFIG_SMP */ 424#endif /* CONFIG_SMP */
424 425
426static inline unsigned int stfl(void)
427{
428 asm volatile(
429 " .insn s,0xb2b10000,0(0)\n" /* stfl */
430 "0:\n"
431 EX_TABLE(0b,0b));
432 return S390_lowcore.stfl_fac_list;
433}
434
435static inline unsigned short stap(void)
436{
437 unsigned short cpu_address;
438
439 asm volatile("stap %0" : "=m" (cpu_address));
440 return cpu_address;
441}
442
425extern void (*_machine_restart)(char *command); 443extern void (*_machine_restart)(char *command);
426extern void (*_machine_halt)(void); 444extern void (*_machine_halt)(void);
427extern void (*_machine_power_off)(void); 445extern void (*_machine_power_off)(void);
diff --git a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h
index 0a518915bf90..99bbed99a3b2 100644
--- a/include/asm-s390/thread_info.h
+++ b/include/asm-s390/thread_info.h
@@ -89,7 +89,6 @@ static inline struct thread_info *current_thread_info(void)
89 * thread information flags bit numbers 89 * thread information flags bit numbers
90 */ 90 */
91#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 91#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
92#define TIF_RESTORE_SIGMASK 1 /* restore signal mask in do_signal() */
93#define TIF_SIGPENDING 2 /* signal pending */ 92#define TIF_SIGPENDING 2 /* signal pending */
94#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 93#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
95#define TIF_RESTART_SVC 4 /* restart svc with new svc number */ 94#define TIF_RESTART_SVC 4 /* restart svc with new svc number */
@@ -101,6 +100,7 @@ static inline struct thread_info *current_thread_info(void)
101 TIF_NEED_RESCHED */ 100 TIF_NEED_RESCHED */
102#define TIF_31BIT 18 /* 32bit process */ 101#define TIF_31BIT 18 /* 32bit process */
103#define TIF_MEMDIE 19 102#define TIF_MEMDIE 19
103#define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */
104 104
105#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 105#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
106#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 106#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
diff --git a/include/asm-s390/tlbflush.h b/include/asm-s390/tlbflush.h
index 9e57a93d7de1..d60394b9745e 100644
--- a/include/asm-s390/tlbflush.h
+++ b/include/asm-s390/tlbflush.h
@@ -2,6 +2,7 @@
2#define _S390_TLBFLUSH_H 2#define _S390_TLBFLUSH_H
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <linux/sched.h>
5#include <asm/processor.h> 6#include <asm/processor.h>
6#include <asm/pgalloc.h> 7#include <asm/pgalloc.h>
7 8
diff --git a/include/asm-s390/topology.h b/include/asm-s390/topology.h
index 8e97b06f298a..d96c91643458 100644
--- a/include/asm-s390/topology.h
+++ b/include/asm-s390/topology.h
@@ -7,6 +7,10 @@
7 7
8cpumask_t cpu_coregroup_map(unsigned int cpu); 8cpumask_t cpu_coregroup_map(unsigned int cpu);
9 9
10extern cpumask_t cpu_core_map[NR_CPUS];
11
12#define topology_core_siblings(cpu) (cpu_core_map[cpu])
13
10int topology_set_cpu_management(int fc); 14int topology_set_cpu_management(int fc);
11void topology_schedule_update(void); 15void topology_schedule_update(void);
12 16
diff --git a/include/asm-s390/unaligned.h b/include/asm-s390/unaligned.h
index 8ee86dbedd1f..da9627afe5d8 100644
--- a/include/asm-s390/unaligned.h
+++ b/include/asm-s390/unaligned.h
@@ -1,24 +1,13 @@
1/* 1#ifndef _ASM_S390_UNALIGNED_H
2 * include/asm-s390/unaligned.h 2#define _ASM_S390_UNALIGNED_H
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/unaligned.h"
7 */
8
9#ifndef __S390_UNALIGNED_H
10#define __S390_UNALIGNED_H
11 3
12/* 4/*
13 * The S390 can do unaligned accesses itself. 5 * The S390 can do unaligned accesses itself.
14 *
15 * The strange macros are there to make sure these can't
16 * be misused in a way that makes them not work on other
17 * architectures where unaligned accesses aren't as simple.
18 */ 6 */
7#include <linux/unaligned/access_ok.h>
8#include <linux/unaligned/generic.h>
19 9
20#define get_unaligned(ptr) (*(ptr)) 10#define get_unaligned __get_unaligned_be
21 11#define put_unaligned __put_unaligned_be
22#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
23 12
24#endif 13#endif /* _ASM_S390_UNALIGNED_H */
diff --git a/include/asm-sh/futex.h b/include/asm-sh/futex.h
index 74ed3681d33c..68256ec5fa35 100644
--- a/include/asm-sh/futex.h
+++ b/include/asm-sh/futex.h
@@ -4,8 +4,8 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/futex.h> 6#include <linux/futex.h>
7#include <linux/uaccess.h>
7#include <asm/errno.h> 8#include <asm/errno.h>
8#include <asm/uaccess.h>
9 9
10/* XXX: UP variants, fix for SH-4A and SMP.. */ 10/* XXX: UP variants, fix for SH-4A and SMP.. */
11#include <asm/futex-irq.h> 11#include <asm/futex-irq.h>
diff --git a/include/asm-sh/unaligned.h b/include/asm-sh/unaligned.h
index 5250e3063b42..c1641a01d50f 100644
--- a/include/asm-sh/unaligned.h
+++ b/include/asm-sh/unaligned.h
@@ -1,7 +1,19 @@
1#ifndef __ASM_SH_UNALIGNED_H 1#ifndef _ASM_SH_UNALIGNED_H
2#define __ASM_SH_UNALIGNED_H 2#define _ASM_SH_UNALIGNED_H
3 3
4/* SH can't handle unaligned accesses. */ 4/* SH can't handle unaligned accesses. */
5#include <asm-generic/unaligned.h> 5#ifdef __LITTLE_ENDIAN__
6# include <linux/unaligned/le_struct.h>
7# include <linux/unaligned/be_byteshift.h>
8# include <linux/unaligned/generic.h>
9# define get_unaligned __get_unaligned_le
10# define put_unaligned __put_unaligned_le
11#else
12# include <linux/unaligned/be_struct.h>
13# include <linux/unaligned/le_byteshift.h>
14# include <linux/unaligned/generic.h>
15# define get_unaligned __get_unaligned_be
16# define put_unaligned __put_unaligned_be
17#endif
6 18
7#endif /* __ASM_SH_UNALIGNED_H */ 19#endif /* _ASM_SH_UNALIGNED_H */
diff --git a/include/asm-sparc/head.h b/include/asm-sparc/head.h
index fcdba5116339..e6532c3e09c9 100644
--- a/include/asm-sparc/head.h
+++ b/include/asm-sparc/head.h
@@ -52,6 +52,17 @@
52 nop; \ 52 nop; \
53 nop; 53 nop;
54 54
55#ifdef CONFIG_KGDB
56#define KGDB_TRAP(num) \
57 b kgdb_trap_low; \
58 rd %psr,%l0; \
59 nop; \
60 nop;
61#else
62#define KGDB_TRAP(num) \
63 BAD_TRAP(num)
64#endif
65
55/* The Get Condition Codes software trap for userland. */ 66/* The Get Condition Codes software trap for userland. */
56#define GETCC_TRAP \ 67#define GETCC_TRAP \
57 b getcc_trap_handler; mov %psr, %l0; nop; nop; 68 b getcc_trap_handler; mov %psr, %l0; nop; nop;
diff --git a/include/asm-sparc/kgdb.h b/include/asm-sparc/kgdb.h
index d120adfb429f..b6ef301d05bf 100644
--- a/include/asm-sparc/kgdb.h
+++ b/include/asm-sparc/kgdb.h
@@ -1,94 +1,38 @@
1/* $Id: kgdb.h,v 1.8 1998/01/07 06:33:44 baccala Exp $
2 * kgdb.h: Defines and declarations for serial line source level
3 * remote debugging of the Linux kernel using gdb.
4 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */
7#ifndef _SPARC_KGDB_H 1#ifndef _SPARC_KGDB_H
8#define _SPARC_KGDB_H 2#define _SPARC_KGDB_H
9 3
10#ifndef __ASSEMBLY__ 4#ifdef CONFIG_SPARC32
11/* To init the kgdb engine. */ 5#define BUFMAX 2048
12extern void set_debug_traps(void); 6#else
13 7#define BUFMAX 4096
14/* To enter the debugger explicitly. */ 8#endif
15extern void breakpoint(void); 9
16 10enum regnames {
17/* For convenience we define the format of a kgdb trap breakpoint 11 GDB_G0, GDB_G1, GDB_G2, GDB_G3, GDB_G4, GDB_G5, GDB_G6, GDB_G7,
18 * frame here also. 12 GDB_O0, GDB_O1, GDB_O2, GDB_O3, GDB_O4, GDB_O5, GDB_SP, GDB_O7,
19 */ 13 GDB_L0, GDB_L1, GDB_L2, GDB_L3, GDB_L4, GDB_L5, GDB_L6, GDB_L7,
20struct kgdb_frame { 14 GDB_I0, GDB_I1, GDB_I2, GDB_I3, GDB_I4, GDB_I5, GDB_FP, GDB_I7,
21 unsigned long globals[8]; 15 GDB_F0,
22 unsigned long outs[8]; 16 GDB_F31 = GDB_F0 + 31,
23 unsigned long locals[8]; 17#ifdef CONFIG_SPARC32
24 unsigned long ins[8]; 18 GDB_Y, GDB_PSR, GDB_WIM, GDB_TBR, GDB_PC, GDB_NPC,
25 unsigned long fpregs[32]; 19 GDB_FSR, GDB_CSR,
26 unsigned long y; 20#else
27 unsigned long psr; 21 GDB_F32 = GDB_F0 + 32,
28 unsigned long wim; 22 GDB_F62 = GDB_F32 + 15,
29 unsigned long tbr; 23 GDB_PC, GDB_NPC, GDB_STATE, GDB_FSR, GDB_FPRS, GDB_Y,
30 unsigned long pc; 24#endif
31 unsigned long npc;
32 unsigned long fpsr;
33 unsigned long cpsr;
34}; 25};
35#endif /* !(__ASSEMBLY__) */
36
37/* Macros for assembly usage of the kgdb breakpoint frame. */
38#define KGDB_G0 0x000
39#define KGDB_G1 0x004
40#define KGDB_G2 0x008
41#define KGDB_G4 0x010
42#define KGDB_G6 0x018
43#define KGDB_I0 0x020
44#define KGDB_I2 0x028
45#define KGDB_I4 0x030
46#define KGDB_I6 0x038
47#define KGDB_Y 0x100
48#define KGDB_PSR 0x104
49#define KGDB_WIM 0x108
50#define KGDB_TBR 0x10c
51#define KGDB_PC 0x110
52#define KGDB_NPC 0x114
53
54#define SAVE_KGDB_GLOBALS(reg) \
55 std %g0, [%reg + STACKFRAME_SZ + KGDB_G0]; \
56 std %g2, [%reg + STACKFRAME_SZ + KGDB_G2]; \
57 std %g4, [%reg + STACKFRAME_SZ + KGDB_G4]; \
58 std %g6, [%reg + STACKFRAME_SZ + KGDB_G6];
59
60#define SAVE_KGDB_INS(reg) \
61 std %i0, [%reg + STACKFRAME_SZ + KGDB_I0]; \
62 std %i2, [%reg + STACKFRAME_SZ + KGDB_I2]; \
63 std %i4, [%reg + STACKFRAME_SZ + KGDB_I4]; \
64 std %i6, [%reg + STACKFRAME_SZ + KGDB_I6];
65
66#define SAVE_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \
67 st %reg_y, [%reg + STACKFRAME_SZ + KGDB_Y]; \
68 st %reg_psr, [%reg + STACKFRAME_SZ + KGDB_PSR]; \
69 st %reg_wim, [%reg + STACKFRAME_SZ + KGDB_WIM]; \
70 st %reg_tbr, [%reg + STACKFRAME_SZ + KGDB_TBR]; \
71 st %reg_pc, [%reg + STACKFRAME_SZ + KGDB_PC]; \
72 st %reg_npc, [%reg + STACKFRAME_SZ + KGDB_NPC];
73 26
74#define LOAD_KGDB_GLOBALS(reg) \ 27#ifdef CONFIG_SPARC32
75 ld [%reg + STACKFRAME_SZ + KGDB_G1], %g1; \ 28#define NUMREGBYTES ((GDB_CSR + 1) * 4)
76 ldd [%reg + STACKFRAME_SZ + KGDB_G2], %g2; \ 29#else
77 ldd [%reg + STACKFRAME_SZ + KGDB_G4], %g4; \ 30#define NUMREGBYTES ((GDB_Y + 1) * 8)
78 ldd [%reg + STACKFRAME_SZ + KGDB_G6], %g6; 31#endif
79 32
80#define LOAD_KGDB_INS(reg) \ 33extern void arch_kgdb_breakpoint(void);
81 ldd [%reg + STACKFRAME_SZ + KGDB_I0], %i0; \
82 ldd [%reg + STACKFRAME_SZ + KGDB_I2], %i2; \
83 ldd [%reg + STACKFRAME_SZ + KGDB_I4], %i4; \
84 ldd [%reg + STACKFRAME_SZ + KGDB_I6], %i6;
85 34
86#define LOAD_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \ 35#define BREAK_INSTR_SIZE 4
87 ld [%reg + STACKFRAME_SZ + KGDB_Y], %reg_y; \ 36#define CACHE_FLUSH_IS_SAFE 1
88 ld [%reg + STACKFRAME_SZ + KGDB_PSR], %reg_psr; \
89 ld [%reg + STACKFRAME_SZ + KGDB_WIM], %reg_wim; \
90 ld [%reg + STACKFRAME_SZ + KGDB_TBR], %reg_tbr; \
91 ld [%reg + STACKFRAME_SZ + KGDB_PC], %reg_pc; \
92 ld [%reg + STACKFRAME_SZ + KGDB_NPC], %reg_npc;
93 37
94#endif /* !(_SPARC_KGDB_H) */ 38#endif /* _SPARC_KGDB_H */
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
index b3f492208fd2..e6d561599726 100644
--- a/include/asm-sparc/smp.h
+++ b/include/asm-sparc/smp.h
@@ -51,13 +51,11 @@ void smp_bogo(struct seq_file *);
51void smp_info(struct seq_file *); 51void smp_info(struct seq_file *);
52 52
53BTFIXUPDEF_CALL(void, smp_cross_call, smpfunc_t, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) 53BTFIXUPDEF_CALL(void, smp_cross_call, smpfunc_t, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)
54BTFIXUPDEF_CALL(void, smp_message_pass, int, int, unsigned long, int)
55BTFIXUPDEF_CALL(int, __hard_smp_processor_id, void) 54BTFIXUPDEF_CALL(int, __hard_smp_processor_id, void)
56BTFIXUPDEF_BLACKBOX(hard_smp_processor_id) 55BTFIXUPDEF_BLACKBOX(hard_smp_processor_id)
57BTFIXUPDEF_BLACKBOX(load_current) 56BTFIXUPDEF_BLACKBOX(load_current)
58 57
59#define smp_cross_call(func,arg1,arg2,arg3,arg4,arg5) BTFIXUP_CALL(smp_cross_call)(func,arg1,arg2,arg3,arg4,arg5) 58#define smp_cross_call(func,arg1,arg2,arg3,arg4,arg5) BTFIXUP_CALL(smp_cross_call)(func,arg1,arg2,arg3,arg4,arg5)
60#define smp_message_pass(target,msg,data,wait) BTFIXUP_CALL(smp_message_pass)(target,msg,data,wait)
61 59
62static inline void xc0(smpfunc_t func) { smp_cross_call(func, 0, 0, 0, 0, 0); } 60static inline void xc0(smpfunc_t func) { smp_cross_call(func, 0, 0, 0, 0, 0); }
63static inline void xc1(smpfunc_t func, unsigned long arg1) 61static inline void xc1(smpfunc_t func, unsigned long arg1)
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index 4e08210cd4c2..b4b024445fc9 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -94,6 +94,8 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
94 } while(0) 94 } while(0)
95#endif 95#endif
96 96
97extern void flushw_all(void);
98
97/* 99/*
98 * Flush windows so that the VM switch which follows 100 * Flush windows so that the VM switch which follows
99 * would not pull the stack from under us. 101 * would not pull the stack from under us.
diff --git a/include/asm-sparc/unaligned.h b/include/asm-sparc/unaligned.h
index b6f8eddd30af..11d2d5fb5902 100644
--- a/include/asm-sparc/unaligned.h
+++ b/include/asm-sparc/unaligned.h
@@ -1,6 +1,10 @@
1#ifndef _ASM_SPARC_UNALIGNED_H_ 1#ifndef _ASM_SPARC_UNALIGNED_H
2#define _ASM_SPARC_UNALIGNED_H_ 2#define _ASM_SPARC_UNALIGNED_H
3 3
4#include <asm-generic/unaligned.h> 4#include <linux/unaligned/be_struct.h>
5#include <linux/unaligned/le_byteshift.h>
6#include <linux/unaligned/generic.h>
7#define get_unaligned __get_unaligned_be
8#define put_unaligned __put_unaligned_be
5 9
6#endif /* _ASM_SPARC_UNALIGNED_H */ 10#endif /* _ASM_SPARC_UNALIGNED_H */
diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h
index df1097d6ffbe..d8378935ae90 100644
--- a/include/asm-sparc64/futex.h
+++ b/include/asm-sparc64/futex.h
@@ -2,9 +2,9 @@
2#define _SPARC64_FUTEX_H 2#define _SPARC64_FUTEX_H
3 3
4#include <linux/futex.h> 4#include <linux/futex.h>
5#include <linux/uaccess.h>
5#include <asm/errno.h> 6#include <asm/errno.h>
6#include <asm/system.h> 7#include <asm/system.h>
7#include <asm/uaccess.h>
8 8
9#define __futex_cas_op(insn, ret, oldval, uaddr, oparg) \ 9#define __futex_cas_op(insn, ret, oldval, uaddr, oparg) \
10 __asm__ __volatile__( \ 10 __asm__ __volatile__( \
diff --git a/include/asm-sparc64/kgdb.h b/include/asm-sparc64/kgdb.h
new file mode 100644
index 000000000000..aa6532fd3a13
--- /dev/null
+++ b/include/asm-sparc64/kgdb.h
@@ -0,0 +1 @@
#include <asm-sparc/kgdb.h>
diff --git a/include/asm-sparc64/pil.h b/include/asm-sparc64/pil.h
index 72927749aebf..2f5d126f7163 100644
--- a/include/asm-sparc64/pil.h
+++ b/include/asm-sparc64/pil.h
@@ -19,11 +19,4 @@
19#define PIL_SMP_CTX_NEW_VERSION 4 19#define PIL_SMP_CTX_NEW_VERSION 4
20#define PIL_DEVICE_IRQ 5 20#define PIL_DEVICE_IRQ 5
21 21
22#ifndef __ASSEMBLY__
23#define PIL_RESERVED(PIL) ((PIL) == PIL_SMP_CALL_FUNC || \
24 (PIL) == PIL_SMP_RECEIVE_SIGNAL || \
25 (PIL) == PIL_SMP_CAPTURE || \
26 (PIL) == PIL_SMP_CTX_NEW_VERSION)
27#endif
28
29#endif /* !(_SPARC64_PIL_H) */ 22#endif /* !(_SPARC64_PIL_H) */
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index 53eae091a171..6897ac31be41 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -180,12 +180,13 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
180 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ 180 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \
181 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ 181 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \
182 "ldx [%%g6 + %9], %%g4\n\t" \ 182 "ldx [%%g6 + %9], %%g4\n\t" \
183 "brz,pt %%o7, 1f\n\t" \ 183 "brz,pt %%o7, switch_to_pc\n\t" \
184 " mov %%g7, %0\n\t" \ 184 " mov %%g7, %0\n\t" \
185 "sethi %%hi(ret_from_syscall), %%g1\n\t" \ 185 "sethi %%hi(ret_from_syscall), %%g1\n\t" \
186 "jmpl %%g1 + %%lo(ret_from_syscall), %%g0\n\t" \ 186 "jmpl %%g1 + %%lo(ret_from_syscall), %%g0\n\t" \
187 " nop\n\t" \ 187 " nop\n\t" \
188 "1:\n\t" \ 188 ".globl switch_to_pc\n\t" \
189 "switch_to_pc:\n\t" \
189 : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \ 190 : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \
190 "=r" (__local_per_cpu_offset) \ 191 "=r" (__local_per_cpu_offset) \
191 : "0" (task_thread_info(next)), \ 192 : "0" (task_thread_info(next)), \
diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h
index d3cc4eff39a6..1b55538b944f 100644
--- a/include/asm-sparc64/ttable.h
+++ b/include/asm-sparc64/ttable.h
@@ -175,6 +175,12 @@
175#define KPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl) 175#define KPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl)
176#endif 176#endif
177 177
178#ifdef CONFIG_KGDB
179#define KGDB_TRAP(lvl) TRAP_IRQ(kgdb_trap, lvl)
180#else
181#define KGDB_TRAP(lvl) TRAP_ARG(bad_trap, lvl)
182#endif
183
178#define SUN4V_ITSB_MISS \ 184#define SUN4V_ITSB_MISS \
179 ldxa [%g0] ASI_SCRATCHPAD, %g2; \ 185 ldxa [%g0] ASI_SCRATCHPAD, %g2; \
180 ldx [%g2 + HV_FAULT_I_ADDR_OFFSET], %g4; \ 186 ldx [%g2 + HV_FAULT_I_ADDR_OFFSET], %g4; \
diff --git a/include/asm-sparc64/unaligned.h b/include/asm-sparc64/unaligned.h
index 1ed3ba537772..edcebb09441e 100644
--- a/include/asm-sparc64/unaligned.h
+++ b/include/asm-sparc64/unaligned.h
@@ -1,6 +1,10 @@
1#ifndef _ASM_SPARC64_UNALIGNED_H_ 1#ifndef _ASM_SPARC64_UNALIGNED_H
2#define _ASM_SPARC64_UNALIGNED_H_ 2#define _ASM_SPARC64_UNALIGNED_H
3 3
4#include <asm-generic/unaligned.h> 4#include <linux/unaligned/be_struct.h>
5#include <linux/unaligned/le_byteshift.h>
6#include <linux/unaligned/generic.h>
7#define get_unaligned __get_unaligned_be
8#define put_unaligned __put_unaligned_be
5 9
6#endif /* _ASM_SPARC64_UNALIGNED_H */ 10#endif /* _ASM_SPARC64_UNALIGNED_H */
diff --git a/include/asm-um/unaligned.h b/include/asm-um/unaligned.h
index 1d2497c57274..a47196974e39 100644
--- a/include/asm-um/unaligned.h
+++ b/include/asm-um/unaligned.h
@@ -1,6 +1,6 @@
1#ifndef __UM_UNALIGNED_H 1#ifndef _ASM_UM_UNALIGNED_H
2#define __UM_UNALIGNED_H 2#define _ASM_UM_UNALIGNED_H
3 3
4#include "asm/arch/unaligned.h" 4#include "asm/arch/unaligned.h"
5 5
6#endif 6#endif /* _ASM_UM_UNALIGNED_H */
diff --git a/include/asm-v850/unaligned.h b/include/asm-v850/unaligned.h
index e30b18653a94..53122b28491e 100644
--- a/include/asm-v850/unaligned.h
+++ b/include/asm-v850/unaligned.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * include/asm-v850/unaligned.h -- Unaligned memory access
3 *
4 * Copyright (C) 2001 NEC Corporation 2 * Copyright (C) 2001 NEC Corporation
5 * Copyright (C) 2001 Miles Bader <miles@gnu.org> 3 * Copyright (C) 2001 Miles Bader <miles@gnu.org>
6 * 4 *
@@ -8,123 +6,17 @@
8 * Public License. See the file COPYING in the main directory of this 6 * Public License. See the file COPYING in the main directory of this
9 * archive for more details. 7 * archive for more details.
10 * 8 *
11 * This file is a copy of the arm version, include/asm-arm/unaligned.h
12 *
13 * Note that some v850 chips support unaligned access, but it seems too 9 * Note that some v850 chips support unaligned access, but it seems too
14 * annoying to use. 10 * annoying to use.
15 */ 11 */
12#ifndef _ASM_V850_UNALIGNED_H
13#define _ASM_V850_UNALIGNED_H
16 14
17#ifndef __V850_UNALIGNED_H__ 15#include <linux/unaligned/be_byteshift.h>
18#define __V850_UNALIGNED_H__ 16#include <linux/unaligned/le_byteshift.h>
19 17#include <linux/unaligned/generic.h>
20#include <asm/types.h>
21
22extern int __bug_unaligned_x(void *ptr);
23
24/*
25 * What is the most efficient way of loading/storing an unaligned value?
26 *
27 * That is the subject of this file. Efficiency here is defined as
28 * minimum code size with minimum register usage for the common cases.
29 * It is currently not believed that long longs are common, so we
30 * trade efficiency for the chars, shorts and longs against the long
31 * longs.
32 *
33 * Current stats with gcc 2.7.2.2 for these functions:
34 *
35 * ptrsize get: code regs put: code regs
36 * 1 1 1 1 2
37 * 2 3 2 3 2
38 * 4 7 3 7 3
39 * 8 20 6 16 6
40 *
41 * gcc 2.95.1 seems to code differently:
42 *
43 * ptrsize get: code regs put: code regs
44 * 1 1 1 1 2
45 * 2 3 2 3 2
46 * 4 7 4 7 4
47 * 8 19 8 15 6
48 *
49 * which may or may not be more efficient (depending upon whether
50 * you can afford the extra registers). Hopefully the gcc 2.95
51 * is inteligent enough to decide if it is better to use the
52 * extra register, but evidence so far seems to suggest otherwise.
53 *
54 * Unfortunately, gcc is not able to optimise the high word
55 * out of long long >> 32, or the low word from long long << 32
56 */
57
58#define __get_unaligned_2(__p) \
59 (__p[0] | __p[1] << 8)
60
61#define __get_unaligned_4(__p) \
62 (__p[0] | __p[1] << 8 | __p[2] << 16 | __p[3] << 24)
63
64#define get_unaligned(ptr) \
65 ({ \
66 __typeof__(*(ptr)) __v; \
67 __u8 *__p = (__u8 *)(ptr); \
68 switch (sizeof(*(ptr))) { \
69 case 1: __v = *(ptr); break; \
70 case 2: __v = __get_unaligned_2(__p); break; \
71 case 4: __v = __get_unaligned_4(__p); break; \
72 case 8: { \
73 unsigned int __v1, __v2; \
74 __v2 = __get_unaligned_4((__p+4)); \
75 __v1 = __get_unaligned_4(__p); \
76 __v = ((unsigned long long)__v2 << 32 | __v1); \
77 } \
78 break; \
79 default: __v = __bug_unaligned_x(__p); break; \
80 } \
81 __v; \
82 })
83
84
85static inline void __put_unaligned_2(__u32 __v, register __u8 *__p)
86{
87 *__p++ = __v;
88 *__p++ = __v >> 8;
89}
90
91static inline void __put_unaligned_4(__u32 __v, register __u8 *__p)
92{
93 __put_unaligned_2(__v >> 16, __p + 2);
94 __put_unaligned_2(__v, __p);
95}
96
97static inline void __put_unaligned_8(const unsigned long long __v, register __u8 *__p)
98{
99 /*
100 * tradeoff: 8 bytes of stack for all unaligned puts (2
101 * instructions), or an extra register in the long long
102 * case - go for the extra register.
103 */
104 __put_unaligned_4(__v >> 32, __p+4);
105 __put_unaligned_4(__v, __p);
106}
107
108/*
109 * Try to store an unaligned value as efficiently as possible.
110 */
111#define put_unaligned(val,ptr) \
112 ({ \
113 switch (sizeof(*(ptr))) { \
114 case 1: \
115 *(ptr) = (val); \
116 break; \
117 case 2: __put_unaligned_2((val),(__u8 *)(ptr)); \
118 break; \
119 case 4: __put_unaligned_4((val),(__u8 *)(ptr)); \
120 break; \
121 case 8: __put_unaligned_8((val),(__u8 *)(ptr)); \
122 break; \
123 default: __bug_unaligned_x(ptr); \
124 break; \
125 } \
126 (void) 0; \
127 })
128 18
19#define get_unaligned __get_unaligned_le
20#define put_unaligned __put_unaligned_le
129 21
130#endif /* __V850_UNALIGNED_H__ */ 22#endif /* _ASM_V850_UNALIGNED_H */
diff --git a/include/asm-x86/futex.h b/include/asm-x86/futex.h
index ac0fbf24d722..e7a76b37b333 100644
--- a/include/asm-x86/futex.h
+++ b/include/asm-x86/futex.h
@@ -4,12 +4,12 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/futex.h> 6#include <linux/futex.h>
7#include <linux/uaccess.h>
7 8
8#include <asm/asm.h> 9#include <asm/asm.h>
9#include <asm/errno.h> 10#include <asm/errno.h>
10#include <asm/processor.h> 11#include <asm/processor.h>
11#include <asm/system.h> 12#include <asm/system.h>
12#include <asm/uaccess.h>
13 13
14#define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \ 14#define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \
15 asm volatile("1:\t" insn "\n" \ 15 asm volatile("1:\t" insn "\n" \
diff --git a/include/asm-x86/olpc.h b/include/asm-x86/olpc.h
new file mode 100644
index 000000000000..97d47133486f
--- /dev/null
+++ b/include/asm-x86/olpc.h
@@ -0,0 +1,132 @@
1/* OLPC machine specific definitions */
2
3#ifndef ASM_OLPC_H_
4#define ASM_OLPC_H_
5
6#include <asm/geode.h>
7
8struct olpc_platform_t {
9 int flags;
10 uint32_t boardrev;
11 int ecver;
12};
13
14#define OLPC_F_PRESENT 0x01
15#define OLPC_F_DCON 0x02
16#define OLPC_F_VSA 0x04
17
18#ifdef CONFIG_OLPC
19
20extern struct olpc_platform_t olpc_platform_info;
21
22/*
23 * OLPC board IDs contain the major build number within the mask 0x0ff0,
24 * and the minor build number withing 0x000f. Pre-builds have a minor
25 * number less than 8, and normal builds start at 8. For example, 0x0B10
26 * is a PreB1, and 0x0C18 is a C1.
27 */
28
29static inline uint32_t olpc_board(uint8_t id)
30{
31 return (id << 4) | 0x8;
32}
33
34static inline uint32_t olpc_board_pre(uint8_t id)
35{
36 return id << 4;
37}
38
39static inline int machine_is_olpc(void)
40{
41 return (olpc_platform_info.flags & OLPC_F_PRESENT) ? 1 : 0;
42}
43
44/*
45 * The DCON is OLPC's Display Controller. It has a number of unique
46 * features that we might want to take advantage of..
47 */
48static inline int olpc_has_dcon(void)
49{
50 return (olpc_platform_info.flags & OLPC_F_DCON) ? 1 : 0;
51}
52
53/*
54 * The VSA is software from AMD that typical Geode bioses will include.
55 * It is used to emulate the PCI bus, VGA, etc. OLPC's Open Firmware does
56 * not include the VSA; instead, PCI is emulated by the kernel.
57 *
58 * The VSA is described further in arch/x86/pci/olpc.c.
59 */
60static inline int olpc_has_vsa(void)
61{
62 return (olpc_platform_info.flags & OLPC_F_VSA) ? 1 : 0;
63}
64
65/*
66 * The "Mass Production" version of OLPC's XO is identified as being model
67 * C2. During the prototype phase, the following models (in chronological
68 * order) were created: A1, B1, B2, B3, B4, C1. The A1 through B2 models
69 * were based on Geode GX CPUs, and models after that were based upon
70 * Geode LX CPUs. There were also some hand-assembled models floating
71 * around, referred to as PreB1, PreB2, etc.
72 */
73static inline int olpc_board_at_least(uint32_t rev)
74{
75 return olpc_platform_info.boardrev >= rev;
76}
77
78#else
79
80static inline int machine_is_olpc(void)
81{
82 return 0;
83}
84
85static inline int olpc_has_dcon(void)
86{
87 return 0;
88}
89
90static inline int olpc_has_vsa(void)
91{
92 return 0;
93}
94
95#endif
96
97/* EC related functions */
98
99extern int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
100 unsigned char *outbuf, size_t outlen);
101
102extern int olpc_ec_mask_set(uint8_t bits);
103extern int olpc_ec_mask_unset(uint8_t bits);
104
105/* EC commands */
106
107#define EC_FIRMWARE_REV 0x08
108
109/* SCI source values */
110
111#define EC_SCI_SRC_EMPTY 0x00
112#define EC_SCI_SRC_GAME 0x01
113#define EC_SCI_SRC_BATTERY 0x02
114#define EC_SCI_SRC_BATSOC 0x04
115#define EC_SCI_SRC_BATERR 0x08
116#define EC_SCI_SRC_EBOOK 0x10
117#define EC_SCI_SRC_WLAN 0x20
118#define EC_SCI_SRC_ACPWR 0x40
119#define EC_SCI_SRC_ALL 0x7F
120
121/* GPIO assignments */
122
123#define OLPC_GPIO_MIC_AC geode_gpio(1)
124#define OLPC_GPIO_DCON_IRQ geode_gpio(7)
125#define OLPC_GPIO_THRM_ALRM geode_gpio(10)
126#define OLPC_GPIO_SMB_CLK geode_gpio(14)
127#define OLPC_GPIO_SMB_DATA geode_gpio(15)
128#define OLPC_GPIO_WORKAUX geode_gpio(24)
129#define OLPC_GPIO_LID geode_gpio(26)
130#define OLPC_GPIO_ECSCI geode_gpio(27)
131
132#endif
diff --git a/include/asm-x86/pci.h b/include/asm-x86/pci.h
index ddd8e248fc0a..30bbde0cb34b 100644
--- a/include/asm-x86/pci.h
+++ b/include/asm-x86/pci.h
@@ -19,6 +19,8 @@ struct pci_sysdata {
19}; 19};
20 20
21/* scan a bus after allocating a pci_sysdata for it */ 21/* scan a bus after allocating a pci_sysdata for it */
22extern struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops,
23 int node);
22extern struct pci_bus *pci_scan_bus_with_sysdata(int busno); 24extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
23 25
24static inline int pci_domain_nr(struct pci_bus *bus) 26static inline int pci_domain_nr(struct pci_bus *bus)
diff --git a/include/asm-x86/thread_info_32.h b/include/asm-x86/thread_info_32.h
index 531859962096..b6338829d1a8 100644
--- a/include/asm-x86/thread_info_32.h
+++ b/include/asm-x86/thread_info_32.h
@@ -131,7 +131,6 @@ static inline struct thread_info *current_thread_info(void)
131#define TIF_SYSCALL_EMU 5 /* syscall emulation active */ 131#define TIF_SYSCALL_EMU 5 /* syscall emulation active */
132#define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */ 132#define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */
133#define TIF_SECCOMP 7 /* secure computing */ 133#define TIF_SECCOMP 7 /* secure computing */
134#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal() */
135#define TIF_HRTICK_RESCHED 9 /* reprogram hrtick timer */ 134#define TIF_HRTICK_RESCHED 9 /* reprogram hrtick timer */
136#define TIF_MEMDIE 16 135#define TIF_MEMDIE 16
137#define TIF_DEBUG 17 /* uses debug registers */ 136#define TIF_DEBUG 17 /* uses debug registers */
@@ -151,7 +150,6 @@ static inline struct thread_info *current_thread_info(void)
151#define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU) 150#define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU)
152#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 151#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
153#define _TIF_SECCOMP (1 << TIF_SECCOMP) 152#define _TIF_SECCOMP (1 << TIF_SECCOMP)
154#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
155#define _TIF_HRTICK_RESCHED (1 << TIF_HRTICK_RESCHED) 153#define _TIF_HRTICK_RESCHED (1 << TIF_HRTICK_RESCHED)
156#define _TIF_DEBUG (1 << TIF_DEBUG) 154#define _TIF_DEBUG (1 << TIF_DEBUG)
157#define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) 155#define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP)
@@ -188,9 +186,20 @@ static inline struct thread_info *current_thread_info(void)
188 this quantum (SMP) */ 186 this quantum (SMP) */
189#define TS_POLLING 0x0002 /* True if in idle loop 187#define TS_POLLING 0x0002 /* True if in idle loop
190 and not sleeping */ 188 and not sleeping */
189#define TS_RESTORE_SIGMASK 0x0004 /* restore signal mask in do_signal() */
191 190
192#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) 191#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
193 192
193#ifndef __ASSEMBLY__
194#define HAVE_SET_RESTORE_SIGMASK 1
195static inline void set_restore_sigmask(void)
196{
197 struct thread_info *ti = current_thread_info();
198 ti->status |= TS_RESTORE_SIGMASK;
199 set_bit(TIF_SIGPENDING, &ti->flags);
200}
201#endif /* !__ASSEMBLY__ */
202
194#endif /* __KERNEL__ */ 203#endif /* __KERNEL__ */
195 204
196#endif /* _ASM_THREAD_INFO_H */ 205#endif /* _ASM_THREAD_INFO_H */
diff --git a/include/asm-x86/thread_info_64.h b/include/asm-x86/thread_info_64.h
index ed664e874dec..cb69f70abba1 100644
--- a/include/asm-x86/thread_info_64.h
+++ b/include/asm-x86/thread_info_64.h
@@ -109,7 +109,6 @@ static inline struct thread_info *stack_thread_info(void)
109#define TIF_IRET 5 /* force IRET */ 109#define TIF_IRET 5 /* force IRET */
110#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ 110#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
111#define TIF_SECCOMP 8 /* secure computing */ 111#define TIF_SECCOMP 8 /* secure computing */
112#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */
113#define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */ 112#define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */
114#define TIF_HRTICK_RESCHED 11 /* reprogram hrtick timer */ 113#define TIF_HRTICK_RESCHED 11 /* reprogram hrtick timer */
115/* 16 free */ 114/* 16 free */
@@ -133,7 +132,6 @@ static inline struct thread_info *stack_thread_info(void)
133#define _TIF_IRET (1 << TIF_IRET) 132#define _TIF_IRET (1 << TIF_IRET)
134#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 133#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
135#define _TIF_SECCOMP (1 << TIF_SECCOMP) 134#define _TIF_SECCOMP (1 << TIF_SECCOMP)
136#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
137#define _TIF_MCE_NOTIFY (1 << TIF_MCE_NOTIFY) 135#define _TIF_MCE_NOTIFY (1 << TIF_MCE_NOTIFY)
138#define _TIF_HRTICK_RESCHED (1 << TIF_HRTICK_RESCHED) 136#define _TIF_HRTICK_RESCHED (1 << TIF_HRTICK_RESCHED)
139#define _TIF_IA32 (1 << TIF_IA32) 137#define _TIF_IA32 (1 << TIF_IA32)
@@ -178,9 +176,20 @@ static inline struct thread_info *stack_thread_info(void)
178#define TS_COMPAT 0x0002 /* 32bit syscall active */ 176#define TS_COMPAT 0x0002 /* 32bit syscall active */
179#define TS_POLLING 0x0004 /* true if in idle loop 177#define TS_POLLING 0x0004 /* true if in idle loop
180 and not sleeping */ 178 and not sleeping */
179#define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal() */
181 180
182#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) 181#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
183 182
183#ifndef __ASSEMBLY__
184#define HAVE_SET_RESTORE_SIGMASK 1
185static inline void set_restore_sigmask(void)
186{
187 struct thread_info *ti = current_thread_info();
188 ti->status |= TS_RESTORE_SIGMASK;
189 set_bit(TIF_SIGPENDING, &ti->flags);
190}
191#endif /* !__ASSEMBLY__ */
192
184#endif /* __KERNEL__ */ 193#endif /* __KERNEL__ */
185 194
186#endif /* _ASM_THREAD_INFO_H */ 195#endif /* _ASM_THREAD_INFO_H */
diff --git a/include/asm-x86/time.h b/include/asm-x86/time.h
index 68779b048a3e..bce72d7a958c 100644
--- a/include/asm-x86/time.h
+++ b/include/asm-x86/time.h
@@ -1,7 +1,6 @@
1#ifndef _ASMX86_TIME_H 1#ifndef _ASMX86_TIME_H
2#define _ASMX86_TIME_H 2#define _ASMX86_TIME_H
3 3
4extern void (*late_time_init)(void);
5extern void hpet_time_init(void); 4extern void hpet_time_init(void);
6 5
7#include <asm/mc146818rtc.h> 6#include <asm/mc146818rtc.h>
diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h
index 22073268b481..4f35a0fb4f22 100644
--- a/include/asm-x86/topology.h
+++ b/include/asm-x86/topology.h
@@ -193,9 +193,29 @@ extern cpumask_t cpu_coregroup_map(int cpu);
193#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) 193#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
194#endif 194#endif
195 195
196static inline void arch_fix_phys_package_id(int num, u32 slot)
197{
198}
199
200struct pci_bus;
201void set_pci_bus_resources_arch_default(struct pci_bus *b);
202
196#ifdef CONFIG_SMP 203#ifdef CONFIG_SMP
197#define mc_capable() (boot_cpu_data.x86_max_cores > 1) 204#define mc_capable() (boot_cpu_data.x86_max_cores > 1)
198#define smt_capable() (smp_num_siblings > 1) 205#define smt_capable() (smp_num_siblings > 1)
199#endif 206#endif
200 207
208#ifdef CONFIG_NUMA
209extern int get_mp_bus_to_node(int busnum);
210extern void set_mp_bus_to_node(int busnum, int node);
211#else
212static inline int get_mp_bus_to_node(int busnum)
213{
214 return 0;
215}
216static inline void set_mp_bus_to_node(int busnum, int node)
217{
218}
219#endif
220
201#endif 221#endif
diff --git a/include/asm-x86/tsc.h b/include/asm-x86/tsc.h
index d2d8eb5b55f5..548873ab5fc1 100644
--- a/include/asm-x86/tsc.h
+++ b/include/asm-x86/tsc.h
@@ -32,7 +32,7 @@ static inline cycles_t get_cycles(void)
32 return ret; 32 return ret;
33} 33}
34 34
35static inline cycles_t vget_cycles(void) 35static __always_inline cycles_t vget_cycles(void)
36{ 36{
37 /* 37 /*
38 * We only do VDSOs on TSC capable CPUs, so this shouldnt 38 * We only do VDSOs on TSC capable CPUs, so this shouldnt
diff --git a/include/asm-x86/unaligned.h b/include/asm-x86/unaligned.h
index d270ffe72759..a7bd416b4763 100644
--- a/include/asm-x86/unaligned.h
+++ b/include/asm-x86/unaligned.h
@@ -3,35 +3,12 @@
3 3
4/* 4/*
5 * The x86 can do unaligned accesses itself. 5 * The x86 can do unaligned accesses itself.
6 *
7 * The strange macros are there to make sure these can't
8 * be misused in a way that makes them not work on other
9 * architectures where unaligned accesses aren't as simple.
10 */ 6 */
11 7
12/** 8#include <linux/unaligned/access_ok.h>
13 * get_unaligned - get value from possibly mis-aligned location 9#include <linux/unaligned/generic.h>
14 * @ptr: pointer to value
15 *
16 * This macro should be used for accessing values larger in size than
17 * single bytes at locations that are expected to be improperly aligned,
18 * e.g. retrieving a u16 value from a location not u16-aligned.
19 *
20 * Note that unaligned accesses can be very expensive on some architectures.
21 */
22#define get_unaligned(ptr) (*(ptr))
23 10
24/** 11#define get_unaligned __get_unaligned_le
25 * put_unaligned - put value to a possibly mis-aligned location 12#define put_unaligned __put_unaligned_le
26 * @val: value to place
27 * @ptr: pointer to location
28 *
29 * This macro should be used for placing values larger in size than
30 * single bytes at locations that are expected to be improperly aligned,
31 * e.g. writing a u16 value to a location not u16-aligned.
32 *
33 * Note that unaligned accesses can be very expensive on some architectures.
34 */
35#define put_unaligned(val, ptr) ((void)(*(ptr) = (val)))
36 13
37#endif /* _ASM_X86_UNALIGNED_H */ 14#endif /* _ASM_X86_UNALIGNED_H */
diff --git a/include/asm-xtensa/unaligned.h b/include/asm-xtensa/unaligned.h
index 28220890d0a6..8f3424fc5d18 100644
--- a/include/asm-xtensa/unaligned.h
+++ b/include/asm-xtensa/unaligned.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * include/asm-xtensa/unaligned.h
3 *
4 * Xtensa doesn't handle unaligned accesses efficiently. 2 * Xtensa doesn't handle unaligned accesses efficiently.
5 * 3 *
6 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
@@ -9,20 +7,23 @@
9 * 7 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc. 8 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */ 9 */
10#ifndef _ASM_XTENSA_UNALIGNED_H
11#define _ASM_XTENSA_UNALIGNED_H
12 12
13#ifndef _XTENSA_UNALIGNED_H 13#ifdef __XTENSA_EL__
14#define _XTENSA_UNALIGNED_H 14# include <linux/unaligned/le_memmove.h>
15 15# include <linux/unaligned/be_byteshift.h>
16#include <linux/string.h> 16# include <linux/unaligned/generic.h>
17 17# define get_unaligned __get_unaligned_le
18/* Use memmove here, so gcc does not insert a __builtin_memcpy. */ 18# define put_unaligned __put_unaligned_le
19 19#elif defined(__XTENSA_EB__)
20#define get_unaligned(ptr) \ 20# include <linux/unaligned/be_memmove.h>
21 ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) 21# include <linux/unaligned/le_byteshift.h>
22 22# include <linux/unaligned/generic.h>
23#define put_unaligned(val, ptr) \ 23# define get_unaligned __get_unaligned_be
24 ({ __typeof__(*(ptr)) __tmp = (val); \ 24# define put_unaligned __put_unaligned_be
25 memmove((ptr), &__tmp, sizeof(*(ptr))); \ 25#else
26 (void)0; }) 26# error processor byte order undefined!
27#endif
27 28
28#endif /* _XTENSA_UNALIGNED_H */ 29#endif /* _ASM_XTENSA_UNALIGNED_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index bda6f04791d4..78fade0a1e35 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -20,6 +20,7 @@ header-y += affs_hardblocks.h
20header-y += aio_abi.h 20header-y += aio_abi.h
21header-y += arcfb.h 21header-y += arcfb.h
22header-y += atmapi.h 22header-y += atmapi.h
23header-y += atmarp.h
23header-y += atmbr2684.h 24header-y += atmbr2684.h
24header-y += atmclip.h 25header-y += atmclip.h
25header-y += atm_eni.h 26header-y += atm_eni.h
@@ -48,6 +49,7 @@ header-y += coff.h
48header-y += comstats.h 49header-y += comstats.h
49header-y += const.h 50header-y += const.h
50header-y += cgroupstats.h 51header-y += cgroupstats.h
52header-y += cramfs_fs.h
51header-y += cycx_cfm.h 53header-y += cycx_cfm.h
52header-y += dlmconstants.h 54header-y += dlmconstants.h
53header-y += dlm_device.h 55header-y += dlm_device.h
@@ -70,10 +72,12 @@ header-y += firewire-constants.h
70header-y += fuse.h 72header-y += fuse.h
71header-y += genetlink.h 73header-y += genetlink.h
72header-y += gen_stats.h 74header-y += gen_stats.h
75header-y += gfs2_ondisk.h
73header-y += gigaset_dev.h 76header-y += gigaset_dev.h
74header-y += hysdn_if.h 77header-y += hysdn_if.h
75header-y += i2o-dev.h 78header-y += i2o-dev.h
76header-y += i8k.h 79header-y += i8k.h
80header-y += if_addrlabel.h
77header-y += if_arcnet.h 81header-y += if_arcnet.h
78header-y += if_bonding.h 82header-y += if_bonding.h
79header-y += if_cablemodem.h 83header-y += if_cablemodem.h
@@ -91,6 +95,7 @@ header-y += if_tunnel.h
91header-y += in6.h 95header-y += in6.h
92header-y += in_route.h 96header-y += in_route.h
93header-y += ioctl.h 97header-y += ioctl.h
98header-y += ip6_tunnel.h
94header-y += ipmi_msgdefs.h 99header-y += ipmi_msgdefs.h
95header-y += ipsec.h 100header-y += ipsec.h
96header-y += ipx.h 101header-y += ipx.h
@@ -117,7 +122,6 @@ header-y += nfs2.h
117header-y += nfs4_mount.h 122header-y += nfs4_mount.h
118header-y += nfs_mount.h 123header-y += nfs_mount.h
119header-y += nl80211.h 124header-y += nl80211.h
120header-y += oom.h
121header-y += param.h 125header-y += param.h
122header-y += pci_regs.h 126header-y += pci_regs.h
123header-y += pfkeyv2.h 127header-y += pfkeyv2.h
@@ -166,7 +170,6 @@ unifdef-y += adfs_fs.h
166unifdef-y += agpgart.h 170unifdef-y += agpgart.h
167unifdef-y += apm_bios.h 171unifdef-y += apm_bios.h
168unifdef-y += atalk.h 172unifdef-y += atalk.h
169unifdef-y += atmarp.h
170unifdef-y += atmdev.h 173unifdef-y += atmdev.h
171unifdef-y += atm.h 174unifdef-y += atm.h
172unifdef-y += atm_tcp.h 175unifdef-y += atm_tcp.h
@@ -182,7 +185,6 @@ unifdef-y += cm4000_cs.h
182unifdef-y += cn_proc.h 185unifdef-y += cn_proc.h
183unifdef-y += coda.h 186unifdef-y += coda.h
184unifdef-y += connector.h 187unifdef-y += connector.h
185unifdef-y += cramfs_fs.h
186unifdef-y += cuda.h 188unifdef-y += cuda.h
187unifdef-y += cyclades.h 189unifdef-y += cyclades.h
188unifdef-y += dccp.h 190unifdef-y += dccp.h
@@ -205,7 +207,6 @@ unifdef-y += futex.h
205unifdef-y += fs.h 207unifdef-y += fs.h
206unifdef-y += gameport.h 208unifdef-y += gameport.h
207unifdef-y += generic_serial.h 209unifdef-y += generic_serial.h
208unifdef-y += gfs2_ondisk.h
209unifdef-y += hayesesp.h 210unifdef-y += hayesesp.h
210unifdef-y += hdlcdrv.h 211unifdef-y += hdlcdrv.h
211unifdef-y += hdlc.h 212unifdef-y += hdlc.h
@@ -219,7 +220,6 @@ unifdef-y += i2c-dev.h
219unifdef-y += icmp.h 220unifdef-y += icmp.h
220unifdef-y += icmpv6.h 221unifdef-y += icmpv6.h
221unifdef-y += if_addr.h 222unifdef-y += if_addr.h
222unifdef-y += if_addrlabel.h
223unifdef-y += if_arp.h 223unifdef-y += if_arp.h
224unifdef-y += if_bridge.h 224unifdef-y += if_bridge.h
225unifdef-y += if_ec.h 225unifdef-y += if_ec.h
@@ -243,7 +243,6 @@ unifdef-y += ipc.h
243unifdef-y += ipmi.h 243unifdef-y += ipmi.h
244unifdef-y += ipv6.h 244unifdef-y += ipv6.h
245unifdef-y += ipv6_route.h 245unifdef-y += ipv6_route.h
246unifdef-y += ip6_tunnel.h
247unifdef-y += isdn.h 246unifdef-y += isdn.h
248unifdef-y += isdnif.h 247unifdef-y += isdnif.h
249unifdef-y += isdn_divertif.h 248unifdef-y += isdn_divertif.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 2c7e003356ac..41f7ce7edd7a 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -79,6 +79,7 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table);
79typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); 79typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
80 80
81char * __acpi_map_table (unsigned long phys_addr, unsigned long size); 81char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
82int early_acpi_boot_init(void);
82int acpi_boot_init (void); 83int acpi_boot_init (void);
83int acpi_boot_table_init (void); 84int acpi_boot_table_init (void);
84int acpi_numa_init (void); 85int acpi_numa_init (void);
@@ -235,6 +236,10 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n,
235 236
236#else /* CONFIG_ACPI */ 237#else /* CONFIG_ACPI */
237 238
239static inline int early_acpi_boot_init(void)
240{
241 return 0;
242}
238static inline int acpi_boot_init(void) 243static inline int acpi_boot_init(void)
239{ 244{
240 return 0; 245 return 0;
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 03e34547d489..661d90d6cf7c 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -30,8 +30,6 @@
30#ifndef _AGP_BACKEND_H 30#ifndef _AGP_BACKEND_H
31#define _AGP_BACKEND_H 1 31#define _AGP_BACKEND_H 1
32 32
33#ifdef __KERNEL__
34
35#ifndef TRUE 33#ifndef TRUE
36#define TRUE 1 34#define TRUE 1
37#endif 35#endif
@@ -111,5 +109,4 @@ extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
111extern void agp_backend_release(struct agp_bridge_data *); 109extern void agp_backend_release(struct agp_bridge_data *);
112extern void agp_flush_chipset(struct agp_bridge_data *); 110extern void agp_flush_chipset(struct agp_bridge_data *);
113 111
114#endif /* __KERNEL__ */
115#endif /* _AGP_BACKEND_H */ 112#endif /* _AGP_BACKEND_H */
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 0d0b7f629bd3..b51ddd28444e 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -209,27 +209,8 @@ extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
209extern int aio_put_req(struct kiocb *iocb); 209extern int aio_put_req(struct kiocb *iocb);
210extern void kick_iocb(struct kiocb *iocb); 210extern void kick_iocb(struct kiocb *iocb);
211extern int aio_complete(struct kiocb *iocb, long res, long res2); 211extern int aio_complete(struct kiocb *iocb, long res, long res2);
212extern void __put_ioctx(struct kioctx *ctx);
213struct mm_struct; 212struct mm_struct;
214extern void exit_aio(struct mm_struct *mm); 213extern void exit_aio(struct mm_struct *mm);
215extern struct kioctx *lookup_ioctx(unsigned long ctx_id);
216extern int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
217 struct iocb *iocb);
218
219/* semi private, but used by the 32bit emulations: */
220struct kioctx *lookup_ioctx(unsigned long ctx_id);
221int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
222 struct iocb *iocb);
223
224#define get_ioctx(kioctx) do { \
225 BUG_ON(atomic_read(&(kioctx)->users) <= 0); \
226 atomic_inc(&(kioctx)->users); \
227} while (0)
228#define put_ioctx(kioctx) do { \
229 BUG_ON(atomic_read(&(kioctx)->users) <= 0); \
230 if (unlikely(atomic_dec_and_test(&(kioctx)->users))) \
231 __put_ioctx(kioctx); \
232} while (0)
233 214
234#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) 215#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
235 216
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 4ccb048cae1d..63c3bb98558f 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -146,7 +146,7 @@
146/* Rule structure sizes -- if these change, different AUDIT_ADD and 146/* Rule structure sizes -- if these change, different AUDIT_ADD and
147 * AUDIT_LIST commands must be implemented. */ 147 * AUDIT_LIST commands must be implemented. */
148#define AUDIT_MAX_FIELDS 64 148#define AUDIT_MAX_FIELDS 64
149#define AUDIT_MAX_KEY_LEN 32 149#define AUDIT_MAX_KEY_LEN 256
150#define AUDIT_BITMASK_SIZE 64 150#define AUDIT_BITMASK_SIZE 64
151#define AUDIT_WORD(nr) ((__u32)((nr)/32)) 151#define AUDIT_WORD(nr) ((__u32)((nr)/32))
152#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) 152#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32))
@@ -209,6 +209,7 @@
209#define AUDIT_WATCH 105 209#define AUDIT_WATCH 105
210#define AUDIT_PERM 106 210#define AUDIT_PERM 106
211#define AUDIT_DIR 107 211#define AUDIT_DIR 107
212#define AUDIT_FILETYPE 108
212 213
213#define AUDIT_ARG0 200 214#define AUDIT_ARG0 200
214#define AUDIT_ARG1 (AUDIT_ARG0+1) 215#define AUDIT_ARG1 (AUDIT_ARG0+1)
@@ -549,16 +550,20 @@ extern void audit_log_format(struct audit_buffer *ab,
549 const char *fmt, ...) 550 const char *fmt, ...)
550 __attribute__((format(printf,2,3))); 551 __attribute__((format(printf,2,3)));
551extern void audit_log_end(struct audit_buffer *ab); 552extern void audit_log_end(struct audit_buffer *ab);
552extern void audit_log_hex(struct audit_buffer *ab,
553 const unsigned char *buf,
554 size_t len);
555extern int audit_string_contains_control(const char *string, 553extern int audit_string_contains_control(const char *string,
556 size_t len); 554 size_t len);
555extern void audit_log_n_hex(struct audit_buffer *ab,
556 const unsigned char *buf,
557 size_t len);
558extern void audit_log_n_string(struct audit_buffer *ab,
559 const char *buf,
560 size_t n);
561#define audit_log_string(a,b) audit_log_n_string(a, b, strlen(b));
562extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
563 const char *string,
564 size_t n);
557extern void audit_log_untrustedstring(struct audit_buffer *ab, 565extern void audit_log_untrustedstring(struct audit_buffer *ab,
558 const char *string); 566 const char *string);
559extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
560 size_t n,
561 const char *string);
562extern void audit_log_d_path(struct audit_buffer *ab, 567extern void audit_log_d_path(struct audit_buffer *ab,
563 const char *prefix, 568 const char *prefix,
564 struct path *path); 569 struct path *path);
@@ -569,7 +574,8 @@ extern int audit_update_lsm_rules(void);
569extern int audit_filter_user(struct netlink_skb_parms *cb, int type); 574extern int audit_filter_user(struct netlink_skb_parms *cb, int type);
570extern int audit_filter_type(int type); 575extern int audit_filter_type(int type);
571extern int audit_receive_filter(int type, int pid, int uid, int seq, 576extern int audit_receive_filter(int type, int pid, int uid, int seq,
572 void *data, size_t datasz, uid_t loginuid, u32 sid); 577 void *data, size_t datasz, uid_t loginuid,
578 u32 sessionid, u32 sid);
573extern int audit_enabled; 579extern int audit_enabled;
574#else 580#else
575#define audit_log(c,g,t,f,...) do { ; } while (0) 581#define audit_log(c,g,t,f,...) do { ; } while (0)
@@ -577,9 +583,11 @@ extern int audit_enabled;
577#define audit_log_vformat(b,f,a) do { ; } while (0) 583#define audit_log_vformat(b,f,a) do { ; } while (0)
578#define audit_log_format(b,f,...) do { ; } while (0) 584#define audit_log_format(b,f,...) do { ; } while (0)
579#define audit_log_end(b) do { ; } while (0) 585#define audit_log_end(b) do { ; } while (0)
580#define audit_log_hex(a,b,l) do { ; } while (0) 586#define audit_log_n_hex(a,b,l) do { ; } while (0)
581#define audit_log_untrustedstring(a,s) do { ; } while (0) 587#define audit_log_n_string(a,c,l) do { ; } while (0)
588#define audit_log_string(a,c) do { ; } while (0)
582#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0) 589#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0)
590#define audit_log_untrustedstring(a,s) do { ; } while (0)
583#define audit_log_d_path(b, p, d) do { ; } while (0) 591#define audit_log_d_path(b, p, d) do { ; } while (0)
584#define audit_enabled 0 592#define audit_enabled 0
585#endif 593#endif
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 48a62baace58..0a24d5550eb3 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -11,9 +11,13 @@
11#include <linux/percpu_counter.h> 11#include <linux/percpu_counter.h>
12#include <linux/log2.h> 12#include <linux/log2.h>
13#include <linux/proportions.h> 13#include <linux/proportions.h>
14#include <linux/kernel.h>
15#include <linux/fs.h>
14#include <asm/atomic.h> 16#include <asm/atomic.h>
15 17
16struct page; 18struct page;
19struct device;
20struct dentry;
17 21
18/* 22/*
19 * Bits in backing_dev_info.state 23 * Bits in backing_dev_info.state
@@ -48,11 +52,26 @@ struct backing_dev_info {
48 52
49 struct prop_local_percpu completions; 53 struct prop_local_percpu completions;
50 int dirty_exceeded; 54 int dirty_exceeded;
55
56 unsigned int min_ratio;
57 unsigned int max_ratio, max_prop_frac;
58
59 struct device *dev;
60
61#ifdef CONFIG_DEBUG_FS
62 struct dentry *debug_dir;
63 struct dentry *debug_stats;
64#endif
51}; 65};
52 66
53int bdi_init(struct backing_dev_info *bdi); 67int bdi_init(struct backing_dev_info *bdi);
54void bdi_destroy(struct backing_dev_info *bdi); 68void bdi_destroy(struct backing_dev_info *bdi);
55 69
70int bdi_register(struct backing_dev_info *bdi, struct device *parent,
71 const char *fmt, ...);
72int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
73void bdi_unregister(struct backing_dev_info *bdi);
74
56static inline void __add_bdi_stat(struct backing_dev_info *bdi, 75static inline void __add_bdi_stat(struct backing_dev_info *bdi,
57 enum bdi_stat_item item, s64 amount) 76 enum bdi_stat_item item, s64 amount)
58{ 77{
@@ -116,6 +135,8 @@ static inline s64 bdi_stat_sum(struct backing_dev_info *bdi,
116 return sum; 135 return sum;
117} 136}
118 137
138extern void bdi_writeout_inc(struct backing_dev_info *bdi);
139
119/* 140/*
120 * maximal error of a stat counter. 141 * maximal error of a stat counter.
121 */ 142 */
@@ -128,24 +149,48 @@ static inline unsigned long bdi_stat_error(struct backing_dev_info *bdi)
128#endif 149#endif
129} 150}
130 151
152int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio);
153int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
154
131/* 155/*
132 * Flags in backing_dev_info::capability 156 * Flags in backing_dev_info::capability
133 * - The first two flags control whether dirty pages will contribute to the 157 *
134 * VM's accounting and whether writepages() should be called for dirty pages 158 * The first three flags control whether dirty pages will contribute to the
135 * (something that would not, for example, be appropriate for ramfs) 159 * VM's accounting and whether writepages() should be called for dirty pages
136 * - These flags let !MMU mmap() govern direct device mapping vs immediate 160 * (something that would not, for example, be appropriate for ramfs)
137 * copying more easily for MAP_PRIVATE, especially for ROM filesystems 161 *
162 * WARNING: these flags are closely related and should not normally be
163 * used separately. The BDI_CAP_NO_ACCT_AND_WRITEBACK combines these
164 * three flags into a single convenience macro.
165 *
166 * BDI_CAP_NO_ACCT_DIRTY: Dirty pages shouldn't contribute to accounting
167 * BDI_CAP_NO_WRITEBACK: Don't write pages back
168 * BDI_CAP_NO_ACCT_WB: Don't automatically account writeback pages
169 *
170 * These flags let !MMU mmap() govern direct device mapping vs immediate
171 * copying more easily for MAP_PRIVATE, especially for ROM filesystems.
172 *
173 * BDI_CAP_MAP_COPY: Copy can be mapped (MAP_PRIVATE)
174 * BDI_CAP_MAP_DIRECT: Can be mapped directly (MAP_SHARED)
175 * BDI_CAP_READ_MAP: Can be mapped for reading
176 * BDI_CAP_WRITE_MAP: Can be mapped for writing
177 * BDI_CAP_EXEC_MAP: Can be mapped for execution
138 */ 178 */
139#define BDI_CAP_NO_ACCT_DIRTY 0x00000001 /* Dirty pages shouldn't contribute to accounting */ 179#define BDI_CAP_NO_ACCT_DIRTY 0x00000001
140#define BDI_CAP_NO_WRITEBACK 0x00000002 /* Don't write pages back */ 180#define BDI_CAP_NO_WRITEBACK 0x00000002
141#define BDI_CAP_MAP_COPY 0x00000004 /* Copy can be mapped (MAP_PRIVATE) */ 181#define BDI_CAP_MAP_COPY 0x00000004
142#define BDI_CAP_MAP_DIRECT 0x00000008 /* Can be mapped directly (MAP_SHARED) */ 182#define BDI_CAP_MAP_DIRECT 0x00000008
143#define BDI_CAP_READ_MAP 0x00000010 /* Can be mapped for reading */ 183#define BDI_CAP_READ_MAP 0x00000010
144#define BDI_CAP_WRITE_MAP 0x00000020 /* Can be mapped for writing */ 184#define BDI_CAP_WRITE_MAP 0x00000020
145#define BDI_CAP_EXEC_MAP 0x00000040 /* Can be mapped for execution */ 185#define BDI_CAP_EXEC_MAP 0x00000040
186#define BDI_CAP_NO_ACCT_WB 0x00000080
187
146#define BDI_CAP_VMFLAGS \ 188#define BDI_CAP_VMFLAGS \
147 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) 189 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
148 190
191#define BDI_CAP_NO_ACCT_AND_WRITEBACK \
192 (BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_ACCT_WB)
193
149#if defined(VM_MAYREAD) && \ 194#if defined(VM_MAYREAD) && \
150 (BDI_CAP_READ_MAP != VM_MAYREAD || \ 195 (BDI_CAP_READ_MAP != VM_MAYREAD || \
151 BDI_CAP_WRITE_MAP != VM_MAYWRITE || \ 196 BDI_CAP_WRITE_MAP != VM_MAYWRITE || \
@@ -156,9 +201,7 @@ static inline unsigned long bdi_stat_error(struct backing_dev_info *bdi)
156extern struct backing_dev_info default_backing_dev_info; 201extern struct backing_dev_info default_backing_dev_info;
157void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); 202void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);
158 203
159int writeback_acquire(struct backing_dev_info *bdi);
160int writeback_in_progress(struct backing_dev_info *bdi); 204int writeback_in_progress(struct backing_dev_info *bdi);
161void writeback_release(struct backing_dev_info *bdi);
162 205
163static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits) 206static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits)
164{ 207{
@@ -187,17 +230,32 @@ void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
187void set_bdi_congested(struct backing_dev_info *bdi, int rw); 230void set_bdi_congested(struct backing_dev_info *bdi, int rw);
188long congestion_wait(int rw, long timeout); 231long congestion_wait(int rw, long timeout);
189 232
190#define bdi_cap_writeback_dirty(bdi) \
191 (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK))
192 233
193#define bdi_cap_account_dirty(bdi) \ 234static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi)
194 (!((bdi)->capabilities & BDI_CAP_NO_ACCT_DIRTY)) 235{
236 return !(bdi->capabilities & BDI_CAP_NO_WRITEBACK);
237}
238
239static inline bool bdi_cap_account_dirty(struct backing_dev_info *bdi)
240{
241 return !(bdi->capabilities & BDI_CAP_NO_ACCT_DIRTY);
242}
195 243
196#define mapping_cap_writeback_dirty(mapping) \ 244static inline bool bdi_cap_account_writeback(struct backing_dev_info *bdi)
197 bdi_cap_writeback_dirty((mapping)->backing_dev_info) 245{
246 /* Paranoia: BDI_CAP_NO_WRITEBACK implies BDI_CAP_NO_ACCT_WB */
247 return !(bdi->capabilities & (BDI_CAP_NO_ACCT_WB |
248 BDI_CAP_NO_WRITEBACK));
249}
198 250
199#define mapping_cap_account_dirty(mapping) \ 251static inline bool mapping_cap_writeback_dirty(struct address_space *mapping)
200 bdi_cap_account_dirty((mapping)->backing_dev_info) 252{
253 return bdi_cap_writeback_dirty(mapping->backing_dev_info);
254}
201 255
256static inline bool mapping_cap_account_dirty(struct address_space *mapping)
257{
258 return bdi_cap_account_dirty(mapping->backing_dev_info);
259}
202 260
203#endif /* _LINUX_BACKING_DEV_H */ 261#endif /* _LINUX_BACKING_DEV_H */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index b7fc55ec8d48..b512e48f6d8e 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -34,7 +34,8 @@ struct linux_binprm{
34#endif 34#endif
35 struct mm_struct *mm; 35 struct mm_struct *mm;
36 unsigned long p; /* current top of mem */ 36 unsigned long p; /* current top of mem */
37 int sh_bang; 37 unsigned int sh_bang:1,
38 misc_bang:1;
38 struct file * file; 39 struct file * file;
39 int e_uid, e_gid; 40 int e_uid, e_gid;
40 kernel_cap_t cap_inheritable, cap_permitted; 41 kernel_cap_t cap_inheritable, cap_permitted;
@@ -48,7 +49,6 @@ struct linux_binprm{
48 unsigned interp_flags; 49 unsigned interp_flags;
49 unsigned interp_data; 50 unsigned interp_data;
50 unsigned long loader, exec; 51 unsigned long loader, exec;
51 unsigned long argv_len;
52}; 52};
53 53
54#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 54#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
diff --git a/include/linux/bio.h b/include/linux/bio.h
index d259690863fb..61c15eaf3fb3 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -324,6 +324,8 @@ extern struct bio *bio_map_user_iov(struct request_queue *,
324extern void bio_unmap_user(struct bio *); 324extern void bio_unmap_user(struct bio *);
325extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, 325extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
326 gfp_t); 326 gfp_t);
327extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int,
328 gfp_t, int);
327extern void bio_set_pages_dirty(struct bio *bio); 329extern void bio_set_pages_dirty(struct bio *bio);
328extern void bio_check_pages_dirty(struct bio *bio); 330extern void bio_check_pages_dirty(struct bio *bio);
329extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); 331extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 48bde600a2db..024f2b027244 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -6,8 +6,8 @@
6#define BIT(nr) (1UL << (nr)) 6#define BIT(nr) (1UL << (nr))
7#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) 7#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
8#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) 8#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
9#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
10#define BITS_PER_BYTE 8 9#define BITS_PER_BYTE 8
10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
11#endif 11#endif
12 12
13/* 13/*
@@ -114,8 +114,6 @@ static inline unsigned fls_long(unsigned long l)
114 114
115#ifdef __KERNEL__ 115#ifdef __KERNEL__
116#ifdef CONFIG_GENERIC_FIND_FIRST_BIT 116#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
117extern unsigned long __find_first_bit(const unsigned long *addr,
118 unsigned long size);
119 117
120/** 118/**
121 * find_first_bit - find the first set bit in a memory region 119 * find_first_bit - find the first set bit in a memory region
@@ -124,28 +122,8 @@ extern unsigned long __find_first_bit(const unsigned long *addr,
124 * 122 *
125 * Returns the bit number of the first set bit. 123 * Returns the bit number of the first set bit.
126 */ 124 */
127static __always_inline unsigned long 125extern unsigned long find_first_bit(const unsigned long *addr,
128find_first_bit(const unsigned long *addr, unsigned long size) 126 unsigned long size);
129{
130 /* Avoid a function call if the bitmap size is a constant */
131 /* and not bigger than BITS_PER_LONG. */
132
133 /* insert a sentinel so that __ffs returns size if there */
134 /* are no set bits in the bitmap */
135 if (__builtin_constant_p(size) && (size < BITS_PER_LONG))
136 return __ffs((*addr) | (1ul << size));
137
138 /* the result of __ffs(0) is undefined, so it needs to be */
139 /* handled separately */
140 if (__builtin_constant_p(size) && (size == BITS_PER_LONG))
141 return ((*addr) == 0) ? BITS_PER_LONG : __ffs(*addr);
142
143 /* size is not constant or too big */
144 return __find_first_bit(addr, size);
145}
146
147extern unsigned long __find_first_zero_bit(const unsigned long *addr,
148 unsigned long size);
149 127
150/** 128/**
151 * find_first_zero_bit - find the first cleared bit in a memory region 129 * find_first_zero_bit - find the first cleared bit in a memory region
@@ -154,31 +132,12 @@ extern unsigned long __find_first_zero_bit(const unsigned long *addr,
154 * 132 *
155 * Returns the bit number of the first cleared bit. 133 * Returns the bit number of the first cleared bit.
156 */ 134 */
157static __always_inline unsigned long 135extern unsigned long find_first_zero_bit(const unsigned long *addr,
158find_first_zero_bit(const unsigned long *addr, unsigned long size) 136 unsigned long size);
159{ 137
160 /* Avoid a function call if the bitmap size is a constant */
161 /* and not bigger than BITS_PER_LONG. */
162
163 /* insert a sentinel so that __ffs returns size if there */
164 /* are no set bits in the bitmap */
165 if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) {
166 return __ffs(~(*addr) | (1ul << size));
167 }
168
169 /* the result of __ffs(0) is undefined, so it needs to be */
170 /* handled separately */
171 if (__builtin_constant_p(size) && (size == BITS_PER_LONG))
172 return (~(*addr) == 0) ? BITS_PER_LONG : __ffs(~(*addr));
173
174 /* size is not constant or too big */
175 return __find_first_zero_bit(addr, size);
176}
177#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ 138#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
178 139
179#ifdef CONFIG_GENERIC_FIND_NEXT_BIT 140#ifdef CONFIG_GENERIC_FIND_NEXT_BIT
180extern unsigned long __find_next_bit(const unsigned long *addr,
181 unsigned long size, unsigned long offset);
182 141
183/** 142/**
184 * find_next_bit - find the next set bit in a memory region 143 * find_next_bit - find the next set bit in a memory region
@@ -186,36 +145,8 @@ extern unsigned long __find_next_bit(const unsigned long *addr,
186 * @offset: The bitnumber to start searching at 145 * @offset: The bitnumber to start searching at
187 * @size: The bitmap size in bits 146 * @size: The bitmap size in bits
188 */ 147 */
189static __always_inline unsigned long 148extern unsigned long find_next_bit(const unsigned long *addr,
190find_next_bit(const unsigned long *addr, unsigned long size, 149 unsigned long size, unsigned long offset);
191 unsigned long offset)
192{
193 unsigned long value;
194
195 /* Avoid a function call if the bitmap size is a constant */
196 /* and not bigger than BITS_PER_LONG. */
197
198 /* insert a sentinel so that __ffs returns size if there */
199 /* are no set bits in the bitmap */
200 if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) {
201 value = (*addr) & ((~0ul) << offset);
202 value |= (1ul << size);
203 return __ffs(value);
204 }
205
206 /* the result of __ffs(0) is undefined, so it needs to be */
207 /* handled separately */
208 if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) {
209 value = (*addr) & ((~0ul) << offset);
210 return (value == 0) ? BITS_PER_LONG : __ffs(value);
211 }
212
213 /* size is not constant or too big */
214 return __find_next_bit(addr, size, offset);
215}
216
217extern unsigned long __find_next_zero_bit(const unsigned long *addr,
218 unsigned long size, unsigned long offset);
219 150
220/** 151/**
221 * find_next_zero_bit - find the next cleared bit in a memory region 152 * find_next_zero_bit - find the next cleared bit in a memory region
@@ -223,33 +154,11 @@ extern unsigned long __find_next_zero_bit(const unsigned long *addr,
223 * @offset: The bitnumber to start searching at 154 * @offset: The bitnumber to start searching at
224 * @size: The bitmap size in bits 155 * @size: The bitmap size in bits
225 */ 156 */
226static __always_inline unsigned long 157
227find_next_zero_bit(const unsigned long *addr, unsigned long size, 158extern unsigned long find_next_zero_bit(const unsigned long *addr,
228 unsigned long offset) 159 unsigned long size,
229{ 160 unsigned long offset);
230 unsigned long value; 161
231
232 /* Avoid a function call if the bitmap size is a constant */
233 /* and not bigger than BITS_PER_LONG. */
234
235 /* insert a sentinel so that __ffs returns size if there */
236 /* are no set bits in the bitmap */
237 if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) {
238 value = (~(*addr)) & ((~0ul) << offset);
239 value |= (1ul << size);
240 return __ffs(value);
241 }
242
243 /* the result of __ffs(0) is undefined, so it needs to be */
244 /* handled separately */
245 if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) {
246 value = (~(*addr)) & ((~0ul) << offset);
247 return (value == 0) ? BITS_PER_LONG : __ffs(value);
248 }
249
250 /* size is not constant or too big */
251 return __find_next_zero_bit(addr, size, offset);
252}
253#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ 162#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */
254#endif /* __KERNEL__ */ 163#endif /* __KERNEL__ */
255#endif 164#endif
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c5065e3d2ca9..d2a1b71e93c3 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -215,8 +215,9 @@ struct request {
215 /* 215 /*
216 * when request is used as a packet command carrier 216 * when request is used as a packet command carrier
217 */ 217 */
218 unsigned int cmd_len; 218 unsigned short cmd_len;
219 unsigned char cmd[BLK_MAX_CDB]; 219 unsigned char __cmd[BLK_MAX_CDB];
220 unsigned char *cmd;
220 221
221 unsigned int data_len; 222 unsigned int data_len;
222 unsigned int extra_len; /* length of alignment and padding */ 223 unsigned int extra_len; /* length of alignment and padding */
@@ -407,6 +408,41 @@ struct request_queue
407#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 408#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
408#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ 409#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */
409#define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ 410#define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */
411#define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */
412
413static inline int queue_is_locked(struct request_queue *q)
414{
415#ifdef CONFIG_SMP
416 spinlock_t *lock = q->queue_lock;
417 return lock && spin_is_locked(lock);
418#else
419 return 1;
420#endif
421}
422
423static inline void queue_flag_set_unlocked(unsigned int flag,
424 struct request_queue *q)
425{
426 __set_bit(flag, &q->queue_flags);
427}
428
429static inline void queue_flag_set(unsigned int flag, struct request_queue *q)
430{
431 WARN_ON_ONCE(!queue_is_locked(q));
432 __set_bit(flag, &q->queue_flags);
433}
434
435static inline void queue_flag_clear_unlocked(unsigned int flag,
436 struct request_queue *q)
437{
438 __clear_bit(flag, &q->queue_flags);
439}
440
441static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
442{
443 WARN_ON_ONCE(!queue_is_locked(q));
444 __clear_bit(flag, &q->queue_flags);
445}
410 446
411enum { 447enum {
412 /* 448 /*
@@ -451,6 +487,7 @@ enum {
451#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) 487#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
452#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 488#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
453#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 489#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
490#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
454#define blk_queue_flushing(q) ((q)->ordseq) 491#define blk_queue_flushing(q) ((q)->ordseq)
455 492
456#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) 493#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
@@ -496,17 +533,17 @@ static inline int blk_queue_full(struct request_queue *q, int rw)
496static inline void blk_set_queue_full(struct request_queue *q, int rw) 533static inline void blk_set_queue_full(struct request_queue *q, int rw)
497{ 534{
498 if (rw == READ) 535 if (rw == READ)
499 set_bit(QUEUE_FLAG_READFULL, &q->queue_flags); 536 queue_flag_set(QUEUE_FLAG_READFULL, q);
500 else 537 else
501 set_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags); 538 queue_flag_set(QUEUE_FLAG_WRITEFULL, q);
502} 539}
503 540
504static inline void blk_clear_queue_full(struct request_queue *q, int rw) 541static inline void blk_clear_queue_full(struct request_queue *q, int rw)
505{ 542{
506 if (rw == READ) 543 if (rw == READ)
507 clear_bit(QUEUE_FLAG_READFULL, &q->queue_flags); 544 queue_flag_clear(QUEUE_FLAG_READFULL, q);
508 else 545 else
509 clear_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags); 546 queue_flag_clear(QUEUE_FLAG_WRITEFULL, q);
510} 547}
511 548
512 549
@@ -583,6 +620,7 @@ extern int blk_register_queue(struct gendisk *disk);
583extern void blk_unregister_queue(struct gendisk *disk); 620extern void blk_unregister_queue(struct gendisk *disk);
584extern void register_disk(struct gendisk *dev); 621extern void register_disk(struct gendisk *dev);
585extern void generic_make_request(struct bio *bio); 622extern void generic_make_request(struct bio *bio);
623extern void blk_rq_init(struct request_queue *q, struct request *rq);
586extern void blk_put_request(struct request *); 624extern void blk_put_request(struct request *);
587extern void __blk_put_request(struct request_queue *, struct request *); 625extern void __blk_put_request(struct request_queue *, struct request *);
588extern void blk_end_sync_rq(struct request *rq, int error); 626extern void blk_end_sync_rq(struct request *rq, int error);
@@ -626,6 +664,7 @@ extern void blk_start_queue(struct request_queue *q);
626extern void blk_stop_queue(struct request_queue *q); 664extern void blk_stop_queue(struct request_queue *q);
627extern void blk_sync_queue(struct request_queue *q); 665extern void blk_sync_queue(struct request_queue *q);
628extern void __blk_stop_queue(struct request_queue *q); 666extern void __blk_stop_queue(struct request_queue *q);
667extern void __blk_run_queue(struct request_queue *);
629extern void blk_run_queue(struct request_queue *); 668extern void blk_run_queue(struct request_queue *);
630extern void blk_start_queueing(struct request_queue *); 669extern void blk_start_queueing(struct request_queue *);
631extern int blk_rq_map_user(struct request_queue *, struct request *, void __user *, unsigned long); 670extern int blk_rq_map_user(struct request_queue *, struct request *, void __user *, unsigned long);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 932eb02a2753..82aa36c53ea7 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -225,7 +225,6 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct page *page,
225 get_block_t get_block); 225 get_block_t get_block);
226void block_sync_page(struct page *); 226void block_sync_page(struct page *);
227sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 227sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
228int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
229int block_truncate_page(struct address_space *, loff_t, get_block_t *); 228int block_truncate_page(struct address_space *, loff_t, get_block_t *);
230int file_fsync(struct file *, struct dentry *, int); 229int file_fsync(struct file *, struct dentry *, int);
231int nobh_write_begin(struct file *, struct address_space *, 230int nobh_write_begin(struct file *, struct address_space *,
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
index 79bedddfd9ca..1133d5f9d818 100644
--- a/include/linux/byteorder/Kbuild
+++ b/include/linux/byteorder/Kbuild
@@ -1,5 +1,3 @@
1header-y += big_endian.h 1unifdef-y += big_endian.h
2header-y += little_endian.h 2unifdef-y += little_endian.h
3
4unifdef-y += generic.h
5unifdef-y += swab.h 3unifdef-y += swab.h
diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h
index bef87891cb24..961ed4b48d8e 100644
--- a/include/linux/byteorder/big_endian.h
+++ b/include/linux/byteorder/big_endian.h
@@ -101,6 +101,8 @@ static inline __u16 __be16_to_cpup(const __be16 *p)
101#define __cpu_to_be16s(x) do {} while (0) 101#define __cpu_to_be16s(x) do {} while (0)
102#define __be16_to_cpus(x) do {} while (0) 102#define __be16_to_cpus(x) do {} while (0)
103 103
104#ifdef __KERNEL__
104#include <linux/byteorder/generic.h> 105#include <linux/byteorder/generic.h>
106#endif
105 107
106#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ 108#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index d3771551fdd9..0846e6b931ce 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -82,12 +82,6 @@
82 * 82 *
83 */ 83 */
84 84
85
86#if defined(__KERNEL__)
87/*
88 * inside the kernel, we can use nicknames;
89 * outside of it, we must avoid POSIX namespace pollution...
90 */
91#define cpu_to_le64 __cpu_to_le64 85#define cpu_to_le64 __cpu_to_le64
92#define le64_to_cpu __le64_to_cpu 86#define le64_to_cpu __le64_to_cpu
93#define cpu_to_le32 __cpu_to_le32 87#define cpu_to_le32 __cpu_to_le32
@@ -176,6 +170,4 @@ static inline void be64_add_cpu(__be64 *var, u64 val)
176 *var = cpu_to_be64(be64_to_cpu(*var) + val); 170 *var = cpu_to_be64(be64_to_cpu(*var) + val);
177} 171}
178 172
179#endif /* KERNEL */
180
181#endif /* _LINUX_BYTEORDER_GENERIC_H */ 173#endif /* _LINUX_BYTEORDER_GENERIC_H */
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h
index 86e62b750176..05dc7c35b3b2 100644
--- a/include/linux/byteorder/little_endian.h
+++ b/include/linux/byteorder/little_endian.h
@@ -101,6 +101,8 @@ static inline __u16 __be16_to_cpup(const __be16 *p)
101#define __cpu_to_be16s(x) __swab16s((x)) 101#define __cpu_to_be16s(x) __swab16s((x))
102#define __be16_to_cpus(x) __swab16s((x)) 102#define __be16_to_cpus(x) __swab16s((x))
103 103
104#ifdef __KERNEL__
104#include <linux/byteorder/generic.h> 105#include <linux/byteorder/generic.h>
106#endif
105 107
106#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ 108#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index eaab759b1460..f4ea0dd9a618 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -365,12 +365,12 @@ typedef struct kernel_cap_struct {
365# error Fix up hand-coded capability macro initializers 365# error Fix up hand-coded capability macro initializers
366#else /* HAND-CODED capability initializers */ 366#else /* HAND-CODED capability initializers */
367 367
368# define CAP_EMPTY_SET {{ 0, 0 }} 368# define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }})
369# define CAP_FULL_SET {{ ~0, ~0 }} 369# define CAP_FULL_SET ((kernel_cap_t){{ ~0, ~0 }})
370# define CAP_INIT_EFF_SET {{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }} 370# define CAP_INIT_EFF_SET ((kernel_cap_t){{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }})
371# define CAP_FS_SET {{ CAP_FS_MASK_B0, CAP_FS_MASK_B1 } } 371# define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0, CAP_FS_MASK_B1 } })
372# define CAP_NFSD_SET {{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \ 372# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \
373 CAP_FS_MASK_B1 } } 373 CAP_FS_MASK_B1 } })
374 374
375#endif /* _LINUX_CAPABILITY_U32S != 2 */ 375#endif /* _LINUX_CAPABILITY_U32S != 2 */
376 376
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 1e29b13d0062..fb4591977b03 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -1,6 +1,5 @@
1#ifndef _LINUX_CDEV_H 1#ifndef _LINUX_CDEV_H
2#define _LINUX_CDEV_H 2#define _LINUX_CDEV_H
3#ifdef __KERNEL__
4 3
5#include <linux/kobject.h> 4#include <linux/kobject.h>
6#include <linux/kdev_t.h> 5#include <linux/kdev_t.h>
@@ -34,4 +33,3 @@ void cd_forget(struct inode *);
34extern struct backing_dev_info directly_mappable_cdev_bdi; 33extern struct backing_dev_info directly_mappable_cdev_bdi;
35 34
36#endif 35#endif
37#endif
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index a6a6035a4e1e..e155aa78d859 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -88,6 +88,17 @@ static inline void css_put(struct cgroup_subsys_state *css)
88 __css_put(css); 88 __css_put(css);
89} 89}
90 90
91/* bits in struct cgroup flags field */
92enum {
93 /* Control Group is dead */
94 CGRP_REMOVED,
95 /* Control Group has previously had a child cgroup or a task,
96 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */
97 CGRP_RELEASABLE,
98 /* Control Group requires release notifications to userspace */
99 CGRP_NOTIFY_ON_RELEASE,
100};
101
91struct cgroup { 102struct cgroup {
92 unsigned long flags; /* "unsigned long" so bitops work */ 103 unsigned long flags; /* "unsigned long" so bitops work */
93 104
@@ -139,10 +150,10 @@ struct css_set {
139 struct kref ref; 150 struct kref ref;
140 151
141 /* 152 /*
142 * List running through all cgroup groups. Protected by 153 * List running through all cgroup groups in the same hash
143 * css_set_lock 154 * slot. Protected by css_set_lock
144 */ 155 */
145 struct list_head list; 156 struct hlist_node hlist;
146 157
147 /* 158 /*
148 * List running through all tasks using this cgroup 159 * List running through all tasks using this cgroup
@@ -163,7 +174,16 @@ struct css_set {
163 * during subsystem registration (at boot time). 174 * during subsystem registration (at boot time).
164 */ 175 */
165 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 176 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
177};
178
179/*
180 * cgroup_map_cb is an abstract callback API for reporting map-valued
181 * control files
182 */
166 183
184struct cgroup_map_cb {
185 int (*fill)(struct cgroup_map_cb *cb, const char *key, u64 value);
186 void *state;
167}; 187};
168 188
169/* struct cftype: 189/* struct cftype:
@@ -190,20 +210,51 @@ struct cftype {
190 struct file *file, 210 struct file *file,
191 char __user *buf, size_t nbytes, loff_t *ppos); 211 char __user *buf, size_t nbytes, loff_t *ppos);
192 /* 212 /*
193 * read_uint() is a shortcut for the common case of returning a 213 * read_u64() is a shortcut for the common case of returning a
194 * single integer. Use it in place of read() 214 * single integer. Use it in place of read()
195 */ 215 */
196 u64 (*read_uint) (struct cgroup *cgrp, struct cftype *cft); 216 u64 (*read_u64) (struct cgroup *cgrp, struct cftype *cft);
217 /*
218 * read_s64() is a signed version of read_u64()
219 */
220 s64 (*read_s64) (struct cgroup *cgrp, struct cftype *cft);
221 /*
222 * read_map() is used for defining a map of key/value
223 * pairs. It should call cb->fill(cb, key, value) for each
224 * entry. The key/value pairs (and their ordering) should not
225 * change between reboots.
226 */
227 int (*read_map) (struct cgroup *cont, struct cftype *cft,
228 struct cgroup_map_cb *cb);
229 /*
230 * read_seq_string() is used for outputting a simple sequence
231 * using seqfile.
232 */
233 int (*read_seq_string) (struct cgroup *cont, struct cftype *cft,
234 struct seq_file *m);
235
197 ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft, 236 ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft,
198 struct file *file, 237 struct file *file,
199 const char __user *buf, size_t nbytes, loff_t *ppos); 238 const char __user *buf, size_t nbytes, loff_t *ppos);
200 239
201 /* 240 /*
202 * write_uint() is a shortcut for the common case of accepting 241 * write_u64() is a shortcut for the common case of accepting
203 * a single integer (as parsed by simple_strtoull) from 242 * a single integer (as parsed by simple_strtoull) from
204 * userspace. Use in place of write(); return 0 or error. 243 * userspace. Use in place of write(); return 0 or error.
205 */ 244 */
206 int (*write_uint) (struct cgroup *cgrp, struct cftype *cft, u64 val); 245 int (*write_u64) (struct cgroup *cgrp, struct cftype *cft, u64 val);
246 /*
247 * write_s64() is a signed version of write_u64()
248 */
249 int (*write_s64) (struct cgroup *cgrp, struct cftype *cft, s64 val);
250
251 /*
252 * trigger() callback can be used to get some kick from the
253 * userspace, when the actual string written is not important
254 * at all. The private field can be used to determine the
255 * kick type for multiplexing.
256 */
257 int (*trigger)(struct cgroup *cgrp, unsigned int event);
207 258
208 int (*release) (struct inode *inode, struct file *file); 259 int (*release) (struct inode *inode, struct file *file);
209}; 260};
@@ -254,6 +305,12 @@ struct cgroup_subsys {
254 struct cgroup *cgrp); 305 struct cgroup *cgrp);
255 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); 306 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
256 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); 307 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
308 /*
309 * This routine is called with the task_lock of mm->owner held
310 */
311 void (*mm_owner_changed)(struct cgroup_subsys *ss,
312 struct cgroup *old,
313 struct cgroup *new);
257 int subsys_id; 314 int subsys_id;
258 int active; 315 int active;
259 int disabled; 316 int disabled;
@@ -339,4 +396,13 @@ static inline int cgroupstats_build(struct cgroupstats *stats,
339 396
340#endif /* !CONFIG_CGROUPS */ 397#endif /* !CONFIG_CGROUPS */
341 398
399#ifdef CONFIG_MM_OWNER
400extern void
401cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new);
402#else /* !CONFIG_MM_OWNER */
403static inline void
404cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new)
405{
406}
407#endif /* CONFIG_MM_OWNER */
342#endif /* _LINUX_CGROUP_H */ 408#endif /* _LINUX_CGROUP_H */
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 1ddebfc52565..e2877454ec82 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -42,3 +42,9 @@ SUBSYS(mem_cgroup)
42#endif 42#endif
43 43
44/* */ 44/* */
45
46#ifdef CONFIG_CGROUP_DEVICE
47SUBSYS(devices)
48#endif
49
50/* */
diff --git a/include/linux/coda_fs_i.h b/include/linux/coda_fs_i.h
index 424fe9cf02c4..b3ef0c461578 100644
--- a/include/linux/coda_fs_i.h
+++ b/include/linux/coda_fs_i.h
@@ -8,7 +8,6 @@
8#ifndef _LINUX_CODA_FS_I 8#ifndef _LINUX_CODA_FS_I
9#define _LINUX_CODA_FS_I 9#define _LINUX_CODA_FS_I
10 10
11#ifdef __KERNEL__
12#include <linux/types.h> 11#include <linux/types.h>
13#include <linux/list.h> 12#include <linux/list.h>
14#include <linux/coda.h> 13#include <linux/coda.h>
@@ -52,4 +51,3 @@ struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb);
52void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); 51void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *);
53 52
54#endif 53#endif
55#endif
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index 1c47a34aa794..31b75311e2ca 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -43,9 +43,6 @@ int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
43int coda_setattr(struct dentry *, struct iattr *); 43int coda_setattr(struct dentry *, struct iattr *);
44 44
45/* this file: heloers */ 45/* this file: heloers */
46static __inline__ struct CodaFid *coda_i2f(struct inode *);
47static __inline__ char *coda_i2s(struct inode *);
48static __inline__ void coda_flag_inode(struct inode *, int flag);
49char *coda_f2s(struct CodaFid *f); 46char *coda_f2s(struct CodaFid *f);
50int coda_isroot(struct inode *i); 47int coda_isroot(struct inode *i);
51int coda_iscontrol(const char *name, size_t length); 48int coda_iscontrol(const char *name, size_t length);
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index b2fd7547b58d..5c8351b859f0 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -29,10 +29,11 @@
29 BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) 29 BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
30 30
31/* 31/*
32 * Force always-inline if the user requests it so via the .config: 32 * Force always-inline if the user requests it so via the .config,
33 * or if gcc is too old:
33 */ 34 */
34#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ 35#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
35 !defined(CONFIG_OPTIMIZE_INLINING) && (__GNUC__ >= 4) 36 !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
36# define inline inline __attribute__((always_inline)) 37# define inline inline __attribute__((always_inline))
37# define __inline__ __inline__ __attribute__((always_inline)) 38# define __inline__ __inline__ __attribute__((always_inline))
38# define __inline __inline __attribute__((always_inline)) 39# define __inline __inline __attribute__((always_inline))
diff --git a/include/linux/concap.h b/include/linux/concap.h
index 27304651d700..977acb3d1fb2 100644
--- a/include/linux/concap.h
+++ b/include/linux/concap.h
@@ -8,7 +8,7 @@
8 8
9#ifndef _LINUX_CONCAP_H 9#ifndef _LINUX_CONCAP_H
10#define _LINUX_CONCAP_H 10#define _LINUX_CONCAP_H
11#ifdef __KERNEL__ 11
12#include <linux/skbuff.h> 12#include <linux/skbuff.h>
13#include <linux/netdevice.h> 13#include <linux/netdevice.h>
14 14
@@ -110,4 +110,3 @@ extern int concap_nop(struct concap_proto *cprot);
110 */ 110 */
111extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb); 111extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb);
112#endif 112#endif
113#endif
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 4b287ad9371a..3ae65b1bf90f 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -35,8 +35,6 @@
35#ifndef _CONFIGFS_H_ 35#ifndef _CONFIGFS_H_
36#define _CONFIGFS_H_ 36#define _CONFIGFS_H_
37 37
38#ifdef __KERNEL__
39
40#include <linux/kernel.h> 38#include <linux/kernel.h>
41#include <linux/types.h> 39#include <linux/types.h>
42#include <linux/list.h> 40#include <linux/list.h>
@@ -194,6 +192,4 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
194int configfs_depend_item(struct configfs_subsystem *subsys, struct config_item *target); 192int configfs_depend_item(struct configfs_subsystem *subsys, struct config_item *target);
195void configfs_undepend_item(struct configfs_subsystem *subsys, struct config_item *target); 193void configfs_undepend_item(struct configfs_subsystem *subsys, struct config_item *target);
196 194
197#endif /* __KERNEL__ */
198
199#endif /* _CONFIGFS_H_ */ 195#endif /* _CONFIGFS_H_ */
diff --git a/include/linux/console.h b/include/linux/console.h
index a5f88a6a259d..a4f27fbdf549 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -91,6 +91,7 @@ void give_up_console(const struct consw *sw);
91#define CON_ENABLED (4) 91#define CON_ENABLED (4)
92#define CON_BOOT (8) 92#define CON_BOOT (8)
93#define CON_ANYTIME (16) /* Safe to call when cpu is offline */ 93#define CON_ANYTIME (16) /* Safe to call when cpu is offline */
94#define CON_BRL (32) /* Used for a braille device */
94 95
95struct console { 96struct console {
96 char name[16]; 97 char name[16];
@@ -121,6 +122,9 @@ extern struct tty_driver *console_device(int *);
121extern void console_stop(struct console *); 122extern void console_stop(struct console *);
122extern void console_start(struct console *); 123extern void console_start(struct console *);
123extern int is_console_locked(void); 124extern int is_console_locked(void);
125extern int braille_register_console(struct console *, int index,
126 char *console_options, char *braille_options);
127extern int braille_unregister_console(struct console *);
124 128
125extern int console_suspend_enabled; 129extern int console_suspend_enabled;
126 130
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index d71f7c0f931b..b03f80a078be 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -53,6 +53,7 @@ struct vc_data {
53 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ 53 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */
54 struct console_font vc_font; /* Current VC font set */ 54 struct console_font vc_font; /* Current VC font set */
55 unsigned short vc_video_erase_char; /* Background erase character */ 55 unsigned short vc_video_erase_char; /* Background erase character */
56 unsigned short vc_scrl_erase_char; /* Erase character for scroll */
56 /* VT terminal data */ 57 /* VT terminal data */
57 unsigned int vc_state; /* Escape sequence parser state */ 58 unsigned int vc_state; /* Escape sequence parser state */
58 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ 59 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index f212fa98283e..7464ba3b4333 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -108,7 +108,7 @@ static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
108extern void get_online_cpus(void); 108extern void get_online_cpus(void);
109extern void put_online_cpus(void); 109extern void put_online_cpus(void);
110#define hotcpu_notifier(fn, pri) { \ 110#define hotcpu_notifier(fn, pri) { \
111 static struct notifier_block fn##_nb = \ 111 static struct notifier_block fn##_nb __cpuinitdata = \
112 { .notifier_call = fn, .priority = pri }; \ 112 { .notifier_call = fn, .priority = pri }; \
113 register_cpu_notifier(&fn##_nb); \ 113 register_cpu_notifier(&fn##_nb); \
114} 114}
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index ddd8652fc3f3..e7e91dbfde0f 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -83,7 +83,8 @@ struct cpufreq_real_policy {
83}; 83};
84 84
85struct cpufreq_policy { 85struct cpufreq_policy {
86 cpumask_t cpus; /* affected CPUs */ 86 cpumask_t cpus; /* CPUs requiring sw coordination */
87 cpumask_t related_cpus; /* CPUs with any coordination */
87 unsigned int shared_type; /* ANY or ALL affected CPUs 88 unsigned int shared_type; /* ANY or ALL affected CPUs
88 should set cpufreq */ 89 should set cpufreq */
89 unsigned int cpu; /* cpu nr of registered CPU */ 90 unsigned int cpu; /* cpu nr of registered CPU */
@@ -307,6 +308,9 @@ extern struct cpufreq_governor cpufreq_gov_performance;
307#endif 308#endif
308#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE 309#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
309#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance) 310#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance)
311#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE)
312extern struct cpufreq_governor cpufreq_gov_powersave;
313#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_powersave)
310#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) 314#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE)
311extern struct cpufreq_governor cpufreq_gov_userspace; 315extern struct cpufreq_governor cpufreq_gov_userspace;
312#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace) 316#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace)
diff --git a/include/linux/crc-ccitt.h b/include/linux/crc-ccitt.h
index 90037617da8f..f52696a1ff0d 100644
--- a/include/linux/crc-ccitt.h
+++ b/include/linux/crc-ccitt.h
@@ -1,6 +1,5 @@
1#ifndef _LINUX_CRC_CCITT_H 1#ifndef _LINUX_CRC_CCITT_H
2#define _LINUX_CRC_CCITT_H 2#define _LINUX_CRC_CCITT_H
3#ifdef __KERNEL__
4 3
5#include <linux/types.h> 4#include <linux/types.h>
6 5
@@ -13,5 +12,4 @@ static inline u16 crc_ccitt_byte(u16 crc, const u8 c)
13 return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff]; 12 return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff];
14} 13}
15 14
16#endif /* __KERNEL__ */
17#endif /* _LINUX_CRC_CCITT_H */ 15#endif /* _LINUX_CRC_CCITT_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index cfb1627ac51c..2a6639407c80 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -1,8 +1,6 @@
1#ifndef __LINUX_DCACHE_H 1#ifndef __LINUX_DCACHE_H
2#define __LINUX_DCACHE_H 2#define __LINUX_DCACHE_H
3 3
4#ifdef __KERNEL__
5
6#include <asm/atomic.h> 4#include <asm/atomic.h>
7#include <linux/list.h> 5#include <linux/list.h>
8#include <linux/spinlock.h> 6#include <linux/spinlock.h>
@@ -365,6 +363,4 @@ extern struct dentry *lookup_create(struct nameidata *nd, int is_dir);
365 363
366extern int sysctl_vfs_cache_pressure; 364extern int sysctl_vfs_cache_pressure;
367 365
368#endif /* __KERNEL__ */
369
370#endif /* __LINUX_DCACHE_H */ 366#endif /* __LINUX_DCACHE_H */
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
new file mode 100644
index 000000000000..8c243aaa86a7
--- /dev/null
+++ b/include/linux/debugobjects.h
@@ -0,0 +1,90 @@
1#ifndef _LINUX_DEBUGOBJECTS_H
2#define _LINUX_DEBUGOBJECTS_H
3
4#include <linux/list.h>
5#include <linux/spinlock.h>
6
7enum debug_obj_state {
8 ODEBUG_STATE_NONE,
9 ODEBUG_STATE_INIT,
10 ODEBUG_STATE_INACTIVE,
11 ODEBUG_STATE_ACTIVE,
12 ODEBUG_STATE_DESTROYED,
13 ODEBUG_STATE_NOTAVAILABLE,
14 ODEBUG_STATE_MAX,
15};
16
17struct debug_obj_descr;
18
19/**
20 * struct debug_obj - representaion of an tracked object
21 * @node: hlist node to link the object into the tracker list
22 * @state: tracked object state
23 * @object: pointer to the real object
24 * @descr: pointer to an object type specific debug description structure
25 */
26struct debug_obj {
27 struct hlist_node node;
28 enum debug_obj_state state;
29 void *object;
30 struct debug_obj_descr *descr;
31};
32
33/**
34 * struct debug_obj_descr - object type specific debug description structure
35 * @name: name of the object typee
36 * @fixup_init: fixup function, which is called when the init check
37 * fails
38 * @fixup_activate: fixup function, which is called when the activate check
39 * fails
40 * @fixup_destroy: fixup function, which is called when the destroy check
41 * fails
42 * @fixup_free: fixup function, which is called when the free check
43 * fails
44 */
45struct debug_obj_descr {
46 const char *name;
47
48 int (*fixup_init) (void *addr, enum debug_obj_state state);
49 int (*fixup_activate) (void *addr, enum debug_obj_state state);
50 int (*fixup_destroy) (void *addr, enum debug_obj_state state);
51 int (*fixup_free) (void *addr, enum debug_obj_state state);
52};
53
54#ifdef CONFIG_DEBUG_OBJECTS
55extern void debug_object_init (void *addr, struct debug_obj_descr *descr);
56extern void
57debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr);
58extern void debug_object_activate (void *addr, struct debug_obj_descr *descr);
59extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
60extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
61extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
62
63extern void debug_objects_early_init(void);
64extern void debug_objects_mem_init(void);
65#else
66static inline void
67debug_object_init (void *addr, struct debug_obj_descr *descr) { }
68static inline void
69debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr) { }
70static inline void
71debug_object_activate (void *addr, struct debug_obj_descr *descr) { }
72static inline void
73debug_object_deactivate(void *addr, struct debug_obj_descr *descr) { }
74static inline void
75debug_object_destroy (void *addr, struct debug_obj_descr *descr) { }
76static inline void
77debug_object_free (void *addr, struct debug_obj_descr *descr) { }
78
79static inline void debug_objects_early_init(void) { }
80static inline void debug_objects_mem_init(void) { }
81#endif
82
83#ifdef CONFIG_DEBUG_OBJECTS_FREE
84extern void debug_check_no_obj_freed(const void *address, unsigned long size);
85#else
86static inline void
87debug_check_no_obj_freed(const void *address, unsigned long size) { }
88#endif
89
90#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index ad3b787479a4..0d8d419d191a 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -8,8 +8,6 @@
8#ifndef _LINUX_DEVICE_MAPPER_H 8#ifndef _LINUX_DEVICE_MAPPER_H
9#define _LINUX_DEVICE_MAPPER_H 9#define _LINUX_DEVICE_MAPPER_H
10 10
11#ifdef __KERNEL__
12
13#include <linux/bio.h> 11#include <linux/bio.h>
14 12
15struct dm_target; 13struct dm_target;
@@ -344,5 +342,4 @@ static inline unsigned long to_bytes(sector_t n)
344 return (n << SECTOR_SHIFT); 342 return (n << SECTOR_SHIFT);
345} 343}
346 344
347#endif /* __KERNEL__ */
348#endif /* _LINUX_DEVICE_MAPPER_H */ 345#endif /* _LINUX_DEVICE_MAPPER_H */
diff --git a/include/linux/device_cgroup.h b/include/linux/device_cgroup.h
new file mode 100644
index 000000000000..0b0d9c39ed67
--- /dev/null
+++ b/include/linux/device_cgroup.h
@@ -0,0 +1,12 @@
1#include <linux/module.h>
2#include <linux/fs.h>
3
4#ifdef CONFIG_CGROUP_DEVICE
5extern int devcgroup_inode_permission(struct inode *inode, int mask);
6extern int devcgroup_inode_mknod(int mode, dev_t dev);
7#else
8static inline int devcgroup_inode_permission(struct inode *inode, int mask)
9{ return 0; }
10static inline int devcgroup_inode_mknod(int mode, dev_t dev)
11{ return 0; }
12#endif
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h
index b672ddc00735..154769cad3f3 100644
--- a/include/linux/devpts_fs.h
+++ b/include/linux/devpts_fs.h
@@ -17,6 +17,8 @@
17 17
18#ifdef CONFIG_UNIX98_PTYS 18#ifdef CONFIG_UNIX98_PTYS
19 19
20int devpts_new_index(void);
21void devpts_kill_index(int idx);
20int devpts_pty_new(struct tty_struct *tty); /* mknod in devpts */ 22int devpts_pty_new(struct tty_struct *tty); /* mknod in devpts */
21struct tty_struct *devpts_get_tty(int number); /* get tty structure */ 23struct tty_struct *devpts_get_tty(int number); /* get tty structure */
22void devpts_pty_kill(int number); /* unlink */ 24void devpts_pty_kill(int number); /* unlink */
@@ -24,6 +26,8 @@ void devpts_pty_kill(int number); /* unlink */
24#else 26#else
25 27
26/* Dummy stubs in the no-pty case */ 28/* Dummy stubs in the no-pty case */
29static inline int devpts_new_index(void) { return -EINVAL; }
30static inline void devpts_kill_index(int idx) { }
27static inline int devpts_pty_new(struct tty_struct *tty) { return -EINVAL; } 31static inline int devpts_pty_new(struct tty_struct *tty) { return -EINVAL; }
28static inline struct tty_struct *devpts_get_tty(int number) { return NULL; } 32static inline struct tty_struct *devpts_get_tty(int number) { return NULL; }
29static inline void devpts_pty_kill(int number) { } 33static inline void devpts_pty_kill(int number) { }
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
new file mode 100644
index 000000000000..1677e2bfa00c
--- /dev/null
+++ b/include/linux/dma-attrs.h
@@ -0,0 +1,74 @@
1#ifndef _DMA_ATTR_H
2#define _DMA_ATTR_H
3
4#include <linux/bitmap.h>
5#include <linux/bitops.h>
6#include <linux/bug.h>
7
8/**
9 * an enum dma_attr represents an attribute associated with a DMA
10 * mapping. The semantics of each attribute should be defined in
11 * Documentation/DMA-attributes.txt.
12 */
13enum dma_attr {
14 DMA_ATTR_WRITE_BARRIER,
15 DMA_ATTR_MAX,
16};
17
18#define __DMA_ATTRS_LONGS BITS_TO_LONGS(DMA_ATTR_MAX)
19
20/**
21 * struct dma_attrs - an opaque container for DMA attributes
22 * @flags - bitmask representing a collection of enum dma_attr
23 */
24struct dma_attrs {
25 unsigned long flags[__DMA_ATTRS_LONGS];
26};
27
28#define DEFINE_DMA_ATTRS(x) \
29 struct dma_attrs x = { \
30 .flags = { [0 ... __DMA_ATTRS_LONGS-1] = 0 }, \
31 }
32
33static inline void init_dma_attrs(struct dma_attrs *attrs)
34{
35 bitmap_zero(attrs->flags, __DMA_ATTRS_LONGS);
36}
37
38#ifdef CONFIG_HAVE_DMA_ATTRS
39/**
40 * dma_set_attr - set a specific attribute
41 * @attr: attribute to set
42 * @attrs: struct dma_attrs (may be NULL)
43 */
44static inline void dma_set_attr(enum dma_attr attr, struct dma_attrs *attrs)
45{
46 if (attrs == NULL)
47 return;
48 BUG_ON(attr >= DMA_ATTR_MAX);
49 __set_bit(attr, attrs->flags);
50}
51
52/**
53 * dma_get_attr - check for a specific attribute
54 * @attr: attribute to set
55 * @attrs: struct dma_attrs (may be NULL)
56 */
57static inline int dma_get_attr(enum dma_attr attr, struct dma_attrs *attrs)
58{
59 if (attrs == NULL)
60 return 0;
61 BUG_ON(attr >= DMA_ATTR_MAX);
62 return test_bit(attr, attrs->flags);
63}
64#else /* !CONFIG_HAVE_DMA_ATTRS */
65static inline void dma_set_attr(enum dma_attr attr, struct dma_attrs *attrs)
66{
67}
68
69static inline int dma_get_attr(enum dma_attr attr, struct dma_attrs *attrs)
70{
71 return 0;
72}
73#endif /* CONFIG_HAVE_DMA_ATTRS */
74#endif /* _DMA_ATTR_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 332030709623..952e0f857ac9 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -146,4 +146,21 @@ static inline void dmam_release_declared_memory(struct device *dev)
146} 146}
147#endif /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */ 147#endif /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */
148 148
149#ifndef CONFIG_HAVE_DMA_ATTRS
150struct dma_attrs;
151
152#define dma_map_single_attrs(dev, cpu_addr, size, dir, attrs) \
153 dma_map_single(dev, cpu_addr, size, dir)
154
155#define dma_unmap_single_attrs(dev, dma_addr, size, dir, attrs) \
156 dma_unmap_single(dev, dma_addr, size, dir)
157
158#define dma_map_sg_attrs(dev, sgl, nents, dir, attrs) \
159 dma_map_sg(dev, sgl, nents, dir)
160
161#define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
162 dma_unmap_sg(dev, sgl, nents, dir)
163
164#endif /* CONFIG_HAVE_DMA_ATTRS */
165
149#endif 166#endif
diff --git a/include/linux/edac.h b/include/linux/edac.h
index eab451e69a91..7cf92e8a4196 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Author: Dave Jiang <djiang@mvista.com> 4 * Author: Dave Jiang <djiang@mvista.com>
5 * 5 *
6 * 2006-2007 (c) MontaVista Software, Inc. This file is licensed under 6 * 2006-2008 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program 7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express 8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied. 9 * or implied.
@@ -26,4 +26,16 @@ extern atomic_t edac_handlers;
26extern int edac_handler_set(void); 26extern int edac_handler_set(void);
27extern void edac_atomic_assert_error(void); 27extern void edac_atomic_assert_error(void);
28 28
29static inline void opstate_init(void)
30{
31 switch (edac_op_state) {
32 case EDAC_OPSTATE_POLL:
33 case EDAC_OPSTATE_NMI:
34 break;
35 default:
36 edac_op_state = EDAC_OPSTATE_POLL;
37 }
38 return;
39}
40
29#endif 41#endif
diff --git a/include/linux/elf.h b/include/linux/elf.h
index bad1b16ec49a..ff9fbed90123 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -208,7 +208,7 @@ typedef struct elf32_hdr{
208} Elf32_Ehdr; 208} Elf32_Ehdr;
209 209
210typedef struct elf64_hdr { 210typedef struct elf64_hdr {
211 unsigned char e_ident[16]; /* ELF "magic number" */ 211 unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
212 Elf64_Half e_type; 212 Elf64_Half e_type;
213 Elf64_Half e_machine; 213 Elf64_Half e_machine;
214 Elf64_Word e_version; 214 Elf64_Word e_version;
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index b489fc6d0b62..a701399b7fed 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -8,9 +8,6 @@
8#ifndef _LINUX_EVENTFD_H 8#ifndef _LINUX_EVENTFD_H
9#define _LINUX_EVENTFD_H 9#define _LINUX_EVENTFD_H
10 10
11
12#ifdef __KERNEL__
13
14#ifdef CONFIG_EVENTFD 11#ifdef CONFIG_EVENTFD
15 12
16struct file *eventfd_fget(int fd); 13struct file *eventfd_fget(int fd);
@@ -24,7 +21,5 @@ static inline int eventfd_signal(struct file *file, int n)
24 21
25#endif /* CONFIG_EVENTFD */ 22#endif /* CONFIG_EVENTFD */
26 23
27#endif /* __KERNEL__ */
28
29#endif /* _LINUX_EVENTFD_H */ 24#endif /* _LINUX_EVENTFD_H */
30 25
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
deleted file mode 100644
index 250032548597..000000000000
--- a/include/linux/ext4_fs.h
+++ /dev/null
@@ -1,1207 +0,0 @@
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#include <linux/ext4_fs_i.h>
24
25/*
26 * The second extended filesystem constants/structures
27 */
28
29/*
30 * Define EXT4FS_DEBUG to produce debug messages
31 */
32#undef EXT4FS_DEBUG
33
34/*
35 * Define EXT4_RESERVATION to reserve data blocks for expanding files
36 */
37#define EXT4_DEFAULT_RESERVE_BLOCKS 8
38/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
39#define EXT4_MAX_RESERVE_BLOCKS 1027
40#define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0
41
42/*
43 * Debug code
44 */
45#ifdef EXT4FS_DEBUG
46#define ext4_debug(f, a...) \
47 do { \
48 printk (KERN_DEBUG "EXT4-fs DEBUG (%s, %d): %s:", \
49 __FILE__, __LINE__, __FUNCTION__); \
50 printk (KERN_DEBUG f, ## a); \
51 } while (0)
52#else
53#define ext4_debug(f, a...) do {} while (0)
54#endif
55
56#define EXT4_MULTIBLOCK_ALLOCATOR 1
57
58/* prefer goal again. length */
59#define EXT4_MB_HINT_MERGE 1
60/* blocks already reserved */
61#define EXT4_MB_HINT_RESERVED 2
62/* metadata is being allocated */
63#define EXT4_MB_HINT_METADATA 4
64/* first blocks in the file */
65#define EXT4_MB_HINT_FIRST 8
66/* search for the best chunk */
67#define EXT4_MB_HINT_BEST 16
68/* data is being allocated */
69#define EXT4_MB_HINT_DATA 32
70/* don't preallocate (for tails) */
71#define EXT4_MB_HINT_NOPREALLOC 64
72/* allocate for locality group */
73#define EXT4_MB_HINT_GROUP_ALLOC 128
74/* allocate goal blocks or none */
75#define EXT4_MB_HINT_GOAL_ONLY 256
76/* goal is meaningful */
77#define EXT4_MB_HINT_TRY_GOAL 512
78
79struct ext4_allocation_request {
80 /* target inode for block we're allocating */
81 struct inode *inode;
82 /* logical block in target inode */
83 ext4_lblk_t logical;
84 /* phys. target (a hint) */
85 ext4_fsblk_t goal;
86 /* the closest logical allocated block to the left */
87 ext4_lblk_t lleft;
88 /* phys. block for ^^^ */
89 ext4_fsblk_t pleft;
90 /* the closest logical allocated block to the right */
91 ext4_lblk_t lright;
92 /* phys. block for ^^^ */
93 ext4_fsblk_t pright;
94 /* how many blocks we want to allocate */
95 unsigned long len;
96 /* flags. see above EXT4_MB_HINT_* */
97 unsigned long flags;
98};
99
100/*
101 * Special inodes numbers
102 */
103#define EXT4_BAD_INO 1 /* Bad blocks inode */
104#define EXT4_ROOT_INO 2 /* Root inode */
105#define EXT4_BOOT_LOADER_INO 5 /* Boot loader inode */
106#define EXT4_UNDEL_DIR_INO 6 /* Undelete directory inode */
107#define EXT4_RESIZE_INO 7 /* Reserved group descriptors inode */
108#define EXT4_JOURNAL_INO 8 /* Journal inode */
109
110/* First non-reserved inode for old ext4 filesystems */
111#define EXT4_GOOD_OLD_FIRST_INO 11
112
113/*
114 * Maximal count of links to a file
115 */
116#define EXT4_LINK_MAX 65000
117
118/*
119 * Macro-instructions used to manage several block sizes
120 */
121#define EXT4_MIN_BLOCK_SIZE 1024
122#define EXT4_MAX_BLOCK_SIZE 65536
123#define EXT4_MIN_BLOCK_LOG_SIZE 10
124#ifdef __KERNEL__
125# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize)
126#else
127# define EXT4_BLOCK_SIZE(s) (EXT4_MIN_BLOCK_SIZE << (s)->s_log_block_size)
128#endif
129#define EXT4_ADDR_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / sizeof (__u32))
130#ifdef __KERNEL__
131# define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
132#else
133# define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
134#endif
135#ifdef __KERNEL__
136#define EXT4_ADDR_PER_BLOCK_BITS(s) (EXT4_SB(s)->s_addr_per_block_bits)
137#define EXT4_INODE_SIZE(s) (EXT4_SB(s)->s_inode_size)
138#define EXT4_FIRST_INO(s) (EXT4_SB(s)->s_first_ino)
139#else
140#define EXT4_INODE_SIZE(s) (((s)->s_rev_level == EXT4_GOOD_OLD_REV) ? \
141 EXT4_GOOD_OLD_INODE_SIZE : \
142 (s)->s_inode_size)
143#define EXT4_FIRST_INO(s) (((s)->s_rev_level == EXT4_GOOD_OLD_REV) ? \
144 EXT4_GOOD_OLD_FIRST_INO : \
145 (s)->s_first_ino)
146#endif
147#define EXT4_BLOCK_ALIGN(size, blkbits) ALIGN((size), (1 << (blkbits)))
148
149/*
150 * Structure of a blocks group descriptor
151 */
152struct ext4_group_desc
153{
154 __le32 bg_block_bitmap_lo; /* Blocks bitmap block */
155 __le32 bg_inode_bitmap_lo; /* Inodes bitmap block */
156 __le32 bg_inode_table_lo; /* Inodes table block */
157 __le16 bg_free_blocks_count; /* Free blocks count */
158 __le16 bg_free_inodes_count; /* Free inodes count */
159 __le16 bg_used_dirs_count; /* Directories count */
160 __le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */
161 __u32 bg_reserved[2]; /* Likely block/inode bitmap checksum */
162 __le16 bg_itable_unused; /* Unused inodes count */
163 __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */
164 __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
165 __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
166 __le32 bg_inode_table_hi; /* Inodes table block MSB */
167 __le16 bg_free_blocks_count_hi;/* Free blocks count MSB */
168 __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */
169 __le16 bg_used_dirs_count_hi; /* Directories count MSB */
170 __le16 bg_itable_unused_hi; /* Unused inodes count MSB */
171 __u32 bg_reserved2[3];
172};
173
174#define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */
175#define EXT4_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */
176#define EXT4_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */
177
178#ifdef __KERNEL__
179#include <linux/ext4_fs_i.h>
180#include <linux/ext4_fs_sb.h>
181#endif
182/*
183 * Macro-instructions used to manage group descriptors
184 */
185#define EXT4_MIN_DESC_SIZE 32
186#define EXT4_MIN_DESC_SIZE_64BIT 64
187#define EXT4_MAX_DESC_SIZE EXT4_MIN_BLOCK_SIZE
188#define EXT4_DESC_SIZE(s) (EXT4_SB(s)->s_desc_size)
189#ifdef __KERNEL__
190# define EXT4_BLOCKS_PER_GROUP(s) (EXT4_SB(s)->s_blocks_per_group)
191# define EXT4_DESC_PER_BLOCK(s) (EXT4_SB(s)->s_desc_per_block)
192# define EXT4_INODES_PER_GROUP(s) (EXT4_SB(s)->s_inodes_per_group)
193# define EXT4_DESC_PER_BLOCK_BITS(s) (EXT4_SB(s)->s_desc_per_block_bits)
194#else
195# define EXT4_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
196# define EXT4_DESC_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / EXT4_DESC_SIZE(s))
197# define EXT4_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
198#endif
199
200/*
201 * Constants relative to the data blocks
202 */
203#define EXT4_NDIR_BLOCKS 12
204#define EXT4_IND_BLOCK EXT4_NDIR_BLOCKS
205#define EXT4_DIND_BLOCK (EXT4_IND_BLOCK + 1)
206#define EXT4_TIND_BLOCK (EXT4_DIND_BLOCK + 1)
207#define EXT4_N_BLOCKS (EXT4_TIND_BLOCK + 1)
208
209/*
210 * Inode flags
211 */
212#define EXT4_SECRM_FL 0x00000001 /* Secure deletion */
213#define EXT4_UNRM_FL 0x00000002 /* Undelete */
214#define EXT4_COMPR_FL 0x00000004 /* Compress file */
215#define EXT4_SYNC_FL 0x00000008 /* Synchronous updates */
216#define EXT4_IMMUTABLE_FL 0x00000010 /* Immutable file */
217#define EXT4_APPEND_FL 0x00000020 /* writes to file may only append */
218#define EXT4_NODUMP_FL 0x00000040 /* do not dump file */
219#define EXT4_NOATIME_FL 0x00000080 /* do not update atime */
220/* Reserved for compression usage... */
221#define EXT4_DIRTY_FL 0x00000100
222#define EXT4_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
223#define EXT4_NOCOMPR_FL 0x00000400 /* Don't compress */
224#define EXT4_ECOMPR_FL 0x00000800 /* Compression error */
225/* End compression flags --- maybe not all used */
226#define EXT4_INDEX_FL 0x00001000 /* hash-indexed directory */
227#define EXT4_IMAGIC_FL 0x00002000 /* AFS directory */
228#define EXT4_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
229#define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */
230#define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
231#define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
232#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
233#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
234#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
235
236#define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */
237#define EXT4_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
238
239/*
240 * Inode dynamic state flags
241 */
242#define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */
243#define EXT4_STATE_NEW 0x00000002 /* inode is newly created */
244#define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */
245#define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */
246
247/* Used to pass group descriptor data when online resize is done */
248struct ext4_new_group_input {
249 __u32 group; /* Group number for this data */
250 __u64 block_bitmap; /* Absolute block number of block bitmap */
251 __u64 inode_bitmap; /* Absolute block number of inode bitmap */
252 __u64 inode_table; /* Absolute block number of inode table start */
253 __u32 blocks_count; /* Total number of blocks in this group */
254 __u16 reserved_blocks; /* Number of reserved blocks in this group */
255 __u16 unused;
256};
257
258/* The struct ext4_new_group_input in kernel space, with free_blocks_count */
259struct ext4_new_group_data {
260 __u32 group;
261 __u64 block_bitmap;
262 __u64 inode_bitmap;
263 __u64 inode_table;
264 __u32 blocks_count;
265 __u16 reserved_blocks;
266 __u16 unused;
267 __u32 free_blocks_count;
268};
269
270/*
271 * Following is used by preallocation code to tell get_blocks() that we
272 * want uninitialzed extents.
273 */
274#define EXT4_CREATE_UNINITIALIZED_EXT 2
275
276/*
277 * ioctl commands
278 */
279#define EXT4_IOC_GETFLAGS FS_IOC_GETFLAGS
280#define EXT4_IOC_SETFLAGS FS_IOC_SETFLAGS
281#define EXT4_IOC_GETVERSION _IOR('f', 3, long)
282#define EXT4_IOC_SETVERSION _IOW('f', 4, long)
283#define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
284#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input)
285#define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION
286#define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION
287#ifdef CONFIG_JBD2_DEBUG
288#define EXT4_IOC_WAIT_FOR_READONLY _IOR('f', 99, long)
289#endif
290#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long)
291#define EXT4_IOC_SETRSVSZ _IOW('f', 6, long)
292#define EXT4_IOC_MIGRATE _IO('f', 7)
293
294/*
295 * ioctl commands in 32 bit emulation
296 */
297#define EXT4_IOC32_GETFLAGS FS_IOC32_GETFLAGS
298#define EXT4_IOC32_SETFLAGS FS_IOC32_SETFLAGS
299#define EXT4_IOC32_GETVERSION _IOR('f', 3, int)
300#define EXT4_IOC32_SETVERSION _IOW('f', 4, int)
301#define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int)
302#define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int)
303#define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
304#ifdef CONFIG_JBD2_DEBUG
305#define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
306#endif
307#define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
308#define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
309
310
311/*
312 * Mount options
313 */
314struct ext4_mount_options {
315 unsigned long s_mount_opt;
316 uid_t s_resuid;
317 gid_t s_resgid;
318 unsigned long s_commit_interval;
319#ifdef CONFIG_QUOTA
320 int s_jquota_fmt;
321 char *s_qf_names[MAXQUOTAS];
322#endif
323};
324
325/*
326 * Structure of an inode on the disk
327 */
328struct ext4_inode {
329 __le16 i_mode; /* File mode */
330 __le16 i_uid; /* Low 16 bits of Owner Uid */
331 __le32 i_size_lo; /* Size in bytes */
332 __le32 i_atime; /* Access time */
333 __le32 i_ctime; /* Inode Change time */
334 __le32 i_mtime; /* Modification time */
335 __le32 i_dtime; /* Deletion Time */
336 __le16 i_gid; /* Low 16 bits of Group Id */
337 __le16 i_links_count; /* Links count */
338 __le32 i_blocks_lo; /* Blocks count */
339 __le32 i_flags; /* File flags */
340 union {
341 struct {
342 __le32 l_i_version;
343 } linux1;
344 struct {
345 __u32 h_i_translator;
346 } hurd1;
347 struct {
348 __u32 m_i_reserved1;
349 } masix1;
350 } osd1; /* OS dependent 1 */
351 __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */
352 __le32 i_generation; /* File version (for NFS) */
353 __le32 i_file_acl_lo; /* File ACL */
354 __le32 i_size_high;
355 __le32 i_obso_faddr; /* Obsoleted fragment address */
356 union {
357 struct {
358 __le16 l_i_blocks_high; /* were l_i_reserved1 */
359 __le16 l_i_file_acl_high;
360 __le16 l_i_uid_high; /* these 2 fields */
361 __le16 l_i_gid_high; /* were reserved2[0] */
362 __u32 l_i_reserved2;
363 } linux2;
364 struct {
365 __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
366 __u16 h_i_mode_high;
367 __u16 h_i_uid_high;
368 __u16 h_i_gid_high;
369 __u32 h_i_author;
370 } hurd2;
371 struct {
372 __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
373 __le16 m_i_file_acl_high;
374 __u32 m_i_reserved2[2];
375 } masix2;
376 } osd2; /* OS dependent 2 */
377 __le16 i_extra_isize;
378 __le16 i_pad1;
379 __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
380 __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
381 __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
382 __le32 i_crtime; /* File Creation time */
383 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
384 __le32 i_version_hi; /* high 32 bits for 64-bit version */
385};
386
387
388#define EXT4_EPOCH_BITS 2
389#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
390#define EXT4_NSEC_MASK (~0UL << EXT4_EPOCH_BITS)
391
392/*
393 * Extended fields will fit into an inode if the filesystem was formatted
394 * with large inodes (-I 256 or larger) and there are not currently any EAs
395 * consuming all of the available space. For new inodes we always reserve
396 * enough space for the kernel's known extended fields, but for inodes
397 * created with an old kernel this might not have been the case. None of
398 * the extended inode fields is critical for correct filesystem operation.
399 * This macro checks if a certain field fits in the inode. Note that
400 * inode-size = GOOD_OLD_INODE_SIZE + i_extra_isize
401 */
402#define EXT4_FITS_IN_INODE(ext4_inode, einode, field) \
403 ((offsetof(typeof(*ext4_inode), field) + \
404 sizeof((ext4_inode)->field)) \
405 <= (EXT4_GOOD_OLD_INODE_SIZE + \
406 (einode)->i_extra_isize)) \
407
408static inline __le32 ext4_encode_extra_time(struct timespec *time)
409{
410 return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
411 time->tv_sec >> 32 : 0) |
412 ((time->tv_nsec << 2) & EXT4_NSEC_MASK));
413}
414
415static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra)
416{
417 if (sizeof(time->tv_sec) > 4)
418 time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK)
419 << 32;
420 time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> 2;
421}
422
423#define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \
424do { \
425 (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
426 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \
427 (raw_inode)->xtime ## _extra = \
428 ext4_encode_extra_time(&(inode)->xtime); \
429} while (0)
430
431#define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \
432do { \
433 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
434 (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \
435 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
436 (raw_inode)->xtime ## _extra = \
437 ext4_encode_extra_time(&(einode)->xtime); \
438} while (0)
439
440#define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode) \
441do { \
442 (inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime); \
443 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \
444 ext4_decode_extra_time(&(inode)->xtime, \
445 raw_inode->xtime ## _extra); \
446} while (0)
447
448#define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \
449do { \
450 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
451 (einode)->xtime.tv_sec = \
452 (signed)le32_to_cpu((raw_inode)->xtime); \
453 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
454 ext4_decode_extra_time(&(einode)->xtime, \
455 raw_inode->xtime ## _extra); \
456} while (0)
457
458#define i_disk_version osd1.linux1.l_i_version
459
460#if defined(__KERNEL__) || defined(__linux__)
461#define i_reserved1 osd1.linux1.l_i_reserved1
462#define i_file_acl_high osd2.linux2.l_i_file_acl_high
463#define i_blocks_high osd2.linux2.l_i_blocks_high
464#define i_uid_low i_uid
465#define i_gid_low i_gid
466#define i_uid_high osd2.linux2.l_i_uid_high
467#define i_gid_high osd2.linux2.l_i_gid_high
468#define i_reserved2 osd2.linux2.l_i_reserved2
469
470#elif defined(__GNU__)
471
472#define i_translator osd1.hurd1.h_i_translator
473#define i_uid_high osd2.hurd2.h_i_uid_high
474#define i_gid_high osd2.hurd2.h_i_gid_high
475#define i_author osd2.hurd2.h_i_author
476
477#elif defined(__masix__)
478
479#define i_reserved1 osd1.masix1.m_i_reserved1
480#define i_file_acl_high osd2.masix2.m_i_file_acl_high
481#define i_reserved2 osd2.masix2.m_i_reserved2
482
483#endif /* defined(__KERNEL__) || defined(__linux__) */
484
485/*
486 * File system states
487 */
488#define EXT4_VALID_FS 0x0001 /* Unmounted cleanly */
489#define EXT4_ERROR_FS 0x0002 /* Errors detected */
490#define EXT4_ORPHAN_FS 0x0004 /* Orphans being recovered */
491
492/*
493 * Misc. filesystem flags
494 */
495#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
496#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
497#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */
498
499/*
500 * Mount flags
501 */
502#define EXT4_MOUNT_CHECK 0x00001 /* Do mount-time checks */
503#define EXT4_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */
504#define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */
505#define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */
506#define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
507#define EXT4_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */
508#define EXT4_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */
509#define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */
510#define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/
511#define EXT4_MOUNT_ABORT 0x00200 /* Fatal error detected */
512#define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */
513#define EXT4_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */
514#define EXT4_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */
515#define EXT4_MOUNT_WRITEBACK_DATA 0x00C00 /* No data ordering */
516#define EXT4_MOUNT_UPDATE_JOURNAL 0x01000 /* Update the journal format */
517#define EXT4_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */
518#define EXT4_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */
519#define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
520#define EXT4_MOUNT_RESERVATION 0x10000 /* Preallocation */
521#define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */
522#define EXT4_MOUNT_NOBH 0x40000 /* No bufferheads */
523#define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
524#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
525#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
526#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */
527#define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
528#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
529#define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
530#define EXT4_MOUNT_MBALLOC 0x4000000 /* Buddy allocation support */
531/* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */
532#ifndef _LINUX_EXT2_FS_H
533#define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt
534#define set_opt(o, opt) o |= EXT4_MOUNT_##opt
535#define test_opt(sb, opt) (EXT4_SB(sb)->s_mount_opt & \
536 EXT4_MOUNT_##opt)
537#else
538#define EXT2_MOUNT_NOLOAD EXT4_MOUNT_NOLOAD
539#define EXT2_MOUNT_ABORT EXT4_MOUNT_ABORT
540#define EXT2_MOUNT_DATA_FLAGS EXT4_MOUNT_DATA_FLAGS
541#endif
542
543#define ext4_set_bit ext2_set_bit
544#define ext4_set_bit_atomic ext2_set_bit_atomic
545#define ext4_clear_bit ext2_clear_bit
546#define ext4_clear_bit_atomic ext2_clear_bit_atomic
547#define ext4_test_bit ext2_test_bit
548#define ext4_find_first_zero_bit ext2_find_first_zero_bit
549#define ext4_find_next_zero_bit ext2_find_next_zero_bit
550#define ext4_find_next_bit ext2_find_next_bit
551
552/*
553 * Maximal mount counts between two filesystem checks
554 */
555#define EXT4_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
556#define EXT4_DFL_CHECKINTERVAL 0 /* Don't use interval check */
557
558/*
559 * Behaviour when detecting errors
560 */
561#define EXT4_ERRORS_CONTINUE 1 /* Continue execution */
562#define EXT4_ERRORS_RO 2 /* Remount fs read-only */
563#define EXT4_ERRORS_PANIC 3 /* Panic */
564#define EXT4_ERRORS_DEFAULT EXT4_ERRORS_CONTINUE
565
566/*
567 * Structure of the super block
568 */
569struct ext4_super_block {
570/*00*/ __le32 s_inodes_count; /* Inodes count */
571 __le32 s_blocks_count_lo; /* Blocks count */
572 __le32 s_r_blocks_count_lo; /* Reserved blocks count */
573 __le32 s_free_blocks_count_lo; /* Free blocks count */
574/*10*/ __le32 s_free_inodes_count; /* Free inodes count */
575 __le32 s_first_data_block; /* First Data Block */
576 __le32 s_log_block_size; /* Block size */
577 __le32 s_obso_log_frag_size; /* Obsoleted fragment size */
578/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */
579 __le32 s_obso_frags_per_group; /* Obsoleted fragments per group */
580 __le32 s_inodes_per_group; /* # Inodes per group */
581 __le32 s_mtime; /* Mount time */
582/*30*/ __le32 s_wtime; /* Write time */
583 __le16 s_mnt_count; /* Mount count */
584 __le16 s_max_mnt_count; /* Maximal mount count */
585 __le16 s_magic; /* Magic signature */
586 __le16 s_state; /* File system state */
587 __le16 s_errors; /* Behaviour when detecting errors */
588 __le16 s_minor_rev_level; /* minor revision level */
589/*40*/ __le32 s_lastcheck; /* time of last check */
590 __le32 s_checkinterval; /* max. time between checks */
591 __le32 s_creator_os; /* OS */
592 __le32 s_rev_level; /* Revision level */
593/*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */
594 __le16 s_def_resgid; /* Default gid for reserved blocks */
595 /*
596 * These fields are for EXT4_DYNAMIC_REV superblocks only.
597 *
598 * Note: the difference between the compatible feature set and
599 * the incompatible feature set is that if there is a bit set
600 * in the incompatible feature set that the kernel doesn't
601 * know about, it should refuse to mount the filesystem.
602 *
603 * e2fsck's requirements are more strict; if it doesn't know
604 * about a feature in either the compatible or incompatible
605 * feature set, it must abort and not try to meddle with
606 * things it doesn't understand...
607 */
608 __le32 s_first_ino; /* First non-reserved inode */
609 __le16 s_inode_size; /* size of inode structure */
610 __le16 s_block_group_nr; /* block group # of this superblock */
611 __le32 s_feature_compat; /* compatible feature set */
612/*60*/ __le32 s_feature_incompat; /* incompatible feature set */
613 __le32 s_feature_ro_compat; /* readonly-compatible feature set */
614/*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
615/*78*/ char s_volume_name[16]; /* volume name */
616/*88*/ char s_last_mounted[64]; /* directory where last mounted */
617/*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */
618 /*
619 * Performance hints. Directory preallocation should only
620 * happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
621 */
622 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
623 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
624 __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
625 /*
626 * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
627 */
628/*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
629/*E0*/ __le32 s_journal_inum; /* inode number of journal file */
630 __le32 s_journal_dev; /* device number of journal file */
631 __le32 s_last_orphan; /* start of list of inodes to delete */
632 __le32 s_hash_seed[4]; /* HTREE hash seed */
633 __u8 s_def_hash_version; /* Default hash version to use */
634 __u8 s_reserved_char_pad;
635 __le16 s_desc_size; /* size of group descriptor */
636/*100*/ __le32 s_default_mount_opts;
637 __le32 s_first_meta_bg; /* First metablock block group */
638 __le32 s_mkfs_time; /* When the filesystem was created */
639 __le32 s_jnl_blocks[17]; /* Backup of the journal inode */
640 /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
641/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
642 __le32 s_r_blocks_count_hi; /* Reserved blocks count */
643 __le32 s_free_blocks_count_hi; /* Free blocks count */
644 __le16 s_min_extra_isize; /* All inodes have at least # bytes */
645 __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
646 __le32 s_flags; /* Miscellaneous flags */
647 __le16 s_raid_stride; /* RAID stride */
648 __le16 s_mmp_interval; /* # seconds to wait in MMP checking */
649 __le64 s_mmp_block; /* Block for multi-mount protection */
650 __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
651 __u32 s_reserved[163]; /* Padding to the end of the block */
652};
653
654#ifdef __KERNEL__
655static inline struct ext4_sb_info * EXT4_SB(struct super_block *sb)
656{
657 return sb->s_fs_info;
658}
659static inline struct ext4_inode_info *EXT4_I(struct inode *inode)
660{
661 return container_of(inode, struct ext4_inode_info, vfs_inode);
662}
663
664static inline struct timespec ext4_current_time(struct inode *inode)
665{
666 return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
667 current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
668}
669
670
671static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
672{
673 return ino == EXT4_ROOT_INO ||
674 ino == EXT4_JOURNAL_INO ||
675 ino == EXT4_RESIZE_INO ||
676 (ino >= EXT4_FIRST_INO(sb) &&
677 ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count));
678}
679#else
680/* Assume that user mode programs are passing in an ext4fs superblock, not
681 * a kernel struct super_block. This will allow us to call the feature-test
682 * macros from user land. */
683#define EXT4_SB(sb) (sb)
684#endif
685
686#define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
687
688/*
689 * Codes for operating systems
690 */
691#define EXT4_OS_LINUX 0
692#define EXT4_OS_HURD 1
693#define EXT4_OS_MASIX 2
694#define EXT4_OS_FREEBSD 3
695#define EXT4_OS_LITES 4
696
697/*
698 * Revision levels
699 */
700#define EXT4_GOOD_OLD_REV 0 /* The good old (original) format */
701#define EXT4_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
702
703#define EXT4_CURRENT_REV EXT4_GOOD_OLD_REV
704#define EXT4_MAX_SUPP_REV EXT4_DYNAMIC_REV
705
706#define EXT4_GOOD_OLD_INODE_SIZE 128
707
708/*
709 * Feature set definitions
710 */
711
712#define EXT4_HAS_COMPAT_FEATURE(sb,mask) \
713 ( EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
714#define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \
715 ( EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
716#define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \
717 ( EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
718#define EXT4_SET_COMPAT_FEATURE(sb,mask) \
719 EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
720#define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \
721 EXT4_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
722#define EXT4_SET_INCOMPAT_FEATURE(sb,mask) \
723 EXT4_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
724#define EXT4_CLEAR_COMPAT_FEATURE(sb,mask) \
725 EXT4_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
726#define EXT4_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
727 EXT4_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
728#define EXT4_CLEAR_INCOMPAT_FEATURE(sb,mask) \
729 EXT4_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
730
731#define EXT4_FEATURE_COMPAT_DIR_PREALLOC 0x0001
732#define EXT4_FEATURE_COMPAT_IMAGIC_INODES 0x0002
733#define EXT4_FEATURE_COMPAT_HAS_JOURNAL 0x0004
734#define EXT4_FEATURE_COMPAT_EXT_ATTR 0x0008
735#define EXT4_FEATURE_COMPAT_RESIZE_INODE 0x0010
736#define EXT4_FEATURE_COMPAT_DIR_INDEX 0x0020
737
738#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
739#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
740#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
741#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
742#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
743#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
744#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
745
746#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001
747#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002
748#define EXT4_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
749#define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
750#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010
751#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
752#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
753#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
754#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
755
756#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
757#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \
758 EXT4_FEATURE_INCOMPAT_RECOVER| \
759 EXT4_FEATURE_INCOMPAT_META_BG| \
760 EXT4_FEATURE_INCOMPAT_EXTENTS| \
761 EXT4_FEATURE_INCOMPAT_64BIT| \
762 EXT4_FEATURE_INCOMPAT_FLEX_BG)
763#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
764 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
765 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
766 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
767 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
768 EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\
769 EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
770
771/*
772 * Default values for user and/or group using reserved blocks
773 */
774#define EXT4_DEF_RESUID 0
775#define EXT4_DEF_RESGID 0
776
777/*
778 * Default mount options
779 */
780#define EXT4_DEFM_DEBUG 0x0001
781#define EXT4_DEFM_BSDGROUPS 0x0002
782#define EXT4_DEFM_XATTR_USER 0x0004
783#define EXT4_DEFM_ACL 0x0008
784#define EXT4_DEFM_UID16 0x0010
785#define EXT4_DEFM_JMODE 0x0060
786#define EXT4_DEFM_JMODE_DATA 0x0020
787#define EXT4_DEFM_JMODE_ORDERED 0x0040
788#define EXT4_DEFM_JMODE_WBACK 0x0060
789
790/*
791 * Structure of a directory entry
792 */
793#define EXT4_NAME_LEN 255
794
795struct ext4_dir_entry {
796 __le32 inode; /* Inode number */
797 __le16 rec_len; /* Directory entry length */
798 __le16 name_len; /* Name length */
799 char name[EXT4_NAME_LEN]; /* File name */
800};
801
802/*
803 * The new version of the directory entry. Since EXT4 structures are
804 * stored in intel byte order, and the name_len field could never be
805 * bigger than 255 chars, it's safe to reclaim the extra byte for the
806 * file_type field.
807 */
808struct ext4_dir_entry_2 {
809 __le32 inode; /* Inode number */
810 __le16 rec_len; /* Directory entry length */
811 __u8 name_len; /* Name length */
812 __u8 file_type;
813 char name[EXT4_NAME_LEN]; /* File name */
814};
815
816/*
817 * Ext4 directory file types. Only the low 3 bits are used. The
818 * other bits are reserved for now.
819 */
820#define EXT4_FT_UNKNOWN 0
821#define EXT4_FT_REG_FILE 1
822#define EXT4_FT_DIR 2
823#define EXT4_FT_CHRDEV 3
824#define EXT4_FT_BLKDEV 4
825#define EXT4_FT_FIFO 5
826#define EXT4_FT_SOCK 6
827#define EXT4_FT_SYMLINK 7
828
829#define EXT4_FT_MAX 8
830
831/*
832 * EXT4_DIR_PAD defines the directory entries boundaries
833 *
834 * NOTE: It must be a multiple of 4
835 */
836#define EXT4_DIR_PAD 4
837#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1)
838#define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \
839 ~EXT4_DIR_ROUND)
840#define EXT4_MAX_REC_LEN ((1<<16)-1)
841
842static inline unsigned ext4_rec_len_from_disk(__le16 dlen)
843{
844 unsigned len = le16_to_cpu(dlen);
845
846 if (len == EXT4_MAX_REC_LEN)
847 return 1 << 16;
848 return len;
849}
850
851static inline __le16 ext4_rec_len_to_disk(unsigned len)
852{
853 if (len == (1 << 16))
854 return cpu_to_le16(EXT4_MAX_REC_LEN);
855 else if (len > (1 << 16))
856 BUG();
857 return cpu_to_le16(len);
858}
859
860/*
861 * Hash Tree Directory indexing
862 * (c) Daniel Phillips, 2001
863 */
864
865#define is_dx(dir) (EXT4_HAS_COMPAT_FEATURE(dir->i_sb, \
866 EXT4_FEATURE_COMPAT_DIR_INDEX) && \
867 (EXT4_I(dir)->i_flags & EXT4_INDEX_FL))
868#define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX)
869#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
870
871/* Legal values for the dx_root hash_version field: */
872
873#define DX_HASH_LEGACY 0
874#define DX_HASH_HALF_MD4 1
875#define DX_HASH_TEA 2
876
877#ifdef __KERNEL__
878
879/* hash info structure used by the directory hash */
880struct dx_hash_info
881{
882 u32 hash;
883 u32 minor_hash;
884 int hash_version;
885 u32 *seed;
886};
887
888#define EXT4_HTREE_EOF 0x7fffffff
889
890/*
891 * Control parameters used by ext4_htree_next_block
892 */
893#define HASH_NB_ALWAYS 1
894
895
896/*
897 * Describe an inode's exact location on disk and in memory
898 */
899struct ext4_iloc
900{
901 struct buffer_head *bh;
902 unsigned long offset;
903 ext4_group_t block_group;
904};
905
906static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc)
907{
908 return (struct ext4_inode *) (iloc->bh->b_data + iloc->offset);
909}
910
911/*
912 * This structure is stuffed into the struct file's private_data field
913 * for directories. It is where we put information so that we can do
914 * readdir operations in hash tree order.
915 */
916struct dir_private_info {
917 struct rb_root root;
918 struct rb_node *curr_node;
919 struct fname *extra_fname;
920 loff_t last_pos;
921 __u32 curr_hash;
922 __u32 curr_minor_hash;
923 __u32 next_hash;
924};
925
926/* calculate the first block number of the group */
927static inline ext4_fsblk_t
928ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no)
929{
930 return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) +
931 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
932}
933
934/*
935 * Special error return code only used by dx_probe() and its callers.
936 */
937#define ERR_BAD_DX_DIR -75000
938
939void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
940 unsigned long *blockgrpp, ext4_grpblk_t *offsetp);
941
942/*
943 * Function prototypes
944 */
945
946/*
947 * Ok, these declarations are also in <linux/kernel.h> but none of the
948 * ext4 source programs needs to include it so they are duplicated here.
949 */
950# define NORET_TYPE /**/
951# define ATTRIB_NORET __attribute__((noreturn))
952# define NORET_AND noreturn,
953
954/* balloc.c */
955extern unsigned int ext4_block_group(struct super_block *sb,
956 ext4_fsblk_t blocknr);
957extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb,
958 ext4_fsblk_t blocknr);
959extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group);
960extern unsigned long ext4_bg_num_gdb(struct super_block *sb,
961 ext4_group_t group);
962extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode,
963 ext4_fsblk_t goal, int *errp);
964extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode,
965 ext4_fsblk_t goal, unsigned long *count, int *errp);
966extern ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode,
967 ext4_fsblk_t goal, unsigned long *count, int *errp);
968extern void ext4_free_blocks (handle_t *handle, struct inode *inode,
969 ext4_fsblk_t block, unsigned long count, int metadata);
970extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb,
971 ext4_fsblk_t block, unsigned long count,
972 unsigned long *pdquot_freed_blocks);
973extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *);
974extern void ext4_check_blocks_bitmap (struct super_block *);
975extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
976 ext4_group_t block_group,
977 struct buffer_head ** bh);
978extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
979extern void ext4_init_block_alloc_info(struct inode *);
980extern void ext4_rsv_window_add(struct super_block *sb, struct ext4_reserve_window_node *rsv);
981
982/* dir.c */
983extern int ext4_check_dir_entry(const char *, struct inode *,
984 struct ext4_dir_entry_2 *,
985 struct buffer_head *, unsigned long);
986extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash,
987 __u32 minor_hash,
988 struct ext4_dir_entry_2 *dirent);
989extern void ext4_htree_free_dir_info(struct dir_private_info *p);
990
991/* fsync.c */
992extern int ext4_sync_file (struct file *, struct dentry *, int);
993
994/* hash.c */
995extern int ext4fs_dirhash(const char *name, int len, struct
996 dx_hash_info *hinfo);
997
998/* ialloc.c */
999extern struct inode * ext4_new_inode (handle_t *, struct inode *, int);
1000extern void ext4_free_inode (handle_t *, struct inode *);
1001extern struct inode * ext4_orphan_get (struct super_block *, unsigned long);
1002extern unsigned long ext4_count_free_inodes (struct super_block *);
1003extern unsigned long ext4_count_dirs (struct super_block *);
1004extern void ext4_check_inodes_bitmap (struct super_block *);
1005extern unsigned long ext4_count_free (struct buffer_head *, unsigned);
1006
1007/* mballoc.c */
1008extern long ext4_mb_stats;
1009extern long ext4_mb_max_to_scan;
1010extern int ext4_mb_init(struct super_block *, int);
1011extern int ext4_mb_release(struct super_block *);
1012extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
1013 struct ext4_allocation_request *, int *);
1014extern int ext4_mb_reserve_blocks(struct super_block *, int);
1015extern void ext4_mb_discard_inode_preallocations(struct inode *);
1016extern int __init init_ext4_mballoc(void);
1017extern void exit_ext4_mballoc(void);
1018extern void ext4_mb_free_blocks(handle_t *, struct inode *,
1019 unsigned long, unsigned long, int, unsigned long *);
1020
1021
1022/* inode.c */
1023int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
1024 struct buffer_head *bh, ext4_fsblk_t blocknr);
1025struct buffer_head *ext4_getblk(handle_t *, struct inode *,
1026 ext4_lblk_t, int, int *);
1027struct buffer_head *ext4_bread(handle_t *, struct inode *,
1028 ext4_lblk_t, int, int *);
1029int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
1030 ext4_lblk_t iblock, unsigned long maxblocks,
1031 struct buffer_head *bh_result,
1032 int create, int extend_disksize);
1033
1034extern struct inode *ext4_iget(struct super_block *, unsigned long);
1035extern int ext4_write_inode (struct inode *, int);
1036extern int ext4_setattr (struct dentry *, struct iattr *);
1037extern void ext4_delete_inode (struct inode *);
1038extern int ext4_sync_inode (handle_t *, struct inode *);
1039extern void ext4_discard_reservation (struct inode *);
1040extern void ext4_dirty_inode(struct inode *);
1041extern int ext4_change_inode_journal_flag(struct inode *, int);
1042extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
1043extern void ext4_truncate (struct inode *);
1044extern void ext4_set_inode_flags(struct inode *);
1045extern void ext4_get_inode_flags(struct ext4_inode_info *);
1046extern void ext4_set_aops(struct inode *inode);
1047extern int ext4_writepage_trans_blocks(struct inode *);
1048extern int ext4_block_truncate_page(handle_t *handle, struct page *page,
1049 struct address_space *mapping, loff_t from);
1050
1051/* ioctl.c */
1052extern int ext4_ioctl (struct inode *, struct file *, unsigned int,
1053 unsigned long);
1054extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long);
1055
1056/* migrate.c */
1057extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int,
1058 unsigned long);
1059/* namei.c */
1060extern int ext4_orphan_add(handle_t *, struct inode *);
1061extern int ext4_orphan_del(handle_t *, struct inode *);
1062extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
1063 __u32 start_minor_hash, __u32 *next_hash);
1064
1065/* resize.c */
1066extern int ext4_group_add(struct super_block *sb,
1067 struct ext4_new_group_data *input);
1068extern int ext4_group_extend(struct super_block *sb,
1069 struct ext4_super_block *es,
1070 ext4_fsblk_t n_blocks_count);
1071
1072/* super.c */
1073extern void ext4_error (struct super_block *, const char *, const char *, ...)
1074 __attribute__ ((format (printf, 3, 4)));
1075extern void __ext4_std_error (struct super_block *, const char *, int);
1076extern void ext4_abort (struct super_block *, const char *, const char *, ...)
1077 __attribute__ ((format (printf, 3, 4)));
1078extern void ext4_warning (struct super_block *, const char *, const char *, ...)
1079 __attribute__ ((format (printf, 3, 4)));
1080extern void ext4_update_dynamic_rev (struct super_block *sb);
1081extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb,
1082 __u32 compat);
1083extern int ext4_update_rocompat_feature(handle_t *handle,
1084 struct super_block *sb, __u32 rocompat);
1085extern int ext4_update_incompat_feature(handle_t *handle,
1086 struct super_block *sb, __u32 incompat);
1087extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
1088 struct ext4_group_desc *bg);
1089extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,
1090 struct ext4_group_desc *bg);
1091extern ext4_fsblk_t ext4_inode_table(struct super_block *sb,
1092 struct ext4_group_desc *bg);
1093extern void ext4_block_bitmap_set(struct super_block *sb,
1094 struct ext4_group_desc *bg, ext4_fsblk_t blk);
1095extern void ext4_inode_bitmap_set(struct super_block *sb,
1096 struct ext4_group_desc *bg, ext4_fsblk_t blk);
1097extern void ext4_inode_table_set(struct super_block *sb,
1098 struct ext4_group_desc *bg, ext4_fsblk_t blk);
1099
1100static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es)
1101{
1102 return ((ext4_fsblk_t)le32_to_cpu(es->s_blocks_count_hi) << 32) |
1103 le32_to_cpu(es->s_blocks_count_lo);
1104}
1105
1106static inline ext4_fsblk_t ext4_r_blocks_count(struct ext4_super_block *es)
1107{
1108 return ((ext4_fsblk_t)le32_to_cpu(es->s_r_blocks_count_hi) << 32) |
1109 le32_to_cpu(es->s_r_blocks_count_lo);
1110}
1111
1112static inline ext4_fsblk_t ext4_free_blocks_count(struct ext4_super_block *es)
1113{
1114 return ((ext4_fsblk_t)le32_to_cpu(es->s_free_blocks_count_hi) << 32) |
1115 le32_to_cpu(es->s_free_blocks_count_lo);
1116}
1117
1118static inline void ext4_blocks_count_set(struct ext4_super_block *es,
1119 ext4_fsblk_t blk)
1120{
1121 es->s_blocks_count_lo = cpu_to_le32((u32)blk);
1122 es->s_blocks_count_hi = cpu_to_le32(blk >> 32);
1123}
1124
1125static inline void ext4_free_blocks_count_set(struct ext4_super_block *es,
1126 ext4_fsblk_t blk)
1127{
1128 es->s_free_blocks_count_lo = cpu_to_le32((u32)blk);
1129 es->s_free_blocks_count_hi = cpu_to_le32(blk >> 32);
1130}
1131
1132static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
1133 ext4_fsblk_t blk)
1134{
1135 es->s_r_blocks_count_lo = cpu_to_le32((u32)blk);
1136 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
1137}
1138
1139static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
1140{
1141 return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
1142 le32_to_cpu(raw_inode->i_size_lo);
1143}
1144
1145static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
1146{
1147 raw_inode->i_size_lo = cpu_to_le32(i_size);
1148 raw_inode->i_size_high = cpu_to_le32(i_size >> 32);
1149}
1150
1151static inline
1152struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
1153 ext4_group_t group)
1154{
1155 struct ext4_group_info ***grp_info;
1156 long indexv, indexh;
1157 grp_info = EXT4_SB(sb)->s_group_info;
1158 indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
1159 indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
1160 return grp_info[indexv][indexh];
1161}
1162
1163
1164#define ext4_std_error(sb, errno) \
1165do { \
1166 if ((errno)) \
1167 __ext4_std_error((sb), __FUNCTION__, (errno)); \
1168} while (0)
1169
1170/*
1171 * Inodes and files operations
1172 */
1173
1174/* dir.c */
1175extern const struct file_operations ext4_dir_operations;
1176
1177/* file.c */
1178extern const struct inode_operations ext4_file_inode_operations;
1179extern const struct file_operations ext4_file_operations;
1180
1181/* namei.c */
1182extern const struct inode_operations ext4_dir_inode_operations;
1183extern const struct inode_operations ext4_special_inode_operations;
1184
1185/* symlink.c */
1186extern const struct inode_operations ext4_symlink_inode_operations;
1187extern const struct inode_operations ext4_fast_symlink_inode_operations;
1188
1189/* extents.c */
1190extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
1191extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
1192extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
1193 ext4_lblk_t iblock,
1194 unsigned long max_blocks, struct buffer_head *bh_result,
1195 int create, int extend_disksize);
1196extern void ext4_ext_truncate(struct inode *, struct page *);
1197extern void ext4_ext_init(struct super_block *);
1198extern void ext4_ext_release(struct super_block *);
1199extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset,
1200 loff_t len);
1201extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode,
1202 sector_t block, unsigned long max_blocks,
1203 struct buffer_head *bh, int create,
1204 int extend_disksize);
1205#endif /* __KERNEL__ */
1206
1207#endif /* _LINUX_EXT4_FS_H */
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
deleted file mode 100644
index 1285c583b2d8..000000000000
--- a/include/linux/ext4_fs_extents.h
+++ /dev/null
@@ -1,232 +0,0 @@
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 AGGRESSIVE_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 AGGRESSIVE_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_lo; /* 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_lo; /* 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#define EXT_MAX_BLOCK 0xffffffff
129
130/*
131 * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
132 * initialized extent. This is 2^15 and not (2^16 - 1), since we use the
133 * MSB of ee_len field in the extent datastructure to signify if this
134 * particular extent is an initialized extent or an uninitialized (i.e.
135 * preallocated).
136 * EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an
137 * uninitialized extent.
138 * If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an
139 * uninitialized one. In other words, if MSB of ee_len is set, it is an
140 * uninitialized extent with only one special scenario when ee_len = 0x8000.
141 * In this case we can not have an uninitialized extent of zero length and
142 * thus we make it as a special case of initialized extent with 0x8000 length.
143 * This way we get better extent-to-group alignment for initialized extents.
144 * Hence, the maximum number of blocks we can have in an *initialized*
145 * extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767).
146 */
147#define EXT_INIT_MAX_LEN (1UL << 15)
148#define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1)
149
150
151#define EXT_FIRST_EXTENT(__hdr__) \
152 ((struct ext4_extent *) (((char *) (__hdr__)) + \
153 sizeof(struct ext4_extent_header)))
154#define EXT_FIRST_INDEX(__hdr__) \
155 ((struct ext4_extent_idx *) (((char *) (__hdr__)) + \
156 sizeof(struct ext4_extent_header)))
157#define EXT_HAS_FREE_INDEX(__path__) \
158 (le16_to_cpu((__path__)->p_hdr->eh_entries) \
159 < le16_to_cpu((__path__)->p_hdr->eh_max))
160#define EXT_LAST_EXTENT(__hdr__) \
161 (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1)
162#define EXT_LAST_INDEX(__hdr__) \
163 (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1)
164#define EXT_MAX_EXTENT(__hdr__) \
165 (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)
166#define EXT_MAX_INDEX(__hdr__) \
167 (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)
168
169static inline struct ext4_extent_header *ext_inode_hdr(struct inode *inode)
170{
171 return (struct ext4_extent_header *) EXT4_I(inode)->i_data;
172}
173
174static inline struct ext4_extent_header *ext_block_hdr(struct buffer_head *bh)
175{
176 return (struct ext4_extent_header *) bh->b_data;
177}
178
179static inline unsigned short ext_depth(struct inode *inode)
180{
181 return le16_to_cpu(ext_inode_hdr(inode)->eh_depth);
182}
183
184static inline void ext4_ext_tree_changed(struct inode *inode)
185{
186 EXT4_I(inode)->i_ext_generation++;
187}
188
189static inline void
190ext4_ext_invalidate_cache(struct inode *inode)
191{
192 EXT4_I(inode)->i_cached_extent.ec_type = EXT4_EXT_CACHE_NO;
193}
194
195static inline void ext4_ext_mark_uninitialized(struct ext4_extent *ext)
196{
197 /* We can not have an uninitialized extent of zero length! */
198 BUG_ON((le16_to_cpu(ext->ee_len) & ~EXT_INIT_MAX_LEN) == 0);
199 ext->ee_len |= cpu_to_le16(EXT_INIT_MAX_LEN);
200}
201
202static inline int ext4_ext_is_uninitialized(struct ext4_extent *ext)
203{
204 /* Extent with ee_len of 0x8000 is treated as an initialized extent */
205 return (le16_to_cpu(ext->ee_len) > EXT_INIT_MAX_LEN);
206}
207
208static inline int ext4_ext_get_actual_len(struct ext4_extent *ext)
209{
210 return (le16_to_cpu(ext->ee_len) <= EXT_INIT_MAX_LEN ?
211 le16_to_cpu(ext->ee_len) :
212 (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
213}
214
215extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
216extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
217extern int ext4_extent_tree_init(handle_t *, struct inode *);
218extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *);
219extern int ext4_ext_try_to_merge(struct inode *inode,
220 struct ext4_ext_path *path,
221 struct ext4_extent *);
222extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
223extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
224extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t,
225 struct ext4_ext_path *);
226extern int ext4_ext_search_left(struct inode *, struct ext4_ext_path *,
227 ext4_lblk_t *, ext4_fsblk_t *);
228extern int ext4_ext_search_right(struct inode *, struct ext4_ext_path *,
229 ext4_lblk_t *, ext4_fsblk_t *);
230extern void ext4_ext_drop_refs(struct ext4_ext_path *);
231#endif /* _LINUX_EXT4_EXTENTS */
232
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h
deleted file mode 100644
index d5508d3cf290..000000000000
--- a/include/linux/ext4_fs_i.h
+++ /dev/null
@@ -1,167 +0,0 @@
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
30/* data type for file logical block number */
31typedef __u32 ext4_lblk_t;
32
33/* data type for block group number */
34typedef unsigned long ext4_group_t;
35
36struct ext4_reserve_window {
37 ext4_fsblk_t _rsv_start; /* First byte reserved */
38 ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */
39};
40
41struct ext4_reserve_window_node {
42 struct rb_node rsv_node;
43 __u32 rsv_goal_size;
44 __u32 rsv_alloc_hit;
45 struct ext4_reserve_window rsv_window;
46};
47
48struct ext4_block_alloc_info {
49 /* information about reservation window */
50 struct ext4_reserve_window_node rsv_window_node;
51 /*
52 * was i_next_alloc_block in ext4_inode_info
53 * is the logical (file-relative) number of the
54 * most-recently-allocated block in this file.
55 * We use this for detecting linearly ascending allocation requests.
56 */
57 ext4_lblk_t last_alloc_logical_block;
58 /*
59 * Was i_next_alloc_goal in ext4_inode_info
60 * is the *physical* companion to i_next_alloc_block.
61 * it the physical block number of the block which was most-recentl
62 * allocated to this file. This give us the goal (target) for the next
63 * allocation when we detect linearly ascending requests.
64 */
65 ext4_fsblk_t last_alloc_physical_block;
66};
67
68#define rsv_start rsv_window._rsv_start
69#define rsv_end rsv_window._rsv_end
70
71/*
72 * storage for cached extent
73 */
74struct ext4_ext_cache {
75 ext4_fsblk_t ec_start;
76 ext4_lblk_t ec_block;
77 __u32 ec_len; /* must be 32bit to return holes */
78 __u32 ec_type;
79};
80
81/*
82 * third extended file system inode data in memory
83 */
84struct ext4_inode_info {
85 __le32 i_data[15]; /* unconverted */
86 __u32 i_flags;
87 ext4_fsblk_t i_file_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 ext4_group_t 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 ext4_lblk_t 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 * i_data_sem 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 i_data_sem.
150 */
151 struct rw_semaphore i_data_sem;
152 struct inode vfs_inode;
153
154 unsigned long i_ext_generation;
155 struct ext4_ext_cache i_cached_extent;
156 /*
157 * File creation time. Its function is same as that of
158 * struct timespec i_{a,c,m}time in the generic inode.
159 */
160 struct timespec i_crtime;
161
162 /* mballoc */
163 struct list_head i_prealloc_list;
164 spinlock_t i_prealloc_lock;
165};
166
167#endif /* _LINUX_EXT4_FS_I */
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h
deleted file mode 100644
index abaae2c8cccf..000000000000
--- a/include/linux/ext4_fs_sb.h
+++ /dev/null
@@ -1,148 +0,0 @@
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_desc_size; /* Size of a group descriptor in bytes */
32 unsigned long s_inodes_per_block;/* Number of inodes per block */
33 unsigned long s_blocks_per_group;/* Number of blocks in a group */
34 unsigned long s_inodes_per_group;/* Number of inodes in a group */
35 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
36 unsigned long s_gdb_count; /* Number of group descriptor blocks */
37 unsigned long s_desc_per_block; /* Number of group descriptors per block */
38 ext4_group_t s_groups_count; /* Number of groups in the fs */
39 unsigned long s_overhead_last; /* Last calculated overhead */
40 unsigned long s_blocks_last; /* Last seen block count */
41 loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
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 ext4_fsblk_t s_sb_block;
47 uid_t s_resuid;
48 gid_t s_resgid;
49 unsigned short s_mount_state;
50 unsigned short s_pad;
51 int s_addr_per_block_bits;
52 int s_desc_per_block_bits;
53 int s_inode_size;
54 int s_first_ino;
55 spinlock_t s_next_gen_lock;
56 u32 s_next_generation;
57 u32 s_hash_seed[4];
58 int s_def_hash_version;
59 struct percpu_counter s_freeblocks_counter;
60 struct percpu_counter s_freeinodes_counter;
61 struct percpu_counter s_dirs_counter;
62 struct blockgroup_lock s_blockgroup_lock;
63
64 /* root of the per fs reservation window tree */
65 spinlock_t s_rsv_window_lock;
66 struct rb_root s_rsv_window_root;
67 struct ext4_reserve_window_node s_rsv_window_head;
68
69 /* Journaling */
70 struct inode * s_journal_inode;
71 struct journal_s * s_journal;
72 struct list_head s_orphan;
73 unsigned long s_commit_interval;
74 struct block_device *journal_bdev;
75#ifdef CONFIG_JBD2_DEBUG
76 struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
77 wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
78#endif
79#ifdef CONFIG_QUOTA
80 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
81 int s_jquota_fmt; /* Format of quota to use */
82#endif
83 unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
84
85#ifdef EXTENTS_STATS
86 /* ext4 extents stats */
87 unsigned long s_ext_min;
88 unsigned long s_ext_max;
89 unsigned long s_depth_max;
90 spinlock_t s_ext_stats_lock;
91 unsigned long s_ext_blocks;
92 unsigned long s_ext_extents;
93#endif
94
95 /* for buddy allocator */
96 struct ext4_group_info ***s_group_info;
97 struct inode *s_buddy_cache;
98 long s_blocks_reserved;
99 spinlock_t s_reserve_lock;
100 struct list_head s_active_transaction;
101 struct list_head s_closed_transaction;
102 struct list_head s_committed_transaction;
103 spinlock_t s_md_lock;
104 tid_t s_last_transaction;
105 unsigned short *s_mb_offsets, *s_mb_maxs;
106
107 /* tunables */
108 unsigned long s_stripe;
109 unsigned long s_mb_stream_request;
110 unsigned long s_mb_max_to_scan;
111 unsigned long s_mb_min_to_scan;
112 unsigned long s_mb_stats;
113 unsigned long s_mb_order2_reqs;
114 unsigned long s_mb_group_prealloc;
115 /* where last allocation was done - for stream allocation */
116 unsigned long s_mb_last_group;
117 unsigned long s_mb_last_start;
118
119 /* history to debug policy */
120 struct ext4_mb_history *s_mb_history;
121 int s_mb_history_cur;
122 int s_mb_history_max;
123 int s_mb_history_num;
124 struct proc_dir_entry *s_mb_proc;
125 spinlock_t s_mb_history_lock;
126 int s_mb_history_filter;
127
128 /* stats for buddy allocator */
129 spinlock_t s_mb_pa_lock;
130 atomic_t s_bal_reqs; /* number of reqs with len > 1 */
131 atomic_t s_bal_success; /* we found long enough chunks */
132 atomic_t s_bal_allocated; /* in blocks */
133 atomic_t s_bal_ex_scanned; /* total extents scanned */
134 atomic_t s_bal_goals; /* goal hits */
135 atomic_t s_bal_breaks; /* too long searches */
136 atomic_t s_bal_2orders; /* 2^order hits */
137 spinlock_t s_bal_lock;
138 unsigned long s_mb_buddies_generated;
139 unsigned long long s_mb_generation_time;
140 atomic_t s_mb_lost_chunks;
141 atomic_t s_mb_preallocated;
142 atomic_t s_mb_discarded;
143
144 /* locality groups */
145 struct ext4_locality_group *s_locality_groups;
146};
147
148#endif /* _LINUX_EXT4_FS_SB */
diff --git a/include/linux/ext4_jbd2.h b/include/linux/ext4_jbd2.h
deleted file mode 100644
index 38c71d3c8dbf..000000000000
--- a/include/linux/ext4_jbd2.h
+++ /dev/null
@@ -1,231 +0,0 @@
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_JBD2_H
16#define _LINUX_EXT4_JBD2_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
117static inline void ext4_journal_release_buffer(handle_t *handle,
118 struct buffer_head *bh)
119{
120 jbd2_journal_release_buffer(handle, bh);
121}
122
123void ext4_journal_abort_handle(const char *caller, const char *err_fn,
124 struct buffer_head *bh, handle_t *handle, int err);
125
126int __ext4_journal_get_undo_access(const char *where, handle_t *handle,
127 struct buffer_head *bh);
128
129int __ext4_journal_get_write_access(const char *where, handle_t *handle,
130 struct buffer_head *bh);
131
132int __ext4_journal_forget(const char *where, handle_t *handle,
133 struct buffer_head *bh);
134
135int __ext4_journal_revoke(const char *where, handle_t *handle,
136 ext4_fsblk_t blocknr, struct buffer_head *bh);
137
138int __ext4_journal_get_create_access(const char *where,
139 handle_t *handle, struct buffer_head *bh);
140
141int __ext4_journal_dirty_metadata(const char *where,
142 handle_t *handle, struct buffer_head *bh);
143
144#define ext4_journal_get_undo_access(handle, bh) \
145 __ext4_journal_get_undo_access(__FUNCTION__, (handle), (bh))
146#define ext4_journal_get_write_access(handle, bh) \
147 __ext4_journal_get_write_access(__FUNCTION__, (handle), (bh))
148#define ext4_journal_revoke(handle, blocknr, bh) \
149 __ext4_journal_revoke(__FUNCTION__, (handle), (blocknr), (bh))
150#define ext4_journal_get_create_access(handle, bh) \
151 __ext4_journal_get_create_access(__FUNCTION__, (handle), (bh))
152#define ext4_journal_dirty_metadata(handle, bh) \
153 __ext4_journal_dirty_metadata(__FUNCTION__, (handle), (bh))
154#define ext4_journal_forget(handle, bh) \
155 __ext4_journal_forget(__FUNCTION__, (handle), (bh))
156
157int ext4_journal_dirty_data(handle_t *handle, struct buffer_head *bh);
158
159handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks);
160int __ext4_journal_stop(const char *where, handle_t *handle);
161
162static inline handle_t *ext4_journal_start(struct inode *inode, int nblocks)
163{
164 return ext4_journal_start_sb(inode->i_sb, nblocks);
165}
166
167#define ext4_journal_stop(handle) \
168 __ext4_journal_stop(__FUNCTION__, (handle))
169
170static inline handle_t *ext4_journal_current_handle(void)
171{
172 return journal_current_handle();
173}
174
175static inline int ext4_journal_extend(handle_t *handle, int nblocks)
176{
177 return jbd2_journal_extend(handle, nblocks);
178}
179
180static inline int ext4_journal_restart(handle_t *handle, int nblocks)
181{
182 return jbd2_journal_restart(handle, nblocks);
183}
184
185static inline int ext4_journal_blocks_per_page(struct inode *inode)
186{
187 return jbd2_journal_blocks_per_page(inode);
188}
189
190static inline int ext4_journal_force_commit(journal_t *journal)
191{
192 return jbd2_journal_force_commit(journal);
193}
194
195/* super.c */
196int ext4_force_commit(struct super_block *sb);
197
198static inline int ext4_should_journal_data(struct inode *inode)
199{
200 if (!S_ISREG(inode->i_mode))
201 return 1;
202 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
203 return 1;
204 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
205 return 1;
206 return 0;
207}
208
209static inline int ext4_should_order_data(struct inode *inode)
210{
211 if (!S_ISREG(inode->i_mode))
212 return 0;
213 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
214 return 0;
215 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
216 return 1;
217 return 0;
218}
219
220static inline int ext4_should_writeback_data(struct inode *inode)
221{
222 if (!S_ISREG(inode->i_mode))
223 return 0;
224 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
225 return 0;
226 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
227 return 1;
228 return 0;
229}
230
231#endif /* _LINUX_EXT4_JBD2_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2c925747bc49..a1ba005d08e7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1521,7 +1521,6 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
1521 const struct super_operations *ops, unsigned long, 1521 const struct super_operations *ops, unsigned long,
1522 struct vfsmount *mnt); 1522 struct vfsmount *mnt);
1523extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1523extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1524int __put_super(struct super_block *sb);
1525int __put_super_and_need_restart(struct super_block *sb); 1524int __put_super_and_need_restart(struct super_block *sb);
1526void unnamed_dev_init(void); 1525void unnamed_dev_init(void);
1527 1526
@@ -1965,7 +1964,6 @@ extern int vfs_stat_fd(int dfd, char __user *, struct kstat *);
1965extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); 1964extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *);
1966extern int vfs_fstat(unsigned int, struct kstat *); 1965extern int vfs_fstat(unsigned int, struct kstat *);
1967 1966
1968extern long vfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
1969extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 1967extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
1970 unsigned long arg); 1968 unsigned long arg);
1971 1969
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 2cad5c67397e..c415a496de3a 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -14,7 +14,6 @@
14 * option) any later version. 14 * option) any later version.
15 */ 15 */
16 16
17#ifdef __KERNEL__
18#ifndef _FSL_DEVICE_H_ 17#ifndef _FSL_DEVICE_H_
19#define _FSL_DEVICE_H_ 18#define _FSL_DEVICE_H_
20 19
@@ -127,4 +126,3 @@ struct mpc8xx_pcmcia_ops {
127}; 126};
128 127
129#endif /* _FSL_DEVICE_H_ */ 128#endif /* _FSL_DEVICE_H_ */
130#endif /* __KERNEL__ */
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index d4b7c4ac72e6..a89513188ce7 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -11,8 +11,6 @@
11 * (C) Copyright 2005 Robert Love 11 * (C) Copyright 2005 Robert Love
12 */ 12 */
13 13
14#ifdef __KERNEL__
15
16#include <linux/dnotify.h> 14#include <linux/dnotify.h>
17#include <linux/inotify.h> 15#include <linux/inotify.h>
18#include <linux/audit.h> 16#include <linux/audit.h>
@@ -296,6 +294,4 @@ static inline void fsnotify_oldname_free(const char *old_name)
296 294
297#endif /* ! CONFIG_INOTIFY */ 295#endif /* ! CONFIG_INOTIFY */
298 296
299#endif /* __KERNEL__ */
300
301#endif /* _LINUX_FS_NOTIFY_H */ 297#endif /* _LINUX_FS_NOTIFY_H */
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index 5412da28fa47..110833666e37 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -78,7 +78,7 @@ struct gs_port {
78#define GS_DEBUG_WRITE 0x00000040 78#define GS_DEBUG_WRITE 0x00000040
79 79
80#ifdef __KERNEL__ 80#ifdef __KERNEL__
81void gs_put_char(struct tty_struct *tty, unsigned char ch); 81int gs_put_char(struct tty_struct *tty, unsigned char ch);
82int gs_write(struct tty_struct *tty, 82int gs_write(struct tty_struct *tty,
83 const unsigned char *buf, int count); 83 const unsigned char *buf, int count);
84int gs_write_room(struct tty_struct *tty); 84int gs_write_room(struct tty_struct *tty);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index c37653b6843f..b414be387180 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -40,9 +40,9 @@ struct vm_area_struct;
40#define __GFP_FS ((__force gfp_t)0x80u) /* Can call down to low-level FS? */ 40#define __GFP_FS ((__force gfp_t)0x80u) /* Can call down to low-level FS? */
41#define __GFP_COLD ((__force gfp_t)0x100u) /* Cache-cold page required */ 41#define __GFP_COLD ((__force gfp_t)0x100u) /* Cache-cold page required */
42#define __GFP_NOWARN ((__force gfp_t)0x200u) /* Suppress page allocation failure warning */ 42#define __GFP_NOWARN ((__force gfp_t)0x200u) /* Suppress page allocation failure warning */
43#define __GFP_REPEAT ((__force gfp_t)0x400u) /* Retry the allocation. Might fail */ 43#define __GFP_REPEAT ((__force gfp_t)0x400u) /* See above */
44#define __GFP_NOFAIL ((__force gfp_t)0x800u) /* Retry for ever. Cannot fail */ 44#define __GFP_NOFAIL ((__force gfp_t)0x800u) /* See above */
45#define __GFP_NORETRY ((__force gfp_t)0x1000u)/* Do not retry. Might fail */ 45#define __GFP_NORETRY ((__force gfp_t)0x1000u)/* See above */
46#define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */ 46#define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */
47#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ 47#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */
48#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ 48#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 56f3236da829..31a4d653389f 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -266,6 +266,21 @@ extern ktime_t ktime_get_real(void);
266extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, 266extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock,
267 enum hrtimer_mode mode); 267 enum hrtimer_mode mode);
268 268
269#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
270extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_clock,
271 enum hrtimer_mode mode);
272
273extern void destroy_hrtimer_on_stack(struct hrtimer *timer);
274#else
275static inline void hrtimer_init_on_stack(struct hrtimer *timer,
276 clockid_t which_clock,
277 enum hrtimer_mode mode)
278{
279 hrtimer_init(timer, which_clock, mode);
280}
281static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { }
282#endif
283
269/* Basic timer operations: */ 284/* Basic timer operations: */
270extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, 285extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
271 const enum hrtimer_mode mode); 286 const enum hrtimer_mode mode);
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 85d11916e9ea..7244456e7e65 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -11,7 +11,6 @@
11 11
12#ifndef LINUX_HWRANDOM_H_ 12#ifndef LINUX_HWRANDOM_H_
13#define LINUX_HWRANDOM_H_ 13#define LINUX_HWRANDOM_H_
14#ifdef __KERNEL__
15 14
16#include <linux/types.h> 15#include <linux/types.h>
17#include <linux/list.h> 16#include <linux/list.h>
@@ -46,5 +45,4 @@ extern int hwrng_register(struct hwrng *rng);
46/** Unregister a Hardware Random Number Generator driver. */ 45/** Unregister a Hardware Random Number Generator driver. */
47extern void hwrng_unregister(struct hwrng *rng); 46extern void hwrng_unregister(struct hwrng *rng);
48 47
49#endif /* __KERNEL__ */
50#endif /* LINUX_HWRANDOM_H_ */ 48#endif /* LINUX_HWRANDOM_H_ */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 32eb8bbe4831..580acc93903e 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -79,12 +79,9 @@
79#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */ 79#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */
80#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */ 80#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */
81#define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */ 81#define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */
82#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */
83#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */
84#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */ 82#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */
85#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ 83#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
86#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ 84#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
87#define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */
88#define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */ 85#define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */
89#define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ 86#define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */
90#define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ 87#define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 365e0df3646b..cb63da5c2139 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -126,7 +126,7 @@ struct i2c_driver {
126 * With the driver model, device enumeration is NEVER done by drivers; 126 * With the driver model, device enumeration is NEVER done by drivers;
127 * it's done by infrastructure. (NEW STYLE DRIVERS ONLY) 127 * it's done by infrastructure. (NEW STYLE DRIVERS ONLY)
128 */ 128 */
129 int (*probe)(struct i2c_client *); 129 int (*probe)(struct i2c_client *, const struct i2c_device_id *);
130 int (*remove)(struct i2c_client *); 130 int (*remove)(struct i2c_client *);
131 131
132 /* driver model interfaces that don't relate to enumeration */ 132 /* driver model interfaces that don't relate to enumeration */
@@ -140,11 +140,10 @@ struct i2c_driver {
140 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); 140 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg);
141 141
142 struct device_driver driver; 142 struct device_driver driver;
143 const struct i2c_device_id *id_table;
143}; 144};
144#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 145#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
145 146
146#define I2C_NAME_SIZE 20
147
148/** 147/**
149 * struct i2c_client - represent an I2C slave device 148 * struct i2c_client - represent an I2C slave device
150 * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address; 149 * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address;
@@ -230,17 +229,17 @@ struct i2c_board_info {
230}; 229};
231 230
232/** 231/**
233 * I2C_BOARD_INFO - macro used to list an i2c device and its driver 232 * I2C_BOARD_INFO - macro used to list an i2c device and its address
234 * @driver: identifies the driver to use with the device 233 * @dev_type: identifies the device type
235 * @dev_addr: the device's address on the bus. 234 * @dev_addr: the device's address on the bus.
236 * 235 *
237 * This macro initializes essential fields of a struct i2c_board_info, 236 * This macro initializes essential fields of a struct i2c_board_info,
238 * declaring what has been provided on a particular board. Optional 237 * declaring what has been provided on a particular board. Optional
239 * fields (such as the chip type, its associated irq, or device-specific 238 * fields (such as associated irq, or device-specific platform_data)
240 * platform_data) are provided using conventional syntax. 239 * are provided using conventional syntax.
241 */ 240 */
242#define I2C_BOARD_INFO(driver,dev_addr) \ 241#define I2C_BOARD_INFO(dev_type,dev_addr) \
243 .driver_name = (driver), .addr = (dev_addr) 242 .type = (dev_type), .addr = (dev_addr)
244 243
245 244
246/* Add-on boards should register/unregister their devices; e.g. a board 245/* Add-on boards should register/unregister their devices; e.g. a board
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index f65e58a1d925..7d51cbca49ab 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -18,8 +18,6 @@
18#ifndef _I2O_H 18#ifndef _I2O_H
19#define _I2O_H 19#define _I2O_H
20 20
21#ifdef __KERNEL__ /* This file to be included by kernel only */
22
23#include <linux/i2o-dev.h> 21#include <linux/i2o-dev.h>
24 22
25/* How many different OSM's are we allowing */ 23/* How many different OSM's are we allowing */
@@ -1255,5 +1253,4 @@ extern void i2o_dump_message(struct i2o_message *);
1255extern void i2o_dump_hrt(struct i2o_controller *c); 1253extern void i2o_dump_hrt(struct i2o_controller *c);
1256extern void i2o_debug_state(struct i2o_controller *c); 1254extern void i2o_debug_state(struct i2o_controller *c);
1257 1255
1258#endif /* __KERNEL__ */
1259#endif /* _I2O_H */ 1256#endif /* _I2O_H */
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 0edda411959c..9a2d762124de 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -14,6 +14,7 @@
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17#include <linux/init.h>
17 18
18#if BITS_PER_LONG == 32 19#if BITS_PER_LONG == 32
19# define IDR_BITS 5 20# define IDR_BITS 5
@@ -115,4 +116,6 @@ void ida_remove(struct ida *ida, int id);
115void ida_destroy(struct ida *ida); 116void ida_destroy(struct ida *ida);
116void ida_init(struct ida *ida); 117void ida_init(struct ida *ida);
117 118
119void __init idr_init_cache(void);
120
118#endif /* __IDR_H__ */ 121#endif /* __IDR_H__ */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 0d9d7ea2c1cc..5f200bac3749 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -1,9 +1,6 @@
1#ifndef _LINUX_IF_MACVLAN_H 1#ifndef _LINUX_IF_MACVLAN_H
2#define _LINUX_IF_MACVLAN_H 2#define _LINUX_IF_MACVLAN_H
3 3
4#ifdef __KERNEL__
5
6extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); 4extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *);
7 5
8#endif /* __KERNEL__ */
9#endif /* _LINUX_IF_MACVLAN_H */ 6#endif /* _LINUX_IF_MACVLAN_H */
diff --git a/include/linux/inet.h b/include/linux/inet.h
index 675a7dbe86f8..1354080cf8cf 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -42,11 +42,9 @@
42#ifndef _LINUX_INET_H 42#ifndef _LINUX_INET_H
43#define _LINUX_INET_H 43#define _LINUX_INET_H
44 44
45#ifdef __KERNEL__
46#include <linux/types.h> 45#include <linux/types.h>
47 46
48extern __be32 in_aton(const char *str); 47extern __be32 in_aton(const char *str);
49extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); 48extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
50extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); 49extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
51#endif
52#endif /* _LINUX_INET_H */ 50#endif /* _LINUX_INET_H */
diff --git a/include/linux/init.h b/include/linux/init.h
index fb58c0493cf2..21d658cdfa27 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -147,6 +147,8 @@ extern unsigned int reset_devices;
147void setup_arch(char **); 147void setup_arch(char **);
148void prepare_namespace(void); 148void prepare_namespace(void);
149 149
150extern void (*late_time_init)(void);
151
150#endif 152#endif
151 153
152#ifndef MODULE 154#ifndef MODULE
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index b5fef13148bd..f1fc7470d26c 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -289,6 +289,7 @@ struct softirq_action
289}; 289};
290 290
291asmlinkage void do_softirq(void); 291asmlinkage void do_softirq(void);
292asmlinkage void __do_softirq(void);
292extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); 293extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data);
293extern void softirq_init(void); 294extern void softirq_init(void);
294#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) 295#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index e4451d1da753..ea6c18a8b0d4 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -4,6 +4,17 @@
4#include <linux/err.h> 4#include <linux/err.h>
5#include <linux/idr.h> 5#include <linux/idr.h>
6#include <linux/rwsem.h> 6#include <linux/rwsem.h>
7#include <linux/notifier.h>
8
9/*
10 * ipc namespace events
11 */
12#define IPCNS_MEMCHANGED 0x00000001 /* Notify lowmem size changed */
13#define IPCNS_CREATED 0x00000002 /* Notify new ipc namespace created */
14#define IPCNS_REMOVED 0x00000003 /* Notify ipc namespace removed */
15
16#define IPCNS_CALLBACK_PRI 0
17
7 18
8struct ipc_ids { 19struct ipc_ids {
9 int in_use; 20 int in_use;
@@ -30,15 +41,24 @@ struct ipc_namespace {
30 size_t shm_ctlall; 41 size_t shm_ctlall;
31 int shm_ctlmni; 42 int shm_ctlmni;
32 int shm_tot; 43 int shm_tot;
44
45 struct notifier_block ipcns_nb;
33}; 46};
34 47
35extern struct ipc_namespace init_ipc_ns; 48extern struct ipc_namespace init_ipc_ns;
49extern atomic_t nr_ipc_ns;
36 50
37#ifdef CONFIG_SYSVIPC 51#ifdef CONFIG_SYSVIPC
38#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, 52#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
39#else 53
54extern int register_ipcns_notifier(struct ipc_namespace *);
55extern int cond_register_ipcns_notifier(struct ipc_namespace *);
56extern int unregister_ipcns_notifier(struct ipc_namespace *);
57extern int ipcns_notify(unsigned long);
58
59#else /* CONFIG_SYSVIPC */
40#define INIT_IPC_NS(ns) 60#define INIT_IPC_NS(ns)
41#endif 61#endif /* CONFIG_SYSVIPC */
42 62
43#if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS) 63#if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS)
44extern void free_ipc_ns(struct kref *kref); 64extern void free_ipc_ns(struct kref *kref);
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index c5bd28b69aec..7ebdb4fb4e54 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -64,7 +64,7 @@
64 * applications and another for userland applications. The 64 * applications and another for userland applications. The
65 * capabilities are basically the same for both interface, although 65 * capabilities are basically the same for both interface, although
66 * the interfaces are somewhat different. The stuff in the 66 * the interfaces are somewhat different. The stuff in the
67 * #ifdef KERNEL below is the in-kernel interface. The userland 67 * #ifdef __KERNEL__ below is the in-kernel interface. The userland
68 * interface is defined later in the file. */ 68 * interface is defined later in the file. */
69 69
70 70
@@ -75,8 +75,7 @@
75 * work for sockets. 75 * work for sockets.
76 */ 76 */
77#define IPMI_MAX_ADDR_SIZE 32 77#define IPMI_MAX_ADDR_SIZE 32
78struct ipmi_addr 78struct ipmi_addr {
79{
80 /* Try to take these from the "Channel Medium Type" table 79 /* Try to take these from the "Channel Medium Type" table
81 in section 6.5 of the IPMI 1.5 manual. */ 80 in section 6.5 of the IPMI 1.5 manual. */
82 int addr_type; 81 int addr_type;
@@ -90,8 +89,7 @@ struct ipmi_addr
90 * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC. 89 * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC.
91 */ 90 */
92#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c 91#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c
93struct ipmi_system_interface_addr 92struct ipmi_system_interface_addr {
94{
95 int addr_type; 93 int addr_type;
96 short channel; 94 short channel;
97 unsigned char lun; 95 unsigned char lun;
@@ -100,10 +98,9 @@ struct ipmi_system_interface_addr
100/* An IPMB Address. */ 98/* An IPMB Address. */
101#define IPMI_IPMB_ADDR_TYPE 0x01 99#define IPMI_IPMB_ADDR_TYPE 0x01
102/* Used for broadcast get device id as described in section 17.9 of the 100/* Used for broadcast get device id as described in section 17.9 of the
103 IPMI 1.5 manual. */ 101 IPMI 1.5 manual. */
104#define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41 102#define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41
105struct ipmi_ipmb_addr 103struct ipmi_ipmb_addr {
106{
107 int addr_type; 104 int addr_type;
108 short channel; 105 short channel;
109 unsigned char slave_addr; 106 unsigned char slave_addr;
@@ -128,8 +125,7 @@ struct ipmi_ipmb_addr
128 * message is a little weird, but this is required. 125 * message is a little weird, but this is required.
129 */ 126 */
130#define IPMI_LAN_ADDR_TYPE 0x04 127#define IPMI_LAN_ADDR_TYPE 0x04
131struct ipmi_lan_addr 128struct ipmi_lan_addr {
132{
133 int addr_type; 129 int addr_type;
134 short channel; 130 short channel;
135 unsigned char privilege; 131 unsigned char privilege;
@@ -162,16 +158,14 @@ struct ipmi_lan_addr
162 * byte of data in the response (as the spec shows the messages laid 158 * byte of data in the response (as the spec shows the messages laid
163 * out). 159 * out).
164 */ 160 */
165struct ipmi_msg 161struct ipmi_msg {
166{
167 unsigned char netfn; 162 unsigned char netfn;
168 unsigned char cmd; 163 unsigned char cmd;
169 unsigned short data_len; 164 unsigned short data_len;
170 unsigned char __user *data; 165 unsigned char __user *data;
171}; 166};
172 167
173struct kernel_ipmi_msg 168struct kernel_ipmi_msg {
174{
175 unsigned char netfn; 169 unsigned char netfn;
176 unsigned char cmd; 170 unsigned char cmd;
177 unsigned short data_len; 171 unsigned short data_len;
@@ -239,12 +233,11 @@ typedef struct ipmi_user *ipmi_user_t;
239 * used after the message is delivered, so the upper layer may use the 233 * used after the message is delivered, so the upper layer may use the
240 * link to build a linked list, if it likes. 234 * link to build a linked list, if it likes.
241 */ 235 */
242struct ipmi_recv_msg 236struct ipmi_recv_msg {
243{
244 struct list_head link; 237 struct list_head link;
245 238
246 /* The type of message as defined in the "Receive Types" 239 /* The type of message as defined in the "Receive Types"
247 defines above. */ 240 defines above. */
248 int recv_type; 241 int recv_type;
249 242
250 ipmi_user_t user; 243 ipmi_user_t user;
@@ -271,9 +264,8 @@ struct ipmi_recv_msg
271/* Allocate and free the receive message. */ 264/* Allocate and free the receive message. */
272void ipmi_free_recv_msg(struct ipmi_recv_msg *msg); 265void ipmi_free_recv_msg(struct ipmi_recv_msg *msg);
273 266
274struct ipmi_user_hndl 267struct ipmi_user_hndl {
275{ 268 /* Routine type to call when a message needs to be routed to
276 /* Routine type to call when a message needs to be routed to
277 the upper layer. This will be called with some locks held, 269 the upper layer. This will be called with some locks held,
278 the only IPMI routines that can be called are ipmi_request 270 the only IPMI routines that can be called are ipmi_request
279 and the alloc/free operations. The handler_data is the 271 and the alloc/free operations. The handler_data is the
@@ -368,9 +360,8 @@ int ipmi_request_supply_msgs(ipmi_user_t user,
368 * Poll the IPMI interface for the user. This causes the IPMI code to 360 * Poll the IPMI interface for the user. This causes the IPMI code to
369 * do an immediate check for information from the driver and handle 361 * do an immediate check for information from the driver and handle
370 * anything that is immediately pending. This will not block in any 362 * anything that is immediately pending. This will not block in any
371 * way. This is useful if you need to implement polling from the user 363 * way. This is useful if you need to spin waiting for something to
372 * for things like modifying the watchdog timeout when a panic occurs 364 * happen in the IPMI driver.
373 * or disabling the watchdog timer on a reboot.
374 */ 365 */
375void ipmi_poll_interface(ipmi_user_t user); 366void ipmi_poll_interface(ipmi_user_t user);
376 367
@@ -422,12 +413,6 @@ int ipmi_get_maintenance_mode(ipmi_user_t user);
422int ipmi_set_maintenance_mode(ipmi_user_t user, int mode); 413int ipmi_set_maintenance_mode(ipmi_user_t user, int mode);
423 414
424/* 415/*
425 * Allow run-to-completion mode to be set for the interface of
426 * a specific user.
427 */
428void ipmi_user_set_run_to_completion(ipmi_user_t user, int val);
429
430/*
431 * When the user is created, it will not receive IPMI events by 416 * When the user is created, it will not receive IPMI events by
432 * default. The user must set this to TRUE to get incoming events. 417 * default. The user must set this to TRUE to get incoming events.
433 * The first user that sets this to TRUE will receive all events that 418 * The first user that sets this to TRUE will receive all events that
@@ -440,8 +425,7 @@ int ipmi_set_gets_events(ipmi_user_t user, int val);
440 * every existing interface when a new watcher is registered with 425 * every existing interface when a new watcher is registered with
441 * ipmi_smi_watcher_register(). 426 * ipmi_smi_watcher_register().
442 */ 427 */
443struct ipmi_smi_watcher 428struct ipmi_smi_watcher {
444{
445 struct list_head link; 429 struct list_head link;
446 430
447 /* You must set the owner to the current module, if you are in 431 /* You must set the owner to the current module, if you are in
@@ -512,8 +496,7 @@ int ipmi_validate_addr(struct ipmi_addr *addr, int len);
512 496
513 497
514/* Messages sent to the interface are this format. */ 498/* Messages sent to the interface are this format. */
515struct ipmi_req 499struct ipmi_req {
516{
517 unsigned char __user *addr; /* Address to send the message to. */ 500 unsigned char __user *addr; /* Address to send the message to. */
518 unsigned int addr_len; 501 unsigned int addr_len;
519 502
@@ -538,12 +521,11 @@ struct ipmi_req
538 521
539/* Messages sent to the interface with timing parameters are this 522/* Messages sent to the interface with timing parameters are this
540 format. */ 523 format. */
541struct ipmi_req_settime 524struct ipmi_req_settime {
542{
543 struct ipmi_req req; 525 struct ipmi_req req;
544 526
545 /* See ipmi_request_settime() above for details on these 527 /* See ipmi_request_settime() above for details on these
546 values. */ 528 values. */
547 int retries; 529 int retries;
548 unsigned int retry_time_ms; 530 unsigned int retry_time_ms;
549}; 531};
@@ -560,8 +542,7 @@ struct ipmi_req_settime
560 struct ipmi_req_settime) 542 struct ipmi_req_settime)
561 543
562/* Messages received from the interface are this format. */ 544/* Messages received from the interface are this format. */
563struct ipmi_recv 545struct ipmi_recv {
564{
565 int recv_type; /* Is this a command, response or an 546 int recv_type; /* Is this a command, response or an
566 asyncronous event. */ 547 asyncronous event. */
567 548
@@ -607,13 +588,12 @@ struct ipmi_recv
607 struct ipmi_recv) 588 struct ipmi_recv)
608 589
609/* Register to get commands from other entities on this interface. */ 590/* Register to get commands from other entities on this interface. */
610struct ipmi_cmdspec 591struct ipmi_cmdspec {
611{
612 unsigned char netfn; 592 unsigned char netfn;
613 unsigned char cmd; 593 unsigned char cmd;
614}; 594};
615 595
616/* 596/*
617 * Register to receive a specific command. error values: 597 * Register to receive a specific command. error values:
618 * - EFAULT - an address supplied was invalid. 598 * - EFAULT - an address supplied was invalid.
619 * - EBUSY - The netfn/cmd supplied was already in use. 599 * - EBUSY - The netfn/cmd supplied was already in use.
@@ -636,8 +616,7 @@ struct ipmi_cmdspec
636 * else. The chans field is a bitmask, (1 << channel) for each channel. 616 * else. The chans field is a bitmask, (1 << channel) for each channel.
637 * It may be IPMI_CHAN_ALL for all channels. 617 * It may be IPMI_CHAN_ALL for all channels.
638 */ 618 */
639struct ipmi_cmdspec_chans 619struct ipmi_cmdspec_chans {
640{
641 unsigned int netfn; 620 unsigned int netfn;
642 unsigned int cmd; 621 unsigned int cmd;
643 unsigned int chans; 622 unsigned int chans;
@@ -659,7 +638,7 @@ struct ipmi_cmdspec_chans
659#define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \ 638#define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \
660 struct ipmi_cmdspec_chans) 639 struct ipmi_cmdspec_chans)
661 640
662/* 641/*
663 * Set whether this interface receives events. Note that the first 642 * Set whether this interface receives events. Note that the first
664 * user registered for events will get all pending events for the 643 * user registered for events will get all pending events for the
665 * interface. error values: 644 * interface. error values:
@@ -675,15 +654,18 @@ struct ipmi_cmdspec_chans
675 * things it takes to determine your address (if not the BMC) and set 654 * things it takes to determine your address (if not the BMC) and set
676 * it for everyone else. You should probably leave the LUN alone. 655 * it for everyone else. You should probably leave the LUN alone.
677 */ 656 */
678struct ipmi_channel_lun_address_set 657struct ipmi_channel_lun_address_set {
679{
680 unsigned short channel; 658 unsigned short channel;
681 unsigned char value; 659 unsigned char value;
682}; 660};
683#define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set) 661#define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \
684#define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set) 662 _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
685#define IPMICTL_SET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set) 663#define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \
686#define IPMICTL_GET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set) 664 _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
665#define IPMICTL_SET_MY_CHANNEL_LUN_CMD \
666 _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
667#define IPMICTL_GET_MY_CHANNEL_LUN_CMD \
668 _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
687/* Legacy interfaces, these only set IPMB 0. */ 669/* Legacy interfaces, these only set IPMB 0. */
688#define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int) 670#define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int)
689#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int) 671#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int)
@@ -694,8 +676,7 @@ struct ipmi_channel_lun_address_set
694 * Get/set the default timing values for an interface. You shouldn't 676 * Get/set the default timing values for an interface. You shouldn't
695 * generally mess with these. 677 * generally mess with these.
696 */ 678 */
697struct ipmi_timing_parms 679struct ipmi_timing_parms {
698{
699 int retries; 680 int retries;
700 unsigned int retry_time_ms; 681 unsigned int retry_time_ms;
701}; 682};
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 6e8cec503380..62b73668b602 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -60,8 +60,7 @@ typedef struct ipmi_smi *ipmi_smi_t;
60 * asynchronous data and messages and request them from the 60 * asynchronous data and messages and request them from the
61 * interface. 61 * interface.
62 */ 62 */
63struct ipmi_smi_msg 63struct ipmi_smi_msg {
64{
65 struct list_head link; 64 struct list_head link;
66 65
67 long msgid; 66 long msgid;
@@ -74,12 +73,11 @@ struct ipmi_smi_msg
74 unsigned char rsp[IPMI_MAX_MSG_LENGTH]; 73 unsigned char rsp[IPMI_MAX_MSG_LENGTH];
75 74
76 /* Will be called when the system is done with the message 75 /* Will be called when the system is done with the message
77 (presumably to free it). */ 76 (presumably to free it). */
78 void (*done)(struct ipmi_smi_msg *msg); 77 void (*done)(struct ipmi_smi_msg *msg);
79}; 78};
80 79
81struct ipmi_smi_handlers 80struct ipmi_smi_handlers {
82{
83 struct module *owner; 81 struct module *owner;
84 82
85 /* The low-level interface cannot start sending messages to 83 /* The low-level interface cannot start sending messages to
@@ -231,7 +229,7 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg)
231 directory for this interface. Note that the entry will 229 directory for this interface. Note that the entry will
232 automatically be dstroyed when the interface is destroyed. */ 230 automatically be dstroyed when the interface is destroyed. */
233int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, 231int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
234 read_proc_t *read_proc, write_proc_t *write_proc, 232 read_proc_t *read_proc,
235 void *data, struct module *owner); 233 void *data, struct module *owner);
236 234
237#endif /* __LINUX_IPMI_SMI_H */ 235#endif /* __LINUX_IPMI_SMI_H */
diff --git a/include/linux/isicom.h b/include/linux/isicom.h
index 8f4c71759d73..bbd42197298f 100644
--- a/include/linux/isicom.h
+++ b/include/linux/isicom.h
@@ -1,11 +1,6 @@
1#ifndef _LINUX_ISICOM_H 1#ifndef _LINUX_ISICOM_H
2#define _LINUX_ISICOM_H 2#define _LINUX_ISICOM_H
3 3
4/*#define ISICOM_DEBUG*/
5/*#define ISICOM_DEBUG_DTR_RTS*/
6
7#ifdef __KERNEL__
8
9#define YES 1 4#define YES 1
10#define NO 0 5#define NO 0
11 6
@@ -85,6 +80,4 @@
85 80
86#define ISI_TXOK 0x0001 81#define ISI_TXOK 0x0001
87 82
88#endif /* __KERNEL__ */
89
90#endif /* ISICOM_H */ 83#endif /* ISICOM_H */
diff --git a/include/linux/kbuild.h b/include/linux/kbuild.h
new file mode 100644
index 000000000000..22a72198c14b
--- /dev/null
+++ b/include/linux/kbuild.h
@@ -0,0 +1,15 @@
1#ifndef __LINUX_KBUILD_H
2#define __LINUX_KBUILD_H
3
4#define DEFINE(sym, val) \
5 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
6
7#define BLANK() asm volatile("\n->" : : )
8
9#define OFFSET(sym, str, mem) \
10 DEFINE(sym, offsetof(struct str, mem))
11
12#define COMMENT(x) \
13 asm volatile("\n->#" x)
14
15#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index cd6d02cf854d..4d46e299afb5 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -20,6 +20,9 @@
20extern const char linux_banner[]; 20extern const char linux_banner[];
21extern const char linux_proc_banner[]; 21extern const char linux_proc_banner[];
22 22
23#define USHORT_MAX ((u16)(~0U))
24#define SHORT_MAX ((s16)(USHORT_MAX>>1))
25#define SHORT_MIN (-SHORT_MAX - 1)
23#define INT_MAX ((int)(~0U>>1)) 26#define INT_MAX ((int)(~0U>>1))
24#define INT_MIN (-INT_MAX - 1) 27#define INT_MIN (-INT_MAX - 1)
25#define UINT_MAX (~0U) 28#define UINT_MAX (~0U)
@@ -188,6 +191,7 @@ extern int log_buf_copy(char *dest, int idx, int len);
188extern int printk_ratelimit_jiffies; 191extern int printk_ratelimit_jiffies;
189extern int printk_ratelimit_burst; 192extern int printk_ratelimit_burst;
190extern int printk_ratelimit(void); 193extern int printk_ratelimit(void);
194extern int __ratelimit(int ratelimit_jiffies, int ratelimit_burst);
191extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); 195extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst);
192extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, 196extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
193 unsigned int interval_msec); 197 unsigned int interval_msec);
@@ -255,6 +259,7 @@ extern enum system_states {
255#define TAINT_USER (1<<6) 259#define TAINT_USER (1<<6)
256#define TAINT_DIE (1<<7) 260#define TAINT_DIE (1<<7)
257#define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) 261#define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8)
262#define TAINT_WARN (1<<9)
258 263
259extern void dump_stack(void) __cold; 264extern void dump_stack(void) __cold;
260 265
@@ -333,33 +338,90 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
333#endif /* __LITTLE_ENDIAN */ 338#endif /* __LITTLE_ENDIAN */
334 339
335/* 340/*
336 * min()/max() macros that also do 341 * min()/max()/clamp() macros that also do
337 * strict type-checking.. See the 342 * strict type-checking.. See the
338 * "unnecessary" pointer comparison. 343 * "unnecessary" pointer comparison.
339 */ 344 */
340#define min(x,y) ({ \ 345#define min(x, y) ({ \
341 typeof(x) _x = (x); \ 346 typeof(x) _min1 = (x); \
342 typeof(y) _y = (y); \ 347 typeof(y) _min2 = (y); \
343 (void) (&_x == &_y); \ 348 (void) (&_min1 == &_min2); \
344 _x < _y ? _x : _y; }) 349 _min1 < _min2 ? _min1 : _min2; })
345 350
346#define max(x,y) ({ \ 351#define max(x, y) ({ \
347 typeof(x) _x = (x); \ 352 typeof(x) _max1 = (x); \
348 typeof(y) _y = (y); \ 353 typeof(y) _max2 = (y); \
349 (void) (&_x == &_y); \ 354 (void) (&_max1 == &_max2); \
350 _x > _y ? _x : _y; }) 355 _max1 > _max2 ? _max1 : _max2; })
356
357/**
358 * clamp - return a value clamped to a given range with strict typechecking
359 * @val: current value
360 * @min: minimum allowable value
361 * @max: maximum allowable value
362 *
363 * This macro does strict typechecking of min/max to make sure they are of the
364 * same type as val. See the unnecessary pointer comparisons.
365 */
366#define clamp(val, min, max) ({ \
367 typeof(val) __val = (val); \
368 typeof(min) __min = (min); \
369 typeof(max) __max = (max); \
370 (void) (&__val == &__min); \
371 (void) (&__val == &__max); \
372 __val = __val < __min ? __min: __val; \
373 __val > __max ? __max: __val; })
351 374
352/* 375/*
353 * ..and if you can't take the strict 376 * ..and if you can't take the strict
354 * types, you can specify one yourself. 377 * types, you can specify one yourself.
355 * 378 *
356 * Or not use min/max at all, of course. 379 * Or not use min/max/clamp at all, of course.
380 */
381#define min_t(type, x, y) ({ \
382 type __min1 = (x); \
383 type __min2 = (y); \
384 __min1 < __min2 ? __min1: __min2; })
385
386#define max_t(type, x, y) ({ \
387 type __max1 = (x); \
388 type __max2 = (y); \
389 __max1 > __max2 ? __max1: __max2; })
390
391/**
392 * clamp_t - return a value clamped to a given range using a given type
393 * @type: the type of variable to use
394 * @val: current value
395 * @min: minimum allowable value
396 * @max: maximum allowable value
397 *
398 * This macro does no typechecking and uses temporary variables of type
399 * 'type' to make all the comparisons.
357 */ 400 */
358#define min_t(type,x,y) \ 401#define clamp_t(type, val, min, max) ({ \
359 ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) 402 type __val = (val); \
360#define max_t(type,x,y) \ 403 type __min = (min); \
361 ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) 404 type __max = (max); \
405 __val = __val < __min ? __min: __val; \
406 __val > __max ? __max: __val; })
362 407
408/**
409 * clamp_val - return a value clamped to a given range using val's type
410 * @val: current value
411 * @min: minimum allowable value
412 * @max: maximum allowable value
413 *
414 * This macro does no typechecking and uses temporary variables of whatever
415 * type the input argument 'val' is. This is useful when val is an unsigned
416 * type and min and max are literals that will otherwise be assigned a signed
417 * integer type.
418 */
419#define clamp_val(val, min, max) ({ \
420 typeof(val) __val = (val); \
421 typeof(val) __min = (min); \
422 typeof(val) __max = (max); \
423 __val = __val < __min ? __min: __val; \
424 __val > __max ? __max: __val; })
363 425
364/** 426/**
365 * container_of - cast a member of a structure out to the containing structure 427 * container_of - cast a member of a structure out to the containing structure
diff --git a/include/linux/key.h b/include/linux/key.h
index a70b8a8f2005..c45c962d1cc5 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -19,6 +19,7 @@
19#include <linux/list.h> 19#include <linux/list.h>
20#include <linux/rbtree.h> 20#include <linux/rbtree.h>
21#include <linux/rcupdate.h> 21#include <linux/rcupdate.h>
22#include <linux/sysctl.h>
22#include <asm/atomic.h> 23#include <asm/atomic.h>
23 24
24#ifdef __KERNEL__ 25#ifdef __KERNEL__
@@ -67,6 +68,8 @@ struct key;
67#define KEY_OTH_SETATTR 0x00000020 68#define KEY_OTH_SETATTR 0x00000020
68#define KEY_OTH_ALL 0x0000003f 69#define KEY_OTH_ALL 0x0000003f
69 70
71#define KEY_PERM_UNDEF 0xffffffff
72
70struct seq_file; 73struct seq_file;
71struct user_struct; 74struct user_struct;
72struct signal_struct; 75struct signal_struct;
@@ -208,16 +211,19 @@ extern struct key *request_key(struct key_type *type,
208 211
209extern struct key *request_key_with_auxdata(struct key_type *type, 212extern struct key *request_key_with_auxdata(struct key_type *type,
210 const char *description, 213 const char *description,
211 const char *callout_info, 214 const void *callout_info,
215 size_t callout_len,
212 void *aux); 216 void *aux);
213 217
214extern struct key *request_key_async(struct key_type *type, 218extern struct key *request_key_async(struct key_type *type,
215 const char *description, 219 const char *description,
216 const char *callout_info); 220 const void *callout_info,
221 size_t callout_len);
217 222
218extern struct key *request_key_async_with_auxdata(struct key_type *type, 223extern struct key *request_key_async_with_auxdata(struct key_type *type,
219 const char *description, 224 const char *description,
220 const char *callout_info, 225 const void *callout_info,
226 size_t callout_len,
221 void *aux); 227 void *aux);
222 228
223extern int wait_for_key_construction(struct key *key, bool intr); 229extern int wait_for_key_construction(struct key *key, bool intr);
@@ -229,6 +235,7 @@ extern key_ref_t key_create_or_update(key_ref_t keyring,
229 const char *description, 235 const char *description,
230 const void *payload, 236 const void *payload,
231 size_t plen, 237 size_t plen,
238 key_perm_t perm,
232 unsigned long flags); 239 unsigned long flags);
233 240
234extern int key_update(key_ref_t key, 241extern int key_update(key_ref_t key,
@@ -257,14 +264,18 @@ extern int keyring_add_key(struct key *keyring,
257 264
258extern struct key *key_lookup(key_serial_t id); 265extern struct key *key_lookup(key_serial_t id);
259 266
260#define key_serial(key) ((key) ? (key)->serial : 0) 267static inline key_serial_t key_serial(struct key *key)
268{
269 return key ? key->serial : 0;
270}
271
272#ifdef CONFIG_SYSCTL
273extern ctl_table key_sysctls[];
274#endif
261 275
262/* 276/*
263 * the userspace interface 277 * the userspace interface
264 */ 278 */
265extern struct key root_user_keyring, root_session_keyring;
266extern int alloc_uid_keyring(struct user_struct *user,
267 struct task_struct *ctx);
268extern void switch_uid_keyring(struct user_struct *new_user); 279extern void switch_uid_keyring(struct user_struct *new_user);
269extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk); 280extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk);
270extern int copy_thread_group_keys(struct task_struct *tsk); 281extern int copy_thread_group_keys(struct task_struct *tsk);
@@ -293,7 +304,6 @@ extern void key_init(void);
293#define make_key_ref(k, p) ({ NULL; }) 304#define make_key_ref(k, p) ({ NULL; })
294#define key_ref_to_ptr(k) ({ NULL; }) 305#define key_ref_to_ptr(k) ({ NULL; })
295#define is_key_possessed(k) 0 306#define is_key_possessed(k) 0
296#define alloc_uid_keyring(u,c) 0
297#define switch_uid_keyring(u) do { } while(0) 307#define switch_uid_keyring(u) do { } while(0)
298#define __install_session_keyring(t, k) ({ NULL; }) 308#define __install_session_keyring(t, k) ({ NULL; })
299#define copy_keys(f,t) 0 309#define copy_keys(f,t) 0
@@ -306,10 +316,6 @@ extern void key_init(void);
306#define key_fsgid_changed(t) do { } while(0) 316#define key_fsgid_changed(t) do { } while(0)
307#define key_init() do { } while(0) 317#define key_init() do { } while(0)
308 318
309/* Initial keyrings */
310extern struct key root_user_keyring;
311extern struct key root_session_keyring;
312
313#endif /* CONFIG_KEYS */ 319#endif /* CONFIG_KEYS */
314#endif /* __KERNEL__ */ 320#endif /* __KERNEL__ */
315#endif /* _LINUX_KEY_H */ 321#endif /* _LINUX_KEY_H */
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index 3365945640c9..656ee6b77a4a 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -49,5 +49,6 @@
49#define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ 49#define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */
50#define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ 50#define KEYCTL_SET_TIMEOUT 15 /* set key timeout */
51#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ 51#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */
52#define KEYCTL_GET_SECURITY 17 /* get key security label */
52 53
53#endif /* _LINUX_KEYCTL_H */ 54#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 404f4464cb1a..29f62e1733ff 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -21,8 +21,6 @@
21#ifndef _LINUX_KFIFO_H 21#ifndef _LINUX_KFIFO_H
22#define _LINUX_KFIFO_H 22#define _LINUX_KFIFO_H
23 23
24#ifdef __KERNEL__
25
26#include <linux/kernel.h> 24#include <linux/kernel.h>
27#include <linux/spinlock.h> 25#include <linux/spinlock.h>
28 26
@@ -151,7 +149,4 @@ static inline unsigned int kfifo_len(struct kfifo *fifo)
151 return ret; 149 return ret;
152} 150}
153 151
154#else
155#warning "don't include kernel headers in userspace"
156#endif /* __KERNEL__ */
157#endif 152#endif
diff --git a/include/linux/kobj_map.h b/include/linux/kobj_map.h
index bafe178a381f..73717ed9ea79 100644
--- a/include/linux/kobj_map.h
+++ b/include/linux/kobj_map.h
@@ -1,5 +1,3 @@
1#ifdef __KERNEL__
2
3#include <linux/mutex.h> 1#include <linux/mutex.h>
4 2
5typedef struct kobject *kobj_probe_t(dev_t, int *, void *); 3typedef struct kobject *kobj_probe_t(dev_t, int *, void *);
@@ -10,5 +8,3 @@ int kobj_map(struct kobj_map *, dev_t, unsigned long, struct module *,
10void kobj_unmap(struct kobj_map *, dev_t, unsigned long); 8void kobj_unmap(struct kobj_map *, dev_t, unsigned long);
11struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *); 9struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *);
12struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *); 10struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *);
13
14#endif
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index caa3f411f15d..39e709f88aa0 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -16,8 +16,6 @@
16#ifndef _KOBJECT_H_ 16#ifndef _KOBJECT_H_
17#define _KOBJECT_H_ 17#define _KOBJECT_H_
18 18
19#ifdef __KERNEL__
20
21#include <linux/types.h> 19#include <linux/types.h>
22#include <linux/list.h> 20#include <linux/list.h>
23#include <linux/sysfs.h> 21#include <linux/sysfs.h>
@@ -224,5 +222,4 @@ static inline int kobject_action_type(const char *buf, size_t count,
224{ return -EINVAL; } 222{ return -EINVAL; }
225#endif 223#endif
226 224
227#endif /* __KERNEL__ */
228#endif /* _KOBJECT_H_ */ 225#endif /* _KOBJECT_H_ */
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 5d185635786e..0cef6badd6fb 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -15,8 +15,6 @@
15#ifndef _KREF_H_ 15#ifndef _KREF_H_
16#define _KREF_H_ 16#define _KREF_H_
17 17
18#ifdef __KERNEL__
19
20#include <linux/types.h> 18#include <linux/types.h>
21#include <asm/atomic.h> 19#include <asm/atomic.h>
22 20
@@ -29,5 +27,4 @@ void kref_init(struct kref *kref);
29void kref_get(struct kref *kref); 27void kref_get(struct kref *kref);
30int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 28int kref_put(struct kref *kref, void (*release) (struct kref *kref));
31 29
32#endif /* __KERNEL__ */
33#endif /* _KREF_H_ */ 30#endif /* _KREF_H_ */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 395a523d8c30..d1dfe872ee30 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -548,11 +548,6 @@ struct ata_device {
548 u64 n_sectors; /* size of device, if ATA */ 548 u64 n_sectors; /* size of device, if ATA */
549 unsigned int class; /* ATA_DEV_xxx */ 549 unsigned int class; /* ATA_DEV_xxx */
550 550
551 union {
552 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
553 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
554 };
555
556 u8 pio_mode; 551 u8 pio_mode;
557 u8 dma_mode; 552 u8 dma_mode;
558 u8 xfer_mode; 553 u8 xfer_mode;
@@ -574,8 +569,13 @@ struct ata_device {
574 u16 sectors; /* Number of sectors per track */ 569 u16 sectors; /* Number of sectors per track */
575 570
576 /* error history */ 571 /* error history */
577 struct ata_ering ering;
578 int spdn_cnt; 572 int spdn_cnt;
573 struct ata_ering ering;
574
575 union {
576 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
577 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
578 };
579}; 579};
580 580
581/* Offset into struct ata_device. Fields above it are maintained 581/* Offset into struct ata_device. Fields above it are maintained
diff --git a/include/linux/list.h b/include/linux/list.h
index b4a939b6b625..08cf4f651889 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -1,8 +1,6 @@
1#ifndef _LINUX_LIST_H 1#ifndef _LINUX_LIST_H
2#define _LINUX_LIST_H 2#define _LINUX_LIST_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/stddef.h> 4#include <linux/stddef.h>
7#include <linux/poison.h> 5#include <linux/poison.h>
8#include <linux/prefetch.h> 6#include <linux/prefetch.h>
@@ -328,7 +326,7 @@ static inline int list_is_singular(const struct list_head *head)
328 return !list_empty(head) && (head->next == head->prev); 326 return !list_empty(head) && (head->next == head->prev);
329} 327}
330 328
331static inline void __list_splice(struct list_head *list, 329static inline void __list_splice(const struct list_head *list,
332 struct list_head *head) 330 struct list_head *head)
333{ 331{
334 struct list_head *first = list->next; 332 struct list_head *first = list->next;
@@ -347,7 +345,8 @@ static inline void __list_splice(struct list_head *list,
347 * @list: the new list to add. 345 * @list: the new list to add.
348 * @head: the place to add it in the first list. 346 * @head: the place to add it in the first list.
349 */ 347 */
350static inline void list_splice(struct list_head *list, struct list_head *head) 348static inline void list_splice(const struct list_head *list,
349 struct list_head *head)
351{ 350{
352 if (!list_empty(list)) 351 if (!list_empty(list))
353 __list_splice(list, head); 352 __list_splice(list, head);
@@ -982,7 +981,4 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
982 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 981 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
983 pos = rcu_dereference(pos->next)) 982 pos = rcu_dereference(pos->next))
984 983
985#else
986#warning "don't include kernel headers in userspace"
987#endif /* __KERNEL__ */
988#endif 984#endif
diff --git a/include/linux/lmb.h b/include/linux/lmb.h
index 271153d27fba..c46c89505dac 100644
--- a/include/linux/lmb.h
+++ b/include/linux/lmb.h
@@ -40,7 +40,8 @@ extern struct lmb lmb;
40 40
41extern void __init lmb_init(void); 41extern void __init lmb_init(void);
42extern void __init lmb_analyze(void); 42extern void __init lmb_analyze(void);
43extern long __init lmb_add(u64 base, u64 size); 43extern long lmb_add(u64 base, u64 size);
44extern long lmb_remove(u64 base, u64 size);
44extern long __init lmb_reserve(u64 base, u64 size); 45extern long __init lmb_reserve(u64 base, u64 size);
45extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid, 46extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid,
46 u64 (*nid_range)(u64, u64, int *)); 47 u64 (*nid_range)(u64, u64, int *));
@@ -53,6 +54,7 @@ extern u64 __init lmb_phys_mem_size(void);
53extern u64 __init lmb_end_of_DRAM(void); 54extern u64 __init lmb_end_of_DRAM(void);
54extern void __init lmb_enforce_memory_limit(u64 memory_limit); 55extern void __init lmb_enforce_memory_limit(u64 memory_limit);
55extern int __init lmb_is_reserved(u64 addr); 56extern int __init lmb_is_reserved(u64 addr);
57extern int lmb_find(struct lmb_property *res);
56 58
57extern void lmb_dump_all(void); 59extern void lmb_dump_all(void);
58 60
diff --git a/include/linux/mca-legacy.h b/include/linux/mca-legacy.h
index f2bb770e530a..7a3aea845902 100644
--- a/include/linux/mca-legacy.h
+++ b/include/linux/mca-legacy.h
@@ -34,7 +34,6 @@
34extern int mca_find_adapter(int id, int start); 34extern int mca_find_adapter(int id, int start);
35extern int mca_find_unused_adapter(int id, int start); 35extern int mca_find_unused_adapter(int id, int start);
36 36
37extern int mca_is_adapter_used(int slot);
38extern int mca_mark_as_used(int slot); 37extern int mca_mark_as_used(int slot);
39extern void mca_mark_as_unused(int slot); 38extern void mca_mark_as_unused(int slot);
40 39
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 8b1c4295848b..e6608776bc96 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -27,9 +27,6 @@ struct mm_struct;
27 27
28#ifdef CONFIG_CGROUP_MEM_RES_CTLR 28#ifdef CONFIG_CGROUP_MEM_RES_CTLR
29 29
30extern void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p);
31extern void mm_free_cgroup(struct mm_struct *mm);
32
33#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0) 30#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0)
34 31
35extern struct page_cgroup *page_get_page_cgroup(struct page *page); 32extern struct page_cgroup *page_get_page_cgroup(struct page *page);
@@ -48,8 +45,10 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
48extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); 45extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask);
49int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); 46int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
50 47
48extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
49
51#define mm_match_cgroup(mm, cgroup) \ 50#define mm_match_cgroup(mm, cgroup) \
52 ((cgroup) == rcu_dereference((mm)->mem_cgroup)) 51 ((cgroup) == mem_cgroup_from_task((mm)->owner))
53 52
54extern int mem_cgroup_prepare_migration(struct page *page); 53extern int mem_cgroup_prepare_migration(struct page *page);
55extern void mem_cgroup_end_migration(struct page *page); 54extern void mem_cgroup_end_migration(struct page *page);
@@ -73,15 +72,6 @@ extern long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem,
73 struct zone *zone, int priority); 72 struct zone *zone, int priority);
74 73
75#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 74#else /* CONFIG_CGROUP_MEM_RES_CTLR */
76static inline void mm_init_cgroup(struct mm_struct *mm,
77 struct task_struct *p)
78{
79}
80
81static inline void mm_free_cgroup(struct mm_struct *mm)
82{
83}
84
85static inline void page_reset_bad_cgroup(struct page *page) 75static inline void page_reset_bad_cgroup(struct page *page)
86{ 76{
87} 77}
diff --git a/include/linux/memory.h b/include/linux/memory.h
index f80e0e331cb7..2f5f8a5ef2a0 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -53,6 +53,13 @@ struct memory_notify {
53struct notifier_block; 53struct notifier_block;
54struct mem_section; 54struct mem_section;
55 55
56/*
57 * Priorities for the hotplug memory callback routines (stored in decreasing
58 * order in the callback chain)
59 */
60#define SLAB_CALLBACK_PRI 1
61#define IPC_CALLBACK_PRI 10
62
56#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE 63#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE
57static inline int memory_dev_init(void) 64static inline int memory_dev_init(void)
58{ 65{
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 9fa1a8002ce2..a744383d16e9 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -382,7 +382,8 @@ void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres,
382 int size); 382 int size);
383 383
384int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, 384int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
385 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq); 385 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq,
386 int collapsed);
386void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); 387void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
387 388
388int mlx4_qp_alloc(struct mlx4_dev *dev, int sqpn, struct mlx4_qp *qp); 389int mlx4_qp_alloc(struct mlx4_dev *dev, int sqpn, struct mlx4_qp *qp);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 8b7f4a5d4f6a..c31a9cd2a30e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1066,6 +1066,19 @@ extern void unlink_file_vma(struct vm_area_struct *);
1066extern struct vm_area_struct *copy_vma(struct vm_area_struct **, 1066extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
1067 unsigned long addr, unsigned long len, pgoff_t pgoff); 1067 unsigned long addr, unsigned long len, pgoff_t pgoff);
1068extern void exit_mmap(struct mm_struct *); 1068extern void exit_mmap(struct mm_struct *);
1069
1070#ifdef CONFIG_PROC_FS
1071/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */
1072extern void added_exe_file_vma(struct mm_struct *mm);
1073extern void removed_exe_file_vma(struct mm_struct *mm);
1074#else
1075static inline void added_exe_file_vma(struct mm_struct *mm)
1076{}
1077
1078static inline void removed_exe_file_vma(struct mm_struct *mm)
1079{}
1080#endif /* CONFIG_PROC_FS */
1081
1069extern int may_expand_vm(struct mm_struct *mm, unsigned long npages); 1082extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
1070extern int install_special_mapping(struct mm_struct *mm, 1083extern int install_special_mapping(struct mm_struct *mm,
1071 unsigned long addr, unsigned long len, 1084 unsigned long addr, unsigned long len,
@@ -1230,8 +1243,6 @@ int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
1230 void __user *, size_t *, loff_t *); 1243 void __user *, size_t *, loff_t *);
1231unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, 1244unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
1232 unsigned long lru_pages); 1245 unsigned long lru_pages);
1233void drop_pagecache(void);
1234void drop_slab(void);
1235 1246
1236#ifndef CONFIG_MMU 1247#ifndef CONFIG_MMU
1237#define randomize_va_space 0 1248#define randomize_va_space 0
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index e2bae8dde35a..eb7c16cc9559 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -225,8 +225,15 @@ struct mm_struct {
225 /* aio bits */ 225 /* aio bits */
226 rwlock_t ioctx_list_lock; /* aio lock */ 226 rwlock_t ioctx_list_lock; /* aio lock */
227 struct kioctx *ioctx_list; 227 struct kioctx *ioctx_list;
228#ifdef CONFIG_CGROUP_MEM_RES_CTLR 228#ifdef CONFIG_MM_OWNER
229 struct mem_cgroup *mem_cgroup; 229 struct task_struct *owner; /* The thread group leader that */
230 /* owns the mm_struct. */
231#endif
232
233#ifdef CONFIG_PROC_FS
234 /* store ref to file /proc/<pid>/exe symlink points to */
235 struct file *exe_file;
236 unsigned long num_exe_file_vmas;
230#endif 237#endif
231}; 238};
232 239
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index aad98003176f..c463cd8a15a4 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1,7 +1,6 @@
1#ifndef _LINUX_MMZONE_H 1#ifndef _LINUX_MMZONE_H
2#define _LINUX_MMZONE_H 2#define _LINUX_MMZONE_H
3 3
4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
6#ifndef __GENERATING_BOUNDS_H 5#ifndef __GENERATING_BOUNDS_H
7 6
@@ -97,6 +96,7 @@ enum zone_stat_item {
97 NR_UNSTABLE_NFS, /* NFS unstable pages */ 96 NR_UNSTABLE_NFS, /* NFS unstable pages */
98 NR_BOUNCE, 97 NR_BOUNCE,
99 NR_VMSCAN_WRITE, 98 NR_VMSCAN_WRITE,
99 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */
100#ifdef CONFIG_NUMA 100#ifdef CONFIG_NUMA
101 NUMA_HIT, /* allocated in intended node */ 101 NUMA_HIT, /* allocated in intended node */
102 NUMA_MISS, /* allocated in non intended node */ 102 NUMA_MISS, /* allocated in non intended node */
@@ -1004,5 +1004,4 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
1004 1004
1005#endif /* !__GENERATING_BOUNDS.H */ 1005#endif /* !__GENERATING_BOUNDS.H */
1006#endif /* !__ASSEMBLY__ */ 1006#endif /* !__ASSEMBLY__ */
1007#endif /* __KERNEL__ */
1008#endif /* _LINUX_MMZONE_H */ 1007#endif /* _LINUX_MMZONE_H */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 139d49d2f078..d73eceaa7afb 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -368,4 +368,15 @@ struct virtio_device_id {
368}; 368};
369#define VIRTIO_DEV_ANY_ID 0xffffffff 369#define VIRTIO_DEV_ANY_ID 0xffffffff
370 370
371/* i2c */
372
373#define I2C_NAME_SIZE 20
374#define I2C_MODULE_PREFIX "i2c:"
375
376struct i2c_device_id {
377 char name[I2C_NAME_SIZE];
378 kernel_ulong_t driver_data; /* Data private to the driver */
379};
380
381
371#endif /* LINUX_MOD_DEVICETABLE_H */ 382#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/mount.h b/include/linux/mount.h
index b4836d58f428..4374d1adeb4b 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -10,7 +10,6 @@
10 */ 10 */
11#ifndef _LINUX_MOUNT_H 11#ifndef _LINUX_MOUNT_H
12#define _LINUX_MOUNT_H 12#define _LINUX_MOUNT_H
13#ifdef __KERNEL__
14 13
15#include <linux/types.h> 14#include <linux/types.h>
16#include <linux/list.h> 15#include <linux/list.h>
@@ -114,5 +113,4 @@ extern void mark_mounts_for_expiry(struct list_head *mounts);
114extern spinlock_t vfsmount_lock; 113extern spinlock_t vfsmount_lock;
115extern dev_t name_to_dev_t(char *name); 114extern dev_t name_to_dev_t(char *name);
116 115
117#endif
118#endif /* _LINUX_MOUNT_H */ 116#endif /* _LINUX_MOUNT_H */
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 10a3d5a1abff..6f3b8e79a991 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -49,16 +49,26 @@ struct msginfo {
49 unsigned short msgseg; 49 unsigned short msgseg;
50}; 50};
51 51
52/*
53 * Scaling factor to compute msgmni:
54 * the memory dedicated to msg queues (msgmni * msgmnb) should occupy
55 * at most 1/MSG_MEM_SCALE of the lowmem (see the formula in ipc/msg.c):
56 * up to 8MB : msgmni = 16 (MSGMNI)
57 * 4 GB : msgmni = 8K
58 * more than 16 GB : msgmni = 32K (IPCMNI)
59 */
60#define MSG_MEM_SCALE 32
61
52#define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */ 62#define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */
53#define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */ 63#define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */
54#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ 64#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */
55 65
56/* unused */ 66/* unused */
57#define MSGPOOL (MSGMNI*MSGMNB/1024) /* size in kilobytes of message pool */ 67#define MSGPOOL (MSGMNI * MSGMNB) /* size in bytes of message pool */
58#define MSGTQL MSGMNB /* number of system message headers */ 68#define MSGTQL MSGMNB /* number of system message headers */
59#define MSGMAP MSGMNB /* number of entries in message map */ 69#define MSGMAP MSGMNB /* number of entries in message map */
60#define MSGSSZ 16 /* message segment size */ 70#define MSGSSZ 16 /* message segment size */
61#define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ) /* max no. of segments */ 71#define __MSGSEG (MSGPOOL / MSGSSZ) /* max no. of segments */
62#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff) 72#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
63 73
64#ifdef __KERNEL__ 74#ifdef __KERNEL__
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 94bb46d82efd..8f2939227207 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -22,6 +22,7 @@ struct msi_desc {
22 __u8 masked : 1; 22 __u8 masked : 1;
23 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 23 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
24 __u8 pos; /* Location of the msi capability */ 24 __u8 pos; /* Location of the msi capability */
25 __u32 maskbits_mask; /* mask bits mask */
25 __u16 entry_nr; /* specific enabled entry */ 26 __u16 entry_nr; /* specific enabled entry */
26 unsigned default_irq; /* default pre-assigned irq */ 27 unsigned default_irq; /* default pre-assigned irq */
27 }msi_attrib; 28 }msi_attrib;
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 986572081e19..155719dab813 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -56,9 +56,11 @@ struct nbd_device {
56 int magic; 56 int magic;
57 57
58 spinlock_t queue_lock; 58 spinlock_t queue_lock;
59 struct list_head queue_head;/* Requests are added here... */ 59 struct list_head queue_head; /* Requests waiting result */
60 struct request *active_req; 60 struct request *active_req;
61 wait_queue_head_t active_wq; 61 wait_queue_head_t active_wq;
62 struct list_head waiting_queue; /* Requests to be sent */
63 wait_queue_head_t waiting_wq;
62 64
63 struct mutex tx_lock; 65 struct mutex tx_lock;
64 struct gendisk *disk; 66 struct gendisk *disk;
@@ -86,11 +88,7 @@ struct nbd_request {
86 char handle[8]; 88 char handle[8];
87 __be64 from; 89 __be64 from;
88 __be32 len; 90 __be32 len;
89} 91} __attribute__ ((packed));
90#ifdef __GNUC__
91 __attribute__ ((packed))
92#endif
93;
94 92
95/* 93/*
96 * This is the reply packet that nbd-server sends back to the client after 94 * This is the reply packet that nbd-server sends back to the client after
diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h
index bdb4c8ae6924..4b0bec477846 100644
--- a/include/linux/ncp_fs_i.h
+++ b/include/linux/ncp_fs_i.h
@@ -8,8 +8,6 @@
8#ifndef _LINUX_NCP_FS_I 8#ifndef _LINUX_NCP_FS_I
9#define _LINUX_NCP_FS_I 9#define _LINUX_NCP_FS_I
10 10
11#ifdef __KERNEL__
12
13/* 11/*
14 * This is the ncpfs part of the inode structure. This must contain 12 * This is the ncpfs part of the inode structure. This must contain
15 * all the information we need to work with an inode after creation. 13 * all the information we need to work with an inode after creation.
@@ -28,6 +26,4 @@ struct ncp_inode_info {
28 struct inode vfs_inode; 26 struct inode vfs_inode;
29}; 27};
30 28
31#endif /* __KERNEL__ */
32
33#endif /* _LINUX_NCP_FS_I */ 29#endif /* _LINUX_NCP_FS_I */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index fb0713b6ffaf..bec1062a25a1 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -166,6 +166,7 @@ struct netlink_skb_parms
166 __u32 dst_group; 166 __u32 dst_group;
167 kernel_cap_t eff_cap; 167 kernel_cap_t eff_cap;
168 __u32 loginuid; /* Login (audit) uid */ 168 __u32 loginuid; /* Login (audit) uid */
169 __u32 sessionid; /* Session id (audit) */
169 __u32 sid; /* SELinux security id */ 170 __u32 sid; /* SELinux security id */
170}; 171};
171 172
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 20dfed590183..0ff6224d172a 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -121,6 +121,10 @@ extern int raw_notifier_chain_register(struct raw_notifier_head *nh,
121extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, 121extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh,
122 struct notifier_block *nb); 122 struct notifier_block *nb);
123 123
124extern int blocking_notifier_chain_cond_register(
125 struct blocking_notifier_head *nh,
126 struct notifier_block *nb);
127
124extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, 128extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,
125 struct notifier_block *nb); 129 struct notifier_block *nb);
126extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, 130extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh,
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 6dc11959770c..afe338217d91 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -1,6 +1,5 @@
1#ifndef _LINUX_OF_DEVICE_H 1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H 2#define _LINUX_OF_DEVICE_H
3#ifdef __KERNEL__
4 3
5#include <linux/device.h> 4#include <linux/device.h>
6#include <linux/of.h> 5#include <linux/of.h>
@@ -25,5 +24,4 @@ static inline void of_device_free(struct of_device *dev)
25 of_release_dev(&dev->dev); 24 of_release_dev(&dev->dev);
26} 25}
27 26
28#endif /* __KERNEL__ */
29#endif /* _LINUX_OF_DEVICE_H */ 27#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 292491324b01..96acd0dae241 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -20,8 +20,6 @@
20/* Include the pci register defines */ 20/* Include the pci register defines */
21#include <linux/pci_regs.h> 21#include <linux/pci_regs.h>
22 22
23struct pci_vpd;
24
25/* 23/*
26 * The PCI interface treats multi-function devices as independent 24 * The PCI interface treats multi-function devices as independent
27 * devices. The slot/function address of each device is encoded 25 * devices. The slot/function address of each device is encoded
@@ -131,6 +129,8 @@ struct pci_cap_saved_state {
131}; 129};
132 130
133struct pcie_link_state; 131struct pcie_link_state;
132struct pci_vpd;
133
134/* 134/*
135 * The pci_dev structure is used to describe PCI devices. 135 * The pci_dev structure is used to describe PCI devices.
136 */ 136 */
@@ -254,7 +254,7 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
254#define PCI_NUM_RESOURCES 11 254#define PCI_NUM_RESOURCES 11
255 255
256#ifndef PCI_BUS_NUM_RESOURCES 256#ifndef PCI_BUS_NUM_RESOURCES
257#define PCI_BUS_NUM_RESOURCES 8 257#define PCI_BUS_NUM_RESOURCES 16
258#endif 258#endif
259 259
260#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ 260#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */
@@ -666,6 +666,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
666 666
667void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 667void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
668 void *userdata); 668 void *userdata);
669int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix);
669int pci_cfg_space_size(struct pci_dev *dev); 670int pci_cfg_space_size(struct pci_dev *dev);
670unsigned char pci_bus_max_busnr(struct pci_bus *bus); 671unsigned char pci_bus_max_busnr(struct pci_bus *bus);
671 672
@@ -701,6 +702,8 @@ static inline int pci_enable_msi(struct pci_dev *dev)
701 return -1; 702 return -1;
702} 703}
703 704
705static inline void pci_msi_shutdown(struct pci_dev *dev)
706{ }
704static inline void pci_disable_msi(struct pci_dev *dev) 707static inline void pci_disable_msi(struct pci_dev *dev)
705{ } 708{ }
706 709
@@ -710,6 +713,8 @@ static inline int pci_enable_msix(struct pci_dev *dev,
710 return -1; 713 return -1;
711} 714}
712 715
716static inline void pci_msix_shutdown(struct pci_dev *dev)
717{ }
713static inline void pci_disable_msix(struct pci_dev *dev) 718static inline void pci_disable_msix(struct pci_dev *dev)
714{ } 719{ }
715 720
@@ -720,9 +725,11 @@ static inline void pci_restore_msi_state(struct pci_dev *dev)
720{ } 725{ }
721#else 726#else
722extern int pci_enable_msi(struct pci_dev *dev); 727extern int pci_enable_msi(struct pci_dev *dev);
728extern void pci_msi_shutdown(struct pci_dev *dev);
723extern void pci_disable_msi(struct pci_dev *dev); 729extern void pci_disable_msi(struct pci_dev *dev);
724extern int pci_enable_msix(struct pci_dev *dev, 730extern int pci_enable_msix(struct pci_dev *dev,
725 struct msix_entry *entries, int nvec); 731 struct msix_entry *entries, int nvec);
732extern void pci_msix_shutdown(struct pci_dev *dev);
726extern void pci_disable_msix(struct pci_dev *dev); 733extern void pci_disable_msix(struct pci_dev *dev);
727extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 734extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
728extern void pci_restore_msi_state(struct pci_dev *dev); 735extern void pci_restore_msi_state(struct pci_dev *dev);
@@ -1053,5 +1060,13 @@ extern unsigned long pci_cardbus_mem_size;
1053 1060
1054extern int pcibios_add_platform_entries(struct pci_dev *dev); 1061extern int pcibios_add_platform_entries(struct pci_dev *dev);
1055 1062
1063#ifdef CONFIG_PCI_MMCONFIG
1064extern void __init pci_mmcfg_early_init(void);
1065extern void __init pci_mmcfg_late_init(void);
1066#else
1067static inline void pci_mmcfg_early_init(void) { }
1068static inline void pci_mmcfg_late_init(void) { }
1069#endif
1070
1056#endif /* __KERNEL__ */ 1071#endif /* __KERNEL__ */
1057#endif /* LINUX_PCI_H */ 1072#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 70eb3c803d47..e5a53daf17f1 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2413,6 +2413,8 @@
2413#define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0 2413#define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0
2414#define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2 2414#define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2
2415#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 2415#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601
2416#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119
2417#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a
2416#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 2418#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4
2417#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 2419#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5
2418#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca 2420#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 1ac969724bb2..d746a2abb322 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -4,7 +4,6 @@
4#include <linux/preempt.h> 4#include <linux/preempt.h>
5#include <linux/slab.h> /* For kmalloc() */ 5#include <linux/slab.h> /* For kmalloc() */
6#include <linux/smp.h> 6#include <linux/smp.h>
7#include <linux/string.h> /* For memset() */
8#include <linux/cpumask.h> 7#include <linux/cpumask.h>
9 8
10#include <asm/percpu.h> 9#include <asm/percpu.h>
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 012cd558189b..a84e9ff9b27e 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -105,10 +105,6 @@ struct exec_domain {
105 */ 105 */
106#define personality(pers) (pers & PER_MASK) 106#define personality(pers) (pers & PER_MASK)
107 107
108/*
109 * Personality of the currently running process.
110 */
111#define get_personality (current->personality)
112 108
113/* 109/*
114 * Change personality of the currently running process. 110 * Change personality of the currently running process.
diff --git a/include/linux/phantom.h b/include/linux/phantom.h
index 96f4048a6cc3..02268c54c250 100644
--- a/include/linux/phantom.h
+++ b/include/linux/phantom.h
@@ -27,14 +27,17 @@ struct phm_regs {
27 27
28#define PH_IOC_MAGIC 'p' 28#define PH_IOC_MAGIC 'p'
29#define PHN_GET_REG _IOWR(PH_IOC_MAGIC, 0, struct phm_reg *) 29#define PHN_GET_REG _IOWR(PH_IOC_MAGIC, 0, struct phm_reg *)
30#define PHN_SET_REG _IOW (PH_IOC_MAGIC, 1, struct phm_reg *) 30#define PHN_SET_REG _IOW(PH_IOC_MAGIC, 1, struct phm_reg *)
31#define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *) 31#define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *)
32#define PHN_SET_REGS _IOW (PH_IOC_MAGIC, 3, struct phm_regs *) 32#define PHN_SET_REGS _IOW(PH_IOC_MAGIC, 3, struct phm_regs *)
33/* this ioctl tells the driver, that the caller is not OpenHaptics and might 33/* this ioctl tells the driver, that the caller is not OpenHaptics and might
34 * use improved registers update (no more phantom switchoffs when using 34 * use improved registers update (no more phantom switchoffs when using
35 * libphantom) */ 35 * libphantom) */
36#define PHN_NOT_OH _IO (PH_IOC_MAGIC, 4) 36#define PHN_NOT_OH _IO(PH_IOC_MAGIC, 4)
37#define PH_IOC_MAXNR 4 37#define PHN_GETREG _IOWR(PH_IOC_MAGIC, 5, struct phm_reg)
38#define PHN_SETREG _IOW(PH_IOC_MAGIC, 6, struct phm_reg)
39#define PHN_GETREGS _IOWR(PH_IOC_MAGIC, 7, struct phm_regs)
40#define PHN_SETREGS _IOW(PH_IOC_MAGIC, 8, struct phm_regs)
38 41
39#define PHN_CONTROL 0x6 /* control byte in iaddr space */ 42#define PHN_CONTROL 0x6 /* control byte in iaddr space */
40#define PHN_CTL_AMP 0x1 /* switch after torques change */ 43#define PHN_CTL_AMP 0x1 /* switch after torques change */
diff --git a/include/linux/pid.h b/include/linux/pid.h
index c7980810eb09..c21c7e8124a7 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -60,7 +60,7 @@ struct pid
60 /* lists of tasks that use this pid */ 60 /* lists of tasks that use this pid */
61 struct hlist_head tasks[PIDTYPE_MAX]; 61 struct hlist_head tasks[PIDTYPE_MAX];
62 struct rcu_head rcu; 62 struct rcu_head rcu;
63 int level; 63 unsigned int level;
64 struct upid numbers[1]; 64 struct upid numbers[1];
65}; 65};
66 66
@@ -89,9 +89,11 @@ extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);
89 * attach_pid() and detach_pid() must be called with the tasklist_lock 89 * attach_pid() and detach_pid() must be called with the tasklist_lock
90 * write-held. 90 * write-held.
91 */ 91 */
92extern int attach_pid(struct task_struct *task, enum pid_type type, 92extern void attach_pid(struct task_struct *task, enum pid_type type,
93 struct pid *pid); 93 struct pid *pid);
94extern void detach_pid(struct task_struct *task, enum pid_type); 94extern void detach_pid(struct task_struct *task, enum pid_type);
95extern void change_pid(struct task_struct *task, enum pid_type,
96 struct pid *pid);
95extern void transfer_pid(struct task_struct *old, struct task_struct *new, 97extern void transfer_pid(struct task_struct *old, struct task_struct *new,
96 enum pid_type); 98 enum pid_type);
97 99
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index fcd61fa2c833..caff5283d15c 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -20,7 +20,7 @@ struct pid_namespace {
20 int last_pid; 20 int last_pid;
21 struct task_struct *child_reaper; 21 struct task_struct *child_reaper;
22 struct kmem_cache *pid_cachep; 22 struct kmem_cache *pid_cachep;
23 int level; 23 unsigned int level;
24 struct pid_namespace *parent; 24 struct pid_namespace *parent;
25#ifdef CONFIG_PROC_FS 25#ifdef CONFIG_PROC_FS
26 struct vfsmount *proc_mnt; 26 struct vfsmount *proc_mnt;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 1de72cbbe0d1..39a7ee859b67 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -21,8 +21,6 @@
21#ifndef _LINUX_PM_H 21#ifndef _LINUX_PM_H
22#define _LINUX_PM_H 22#define _LINUX_PM_H
23 23
24#ifdef __KERNEL__
25
26#include <linux/list.h> 24#include <linux/list.h>
27#include <asm/atomic.h> 25#include <asm/atomic.h>
28#include <asm/errno.h> 26#include <asm/errno.h>
@@ -225,6 +223,4 @@ extern unsigned int pm_flags;
225#define PM_APM 1 223#define PM_APM 1
226#define PM_ACPI 2 224#define PM_ACPI 2
227 225
228#endif /* __KERNEL__ */
229
230#endif /* _LINUX_PM_H */ 226#endif /* _LINUX_PM_H */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index e3b2c0068de7..63b128d512fb 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -6,8 +6,6 @@
6#ifndef _LINUX_PNP_H 6#ifndef _LINUX_PNP_H
7#define _LINUX_PNP_H 7#define _LINUX_PNP_H
8 8
9#ifdef __KERNEL__
10
11#include <linux/device.h> 9#include <linux/device.h>
12#include <linux/list.h> 10#include <linux/list.h>
13#include <linux/errno.h> 11#include <linux/errno.h>
@@ -478,6 +476,4 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
478#define pnp_dbg(format, arg...) do {} while (0) 476#define pnp_dbg(format, arg...) do {} while (0)
479#endif 477#endif
480 478
481#endif /* __KERNEL__ */
482
483#endif /* _LINUX_PNP_H */ 479#endif /* _LINUX_PNP_H */
diff --git a/include/linux/poison.h b/include/linux/poison.h
index a9c31be7052c..9f31683728fd 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -10,6 +10,13 @@
10#define LIST_POISON1 ((void *) 0x00100100) 10#define LIST_POISON1 ((void *) 0x00100100)
11#define LIST_POISON2 ((void *) 0x00200200) 11#define LIST_POISON2 ((void *) 0x00200200)
12 12
13/********** include/linux/timer.h **********/
14/*
15 * Magic number "tsta" to indicate a static timer initializer
16 * for the object debugging code.
17 */
18#define TIMER_ENTRY_STATIC ((void *) 0x74737461)
19
13/********** mm/slab.c **********/ 20/********** mm/slab.c **********/
14/* 21/*
15 * Magic nums for obj red zoning. 22 * Magic nums for obj red zoning.
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 9b6c935f69cf..9883bc942262 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -9,7 +9,6 @@
9 9
10struct net; 10struct net;
11struct completion; 11struct completion;
12
13/* 12/*
14 * The proc filesystem constants/structures 13 * The proc filesystem constants/structures
15 */ 14 */
@@ -41,7 +40,7 @@ enum {
41 * /proc file has a parent, but "subdir" is NULL for all 40 * /proc file has a parent, but "subdir" is NULL for all
42 * non-directory entries). 41 * non-directory entries).
43 * 42 *
44 * "get_info" is called at "read", while "owner" is used to protect module 43 * "owner" is used to protect module
45 * from unloading while proc_dir_entry is in use 44 * from unloading while proc_dir_entry is in use
46 */ 45 */
47 46
@@ -49,7 +48,6 @@ typedef int (read_proc_t)(char *page, char **start, off_t off,
49 int count, int *eof, void *data); 48 int count, int *eof, void *data);
50typedef int (write_proc_t)(struct file *file, const char __user *buffer, 49typedef int (write_proc_t)(struct file *file, const char __user *buffer,
51 unsigned long count, void *data); 50 unsigned long count, void *data);
52typedef int (get_info_t)(char *, char **, off_t, int);
53 51
54struct proc_dir_entry { 52struct proc_dir_entry {
55 unsigned int low_ino; 53 unsigned int low_ino;
@@ -70,7 +68,6 @@ struct proc_dir_entry {
70 * somewhere. 68 * somewhere.
71 */ 69 */
72 const struct file_operations *proc_fops; 70 const struct file_operations *proc_fops;
73 get_info_t *get_info;
74 struct module *owner; 71 struct module *owner;
75 struct proc_dir_entry *next, *parent, *subdir; 72 struct proc_dir_entry *next, *parent, *subdir;
76 void *data; 73 void *data;
@@ -97,10 +94,6 @@ struct vmcore {
97 94
98#ifdef CONFIG_PROC_FS 95#ifdef CONFIG_PROC_FS
99 96
100extern struct proc_dir_entry proc_root;
101extern struct proc_dir_entry *proc_root_fs;
102extern struct proc_dir_entry *proc_bus;
103extern struct proc_dir_entry *proc_root_driver;
104extern struct proc_dir_entry *proc_root_kcore; 97extern struct proc_dir_entry *proc_root_kcore;
105 98
106extern spinlock_t proc_subdir_lock; 99extern spinlock_t proc_subdir_lock;
@@ -123,9 +116,10 @@ void de_put(struct proc_dir_entry *de);
123 116
124extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 117extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
125 struct proc_dir_entry *parent); 118 struct proc_dir_entry *parent);
126struct proc_dir_entry *proc_create(const char *name, mode_t mode, 119struct proc_dir_entry *proc_create_data(const char *name, mode_t mode,
127 struct proc_dir_entry *parent, 120 struct proc_dir_entry *parent,
128 const struct file_operations *proc_fops); 121 const struct file_operations *proc_fops,
122 void *data);
129extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); 123extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
130 124
131extern struct vfsmount *proc_mnt; 125extern struct vfsmount *proc_mnt;
@@ -180,6 +174,12 @@ extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);
180extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, 174extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode,
181 struct proc_dir_entry *parent); 175 struct proc_dir_entry *parent);
182 176
177static inline struct proc_dir_entry *proc_create(const char *name, mode_t mode,
178 struct proc_dir_entry *parent, const struct file_operations *proc_fops)
179{
180 return proc_create_data(name, mode, parent, proc_fops, NULL);
181}
182
183static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 183static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
184 mode_t mode, struct proc_dir_entry *base, 184 mode_t mode, struct proc_dir_entry *base,
185 read_proc_t *read_proc, void * data) 185 read_proc_t *read_proc, void * data)
@@ -192,24 +192,19 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
192 return res; 192 return res;
193} 193}
194 194
195static inline struct proc_dir_entry *create_proc_info_entry(const char *name,
196 mode_t mode, struct proc_dir_entry *base, get_info_t *get_info)
197{
198 struct proc_dir_entry *res=create_proc_entry(name,mode,base);
199 if (res) res->get_info=get_info;
200 return res;
201}
202
203extern struct proc_dir_entry *proc_net_fops_create(struct net *net, 195extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
204 const char *name, mode_t mode, const struct file_operations *fops); 196 const char *name, mode_t mode, const struct file_operations *fops);
205extern void proc_net_remove(struct net *net, const char *name); 197extern void proc_net_remove(struct net *net, const char *name);
206extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, 198extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
207 struct proc_dir_entry *parent); 199 struct proc_dir_entry *parent);
208 200
209#else 201/* While the {get|set|dup}_mm_exe_file functions are for mm_structs, they are
202 * only needed to implement /proc/<pid>|self/exe so we define them here. */
203extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file);
204extern struct file *get_mm_exe_file(struct mm_struct *mm);
205extern void dup_mm_exe_file(struct mm_struct *oldmm, struct mm_struct *newmm);
210 206
211#define proc_root_driver NULL 207#else
212#define proc_bus NULL
213 208
214#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) 209#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
215static inline void proc_net_remove(struct net *net, const char *name) {} 210static inline void proc_net_remove(struct net *net, const char *name) {}
@@ -226,6 +221,12 @@ static inline struct proc_dir_entry *proc_create(const char *name,
226{ 221{
227 return NULL; 222 return NULL;
228} 223}
224static inline struct proc_dir_entry *proc_create_data(const char *name,
225 mode_t mode, struct proc_dir_entry *parent,
226 const struct file_operations *proc_fops, void *data)
227{
228 return NULL;
229}
229#define remove_proc_entry(name, parent) do {} while (0) 230#define remove_proc_entry(name, parent) do {} while (0)
230 231
231static inline struct proc_dir_entry *proc_symlink(const char *name, 232static inline struct proc_dir_entry *proc_symlink(const char *name,
@@ -236,16 +237,11 @@ static inline struct proc_dir_entry *proc_mkdir(const char *name,
236static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 237static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
237 mode_t mode, struct proc_dir_entry *base, 238 mode_t mode, struct proc_dir_entry *base,
238 read_proc_t *read_proc, void * data) { return NULL; } 239 read_proc_t *read_proc, void * data) { return NULL; }
239static inline struct proc_dir_entry *create_proc_info_entry(const char *name,
240 mode_t mode, struct proc_dir_entry *base, get_info_t *get_info)
241 { return NULL; }
242 240
243struct tty_driver; 241struct tty_driver;
244static inline void proc_tty_register_driver(struct tty_driver *driver) {}; 242static inline void proc_tty_register_driver(struct tty_driver *driver) {};
245static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; 243static inline void proc_tty_unregister_driver(struct tty_driver *driver) {};
246 244
247extern struct proc_dir_entry proc_root;
248
249static inline int pid_ns_prepare_proc(struct pid_namespace *ns) 245static inline int pid_ns_prepare_proc(struct pid_namespace *ns)
250{ 246{
251 return 0; 247 return 0;
@@ -255,6 +251,19 @@ static inline void pid_ns_release_proc(struct pid_namespace *ns)
255{ 251{
256} 252}
257 253
254static inline void set_mm_exe_file(struct mm_struct *mm,
255 struct file *new_exe_file)
256{}
257
258static inline struct file *get_mm_exe_file(struct mm_struct *mm)
259{
260 return NULL;
261}
262
263static inline void dup_mm_exe_file(struct mm_struct *oldmm,
264 struct mm_struct *newmm)
265{}
266
258#endif /* CONFIG_PROC_FS */ 267#endif /* CONFIG_PROC_FS */
259 268
260#if !defined(CONFIG_PROC_KCORE) 269#if !defined(CONFIG_PROC_KCORE)
diff --git a/include/linux/profile.h b/include/linux/profile.h
index ff576d1db67d..05c1cc736937 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -1,8 +1,6 @@
1#ifndef _LINUX_PROFILE_H 1#ifndef _LINUX_PROFILE_H
2#define _LINUX_PROFILE_H 2#define _LINUX_PROFILE_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/kernel.h> 4#include <linux/kernel.h>
7#include <linux/init.h> 5#include <linux/init.h>
8#include <linux/cpumask.h> 6#include <linux/cpumask.h>
@@ -118,6 +116,4 @@ static inline void unregister_timer_hook(int (*hook)(struct pt_regs *))
118 116
119#endif /* CONFIG_PROFILING */ 117#endif /* CONFIG_PROFILING */
120 118
121#endif /* __KERNEL__ */
122
123#endif /* _LINUX_PROFILE_H */ 119#endif /* _LINUX_PROFILE_H */
diff --git a/include/linux/proportions.h b/include/linux/proportions.h
index 2c3b3cad92be..5afc1b23346d 100644
--- a/include/linux/proportions.h
+++ b/include/linux/proportions.h
@@ -78,6 +78,19 @@ void prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl)
78} 78}
79 79
80/* 80/*
81 * Limit the time part in order to ensure there are some bits left for the
82 * cycle counter and fraction multiply.
83 */
84#define PROP_MAX_SHIFT (3*BITS_PER_LONG/4)
85
86#define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1)
87#define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT)
88
89void __prop_inc_percpu_max(struct prop_descriptor *pd,
90 struct prop_local_percpu *pl, long frac);
91
92
93/*
81 * ----- SINGLE ------ 94 * ----- SINGLE ------
82 */ 95 */
83 96
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index ebe0c17039cf..f98501ba557e 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -98,6 +98,10 @@ extern void ptrace_untrace(struct task_struct *child);
98extern int ptrace_may_attach(struct task_struct *task); 98extern int ptrace_may_attach(struct task_struct *task);
99extern int __ptrace_may_attach(struct task_struct *task); 99extern int __ptrace_may_attach(struct task_struct *task);
100 100
101static inline int ptrace_reparented(struct task_struct *child)
102{
103 return child->real_parent != child->parent;
104}
101static inline void ptrace_link(struct task_struct *child, 105static inline void ptrace_link(struct task_struct *child,
102 struct task_struct *new_parent) 106 struct task_struct *new_parent)
103{ 107{
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 8ab630b67fcc..81a1a02d4566 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -94,6 +94,7 @@ extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
94extern void md_do_sync(mddev_t *mddev); 94extern void md_do_sync(mddev_t *mddev);
95extern void md_new_event(mddev_t *mddev); 95extern void md_new_event(mddev_t *mddev);
96extern void md_allow_write(mddev_t *mddev); 96extern void md_allow_write(mddev_t *mddev);
97extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
97 98
98#endif /* CONFIG_MD */ 99#endif /* CONFIG_MD */
99#endif 100#endif
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 7bb6d1abf71e..812ffa590cff 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -84,6 +84,10 @@ struct mdk_rdev_s
84#define AllReserved 6 /* If whole device is reserved for 84#define AllReserved 6 /* If whole device is reserved for
85 * one array */ 85 * one array */
86#define AutoDetected 7 /* added by auto-detect */ 86#define AutoDetected 7 /* added by auto-detect */
87#define Blocked 8 /* An error occured on an externally
88 * managed array, don't allow writes
89 * until it is cleared */
90 wait_queue_head_t blocked_wait;
87 91
88 int desc_nr; /* descriptor index in the superblock */ 92 int desc_nr; /* descriptor index in the superblock */
89 int raid_disk; /* role of device in array */ 93 int raid_disk; /* role of device in array */
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
index b3dccd68629e..b3aa05baab8a 100644
--- a/include/linux/rcuclassic.h
+++ b/include/linux/rcuclassic.h
@@ -33,8 +33,6 @@
33#ifndef __LINUX_RCUCLASSIC_H 33#ifndef __LINUX_RCUCLASSIC_H
34#define __LINUX_RCUCLASSIC_H 34#define __LINUX_RCUCLASSIC_H
35 35
36#ifdef __KERNEL__
37
38#include <linux/cache.h> 36#include <linux/cache.h>
39#include <linux/spinlock.h> 37#include <linux/spinlock.h>
40#include <linux/threads.h> 38#include <linux/threads.h>
@@ -163,5 +161,4 @@ extern long rcu_batches_completed_bh(void);
163#define rcu_enter_nohz() do { } while (0) 161#define rcu_enter_nohz() do { } while (0)
164#define rcu_exit_nohz() do { } while (0) 162#define rcu_exit_nohz() do { } while (0)
165 163
166#endif /* __KERNEL__ */
167#endif /* __LINUX_RCUCLASSIC_H */ 164#endif /* __LINUX_RCUCLASSIC_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 37a642c54871..8082d6587a0f 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -33,8 +33,6 @@
33#ifndef __LINUX_RCUPDATE_H 33#ifndef __LINUX_RCUPDATE_H
34#define __LINUX_RCUPDATE_H 34#define __LINUX_RCUPDATE_H
35 35
36#ifdef __KERNEL__
37
38#include <linux/cache.h> 36#include <linux/cache.h>
39#include <linux/spinlock.h> 37#include <linux/spinlock.h>
40#include <linux/threads.h> 38#include <linux/threads.h>
@@ -245,5 +243,4 @@ extern long rcu_batches_completed_bh(void);
245extern void rcu_init(void); 243extern void rcu_init(void);
246extern int rcu_needs_cpu(int cpu); 244extern int rcu_needs_cpu(int cpu);
247 245
248#endif /* __KERNEL__ */
249#endif /* __LINUX_RCUPDATE_H */ 246#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
index d038aa6e5ee1..8a05c7e20bc4 100644
--- a/include/linux/rcupreempt.h
+++ b/include/linux/rcupreempt.h
@@ -33,8 +33,6 @@
33#ifndef __LINUX_RCUPREEMPT_H 33#ifndef __LINUX_RCUPREEMPT_H
34#define __LINUX_RCUPREEMPT_H 34#define __LINUX_RCUPREEMPT_H
35 35
36#ifdef __KERNEL__
37
38#include <linux/cache.h> 36#include <linux/cache.h>
39#include <linux/spinlock.h> 37#include <linux/spinlock.h>
40#include <linux/threads.h> 38#include <linux/threads.h>
@@ -104,5 +102,4 @@ static inline void rcu_exit_nohz(void)
104#define rcu_exit_nohz() do { } while (0) 102#define rcu_exit_nohz() do { } while (0)
105#endif /* CONFIG_NO_HZ */ 103#endif /* CONFIG_NO_HZ */
106 104
107#endif /* __KERNEL__ */
108#endif /* __LINUX_RCUPREEMPT_H */ 105#endif /* __LINUX_RCUPREEMPT_H */
diff --git a/include/linux/rcupreempt_trace.h b/include/linux/rcupreempt_trace.h
index 21cd6b2a5c42..b99ae073192a 100644
--- a/include/linux/rcupreempt_trace.h
+++ b/include/linux/rcupreempt_trace.h
@@ -32,7 +32,6 @@
32#ifndef __LINUX_RCUPREEMPT_TRACE_H 32#ifndef __LINUX_RCUPREEMPT_TRACE_H
33#define __LINUX_RCUPREEMPT_TRACE_H 33#define __LINUX_RCUPREEMPT_TRACE_H
34 34
35#ifdef __KERNEL__
36#include <linux/types.h> 35#include <linux/types.h>
37#include <linux/kernel.h> 36#include <linux/kernel.h>
38 37
@@ -95,5 +94,4 @@ extern void rcupreempt_trace_done_remove(struct rcupreempt_trace *trace);
95extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace); 94extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace);
96extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace); 95extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace);
97 96
98#endif /* __KERNEL__ */
99#endif /* __LINUX_RCUPREEMPT_TRACE_H */ 97#endif /* __LINUX_RCUPREEMPT_TRACE_H */
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index db5ef9b83c3f..336ee43ed7d8 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -177,7 +177,6 @@ struct reiserfs_journal {
177 struct reiserfs_journal_cnode *j_last; /* newest journal block */ 177 struct reiserfs_journal_cnode *j_last; /* newest journal block */
178 struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ 178 struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */
179 179
180 struct file *j_dev_file;
181 struct block_device *j_dev_bd; 180 struct block_device *j_dev_bd;
182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ 181 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
183 182
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 61363ce896d5..6d9e1fca098c 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -9,6 +9,8 @@
9 * 9 *
10 * Author: Pavel Emelianov <xemul@openvz.org> 10 * Author: Pavel Emelianov <xemul@openvz.org>
11 * 11 *
12 * See Documentation/controllers/resource_counter.txt for more
13 * info about what this counter is.
12 */ 14 */
13 15
14#include <linux/cgroup.h> 16#include <linux/cgroup.h>
@@ -25,6 +27,10 @@ struct res_counter {
25 */ 27 */
26 unsigned long long usage; 28 unsigned long long usage;
27 /* 29 /*
30 * the maximal value of the usage from the counter creation
31 */
32 unsigned long long max_usage;
33 /*
28 * the limit that usage cannot exceed 34 * the limit that usage cannot exceed
29 */ 35 */
30 unsigned long long limit; 36 unsigned long long limit;
@@ -39,8 +45,9 @@ struct res_counter {
39 spinlock_t lock; 45 spinlock_t lock;
40}; 46};
41 47
42/* 48/**
43 * Helpers to interact with userspace 49 * Helpers to interact with userspace
50 * res_counter_read_u64() - returns the value of the specified member.
44 * res_counter_read/_write - put/get the specified fields from the 51 * res_counter_read/_write - put/get the specified fields from the
45 * res_counter struct to/from the user 52 * res_counter struct to/from the user
46 * 53 *
@@ -51,6 +58,8 @@ struct res_counter {
51 * @pos: and the offset. 58 * @pos: and the offset.
52 */ 59 */
53 60
61u64 res_counter_read_u64(struct res_counter *counter, int member);
62
54ssize_t res_counter_read(struct res_counter *counter, int member, 63ssize_t res_counter_read(struct res_counter *counter, int member,
55 const char __user *buf, size_t nbytes, loff_t *pos, 64 const char __user *buf, size_t nbytes, loff_t *pos,
56 int (*read_strategy)(unsigned long long val, char *s)); 65 int (*read_strategy)(unsigned long long val, char *s));
@@ -64,6 +73,7 @@ ssize_t res_counter_write(struct res_counter *counter, int member,
64 73
65enum { 74enum {
66 RES_USAGE, 75 RES_USAGE,
76 RES_MAX_USAGE,
67 RES_LIMIT, 77 RES_LIMIT,
68 RES_FAILCNT, 78 RES_FAILCNT,
69}; 79};
@@ -124,4 +134,21 @@ static inline bool res_counter_check_under_limit(struct res_counter *cnt)
124 return ret; 134 return ret;
125} 135}
126 136
137static inline void res_counter_reset_max(struct res_counter *cnt)
138{
139 unsigned long flags;
140
141 spin_lock_irqsave(&cnt->lock, flags);
142 cnt->max_usage = cnt->usage;
143 spin_unlock_irqrestore(&cnt->lock, flags);
144}
145
146static inline void res_counter_reset_failcnt(struct res_counter *cnt)
147{
148 unsigned long flags;
149
150 spin_lock_irqsave(&cnt->lock, flags);
151 cnt->failcnt = 0;
152 spin_unlock_irqrestore(&cnt->lock, flags);
153}
127#endif 154#endif
diff --git a/include/linux/resource.h b/include/linux/resource.h
index ae13db714742..aaa423a6f3d9 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -19,6 +19,7 @@ struct task_struct;
19#define RUSAGE_SELF 0 19#define RUSAGE_SELF 0
20#define RUSAGE_CHILDREN (-1) 20#define RUSAGE_CHILDREN (-1)
21#define RUSAGE_BOTH (-2) /* sys_wait4() uses this */ 21#define RUSAGE_BOTH (-2) /* sys_wait4() uses this */
22#define RUSAGE_THREAD 1 /* only the calling thread */
22 23
23struct rusage { 24struct rusage {
24 struct timeval ru_utime; /* user time used */ 25 struct timeval ru_utime; /* user time used */
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 68e3f6853fa6..c1c99c9643d3 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -14,8 +14,6 @@
14#ifndef LINUX_RIO_H 14#ifndef LINUX_RIO_H
15#define LINUX_RIO_H 15#define LINUX_RIO_H
16 16
17#ifdef __KERNEL__
18
19#include <linux/types.h> 17#include <linux/types.h>
20#include <linux/ioport.h> 18#include <linux/ioport.h>
21#include <linux/list.h> 19#include <linux/list.h>
@@ -23,7 +21,6 @@
23#include <linux/device.h> 21#include <linux/device.h>
24#include <linux/rio_regs.h> 22#include <linux/rio_regs.h>
25 23
26#define RIO_ANY_DESTID 0xff
27#define RIO_NO_HOPCOUNT -1 24#define RIO_NO_HOPCOUNT -1
28#define RIO_INVALID_DESTID 0xffff 25#define RIO_INVALID_DESTID 0xffff
29 26
@@ -39,11 +36,8 @@
39 entry is invalid (no route 36 entry is invalid (no route
40 exists for the device ID) */ 37 exists for the device ID) */
41 38
42#ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT 39#define RIO_MAX_ROUTE_ENTRIES(size) (size ? (1 << 16) : (1 << 8))
43#define RIO_MAX_ROUTE_ENTRIES (1 << 8) 40#define RIO_ANY_DESTID(size) (size ? 0xffff : 0xff)
44#else
45#define RIO_MAX_ROUTE_ENTRIES (1 << 16)
46#endif
47 41
48#define RIO_MAX_MBOX 4 42#define RIO_MAX_MBOX 4
49#define RIO_MAX_MSG_SIZE 0x1000 43#define RIO_MAX_MSG_SIZE 0x1000
@@ -149,6 +143,11 @@ struct rio_dbell {
149 void *dev_id; 143 void *dev_id;
150}; 144};
151 145
146enum rio_phy_type {
147 RIO_PHY_PARALLEL,
148 RIO_PHY_SERIAL,
149};
150
152/** 151/**
153 * struct rio_mport - RIO master port info 152 * struct rio_mport - RIO master port info
154 * @dbells: List of doorbell events 153 * @dbells: List of doorbell events
@@ -163,6 +162,7 @@ struct rio_dbell {
163 * @id: Port ID, unique among all ports 162 * @id: Port ID, unique among all ports
164 * @index: Port index, unique among all port interfaces of the same type 163 * @index: Port index, unique among all port interfaces of the same type
165 * @name: Port name string 164 * @name: Port name string
165 * @priv: Master port private data
166 */ 166 */
167struct rio_mport { 167struct rio_mport {
168 struct list_head dbells; /* list of doorbell events */ 168 struct list_head dbells; /* list of doorbell events */
@@ -177,7 +177,13 @@ struct rio_mport {
177 unsigned char id; /* port ID, unique among all ports */ 177 unsigned char id; /* port ID, unique among all ports */
178 unsigned char index; /* port index, unique among all port 178 unsigned char index; /* port index, unique among all port
179 interfaces of the same type */ 179 interfaces of the same type */
180 unsigned int sys_size; /* RapidIO common transport system size.
181 * 0 - Small size. 256 devices.
182 * 1 - Large size, 65536 devices.
183 */
184 enum rio_phy_type phy_type; /* RapidIO phy type */
180 unsigned char name[40]; 185 unsigned char name[40];
186 void *priv; /* Master port private data */
181}; 187};
182 188
183/** 189/**
@@ -211,7 +217,7 @@ struct rio_switch {
211 u16 switchid; 217 u16 switchid;
212 u16 hopcount; 218 u16 hopcount;
213 u16 destid; 219 u16 destid;
214 u8 route_table[RIO_MAX_ROUTE_ENTRIES]; 220 u8 *route_table;
215 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, 221 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
216 u16 table, u16 route_destid, u8 route_port); 222 u16 table, u16 route_destid, u8 route_port);
217 int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, 223 int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
@@ -229,13 +235,15 @@ struct rio_switch {
229 * @dsend: Callback to send a doorbell message. 235 * @dsend: Callback to send a doorbell message.
230 */ 236 */
231struct rio_ops { 237struct rio_ops {
232 int (*lcread) (int index, u32 offset, int len, u32 * data); 238 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
233 int (*lcwrite) (int index, u32 offset, int len, u32 data); 239 u32 *data);
234 int (*cread) (int index, u16 destid, u8 hopcount, u32 offset, int len, 240 int (*lcwrite) (struct rio_mport *mport, int index, u32 offset, int len,
235 u32 * data); 241 u32 data);
236 int (*cwrite) (int index, u16 destid, u8 hopcount, u32 offset, int len, 242 int (*cread) (struct rio_mport *mport, int index, u16 destid,
237 u32 data); 243 u8 hopcount, u32 offset, int len, u32 *data);
238 int (*dsend) (int index, u16 destid, u16 data); 244 int (*cwrite) (struct rio_mport *mport, int index, u16 destid,
245 u8 hopcount, u32 offset, int len, u32 data);
246 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);
239}; 247};
240 248
241#define RIO_RESOURCE_MEM 0x00000100 249#define RIO_RESOURCE_MEM 0x00000100
@@ -321,5 +329,4 @@ extern void rio_close_inb_mbox(struct rio_mport *, int);
321extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); 329extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);
322extern void rio_close_outb_mbox(struct rio_mport *, int); 330extern void rio_close_outb_mbox(struct rio_mport *, int);
323 331
324#endif /* __KERNEL__ */
325#endif /* LINUX_RIO_H */ 332#endif /* LINUX_RIO_H */
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 7adb2a1aac92..90987b7bcc1b 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -13,8 +13,6 @@
13#ifndef LINUX_RIO_DRV_H 13#ifndef LINUX_RIO_DRV_H
14#define LINUX_RIO_DRV_H 14#define LINUX_RIO_DRV_H
15 15
16#ifdef __KERNEL__
17
18#include <linux/types.h> 16#include <linux/types.h>
19#include <linux/ioport.h> 17#include <linux/ioport.h>
20#include <linux/list.h> 18#include <linux/list.h>
@@ -465,5 +463,4 @@ extern struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from);
465extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did, 463extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did,
466 struct rio_dev *from); 464 struct rio_dev *from);
467 465
468#endif /* __KERNEL__ */
469#endif /* LINUX_RIO_DRV_H */ 466#endif /* LINUX_RIO_DRV_H */
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 7b524b4109a0..efd348fe8ca7 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -9,8 +9,6 @@
9 9
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11 11
12#ifdef __KERNEL__
13
14#include <linux/types.h> 12#include <linux/types.h>
15#include <linux/kernel.h> 13#include <linux/kernel.h>
16#include <asm/system.h> 14#include <asm/system.h>
@@ -90,5 +88,4 @@ extern void up_read_non_owner(struct rw_semaphore *sem);
90# define up_read_non_owner(sem) up_read(sem) 88# define up_read_non_owner(sem) up_read(sem)
91#endif 89#endif
92 90
93#endif /* __KERNEL__ */
94#endif /* _LINUX_RWSEM_H */ 91#endif /* _LINUX_RWSEM_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 024d72b47a0c..03c238088aee 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -554,6 +554,14 @@ struct signal_struct {
554#define SIGNAL_STOP_DEQUEUED 0x00000002 /* stop signal dequeued */ 554#define SIGNAL_STOP_DEQUEUED 0x00000002 /* stop signal dequeued */
555#define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */ 555#define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */
556#define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */ 556#define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */
557/*
558 * Pending notifications to parent.
559 */
560#define SIGNAL_CLD_STOPPED 0x00000010
561#define SIGNAL_CLD_CONTINUED 0x00000020
562#define SIGNAL_CLD_MASK (SIGNAL_CLD_STOPPED|SIGNAL_CLD_CONTINUED)
563
564#define SIGNAL_UNKILLABLE 0x00000040 /* for init: ignore fatal signals */
557 565
558/* If true, all threads except ->group_exit_task have pending SIGKILL */ 566/* If true, all threads except ->group_exit_task have pending SIGKILL */
559static inline int signal_group_exit(const struct signal_struct *sig) 567static inline int signal_group_exit(const struct signal_struct *sig)
@@ -1167,7 +1175,7 @@ struct task_struct {
1167 struct sighand_struct *sighand; 1175 struct sighand_struct *sighand;
1168 1176
1169 sigset_t blocked, real_blocked; 1177 sigset_t blocked, real_blocked;
1170 sigset_t saved_sigmask; /* To be restored with TIF_RESTORE_SIGMASK */ 1178 sigset_t saved_sigmask; /* restored if set_restore_sigmask() was used */
1171 struct sigpending pending; 1179 struct sigpending pending;
1172 1180
1173 unsigned long sas_ss_sp; 1181 unsigned long sas_ss_sp;
@@ -1669,7 +1677,10 @@ extern struct pid_namespace init_pid_ns;
1669extern struct task_struct *find_task_by_pid_type_ns(int type, int pid, 1677extern struct task_struct *find_task_by_pid_type_ns(int type, int pid,
1670 struct pid_namespace *ns); 1678 struct pid_namespace *ns);
1671 1679
1672extern struct task_struct *find_task_by_pid(pid_t nr); 1680static inline struct task_struct *__deprecated find_task_by_pid(pid_t nr)
1681{
1682 return find_task_by_pid_type_ns(PIDTYPE_PID, nr, &init_pid_ns);
1683}
1673extern struct task_struct *find_task_by_vpid(pid_t nr); 1684extern struct task_struct *find_task_by_vpid(pid_t nr);
1674extern struct task_struct *find_task_by_pid_ns(pid_t nr, 1685extern struct task_struct *find_task_by_pid_ns(pid_t nr,
1675 struct pid_namespace *ns); 1686 struct pid_namespace *ns);
@@ -1745,8 +1756,7 @@ extern void zap_other_threads(struct task_struct *p);
1745extern int kill_proc(pid_t, int, int); 1756extern int kill_proc(pid_t, int, int);
1746extern struct sigqueue *sigqueue_alloc(void); 1757extern struct sigqueue *sigqueue_alloc(void);
1747extern void sigqueue_free(struct sigqueue *); 1758extern void sigqueue_free(struct sigqueue *);
1748extern int send_sigqueue(int, struct sigqueue *, struct task_struct *); 1759extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group);
1749extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *);
1750extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); 1760extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
1751extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); 1761extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
1752 1762
@@ -2148,6 +2158,19 @@ static inline void migration_init(void)
2148#define TASK_SIZE_OF(tsk) TASK_SIZE 2158#define TASK_SIZE_OF(tsk) TASK_SIZE
2149#endif 2159#endif
2150 2160
2161#ifdef CONFIG_MM_OWNER
2162extern void mm_update_next_owner(struct mm_struct *mm);
2163extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
2164#else
2165static inline void mm_update_next_owner(struct mm_struct *mm)
2166{
2167}
2168
2169static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2170{
2171}
2172#endif /* CONFIG_MM_OWNER */
2173
2151#endif /* __KERNEL__ */ 2174#endif /* __KERNEL__ */
2152 2175
2153#endif 2176#endif
diff --git a/include/linux/security.h b/include/linux/security.h
index d0a28fd1747a..50737c70e78e 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -53,8 +53,9 @@ extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective,
53extern int cap_bprm_set_security(struct linux_binprm *bprm); 53extern int cap_bprm_set_security(struct linux_binprm *bprm);
54extern void cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe); 54extern void cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
55extern int cap_bprm_secureexec(struct linux_binprm *bprm); 55extern int cap_bprm_secureexec(struct linux_binprm *bprm);
56extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags); 56extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
57extern int cap_inode_removexattr(struct dentry *dentry, char *name); 57 const void *value, size_t size, int flags);
58extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
58extern int cap_inode_need_killpriv(struct dentry *dentry); 59extern int cap_inode_need_killpriv(struct dentry *dentry);
59extern int cap_inode_killpriv(struct dentry *dentry); 60extern int cap_inode_killpriv(struct dentry *dentry);
60extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); 61extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
@@ -1008,6 +1009,17 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1008 * @perm describes the combination of permissions required of this key. 1009 * @perm describes the combination of permissions required of this key.
1009 * Return 1 if permission granted, 0 if permission denied and -ve it the 1010 * Return 1 if permission granted, 0 if permission denied and -ve it the
1010 * normal permissions model should be effected. 1011 * normal permissions model should be effected.
1012 * @key_getsecurity:
1013 * Get a textual representation of the security context attached to a key
1014 * for the purposes of honouring KEYCTL_GETSECURITY. This function
1015 * allocates the storage for the NUL-terminated string and the caller
1016 * should free it.
1017 * @key points to the key to be queried.
1018 * @_buffer points to a pointer that should be set to point to the
1019 * resulting string (if no label or an error occurs).
1020 * Return the length of the string (including terminating NUL) or -ve if
1021 * an error.
1022 * May also return 0 (and a NULL buffer pointer) if there is no label.
1011 * 1023 *
1012 * Security hooks affecting all System V IPC operations. 1024 * Security hooks affecting all System V IPC operations.
1013 * 1025 *
@@ -1362,13 +1374,13 @@ struct security_operations {
1362 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1374 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1363 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1375 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1364 void (*inode_delete) (struct inode *inode); 1376 void (*inode_delete) (struct inode *inode);
1365 int (*inode_setxattr) (struct dentry *dentry, char *name, void *value, 1377 int (*inode_setxattr) (struct dentry *dentry, const char *name,
1366 size_t size, int flags); 1378 const void *value, size_t size, int flags);
1367 void (*inode_post_setxattr) (struct dentry *dentry, char *name, void *value, 1379 void (*inode_post_setxattr) (struct dentry *dentry, const char *name,
1368 size_t size, int flags); 1380 const void *value, size_t size, int flags);
1369 int (*inode_getxattr) (struct dentry *dentry, char *name); 1381 int (*inode_getxattr) (struct dentry *dentry, const char *name);
1370 int (*inode_listxattr) (struct dentry *dentry); 1382 int (*inode_listxattr) (struct dentry *dentry);
1371 int (*inode_removexattr) (struct dentry *dentry, char *name); 1383 int (*inode_removexattr) (struct dentry *dentry, const char *name);
1372 int (*inode_need_killpriv) (struct dentry *dentry); 1384 int (*inode_need_killpriv) (struct dentry *dentry);
1373 int (*inode_killpriv) (struct dentry *dentry); 1385 int (*inode_killpriv) (struct dentry *dentry);
1374 int (*inode_getsecurity) (const struct inode *inode, const char *name, void **buffer, bool alloc); 1386 int (*inode_getsecurity) (const struct inode *inode, const char *name, void **buffer, bool alloc);
@@ -1469,7 +1481,7 @@ struct security_operations {
1469 int (*getprocattr) (struct task_struct *p, char *name, char **value); 1481 int (*getprocattr) (struct task_struct *p, char *name, char **value);
1470 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); 1482 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size);
1471 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); 1483 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen);
1472 int (*secctx_to_secid) (char *secdata, u32 seclen, u32 *secid); 1484 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
1473 void (*release_secctx) (char *secdata, u32 seclen); 1485 void (*release_secctx) (char *secdata, u32 seclen);
1474 1486
1475#ifdef CONFIG_SECURITY_NETWORK 1487#ifdef CONFIG_SECURITY_NETWORK
@@ -1537,7 +1549,7 @@ struct security_operations {
1537 int (*key_permission) (key_ref_t key_ref, 1549 int (*key_permission) (key_ref_t key_ref,
1538 struct task_struct *context, 1550 struct task_struct *context,
1539 key_perm_t perm); 1551 key_perm_t perm);
1540 1552 int (*key_getsecurity)(struct key *key, char **_buffer);
1541#endif /* CONFIG_KEYS */ 1553#endif /* CONFIG_KEYS */
1542 1554
1543#ifdef CONFIG_AUDIT 1555#ifdef CONFIG_AUDIT
@@ -1633,13 +1645,13 @@ int security_inode_permission(struct inode *inode, int mask, struct nameidata *n
1633int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1645int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1634int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1646int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1635void security_inode_delete(struct inode *inode); 1647void security_inode_delete(struct inode *inode);
1636int security_inode_setxattr(struct dentry *dentry, char *name, 1648int security_inode_setxattr(struct dentry *dentry, const char *name,
1637 void *value, size_t size, int flags); 1649 const void *value, size_t size, int flags);
1638void security_inode_post_setxattr(struct dentry *dentry, char *name, 1650void security_inode_post_setxattr(struct dentry *dentry, const char *name,
1639 void *value, size_t size, int flags); 1651 const void *value, size_t size, int flags);
1640int security_inode_getxattr(struct dentry *dentry, char *name); 1652int security_inode_getxattr(struct dentry *dentry, const char *name);
1641int security_inode_listxattr(struct dentry *dentry); 1653int security_inode_listxattr(struct dentry *dentry);
1642int security_inode_removexattr(struct dentry *dentry, char *name); 1654int security_inode_removexattr(struct dentry *dentry, const char *name);
1643int security_inode_need_killpriv(struct dentry *dentry); 1655int security_inode_need_killpriv(struct dentry *dentry);
1644int security_inode_killpriv(struct dentry *dentry); 1656int security_inode_killpriv(struct dentry *dentry);
1645int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc); 1657int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc);
@@ -1718,7 +1730,7 @@ int security_setprocattr(struct task_struct *p, char *name, void *value, size_t
1718int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1730int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1719int security_netlink_recv(struct sk_buff *skb, int cap); 1731int security_netlink_recv(struct sk_buff *skb, int cap);
1720int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1732int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1721int security_secctx_to_secid(char *secdata, u32 seclen, u32 *secid); 1733int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1722void security_release_secctx(char *secdata, u32 seclen); 1734void security_release_secctx(char *secdata, u32 seclen);
1723 1735
1724#else /* CONFIG_SECURITY */ 1736#else /* CONFIG_SECURITY */
@@ -2041,17 +2053,18 @@ static inline int security_inode_getattr(struct vfsmount *mnt,
2041static inline void security_inode_delete(struct inode *inode) 2053static inline void security_inode_delete(struct inode *inode)
2042{ } 2054{ }
2043 2055
2044static inline int security_inode_setxattr(struct dentry *dentry, char *name, 2056static inline int security_inode_setxattr(struct dentry *dentry,
2045 void *value, size_t size, int flags) 2057 const char *name, const void *value, size_t size, int flags)
2046{ 2058{
2047 return cap_inode_setxattr(dentry, name, value, size, flags); 2059 return cap_inode_setxattr(dentry, name, value, size, flags);
2048} 2060}
2049 2061
2050static inline void security_inode_post_setxattr(struct dentry *dentry, char *name, 2062static inline void security_inode_post_setxattr(struct dentry *dentry,
2051 void *value, size_t size, int flags) 2063 const char *name, const void *value, size_t size, int flags)
2052{ } 2064{ }
2053 2065
2054static inline int security_inode_getxattr(struct dentry *dentry, char *name) 2066static inline int security_inode_getxattr(struct dentry *dentry,
2067 const char *name)
2055{ 2068{
2056 return 0; 2069 return 0;
2057} 2070}
@@ -2061,7 +2074,8 @@ static inline int security_inode_listxattr(struct dentry *dentry)
2061 return 0; 2074 return 0;
2062} 2075}
2063 2076
2064static inline int security_inode_removexattr(struct dentry *dentry, char *name) 2077static inline int security_inode_removexattr(struct dentry *dentry,
2078 const char *name)
2065{ 2079{
2066 return cap_inode_removexattr(dentry, name); 2080 return cap_inode_removexattr(dentry, name);
2067} 2081}
@@ -2435,7 +2449,7 @@ static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *secle
2435 return -EOPNOTSUPP; 2449 return -EOPNOTSUPP;
2436} 2450}
2437 2451
2438static inline int security_secctx_to_secid(char *secdata, 2452static inline int security_secctx_to_secid(const char *secdata,
2439 u32 seclen, 2453 u32 seclen,
2440 u32 *secid) 2454 u32 *secid)
2441{ 2455{
@@ -2729,6 +2743,7 @@ int security_key_alloc(struct key *key, struct task_struct *tsk, unsigned long f
2729void security_key_free(struct key *key); 2743void security_key_free(struct key *key);
2730int security_key_permission(key_ref_t key_ref, 2744int security_key_permission(key_ref_t key_ref,
2731 struct task_struct *context, key_perm_t perm); 2745 struct task_struct *context, key_perm_t perm);
2746int security_key_getsecurity(struct key *key, char **_buffer);
2732 2747
2733#else 2748#else
2734 2749
@@ -2750,6 +2765,12 @@ static inline int security_key_permission(key_ref_t key_ref,
2750 return 0; 2765 return 0;
2751} 2766}
2752 2767
2768static inline int security_key_getsecurity(struct key *key, char **_buffer)
2769{
2770 *_buffer = NULL;
2771 return 0;
2772}
2773
2753#endif 2774#endif
2754#endif /* CONFIG_KEYS */ 2775#endif /* CONFIG_KEYS */
2755 2776
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 5b5369c3c209..a66304a09955 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -1,6 +1,5 @@
1#ifndef _LINUX_SEQ_FILE_H 1#ifndef _LINUX_SEQ_FILE_H
2#define _LINUX_SEQ_FILE_H 2#define _LINUX_SEQ_FILE_H
3#ifdef __KERNEL__
4 3
5#include <linux/types.h> 4#include <linux/types.h>
6#include <linux/string.h> 5#include <linux/string.h>
@@ -69,4 +68,3 @@ extern struct list_head *seq_list_next(void *v, struct list_head *head,
69 loff_t *ppos); 68 loff_t *ppos);
70 69
71#endif 70#endif
72#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 7cb094a82456..d32123ae08ad 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -149,13 +149,15 @@
149/* Freescale ColdFire */ 149/* Freescale ColdFire */
150#define PORT_MCF 78 150#define PORT_MCF 78
151 151
152#define PORT_SC26XX 79 152/* Blackfin SPORT */
153 153#define PORT_BFIN_SPORT 79
154 154
155/* MN10300 on-chip UART numbers */ 155/* MN10300 on-chip UART numbers */
156#define PORT_MN10300 80 156#define PORT_MN10300 80
157#define PORT_MN10300_CTS 81 157#define PORT_MN10300_CTS 81
158 158
159#define PORT_SC26XX 82
160
159#ifdef __KERNEL__ 161#ifdef __KERNEL__
160 162
161#include <linux/compiler.h> 163#include <linux/compiler.h>
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 42d2e0a948f4..84f997f8aa53 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -362,8 +362,6 @@ int unhandled_signal(struct task_struct *tsk, int sig);
362#define sig_kernel_stop(sig) \ 362#define sig_kernel_stop(sig) \
363 (((sig) < SIGRTMIN) && siginmask(sig, SIG_KERNEL_STOP_MASK)) 363 (((sig) < SIGRTMIN) && siginmask(sig, SIG_KERNEL_STOP_MASK))
364 364
365#define sig_needs_tasklist(sig) ((sig) == SIGCONT)
366
367#define sig_user_defined(t, signr) \ 365#define sig_user_defined(t, signr) \
368 (((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_DFL) && \ 366 (((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_DFL) && \
369 ((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_IGN)) 367 ((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_IGN))
diff --git a/include/linux/slab.h b/include/linux/slab.h
index f62caaad94e0..805ed4b92f9a 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -9,8 +9,6 @@
9#ifndef _LINUX_SLAB_H 9#ifndef _LINUX_SLAB_H
10#define _LINUX_SLAB_H 10#define _LINUX_SLAB_H
11 11
12#ifdef __KERNEL__
13
14#include <linux/gfp.h> 12#include <linux/gfp.h>
15#include <linux/types.h> 13#include <linux/types.h>
16 14
@@ -29,6 +27,13 @@
29#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ 27#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */
30#define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ 28#define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */
31 29
30/* Flag to prevent checks on free */
31#ifdef CONFIG_DEBUG_OBJECTS
32# define SLAB_DEBUG_OBJECTS 0x00400000UL
33#else
34# define SLAB_DEBUG_OBJECTS 0x00000000UL
35#endif
36
32/* The following flags affect the page allocator grouping pages by mobility */ 37/* The following flags affect the page allocator grouping pages by mobility */
33#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ 38#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */
34#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ 39#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */
@@ -276,5 +281,4 @@ extern const struct seq_operations slabinfo_op;
276ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); 281ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
277#endif 282#endif
278 283
279#endif /* __KERNEL__ */
280#endif /* _LINUX_SLAB_H */ 284#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/smb.h b/include/linux/smb.h
index f098dff93f6b..caa43b2370cb 100644
--- a/include/linux/smb.h
+++ b/include/linux/smb.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/magic.h> 13#include <linux/magic.h>
14#include <linux/time.h>
14 15
15enum smb_protocol { 16enum smb_protocol {
16 SMB_PROTOCOL_NONE, 17 SMB_PROTOCOL_NONE,
diff --git a/include/linux/smb_fs_i.h b/include/linux/smb_fs_i.h
index 8516954a5141..8ccf4eca2c3d 100644
--- a/include/linux/smb_fs_i.h
+++ b/include/linux/smb_fs_i.h
@@ -9,7 +9,6 @@
9#ifndef _LINUX_SMB_FS_I 9#ifndef _LINUX_SMB_FS_I
10#define _LINUX_SMB_FS_I 10#define _LINUX_SMB_FS_I
11 11
12#ifdef __KERNEL__
13#include <linux/types.h> 12#include <linux/types.h>
14#include <linux/fs.h> 13#include <linux/fs.h>
15 14
@@ -36,4 +35,3 @@ struct smb_inode_info {
36}; 35};
37 36
38#endif 37#endif
39#endif
diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h
index 3aa97aa4277f..8a060a7040d8 100644
--- a/include/linux/smb_fs_sb.h
+++ b/include/linux/smb_fs_sb.h
@@ -9,8 +9,6 @@
9#ifndef _SMB_FS_SB 9#ifndef _SMB_FS_SB
10#define _SMB_FS_SB 10#define _SMB_FS_SB
11 11
12#ifdef __KERNEL__
13
14#include <linux/types.h> 12#include <linux/types.h>
15#include <linux/smb.h> 13#include <linux/smb.h>
16 14
@@ -96,6 +94,4 @@ smb_unlock_server(struct smb_sb_info *server)
96 up(&(server->sem)); 94 up(&(server->sem));
97} 95}
98 96
99#endif /* __KERNEL__ */
100
101#endif 97#endif
diff --git a/include/linux/svga.h b/include/linux/svga.h
index 13ad0b82ac28..c59a51a2b0e7 100644
--- a/include/linux/svga.h
+++ b/include/linux/svga.h
@@ -1,8 +1,6 @@
1#ifndef _LINUX_SVGA_H 1#ifndef _LINUX_SVGA_H
2#define _LINUX_SVGA_H 2#define _LINUX_SVGA_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/pci.h> 4#include <linux/pci.h>
7#include <video/vga.h> 5#include <video/vga.h>
8 6
@@ -122,6 +120,5 @@ void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninf
122 120
123int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix); 121int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix);
124 122
125#endif /* __KERNEL__ */
126#endif /* _LINUX_SVGA_H */ 123#endif /* _LINUX_SVGA_H */
127 124
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 8df6d1382ac8..0522f368f9d7 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -240,26 +240,28 @@ asmlinkage long sys_truncate64(const char __user *path, loff_t length);
240asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length); 240asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
241#endif 241#endif
242 242
243asmlinkage long sys_setxattr(char __user *path, char __user *name, 243asmlinkage long sys_setxattr(const char __user *path, const char __user *name,
244 void __user *value, size_t size, int flags); 244 const void __user *value, size_t size, int flags);
245asmlinkage long sys_lsetxattr(char __user *path, char __user *name, 245asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name,
246 void __user *value, size_t size, int flags); 246 const void __user *value, size_t size, int flags);
247asmlinkage long sys_fsetxattr(int fd, char __user *name, void __user *value, 247asmlinkage long sys_fsetxattr(int fd, const char __user *name,
248 size_t size, int flags); 248 const void __user *value, size_t size, int flags);
249asmlinkage ssize_t sys_getxattr(char __user *path, char __user *name, 249asmlinkage ssize_t sys_getxattr(const char __user *path, const char __user *name,
250 void __user *value, size_t size); 250 void __user *value, size_t size);
251asmlinkage ssize_t sys_lgetxattr(char __user *path, char __user *name, 251asmlinkage ssize_t sys_lgetxattr(const char __user *path, const char __user *name,
252 void __user *value, size_t size); 252 void __user *value, size_t size);
253asmlinkage ssize_t sys_fgetxattr(int fd, char __user *name, 253asmlinkage ssize_t sys_fgetxattr(int fd, const char __user *name,
254 void __user *value, size_t size); 254 void __user *value, size_t size);
255asmlinkage ssize_t sys_listxattr(char __user *path, char __user *list, 255asmlinkage ssize_t sys_listxattr(const char __user *path, char __user *list,
256 size_t size); 256 size_t size);
257asmlinkage ssize_t sys_llistxattr(char __user *path, char __user *list, 257asmlinkage ssize_t sys_llistxattr(const char __user *path, char __user *list,
258 size_t size); 258 size_t size);
259asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size); 259asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size);
260asmlinkage long sys_removexattr(char __user *path, char __user *name); 260asmlinkage long sys_removexattr(const char __user *path,
261asmlinkage long sys_lremovexattr(char __user *path, char __user *name); 261 const char __user *name);
262asmlinkage long sys_fremovexattr(int fd, char __user *name); 262asmlinkage long sys_lremovexattr(const char __user *path,
263 const char __user *name);
264asmlinkage long sys_fremovexattr(int fd, const char __user *name);
263 265
264asmlinkage unsigned long sys_brk(unsigned long brk); 266asmlinkage unsigned long sys_brk(unsigned long brk);
265asmlinkage long sys_mprotect(unsigned long start, size_t len, 267asmlinkage long sys_mprotect(unsigned long start, size_t len,
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 571f01d20a86..24141b4d1a11 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -945,11 +945,14 @@ enum
945/* For the /proc/sys support */ 945/* For the /proc/sys support */
946struct ctl_table; 946struct ctl_table;
947struct nsproxy; 947struct nsproxy;
948struct ctl_table_root;
949
948extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); 950extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
949extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, 951extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
950 struct ctl_table_header *prev); 952 struct ctl_table_header *prev);
951extern void sysctl_head_finish(struct ctl_table_header *prev); 953extern void sysctl_head_finish(struct ctl_table_header *prev);
952extern int sysctl_perm(struct ctl_table *table, int op); 954extern int sysctl_perm(struct ctl_table_root *root,
955 struct ctl_table *table, int op);
953 956
954typedef struct ctl_table ctl_table; 957typedef struct ctl_table ctl_table;
955 958
@@ -981,11 +984,6 @@ extern int do_sysctl (int __user *name, int nlen,
981 void __user *oldval, size_t __user *oldlenp, 984 void __user *oldval, size_t __user *oldlenp,
982 void __user *newval, size_t newlen); 985 void __user *newval, size_t newlen);
983 986
984extern int do_sysctl_strategy (struct ctl_table *table,
985 int __user *name, int nlen,
986 void __user *oldval, size_t __user *oldlenp,
987 void __user *newval, size_t newlen);
988
989extern ctl_handler sysctl_data; 987extern ctl_handler sysctl_data;
990extern ctl_handler sysctl_string; 988extern ctl_handler sysctl_string;
991extern ctl_handler sysctl_intvec; 989extern ctl_handler sysctl_intvec;
@@ -1054,6 +1052,8 @@ struct ctl_table_root {
1054 struct list_head header_list; 1052 struct list_head header_list;
1055 struct list_head *(*lookup)(struct ctl_table_root *root, 1053 struct list_head *(*lookup)(struct ctl_table_root *root,
1056 struct nsproxy *namespaces); 1054 struct nsproxy *namespaces);
1055 int (*permissions)(struct ctl_table_root *root,
1056 struct nsproxy *namespaces, struct ctl_table *table);
1057}; 1057};
1058 1058
1059/* struct ctl_table_header is used to maintain dynamic lists of 1059/* struct ctl_table_header is used to maintain dynamic lists of
@@ -1085,8 +1085,6 @@ struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1085void unregister_sysctl_table(struct ctl_table_header * table); 1085void unregister_sysctl_table(struct ctl_table_header * table);
1086int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); 1086int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table);
1087 1087
1088#else /* __KERNEL__ */
1089
1090#endif /* __KERNEL__ */ 1088#endif /* __KERNEL__ */
1091 1089
1092#endif /* _LINUX_SYSCTL_H */ 1090#endif /* _LINUX_SYSCTL_H */
diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h
index e0248631e461..96411306eec6 100644
--- a/include/linux/sysv_fs.h
+++ b/include/linux/sysv_fs.h
@@ -1,11 +1,7 @@
1#ifndef _LINUX_SYSV_FS_H 1#ifndef _LINUX_SYSV_FS_H
2#define _LINUX_SYSV_FS_H 2#define _LINUX_SYSV_FS_H
3 3
4#if defined(__GNUC__) 4#define __packed2__ __attribute__((packed, aligned(2)))
5# define __packed2__ __attribute__((packed, aligned(2)))
6#else
7>> I want to scream! <<
8#endif
9 5
10 6
11#ifndef __KERNEL__ 7#ifndef __KERNEL__
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h
index 004808a6df1d..6f371f24160b 100644
--- a/include/linux/textsearch.h
+++ b/include/linux/textsearch.h
@@ -1,8 +1,6 @@
1#ifndef __LINUX_TEXTSEARCH_H 1#ifndef __LINUX_TEXTSEARCH_H
2#define __LINUX_TEXTSEARCH_H 2#define __LINUX_TEXTSEARCH_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/types.h> 4#include <linux/types.h>
7#include <linux/list.h> 5#include <linux/list.h>
8#include <linux/kernel.h> 6#include <linux/kernel.h>
@@ -177,6 +175,4 @@ static inline void *ts_config_priv(struct ts_config *conf)
177 return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config))); 175 return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config)));
178} 176}
179 177
180#endif /* __KERNEL__ */
181
182#endif 178#endif
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index accd7bad35b0..38a56477f27a 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -92,6 +92,31 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
92#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) 92#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED)
93#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) 93#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED)
94 94
95#endif 95#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK
96/*
97 * An arch can define its own version of set_restore_sigmask() to get the
98 * job done however works, with or without TIF_RESTORE_SIGMASK.
99 */
100#define HAVE_SET_RESTORE_SIGMASK 1
101
102/**
103 * set_restore_sigmask() - make sure saved_sigmask processing gets done
104 *
105 * This sets TIF_RESTORE_SIGMASK and ensures that the arch signal code
106 * will run before returning to user mode, to process the flag. For
107 * all callers, TIF_SIGPENDING is already set or it's no harm to set
108 * it. TIF_RESTORE_SIGMASK need not be in the set of bits that the
109 * arch code will notice on return to user mode, in case those bits
110 * are scarce. We set TIF_SIGPENDING here to ensure that the arch
111 * signal code always gets run when TIF_RESTORE_SIGMASK is set.
112 */
113static inline void set_restore_sigmask(void)
114{
115 set_thread_flag(TIF_RESTORE_SIGMASK);
116 set_thread_flag(TIF_SIGPENDING);
117}
118#endif /* TIF_RESTORE_SIGMASK && !HAVE_SET_RESTORE_SIGMASK */
119
120#endif /* __KERNEL__ */
96 121
97#endif /* _LINUX_THREAD_INFO_H */ 122#endif /* _LINUX_THREAD_INFO_H */
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 979fefdeb862..d4ba79248a27 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -4,6 +4,7 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/ktime.h> 5#include <linux/ktime.h>
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7#include <linux/debugobjects.h>
7 8
8struct tvec_base; 9struct tvec_base;
9 10
@@ -25,6 +26,7 @@ struct timer_list {
25extern struct tvec_base boot_tvec_bases; 26extern struct tvec_base boot_tvec_bases;
26 27
27#define TIMER_INITIALIZER(_function, _expires, _data) { \ 28#define TIMER_INITIALIZER(_function, _expires, _data) { \
29 .entry = { .prev = TIMER_ENTRY_STATIC }, \
28 .function = (_function), \ 30 .function = (_function), \
29 .expires = (_expires), \ 31 .expires = (_expires), \
30 .data = (_data), \ 32 .data = (_data), \
@@ -38,6 +40,17 @@ extern struct tvec_base boot_tvec_bases;
38void init_timer(struct timer_list *timer); 40void init_timer(struct timer_list *timer);
39void init_timer_deferrable(struct timer_list *timer); 41void init_timer_deferrable(struct timer_list *timer);
40 42
43#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
44extern void init_timer_on_stack(struct timer_list *timer);
45extern void destroy_timer_on_stack(struct timer_list *timer);
46#else
47static inline void destroy_timer_on_stack(struct timer_list *timer) { }
48static inline void init_timer_on_stack(struct timer_list *timer)
49{
50 init_timer(timer);
51}
52#endif
53
41static inline void setup_timer(struct timer_list * timer, 54static inline void setup_timer(struct timer_list * timer,
42 void (*function)(unsigned long), 55 void (*function)(unsigned long),
43 unsigned long data) 56 unsigned long data)
@@ -47,6 +60,15 @@ static inline void setup_timer(struct timer_list * timer,
47 init_timer(timer); 60 init_timer(timer);
48} 61}
49 62
63static inline void setup_timer_on_stack(struct timer_list *timer,
64 void (*function)(unsigned long),
65 unsigned long data)
66{
67 timer->function = function;
68 timer->data = data;
69 init_timer_on_stack(timer);
70}
71
50/** 72/**
51 * timer_pending - is a timer pending? 73 * timer_pending - is a timer pending?
52 * @timer: the timer in question 74 * @timer: the timer in question
@@ -164,5 +186,4 @@ unsigned long __round_jiffies_relative(unsigned long j, int cpu);
164unsigned long round_jiffies(unsigned long j); 186unsigned long round_jiffies(unsigned long j);
165unsigned long round_jiffies_relative(unsigned long j); 187unsigned long round_jiffies_relative(unsigned long j);
166 188
167
168#endif 189#endif
diff --git a/include/linux/tty.h b/include/linux/tty.h
index dd8e08fe8855..7f7121f9c968 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -177,27 +177,33 @@ struct signal_struct;
177 * size each time the window is created or resized anyway. 177 * size each time the window is created or resized anyway.
178 * - TYT, 9/14/92 178 * - TYT, 9/14/92
179 */ 179 */
180
181struct tty_operations;
182
180struct tty_struct { 183struct tty_struct {
181 int magic; 184 int magic;
182 struct tty_driver *driver; 185 struct tty_driver *driver;
186 const struct tty_operations *ops;
183 int index; 187 int index;
184 struct tty_ldisc ldisc; 188 struct tty_ldisc ldisc;
185 struct mutex termios_mutex; 189 struct mutex termios_mutex;
190 spinlock_t ctrl_lock;
191 /* Termios values are protected by the termios mutex */
186 struct ktermios *termios, *termios_locked; 192 struct ktermios *termios, *termios_locked;
187 char name[64]; 193 char name[64];
188 struct pid *pgrp; 194 struct pid *pgrp; /* Protected by ctrl lock */
189 struct pid *session; 195 struct pid *session;
190 unsigned long flags; 196 unsigned long flags;
191 int count; 197 int count;
192 struct winsize winsize; 198 struct winsize winsize; /* termios mutex */
193 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 199 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
194 unsigned char low_latency:1, warned:1; 200 unsigned char low_latency:1, warned:1;
195 unsigned char ctrl_status; 201 unsigned char ctrl_status; /* ctrl_lock */
196 unsigned int receive_room; /* Bytes free for queue */ 202 unsigned int receive_room; /* Bytes free for queue */
197 203
198 struct tty_struct *link; 204 struct tty_struct *link;
199 struct fasync_struct *fasync; 205 struct fasync_struct *fasync;
200 struct tty_bufhead buf; 206 struct tty_bufhead buf; /* Locked internally */
201 int alt_speed; /* For magic substitution of 38400 bps */ 207 int alt_speed; /* For magic substitution of 38400 bps */
202 wait_queue_head_t write_wait; 208 wait_queue_head_t write_wait;
203 wait_queue_head_t read_wait; 209 wait_queue_head_t read_wait;
@@ -211,6 +217,7 @@ struct tty_struct {
211 /* 217 /*
212 * The following is data for the N_TTY line discipline. For 218 * The following is data for the N_TTY line discipline. For
213 * historical reasons, this is included in the tty structure. 219 * historical reasons, this is included in the tty structure.
220 * Mostly locked by the BKL.
214 */ 221 */
215 unsigned int column; 222 unsigned int column;
216 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1; 223 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
@@ -292,15 +299,21 @@ extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
292extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, 299extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
293 int buflen); 300 int buflen);
294extern void tty_write_message(struct tty_struct *tty, char *msg); 301extern void tty_write_message(struct tty_struct *tty, char *msg);
302extern int tty_put_char(struct tty_struct *tty, unsigned char c);
303extern int tty_chars_in_buffer(struct tty_struct *tty);
304extern int tty_write_room(struct tty_struct *tty);
305extern void tty_driver_flush_buffer(struct tty_struct *tty);
306extern void tty_throttle(struct tty_struct *tty);
307extern void tty_unthrottle(struct tty_struct *tty);
295 308
296extern int is_current_pgrp_orphaned(void); 309extern int is_current_pgrp_orphaned(void);
310extern struct pid *tty_get_pgrp(struct tty_struct *tty);
297extern int is_ignored(int sig); 311extern int is_ignored(int sig);
298extern int tty_signal(int sig, struct tty_struct *tty); 312extern int tty_signal(int sig, struct tty_struct *tty);
299extern void tty_hangup(struct tty_struct * tty); 313extern void tty_hangup(struct tty_struct * tty);
300extern void tty_vhangup(struct tty_struct * tty); 314extern void tty_vhangup(struct tty_struct * tty);
301extern void tty_unhangup(struct file *filp); 315extern void tty_unhangup(struct file *filp);
302extern int tty_hung_up_p(struct file * filp); 316extern int tty_hung_up_p(struct file * filp);
303extern int is_tty(struct file *filp);
304extern void do_SAK(struct tty_struct *tty); 317extern void do_SAK(struct tty_struct *tty);
305extern void __do_SAK(struct tty_struct *tty); 318extern void __do_SAK(struct tty_struct *tty);
306extern void disassociate_ctty(int priv); 319extern void disassociate_ctty(int priv);
@@ -324,8 +337,7 @@ extern void tty_ldisc_put(int);
324extern void tty_wakeup(struct tty_struct *tty); 337extern void tty_wakeup(struct tty_struct *tty);
325extern void tty_ldisc_flush(struct tty_struct *tty); 338extern void tty_ldisc_flush(struct tty_struct *tty);
326 339
327extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 340extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
328 unsigned long arg);
329extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, 341extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
330 unsigned int cmd, unsigned long arg); 342 unsigned int cmd, unsigned long arg);
331extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); 343extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
@@ -351,8 +363,7 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
351extern void tty_audit_exit(void); 363extern void tty_audit_exit(void);
352extern void tty_audit_fork(struct signal_struct *sig); 364extern void tty_audit_fork(struct signal_struct *sig);
353extern void tty_audit_push(struct tty_struct *tty); 365extern void tty_audit_push(struct tty_struct *tty);
354extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid); 366extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid);
355extern void tty_audit_opening(void);
356#else 367#else
357static inline void tty_audit_add_data(struct tty_struct *tty, 368static inline void tty_audit_add_data(struct tty_struct *tty,
358 unsigned char *data, size_t size) 369 unsigned char *data, size_t size)
@@ -367,10 +378,7 @@ static inline void tty_audit_fork(struct signal_struct *sig)
367static inline void tty_audit_push(struct tty_struct *tty) 378static inline void tty_audit_push(struct tty_struct *tty)
368{ 379{
369} 380}
370static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid) 381static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid)
371{
372}
373static inline void tty_audit_opening(void)
374{ 382{
375} 383}
376#endif 384#endif
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 21f69aca4505..59f1c0bd8f9c 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -12,11 +12,15 @@
12 * This routine is called when a particular tty device is opened. 12 * This routine is called when a particular tty device is opened.
13 * This routine is mandatory; if this routine is not filled in, 13 * This routine is mandatory; if this routine is not filled in,
14 * the attempted open will fail with ENODEV. 14 * the attempted open will fail with ENODEV.
15 *
16 * Required method.
15 * 17 *
16 * void (*close)(struct tty_struct * tty, struct file * filp); 18 * void (*close)(struct tty_struct * tty, struct file * filp);
17 * 19 *
18 * This routine is called when a particular tty device is closed. 20 * This routine is called when a particular tty device is closed.
19 * 21 *
22 * Required method.
23 *
20 * int (*write)(struct tty_struct * tty, 24 * int (*write)(struct tty_struct * tty,
21 * const unsigned char *buf, int count); 25 * const unsigned char *buf, int count);
22 * 26 *
@@ -26,7 +30,9 @@
26 * number of characters actually accepted for writing. This 30 * number of characters actually accepted for writing. This
27 * routine is mandatory. 31 * routine is mandatory.
28 * 32 *
29 * void (*put_char)(struct tty_struct *tty, unsigned char ch); 33 * Optional: Required for writable devices.
34 *
35 * int (*put_char)(struct tty_struct *tty, unsigned char ch);
30 * 36 *
31 * This routine is called by the kernel to write a single 37 * This routine is called by the kernel to write a single
32 * character to the tty device. If the kernel uses this routine, 38 * character to the tty device. If the kernel uses this routine,
@@ -34,10 +40,18 @@
34 * done stuffing characters into the driver. If there is no room 40 * done stuffing characters into the driver. If there is no room
35 * in the queue, the character is ignored. 41 * in the queue, the character is ignored.
36 * 42 *
43 * Optional: Kernel will use the write method if not provided.
44 *
45 * Note: Do not call this function directly, call tty_put_char
46 *
37 * void (*flush_chars)(struct tty_struct *tty); 47 * void (*flush_chars)(struct tty_struct *tty);
38 * 48 *
39 * This routine is called by the kernel after it has written a 49 * This routine is called by the kernel after it has written a
40 * series of characters to the tty device using put_char(). 50 * series of characters to the tty device using put_char().
51 *
52 * Optional:
53 *
54 * Note: Do not call this function directly, call tty_driver_flush_chars
41 * 55 *
42 * int (*write_room)(struct tty_struct *tty); 56 * int (*write_room)(struct tty_struct *tty);
43 * 57 *
@@ -45,6 +59,10 @@
45 * will accept for queuing to be written. This number is subject 59 * will accept for queuing to be written. This number is subject
46 * to change as output buffers get emptied, or if the output flow 60 * to change as output buffers get emptied, or if the output flow
47 * control is acted. 61 * control is acted.
62 *
63 * Required if write method is provided else not needed.
64 *
65 * Note: Do not call this function directly, call tty_write_room
48 * 66 *
49 * int (*ioctl)(struct tty_struct *tty, struct file * file, 67 * int (*ioctl)(struct tty_struct *tty, struct file * file,
50 * unsigned int cmd, unsigned long arg); 68 * unsigned int cmd, unsigned long arg);
@@ -53,28 +71,37 @@
53 * device-specific ioctl's. If the ioctl number passed in cmd 71 * device-specific ioctl's. If the ioctl number passed in cmd
54 * is not recognized by the driver, it should return ENOIOCTLCMD. 72 * is not recognized by the driver, it should return ENOIOCTLCMD.
55 * 73 *
74 * Optional
75 *
56 * long (*compat_ioctl)(struct tty_struct *tty, struct file * file, 76 * long (*compat_ioctl)(struct tty_struct *tty, struct file * file,
57 * unsigned int cmd, unsigned long arg); 77 * unsigned int cmd, unsigned long arg);
58 * 78 *
59 * implement ioctl processing for 32 bit process on 64 bit system 79 * implement ioctl processing for 32 bit process on 64 bit system
80 *
81 * Optional
60 * 82 *
61 * void (*set_termios)(struct tty_struct *tty, struct ktermios * old); 83 * void (*set_termios)(struct tty_struct *tty, struct ktermios * old);
62 * 84 *
63 * This routine allows the tty driver to be notified when 85 * This routine allows the tty driver to be notified when
64 * device's termios settings have changed. Note that a 86 * device's termios settings have changed.
65 * well-designed tty driver should be prepared to accept the case 87 *
66 * where old == NULL, and try to do something rational. 88 * Optional: Called under the termios lock
89 *
67 * 90 *
68 * void (*set_ldisc)(struct tty_struct *tty); 91 * void (*set_ldisc)(struct tty_struct *tty);
69 * 92 *
70 * This routine allows the tty driver to be notified when the 93 * This routine allows the tty driver to be notified when the
71 * device's termios settings have changed. 94 * device's termios settings have changed.
95 *
96 * Optional: Called under BKL (currently)
72 * 97 *
73 * void (*throttle)(struct tty_struct * tty); 98 * void (*throttle)(struct tty_struct * tty);
74 * 99 *
75 * This routine notifies the tty driver that input buffers for 100 * This routine notifies the tty driver that input buffers for
76 * the line discipline are close to full, and it should somehow 101 * the line discipline are close to full, and it should somehow
77 * signal that no more characters should be sent to the tty. 102 * signal that no more characters should be sent to the tty.
103 *
104 * Optional: Always invoke via tty_throttle();
78 * 105 *
79 * void (*unthrottle)(struct tty_struct * tty); 106 * void (*unthrottle)(struct tty_struct * tty);
80 * 107 *
@@ -82,21 +109,33 @@
82 * that characters can now be sent to the tty without fear of 109 * that characters can now be sent to the tty without fear of
83 * overrunning the input buffers of the line disciplines. 110 * overrunning the input buffers of the line disciplines.
84 * 111 *
112 * Optional: Always invoke via tty_unthrottle();
113 *
85 * void (*stop)(struct tty_struct *tty); 114 * void (*stop)(struct tty_struct *tty);
86 * 115 *
87 * This routine notifies the tty driver that it should stop 116 * This routine notifies the tty driver that it should stop
88 * outputting characters to the tty device. 117 * outputting characters to the tty device.
118 *
119 * Optional:
120 *
121 * Note: Call stop_tty not this method.
89 * 122 *
90 * void (*start)(struct tty_struct *tty); 123 * void (*start)(struct tty_struct *tty);
91 * 124 *
92 * This routine notifies the tty driver that it resume sending 125 * This routine notifies the tty driver that it resume sending
93 * characters to the tty device. 126 * characters to the tty device.
127 *
128 * Optional:
129 *
130 * Note: Call start_tty not this method.
94 * 131 *
95 * void (*hangup)(struct tty_struct *tty); 132 * void (*hangup)(struct tty_struct *tty);
96 * 133 *
97 * This routine notifies the tty driver that it should hangup the 134 * This routine notifies the tty driver that it should hangup the
98 * tty device. 135 * tty device.
99 * 136 *
137 * Required:
138 *
100 * void (*break_ctl)(struct tty_stuct *tty, int state); 139 * void (*break_ctl)(struct tty_stuct *tty, int state);
101 * 140 *
102 * This optional routine requests the tty driver to turn on or 141 * This optional routine requests the tty driver to turn on or
@@ -106,18 +145,26 @@
106 * 145 *
107 * If this routine is implemented, the high-level tty driver will 146 * If this routine is implemented, the high-level tty driver will
108 * handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK, 147 * handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK,
109 * TIOCCBRK. Otherwise, these ioctls will be passed down to the 148 * TIOCCBRK.
110 * driver to handle. 149 *
150 * Optional: Required for TCSBRK/BRKP/etc handling.
111 * 151 *
112 * void (*wait_until_sent)(struct tty_struct *tty, int timeout); 152 * void (*wait_until_sent)(struct tty_struct *tty, int timeout);
113 * 153 *
114 * This routine waits until the device has written out all of the 154 * This routine waits until the device has written out all of the
115 * characters in its transmitter FIFO. 155 * characters in its transmitter FIFO.
116 * 156 *
157 * Optional: If not provided the device is assumed to have no FIFO
158 *
159 * Note: Usually correct to call tty_wait_until_sent
160 *
117 * void (*send_xchar)(struct tty_struct *tty, char ch); 161 * void (*send_xchar)(struct tty_struct *tty, char ch);
118 * 162 *
119 * This routine is used to send a high-priority XON/XOFF 163 * This routine is used to send a high-priority XON/XOFF
120 * character to the device. 164 * character to the device.
165 *
166 * Optional: If not provided then the write method is called under
167 * the atomic write lock to keep it serialized with the ldisc.
121 */ 168 */
122 169
123#include <linux/fs.h> 170#include <linux/fs.h>
@@ -132,7 +179,7 @@ struct tty_operations {
132 void (*close)(struct tty_struct * tty, struct file * filp); 179 void (*close)(struct tty_struct * tty, struct file * filp);
133 int (*write)(struct tty_struct * tty, 180 int (*write)(struct tty_struct * tty,
134 const unsigned char *buf, int count); 181 const unsigned char *buf, int count);
135 void (*put_char)(struct tty_struct *tty, unsigned char ch); 182 int (*put_char)(struct tty_struct *tty, unsigned char ch);
136 void (*flush_chars)(struct tty_struct *tty); 183 void (*flush_chars)(struct tty_struct *tty);
137 int (*write_room)(struct tty_struct *tty); 184 int (*write_room)(struct tty_struct *tty);
138 int (*chars_in_buffer)(struct tty_struct *tty); 185 int (*chars_in_buffer)(struct tty_struct *tty);
@@ -153,8 +200,6 @@ struct tty_operations {
153 void (*send_xchar)(struct tty_struct *tty, char ch); 200 void (*send_xchar)(struct tty_struct *tty, char ch);
154 int (*read_proc)(char *page, char **start, off_t off, 201 int (*read_proc)(char *page, char **start, off_t off,
155 int count, int *eof, void *data); 202 int count, int *eof, void *data);
156 int (*write_proc)(struct file *file, const char __user *buffer,
157 unsigned long count, void *data);
158 int (*tiocmget)(struct tty_struct *tty, struct file *file); 203 int (*tiocmget)(struct tty_struct *tty, struct file *file);
159 int (*tiocmset)(struct tty_struct *tty, struct file *file, 204 int (*tiocmset)(struct tty_struct *tty, struct file *file,
160 unsigned int set, unsigned int clear); 205 unsigned int set, unsigned int clear);
@@ -190,48 +235,13 @@ struct tty_driver {
190 struct tty_struct **ttys; 235 struct tty_struct **ttys;
191 struct ktermios **termios; 236 struct ktermios **termios;
192 struct ktermios **termios_locked; 237 struct ktermios **termios_locked;
193 void *driver_state; /* only used for the PTY driver */ 238 void *driver_state;
194 239
195 /* 240 /*
196 * Interface routines from the upper tty layer to the tty 241 * Driver methods
197 * driver. Will be replaced with struct tty_operations.
198 */ 242 */
199 int (*open)(struct tty_struct * tty, struct file * filp);
200 void (*close)(struct tty_struct * tty, struct file * filp);
201 int (*write)(struct tty_struct * tty,
202 const unsigned char *buf, int count);
203 void (*put_char)(struct tty_struct *tty, unsigned char ch);
204 void (*flush_chars)(struct tty_struct *tty);
205 int (*write_room)(struct tty_struct *tty);
206 int (*chars_in_buffer)(struct tty_struct *tty);
207 int (*ioctl)(struct tty_struct *tty, struct file * file,
208 unsigned int cmd, unsigned long arg);
209 long (*compat_ioctl)(struct tty_struct *tty, struct file * file,
210 unsigned int cmd, unsigned long arg);
211 void (*set_termios)(struct tty_struct *tty, struct ktermios * old);
212 void (*throttle)(struct tty_struct * tty);
213 void (*unthrottle)(struct tty_struct * tty);
214 void (*stop)(struct tty_struct *tty);
215 void (*start)(struct tty_struct *tty);
216 void (*hangup)(struct tty_struct *tty);
217 void (*break_ctl)(struct tty_struct *tty, int state);
218 void (*flush_buffer)(struct tty_struct *tty);
219 void (*set_ldisc)(struct tty_struct *tty);
220 void (*wait_until_sent)(struct tty_struct *tty, int timeout);
221 void (*send_xchar)(struct tty_struct *tty, char ch);
222 int (*read_proc)(char *page, char **start, off_t off,
223 int count, int *eof, void *data);
224 int (*write_proc)(struct file *file, const char __user *buffer,
225 unsigned long count, void *data);
226 int (*tiocmget)(struct tty_struct *tty, struct file *file);
227 int (*tiocmset)(struct tty_struct *tty, struct file *file,
228 unsigned int set, unsigned int clear);
229#ifdef CONFIG_CONSOLE_POLL
230 int (*poll_init)(struct tty_driver *driver, int line, char *options);
231 int (*poll_get_char)(struct tty_driver *driver, int line);
232 void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
233#endif
234 243
244 const struct tty_operations *ops;
235 struct list_head tty_drivers; 245 struct list_head tty_drivers;
236}; 246};
237 247
diff --git a/include/linux/unaligned/access_ok.h b/include/linux/unaligned/access_ok.h
new file mode 100644
index 000000000000..99c1b4d20b0f
--- /dev/null
+++ b/include/linux/unaligned/access_ok.h
@@ -0,0 +1,67 @@
1#ifndef _LINUX_UNALIGNED_ACCESS_OK_H
2#define _LINUX_UNALIGNED_ACCESS_OK_H
3
4#include <linux/kernel.h>
5#include <asm/byteorder.h>
6
7static inline u16 get_unaligned_le16(const void *p)
8{
9 return le16_to_cpup((__le16 *)p);
10}
11
12static inline u32 get_unaligned_le32(const void *p)
13{
14 return le32_to_cpup((__le32 *)p);
15}
16
17static inline u64 get_unaligned_le64(const void *p)
18{
19 return le64_to_cpup((__le64 *)p);
20}
21
22static inline u16 get_unaligned_be16(const void *p)
23{
24 return be16_to_cpup((__be16 *)p);
25}
26
27static inline u32 get_unaligned_be32(const void *p)
28{
29 return be32_to_cpup((__be32 *)p);
30}
31
32static inline u64 get_unaligned_be64(const void *p)
33{
34 return be64_to_cpup((__be64 *)p);
35}
36
37static inline void put_unaligned_le16(u16 val, void *p)
38{
39 *((__le16 *)p) = cpu_to_le16(val);
40}
41
42static inline void put_unaligned_le32(u32 val, void *p)
43{
44 *((__le32 *)p) = cpu_to_le32(val);
45}
46
47static inline void put_unaligned_le64(u64 val, void *p)
48{
49 *((__le64 *)p) = cpu_to_le64(val);
50}
51
52static inline void put_unaligned_be16(u16 val, void *p)
53{
54 *((__be16 *)p) = cpu_to_be16(val);
55}
56
57static inline void put_unaligned_be32(u32 val, void *p)
58{
59 *((__be32 *)p) = cpu_to_be32(val);
60}
61
62static inline void put_unaligned_be64(u64 val, void *p)
63{
64 *((__be64 *)p) = cpu_to_be64(val);
65}
66
67#endif /* _LINUX_UNALIGNED_ACCESS_OK_H */
diff --git a/include/linux/unaligned/be_byteshift.h b/include/linux/unaligned/be_byteshift.h
new file mode 100644
index 000000000000..46dd12c5709e
--- /dev/null
+++ b/include/linux/unaligned/be_byteshift.h
@@ -0,0 +1,70 @@
1#ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H
2#define _LINUX_UNALIGNED_BE_BYTESHIFT_H
3
4#include <linux/kernel.h>
5
6static inline u16 __get_unaligned_be16(const u8 *p)
7{
8 return p[0] << 8 | p[1];
9}
10
11static inline u32 __get_unaligned_be32(const u8 *p)
12{
13 return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
14}
15
16static inline u64 __get_unaligned_be64(const u8 *p)
17{
18 return (u64)__get_unaligned_be32(p) << 32 |
19 __get_unaligned_be32(p + 4);
20}
21
22static inline void __put_unaligned_be16(u16 val, u8 *p)
23{
24 *p++ = val >> 8;
25 *p++ = val;
26}
27
28static inline void __put_unaligned_be32(u32 val, u8 *p)
29{
30 __put_unaligned_be16(val >> 16, p);
31 __put_unaligned_be16(val, p + 2);
32}
33
34static inline void __put_unaligned_be64(u64 val, u8 *p)
35{
36 __put_unaligned_be32(val >> 32, p);
37 __put_unaligned_be32(val, p + 4);
38}
39
40static inline u16 get_unaligned_be16(const void *p)
41{
42 return __get_unaligned_be16((const u8 *)p);
43}
44
45static inline u32 get_unaligned_be32(const void *p)
46{
47 return __get_unaligned_be32((const u8 *)p);
48}
49
50static inline u64 get_unaligned_be64(const void *p)
51{
52 return __get_unaligned_be64((const u8 *)p);
53}
54
55static inline void put_unaligned_be16(u16 val, void *p)
56{
57 __put_unaligned_be16(val, p);
58}
59
60static inline void put_unaligned_be32(u32 val, void *p)
61{
62 __put_unaligned_be32(val, p);
63}
64
65static inline void put_unaligned_be64(u64 val, void *p)
66{
67 __put_unaligned_be64(val, p);
68}
69
70#endif /* _LINUX_UNALIGNED_BE_BYTESHIFT_H */
diff --git a/include/linux/unaligned/be_memmove.h b/include/linux/unaligned/be_memmove.h
new file mode 100644
index 000000000000..c2a76c5c9ed0
--- /dev/null
+++ b/include/linux/unaligned/be_memmove.h
@@ -0,0 +1,36 @@
1#ifndef _LINUX_UNALIGNED_BE_MEMMOVE_H
2#define _LINUX_UNALIGNED_BE_MEMMOVE_H
3
4#include <linux/unaligned/memmove.h>
5
6static inline u16 get_unaligned_be16(const void *p)
7{
8 return __get_unaligned_memmove16((const u8 *)p);
9}
10
11static inline u32 get_unaligned_be32(const void *p)
12{
13 return __get_unaligned_memmove32((const u8 *)p);
14}
15
16static inline u64 get_unaligned_be64(const void *p)
17{
18 return __get_unaligned_memmove64((const u8 *)p);
19}
20
21static inline void put_unaligned_be16(u16 val, void *p)
22{
23 __put_unaligned_memmove16(val, p);
24}
25
26static inline void put_unaligned_be32(u32 val, void *p)
27{
28 __put_unaligned_memmove32(val, p);
29}
30
31static inline void put_unaligned_be64(u64 val, void *p)
32{
33 __put_unaligned_memmove64(val, p);
34}
35
36#endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */
diff --git a/include/linux/unaligned/be_struct.h b/include/linux/unaligned/be_struct.h
new file mode 100644
index 000000000000..132415836c50
--- /dev/null
+++ b/include/linux/unaligned/be_struct.h
@@ -0,0 +1,36 @@
1#ifndef _LINUX_UNALIGNED_BE_STRUCT_H
2#define _LINUX_UNALIGNED_BE_STRUCT_H
3
4#include <linux/unaligned/packed_struct.h>
5
6static inline u16 get_unaligned_be16(const void *p)
7{
8 return __get_unaligned_cpu16((const u8 *)p);
9}
10
11static inline u32 get_unaligned_be32(const void *p)
12{
13 return __get_unaligned_cpu32((const u8 *)p);
14}
15
16static inline u64 get_unaligned_be64(const void *p)
17{
18 return __get_unaligned_cpu64((const u8 *)p);
19}
20
21static inline void put_unaligned_be16(u16 val, void *p)
22{
23 __put_unaligned_cpu16(val, p);
24}
25
26static inline void put_unaligned_be32(u32 val, void *p)
27{
28 __put_unaligned_cpu32(val, p);
29}
30
31static inline void put_unaligned_be64(u64 val, void *p)
32{
33 __put_unaligned_cpu64(val, p);
34}
35
36#endif /* _LINUX_UNALIGNED_BE_STRUCT_H */
diff --git a/include/linux/unaligned/generic.h b/include/linux/unaligned/generic.h
new file mode 100644
index 000000000000..02d97ff3df70
--- /dev/null
+++ b/include/linux/unaligned/generic.h
@@ -0,0 +1,68 @@
1#ifndef _LINUX_UNALIGNED_GENERIC_H
2#define _LINUX_UNALIGNED_GENERIC_H
3
4/*
5 * Cause a link-time error if we try an unaligned access other than
6 * 1,2,4 or 8 bytes long
7 */
8extern void __bad_unaligned_access_size(void);
9
10#define __get_unaligned_le(ptr) ((__force typeof(*(ptr)))({ \
11 __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \
12 __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_le16((ptr)), \
13 __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_le32((ptr)), \
14 __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_le64((ptr)), \
15 __bad_unaligned_access_size())))); \
16 }))
17
18#define __get_unaligned_be(ptr) ((__force typeof(*(ptr)))({ \
19 __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \
20 __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_be16((ptr)), \
21 __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_be32((ptr)), \
22 __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_be64((ptr)), \
23 __bad_unaligned_access_size())))); \
24 }))
25
26#define __put_unaligned_le(val, ptr) ({ \
27 void *__gu_p = (ptr); \
28 switch (sizeof(*(ptr))) { \
29 case 1: \
30 *(u8 *)__gu_p = (__force u8)(val); \
31 break; \
32 case 2: \
33 put_unaligned_le16((__force u16)(val), __gu_p); \
34 break; \
35 case 4: \
36 put_unaligned_le32((__force u32)(val), __gu_p); \
37 break; \
38 case 8: \
39 put_unaligned_le64((__force u64)(val), __gu_p); \
40 break; \
41 default: \
42 __bad_unaligned_access_size(); \
43 break; \
44 } \
45 (void)0; })
46
47#define __put_unaligned_be(val, ptr) ({ \
48 void *__gu_p = (ptr); \
49 switch (sizeof(*(ptr))) { \
50 case 1: \
51 *(u8 *)__gu_p = (__force u8)(val); \
52 break; \
53 case 2: \
54 put_unaligned_be16((__force u16)(val), __gu_p); \
55 break; \
56 case 4: \
57 put_unaligned_be32((__force u32)(val), __gu_p); \
58 break; \
59 case 8: \
60 put_unaligned_be64((__force u64)(val), __gu_p); \
61 break; \
62 default: \
63 __bad_unaligned_access_size(); \
64 break; \
65 } \
66 (void)0; })
67
68#endif /* _LINUX_UNALIGNED_GENERIC_H */
diff --git a/include/linux/unaligned/le_byteshift.h b/include/linux/unaligned/le_byteshift.h
new file mode 100644
index 000000000000..59777e951baf
--- /dev/null
+++ b/include/linux/unaligned/le_byteshift.h
@@ -0,0 +1,70 @@
1#ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H
2#define _LINUX_UNALIGNED_LE_BYTESHIFT_H
3
4#include <linux/kernel.h>
5
6static inline u16 __get_unaligned_le16(const u8 *p)
7{
8 return p[0] | p[1] << 8;
9}
10
11static inline u32 __get_unaligned_le32(const u8 *p)
12{
13 return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
14}
15
16static inline u64 __get_unaligned_le64(const u8 *p)
17{
18 return (u64)__get_unaligned_le32(p + 4) << 32 |
19 __get_unaligned_le32(p);
20}
21
22static inline void __put_unaligned_le16(u16 val, u8 *p)
23{
24 *p++ = val;
25 *p++ = val >> 8;
26}
27
28static inline void __put_unaligned_le32(u32 val, u8 *p)
29{
30 __put_unaligned_le16(val >> 16, p + 2);
31 __put_unaligned_le16(val, p);
32}
33
34static inline void __put_unaligned_le64(u64 val, u8 *p)
35{
36 __put_unaligned_le32(val >> 32, p + 4);
37 __put_unaligned_le32(val, p);
38}
39
40static inline u16 get_unaligned_le16(const void *p)
41{
42 return __get_unaligned_le16((const u8 *)p);
43}
44
45static inline u32 get_unaligned_le32(const void *p)
46{
47 return __get_unaligned_le32((const u8 *)p);
48}
49
50static inline u64 get_unaligned_le64(const void *p)
51{
52 return __get_unaligned_le64((const u8 *)p);
53}
54
55static inline void put_unaligned_le16(u16 val, void *p)
56{
57 __put_unaligned_le16(val, p);
58}
59
60static inline void put_unaligned_le32(u32 val, void *p)
61{
62 __put_unaligned_le32(val, p);
63}
64
65static inline void put_unaligned_le64(u64 val, void *p)
66{
67 __put_unaligned_le64(val, p);
68}
69
70#endif /* _LINUX_UNALIGNED_LE_BYTESHIFT_H */
diff --git a/include/linux/unaligned/le_memmove.h b/include/linux/unaligned/le_memmove.h
new file mode 100644
index 000000000000..269849bee4ec
--- /dev/null
+++ b/include/linux/unaligned/le_memmove.h
@@ -0,0 +1,36 @@
1#ifndef _LINUX_UNALIGNED_LE_MEMMOVE_H
2#define _LINUX_UNALIGNED_LE_MEMMOVE_H
3
4#include <linux/unaligned/memmove.h>
5
6static inline u16 get_unaligned_le16(const void *p)
7{
8 return __get_unaligned_memmove16((const u8 *)p);
9}
10
11static inline u32 get_unaligned_le32(const void *p)
12{
13 return __get_unaligned_memmove32((const u8 *)p);
14}
15
16static inline u64 get_unaligned_le64(const void *p)
17{
18 return __get_unaligned_memmove64((const u8 *)p);
19}
20
21static inline void put_unaligned_le16(u16 val, void *p)
22{
23 __put_unaligned_memmove16(val, p);
24}
25
26static inline void put_unaligned_le32(u32 val, void *p)
27{
28 __put_unaligned_memmove32(val, p);
29}
30
31static inline void put_unaligned_le64(u64 val, void *p)
32{
33 __put_unaligned_memmove64(val, p);
34}
35
36#endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */
diff --git a/include/linux/unaligned/le_struct.h b/include/linux/unaligned/le_struct.h
new file mode 100644
index 000000000000..088c4572faa8
--- /dev/null
+++ b/include/linux/unaligned/le_struct.h
@@ -0,0 +1,36 @@
1#ifndef _LINUX_UNALIGNED_LE_STRUCT_H
2#define _LINUX_UNALIGNED_LE_STRUCT_H
3
4#include <linux/unaligned/packed_struct.h>
5
6static inline u16 get_unaligned_le16(const void *p)
7{
8 return __get_unaligned_cpu16((const u8 *)p);
9}
10
11static inline u32 get_unaligned_le32(const void *p)
12{
13 return __get_unaligned_cpu32((const u8 *)p);
14}
15
16static inline u64 get_unaligned_le64(const void *p)
17{
18 return __get_unaligned_cpu64((const u8 *)p);
19}
20
21static inline void put_unaligned_le16(u16 val, void *p)
22{
23 __put_unaligned_cpu16(val, p);
24}
25
26static inline void put_unaligned_le32(u32 val, void *p)
27{
28 __put_unaligned_cpu32(val, p);
29}
30
31static inline void put_unaligned_le64(u64 val, void *p)
32{
33 __put_unaligned_cpu64(val, p);
34}
35
36#endif /* _LINUX_UNALIGNED_LE_STRUCT_H */
diff --git a/include/linux/unaligned/memmove.h b/include/linux/unaligned/memmove.h
new file mode 100644
index 000000000000..eeb5a779a4fd
--- /dev/null
+++ b/include/linux/unaligned/memmove.h
@@ -0,0 +1,45 @@
1#ifndef _LINUX_UNALIGNED_MEMMOVE_H
2#define _LINUX_UNALIGNED_MEMMOVE_H
3
4#include <linux/kernel.h>
5#include <linux/string.h>
6
7/* Use memmove here, so gcc does not insert a __builtin_memcpy. */
8
9static inline u16 __get_unaligned_memmove16(const void *p)
10{
11 u16 tmp;
12 memmove(&tmp, p, 2);
13 return tmp;
14}
15
16static inline u32 __get_unaligned_memmove32(const void *p)
17{
18 u32 tmp;
19 memmove(&tmp, p, 4);
20 return tmp;
21}
22
23static inline u64 __get_unaligned_memmove64(const void *p)
24{
25 u64 tmp;
26 memmove(&tmp, p, 8);
27 return tmp;
28}
29
30static inline void __put_unaligned_memmove16(u16 val, void *p)
31{
32 memmove(p, &val, 2);
33}
34
35static inline void __put_unaligned_memmove32(u32 val, void *p)
36{
37 memmove(p, &val, 4);
38}
39
40static inline void __put_unaligned_memmove64(u64 val, void *p)
41{
42 memmove(p, &val, 8);
43}
44
45#endif /* _LINUX_UNALIGNED_MEMMOVE_H */
diff --git a/include/linux/unaligned/packed_struct.h b/include/linux/unaligned/packed_struct.h
new file mode 100644
index 000000000000..2498bb9fe002
--- /dev/null
+++ b/include/linux/unaligned/packed_struct.h
@@ -0,0 +1,46 @@
1#ifndef _LINUX_UNALIGNED_PACKED_STRUCT_H
2#define _LINUX_UNALIGNED_PACKED_STRUCT_H
3
4#include <linux/kernel.h>
5
6struct __una_u16 { u16 x __attribute__((packed)); };
7struct __una_u32 { u32 x __attribute__((packed)); };
8struct __una_u64 { u64 x __attribute__((packed)); };
9
10static inline u16 __get_unaligned_cpu16(const void *p)
11{
12 const struct __una_u16 *ptr = (const struct __una_u16 *)p;
13 return ptr->x;
14}
15
16static inline u32 __get_unaligned_cpu32(const void *p)
17{
18 const struct __una_u32 *ptr = (const struct __una_u32 *)p;
19 return ptr->x;
20}
21
22static inline u64 __get_unaligned_cpu64(const void *p)
23{
24 const struct __una_u64 *ptr = (const struct __una_u64 *)p;
25 return ptr->x;
26}
27
28static inline void __put_unaligned_cpu16(u16 val, void *p)
29{
30 struct __una_u16 *ptr = (struct __una_u16 *)p;
31 ptr->x = val;
32}
33
34static inline void __put_unaligned_cpu32(u32 val, void *p)
35{
36 struct __una_u32 *ptr = (struct __una_u32 *)p;
37 ptr->x = val;
38}
39
40static inline void __put_unaligned_cpu64(u64 val, void *p)
41{
42 struct __una_u64 *ptr = (struct __una_u64 *)p;
43 ptr->x = val;
44}
45
46#endif /* _LINUX_UNALIGNED_PACKED_STRUCT_H */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index b7b3362f7717..f462439cc288 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -114,6 +114,9 @@ struct file;
114int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *, 114int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
115 void __user *, size_t *, loff_t *); 115 void __user *, size_t *, loff_t *);
116 116
117void get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty,
118 struct backing_dev_info *bdi);
119
117void page_writeback_init(void); 120void page_writeback_init(void);
118void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, 121void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
119 unsigned long nr_pages_dirtied); 122 unsigned long nr_pages_dirtied);
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index df6b95d2218e..d131e352cfe1 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -47,10 +47,10 @@ struct xattr_handler {
47}; 47};
48 48
49ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); 49ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
50ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t); 50ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
51ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size); 51ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
52int vfs_setxattr(struct dentry *, char *, void *, size_t, int); 52int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
53int vfs_removexattr(struct dentry *, char *); 53int vfs_removexattr(struct dentry *, const char *);
54 54
55ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size); 55ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);
56ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); 56ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 0ea0bd85c036..2a527742701a 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -64,6 +64,7 @@ enum {
64 /* Conexant MPEG encoder/decoders: reserved range 410-420 */ 64 /* Conexant MPEG encoder/decoders: reserved range 410-420 */
65 V4L2_IDENT_CX23415 = 415, 65 V4L2_IDENT_CX23415 = 415,
66 V4L2_IDENT_CX23416 = 416, 66 V4L2_IDENT_CX23416 = 416,
67 V4L2_IDENT_CX23418 = 418,
67 68
68 /* module vp27smpx: just ident 2700 */ 69 /* module vp27smpx: just ident 2700 */
69 V4L2_IDENT_VP27SMPX = 2700, 70 V4L2_IDENT_VP27SMPX = 2700,
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 316a58453134..020d05758bd8 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -107,9 +107,11 @@ int v4l2_chip_match_host(u32 id_type, u32 chip_id);
107struct i2c_driver; 107struct i2c_driver;
108struct i2c_adapter; 108struct i2c_adapter;
109struct i2c_client; 109struct i2c_client;
110struct i2c_device_id;
110 111
111int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver, 112int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver,
112 const char *name, int (*probe)(struct i2c_client *)); 113 const char *name,
114 int (*probe)(struct i2c_client *, const struct i2c_device_id *));
113 115
114/* ------------------------------------------------------------------------- */ 116/* ------------------------------------------------------------------------- */
115 117
diff --git a/include/media/v4l2-i2c-drv-legacy.h b/include/media/v4l2-i2c-drv-legacy.h
index e7645578fc22..347b6f8beb23 100644
--- a/include/media/v4l2-i2c-drv-legacy.h
+++ b/include/media/v4l2-i2c-drv-legacy.h
@@ -25,7 +25,7 @@ struct v4l2_i2c_driver_data {
25 const char * const name; 25 const char * const name;
26 int driverid; 26 int driverid;
27 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg); 27 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
28 int (*probe)(struct i2c_client *client); 28 int (*probe)(struct i2c_client *client, const struct i2c_device_id *id);
29 int (*remove)(struct i2c_client *client); 29 int (*remove)(struct i2c_client *client);
30 int (*suspend)(struct i2c_client *client, pm_message_t state); 30 int (*suspend)(struct i2c_client *client, pm_message_t state);
31 int (*resume)(struct i2c_client *client); 31 int (*resume)(struct i2c_client *client);
diff --git a/include/media/v4l2-i2c-drv.h b/include/media/v4l2-i2c-drv.h
index 9e4bab276915..7b6f06be7950 100644
--- a/include/media/v4l2-i2c-drv.h
+++ b/include/media/v4l2-i2c-drv.h
@@ -30,7 +30,7 @@ struct v4l2_i2c_driver_data {
30 const char * const name; 30 const char * const name;
31 int driverid; 31 int driverid;
32 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg); 32 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
33 int (*probe)(struct i2c_client *client); 33 int (*probe)(struct i2c_client *client, const struct i2c_device_id *id);
34 int (*remove)(struct i2c_client *client); 34 int (*remove)(struct i2c_client *client);
35 int (*suspend)(struct i2c_client *client, pm_message_t state); 35 int (*suspend)(struct i2c_client *client, pm_message_t state);
36 int (*resume)(struct i2c_client *client); 36 int (*resume)(struct i2c_client *client);
diff --git a/include/net/compat.h b/include/net/compat.h
index 05fa5d0254ab..164cb682e220 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -42,5 +42,8 @@ extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsi
42 42
43extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, int, 43extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, int,
44 int (*)(struct sock *, int, int, char __user *, int)); 44 int (*)(struct sock *, int, int, char __user *, int));
45extern int compat_mc_getsockopt(struct sock *, int, int, char __user *,
46 int __user *, int (*)(struct sock *, int, int, char __user *,
47 int __user *));
45 48
46#endif /* NET_COMPAT_H */ 49#endif /* NET_COMPAT_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 56f3c94ae620..9a51ebad3f1f 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -405,7 +405,8 @@ struct sk_buff;
405struct ip_vs_protocol { 405struct ip_vs_protocol {
406 struct ip_vs_protocol *next; 406 struct ip_vs_protocol *next;
407 char *name; 407 char *name;
408 __u16 protocol; 408 u16 protocol;
409 u16 num_states;
409 int dont_defrag; 410 int dont_defrag;
410 atomic_t appcnt; /* counter of proto app incs */ 411 atomic_t appcnt; /* counter of proto app incs */
411 int *timeout_table; /* protocol timeout table */ 412 int *timeout_table; /* protocol timeout table */
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index 1bb7087833d3..a6874ba22d54 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -107,16 +107,6 @@ struct nf_conntrack_tuple_mask
107 } src; 107 } src;
108}; 108};
109 109
110/* This is optimized opposed to a memset of the whole structure. Everything we
111 * really care about is the source/destination unions */
112#define NF_CT_TUPLE_U_BLANK(tuple) \
113 do { \
114 (tuple)->src.u.all = 0; \
115 (tuple)->dst.u.all = 0; \
116 memset(&(tuple)->src.u3, 0, sizeof((tuple)->src.u3)); \
117 memset(&(tuple)->dst.u3, 0, sizeof((tuple)->dst.u3)); \
118 } while (0)
119
120#ifdef __KERNEL__ 110#ifdef __KERNEL__
121 111
122static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t) 112static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t)
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 5e53a85b5ca1..e4d2d6baa983 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -103,6 +103,7 @@ struct cipso_v4_doi;
103struct netlbl_audit { 103struct netlbl_audit {
104 u32 secid; 104 u32 secid;
105 uid_t loginuid; 105 uid_t loginuid;
106 u32 sessionid;
106}; 107};
107 108
108/* 109/*
diff --git a/include/net/route.h b/include/net/route.h
index c6338802e8f1..fc836ff824cc 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -116,7 +116,7 @@ extern int __ip_route_output_key(struct net *, struct rtable **, const struct f
116extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); 116extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
117extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); 117extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
118extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); 118extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin);
119extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu); 119extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev);
120extern void ip_rt_send_redirect(struct sk_buff *skb); 120extern void ip_rt_send_redirect(struct sk_buff *skb);
121 121
122extern unsigned inet_addr_type(struct net *net, __be32 addr); 122extern unsigned inet_addr_type(struct net *net, __be32 addr);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index baa9f372cfd1..d1350bcccb03 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -597,8 +597,9 @@ struct xfrm_spi_skb_cb {
597/* Audit Information */ 597/* Audit Information */
598struct xfrm_audit 598struct xfrm_audit
599{ 599{
600 u32 loginuid;
601 u32 secid; 600 u32 secid;
601 uid_t loginuid;
602 u32 sessionid;
602}; 603};
603 604
604#ifdef CONFIG_AUDITSYSCALL 605#ifdef CONFIG_AUDITSYSCALL
@@ -616,13 +617,13 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op)
616 return audit_buf; 617 return audit_buf;
617} 618}
618 619
619static inline void xfrm_audit_helper_usrinfo(u32 auid, u32 secid, 620static inline void xfrm_audit_helper_usrinfo(uid_t auid, u32 ses, u32 secid,
620 struct audit_buffer *audit_buf) 621 struct audit_buffer *audit_buf)
621{ 622{
622 char *secctx; 623 char *secctx;
623 u32 secctx_len; 624 u32 secctx_len;
624 625
625 audit_log_format(audit_buf, " auid=%u", auid); 626 audit_log_format(audit_buf, " auid=%u ses=%u", auid, ses);
626 if (secid != 0 && 627 if (secid != 0 &&
627 security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) { 628 security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) {
628 audit_log_format(audit_buf, " subj=%s", secctx); 629 audit_log_format(audit_buf, " subj=%s", secctx);
@@ -632,13 +633,13 @@ static inline void xfrm_audit_helper_usrinfo(u32 auid, u32 secid,
632} 633}
633 634
634extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 635extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
635 u32 auid, u32 secid); 636 u32 auid, u32 ses, u32 secid);
636extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, 637extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
637 u32 auid, u32 secid); 638 u32 auid, u32 ses, u32 secid);
638extern void xfrm_audit_state_add(struct xfrm_state *x, int result, 639extern void xfrm_audit_state_add(struct xfrm_state *x, int result,
639 u32 auid, u32 secid); 640 u32 auid, u32 ses, u32 secid);
640extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, 641extern void xfrm_audit_state_delete(struct xfrm_state *x, int result,
641 u32 auid, u32 secid); 642 u32 auid, u32 ses, u32 secid);
642extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, 643extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
643 struct sk_buff *skb); 644 struct sk_buff *skb);
644extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family); 645extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family);
@@ -647,10 +648,10 @@ extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family,
647extern void xfrm_audit_state_icvfail(struct xfrm_state *x, 648extern void xfrm_audit_state_icvfail(struct xfrm_state *x,
648 struct sk_buff *skb, u8 proto); 649 struct sk_buff *skb, u8 proto);
649#else 650#else
650#define xfrm_audit_policy_add(x, r, a, s) do { ; } while (0) 651#define xfrm_audit_policy_add(x, r, a, se, s) do { ; } while (0)
651#define xfrm_audit_policy_delete(x, r, a, s) do { ; } while (0) 652#define xfrm_audit_policy_delete(x, r, a, se, s) do { ; } while (0)
652#define xfrm_audit_state_add(x, r, a, s) do { ; } while (0) 653#define xfrm_audit_state_add(x, r, a, se, s) do { ; } while (0)
653#define xfrm_audit_state_delete(x, r, a, s) do { ; } while (0) 654#define xfrm_audit_state_delete(x, r, a, se, s) do { ; } while (0)
654#define xfrm_audit_state_replay_overflow(x, s) do { ; } while (0) 655#define xfrm_audit_state_replay_overflow(x, s) do { ; } while (0)
655#define xfrm_audit_state_notfound_simple(s, f) do { ; } while (0) 656#define xfrm_audit_state_notfound_simple(s, f) do { ; } while (0)
656#define xfrm_audit_state_notfound(s, f, sp, sq) do { ; } while (0) 657#define xfrm_audit_state_notfound(s, f, sp, sq) do { ; } while (0)
diff --git a/include/rdma/ib_umem.h b/include/rdma/ib_umem.h
index 22298423cf0b..9ee0d2e51b16 100644
--- a/include/rdma/ib_umem.h
+++ b/include/rdma/ib_umem.h
@@ -62,7 +62,7 @@ struct ib_umem_chunk {
62#ifdef CONFIG_INFINIBAND_USER_MEM 62#ifdef CONFIG_INFINIBAND_USER_MEM
63 63
64struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, 64struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
65 size_t size, int access); 65 size_t size, int access, int dmasync);
66void ib_umem_release(struct ib_umem *umem); 66void ib_umem_release(struct ib_umem *umem);
67int ib_umem_page_count(struct ib_umem *umem); 67int ib_umem_page_count(struct ib_umem *umem);
68 68
@@ -72,7 +72,7 @@ int ib_umem_page_count(struct ib_umem *umem);
72 72
73static inline struct ib_umem *ib_umem_get(struct ib_ucontext *context, 73static inline struct ib_umem *ib_umem_get(struct ib_ucontext *context,
74 unsigned long addr, size_t size, 74 unsigned long addr, size_t size,
75 int access) { 75 int access, int dmasync) {
76 return ERR_PTR(-EINVAL); 76 return ERR_PTR(-EINVAL);
77} 77}
78static inline void ib_umem_release(struct ib_umem *umem) { } 78static inline void ib_umem_release(struct ib_umem *umem) { }
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 2dcbecce3f61..911a661b7278 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1542,6 +1542,24 @@ static inline void ib_dma_unmap_single(struct ib_device *dev,
1542 dma_unmap_single(dev->dma_device, addr, size, direction); 1542 dma_unmap_single(dev->dma_device, addr, size, direction);
1543} 1543}
1544 1544
1545static inline u64 ib_dma_map_single_attrs(struct ib_device *dev,
1546 void *cpu_addr, size_t size,
1547 enum dma_data_direction direction,
1548 struct dma_attrs *attrs)
1549{
1550 return dma_map_single_attrs(dev->dma_device, cpu_addr, size,
1551 direction, attrs);
1552}
1553
1554static inline void ib_dma_unmap_single_attrs(struct ib_device *dev,
1555 u64 addr, size_t size,
1556 enum dma_data_direction direction,
1557 struct dma_attrs *attrs)
1558{
1559 return dma_unmap_single_attrs(dev->dma_device, addr, size,
1560 direction, attrs);
1561}
1562
1545/** 1563/**
1546 * ib_dma_map_page - Map a physical page to DMA address 1564 * ib_dma_map_page - Map a physical page to DMA address
1547 * @dev: The device for which the dma_addr is to be created 1565 * @dev: The device for which the dma_addr is to be created
@@ -1611,6 +1629,21 @@ static inline void ib_dma_unmap_sg(struct ib_device *dev,
1611 dma_unmap_sg(dev->dma_device, sg, nents, direction); 1629 dma_unmap_sg(dev->dma_device, sg, nents, direction);
1612} 1630}
1613 1631
1632static inline int ib_dma_map_sg_attrs(struct ib_device *dev,
1633 struct scatterlist *sg, int nents,
1634 enum dma_data_direction direction,
1635 struct dma_attrs *attrs)
1636{
1637 return dma_map_sg_attrs(dev->dma_device, sg, nents, direction, attrs);
1638}
1639
1640static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev,
1641 struct scatterlist *sg, int nents,
1642 enum dma_data_direction direction,
1643 struct dma_attrs *attrs)
1644{
1645 dma_unmap_sg_attrs(dev->dma_device, sg, nents, direction, attrs);
1646}
1614/** 1647/**
1615 * ib_sg_dma_address - Return the DMA address from a scatter/gather entry 1648 * ib_sg_dma_address - Return the DMA address from a scatter/gather entry
1616 * @dev: The device for which the DMA addresses were created 1649 * @dev: The device for which the DMA addresses were created
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 7b90b63fb5c7..cd3ca63d4fb1 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -225,6 +225,7 @@ struct iscsi_conn {
225 225
226 /* custom statistics */ 226 /* custom statistics */
227 uint32_t eh_abort_cnt; 227 uint32_t eh_abort_cnt;
228 uint32_t fmr_unalign_cnt;
228}; 229};
229 230
230struct iscsi_pool { 231struct iscsi_pool {
diff --git a/include/sound/mpu401.h b/include/sound/mpu401.h
index 68b634b75068..1f1d53f8830b 100644
--- a/include/sound/mpu401.h
+++ b/include/sound/mpu401.h
@@ -50,6 +50,7 @@
50#define MPU401_INFO_INTEGRATED (1 << 2) /* integrated h/w port */ 50#define MPU401_INFO_INTEGRATED (1 << 2) /* integrated h/w port */
51#define MPU401_INFO_MMIO (1 << 3) /* MMIO access */ 51#define MPU401_INFO_MMIO (1 << 3) /* MMIO access */
52#define MPU401_INFO_TX_IRQ (1 << 4) /* independent TX irq */ 52#define MPU401_INFO_TX_IRQ (1 << 4) /* independent TX irq */
53#define MPU401_INFO_NO_ACK (1 << 6) /* No ACK cmd needed */
53 54
54#define MPU401_MODE_BIT_INPUT 0 55#define MPU401_MODE_BIT_INPUT 0
55#define MPU401_MODE_BIT_OUTPUT 1 56#define MPU401_MODE_BIT_OUTPUT 1