aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/bitops/atomic.h10
-rw-r--r--include/asm-generic/bug.h8
-rw-r--r--include/asm-generic/gpio.h6
-rw-r--r--include/asm-generic/mman-common.h5
-rw-r--r--include/linux/aio.h4
-rw-r--r--include/linux/atmel-mci.h4
-rw-r--r--include/linux/bitmap.h11
-rw-r--r--include/linux/can/dev.h9
-rw-r--r--include/linux/cs5535.h172
-rw-r--r--include/linux/ctype.h3
-rw-r--r--include/linux/device-mapper.h8
-rw-r--r--include/linux/dm-dirty-log.h6
-rw-r--r--include/linux/dm-ioctl.h13
-rw-r--r--include/linux/dm-region-hash.h3
-rw-r--r--include/linux/dmaengine.h2
-rw-r--r--include/linux/dynamic_debug.h13
-rw-r--r--include/linux/efi.h6
-rw-r--r--include/linux/err.h5
-rw-r--r--include/linux/exportfs.h2
-rw-r--r--include/linux/fs.h22
-rw-r--r--include/linux/gpio.h6
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/hugetlb.h6
-rw-r--r--include/linux/i2c.h92
-rw-r--r--include/linux/i8042.h18
-rw-r--r--include/linux/init_task.h10
-rw-r--r--include/linux/intel-iommu.h1
-rw-r--r--include/linux/iommu-helper.h3
-rw-r--r--include/linux/ioport.h4
-rw-r--r--include/linux/ipc_namespace.h2
-rw-r--r--include/linux/irq.h2
-rw-r--r--include/linux/kallsyms.h12
-rw-r--r--include/linux/kernel.h55
-rw-r--r--include/linux/kexec.h2
-rw-r--r--include/linux/kmsg_dump.h60
-rw-r--r--include/linux/ksm.h96
-rw-r--r--include/linux/lis3lv02d.h15
-rw-r--r--include/linux/memcontrol.h17
-rw-r--r--include/linux/memory_hotplug.h1
-rw-r--r--include/linux/mempolicy.h3
-rw-r--r--include/linux/mfd/pcf50633/core.h7
-rw-r--r--include/linux/mfd/pcf50633/mbc.h1
-rw-r--r--include/linux/migrate.h8
-rw-r--r--include/linux/mlx4/device.h1
-rw-r--r--include/linux/mm.h25
-rw-r--r--include/linux/mtd/bbm.h35
-rw-r--r--include/linux/mtd/cfi.h9
-rw-r--r--include/linux/mtd/flashchip.h9
-rw-r--r--include/linux/mtd/nand.h97
-rw-r--r--include/linux/mtd/nand_ecc.h10
-rw-r--r--include/linux/mtd/onenand.h23
-rw-r--r--include/linux/mtd/onenand_regs.h2
-rw-r--r--include/linux/nfs_xdr.h1
-rw-r--r--include/linux/nfsacl.h1
-rw-r--r--include/linux/nfsd/cache.h86
-rw-r--r--include/linux/nfsd/export.h19
-rw-r--r--include/linux/nfsd/nfsd.h424
-rw-r--r--include/linux/nfsd/nfsfh.h206
-rw-r--r--include/linux/nfsd/state.h404
-rw-r--r--include/linux/nfsd/syscall.h8
-rw-r--r--include/linux/nfsd/xdr.h177
-rw-r--r--include/linux/nfsd/xdr3.h346
-rw-r--r--include/linux/nfsd/xdr4.h563
-rw-r--r--include/linux/node.h16
-rw-r--r--include/linux/nodemask.h33
-rw-r--r--include/linux/numa.h2
-rw-r--r--include/linux/oom.h4
-rw-r--r--include/linux/page-flags.h8
-rw-r--r--include/linux/page_cgroup.h7
-rw-r--r--include/linux/perf_event.h2
-rw-r--r--include/linux/plist.h43
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/ptrace.h23
-rw-r--r--include/linux/reiserfs_fs.h35
-rw-r--r--include/linux/rmap.h43
-rw-r--r--include/linux/rtmutex.h6
-rw-r--r--include/linux/rtnetlink.h6
-rw-r--r--include/linux/rwlock.h125
-rw-r--r--include/linux/rwlock_api_smp.h282
-rw-r--r--include/linux/rwlock_types.h56
-rw-r--r--include/linux/rwsem-spinlock.h6
-rw-r--r--include/linux/sched.h18
-rw-r--r--include/linux/sem.h5
-rw-r--r--include/linux/sm501-regs.h2
-rw-r--r--include/linux/spinlock.h377
-rw-r--r--include/linux/spinlock_api_smp.h360
-rw-r--r--include/linux/spinlock_api_up.h66
-rw-r--r--include/linux/spinlock_types.h92
-rw-r--r--include/linux/spinlock_types_up.h12
-rw-r--r--include/linux/spinlock_up.h42
-rw-r--r--include/linux/string.h10
-rw-r--r--include/linux/sunrpc/debug.h3
-rw-r--r--include/linux/sunrpc/rpc_rdma.h2
-rw-r--r--include/linux/sunrpc/svc.h7
-rw-r--r--include/linux/swap.h67
-rw-r--r--include/linux/timb_gpio.h37
-rw-r--r--include/linux/tracehook.h7
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/videodev2.h123
-rw-r--r--include/linux/vmstat.h2
-rw-r--r--include/linux/vt.h15
-rw-r--r--include/media/ir-common.h39
-rw-r--r--include/media/ir-core.h62
-rw-r--r--include/media/mt9t112.h30
-rw-r--r--include/media/ov772x.h4
-rw-r--r--include/media/rj54n1cb0c.h19
-rw-r--r--include/media/saa7146_vv.h4
-rw-r--r--include/media/sh_mobile_ceu.h2
-rw-r--r--include/media/soc_camera.h30
-rw-r--r--include/media/soc_camera_platform.h3
-rw-r--r--include/media/soc_mediabus.h65
-rw-r--r--include/media/tw9910.h1
-rw-r--r--include/media/v4l2-chip-ident.h2
-rw-r--r--include/media/v4l2-common.h2
-rw-r--r--include/media/v4l2-dev.h23
-rw-r--r--include/media/v4l2-ioctl.h15
-rw-r--r--include/media/v4l2-mediabus.h61
-rw-r--r--include/media/v4l2-subdev.h61
-rw-r--r--include/net/dst.h2
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/ipv6.h8
-rw-r--r--include/net/netfilter/ipv6/nf_conntrack_ipv6.h2
-rw-r--r--include/net/tcp.h3
-rw-r--r--include/rdma/ib_addr.h36
-rw-r--r--include/rdma/ib_sa.h6
-rw-r--r--include/rdma/ib_user_sa.h16
-rw-r--r--include/rdma/ib_verbs.h5
-rw-r--r--include/rdma/rdma_user_cm.h6
-rw-r--r--include/video/da8xx-fb.h1
-rw-r--r--include/video/sh_mobile_lcdc.h2
130 files changed, 2293 insertions, 3347 deletions
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h
index c8946465e63a..ecc44a8e2b44 100644
--- a/include/asm-generic/bitops/atomic.h
+++ b/include/asm-generic/bitops/atomic.h
@@ -15,19 +15,19 @@
15# define ATOMIC_HASH_SIZE 4 15# define ATOMIC_HASH_SIZE 4
16# define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) 16# define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ]))
17 17
18extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; 18extern arch_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned;
19 19
20/* Can't use raw_spin_lock_irq because of #include problems, so 20/* Can't use raw_spin_lock_irq because of #include problems, so
21 * this is the substitute */ 21 * this is the substitute */
22#define _atomic_spin_lock_irqsave(l,f) do { \ 22#define _atomic_spin_lock_irqsave(l,f) do { \
23 raw_spinlock_t *s = ATOMIC_HASH(l); \ 23 arch_spinlock_t *s = ATOMIC_HASH(l); \
24 local_irq_save(f); \ 24 local_irq_save(f); \
25 __raw_spin_lock(s); \ 25 arch_spin_lock(s); \
26} while(0) 26} while(0)
27 27
28#define _atomic_spin_unlock_irqrestore(l,f) do { \ 28#define _atomic_spin_unlock_irqrestore(l,f) do { \
29 raw_spinlock_t *s = ATOMIC_HASH(l); \ 29 arch_spinlock_t *s = ATOMIC_HASH(l); \
30 __raw_spin_unlock(s); \ 30 arch_spin_unlock(s); \
31 local_irq_restore(f); \ 31 local_irq_restore(f); \
32} while(0) 32} while(0)
33 33
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 4b6755984d24..18c435d7c082 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -113,22 +113,22 @@ extern void warn_slowpath_null(const char *file, const int line);
113#endif 113#endif
114 114
115#define WARN_ON_ONCE(condition) ({ \ 115#define WARN_ON_ONCE(condition) ({ \
116 static int __warned; \ 116 static bool __warned; \
117 int __ret_warn_once = !!(condition); \ 117 int __ret_warn_once = !!(condition); \
118 \ 118 \
119 if (unlikely(__ret_warn_once)) \ 119 if (unlikely(__ret_warn_once)) \
120 if (WARN_ON(!__warned)) \ 120 if (WARN_ON(!__warned)) \
121 __warned = 1; \ 121 __warned = true; \
122 unlikely(__ret_warn_once); \ 122 unlikely(__ret_warn_once); \
123}) 123})
124 124
125#define WARN_ONCE(condition, format...) ({ \ 125#define WARN_ONCE(condition, format...) ({ \
126 static int __warned; \ 126 static bool __warned; \
127 int __ret_warn_once = !!(condition); \ 127 int __ret_warn_once = !!(condition); \
128 \ 128 \
129 if (unlikely(__ret_warn_once)) \ 129 if (unlikely(__ret_warn_once)) \
130 if (WARN(!__warned, format)) \ 130 if (WARN(!__warned, format)) \
131 __warned = 1; \ 131 __warned = true; \
132 unlikely(__ret_warn_once); \ 132 unlikely(__ret_warn_once); \
133}) 133})
134 134
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 204bed37e82d..485eeb6c4ef3 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -145,6 +145,7 @@ extern int __gpio_to_irq(unsigned gpio);
145extern int gpio_export(unsigned gpio, bool direction_may_change); 145extern int gpio_export(unsigned gpio, bool direction_may_change);
146extern int gpio_export_link(struct device *dev, const char *name, 146extern int gpio_export_link(struct device *dev, const char *name,
147 unsigned gpio); 147 unsigned gpio);
148extern int gpio_sysfs_set_active_low(unsigned gpio, int value);
148extern void gpio_unexport(unsigned gpio); 149extern void gpio_unexport(unsigned gpio);
149 150
150#endif /* CONFIG_GPIO_SYSFS */ 151#endif /* CONFIG_GPIO_SYSFS */
@@ -197,6 +198,11 @@ static inline int gpio_export_link(struct device *dev, const char *name,
197 return -ENOSYS; 198 return -ENOSYS;
198} 199}
199 200
201static inline int gpio_sysfs_set_active_low(unsigned gpio, int value)
202{
203 return -ENOSYS;
204}
205
200static inline void gpio_unexport(unsigned gpio) 206static inline void gpio_unexport(unsigned gpio)
201{ 207{
202} 208}
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h
index 5ee13b2fd223..20111265afd8 100644
--- a/include/asm-generic/mman-common.h
+++ b/include/asm-generic/mman-common.h
@@ -19,6 +19,11 @@
19#define MAP_TYPE 0x0f /* Mask for type of mapping */ 19#define MAP_TYPE 0x0f /* Mask for type of mapping */
20#define MAP_FIXED 0x10 /* Interpret addr exactly */ 20#define MAP_FIXED 0x10 /* Interpret addr exactly */
21#define MAP_ANONYMOUS 0x20 /* don't use a file */ 21#define MAP_ANONYMOUS 0x20 /* don't use a file */
22#ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED
23# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */
24#else
25# define MAP_UNINITIALIZED 0x0 /* Don't support this flag */
26#endif
22 27
23#define MS_ASYNC 1 /* sync memory asynchronously */ 28#define MS_ASYNC 1 /* sync memory asynchronously */
24#define MS_INVALIDATE 2 /* invalidate the caches */ 29#define MS_INVALIDATE 2 /* invalidate the caches */
diff --git a/include/linux/aio.h b/include/linux/aio.h
index aea219d7d8d1..811dbb369379 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -102,7 +102,6 @@ struct kiocb {
102 } ki_obj; 102 } ki_obj;
103 103
104 __u64 ki_user_data; /* user's data for completion */ 104 __u64 ki_user_data; /* user's data for completion */
105 wait_queue_t ki_wait;
106 loff_t ki_pos; 105 loff_t ki_pos;
107 106
108 void *private; 107 void *private;
@@ -140,7 +139,6 @@ struct kiocb {
140 (x)->ki_dtor = NULL; \ 139 (x)->ki_dtor = NULL; \
141 (x)->ki_obj.tsk = tsk; \ 140 (x)->ki_obj.tsk = tsk; \
142 (x)->ki_user_data = 0; \ 141 (x)->ki_user_data = 0; \
143 init_wait((&(x)->ki_wait)); \
144 } while (0) 142 } while (0)
145 143
146#define AIO_RING_MAGIC 0xa10a10a1 144#define AIO_RING_MAGIC 0xa10a10a1
@@ -223,8 +221,6 @@ struct mm_struct;
223static inline void exit_aio(struct mm_struct *mm) { } 221static inline void exit_aio(struct mm_struct *mm) { }
224#endif /* CONFIG_AIO */ 222#endif /* CONFIG_AIO */
225 223
226#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
227
228static inline struct kiocb *list_kiocb(struct list_head *h) 224static inline struct kiocb *list_kiocb(struct list_head *h)
229{ 225{
230 return list_entry(h, struct kiocb, ki_list); 226 return list_entry(h, struct kiocb, ki_list);
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
index 57b1846a3c87..3e09b345f4d6 100644
--- a/include/linux/atmel-mci.h
+++ b/include/linux/atmel-mci.h
@@ -3,8 +3,6 @@
3 3
4#define ATMEL_MCI_MAX_NR_SLOTS 2 4#define ATMEL_MCI_MAX_NR_SLOTS 2
5 5
6#include <linux/dw_dmac.h>
7
8/** 6/**
9 * struct mci_slot_pdata - board-specific per-slot configuration 7 * struct mci_slot_pdata - board-specific per-slot configuration
10 * @bus_width: Number of data lines wired up the slot 8 * @bus_width: Number of data lines wired up the slot
@@ -34,7 +32,7 @@ struct mci_slot_pdata {
34 * @slot: Per-slot configuration data. 32 * @slot: Per-slot configuration data.
35 */ 33 */
36struct mci_platform_data { 34struct mci_platform_data {
37 struct dw_dma_slave dma_slave; 35 struct mci_dma_data *dma_slave;
38 struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS]; 36 struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS];
39}; 37};
40 38
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 756d78b8c1c5..daf8c480c786 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -42,6 +42,9 @@
42 * bitmap_empty(src, nbits) Are all bits zero in *src? 42 * bitmap_empty(src, nbits) Are all bits zero in *src?
43 * bitmap_full(src, nbits) Are all bits set in *src? 43 * bitmap_full(src, nbits) Are all bits set in *src?
44 * bitmap_weight(src, nbits) Hamming Weight: number set bits 44 * bitmap_weight(src, nbits) Hamming Weight: number set bits
45 * bitmap_set(dst, pos, nbits) Set specified bit area
46 * bitmap_clear(dst, pos, nbits) Clear specified bit area
47 * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area
45 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n 48 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
46 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n 49 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
47 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) 50 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src)
@@ -108,6 +111,14 @@ extern int __bitmap_subset(const unsigned long *bitmap1,
108 const unsigned long *bitmap2, int bits); 111 const unsigned long *bitmap2, int bits);
109extern int __bitmap_weight(const unsigned long *bitmap, int bits); 112extern int __bitmap_weight(const unsigned long *bitmap, int bits);
110 113
114extern void bitmap_set(unsigned long *map, int i, int len);
115extern void bitmap_clear(unsigned long *map, int start, int nr);
116extern unsigned long bitmap_find_next_zero_area(unsigned long *map,
117 unsigned long size,
118 unsigned long start,
119 unsigned int nr,
120 unsigned long align_mask);
121
111extern int bitmap_scnprintf(char *buf, unsigned int len, 122extern int bitmap_scnprintf(char *buf, unsigned int len,
112 const unsigned long *src, int nbits); 123 const unsigned long *src, int nbits);
113extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, 124extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user,
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 1ed2a5cc03f5..3db7767d2a17 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -51,6 +51,15 @@ struct can_priv {
51 struct sk_buff **echo_skb; 51 struct sk_buff **echo_skb;
52}; 52};
53 53
54/*
55 * get_can_dlc(value) - helper macro to cast a given data length code (dlc)
56 * to __u8 and ensure the dlc value to be max. 8 bytes.
57 *
58 * To be used in the CAN netdriver receive path to ensure conformance with
59 * ISO 11898-1 Chapter 8.4.2.3 (DLC field)
60 */
61#define get_can_dlc(i) (min_t(__u8, (i), 8))
62
54struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); 63struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max);
55void free_candev(struct net_device *dev); 64void free_candev(struct net_device *dev);
56 65
diff --git a/include/linux/cs5535.h b/include/linux/cs5535.h
new file mode 100644
index 000000000000..d5a1d4810b80
--- /dev/null
+++ b/include/linux/cs5535.h
@@ -0,0 +1,172 @@
1/*
2 * AMD CS5535/CS5536 definitions
3 * Copyright (C) 2006 Advanced Micro Devices, Inc.
4 * Copyright (C) 2009 Andres Salomon <dilinger@collabora.co.uk>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public License
8 * as published by the Free Software Foundation.
9 */
10
11#ifndef _CS5535_H
12#define _CS5535_H
13
14/* MSRs */
15#define MSR_GLIU_P2D_RO0 0x10000029
16
17#define MSR_LX_GLD_MSR_CONFIG 0x48002001
18#define MSR_LX_MSR_PADSEL 0x48002011 /* NOT 0x48000011; the data
19 * sheet has the wrong value */
20#define MSR_GLCP_SYS_RSTPLL 0x4C000014
21#define MSR_GLCP_DOTPLL 0x4C000015
22
23#define MSR_LBAR_SMB 0x5140000B
24#define MSR_LBAR_GPIO 0x5140000C
25#define MSR_LBAR_MFGPT 0x5140000D
26#define MSR_LBAR_ACPI 0x5140000E
27#define MSR_LBAR_PMS 0x5140000F
28
29#define MSR_DIVIL_SOFT_RESET 0x51400017
30
31#define MSR_PIC_YSEL_LOW 0x51400020
32#define MSR_PIC_YSEL_HIGH 0x51400021
33#define MSR_PIC_ZSEL_LOW 0x51400022
34#define MSR_PIC_ZSEL_HIGH 0x51400023
35#define MSR_PIC_IRQM_LPC 0x51400025
36
37#define MSR_MFGPT_IRQ 0x51400028
38#define MSR_MFGPT_NR 0x51400029
39#define MSR_MFGPT_SETUP 0x5140002B
40
41#define MSR_LX_SPARE_MSR 0x80000011 /* DC-specific */
42
43#define MSR_GX_GLD_MSR_CONFIG 0xC0002001
44#define MSR_GX_MSR_PADSEL 0xC0002011
45
46/* resource sizes */
47#define LBAR_GPIO_SIZE 0xFF
48#define LBAR_MFGPT_SIZE 0x40
49#define LBAR_ACPI_SIZE 0x40
50#define LBAR_PMS_SIZE 0x80
51
52/* VSA2 magic values */
53#define VSA_VRC_INDEX 0xAC1C
54#define VSA_VRC_DATA 0xAC1E
55#define VSA_VR_UNLOCK 0xFC53 /* unlock virtual register */
56#define VSA_VR_SIGNATURE 0x0003
57#define VSA_VR_MEM_SIZE 0x0200
58#define AMD_VSA_SIG 0x4132 /* signature is ascii 'VSA2' */
59#define GSW_VSA_SIG 0x534d /* General Software signature */
60
61#include <linux/io.h>
62
63static inline int cs5535_has_vsa2(void)
64{
65 static int has_vsa2 = -1;
66
67 if (has_vsa2 == -1) {
68 uint16_t val;
69
70 /*
71 * The VSA has virtual registers that we can query for a
72 * signature.
73 */
74 outw(VSA_VR_UNLOCK, VSA_VRC_INDEX);
75 outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX);
76
77 val = inw(VSA_VRC_DATA);
78 has_vsa2 = (val == AMD_VSA_SIG || val == GSW_VSA_SIG);
79 }
80
81 return has_vsa2;
82}
83
84/* GPIOs */
85#define GPIO_OUTPUT_VAL 0x00
86#define GPIO_OUTPUT_ENABLE 0x04
87#define GPIO_OUTPUT_OPEN_DRAIN 0x08
88#define GPIO_OUTPUT_INVERT 0x0C
89#define GPIO_OUTPUT_AUX1 0x10
90#define GPIO_OUTPUT_AUX2 0x14
91#define GPIO_PULL_UP 0x18
92#define GPIO_PULL_DOWN 0x1C
93#define GPIO_INPUT_ENABLE 0x20
94#define GPIO_INPUT_INVERT 0x24
95#define GPIO_INPUT_FILTER 0x28
96#define GPIO_INPUT_EVENT_COUNT 0x2C
97#define GPIO_READ_BACK 0x30
98#define GPIO_INPUT_AUX1 0x34
99#define GPIO_EVENTS_ENABLE 0x38
100#define GPIO_LOCK_ENABLE 0x3C
101#define GPIO_POSITIVE_EDGE_EN 0x40
102#define GPIO_NEGATIVE_EDGE_EN 0x44
103#define GPIO_POSITIVE_EDGE_STS 0x48
104#define GPIO_NEGATIVE_EDGE_STS 0x4C
105
106#define GPIO_MAP_X 0xE0
107#define GPIO_MAP_Y 0xE4
108#define GPIO_MAP_Z 0xE8
109#define GPIO_MAP_W 0xEC
110
111void cs5535_gpio_set(unsigned offset, unsigned int reg);
112void cs5535_gpio_clear(unsigned offset, unsigned int reg);
113int cs5535_gpio_isset(unsigned offset, unsigned int reg);
114
115/* MFGPTs */
116
117#define MFGPT_MAX_TIMERS 8
118#define MFGPT_TIMER_ANY (-1)
119
120#define MFGPT_DOMAIN_WORKING 1
121#define MFGPT_DOMAIN_STANDBY 2
122#define MFGPT_DOMAIN_ANY (MFGPT_DOMAIN_WORKING | MFGPT_DOMAIN_STANDBY)
123
124#define MFGPT_CMP1 0
125#define MFGPT_CMP2 1
126
127#define MFGPT_EVENT_IRQ 0
128#define MFGPT_EVENT_NMI 1
129#define MFGPT_EVENT_RESET 3
130
131#define MFGPT_REG_CMP1 0
132#define MFGPT_REG_CMP2 2
133#define MFGPT_REG_COUNTER 4
134#define MFGPT_REG_SETUP 6
135
136#define MFGPT_SETUP_CNTEN (1 << 15)
137#define MFGPT_SETUP_CMP2 (1 << 14)
138#define MFGPT_SETUP_CMP1 (1 << 13)
139#define MFGPT_SETUP_SETUP (1 << 12)
140#define MFGPT_SETUP_STOPEN (1 << 11)
141#define MFGPT_SETUP_EXTEN (1 << 10)
142#define MFGPT_SETUP_REVEN (1 << 5)
143#define MFGPT_SETUP_CLKSEL (1 << 4)
144
145struct cs5535_mfgpt_timer;
146
147extern uint16_t cs5535_mfgpt_read(struct cs5535_mfgpt_timer *timer,
148 uint16_t reg);
149extern void cs5535_mfgpt_write(struct cs5535_mfgpt_timer *timer, uint16_t reg,
150 uint16_t value);
151
152extern int cs5535_mfgpt_toggle_event(struct cs5535_mfgpt_timer *timer, int cmp,
153 int event, int enable);
154extern int cs5535_mfgpt_set_irq(struct cs5535_mfgpt_timer *timer, int cmp,
155 int *irq, int enable);
156extern struct cs5535_mfgpt_timer *cs5535_mfgpt_alloc_timer(int timer,
157 int domain);
158extern void cs5535_mfgpt_free_timer(struct cs5535_mfgpt_timer *timer);
159
160static inline int cs5535_mfgpt_setup_irq(struct cs5535_mfgpt_timer *timer,
161 int cmp, int *irq)
162{
163 return cs5535_mfgpt_set_irq(timer, cmp, irq, 1);
164}
165
166static inline int cs5535_mfgpt_release_irq(struct cs5535_mfgpt_timer *timer,
167 int cmp, int *irq)
168{
169 return cs5535_mfgpt_set_irq(timer, cmp, irq, 0);
170}
171
172#endif
diff --git a/include/linux/ctype.h b/include/linux/ctype.h
index afa36392297a..a3d6ee0044f9 100644
--- a/include/linux/ctype.h
+++ b/include/linux/ctype.h
@@ -15,7 +15,7 @@
15#define _X 0x40 /* hex digit */ 15#define _X 0x40 /* hex digit */
16#define _SP 0x80 /* hard space (0x20) */ 16#define _SP 0x80 /* hard space (0x20) */
17 17
18extern unsigned char _ctype[]; 18extern const unsigned char _ctype[];
19 19
20#define __ismask(x) (_ctype[(int)(unsigned char)(x)]) 20#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
21 21
@@ -27,6 +27,7 @@ extern unsigned char _ctype[];
27#define islower(c) ((__ismask(c)&(_L)) != 0) 27#define islower(c) ((__ismask(c)&(_L)) != 0)
28#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) 28#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
29#define ispunct(c) ((__ismask(c)&(_P)) != 0) 29#define ispunct(c) ((__ismask(c)&(_P)) != 0)
30/* Note: isspace() must return false for %NUL-terminator */
30#define isspace(c) ((__ismask(c)&(_S)) != 0) 31#define isspace(c) ((__ismask(c)&(_S)) != 0)
31#define isupper(c) ((__ismask(c)&(_U)) != 0) 32#define isupper(c) ((__ismask(c)&(_U)) != 0)
32#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) 33#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index df7607e6dce8..d4c9c0b88adc 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -235,7 +235,7 @@ void dm_uevent_add(struct mapped_device *md, struct list_head *elist);
235const char *dm_device_name(struct mapped_device *md); 235const char *dm_device_name(struct mapped_device *md);
236int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); 236int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid);
237struct gendisk *dm_disk(struct mapped_device *md); 237struct gendisk *dm_disk(struct mapped_device *md);
238int dm_suspended(struct mapped_device *md); 238int dm_suspended(struct dm_target *ti);
239int dm_noflush_suspending(struct dm_target *ti); 239int dm_noflush_suspending(struct dm_target *ti);
240union map_info *dm_get_mapinfo(struct bio *bio); 240union map_info *dm_get_mapinfo(struct bio *bio);
241union map_info *dm_get_rq_mapinfo(struct request *rq); 241union map_info *dm_get_rq_mapinfo(struct request *rq);
@@ -276,7 +276,7 @@ void dm_table_unplug_all(struct dm_table *t);
276/* 276/*
277 * Table reference counting. 277 * Table reference counting.
278 */ 278 */
279struct dm_table *dm_get_table(struct mapped_device *md); 279struct dm_table *dm_get_live_table(struct mapped_device *md);
280void dm_table_get(struct dm_table *t); 280void dm_table_get(struct dm_table *t);
281void dm_table_put(struct dm_table *t); 281void dm_table_put(struct dm_table *t);
282 282
@@ -295,8 +295,10 @@ void dm_table_event(struct dm_table *t);
295 295
296/* 296/*
297 * The device must be suspended before calling this method. 297 * The device must be suspended before calling this method.
298 * Returns the previous table, which the caller must destroy.
298 */ 299 */
299int dm_swap_table(struct mapped_device *md, struct dm_table *t); 300struct dm_table *dm_swap_table(struct mapped_device *md,
301 struct dm_table *t);
300 302
301/* 303/*
302 * A wrapper around vmalloc. 304 * A wrapper around vmalloc.
diff --git a/include/linux/dm-dirty-log.h b/include/linux/dm-dirty-log.h
index 5e8b11d88f6f..7084503c3405 100644
--- a/include/linux/dm-dirty-log.h
+++ b/include/linux/dm-dirty-log.h
@@ -21,6 +21,7 @@ struct dm_dirty_log_type;
21 21
22struct dm_dirty_log { 22struct dm_dirty_log {
23 struct dm_dirty_log_type *type; 23 struct dm_dirty_log_type *type;
24 int (*flush_callback_fn)(struct dm_target *ti);
24 void *context; 25 void *context;
25}; 26};
26 27
@@ -136,8 +137,9 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type);
136 * type->constructor/destructor() directly. 137 * type->constructor/destructor() directly.
137 */ 138 */
138struct dm_dirty_log *dm_dirty_log_create(const char *type_name, 139struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
139 struct dm_target *ti, 140 struct dm_target *ti,
140 unsigned argc, char **argv); 141 int (*flush_callback_fn)(struct dm_target *ti),
142 unsigned argc, char **argv);
141void dm_dirty_log_destroy(struct dm_dirty_log *log); 143void dm_dirty_log_destroy(struct dm_dirty_log *log);
142 144
143#endif /* __KERNEL__ */ 145#endif /* __KERNEL__ */
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index 2ab84c83c31a..aa95508d2f95 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. 2 * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited.
3 * Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved. 3 * Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved.
4 * 4 *
5 * This file is released under the LGPL. 5 * This file is released under the LGPL.
6 */ 6 */
@@ -266,9 +266,9 @@ enum {
266#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 266#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
267 267
268#define DM_VERSION_MAJOR 4 268#define DM_VERSION_MAJOR 4
269#define DM_VERSION_MINOR 15 269#define DM_VERSION_MINOR 16
270#define DM_VERSION_PATCHLEVEL 0 270#define DM_VERSION_PATCHLEVEL 0
271#define DM_VERSION_EXTRA "-ioctl (2009-04-01)" 271#define DM_VERSION_EXTRA "-ioctl (2009-11-05)"
272 272
273/* Status bits */ 273/* Status bits */
274#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 274#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -309,4 +309,11 @@ enum {
309 */ 309 */
310#define DM_NOFLUSH_FLAG (1 << 11) /* In */ 310#define DM_NOFLUSH_FLAG (1 << 11) /* In */
311 311
312/*
313 * If set, any table information returned will relate to the inactive
314 * table instead of the live one. Always check DM_INACTIVE_PRESENT_FLAG
315 * is set before using the data returned.
316 */
317#define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */
318
312#endif /* _LINUX_DM_IOCTL_H */ 319#endif /* _LINUX_DM_IOCTL_H */
diff --git a/include/linux/dm-region-hash.h b/include/linux/dm-region-hash.h
index a9e652a41373..9e2a7a401df5 100644
--- a/include/linux/dm-region-hash.h
+++ b/include/linux/dm-region-hash.h
@@ -78,8 +78,7 @@ void dm_rh_dec(struct dm_region_hash *rh, region_t region);
78/* Delay bios on regions. */ 78/* Delay bios on regions. */
79void dm_rh_delay(struct dm_region_hash *rh, struct bio *bio); 79void dm_rh_delay(struct dm_region_hash *rh, struct bio *bio);
80 80
81void dm_rh_mark_nosync(struct dm_region_hash *rh, 81void dm_rh_mark_nosync(struct dm_region_hash *rh, struct bio *bio);
82 struct bio *bio, unsigned done, int error);
83 82
84/* 83/*
85 * Region recovery control. 84 * Region recovery control.
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 2b9f2ac7ed60..78784982b33e 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -74,7 +74,7 @@ enum dma_transaction_type {
74 * control completion, and communicate status. 74 * control completion, and communicate status.
75 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of 75 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of
76 * this transaction 76 * this transaction
77 * @DMA_CTRL_ACK - the descriptor cannot be reused until the client 77 * @DMA_CTRL_ACK - if clear, the descriptor cannot be reused until the client
78 * acknowledges receipt, i.e. has has a chance to establish any dependency 78 * acknowledges receipt, i.e. has has a chance to establish any dependency
79 * chains 79 * chains
80 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s) 80 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s)
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index a0d9422a1569..f8c2e1767500 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -57,8 +57,7 @@ extern int ddebug_remove_module(char *mod_name);
57 { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ 57 { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
58 DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ 58 DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
59 if (__dynamic_dbg_enabled(descriptor)) \ 59 if (__dynamic_dbg_enabled(descriptor)) \
60 printk(KERN_DEBUG KBUILD_MODNAME ":" pr_fmt(fmt), \ 60 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
61 ##__VA_ARGS__); \
62 } while (0) 61 } while (0)
63 62
64 63
@@ -69,9 +68,7 @@ extern int ddebug_remove_module(char *mod_name);
69 { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ 68 { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
70 DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ 69 DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
71 if (__dynamic_dbg_enabled(descriptor)) \ 70 if (__dynamic_dbg_enabled(descriptor)) \
72 dev_printk(KERN_DEBUG, dev, \ 71 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
73 KBUILD_MODNAME ": " fmt, \
74 ##__VA_ARGS__); \
75 } while (0) 72 } while (0)
76 73
77#else 74#else
@@ -81,8 +78,10 @@ static inline int ddebug_remove_module(char *mod)
81 return 0; 78 return 0;
82} 79}
83 80
84#define dynamic_pr_debug(fmt, ...) do { } while (0) 81#define dynamic_pr_debug(fmt, ...) \
85#define dynamic_dev_dbg(dev, format, ...) do { } while (0) 82 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
83#define dynamic_dev_dbg(dev, format, ...) \
84 do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0)
86#endif 85#endif
87 86
88#endif 87#endif
diff --git a/include/linux/efi.h b/include/linux/efi.h
index ce4581fbc08b..fb737bc19a8c 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -280,11 +280,7 @@ efi_guidcmp (efi_guid_t left, efi_guid_t right)
280static inline char * 280static inline char *
281efi_guid_unparse(efi_guid_t *guid, char *out) 281efi_guid_unparse(efi_guid_t *guid, char *out)
282{ 282{
283 sprintf(out, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", 283 sprintf(out, "%pUl", guid->b);
284 guid->b[3], guid->b[2], guid->b[1], guid->b[0],
285 guid->b[5], guid->b[4], guid->b[7], guid->b[6],
286 guid->b[8], guid->b[9], guid->b[10], guid->b[11],
287 guid->b[12], guid->b[13], guid->b[14], guid->b[15]);
288 return out; 284 return out;
289} 285}
290 286
diff --git a/include/linux/err.h b/include/linux/err.h
index ec87f3142bf3..1b12642636c7 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -34,6 +34,11 @@ static inline long IS_ERR(const void *ptr)
34 return IS_ERR_VALUE((unsigned long)ptr); 34 return IS_ERR_VALUE((unsigned long)ptr);
35} 35}
36 36
37static inline long IS_ERR_OR_NULL(const void *ptr)
38{
39 return !ptr || IS_ERR_VALUE((unsigned long)ptr);
40}
41
37/** 42/**
38 * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type 43 * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
39 * @ptr: The pointer to cast. 44 * @ptr: The pointer to cast.
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index 27e772cefb6a..dc12f416a49f 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -97,7 +97,7 @@ struct fid {
97 * @get_name: find the name for a given inode in a given directory 97 * @get_name: find the name for a given inode in a given directory
98 * @get_parent: find the parent of a given directory 98 * @get_parent: find the parent of a given directory
99 * 99 *
100 * See Documentation/filesystems/Exporting for details on how to use 100 * See Documentation/filesystems/nfs/Exporting for details on how to use
101 * this interface correctly. 101 * this interface correctly.
102 * 102 *
103 * encode_fh: 103 * encode_fh:
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a057f48eb156..b23a7018eb90 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2264,9 +2264,11 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2264 int lock_type); 2264 int lock_type);
2265 2265
2266enum { 2266enum {
2267 DIO_LOCKING = 1, /* need locking between buffered and direct access */ 2267 /* need locking between buffered and direct access */
2268 DIO_NO_LOCKING, /* bdev; no locking at all between buffered/direct */ 2268 DIO_LOCKING = 0x01,
2269 DIO_OWN_LOCKING, /* filesystem locks buffered and direct internally */ 2269
2270 /* filesystem does not support filling holes */
2271 DIO_SKIP_HOLES = 0x02,
2270}; 2272};
2271 2273
2272static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2274static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
@@ -2275,7 +2277,8 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2275 dio_iodone_t end_io) 2277 dio_iodone_t end_io)
2276{ 2278{
2277 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2279 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2278 nr_segs, get_block, end_io, DIO_LOCKING); 2280 nr_segs, get_block, end_io,
2281 DIO_LOCKING | DIO_SKIP_HOLES);
2279} 2282}
2280 2283
2281static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, 2284static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
@@ -2284,16 +2287,7 @@ static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2284 dio_iodone_t end_io) 2287 dio_iodone_t end_io)
2285{ 2288{
2286 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2289 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2287 nr_segs, get_block, end_io, DIO_NO_LOCKING); 2290 nr_segs, get_block, end_io, 0);
2288}
2289
2290static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb,
2291 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2292 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2293 dio_iodone_t end_io)
2294{
2295 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2296 nr_segs, get_block, end_io, DIO_OWN_LOCKING);
2297} 2291}
2298#endif 2292#endif
2299 2293
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 059bd189d35d..4e949a5b5b85 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -99,6 +99,12 @@ static inline int gpio_export_link(struct device *dev, const char *name,
99 return -EINVAL; 99 return -EINVAL;
100} 100}
101 101
102static inline int gpio_sysfs_set_active_low(unsigned gpio, int value)
103{
104 /* GPIO can never have been requested */
105 WARN_ON(1);
106 return -EINVAL;
107}
102 108
103static inline void gpio_unexport(unsigned gpio) 109static inline void gpio_unexport(unsigned gpio)
104{ 110{
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index af634e95871d..5d86fb2309d2 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -169,7 +169,7 @@ struct hrtimer_clock_base {
169 * @max_hang_time: Maximum time spent in hrtimer_interrupt 169 * @max_hang_time: Maximum time spent in hrtimer_interrupt
170 */ 170 */
171struct hrtimer_cpu_base { 171struct hrtimer_cpu_base {
172 spinlock_t lock; 172 raw_spinlock_t lock;
173 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; 173 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
174#ifdef CONFIG_HIGH_RES_TIMERS 174#ifdef CONFIG_HIGH_RES_TIMERS
175 ktime_t expires_next; 175 ktime_t expires_next;
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 41a59afc70fa..78b4bc64c006 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -23,6 +23,12 @@ void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
23int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 23int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
24int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 24int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
25int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 25int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
26
27#ifdef CONFIG_NUMA
28int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int,
29 void __user *, size_t *, loff_t *);
30#endif
31
26int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 32int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
27int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, 33int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,
28 struct page **, struct vm_area_struct **, 34 struct page **, struct vm_area_struct **,
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 419ab546b266..02fc617782ef 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -110,7 +110,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
110 * @driver: Device driver model driver 110 * @driver: Device driver model driver
111 * @id_table: List of I2C devices supported by this driver 111 * @id_table: List of I2C devices supported by this driver
112 * @detect: Callback for device detection 112 * @detect: Callback for device detection
113 * @address_data: The I2C addresses to probe (for detect) 113 * @address_list: The I2C addresses to probe (for detect)
114 * @clients: List of detected clients we created (for i2c-core use only) 114 * @clients: List of detected clients we created (for i2c-core use only)
115 * 115 *
116 * The driver.owner field should be set to the module owner of this driver. 116 * The driver.owner field should be set to the module owner of this driver.
@@ -161,8 +161,8 @@ struct i2c_driver {
161 const struct i2c_device_id *id_table; 161 const struct i2c_device_id *id_table;
162 162
163 /* Device detection callback for automatic device creation */ 163 /* Device detection callback for automatic device creation */
164 int (*detect)(struct i2c_client *, int kind, struct i2c_board_info *); 164 int (*detect)(struct i2c_client *, struct i2c_board_info *);
165 const struct i2c_client_address_data *address_data; 165 const unsigned short *address_list;
166 struct list_head clients; 166 struct list_head clients;
167}; 167};
168#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 168#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
@@ -391,14 +391,6 @@ static inline void i2c_unlock_adapter(struct i2c_adapter *adapter)
391#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ 391#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
392#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ 392#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */
393 393
394/* i2c_client_address_data is the struct for holding default client
395 * addresses for a driver and for the parameters supplied on the
396 * command line
397 */
398struct i2c_client_address_data {
399 const unsigned short *normal_i2c;
400};
401
402/* Internal numbers to terminate lists */ 394/* Internal numbers to terminate lists */
403#define I2C_CLIENT_END 0xfffeU 395#define I2C_CLIENT_END 0xfffeU
404 396
@@ -576,82 +568,4 @@ union i2c_smbus_data {
576#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ 568#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
577#define I2C_SMBUS_I2C_BLOCK_DATA 8 569#define I2C_SMBUS_I2C_BLOCK_DATA 8
578 570
579
580#ifdef __KERNEL__
581
582/* These defines are used for probing i2c client addresses */
583/* The length of the option lists */
584#define I2C_CLIENT_MAX_OPTS 48
585
586/* Default fill of many variables */
587#define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
588 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
589 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
590 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
591 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
592 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
593 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
594 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
595 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
596 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
597 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
598 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
599 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
600 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
601 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
602 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END}
603
604/* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the
605 module header */
606
607#define I2C_CLIENT_MODULE_PARM(var,desc) \
608 static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \
609 static unsigned int var##_num; \
610 module_param_array(var, short, &var##_num, 0); \
611 MODULE_PARM_DESC(var, desc)
612
613#define I2C_CLIENT_INSMOD_COMMON \
614static const struct i2c_client_address_data addr_data = { \
615 .normal_i2c = normal_i2c, \
616}
617
618/* These are the ones you want to use in your own drivers. Pick the one
619 which matches the number of devices the driver differenciates between. */
620#define I2C_CLIENT_INSMOD \
621I2C_CLIENT_INSMOD_COMMON
622
623#define I2C_CLIENT_INSMOD_1(chip1) \
624enum chips { any_chip, chip1 }; \
625I2C_CLIENT_INSMOD_COMMON
626
627#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
628enum chips { any_chip, chip1, chip2 }; \
629I2C_CLIENT_INSMOD_COMMON
630
631#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
632enum chips { any_chip, chip1, chip2, chip3 }; \
633I2C_CLIENT_INSMOD_COMMON
634
635#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
636enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
637I2C_CLIENT_INSMOD_COMMON
638
639#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
640enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
641I2C_CLIENT_INSMOD_COMMON
642
643#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
644enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
645I2C_CLIENT_INSMOD_COMMON
646
647#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
648enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
649 chip7 }; \
650I2C_CLIENT_INSMOD_COMMON
651
652#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
653enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
654 chip7, chip8 }; \
655I2C_CLIENT_INSMOD_COMMON
656#endif /* __KERNEL__ */
657#endif /* _LINUX_I2C_H */ 571#endif /* _LINUX_I2C_H */
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index 60c3360ef6ad..9bf6870ee5f4 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -39,6 +39,10 @@ void i8042_lock_chip(void);
39void i8042_unlock_chip(void); 39void i8042_unlock_chip(void);
40int i8042_command(unsigned char *param, int command); 40int i8042_command(unsigned char *param, int command);
41bool i8042_check_port_owner(const struct serio *); 41bool i8042_check_port_owner(const struct serio *);
42int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
43 struct serio *serio));
44int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
45 struct serio *serio));
42 46
43#else 47#else
44 48
@@ -52,7 +56,7 @@ void i8042_unlock_chip(void)
52 56
53int i8042_command(unsigned char *param, int command) 57int i8042_command(unsigned char *param, int command)
54{ 58{
55 return -ENOSYS; 59 return -ENODEV;
56} 60}
57 61
58bool i8042_check_port_owner(const struct serio *serio) 62bool i8042_check_port_owner(const struct serio *serio)
@@ -60,6 +64,18 @@ bool i8042_check_port_owner(const struct serio *serio)
60 return false; 64 return false;
61} 65}
62 66
67int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
68 struct serio *serio))
69{
70 return -ENODEV;
71}
72
73int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
74 struct serio *serio))
75{
76 return -ENODEV;
77}
78
63#endif 79#endif
64 80
65#endif 81#endif
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 8d10aa7fd4c9..5ed8b9c50355 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -111,6 +111,12 @@ extern struct cred init_cred;
111# define INIT_PERF_EVENTS(tsk) 111# define INIT_PERF_EVENTS(tsk)
112#endif 112#endif
113 113
114#ifdef CONFIG_FS_JOURNAL_INFO
115#define INIT_JOURNAL_INFO .journal_info = NULL,
116#else
117#define INIT_JOURNAL_INFO
118#endif
119
114/* 120/*
115 * INIT_TASK is used to set up the first task table, touch at 121 * INIT_TASK is used to set up the first task table, touch at
116 * your own risk!. Base=0, limit=0x1fffff (=2MB) 122 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -162,10 +168,9 @@ extern struct cred init_cred;
162 .signal = {{0}}}, \ 168 .signal = {{0}}}, \
163 .blocked = {{0}}, \ 169 .blocked = {{0}}, \
164 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \ 170 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
165 .journal_info = NULL, \
166 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ 171 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
167 .fs_excl = ATOMIC_INIT(0), \ 172 .fs_excl = ATOMIC_INIT(0), \
168 .pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ 173 .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
169 .timer_slack_ns = 50000, /* 50 usec default slack */ \ 174 .timer_slack_ns = 50000, /* 50 usec default slack */ \
170 .pids = { \ 175 .pids = { \
171 [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \ 176 [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \
@@ -173,6 +178,7 @@ extern struct cred init_cred;
173 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ 178 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
174 }, \ 179 }, \
175 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ 180 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
181 INIT_JOURNAL_INFO \
176 INIT_IDS \ 182 INIT_IDS \
177 INIT_PERF_EVENTS(tsk) \ 183 INIT_PERF_EVENTS(tsk) \
178 INIT_TRACE_IRQFLAGS \ 184 INIT_TRACE_IRQFLAGS \
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 4f0a72a9740c..9310c699a37d 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -332,6 +332,7 @@ struct intel_iommu {
332#ifdef CONFIG_INTR_REMAP 332#ifdef CONFIG_INTR_REMAP
333 struct ir_table *ir_table; /* Interrupt remapping info */ 333 struct ir_table *ir_table; /* Interrupt remapping info */
334#endif 334#endif
335 int node;
335}; 336};
336 337
337static inline void __iommu_flush_cache( 338static inline void __iommu_flush_cache(
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index 3b068e5b5671..64d1b638745d 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -14,14 +14,11 @@ static inline unsigned long iommu_device_max_index(unsigned long size,
14extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, 14extern int iommu_is_span_boundary(unsigned int index, unsigned int nr,
15 unsigned long shift, 15 unsigned long shift,
16 unsigned long boundary_size); 16 unsigned long boundary_size);
17extern void iommu_area_reserve(unsigned long *map, unsigned long i, int len);
18extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, 17extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
19 unsigned long start, unsigned int nr, 18 unsigned long start, unsigned int nr,
20 unsigned long shift, 19 unsigned long shift,
21 unsigned long boundary_size, 20 unsigned long boundary_size,
22 unsigned long align_mask); 21 unsigned long align_mask);
23extern void iommu_area_free(unsigned long *map, unsigned long start,
24 unsigned int nr);
25 22
26extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, 23extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len,
27 unsigned long io_page_size); 24 unsigned long io_page_size);
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 83aa81297ea3..7129504e053d 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -126,11 +126,11 @@ extern int allocate_resource(struct resource *root, struct resource *new,
126int adjust_resource(struct resource *res, resource_size_t start, 126int adjust_resource(struct resource *res, resource_size_t start,
127 resource_size_t size); 127 resource_size_t size);
128resource_size_t resource_alignment(struct resource *res); 128resource_size_t resource_alignment(struct resource *res);
129static inline resource_size_t resource_size(struct resource *res) 129static inline resource_size_t resource_size(const struct resource *res)
130{ 130{
131 return res->end - res->start + 1; 131 return res->end - res->start + 1;
132} 132}
133static inline unsigned long resource_type(struct resource *res) 133static inline unsigned long resource_type(const struct resource *res)
134{ 134{
135 return res->flags & IORESOURCE_TYPE_BITS; 135 return res->flags & IORESOURCE_TYPE_BITS;
136} 136}
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index e408722a84c7..07baa38bce37 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -87,7 +87,7 @@ extern int mq_init_ns(struct ipc_namespace *ns);
87/* default values */ 87/* default values */
88#define DFLT_QUEUESMAX 256 /* max number of message queues */ 88#define DFLT_QUEUESMAX 256 /* max number of message queues */
89#define DFLT_MSGMAX 10 /* max number of messages in each queue */ 89#define DFLT_MSGMAX 10 /* max number of messages in each queue */
90#define HARD_MSGMAX (131072/sizeof(void *)) 90#define HARD_MSGMAX (32768*sizeof(void *)/4)
91#define DFLT_MSGSIZEMAX 8192 /* max message size */ 91#define DFLT_MSGSIZEMAX 8192 /* max message size */
92#else 92#else
93static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; } 93static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
diff --git a/include/linux/irq.h b/include/linux/irq.h
index a287cfc0b1a6..451481c082b5 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -192,7 +192,7 @@ struct irq_desc {
192 unsigned int irq_count; /* For detecting broken IRQs */ 192 unsigned int irq_count; /* For detecting broken IRQs */
193 unsigned long last_unhandled; /* Aging timer for unhandled count */ 193 unsigned long last_unhandled; /* Aging timer for unhandled count */
194 unsigned int irqs_unhandled; 194 unsigned int irqs_unhandled;
195 spinlock_t lock; 195 raw_spinlock_t lock;
196#ifdef CONFIG_SMP 196#ifdef CONFIG_SMP
197 cpumask_var_t affinity; 197 cpumask_var_t affinity;
198 unsigned int node; 198 unsigned int node;
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 792274269f2b..d8e9b3d1c23c 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -107,18 +107,6 @@ static inline void print_symbol(const char *fmt, unsigned long addr)
107 __builtin_extract_return_addr((void *)addr)); 107 __builtin_extract_return_addr((void *)addr));
108} 108}
109 109
110/*
111 * Pretty-print a function pointer. This function is deprecated.
112 * Please use the "%pF" vsprintf format instead.
113 */
114static inline void __deprecated print_fn_descriptor_symbol(const char *fmt, void *addr)
115{
116#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
117 addr = *(void **)addr;
118#endif
119 print_symbol(fmt, (unsigned long)addr);
120}
121
122static inline void print_ip_sym(unsigned long ip) 110static inline void print_ip_sym(unsigned long ip)
123{ 111{
124 printk("[<%p>] %pS\n", (void *) ip, (void *) ip); 112 printk("[<%p>] %pS\n", (void *) ip, (void *) ip);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3fa4c590cf12..4d9c916d06d9 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -251,10 +251,10 @@ extern int printk_delay_msec;
251 * Print a one-time message (analogous to WARN_ONCE() et al): 251 * Print a one-time message (analogous to WARN_ONCE() et al):
252 */ 252 */
253#define printk_once(x...) ({ \ 253#define printk_once(x...) ({ \
254 static bool __print_once = true; \ 254 static bool __print_once; \
255 \ 255 \
256 if (__print_once) { \ 256 if (!__print_once) { \
257 __print_once = false; \ 257 __print_once = true; \
258 printk(x); \ 258 printk(x); \
259 } \ 259 } \
260}) 260})
@@ -397,15 +397,58 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
397 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 397 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
398#elif defined(CONFIG_DYNAMIC_DEBUG) 398#elif defined(CONFIG_DYNAMIC_DEBUG)
399/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ 399/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
400#define pr_debug(fmt, ...) do { \ 400#define pr_debug(fmt, ...) \
401 dynamic_pr_debug(fmt, ##__VA_ARGS__); \ 401 dynamic_pr_debug(fmt, ##__VA_ARGS__)
402 } while (0)
403#else 402#else
404#define pr_debug(fmt, ...) \ 403#define pr_debug(fmt, ...) \
405 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) 404 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
406#endif 405#endif
407 406
408/* 407/*
408 * ratelimited messages with local ratelimit_state,
409 * no local ratelimit_state used in the !PRINTK case
410 */
411#ifdef CONFIG_PRINTK
412#define printk_ratelimited(fmt, ...) ({ \
413 static struct ratelimit_state _rs = { \
414 .interval = DEFAULT_RATELIMIT_INTERVAL, \
415 .burst = DEFAULT_RATELIMIT_BURST, \
416 }; \
417 \
418 if (!__ratelimit(&_rs)) \
419 printk(fmt, ##__VA_ARGS__); \
420})
421#else
422/* No effect, but we still get type checking even in the !PRINTK case: */
423#define printk_ratelimited printk
424#endif
425
426#define pr_emerg_ratelimited(fmt, ...) \
427 printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
428#define pr_alert_ratelimited(fmt, ...) \
429 printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
430#define pr_crit_ratelimited(fmt, ...) \
431 printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
432#define pr_err_ratelimited(fmt, ...) \
433 printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
434#define pr_warning_ratelimited(fmt, ...) \
435 printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
436#define pr_notice_ratelimited(fmt, ...) \
437 printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
438#define pr_info_ratelimited(fmt, ...) \
439 printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
440/* no pr_cont_ratelimited, don't do that... */
441/* If you are writing a driver, please use dev_dbg instead */
442#if defined(DEBUG)
443#define pr_debug_ratelimited(fmt, ...) \
444 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
445#else
446#define pr_debug_ratelimited(fmt, ...) \
447 ({ if (0) printk_ratelimited(KERN_DEBUG pr_fmt(fmt), \
448 ##__VA_ARGS__); 0; })
449#endif
450
451/*
409 * General tracing related utility functions - trace_printk(), 452 * General tracing related utility functions - trace_printk(),
410 * tracing_on/tracing_off and tracing_start()/tracing_stop 453 * tracing_on/tracing_off and tracing_start()/tracing_stop
411 * 454 *
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index adc34f2c6eff..c356b6914ffd 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -206,6 +206,8 @@ extern size_t vmcoreinfo_max_size;
206 206
207int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, 207int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
208 unsigned long long *crash_size, unsigned long long *crash_base); 208 unsigned long long *crash_size, unsigned long long *crash_base);
209int crash_shrink_memory(unsigned long new_size);
210size_t crash_get_memory_size(void);
209 211
210#else /* !CONFIG_KEXEC */ 212#else /* !CONFIG_KEXEC */
211struct pt_regs; 213struct pt_regs;
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
new file mode 100644
index 000000000000..e32aa268efac
--- /dev/null
+++ b/include/linux/kmsg_dump.h
@@ -0,0 +1,60 @@
1/*
2 * linux/include/kmsg_dump.h
3 *
4 * Copyright (C) 2009 Net Insight AB
5 *
6 * Author: Simon Kagstrom <simon.kagstrom@netinsight.net>
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive
10 * for more details.
11 */
12#ifndef _LINUX_KMSG_DUMP_H
13#define _LINUX_KMSG_DUMP_H
14
15#include <linux/list.h>
16
17enum kmsg_dump_reason {
18 KMSG_DUMP_OOPS,
19 KMSG_DUMP_PANIC,
20};
21
22/**
23 * struct kmsg_dumper - kernel crash message dumper structure
24 * @dump: The callback which gets called on crashes. The buffer is passed
25 * as two sections, where s1 (length l1) contains the older
26 * messages and s2 (length l2) contains the newer.
27 * @list: Entry in the dumper list (private)
28 * @registered: Flag that specifies if this is already registered
29 */
30struct kmsg_dumper {
31 void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason,
32 const char *s1, unsigned long l1,
33 const char *s2, unsigned long l2);
34 struct list_head list;
35 int registered;
36};
37
38#ifdef CONFIG_PRINTK
39void kmsg_dump(enum kmsg_dump_reason reason);
40
41int kmsg_dump_register(struct kmsg_dumper *dumper);
42
43int kmsg_dump_unregister(struct kmsg_dumper *dumper);
44#else
45static inline void kmsg_dump(enum kmsg_dump_reason reason)
46{
47}
48
49static inline int kmsg_dump_register(struct kmsg_dumper *dumper)
50{
51 return -EINVAL;
52}
53
54static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper)
55{
56 return -EINVAL;
57}
58#endif
59
60#endif /* _LINUX_KMSG_DUMP_H */
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index a485c14ecd5d..43bdab769fc3 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -9,8 +9,12 @@
9 9
10#include <linux/bitops.h> 10#include <linux/bitops.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/pagemap.h>
13#include <linux/rmap.h>
12#include <linux/sched.h> 14#include <linux/sched.h>
13#include <linux/vmstat.h> 15
16struct stable_node;
17struct mem_cgroup;
14 18
15#ifdef CONFIG_KSM 19#ifdef CONFIG_KSM
16int ksm_madvise(struct vm_area_struct *vma, unsigned long start, 20int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
@@ -34,46 +38,110 @@ static inline void ksm_exit(struct mm_struct *mm)
34/* 38/*
35 * A KSM page is one of those write-protected "shared pages" or "merged pages" 39 * A KSM page is one of those write-protected "shared pages" or "merged pages"
36 * which KSM maps into multiple mms, wherever identical anonymous page content 40 * which KSM maps into multiple mms, wherever identical anonymous page content
37 * is found in VM_MERGEABLE vmas. It's a PageAnon page, with NULL anon_vma. 41 * is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any
42 * anon_vma, but to that page's node of the stable tree.
38 */ 43 */
39static inline int PageKsm(struct page *page) 44static inline int PageKsm(struct page *page)
40{ 45{
41 return ((unsigned long)page->mapping == PAGE_MAPPING_ANON); 46 return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
47 (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
48}
49
50static inline struct stable_node *page_stable_node(struct page *page)
51{
52 return PageKsm(page) ? page_rmapping(page) : NULL;
53}
54
55static inline void set_page_stable_node(struct page *page,
56 struct stable_node *stable_node)
57{
58 page->mapping = (void *)stable_node +
59 (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
42} 60}
43 61
44/* 62/*
45 * But we have to avoid the checking which page_add_anon_rmap() performs. 63 * When do_swap_page() first faults in from swap what used to be a KSM page,
64 * no problem, it will be assigned to this vma's anon_vma; but thereafter,
65 * it might be faulted into a different anon_vma (or perhaps to a different
66 * offset in the same anon_vma). do_swap_page() cannot do all the locking
67 * needed to reconstitute a cross-anon_vma KSM page: for now it has to make
68 * a copy, and leave remerging the pages to a later pass of ksmd.
69 *
70 * We'd like to make this conditional on vma->vm_flags & VM_MERGEABLE,
71 * but what if the vma was unmerged while the page was swapped out?
46 */ 72 */
47static inline void page_add_ksm_rmap(struct page *page) 73struct page *ksm_does_need_to_copy(struct page *page,
74 struct vm_area_struct *vma, unsigned long address);
75static inline struct page *ksm_might_need_to_copy(struct page *page,
76 struct vm_area_struct *vma, unsigned long address)
48{ 77{
49 if (atomic_inc_and_test(&page->_mapcount)) { 78 struct anon_vma *anon_vma = page_anon_vma(page);
50 page->mapping = (void *) PAGE_MAPPING_ANON; 79
51 __inc_zone_page_state(page, NR_ANON_PAGES); 80 if (!anon_vma ||
52 } 81 (anon_vma == vma->anon_vma &&
82 page->index == linear_page_index(vma, address)))
83 return page;
84
85 return ksm_does_need_to_copy(page, vma, address);
53} 86}
87
88int page_referenced_ksm(struct page *page,
89 struct mem_cgroup *memcg, unsigned long *vm_flags);
90int try_to_unmap_ksm(struct page *page, enum ttu_flags flags);
91int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page *,
92 struct vm_area_struct *, unsigned long, void *), void *arg);
93void ksm_migrate_page(struct page *newpage, struct page *oldpage);
94
54#else /* !CONFIG_KSM */ 95#else /* !CONFIG_KSM */
55 96
97static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
98{
99 return 0;
100}
101
102static inline void ksm_exit(struct mm_struct *mm)
103{
104}
105
106static inline int PageKsm(struct page *page)
107{
108 return 0;
109}
110
111#ifdef CONFIG_MMU
56static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start, 112static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
57 unsigned long end, int advice, unsigned long *vm_flags) 113 unsigned long end, int advice, unsigned long *vm_flags)
58{ 114{
59 return 0; 115 return 0;
60} 116}
61 117
62static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) 118static inline struct page *ksm_might_need_to_copy(struct page *page,
119 struct vm_area_struct *vma, unsigned long address)
120{
121 return page;
122}
123
124static inline int page_referenced_ksm(struct page *page,
125 struct mem_cgroup *memcg, unsigned long *vm_flags)
63{ 126{
64 return 0; 127 return 0;
65} 128}
66 129
67static inline void ksm_exit(struct mm_struct *mm) 130static inline int try_to_unmap_ksm(struct page *page, enum ttu_flags flags)
68{ 131{
132 return 0;
69} 133}
70 134
71static inline int PageKsm(struct page *page) 135static inline int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page*,
136 struct vm_area_struct *, unsigned long, void *), void *arg)
72{ 137{
73 return 0; 138 return 0;
74} 139}
75 140
76/* No stub required for page_add_ksm_rmap(page) */ 141static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage)
142{
143}
144#endif /* CONFIG_MMU */
77#endif /* !CONFIG_KSM */ 145#endif /* !CONFIG_KSM */
78 146
79#endif 147#endif /* __LINUX_KSM_H */
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h
index 3cc2f2c53e4c..f1ca0dcc1628 100644
--- a/include/linux/lis3lv02d.h
+++ b/include/linux/lis3lv02d.h
@@ -43,6 +43,21 @@ struct lis3lv02d_platform_data {
43#define LIS3_WAKEUP_Z_HI (1 << 5) 43#define LIS3_WAKEUP_Z_HI (1 << 5)
44 unsigned char wakeup_flags; 44 unsigned char wakeup_flags;
45 unsigned char wakeup_thresh; 45 unsigned char wakeup_thresh;
46#define LIS3_NO_MAP 0
47#define LIS3_DEV_X 1
48#define LIS3_DEV_Y 2
49#define LIS3_DEV_Z 3
50#define LIS3_INV_DEV_X -1
51#define LIS3_INV_DEV_Y -2
52#define LIS3_INV_DEV_Z -3
53 s8 axis_x;
54 s8 axis_y;
55 s8 axis_z;
56 int (*setup_resources)(void);
57 int (*release_resources)(void);
58 /* Limits for selftest are specified in chip data sheet */
59 s16 st_min_limits[3]; /* min pass limit x, y, z */
60 s16 st_max_limits[3]; /* max pass limit x, y, z */
46}; 61};
47 62
48#endif /* __LIS3LV02D_H_ */ 63#endif /* __LIS3LV02D_H_ */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index bf9213b2db8f..0b46c2068b96 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -54,6 +54,11 @@ extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru);
54extern void mem_cgroup_del_lru(struct page *page); 54extern void mem_cgroup_del_lru(struct page *page);
55extern void mem_cgroup_move_lists(struct page *page, 55extern void mem_cgroup_move_lists(struct page *page,
56 enum lru_list from, enum lru_list to); 56 enum lru_list from, enum lru_list to);
57
58/* For coalescing uncharge for reducing memcg' overhead*/
59extern void mem_cgroup_uncharge_start(void);
60extern void mem_cgroup_uncharge_end(void);
61
57extern void mem_cgroup_uncharge_page(struct page *page); 62extern void mem_cgroup_uncharge_page(struct page *page);
58extern void mem_cgroup_uncharge_cache_page(struct page *page); 63extern void mem_cgroup_uncharge_cache_page(struct page *page);
59extern int mem_cgroup_shmem_charge_fallback(struct page *page, 64extern int mem_cgroup_shmem_charge_fallback(struct page *page,
@@ -117,7 +122,7 @@ static inline bool mem_cgroup_disabled(void)
117} 122}
118 123
119extern bool mem_cgroup_oom_called(struct task_struct *task); 124extern bool mem_cgroup_oom_called(struct task_struct *task);
120void mem_cgroup_update_mapped_file_stat(struct page *page, int val); 125void mem_cgroup_update_file_mapped(struct page *page, int val);
121unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 126unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
122 gfp_t gfp_mask, int nid, 127 gfp_t gfp_mask, int nid,
123 int zid); 128 int zid);
@@ -151,6 +156,14 @@ static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr)
151{ 156{
152} 157}
153 158
159static inline void mem_cgroup_uncharge_start(void)
160{
161}
162
163static inline void mem_cgroup_uncharge_end(void)
164{
165}
166
154static inline void mem_cgroup_uncharge_page(struct page *page) 167static inline void mem_cgroup_uncharge_page(struct page *page)
155{ 168{
156} 169}
@@ -274,7 +287,7 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
274{ 287{
275} 288}
276 289
277static inline void mem_cgroup_update_mapped_file_stat(struct page *page, 290static inline void mem_cgroup_update_file_mapped(struct page *page,
278 int val) 291 int val)
279{ 292{
280} 293}
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index fed969281a41..35b07b773e6c 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -69,7 +69,6 @@ extern void online_page(struct page *page);
69/* VM interface that may be used by firmware interface */ 69/* VM interface that may be used by firmware interface */
70extern int online_pages(unsigned long, unsigned long); 70extern int online_pages(unsigned long, unsigned long);
71extern void __offline_isolated_pages(unsigned long, unsigned long); 71extern void __offline_isolated_pages(unsigned long, unsigned long);
72extern int offline_pages(unsigned long, unsigned long, unsigned long);
73 72
74/* reasonably generic interface to expand the physical pages in a zone */ 73/* reasonably generic interface to expand the physical pages in a zone */
75extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn, 74extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn,
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 085c903fe0f1..1cc966cd3e5f 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -201,6 +201,7 @@ extern void mpol_fix_fork_child_flag(struct task_struct *p);
201extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 201extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
202 unsigned long addr, gfp_t gfp_flags, 202 unsigned long addr, gfp_t gfp_flags,
203 struct mempolicy **mpol, nodemask_t **nodemask); 203 struct mempolicy **mpol, nodemask_t **nodemask);
204extern bool init_nodemask_of_mempolicy(nodemask_t *mask);
204extern unsigned slab_node(struct mempolicy *policy); 205extern unsigned slab_node(struct mempolicy *policy);
205 206
206extern enum zone_type policy_zone; 207extern enum zone_type policy_zone;
@@ -328,6 +329,8 @@ static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
328 return node_zonelist(0, gfp_flags); 329 return node_zonelist(0, gfp_flags);
329} 330}
330 331
332static inline bool init_nodemask_of_mempolicy(nodemask_t *m) { return false; }
333
331static inline int do_migrate_pages(struct mm_struct *mm, 334static inline int do_migrate_pages(struct mm_struct *mm,
332 const nodemask_t *from_nodes, 335 const nodemask_t *from_nodes,
333 const nodemask_t *to_nodes, int flags) 336 const nodemask_t *to_nodes, int flags)
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index d9034cc87f18..3398bd9aab11 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -29,7 +29,12 @@ struct pcf50633_platform_data {
29 char **batteries; 29 char **batteries;
30 int num_batteries; 30 int num_batteries;
31 31
32 int charging_restart_interval; 32 /*
33 * Should be set accordingly to the reference resistor used, see
34 * I_{ch(ref)} charger reference current in the pcf50633 User
35 * Manual.
36 */
37 int charger_reference_current_ma;
33 38
34 /* Callbacks */ 39 /* Callbacks */
35 void (*probe_done)(struct pcf50633 *); 40 void (*probe_done)(struct pcf50633 *);
diff --git a/include/linux/mfd/pcf50633/mbc.h b/include/linux/mfd/pcf50633/mbc.h
index 4119579acf2c..df4f5fa88de3 100644
--- a/include/linux/mfd/pcf50633/mbc.h
+++ b/include/linux/mfd/pcf50633/mbc.h
@@ -128,6 +128,7 @@ enum pcf50633_reg_mbcs3 {
128int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma); 128int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma);
129 129
130int pcf50633_mbc_get_status(struct pcf50633 *); 130int pcf50633_mbc_get_status(struct pcf50633 *);
131int pcf50633_mbc_get_usb_online_status(struct pcf50633 *);
131 132
132#endif 133#endif
133 134
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 527602cdea1c..7f085c97c799 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -12,7 +12,8 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **);
12extern int putback_lru_pages(struct list_head *l); 12extern int putback_lru_pages(struct list_head *l);
13extern int migrate_page(struct address_space *, 13extern int migrate_page(struct address_space *,
14 struct page *, struct page *); 14 struct page *, struct page *);
15extern int migrate_pages(struct list_head *l, new_page_t x, unsigned long); 15extern int migrate_pages(struct list_head *l, new_page_t x,
16 unsigned long private, int offlining);
16 17
17extern int fail_migrate_page(struct address_space *, 18extern int fail_migrate_page(struct address_space *,
18 struct page *, struct page *); 19 struct page *, struct page *);
@@ -26,10 +27,7 @@ extern int migrate_vmas(struct mm_struct *mm,
26 27
27static inline int putback_lru_pages(struct list_head *l) { return 0; } 28static inline int putback_lru_pages(struct list_head *l) { return 0; }
28static inline int migrate_pages(struct list_head *l, new_page_t x, 29static inline int migrate_pages(struct list_head *l, new_page_t x,
29 unsigned long private) { return -ENOSYS; } 30 unsigned long private, int offlining) { return -ENOSYS; }
30
31static inline int migrate_pages_to(struct list_head *pagelist,
32 struct vm_area_struct *vma, int dest) { return 0; }
33 31
34static inline int migrate_prep(void) { return -ENOSYS; } 32static inline int migrate_prep(void) { return -ENOSYS; }
35 33
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index ce7cc6c7bcbb..e92d1bfdb330 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -61,6 +61,7 @@ enum {
61 MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8, 61 MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8,
62 MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9, 62 MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9,
63 MLX4_DEV_CAP_FLAG_DPDP = 1 << 12, 63 MLX4_DEV_CAP_FLAG_DPDP = 1 << 12,
64 MLX4_DEV_CAP_FLAG_BLH = 1 << 15,
64 MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16, 65 MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16,
65 MLX4_DEV_CAP_FLAG_APM = 1 << 17, 66 MLX4_DEV_CAP_FLAG_APM = 1 << 17,
66 MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, 67 MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 24c395694f4d..9d65ae4ba0e0 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -620,13 +620,22 @@ void page_address_init(void);
620/* 620/*
621 * On an anonymous page mapped into a user virtual memory area, 621 * On an anonymous page mapped into a user virtual memory area,
622 * page->mapping points to its anon_vma, not to a struct address_space; 622 * page->mapping points to its anon_vma, not to a struct address_space;
623 * with the PAGE_MAPPING_ANON bit set to distinguish it. 623 * with the PAGE_MAPPING_ANON bit set to distinguish it. See rmap.h.
624 *
625 * On an anonymous page in a VM_MERGEABLE area, if CONFIG_KSM is enabled,
626 * the PAGE_MAPPING_KSM bit may be set along with the PAGE_MAPPING_ANON bit;
627 * and then page->mapping points, not to an anon_vma, but to a private
628 * structure which KSM associates with that merged page. See ksm.h.
629 *
630 * PAGE_MAPPING_KSM without PAGE_MAPPING_ANON is currently never used.
624 * 631 *
625 * Please note that, confusingly, "page_mapping" refers to the inode 632 * Please note that, confusingly, "page_mapping" refers to the inode
626 * address_space which maps the page from disk; whereas "page_mapped" 633 * address_space which maps the page from disk; whereas "page_mapped"
627 * refers to user virtual address space into which the page is mapped. 634 * refers to user virtual address space into which the page is mapped.
628 */ 635 */
629#define PAGE_MAPPING_ANON 1 636#define PAGE_MAPPING_ANON 1
637#define PAGE_MAPPING_KSM 2
638#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM)
630 639
631extern struct address_space swapper_space; 640extern struct address_space swapper_space;
632static inline struct address_space *page_mapping(struct page *page) 641static inline struct address_space *page_mapping(struct page *page)
@@ -634,16 +643,19 @@ static inline struct address_space *page_mapping(struct page *page)
634 struct address_space *mapping = page->mapping; 643 struct address_space *mapping = page->mapping;
635 644
636 VM_BUG_ON(PageSlab(page)); 645 VM_BUG_ON(PageSlab(page));
637#ifdef CONFIG_SWAP
638 if (unlikely(PageSwapCache(page))) 646 if (unlikely(PageSwapCache(page)))
639 mapping = &swapper_space; 647 mapping = &swapper_space;
640 else 648 else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
641#endif
642 if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
643 mapping = NULL; 649 mapping = NULL;
644 return mapping; 650 return mapping;
645} 651}
646 652
653/* Neutral page->mapping pointer to address_space or anon_vma or other */
654static inline void *page_rmapping(struct page *page)
655{
656 return (void *)((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS);
657}
658
647static inline int PageAnon(struct page *page) 659static inline int PageAnon(struct page *page)
648{ 660{
649 return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; 661 return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
@@ -758,6 +770,7 @@ unsigned long unmap_vmas(struct mmu_gather **tlb,
758 * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry 770 * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry
759 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry 771 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry
760 * @pte_hole: if set, called for each hole at all levels 772 * @pte_hole: if set, called for each hole at all levels
773 * @hugetlb_entry: if set, called for each hugetlb entry
761 * 774 *
762 * (see walk_page_range for more details) 775 * (see walk_page_range for more details)
763 */ 776 */
@@ -767,6 +780,8 @@ struct mm_walk {
767 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *); 780 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *);
768 int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *); 781 int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *);
769 int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *); 782 int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *);
783 int (*hugetlb_entry)(pte_t *, unsigned long, unsigned long,
784 struct mm_walk *);
770 struct mm_struct *mm; 785 struct mm_struct *mm;
771 void *private; 786 void *private;
772}; 787};
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index fff8c53e5434..9c3757c5759d 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -19,22 +19,21 @@
19 19
20/** 20/**
21 * struct nand_bbt_descr - bad block table descriptor 21 * struct nand_bbt_descr - bad block table descriptor
22 * @options: options for this descriptor 22 * @options: options for this descriptor
23 * @pages: the page(s) where we find the bbt, used with 23 * @pages: the page(s) where we find the bbt, used with option BBT_ABSPAGE
24 * option BBT_ABSPAGE when bbt is searched, 24 * when bbt is searched, then we store the found bbts pages here.
25 * then we store the found bbts pages here. 25 * Its an array and supports up to 8 chips now
26 * Its an array and supports up to 8 chips now 26 * @offs: offset of the pattern in the oob area of the page
27 * @offs: offset of the pattern in the oob area of the page 27 * @veroffs: offset of the bbt version counter in the oob are of the page
28 * @veroffs: offset of the bbt version counter in the oob area of the page 28 * @version: version read from the bbt page during scan
29 * @version: version read from the bbt page during scan 29 * @len: length of the pattern, if 0 no pattern check is performed
30 * @len: length of the pattern, if 0 no pattern check is performed 30 * @maxblocks: maximum number of blocks to search for a bbt. This number of
31 * @maxblocks: maximum number of blocks to search for a bbt. This 31 * blocks is reserved at the end of the device where the tables are
32 * number of blocks is reserved at the end of the device 32 * written.
33 * where the tables are written. 33 * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than
34 * @reserved_block_code: if non-0, this pattern denotes a reserved 34 * bad) block in the stored bbt
35 * (rather than bad) block in the stored bbt 35 * @pattern: pattern to identify bad block table or factory marked good /
36 * @pattern: pattern to identify bad block table or factory marked 36 * bad blocks, can be NULL, if len = 0
37 * good / bad blocks, can be NULL, if len = 0
38 * 37 *
39 * Descriptor for the bad block table marker and the descriptor for the 38 * Descriptor for the bad block table marker and the descriptor for the
40 * pattern which identifies good and bad blocks. The assumption is made 39 * pattern which identifies good and bad blocks. The assumption is made
@@ -90,7 +89,9 @@ struct nand_bbt_descr {
90/* 89/*
91 * Constants for oob configuration 90 * Constants for oob configuration
92 */ 91 */
93#define ONENAND_BADBLOCK_POS 0 92#define NAND_SMALL_BADBLOCK_POS 5
93#define NAND_LARGE_BADBLOCK_POS 0
94#define ONENAND_BADBLOCK_POS 0
94 95
95/* 96/*
96 * Bad block scanning errors 97 * Bad block scanning errors
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 88d3d8fbf9f2..df89f4275232 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -518,10 +518,11 @@ struct cfi_fixup {
518#define CFI_MFR_ANY 0xffff 518#define CFI_MFR_ANY 0xffff
519#define CFI_ID_ANY 0xffff 519#define CFI_ID_ANY 0xffff
520 520
521#define CFI_MFR_AMD 0x0001 521#define CFI_MFR_AMD 0x0001
522#define CFI_MFR_ATMEL 0x001F 522#define CFI_MFR_INTEL 0x0089
523#define CFI_MFR_SAMSUNG 0x00EC 523#define CFI_MFR_ATMEL 0x001F
524#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ 524#define CFI_MFR_SAMSUNG 0x00EC
525#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
525 526
526void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); 527void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
527 528
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index d4f38c5fd44e..d0bf422ae374 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -38,6 +38,15 @@ typedef enum {
38 FL_XIP_WHILE_ERASING, 38 FL_XIP_WHILE_ERASING,
39 FL_XIP_WHILE_WRITING, 39 FL_XIP_WHILE_WRITING,
40 FL_SHUTDOWN, 40 FL_SHUTDOWN,
41 /* These 2 come from nand_state_t, which has been unified here */
42 FL_READING,
43 FL_CACHEDPRG,
44 /* These 4 come from onenand_state_t, which has been unified here */
45 FL_RESETING,
46 FL_OTPING,
47 FL_PREPARING_ERASE,
48 FL_VERIFYING_ERASE,
49
41 FL_UNKNOWN 50 FL_UNKNOWN
42} flstate_t; 51} flstate_t;
43 52
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 7a232a9bdd62..ccab9dfc5217 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -21,6 +21,8 @@
21#include <linux/wait.h> 21#include <linux/wait.h>
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/mtd/mtd.h> 23#include <linux/mtd/mtd.h>
24#include <linux/mtd/flashchip.h>
25#include <linux/mtd/bbm.h>
24 26
25struct mtd_info; 27struct mtd_info;
26/* Scan and identify a NAND device */ 28/* Scan and identify a NAND device */
@@ -168,7 +170,6 @@ typedef enum {
168/* Chip does not allow subpage writes */ 170/* Chip does not allow subpage writes */
169#define NAND_NO_SUBPAGE_WRITE 0x00000200 171#define NAND_NO_SUBPAGE_WRITE 0x00000200
170 172
171
172/* Options valid for Samsung large page devices */ 173/* Options valid for Samsung large page devices */
173#define NAND_SAMSUNG_LP_OPTIONS \ 174#define NAND_SAMSUNG_LP_OPTIONS \
174 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) 175 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK)
@@ -194,6 +195,9 @@ typedef enum {
194/* This option is defined if the board driver allocates its own buffers 195/* This option is defined if the board driver allocates its own buffers
195 (e.g. because it needs them DMA-coherent */ 196 (e.g. because it needs them DMA-coherent */
196#define NAND_OWN_BUFFERS 0x00040000 197#define NAND_OWN_BUFFERS 0x00040000
198/* Chip may not exist, so silence any errors in scan */
199#define NAND_SCAN_SILENT_NODEV 0x00080000
200
197/* Options set by nand scan */ 201/* Options set by nand scan */
198/* Nand scan has allocated controller struct */ 202/* Nand scan has allocated controller struct */
199#define NAND_CONTROLLER_ALLOC 0x80000000 203#define NAND_CONTROLLER_ALLOC 0x80000000
@@ -202,20 +206,6 @@ typedef enum {
202#define NAND_CI_CHIPNR_MSK 0x03 206#define NAND_CI_CHIPNR_MSK 0x03
203#define NAND_CI_CELLTYPE_MSK 0x0C 207#define NAND_CI_CELLTYPE_MSK 0x0C
204 208
205/*
206 * nand_state_t - chip states
207 * Enumeration for NAND flash chip state
208 */
209typedef enum {
210 FL_READY,
211 FL_READING,
212 FL_WRITING,
213 FL_ERASING,
214 FL_SYNCING,
215 FL_CACHEDPRG,
216 FL_PM_SUSPENDED,
217} nand_state_t;
218
219/* Keep gcc happy */ 209/* Keep gcc happy */
220struct nand_chip; 210struct nand_chip;
221 211
@@ -402,7 +392,7 @@ struct nand_chip {
402 uint8_t cellinfo; 392 uint8_t cellinfo;
403 int badblockpos; 393 int badblockpos;
404 394
405 nand_state_t state; 395 flstate_t state;
406 396
407 uint8_t *oob_poi; 397 uint8_t *oob_poi;
408 struct nand_hw_control *controller; 398 struct nand_hw_control *controller;
@@ -470,75 +460,6 @@ struct nand_manufacturers {
470extern struct nand_flash_dev nand_flash_ids[]; 460extern struct nand_flash_dev nand_flash_ids[];
471extern struct nand_manufacturers nand_manuf_ids[]; 461extern struct nand_manufacturers nand_manuf_ids[];
472 462
473/**
474 * struct nand_bbt_descr - bad block table descriptor
475 * @options: options for this descriptor
476 * @pages: the page(s) where we find the bbt, used with option BBT_ABSPAGE
477 * when bbt is searched, then we store the found bbts pages here.
478 * Its an array and supports up to 8 chips now
479 * @offs: offset of the pattern in the oob area of the page
480 * @veroffs: offset of the bbt version counter in the oob are of the page
481 * @version: version read from the bbt page during scan
482 * @len: length of the pattern, if 0 no pattern check is performed
483 * @maxblocks: maximum number of blocks to search for a bbt. This number of
484 * blocks is reserved at the end of the device where the tables are
485 * written.
486 * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than
487 * bad) block in the stored bbt
488 * @pattern: pattern to identify bad block table or factory marked good /
489 * bad blocks, can be NULL, if len = 0
490 *
491 * Descriptor for the bad block table marker and the descriptor for the
492 * pattern which identifies good and bad blocks. The assumption is made
493 * that the pattern and the version count are always located in the oob area
494 * of the first block.
495 */
496struct nand_bbt_descr {
497 int options;
498 int pages[NAND_MAX_CHIPS];
499 int offs;
500 int veroffs;
501 uint8_t version[NAND_MAX_CHIPS];
502 int len;
503 int maxblocks;
504 int reserved_block_code;
505 uint8_t *pattern;
506};
507
508/* Options for the bad block table descriptors */
509
510/* The number of bits used per block in the bbt on the device */
511#define NAND_BBT_NRBITS_MSK 0x0000000F
512#define NAND_BBT_1BIT 0x00000001
513#define NAND_BBT_2BIT 0x00000002
514#define NAND_BBT_4BIT 0x00000004
515#define NAND_BBT_8BIT 0x00000008
516/* The bad block table is in the last good block of the device */
517#define NAND_BBT_LASTBLOCK 0x00000010
518/* The bbt is at the given page, else we must scan for the bbt */
519#define NAND_BBT_ABSPAGE 0x00000020
520/* The bbt is at the given page, else we must scan for the bbt */
521#define NAND_BBT_SEARCH 0x00000040
522/* bbt is stored per chip on multichip devices */
523#define NAND_BBT_PERCHIP 0x00000080
524/* bbt has a version counter at offset veroffs */
525#define NAND_BBT_VERSION 0x00000100
526/* Create a bbt if none axists */
527#define NAND_BBT_CREATE 0x00000200
528/* Search good / bad pattern through all pages of a block */
529#define NAND_BBT_SCANALLPAGES 0x00000400
530/* Scan block empty during good / bad block scan */
531#define NAND_BBT_SCANEMPTY 0x00000800
532/* Write bbt if neccecary */
533#define NAND_BBT_WRITE 0x00001000
534/* Read and write back block contents when writing bbt */
535#define NAND_BBT_SAVECONTENT 0x00002000
536/* Search good / bad pattern on the first and the second page */
537#define NAND_BBT_SCAN2NDPAGE 0x00004000
538
539/* The maximum number of blocks to scan for a bbt */
540#define NAND_BBT_SCAN_MAXBLOCKS 4
541
542extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); 463extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd);
543extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs); 464extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs);
544extern int nand_default_bbt(struct mtd_info *mtd); 465extern int nand_default_bbt(struct mtd_info *mtd);
@@ -548,12 +469,6 @@ extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
548extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, 469extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
549 size_t * retlen, uint8_t * buf); 470 size_t * retlen, uint8_t * buf);
550 471
551/*
552* Constants for oob configuration
553*/
554#define NAND_SMALL_BADBLOCK_POS 5
555#define NAND_LARGE_BADBLOCK_POS 0
556
557/** 472/**
558 * struct platform_nand_chip - chip level device structure 473 * struct platform_nand_chip - chip level device structure
559 * @nr_chips: max. number of chips to scan for 474 * @nr_chips: max. number of chips to scan for
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 052ea8ca2434..41bc013571d0 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -16,7 +16,13 @@
16struct mtd_info; 16struct mtd_info;
17 17
18/* 18/*
19 * Calculate 3 byte ECC code for 256 byte block 19 * Calculate 3 byte ECC code for eccsize byte block
20 */
21void __nand_calculate_ecc(const u_char *dat, unsigned int eccsize,
22 u_char *ecc_code);
23
24/*
25 * Calculate 3 byte ECC code for 256/512 byte block
20 */ 26 */
21int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code); 27int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code);
22 28
@@ -27,7 +33,7 @@ int __nand_correct_data(u_char *dat, u_char *read_ecc, u_char *calc_ecc,
27 unsigned int eccsize); 33 unsigned int eccsize);
28 34
29/* 35/*
30 * Detect and correct a 1 bit error for 256 byte block 36 * Detect and correct a 1 bit error for 256/512 byte block
31 */ 37 */
32int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc); 38int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc);
33 39
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 4e49f3350678..5509eb06b326 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/include/linux/mtd/onenand.h 2 * linux/include/linux/mtd/onenand.h
3 * 3 *
4 * Copyright (C) 2005-2007 Samsung Electronics 4 * Copyright © 2005-2009 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com> 5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -14,6 +14,7 @@
14 14
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/completion.h> 16#include <linux/completion.h>
17#include <linux/mtd/flashchip.h>
17#include <linux/mtd/onenand_regs.h> 18#include <linux/mtd/onenand_regs.h>
18#include <linux/mtd/bbm.h> 19#include <linux/mtd/bbm.h>
19 20
@@ -25,22 +26,6 @@ extern int onenand_scan(struct mtd_info *mtd, int max_chips);
25/* Free resources held by the OneNAND device */ 26/* Free resources held by the OneNAND device */
26extern void onenand_release(struct mtd_info *mtd); 27extern void onenand_release(struct mtd_info *mtd);
27 28
28/*
29 * onenand_state_t - chip states
30 * Enumeration for OneNAND flash chip state
31 */
32typedef enum {
33 FL_READY,
34 FL_READING,
35 FL_WRITING,
36 FL_ERASING,
37 FL_SYNCING,
38 FL_LOCKING,
39 FL_RESETING,
40 FL_OTPING,
41 FL_PM_SUSPENDED,
42} onenand_state_t;
43
44/** 29/**
45 * struct onenand_bufferram - OneNAND BufferRAM Data 30 * struct onenand_bufferram - OneNAND BufferRAM Data
46 * @blockpage: block & page address in BufferRAM 31 * @blockpage: block & page address in BufferRAM
@@ -137,7 +122,7 @@ struct onenand_chip {
137 122
138 spinlock_t chip_lock; 123 spinlock_t chip_lock;
139 wait_queue_head_t wq; 124 wait_queue_head_t wq;
140 onenand_state_t state; 125 flstate_t state;
141 unsigned char *page_buf; 126 unsigned char *page_buf;
142 unsigned char *oob_buf; 127 unsigned char *oob_buf;
143 128
@@ -152,6 +137,8 @@ struct onenand_chip {
152/* 137/*
153 * Helper macros 138 * Helper macros
154 */ 139 */
140#define ONENAND_PAGES_PER_BLOCK (1<<6)
141
155#define ONENAND_CURRENT_BUFFERRAM(this) (this->bufferram_index) 142#define ONENAND_CURRENT_BUFFERRAM(this) (this->bufferram_index)
156#define ONENAND_NEXT_BUFFERRAM(this) (this->bufferram_index ^ 1) 143#define ONENAND_NEXT_BUFFERRAM(this) (this->bufferram_index ^ 1)
157#define ONENAND_SET_NEXT_BUFFERRAM(this) (this->bufferram_index ^= 1) 144#define ONENAND_SET_NEXT_BUFFERRAM(this) (this->bufferram_index ^= 1)
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index acadbf53a69f..cd6f3b431195 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -131,6 +131,8 @@
131#define ONENAND_CMD_LOCK_TIGHT (0x2C) 131#define ONENAND_CMD_LOCK_TIGHT (0x2C)
132#define ONENAND_CMD_UNLOCK_ALL (0x27) 132#define ONENAND_CMD_UNLOCK_ALL (0x27)
133#define ONENAND_CMD_ERASE (0x94) 133#define ONENAND_CMD_ERASE (0x94)
134#define ONENAND_CMD_MULTIBLOCK_ERASE (0x95)
135#define ONENAND_CMD_ERASE_VERIFY (0x71)
134#define ONENAND_CMD_RESET (0xF0) 136#define ONENAND_CMD_RESET (0xF0)
135#define ONENAND_CMD_OTP_ACCESS (0x65) 137#define ONENAND_CMD_OTP_ACCESS (0x65)
136#define ONENAND_CMD_READID (0x90) 138#define ONENAND_CMD_READID (0x90)
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 51071b335751..89b28812ec24 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -2,6 +2,7 @@
2#define _LINUX_NFS_XDR_H 2#define _LINUX_NFS_XDR_H
3 3
4#include <linux/nfsacl.h> 4#include <linux/nfsacl.h>
5#include <linux/nfs3.h>
5 6
6/* 7/*
7 * To change the maximum rsize and wsize supported by the NFS client, adjust 8 * To change the maximum rsize and wsize supported by the NFS client, adjust
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h
index 43011b69297c..f321b578edeb 100644
--- a/include/linux/nfsacl.h
+++ b/include/linux/nfsacl.h
@@ -29,6 +29,7 @@
29#ifdef __KERNEL__ 29#ifdef __KERNEL__
30 30
31#include <linux/posix_acl.h> 31#include <linux/posix_acl.h>
32#include <linux/sunrpc/xdr.h>
32 33
33/* Maximum number of ACL entries over NFS */ 34/* Maximum number of ACL entries over NFS */
34#define NFS_ACL_MAX_ENTRIES 1024 35#define NFS_ACL_MAX_ENTRIES 1024
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
deleted file mode 100644
index 3a3f58934f5e..000000000000
--- a/include/linux/nfsd/cache.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 * include/linux/nfsd/cache.h
3 *
4 * Request reply cache. This was heavily inspired by the
5 * implementation in 4.3BSD/4.4BSD.
6 *
7 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
8 */
9
10#ifndef NFSCACHE_H
11#define NFSCACHE_H
12
13#include <linux/in.h>
14#include <linux/uio.h>
15
16/*
17 * Representation of a reply cache entry.
18 */
19struct svc_cacherep {
20 struct hlist_node c_hash;
21 struct list_head c_lru;
22
23 unsigned char c_state, /* unused, inprog, done */
24 c_type, /* status, buffer */
25 c_secure : 1; /* req came from port < 1024 */
26 struct sockaddr_in c_addr;
27 __be32 c_xid;
28 u32 c_prot;
29 u32 c_proc;
30 u32 c_vers;
31 unsigned long c_timestamp;
32 union {
33 struct kvec u_vec;
34 __be32 u_status;
35 } c_u;
36};
37
38#define c_replvec c_u.u_vec
39#define c_replstat c_u.u_status
40
41/* cache entry states */
42enum {
43 RC_UNUSED,
44 RC_INPROG,
45 RC_DONE
46};
47
48/* return values */
49enum {
50 RC_DROPIT,
51 RC_REPLY,
52 RC_DOIT,
53 RC_INTR
54};
55
56/*
57 * Cache types.
58 * We may want to add more types one day, e.g. for diropres and
59 * attrstat replies. Using cache entries with fixed length instead
60 * of buffer pointers may be more efficient.
61 */
62enum {
63 RC_NOCACHE,
64 RC_REPLSTAT,
65 RC_REPLBUFF,
66};
67
68/*
69 * If requests are retransmitted within this interval, they're dropped.
70 */
71#define RC_DELAY (HZ/5)
72
73int nfsd_reply_cache_init(void);
74void nfsd_reply_cache_shutdown(void);
75int nfsd_cache_lookup(struct svc_rqst *, int);
76void nfsd_cache_update(struct svc_rqst *, int, __be32 *);
77
78#ifdef CONFIG_NFSD_V4
79void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp);
80#else /* CONFIG_NFSD_V4 */
81static inline void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp)
82{
83}
84#endif /* CONFIG_NFSD_V4 */
85
86#endif /* NFSCACHE_H */
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index a6d9ef2bb34a..8ae78a61eea4 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -12,7 +12,7 @@
12 12
13# include <linux/types.h> 13# include <linux/types.h>
14#ifdef __KERNEL__ 14#ifdef __KERNEL__
15# include <linux/in.h> 15# include <linux/nfsd/nfsfh.h>
16#endif 16#endif
17 17
18/* 18/*
@@ -39,11 +39,23 @@
39#define NFSEXP_FSID 0x2000 39#define NFSEXP_FSID 0x2000
40#define NFSEXP_CROSSMOUNT 0x4000 40#define NFSEXP_CROSSMOUNT 0x4000
41#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ 41#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */
42#define NFSEXP_ALLFLAGS 0xFE3F 42/*
43 * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4
44 * clients, and only to the single directory that is the root of the
45 * export; further lookup and readdir operations are treated as if every
46 * subdirectory was a mountpoint, and ignored if they are not themselves
47 * exported. This is used by nfsd and mountd to construct the NFSv4
48 * pseudofilesystem, which provides access only to paths leading to each
49 * exported filesystem.
50 */
51#define NFSEXP_V4ROOT 0x10000
52/* All flags that we claim to support. (Note we don't support NOACL.) */
53#define NFSEXP_ALLFLAGS 0x17E3F
43 54
44/* The flags that may vary depending on security flavor: */ 55/* The flags that may vary depending on security flavor: */
45#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ 56#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \
46 | NFSEXP_ALLSQUASH) 57 | NFSEXP_ALLSQUASH \
58 | NFSEXP_INSECURE_PORT)
47 59
48#ifdef __KERNEL__ 60#ifdef __KERNEL__
49 61
@@ -108,7 +120,6 @@ struct svc_expkey {
108 struct path ek_path; 120 struct path ek_path;
109}; 121};
110 122
111#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT))
112#define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) 123#define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC))
113#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) 124#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE)
114#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) 125#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
deleted file mode 100644
index 510ffdd5020e..000000000000
--- a/include/linux/nfsd/nfsd.h
+++ /dev/null
@@ -1,424 +0,0 @@
1/*
2 * linux/include/linux/nfsd/nfsd.h
3 *
4 * Hodge-podge collection of knfsd-related stuff.
5 * I will sort this out later.
6 *
7 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
8 */
9
10#ifndef LINUX_NFSD_NFSD_H
11#define LINUX_NFSD_NFSD_H
12
13#include <linux/types.h>
14#include <linux/unistd.h>
15#include <linux/fs.h>
16#include <linux/posix_acl.h>
17#include <linux/mount.h>
18
19#include <linux/nfsd/debug.h>
20#include <linux/nfsd/nfsfh.h>
21#include <linux/nfsd/export.h>
22#include <linux/nfsd/stats.h>
23/*
24 * nfsd version
25 */
26#define NFSD_SUPPORTED_MINOR_VERSION 1
27
28/*
29 * Flags for nfsd_permission
30 */
31#define NFSD_MAY_NOP 0
32#define NFSD_MAY_EXEC 1 /* == MAY_EXEC */
33#define NFSD_MAY_WRITE 2 /* == MAY_WRITE */
34#define NFSD_MAY_READ 4 /* == MAY_READ */
35#define NFSD_MAY_SATTR 8
36#define NFSD_MAY_TRUNC 16
37#define NFSD_MAY_LOCK 32
38#define NFSD_MAY_OWNER_OVERRIDE 64
39#define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/
40#define NFSD_MAY_BYPASS_GSS_ON_ROOT 256
41
42#define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE)
43#define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC)
44
45/*
46 * Callback function for readdir
47 */
48struct readdir_cd {
49 __be32 err; /* 0, nfserr, or nfserr_eof */
50};
51typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int);
52
53extern struct svc_program nfsd_program;
54extern struct svc_version nfsd_version2, nfsd_version3,
55 nfsd_version4;
56extern u32 nfsd_supported_minorversion;
57extern struct mutex nfsd_mutex;
58extern struct svc_serv *nfsd_serv;
59extern spinlock_t nfsd_drc_lock;
60extern unsigned int nfsd_drc_max_mem;
61extern unsigned int nfsd_drc_mem_used;
62
63extern const struct seq_operations nfs_exports_op;
64
65/*
66 * Function prototypes.
67 */
68int nfsd_svc(unsigned short port, int nrservs);
69int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp);
70
71int nfsd_nrthreads(void);
72int nfsd_nrpools(void);
73int nfsd_get_nrthreads(int n, int *);
74int nfsd_set_nrthreads(int n, int *);
75
76/* nfsd/vfs.c */
77int fh_lock_parent(struct svc_fh *, struct dentry *);
78int nfsd_racache_init(int);
79void nfsd_racache_shutdown(void);
80int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
81 struct svc_export **expp);
82__be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *,
83 const char *, unsigned int, struct svc_fh *);
84__be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *,
85 const char *, unsigned int,
86 struct svc_export **, struct dentry **);
87__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *,
88 struct iattr *, int, time_t);
89#ifdef CONFIG_NFSD_V4
90__be32 nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *,
91 struct nfs4_acl *);
92int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **);
93#endif /* CONFIG_NFSD_V4 */
94__be32 nfsd_create(struct svc_rqst *, struct svc_fh *,
95 char *name, int len, struct iattr *attrs,
96 int type, dev_t rdev, struct svc_fh *res);
97#ifdef CONFIG_NFSD_V3
98__be32 nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *);
99__be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *,
100 char *name, int len, struct iattr *attrs,
101 struct svc_fh *res, int createmode,
102 u32 *verifier, int *truncp, int *created);
103__be32 nfsd_commit(struct svc_rqst *, struct svc_fh *,
104 loff_t, unsigned long);
105#endif /* CONFIG_NFSD_V3 */
106__be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int,
107 int, struct file **);
108void nfsd_close(struct file *);
109__be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *,
110 loff_t, struct kvec *, int, unsigned long *);
111__be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *,
112 loff_t, struct kvec *,int, unsigned long *, int *);
113__be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *,
114 char *, int *);
115__be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *,
116 char *name, int len, char *path, int plen,
117 struct svc_fh *res, struct iattr *);
118__be32 nfsd_link(struct svc_rqst *, struct svc_fh *,
119 char *, int, struct svc_fh *);
120__be32 nfsd_rename(struct svc_rqst *,
121 struct svc_fh *, char *, int,
122 struct svc_fh *, char *, int);
123__be32 nfsd_remove(struct svc_rqst *,
124 struct svc_fh *, char *, int);
125__be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type,
126 char *name, int len);
127int nfsd_truncate(struct svc_rqst *, struct svc_fh *,
128 unsigned long size);
129__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *,
130 loff_t *, struct readdir_cd *, filldir_t);
131__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *,
132 struct kstatfs *, int access);
133
134int nfsd_notify_change(struct inode *, struct iattr *);
135__be32 nfsd_permission(struct svc_rqst *, struct svc_export *,
136 struct dentry *, int);
137int nfsd_sync_dir(struct dentry *dp);
138
139#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
140#ifdef CONFIG_NFSD_V2_ACL
141extern struct svc_version nfsd_acl_version2;
142#else
143#define nfsd_acl_version2 NULL
144#endif
145#ifdef CONFIG_NFSD_V3_ACL
146extern struct svc_version nfsd_acl_version3;
147#else
148#define nfsd_acl_version3 NULL
149#endif
150struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int);
151int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *);
152#endif
153
154enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL };
155int nfsd_vers(int vers, enum vers_op change);
156int nfsd_minorversion(u32 minorversion, enum vers_op change);
157void nfsd_reset_versions(void);
158int nfsd_create_serv(void);
159
160extern int nfsd_max_blksize;
161
162/*
163 * NFSv4 State
164 */
165#ifdef CONFIG_NFSD_V4
166extern unsigned int max_delegations;
167int nfs4_state_init(void);
168void nfsd4_free_slabs(void);
169int nfs4_state_start(void);
170void nfs4_state_shutdown(void);
171time_t nfs4_lease_time(void);
172void nfs4_reset_lease(time_t leasetime);
173int nfs4_reset_recoverydir(char *recdir);
174#else
175static inline int nfs4_state_init(void) { return 0; }
176static inline void nfsd4_free_slabs(void) { }
177static inline int nfs4_state_start(void) { return 0; }
178static inline void nfs4_state_shutdown(void) { }
179static inline time_t nfs4_lease_time(void) { return 0; }
180static inline void nfs4_reset_lease(time_t leasetime) { }
181static inline int nfs4_reset_recoverydir(char *recdir) { return 0; }
182#endif
183
184/*
185 * lockd binding
186 */
187void nfsd_lockd_init(void);
188void nfsd_lockd_shutdown(void);
189
190
191/*
192 * These macros provide pre-xdr'ed values for faster operation.
193 */
194#define nfs_ok cpu_to_be32(NFS_OK)
195#define nfserr_perm cpu_to_be32(NFSERR_PERM)
196#define nfserr_noent cpu_to_be32(NFSERR_NOENT)
197#define nfserr_io cpu_to_be32(NFSERR_IO)
198#define nfserr_nxio cpu_to_be32(NFSERR_NXIO)
199#define nfserr_eagain cpu_to_be32(NFSERR_EAGAIN)
200#define nfserr_acces cpu_to_be32(NFSERR_ACCES)
201#define nfserr_exist cpu_to_be32(NFSERR_EXIST)
202#define nfserr_xdev cpu_to_be32(NFSERR_XDEV)
203#define nfserr_nodev cpu_to_be32(NFSERR_NODEV)
204#define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR)
205#define nfserr_isdir cpu_to_be32(NFSERR_ISDIR)
206#define nfserr_inval cpu_to_be32(NFSERR_INVAL)
207#define nfserr_fbig cpu_to_be32(NFSERR_FBIG)
208#define nfserr_nospc cpu_to_be32(NFSERR_NOSPC)
209#define nfserr_rofs cpu_to_be32(NFSERR_ROFS)
210#define nfserr_mlink cpu_to_be32(NFSERR_MLINK)
211#define nfserr_opnotsupp cpu_to_be32(NFSERR_OPNOTSUPP)
212#define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG)
213#define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY)
214#define nfserr_dquot cpu_to_be32(NFSERR_DQUOT)
215#define nfserr_stale cpu_to_be32(NFSERR_STALE)
216#define nfserr_remote cpu_to_be32(NFSERR_REMOTE)
217#define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH)
218#define nfserr_badhandle cpu_to_be32(NFSERR_BADHANDLE)
219#define nfserr_notsync cpu_to_be32(NFSERR_NOT_SYNC)
220#define nfserr_badcookie cpu_to_be32(NFSERR_BAD_COOKIE)
221#define nfserr_notsupp cpu_to_be32(NFSERR_NOTSUPP)
222#define nfserr_toosmall cpu_to_be32(NFSERR_TOOSMALL)
223#define nfserr_serverfault cpu_to_be32(NFSERR_SERVERFAULT)
224#define nfserr_badtype cpu_to_be32(NFSERR_BADTYPE)
225#define nfserr_jukebox cpu_to_be32(NFSERR_JUKEBOX)
226#define nfserr_denied cpu_to_be32(NFSERR_DENIED)
227#define nfserr_deadlock cpu_to_be32(NFSERR_DEADLOCK)
228#define nfserr_expired cpu_to_be32(NFSERR_EXPIRED)
229#define nfserr_bad_cookie cpu_to_be32(NFSERR_BAD_COOKIE)
230#define nfserr_same cpu_to_be32(NFSERR_SAME)
231#define nfserr_clid_inuse cpu_to_be32(NFSERR_CLID_INUSE)
232#define nfserr_stale_clientid cpu_to_be32(NFSERR_STALE_CLIENTID)
233#define nfserr_resource cpu_to_be32(NFSERR_RESOURCE)
234#define nfserr_moved cpu_to_be32(NFSERR_MOVED)
235#define nfserr_nofilehandle cpu_to_be32(NFSERR_NOFILEHANDLE)
236#define nfserr_minor_vers_mismatch cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH)
237#define nfserr_share_denied cpu_to_be32(NFSERR_SHARE_DENIED)
238#define nfserr_stale_stateid cpu_to_be32(NFSERR_STALE_STATEID)
239#define nfserr_old_stateid cpu_to_be32(NFSERR_OLD_STATEID)
240#define nfserr_bad_stateid cpu_to_be32(NFSERR_BAD_STATEID)
241#define nfserr_bad_seqid cpu_to_be32(NFSERR_BAD_SEQID)
242#define nfserr_symlink cpu_to_be32(NFSERR_SYMLINK)
243#define nfserr_not_same cpu_to_be32(NFSERR_NOT_SAME)
244#define nfserr_restorefh cpu_to_be32(NFSERR_RESTOREFH)
245#define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP)
246#define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR)
247#define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE)
248#define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD)
249#define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL)
250#define nfserr_grace cpu_to_be32(NFSERR_GRACE)
251#define nfserr_no_grace cpu_to_be32(NFSERR_NO_GRACE)
252#define nfserr_reclaim_bad cpu_to_be32(NFSERR_RECLAIM_BAD)
253#define nfserr_badname cpu_to_be32(NFSERR_BADNAME)
254#define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN)
255#define nfserr_locked cpu_to_be32(NFSERR_LOCKED)
256#define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC)
257#define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE)
258#define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT)
259#define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST)
260#define nfserr_badsession cpu_to_be32(NFS4ERR_BADSESSION)
261#define nfserr_badslot cpu_to_be32(NFS4ERR_BADSLOT)
262#define nfserr_complete_already cpu_to_be32(NFS4ERR_COMPLETE_ALREADY)
263#define nfserr_conn_not_bound_to_session cpu_to_be32(NFS4ERR_CONN_NOT_BOUND_TO_SESSION)
264#define nfserr_deleg_already_wanted cpu_to_be32(NFS4ERR_DELEG_ALREADY_WANTED)
265#define nfserr_back_chan_busy cpu_to_be32(NFS4ERR_BACK_CHAN_BUSY)
266#define nfserr_layouttrylater cpu_to_be32(NFS4ERR_LAYOUTTRYLATER)
267#define nfserr_layoutunavailable cpu_to_be32(NFS4ERR_LAYOUTUNAVAILABLE)
268#define nfserr_nomatching_layout cpu_to_be32(NFS4ERR_NOMATCHING_LAYOUT)
269#define nfserr_recallconflict cpu_to_be32(NFS4ERR_RECALLCONFLICT)
270#define nfserr_unknown_layouttype cpu_to_be32(NFS4ERR_UNKNOWN_LAYOUTTYPE)
271#define nfserr_seq_misordered cpu_to_be32(NFS4ERR_SEQ_MISORDERED)
272#define nfserr_sequence_pos cpu_to_be32(NFS4ERR_SEQUENCE_POS)
273#define nfserr_req_too_big cpu_to_be32(NFS4ERR_REQ_TOO_BIG)
274#define nfserr_rep_too_big cpu_to_be32(NFS4ERR_REP_TOO_BIG)
275#define nfserr_rep_too_big_to_cache cpu_to_be32(NFS4ERR_REP_TOO_BIG_TO_CACHE)
276#define nfserr_retry_uncached_rep cpu_to_be32(NFS4ERR_RETRY_UNCACHED_REP)
277#define nfserr_unsafe_compound cpu_to_be32(NFS4ERR_UNSAFE_COMPOUND)
278#define nfserr_too_many_ops cpu_to_be32(NFS4ERR_TOO_MANY_OPS)
279#define nfserr_op_not_in_session cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION)
280#define nfserr_hash_alg_unsupp cpu_to_be32(NFS4ERR_HASH_ALG_UNSUPP)
281#define nfserr_clientid_busy cpu_to_be32(NFS4ERR_CLIENTID_BUSY)
282#define nfserr_pnfs_io_hole cpu_to_be32(NFS4ERR_PNFS_IO_HOLE)
283#define nfserr_seq_false_retry cpu_to_be32(NFS4ERR_SEQ_FALSE_RETRY)
284#define nfserr_bad_high_slot cpu_to_be32(NFS4ERR_BAD_HIGH_SLOT)
285#define nfserr_deadsession cpu_to_be32(NFS4ERR_DEADSESSION)
286#define nfserr_encr_alg_unsupp cpu_to_be32(NFS4ERR_ENCR_ALG_UNSUPP)
287#define nfserr_pnfs_no_layout cpu_to_be32(NFS4ERR_PNFS_NO_LAYOUT)
288#define nfserr_not_only_op cpu_to_be32(NFS4ERR_NOT_ONLY_OP)
289#define nfserr_wrong_cred cpu_to_be32(NFS4ERR_WRONG_CRED)
290#define nfserr_wrong_type cpu_to_be32(NFS4ERR_WRONG_TYPE)
291#define nfserr_dirdeleg_unavail cpu_to_be32(NFS4ERR_DIRDELEG_UNAVAIL)
292#define nfserr_reject_deleg cpu_to_be32(NFS4ERR_REJECT_DELEG)
293#define nfserr_returnconflict cpu_to_be32(NFS4ERR_RETURNCONFLICT)
294#define nfserr_deleg_revoked cpu_to_be32(NFS4ERR_DELEG_REVOKED)
295
296/* error codes for internal use */
297/* if a request fails due to kmalloc failure, it gets dropped.
298 * Client should resend eventually
299 */
300#define nfserr_dropit cpu_to_be32(30000)
301/* end-of-file indicator in readdir */
302#define nfserr_eof cpu_to_be32(30001)
303/* replay detected */
304#define nfserr_replay_me cpu_to_be32(11001)
305/* nfs41 replay detected */
306#define nfserr_replay_cache cpu_to_be32(11002)
307
308/* Check for dir entries '.' and '..' */
309#define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.'))
310
311/*
312 * Time of server startup
313 */
314extern struct timeval nfssvc_boot;
315
316#ifdef CONFIG_NFSD_V4
317
318/* before processing a COMPOUND operation, we have to check that there
319 * is enough space in the buffer for XDR encode to succeed. otherwise,
320 * we might process an operation with side effects, and be unable to
321 * tell the client that the operation succeeded.
322 *
323 * COMPOUND_SLACK_SPACE - this is the minimum bytes of buffer space
324 * needed to encode an "ordinary" _successful_ operation. (GETATTR,
325 * READ, READDIR, and READLINK have their own buffer checks.) if we
326 * fall below this level, we fail the next operation with NFS4ERR_RESOURCE.
327 *
328 * COMPOUND_ERR_SLACK_SPACE - this is the minimum bytes of buffer space
329 * needed to encode an operation which has failed with NFS4ERR_RESOURCE.
330 * care is taken to ensure that we never fall below this level for any
331 * reason.
332 */
333#define COMPOUND_SLACK_SPACE 140 /* OP_GETFH */
334#define COMPOUND_ERR_SLACK_SPACE 12 /* OP_SETATTR */
335
336#define NFSD_LEASE_TIME (nfs4_lease_time())
337#define NFSD_LAUNDROMAT_MINTIMEOUT 10 /* seconds */
338
339/*
340 * The following attributes are currently not supported by the NFSv4 server:
341 * ARCHIVE (deprecated anyway)
342 * HIDDEN (unlikely to be supported any time soon)
343 * MIMETYPE (unlikely to be supported any time soon)
344 * QUOTA_* (will be supported in a forthcoming patch)
345 * SYSTEM (unlikely to be supported any time soon)
346 * TIME_BACKUP (unlikely to be supported any time soon)
347 * TIME_CREATE (unlikely to be supported any time soon)
348 */
349#define NFSD4_SUPPORTED_ATTRS_WORD0 \
350(FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \
351 | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \
352 | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \
353 | FATTR4_WORD0_UNIQUE_HANDLES | FATTR4_WORD0_LEASE_TIME | FATTR4_WORD0_RDATTR_ERROR \
354 | FATTR4_WORD0_ACLSUPPORT | FATTR4_WORD0_CANSETTIME | FATTR4_WORD0_CASE_INSENSITIVE \
355 | FATTR4_WORD0_CASE_PRESERVING | FATTR4_WORD0_CHOWN_RESTRICTED \
356 | FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FILEID | FATTR4_WORD0_FILES_AVAIL \
357 | FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_HOMOGENEOUS \
358 | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \
359 | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL)
360
361#define NFSD4_SUPPORTED_ATTRS_WORD1 \
362(FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \
363 | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \
364 | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \
365 | FATTR4_WORD1_SPACE_USED | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_ACCESS_SET \
366 | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \
367 | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID)
368
369#define NFSD4_SUPPORTED_ATTRS_WORD2 0
370
371#define NFSD4_1_SUPPORTED_ATTRS_WORD0 \
372 NFSD4_SUPPORTED_ATTRS_WORD0
373
374#define NFSD4_1_SUPPORTED_ATTRS_WORD1 \
375 NFSD4_SUPPORTED_ATTRS_WORD1
376
377#define NFSD4_1_SUPPORTED_ATTRS_WORD2 \
378 (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT)
379
380static inline u32 nfsd_suppattrs0(u32 minorversion)
381{
382 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0
383 : NFSD4_SUPPORTED_ATTRS_WORD0;
384}
385
386static inline u32 nfsd_suppattrs1(u32 minorversion)
387{
388 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD1
389 : NFSD4_SUPPORTED_ATTRS_WORD1;
390}
391
392static inline u32 nfsd_suppattrs2(u32 minorversion)
393{
394 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD2
395 : NFSD4_SUPPORTED_ATTRS_WORD2;
396}
397
398/* These will return ERR_INVAL if specified in GETATTR or READDIR. */
399#define NFSD_WRITEONLY_ATTRS_WORD1 \
400(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
401
402/* These are the only attrs allowed in CREATE/OPEN/SETATTR. */
403#define NFSD_WRITEABLE_ATTRS_WORD0 \
404(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL )
405#define NFSD_WRITEABLE_ATTRS_WORD1 \
406(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \
407 | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
408#define NFSD_WRITEABLE_ATTRS_WORD2 0
409
410#define NFSD_SUPPATTR_EXCLCREAT_WORD0 \
411 NFSD_WRITEABLE_ATTRS_WORD0
412/*
413 * we currently store the exclusive create verifier in the v_{a,m}time
414 * attributes so the client can't set these at create time using EXCLUSIVE4_1
415 */
416#define NFSD_SUPPATTR_EXCLCREAT_WORD1 \
417 (NFSD_WRITEABLE_ATTRS_WORD1 & \
418 ~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET))
419#define NFSD_SUPPATTR_EXCLCREAT_WORD2 \
420 NFSD_WRITEABLE_ATTRS_WORD2
421
422#endif /* CONFIG_NFSD_V4 */
423
424#endif /* LINUX_NFSD_NFSD_H */
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index 8f641c908450..65e333afaee4 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -16,11 +16,9 @@
16 16
17# include <linux/types.h> 17# include <linux/types.h>
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19# include <linux/string.h> 19# include <linux/sunrpc/svc.h>
20# include <linux/fs.h>
21#endif 20#endif
22#include <linux/nfsd/const.h> 21#include <linux/nfsd/const.h>
23#include <linux/nfsd/debug.h>
24 22
25/* 23/*
26 * This is the old "dentry style" Linux NFSv2 file handle. 24 * This is the old "dentry style" Linux NFSv2 file handle.
@@ -164,208 +162,6 @@ typedef struct svc_fh {
164 162
165} svc_fh; 163} svc_fh;
166 164
167enum nfsd_fsid {
168 FSID_DEV = 0,
169 FSID_NUM,
170 FSID_MAJOR_MINOR,
171 FSID_ENCODE_DEV,
172 FSID_UUID4_INUM,
173 FSID_UUID8,
174 FSID_UUID16,
175 FSID_UUID16_INUM,
176};
177
178enum fsid_source {
179 FSIDSOURCE_DEV,
180 FSIDSOURCE_FSID,
181 FSIDSOURCE_UUID,
182};
183extern enum fsid_source fsid_source(struct svc_fh *fhp);
184
185
186/* This might look a little large to "inline" but in all calls except
187 * one, 'vers' is constant so moste of the function disappears.
188 */
189static inline void mk_fsid(int vers, u32 *fsidv, dev_t dev, ino_t ino,
190 u32 fsid, unsigned char *uuid)
191{
192 u32 *up;
193 switch(vers) {
194 case FSID_DEV:
195 fsidv[0] = htonl((MAJOR(dev)<<16) |
196 MINOR(dev));
197 fsidv[1] = ino_t_to_u32(ino);
198 break;
199 case FSID_NUM:
200 fsidv[0] = fsid;
201 break;
202 case FSID_MAJOR_MINOR:
203 fsidv[0] = htonl(MAJOR(dev));
204 fsidv[1] = htonl(MINOR(dev));
205 fsidv[2] = ino_t_to_u32(ino);
206 break;
207
208 case FSID_ENCODE_DEV:
209 fsidv[0] = new_encode_dev(dev);
210 fsidv[1] = ino_t_to_u32(ino);
211 break;
212
213 case FSID_UUID4_INUM:
214 /* 4 byte fsid and inode number */
215 up = (u32*)uuid;
216 fsidv[0] = ino_t_to_u32(ino);
217 fsidv[1] = up[0] ^ up[1] ^ up[2] ^ up[3];
218 break;
219
220 case FSID_UUID8:
221 /* 8 byte fsid */
222 up = (u32*)uuid;
223 fsidv[0] = up[0] ^ up[2];
224 fsidv[1] = up[1] ^ up[3];
225 break;
226
227 case FSID_UUID16:
228 /* 16 byte fsid - NFSv3+ only */
229 memcpy(fsidv, uuid, 16);
230 break;
231
232 case FSID_UUID16_INUM:
233 /* 8 byte inode and 16 byte fsid */
234 *(u64*)fsidv = (u64)ino;
235 memcpy(fsidv+2, uuid, 16);
236 break;
237 default: BUG();
238 }
239}
240
241static inline int key_len(int type)
242{
243 switch(type) {
244 case FSID_DEV: return 8;
245 case FSID_NUM: return 4;
246 case FSID_MAJOR_MINOR: return 12;
247 case FSID_ENCODE_DEV: return 8;
248 case FSID_UUID4_INUM: return 8;
249 case FSID_UUID8: return 8;
250 case FSID_UUID16: return 16;
251 case FSID_UUID16_INUM: return 24;
252 default: return 0;
253 }
254}
255
256/*
257 * Shorthand for dprintk()'s
258 */
259extern char * SVCFH_fmt(struct svc_fh *fhp);
260
261/*
262 * Function prototypes
263 */
264__be32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int);
265__be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *);
266__be32 fh_update(struct svc_fh *);
267void fh_put(struct svc_fh *);
268
269static __inline__ struct svc_fh *
270fh_copy(struct svc_fh *dst, struct svc_fh *src)
271{
272 WARN_ON(src->fh_dentry || src->fh_locked);
273
274 *dst = *src;
275 return dst;
276}
277
278static inline void
279fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src)
280{
281 dst->fh_size = src->fh_size;
282 memcpy(&dst->fh_base, &src->fh_base, src->fh_size);
283}
284
285static __inline__ struct svc_fh *
286fh_init(struct svc_fh *fhp, int maxsize)
287{
288 memset(fhp, 0, sizeof(*fhp));
289 fhp->fh_maxsize = maxsize;
290 return fhp;
291}
292
293#ifdef CONFIG_NFSD_V3
294/*
295 * Fill in the pre_op attr for the wcc data
296 */
297static inline void
298fill_pre_wcc(struct svc_fh *fhp)
299{
300 struct inode *inode;
301
302 inode = fhp->fh_dentry->d_inode;
303 if (!fhp->fh_pre_saved) {
304 fhp->fh_pre_mtime = inode->i_mtime;
305 fhp->fh_pre_ctime = inode->i_ctime;
306 fhp->fh_pre_size = inode->i_size;
307 fhp->fh_pre_change = inode->i_version;
308 fhp->fh_pre_saved = 1;
309 }
310}
311
312extern void fill_post_wcc(struct svc_fh *);
313#else
314#define fill_pre_wcc(ignored)
315#define fill_post_wcc(notused)
316#endif /* CONFIG_NFSD_V3 */
317
318
319/*
320 * Lock a file handle/inode
321 * NOTE: both fh_lock and fh_unlock are done "by hand" in
322 * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once
323 * so, any changes here should be reflected there.
324 */
325
326static inline void
327fh_lock_nested(struct svc_fh *fhp, unsigned int subclass)
328{
329 struct dentry *dentry = fhp->fh_dentry;
330 struct inode *inode;
331
332 dfprintk(FILEOP, "nfsd: fh_lock(%s) locked = %d\n",
333 SVCFH_fmt(fhp), fhp->fh_locked);
334
335 BUG_ON(!dentry);
336
337 if (fhp->fh_locked) {
338 printk(KERN_WARNING "fh_lock: %s/%s already locked!\n",
339 dentry->d_parent->d_name.name, dentry->d_name.name);
340 return;
341 }
342
343 inode = dentry->d_inode;
344 mutex_lock_nested(&inode->i_mutex, subclass);
345 fill_pre_wcc(fhp);
346 fhp->fh_locked = 1;
347}
348
349static inline void
350fh_lock(struct svc_fh *fhp)
351{
352 fh_lock_nested(fhp, I_MUTEX_NORMAL);
353}
354
355/*
356 * Unlock a file handle/inode
357 */
358static inline void
359fh_unlock(struct svc_fh *fhp)
360{
361 BUG_ON(!fhp->fh_dentry);
362
363 if (fhp->fh_locked) {
364 fill_post_wcc(fhp);
365 mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex);
366 fhp->fh_locked = 0;
367 }
368}
369#endif /* __KERNEL__ */ 165#endif /* __KERNEL__ */
370 166
371 167
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
deleted file mode 100644
index b38d11324189..000000000000
--- a/include/linux/nfsd/state.h
+++ /dev/null
@@ -1,404 +0,0 @@
1/*
2 * linux/include/nfsd/state.h
3 *
4 * Copyright (c) 2001 The Regents of the University of Michigan.
5 * All rights reserved.
6 *
7 * Kendrick Smith <kmsmith@umich.edu>
8 * Andy Adamson <andros@umich.edu>
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 */
36
37#ifndef _NFSD4_STATE_H
38#define _NFSD4_STATE_H
39
40#include <linux/list.h>
41#include <linux/kref.h>
42#include <linux/sunrpc/clnt.h>
43
44typedef struct {
45 u32 cl_boot;
46 u32 cl_id;
47} clientid_t;
48
49typedef struct {
50 u32 so_boot;
51 u32 so_stateownerid;
52 u32 so_fileid;
53} stateid_opaque_t;
54
55typedef struct {
56 u32 si_generation;
57 stateid_opaque_t si_opaque;
58} stateid_t;
59#define si_boot si_opaque.so_boot
60#define si_stateownerid si_opaque.so_stateownerid
61#define si_fileid si_opaque.so_fileid
62
63struct nfsd4_cb_sequence {
64 /* args/res */
65 u32 cbs_minorversion;
66 struct nfs4_client *cbs_clp;
67};
68
69struct nfs4_delegation {
70 struct list_head dl_perfile;
71 struct list_head dl_perclnt;
72 struct list_head dl_recall_lru; /* delegation recalled */
73 atomic_t dl_count; /* ref count */
74 struct nfs4_client *dl_client;
75 struct nfs4_file *dl_file;
76 struct file_lock *dl_flock;
77 struct file *dl_vfs_file;
78 u32 dl_type;
79 time_t dl_time;
80/* For recall: */
81 u32 dl_ident;
82 stateid_t dl_stateid;
83 struct knfsd_fh dl_fh;
84 int dl_retries;
85};
86
87/* client delegation callback info */
88struct nfs4_cb_conn {
89 /* SETCLIENTID info */
90 struct sockaddr_storage cb_addr;
91 size_t cb_addrlen;
92 u32 cb_prog;
93 u32 cb_minorversion;
94 u32 cb_ident; /* minorversion 0 only */
95 /* RPC client info */
96 atomic_t cb_set; /* successful CB_NULL call */
97 struct rpc_clnt * cb_client;
98};
99
100/* Maximum number of slots per session. 160 is useful for long haul TCP */
101#define NFSD_MAX_SLOTS_PER_SESSION 160
102/* Maximum number of operations per session compound */
103#define NFSD_MAX_OPS_PER_COMPOUND 16
104/* Maximum session per slot cache size */
105#define NFSD_SLOT_CACHE_SIZE 1024
106/* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */
107#define NFSD_CACHE_SIZE_SLOTS_PER_SESSION 32
108#define NFSD_MAX_MEM_PER_SESSION \
109 (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE)
110
111struct nfsd4_slot {
112 bool sl_inuse;
113 bool sl_cachethis;
114 u16 sl_opcnt;
115 u32 sl_seqid;
116 __be32 sl_status;
117 u32 sl_datalen;
118 char sl_data[];
119};
120
121struct nfsd4_channel_attrs {
122 u32 headerpadsz;
123 u32 maxreq_sz;
124 u32 maxresp_sz;
125 u32 maxresp_cached;
126 u32 maxops;
127 u32 maxreqs;
128 u32 nr_rdma_attrs;
129 u32 rdma_attrs;
130};
131
132struct nfsd4_create_session {
133 clientid_t clientid;
134 struct nfs4_sessionid sessionid;
135 u32 seqid;
136 u32 flags;
137 struct nfsd4_channel_attrs fore_channel;
138 struct nfsd4_channel_attrs back_channel;
139 u32 callback_prog;
140 u32 uid;
141 u32 gid;
142};
143
144/* The single slot clientid cache structure */
145struct nfsd4_clid_slot {
146 u32 sl_seqid;
147 __be32 sl_status;
148 struct nfsd4_create_session sl_cr_ses;
149};
150
151struct nfsd4_session {
152 struct kref se_ref;
153 struct list_head se_hash; /* hash by sessionid */
154 struct list_head se_perclnt;
155 u32 se_flags;
156 struct nfs4_client *se_client; /* for expire_client */
157 struct nfs4_sessionid se_sessionid;
158 struct nfsd4_channel_attrs se_fchannel;
159 struct nfsd4_channel_attrs se_bchannel;
160 struct nfsd4_slot *se_slots[]; /* forward channel slots */
161};
162
163static inline void
164nfsd4_put_session(struct nfsd4_session *ses)
165{
166 extern void free_session(struct kref *kref);
167 kref_put(&ses->se_ref, free_session);
168}
169
170static inline void
171nfsd4_get_session(struct nfsd4_session *ses)
172{
173 kref_get(&ses->se_ref);
174}
175
176/* formatted contents of nfs4_sessionid */
177struct nfsd4_sessionid {
178 clientid_t clientid;
179 u32 sequence;
180 u32 reserved;
181};
182
183#define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */
184
185/*
186 * struct nfs4_client - one per client. Clientids live here.
187 * o Each nfs4_client is hashed by clientid.
188 *
189 * o Each nfs4_clients is also hashed by name
190 * (the opaque quantity initially sent by the client to identify itself).
191 *
192 * o cl_perclient list is used to ensure no dangling stateowner references
193 * when we expire the nfs4_client
194 */
195struct nfs4_client {
196 struct list_head cl_idhash; /* hash by cl_clientid.id */
197 struct list_head cl_strhash; /* hash by cl_name */
198 struct list_head cl_openowners;
199 struct list_head cl_delegations;
200 struct list_head cl_lru; /* tail queue */
201 struct xdr_netobj cl_name; /* id generated by client */
202 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
203 nfs4_verifier cl_verifier; /* generated by client */
204 time_t cl_time; /* time of last lease renewal */
205 struct sockaddr_storage cl_addr; /* client ipaddress */
206 u32 cl_flavor; /* setclientid pseudoflavor */
207 char *cl_principal; /* setclientid principal name */
208 struct svc_cred cl_cred; /* setclientid principal */
209 clientid_t cl_clientid; /* generated by server */
210 nfs4_verifier cl_confirm; /* generated by server */
211 struct nfs4_cb_conn cl_cb_conn; /* callback info */
212 atomic_t cl_count; /* ref count */
213 u32 cl_firststate; /* recovery dir creation */
214
215 /* for nfs41 */
216 struct list_head cl_sessions;
217 struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */
218 u32 cl_exchange_flags;
219 struct nfs4_sessionid cl_sessionid;
220
221 /* for nfs41 callbacks */
222 /* We currently support a single back channel with a single slot */
223 unsigned long cl_cb_slot_busy;
224 u32 cl_cb_seq_nr;
225 struct svc_xprt *cl_cb_xprt; /* 4.1 callback transport */
226 struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */
227 /* wait here for slots */
228};
229
230/* struct nfs4_client_reset
231 * one per old client. Populates reset_str_hashtbl. Filled from conf_id_hashtbl
232 * upon lease reset, or from upcall to state_daemon (to read in state
233 * from non-volitile storage) upon reboot.
234 */
235struct nfs4_client_reclaim {
236 struct list_head cr_strhash; /* hash by cr_name */
237 char cr_recdir[HEXDIR_LEN]; /* recover dir */
238};
239
240static inline void
241update_stateid(stateid_t *stateid)
242{
243 stateid->si_generation++;
244}
245
246/* A reasonable value for REPLAY_ISIZE was estimated as follows:
247 * The OPEN response, typically the largest, requires
248 * 4(status) + 8(stateid) + 20(changeinfo) + 4(rflags) + 8(verifier) +
249 * 4(deleg. type) + 8(deleg. stateid) + 4(deleg. recall flag) +
250 * 20(deleg. space limit) + ~32(deleg. ace) = 112 bytes
251 */
252
253#define NFSD4_REPLAY_ISIZE 112
254
255/*
256 * Replay buffer, where the result of the last seqid-mutating operation
257 * is cached.
258 */
259struct nfs4_replay {
260 __be32 rp_status;
261 unsigned int rp_buflen;
262 char *rp_buf;
263 unsigned intrp_allocated;
264 struct knfsd_fh rp_openfh;
265 char rp_ibuf[NFSD4_REPLAY_ISIZE];
266};
267
268/*
269* nfs4_stateowner can either be an open_owner, or a lock_owner
270*
271* so_idhash: stateid_hashtbl[] for open owner, lockstateid_hashtbl[]
272* for lock_owner
273* so_strhash: ownerstr_hashtbl[] for open_owner, lock_ownerstr_hashtbl[]
274* for lock_owner
275* so_perclient: nfs4_client->cl_perclient entry - used when nfs4_client
276* struct is reaped.
277* so_perfilestate: heads the list of nfs4_stateid (either open or lock)
278* and is used to ensure no dangling nfs4_stateid references when we
279* release a stateowner.
280* so_perlockowner: (open) nfs4_stateid->st_perlockowner entry - used when
281* close is called to reap associated byte-range locks
282* so_close_lru: (open) stateowner is placed on this list instead of being
283* reaped (when so_perfilestate is empty) to hold the last close replay.
284* reaped by laundramat thread after lease period.
285*/
286struct nfs4_stateowner {
287 struct kref so_ref;
288 struct list_head so_idhash; /* hash by so_id */
289 struct list_head so_strhash; /* hash by op_name */
290 struct list_head so_perclient;
291 struct list_head so_stateids;
292 struct list_head so_perstateid; /* for lockowners only */
293 struct list_head so_close_lru; /* tail queue */
294 time_t so_time; /* time of placement on so_close_lru */
295 int so_is_open_owner; /* 1=openowner,0=lockowner */
296 u32 so_id;
297 struct nfs4_client * so_client;
298 /* after increment in ENCODE_SEQID_OP_TAIL, represents the next
299 * sequence id expected from the client: */
300 u32 so_seqid;
301 struct xdr_netobj so_owner; /* open owner name */
302 int so_confirmed; /* successful OPEN_CONFIRM? */
303 struct nfs4_replay so_replay;
304};
305
306/*
307* nfs4_file: a file opened by some number of (open) nfs4_stateowners.
308* o fi_perfile list is used to search for conflicting
309* share_acces, share_deny on the file.
310*/
311struct nfs4_file {
312 atomic_t fi_ref;
313 struct list_head fi_hash; /* hash by "struct inode *" */
314 struct list_head fi_stateids;
315 struct list_head fi_delegations;
316 struct inode *fi_inode;
317 u32 fi_id; /* used with stateowner->so_id
318 * for stateid_hashtbl hash */
319 bool fi_had_conflict;
320};
321
322/*
323* nfs4_stateid can either be an open stateid or (eventually) a lock stateid
324*
325* (open)nfs4_stateid: one per (open)nfs4_stateowner, nfs4_file
326*
327* st_hash: stateid_hashtbl[] entry or lockstateid_hashtbl entry
328* st_perfile: file_hashtbl[] entry.
329* st_perfile_state: nfs4_stateowner->so_perfilestate
330* st_perlockowner: (open stateid) list of lock nfs4_stateowners
331* st_access_bmap: used only for open stateid
332* st_deny_bmap: used only for open stateid
333* st_openstp: open stateid lock stateid was derived from
334*
335* XXX: open stateids and lock stateids have diverged sufficiently that
336* we should consider defining separate structs for the two cases.
337*/
338
339struct nfs4_stateid {
340 struct list_head st_hash;
341 struct list_head st_perfile;
342 struct list_head st_perstateowner;
343 struct list_head st_lockowners;
344 struct nfs4_stateowner * st_stateowner;
345 struct nfs4_file * st_file;
346 stateid_t st_stateid;
347 struct file * st_vfs_file;
348 unsigned long st_access_bmap;
349 unsigned long st_deny_bmap;
350 struct nfs4_stateid * st_openstp;
351};
352
353/* flags for preprocess_seqid_op() */
354#define HAS_SESSION 0x00000001
355#define CONFIRM 0x00000002
356#define OPEN_STATE 0x00000004
357#define LOCK_STATE 0x00000008
358#define RD_STATE 0x00000010
359#define WR_STATE 0x00000020
360#define CLOSE_STATE 0x00000040
361
362#define seqid_mutating_err(err) \
363 (((err) != nfserr_stale_clientid) && \
364 ((err) != nfserr_bad_seqid) && \
365 ((err) != nfserr_stale_stateid) && \
366 ((err) != nfserr_bad_stateid))
367
368struct nfsd4_compound_state;
369
370extern __be32 nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
371 stateid_t *stateid, int flags, struct file **filp);
372extern void nfs4_lock_state(void);
373extern void nfs4_unlock_state(void);
374extern int nfs4_in_grace(void);
375extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
376extern void put_nfs4_client(struct nfs4_client *clp);
377extern void nfs4_free_stateowner(struct kref *kref);
378extern int set_callback_cred(void);
379extern void nfsd4_probe_callback(struct nfs4_client *clp);
380extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
381extern void nfs4_put_delegation(struct nfs4_delegation *dp);
382extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
383extern void nfsd4_init_recdir(char *recdir_name);
384extern int nfsd4_recdir_load(void);
385extern void nfsd4_shutdown_recdir(void);
386extern int nfs4_client_to_reclaim(const char *name);
387extern int nfs4_has_reclaimed_state(const char *name, bool use_exchange_id);
388extern void nfsd4_recdir_purge_old(void);
389extern int nfsd4_create_clid_dir(struct nfs4_client *clp);
390extern void nfsd4_remove_clid_dir(struct nfs4_client *clp);
391
392static inline void
393nfs4_put_stateowner(struct nfs4_stateowner *so)
394{
395 kref_put(&so->so_ref, nfs4_free_stateowner);
396}
397
398static inline void
399nfs4_get_stateowner(struct nfs4_stateowner *so)
400{
401 kref_get(&so->so_ref);
402}
403
404#endif /* NFSD4_STATE_H */
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h
index 7a3b565b898f..812bc1e160dc 100644
--- a/include/linux/nfsd/syscall.h
+++ b/include/linux/nfsd/syscall.h
@@ -9,14 +9,8 @@
9#ifndef NFSD_SYSCALL_H 9#ifndef NFSD_SYSCALL_H
10#define NFSD_SYSCALL_H 10#define NFSD_SYSCALL_H
11 11
12# include <linux/types.h> 12#include <linux/types.h>
13#ifdef __KERNEL__
14# include <linux/in.h>
15#endif
16#include <linux/posix_types.h>
17#include <linux/nfsd/const.h>
18#include <linux/nfsd/export.h> 13#include <linux/nfsd/export.h>
19#include <linux/nfsd/nfsfh.h>
20 14
21/* 15/*
22 * Version of the syscall interface 16 * Version of the syscall interface
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
deleted file mode 100644
index a0132ef58f21..000000000000
--- a/include/linux/nfsd/xdr.h
+++ /dev/null
@@ -1,177 +0,0 @@
1/*
2 * linux/include/linux/nfsd/xdr.h
3 *
4 * XDR types for nfsd. This is mainly a typing exercise.
5 */
6
7#ifndef LINUX_NFSD_H
8#define LINUX_NFSD_H
9
10#include <linux/fs.h>
11#include <linux/vfs.h>
12#include <linux/nfs.h>
13
14struct nfsd_fhandle {
15 struct svc_fh fh;
16};
17
18struct nfsd_sattrargs {
19 struct svc_fh fh;
20 struct iattr attrs;
21};
22
23struct nfsd_diropargs {
24 struct svc_fh fh;
25 char * name;
26 unsigned int len;
27};
28
29struct nfsd_readargs {
30 struct svc_fh fh;
31 __u32 offset;
32 __u32 count;
33 int vlen;
34};
35
36struct nfsd_writeargs {
37 svc_fh fh;
38 __u32 offset;
39 int len;
40 int vlen;
41};
42
43struct nfsd_createargs {
44 struct svc_fh fh;
45 char * name;
46 unsigned int len;
47 struct iattr attrs;
48};
49
50struct nfsd_renameargs {
51 struct svc_fh ffh;
52 char * fname;
53 unsigned int flen;
54 struct svc_fh tfh;
55 char * tname;
56 unsigned int tlen;
57};
58
59struct nfsd_readlinkargs {
60 struct svc_fh fh;
61 char * buffer;
62};
63
64struct nfsd_linkargs {
65 struct svc_fh ffh;
66 struct svc_fh tfh;
67 char * tname;
68 unsigned int tlen;
69};
70
71struct nfsd_symlinkargs {
72 struct svc_fh ffh;
73 char * fname;
74 unsigned int flen;
75 char * tname;
76 unsigned int tlen;
77 struct iattr attrs;
78};
79
80struct nfsd_readdirargs {
81 struct svc_fh fh;
82 __u32 cookie;
83 __u32 count;
84 __be32 * buffer;
85};
86
87struct nfsd_attrstat {
88 struct svc_fh fh;
89 struct kstat stat;
90};
91
92struct nfsd_diropres {
93 struct svc_fh fh;
94 struct kstat stat;
95};
96
97struct nfsd_readlinkres {
98 int len;
99};
100
101struct nfsd_readres {
102 struct svc_fh fh;
103 unsigned long count;
104 struct kstat stat;
105};
106
107struct nfsd_readdirres {
108 int count;
109
110 struct readdir_cd common;
111 __be32 * buffer;
112 int buflen;
113 __be32 * offset;
114};
115
116struct nfsd_statfsres {
117 struct kstatfs stats;
118};
119
120/*
121 * Storage requirements for XDR arguments and results.
122 */
123union nfsd_xdrstore {
124 struct nfsd_sattrargs sattr;
125 struct nfsd_diropargs dirop;
126 struct nfsd_readargs read;
127 struct nfsd_writeargs write;
128 struct nfsd_createargs create;
129 struct nfsd_renameargs rename;
130 struct nfsd_linkargs link;
131 struct nfsd_symlinkargs symlink;
132 struct nfsd_readdirargs readdir;
133};
134
135#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
136
137
138int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *);
139int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
140int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *,
141 struct nfsd_sattrargs *);
142int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *,
143 struct nfsd_diropargs *);
144int nfssvc_decode_readargs(struct svc_rqst *, __be32 *,
145 struct nfsd_readargs *);
146int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *,
147 struct nfsd_writeargs *);
148int nfssvc_decode_createargs(struct svc_rqst *, __be32 *,
149 struct nfsd_createargs *);
150int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *,
151 struct nfsd_renameargs *);
152int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *,
153 struct nfsd_readlinkargs *);
154int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *,
155 struct nfsd_linkargs *);
156int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *,
157 struct nfsd_symlinkargs *);
158int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *,
159 struct nfsd_readdirargs *);
160int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *);
161int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *);
162int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *);
163int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *);
164int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *);
165int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *);
166int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *);
167
168int nfssvc_encode_entry(void *, const char *name,
169 int namlen, loff_t offset, u64 ino, unsigned int);
170
171int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
172
173/* Helper functions for NFSv2 ACL code */
174__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp);
175__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp);
176
177#endif /* LINUX_NFSD_H */
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
deleted file mode 100644
index 421eddd65a25..000000000000
--- a/include/linux/nfsd/xdr3.h
+++ /dev/null
@@ -1,346 +0,0 @@
1/*
2 * linux/include/linux/nfsd/xdr3.h
3 *
4 * XDR types for NFSv3 in nfsd.
5 *
6 * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef _LINUX_NFSD_XDR3_H
10#define _LINUX_NFSD_XDR3_H
11
12#include <linux/nfsd/xdr.h>
13
14struct nfsd3_sattrargs {
15 struct svc_fh fh;
16 struct iattr attrs;
17 int check_guard;
18 time_t guardtime;
19};
20
21struct nfsd3_diropargs {
22 struct svc_fh fh;
23 char * name;
24 unsigned int len;
25};
26
27struct nfsd3_accessargs {
28 struct svc_fh fh;
29 unsigned int access;
30};
31
32struct nfsd3_readargs {
33 struct svc_fh fh;
34 __u64 offset;
35 __u32 count;
36 int vlen;
37};
38
39struct nfsd3_writeargs {
40 svc_fh fh;
41 __u64 offset;
42 __u32 count;
43 int stable;
44 __u32 len;
45 int vlen;
46};
47
48struct nfsd3_createargs {
49 struct svc_fh fh;
50 char * name;
51 unsigned int len;
52 int createmode;
53 struct iattr attrs;
54 __be32 * verf;
55};
56
57struct nfsd3_mknodargs {
58 struct svc_fh fh;
59 char * name;
60 unsigned int len;
61 __u32 ftype;
62 __u32 major, minor;
63 struct iattr attrs;
64};
65
66struct nfsd3_renameargs {
67 struct svc_fh ffh;
68 char * fname;
69 unsigned int flen;
70 struct svc_fh tfh;
71 char * tname;
72 unsigned int tlen;
73};
74
75struct nfsd3_readlinkargs {
76 struct svc_fh fh;
77 char * buffer;
78};
79
80struct nfsd3_linkargs {
81 struct svc_fh ffh;
82 struct svc_fh tfh;
83 char * tname;
84 unsigned int tlen;
85};
86
87struct nfsd3_symlinkargs {
88 struct svc_fh ffh;
89 char * fname;
90 unsigned int flen;
91 char * tname;
92 unsigned int tlen;
93 struct iattr attrs;
94};
95
96struct nfsd3_readdirargs {
97 struct svc_fh fh;
98 __u64 cookie;
99 __u32 dircount;
100 __u32 count;
101 __be32 * verf;
102 __be32 * buffer;
103};
104
105struct nfsd3_commitargs {
106 struct svc_fh fh;
107 __u64 offset;
108 __u32 count;
109};
110
111struct nfsd3_getaclargs {
112 struct svc_fh fh;
113 int mask;
114};
115
116struct posix_acl;
117struct nfsd3_setaclargs {
118 struct svc_fh fh;
119 int mask;
120 struct posix_acl *acl_access;
121 struct posix_acl *acl_default;
122};
123
124struct nfsd3_attrstat {
125 __be32 status;
126 struct svc_fh fh;
127 struct kstat stat;
128};
129
130/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
131struct nfsd3_diropres {
132 __be32 status;
133 struct svc_fh dirfh;
134 struct svc_fh fh;
135};
136
137struct nfsd3_accessres {
138 __be32 status;
139 struct svc_fh fh;
140 __u32 access;
141};
142
143struct nfsd3_readlinkres {
144 __be32 status;
145 struct svc_fh fh;
146 __u32 len;
147};
148
149struct nfsd3_readres {
150 __be32 status;
151 struct svc_fh fh;
152 unsigned long count;
153 int eof;
154};
155
156struct nfsd3_writeres {
157 __be32 status;
158 struct svc_fh fh;
159 unsigned long count;
160 int committed;
161};
162
163struct nfsd3_renameres {
164 __be32 status;
165 struct svc_fh ffh;
166 struct svc_fh tfh;
167};
168
169struct nfsd3_linkres {
170 __be32 status;
171 struct svc_fh tfh;
172 struct svc_fh fh;
173};
174
175struct nfsd3_readdirres {
176 __be32 status;
177 struct svc_fh fh;
178 int count;
179 __be32 verf[2];
180
181 struct readdir_cd common;
182 __be32 * buffer;
183 int buflen;
184 __be32 * offset;
185 __be32 * offset1;
186 struct svc_rqst * rqstp;
187
188};
189
190struct nfsd3_fsstatres {
191 __be32 status;
192 struct kstatfs stats;
193 __u32 invarsec;
194};
195
196struct nfsd3_fsinfores {
197 __be32 status;
198 __u32 f_rtmax;
199 __u32 f_rtpref;
200 __u32 f_rtmult;
201 __u32 f_wtmax;
202 __u32 f_wtpref;
203 __u32 f_wtmult;
204 __u32 f_dtpref;
205 __u64 f_maxfilesize;
206 __u32 f_properties;
207};
208
209struct nfsd3_pathconfres {
210 __be32 status;
211 __u32 p_link_max;
212 __u32 p_name_max;
213 __u32 p_no_trunc;
214 __u32 p_chown_restricted;
215 __u32 p_case_insensitive;
216 __u32 p_case_preserving;
217};
218
219struct nfsd3_commitres {
220 __be32 status;
221 struct svc_fh fh;
222};
223
224struct nfsd3_getaclres {
225 __be32 status;
226 struct svc_fh fh;
227 int mask;
228 struct posix_acl *acl_access;
229 struct posix_acl *acl_default;
230};
231
232/* dummy type for release */
233struct nfsd3_fhandle_pair {
234 __u32 dummy;
235 struct svc_fh fh1;
236 struct svc_fh fh2;
237};
238
239/*
240 * Storage requirements for XDR arguments and results.
241 */
242union nfsd3_xdrstore {
243 struct nfsd3_sattrargs sattrargs;
244 struct nfsd3_diropargs diropargs;
245 struct nfsd3_readargs readargs;
246 struct nfsd3_writeargs writeargs;
247 struct nfsd3_createargs createargs;
248 struct nfsd3_renameargs renameargs;
249 struct nfsd3_linkargs linkargs;
250 struct nfsd3_symlinkargs symlinkargs;
251 struct nfsd3_readdirargs readdirargs;
252 struct nfsd3_diropres diropres;
253 struct nfsd3_accessres accessres;
254 struct nfsd3_readlinkres readlinkres;
255 struct nfsd3_readres readres;
256 struct nfsd3_writeres writeres;
257 struct nfsd3_renameres renameres;
258 struct nfsd3_linkres linkres;
259 struct nfsd3_readdirres readdirres;
260 struct nfsd3_fsstatres fsstatres;
261 struct nfsd3_fsinfores fsinfores;
262 struct nfsd3_pathconfres pathconfres;
263 struct nfsd3_commitres commitres;
264 struct nfsd3_getaclres getaclres;
265};
266
267#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
268
269int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
270int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *,
271 struct nfsd3_sattrargs *);
272int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *,
273 struct nfsd3_diropargs *);
274int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *,
275 struct nfsd3_accessargs *);
276int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *,
277 struct nfsd3_readargs *);
278int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *,
279 struct nfsd3_writeargs *);
280int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *,
281 struct nfsd3_createargs *);
282int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *,
283 struct nfsd3_createargs *);
284int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *,
285 struct nfsd3_mknodargs *);
286int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *,
287 struct nfsd3_renameargs *);
288int nfs3svc_decode_readlinkargs(struct svc_rqst *, __be32 *,
289 struct nfsd3_readlinkargs *);
290int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *,
291 struct nfsd3_linkargs *);
292int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *,
293 struct nfsd3_symlinkargs *);
294int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *,
295 struct nfsd3_readdirargs *);
296int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *,
297 struct nfsd3_readdirargs *);
298int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *,
299 struct nfsd3_commitargs *);
300int nfs3svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
301int nfs3svc_encode_attrstat(struct svc_rqst *, __be32 *,
302 struct nfsd3_attrstat *);
303int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *,
304 struct nfsd3_attrstat *);
305int nfs3svc_encode_diropres(struct svc_rqst *, __be32 *,
306 struct nfsd3_diropres *);
307int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *,
308 struct nfsd3_accessres *);
309int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *,
310 struct nfsd3_readlinkres *);
311int nfs3svc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd3_readres *);
312int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *, struct nfsd3_writeres *);
313int nfs3svc_encode_createres(struct svc_rqst *, __be32 *,
314 struct nfsd3_diropres *);
315int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *,
316 struct nfsd3_renameres *);
317int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *,
318 struct nfsd3_linkres *);
319int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *,
320 struct nfsd3_readdirres *);
321int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *,
322 struct nfsd3_fsstatres *);
323int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *,
324 struct nfsd3_fsinfores *);
325int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *,
326 struct nfsd3_pathconfres *);
327int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *,
328 struct nfsd3_commitres *);
329
330int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *,
331 struct nfsd3_attrstat *);
332int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *,
333 struct nfsd3_fhandle_pair *);
334int nfs3svc_encode_entry(void *, const char *name,
335 int namlen, loff_t offset, u64 ino,
336 unsigned int);
337int nfs3svc_encode_entry_plus(void *, const char *name,
338 int namlen, loff_t offset, u64 ino,
339 unsigned int);
340/* Helper functions for NFSv3 ACL code */
341__be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p,
342 struct svc_fh *fhp);
343__be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp);
344
345
346#endif /* _LINUX_NFSD_XDR3_H */
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
deleted file mode 100644
index 73164c2b3d29..000000000000
--- a/include/linux/nfsd/xdr4.h
+++ /dev/null
@@ -1,563 +0,0 @@
1/*
2 * include/linux/nfsd/xdr4.h
3 *
4 * Server-side types for NFSv4.
5 *
6 * Copyright (c) 2002 The Regents of the University of Michigan.
7 * All rights reserved.
8 *
9 * Kendrick Smith <kmsmith@umich.edu>
10 * Andy Adamson <andros@umich.edu>
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. Neither the name of the University nor the names of its
22 * contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 */
38
39#ifndef _LINUX_NFSD_XDR4_H
40#define _LINUX_NFSD_XDR4_H
41
42#include <linux/nfs4.h>
43
44#define NFSD4_MAX_TAGLEN 128
45#define XDR_LEN(n) (((n) + 3) & ~3)
46
47struct nfsd4_compound_state {
48 struct svc_fh current_fh;
49 struct svc_fh save_fh;
50 struct nfs4_stateowner *replay_owner;
51 /* For sessions DRC */
52 struct nfsd4_session *session;
53 struct nfsd4_slot *slot;
54 __be32 *datap;
55 size_t iovlen;
56 u32 minorversion;
57 u32 status;
58};
59
60static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
61{
62 return cs->slot != NULL;
63}
64
65struct nfsd4_change_info {
66 u32 atomic;
67 bool change_supported;
68 u32 before_ctime_sec;
69 u32 before_ctime_nsec;
70 u64 before_change;
71 u32 after_ctime_sec;
72 u32 after_ctime_nsec;
73 u64 after_change;
74};
75
76struct nfsd4_access {
77 u32 ac_req_access; /* request */
78 u32 ac_supported; /* response */
79 u32 ac_resp_access; /* response */
80};
81
82struct nfsd4_close {
83 u32 cl_seqid; /* request */
84 stateid_t cl_stateid; /* request+response */
85 struct nfs4_stateowner * cl_stateowner; /* response */
86};
87
88struct nfsd4_commit {
89 u64 co_offset; /* request */
90 u32 co_count; /* request */
91 nfs4_verifier co_verf; /* response */
92};
93
94struct nfsd4_create {
95 u32 cr_namelen; /* request */
96 char * cr_name; /* request */
97 u32 cr_type; /* request */
98 union { /* request */
99 struct {
100 u32 namelen;
101 char *name;
102 } link; /* NF4LNK */
103 struct {
104 u32 specdata1;
105 u32 specdata2;
106 } dev; /* NF4BLK, NF4CHR */
107 } u;
108 u32 cr_bmval[3]; /* request */
109 struct iattr cr_iattr; /* request */
110 struct nfsd4_change_info cr_cinfo; /* response */
111 struct nfs4_acl *cr_acl;
112};
113#define cr_linklen u.link.namelen
114#define cr_linkname u.link.name
115#define cr_specdata1 u.dev.specdata1
116#define cr_specdata2 u.dev.specdata2
117
118struct nfsd4_delegreturn {
119 stateid_t dr_stateid;
120};
121
122struct nfsd4_getattr {
123 u32 ga_bmval[3]; /* request */
124 struct svc_fh *ga_fhp; /* response */
125};
126
127struct nfsd4_link {
128 u32 li_namelen; /* request */
129 char * li_name; /* request */
130 struct nfsd4_change_info li_cinfo; /* response */
131};
132
133struct nfsd4_lock_denied {
134 clientid_t ld_clientid;
135 struct nfs4_stateowner *ld_sop;
136 u64 ld_start;
137 u64 ld_length;
138 u32 ld_type;
139};
140
141struct nfsd4_lock {
142 /* request */
143 u32 lk_type;
144 u32 lk_reclaim; /* boolean */
145 u64 lk_offset;
146 u64 lk_length;
147 u32 lk_is_new;
148 union {
149 struct {
150 u32 open_seqid;
151 stateid_t open_stateid;
152 u32 lock_seqid;
153 clientid_t clientid;
154 struct xdr_netobj owner;
155 } new;
156 struct {
157 stateid_t lock_stateid;
158 u32 lock_seqid;
159 } old;
160 } v;
161
162 /* response */
163 union {
164 struct {
165 stateid_t stateid;
166 } ok;
167 struct nfsd4_lock_denied denied;
168 } u;
169 /* The lk_replay_owner is the open owner in the open_to_lock_owner
170 * case and the lock owner otherwise: */
171 struct nfs4_stateowner *lk_replay_owner;
172};
173#define lk_new_open_seqid v.new.open_seqid
174#define lk_new_open_stateid v.new.open_stateid
175#define lk_new_lock_seqid v.new.lock_seqid
176#define lk_new_clientid v.new.clientid
177#define lk_new_owner v.new.owner
178#define lk_old_lock_stateid v.old.lock_stateid
179#define lk_old_lock_seqid v.old.lock_seqid
180
181#define lk_rflags u.ok.rflags
182#define lk_resp_stateid u.ok.stateid
183#define lk_denied u.denied
184
185
186struct nfsd4_lockt {
187 u32 lt_type;
188 clientid_t lt_clientid;
189 struct xdr_netobj lt_owner;
190 u64 lt_offset;
191 u64 lt_length;
192 struct nfs4_stateowner * lt_stateowner;
193 struct nfsd4_lock_denied lt_denied;
194};
195
196
197struct nfsd4_locku {
198 u32 lu_type;
199 u32 lu_seqid;
200 stateid_t lu_stateid;
201 u64 lu_offset;
202 u64 lu_length;
203 struct nfs4_stateowner *lu_stateowner;
204};
205
206
207struct nfsd4_lookup {
208 u32 lo_len; /* request */
209 char * lo_name; /* request */
210};
211
212struct nfsd4_putfh {
213 u32 pf_fhlen; /* request */
214 char *pf_fhval; /* request */
215};
216
217struct nfsd4_open {
218 u32 op_claim_type; /* request */
219 struct xdr_netobj op_fname; /* request - everything but CLAIM_PREV */
220 u32 op_delegate_type; /* request - CLAIM_PREV only */
221 stateid_t op_delegate_stateid; /* request - response */
222 u32 op_create; /* request */
223 u32 op_createmode; /* request */
224 u32 op_bmval[3]; /* request */
225 struct iattr iattr; /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */
226 nfs4_verifier verf; /* EXCLUSIVE4 */
227 clientid_t op_clientid; /* request */
228 struct xdr_netobj op_owner; /* request */
229 u32 op_seqid; /* request */
230 u32 op_share_access; /* request */
231 u32 op_share_deny; /* request */
232 stateid_t op_stateid; /* response */
233 u32 op_recall; /* recall */
234 struct nfsd4_change_info op_cinfo; /* response */
235 u32 op_rflags; /* response */
236 int op_truncate; /* used during processing */
237 struct nfs4_stateowner *op_stateowner; /* used during processing */
238 struct nfs4_acl *op_acl;
239};
240#define op_iattr iattr
241#define op_verf verf
242
243struct nfsd4_open_confirm {
244 stateid_t oc_req_stateid /* request */;
245 u32 oc_seqid /* request */;
246 stateid_t oc_resp_stateid /* response */;
247 struct nfs4_stateowner * oc_stateowner; /* response */
248};
249
250struct nfsd4_open_downgrade {
251 stateid_t od_stateid;
252 u32 od_seqid;
253 u32 od_share_access;
254 u32 od_share_deny;
255 struct nfs4_stateowner *od_stateowner;
256};
257
258
259struct nfsd4_read {
260 stateid_t rd_stateid; /* request */
261 u64 rd_offset; /* request */
262 u32 rd_length; /* request */
263 int rd_vlen;
264 struct file *rd_filp;
265
266 struct svc_rqst *rd_rqstp; /* response */
267 struct svc_fh * rd_fhp; /* response */
268};
269
270struct nfsd4_readdir {
271 u64 rd_cookie; /* request */
272 nfs4_verifier rd_verf; /* request */
273 u32 rd_dircount; /* request */
274 u32 rd_maxcount; /* request */
275 u32 rd_bmval[3]; /* request */
276 struct svc_rqst *rd_rqstp; /* response */
277 struct svc_fh * rd_fhp; /* response */
278
279 struct readdir_cd common;
280 __be32 * buffer;
281 int buflen;
282 __be32 * offset;
283};
284
285struct nfsd4_release_lockowner {
286 clientid_t rl_clientid;
287 struct xdr_netobj rl_owner;
288};
289struct nfsd4_readlink {
290 struct svc_rqst *rl_rqstp; /* request */
291 struct svc_fh * rl_fhp; /* request */
292};
293
294struct nfsd4_remove {
295 u32 rm_namelen; /* request */
296 char * rm_name; /* request */
297 struct nfsd4_change_info rm_cinfo; /* response */
298};
299
300struct nfsd4_rename {
301 u32 rn_snamelen; /* request */
302 char * rn_sname; /* request */
303 u32 rn_tnamelen; /* request */
304 char * rn_tname; /* request */
305 struct nfsd4_change_info rn_sinfo; /* response */
306 struct nfsd4_change_info rn_tinfo; /* response */
307};
308
309struct nfsd4_secinfo {
310 u32 si_namelen; /* request */
311 char *si_name; /* request */
312 struct svc_export *si_exp; /* response */
313};
314
315struct nfsd4_setattr {
316 stateid_t sa_stateid; /* request */
317 u32 sa_bmval[3]; /* request */
318 struct iattr sa_iattr; /* request */
319 struct nfs4_acl *sa_acl;
320};
321
322struct nfsd4_setclientid {
323 nfs4_verifier se_verf; /* request */
324 u32 se_namelen; /* request */
325 char * se_name; /* request */
326 u32 se_callback_prog; /* request */
327 u32 se_callback_netid_len; /* request */
328 char * se_callback_netid_val; /* request */
329 u32 se_callback_addr_len; /* request */
330 char * se_callback_addr_val; /* request */
331 u32 se_callback_ident; /* request */
332 clientid_t se_clientid; /* response */
333 nfs4_verifier se_confirm; /* response */
334};
335
336struct nfsd4_setclientid_confirm {
337 clientid_t sc_clientid;
338 nfs4_verifier sc_confirm;
339};
340
341/* also used for NVERIFY */
342struct nfsd4_verify {
343 u32 ve_bmval[3]; /* request */
344 u32 ve_attrlen; /* request */
345 char * ve_attrval; /* request */
346};
347
348struct nfsd4_write {
349 stateid_t wr_stateid; /* request */
350 u64 wr_offset; /* request */
351 u32 wr_stable_how; /* request */
352 u32 wr_buflen; /* request */
353 int wr_vlen;
354
355 u32 wr_bytes_written; /* response */
356 u32 wr_how_written; /* response */
357 nfs4_verifier wr_verifier; /* response */
358};
359
360struct nfsd4_exchange_id {
361 nfs4_verifier verifier;
362 struct xdr_netobj clname;
363 u32 flags;
364 clientid_t clientid;
365 u32 seqid;
366 int spa_how;
367};
368
369struct nfsd4_sequence {
370 struct nfs4_sessionid sessionid; /* request/response */
371 u32 seqid; /* request/response */
372 u32 slotid; /* request/response */
373 u32 maxslots; /* request/response */
374 u32 cachethis; /* request */
375#if 0
376 u32 target_maxslots; /* response */
377 u32 status_flags; /* response */
378#endif /* not yet */
379};
380
381struct nfsd4_destroy_session {
382 struct nfs4_sessionid sessionid;
383};
384
385struct nfsd4_op {
386 int opnum;
387 __be32 status;
388 union {
389 struct nfsd4_access access;
390 struct nfsd4_close close;
391 struct nfsd4_commit commit;
392 struct nfsd4_create create;
393 struct nfsd4_delegreturn delegreturn;
394 struct nfsd4_getattr getattr;
395 struct svc_fh * getfh;
396 struct nfsd4_link link;
397 struct nfsd4_lock lock;
398 struct nfsd4_lockt lockt;
399 struct nfsd4_locku locku;
400 struct nfsd4_lookup lookup;
401 struct nfsd4_verify nverify;
402 struct nfsd4_open open;
403 struct nfsd4_open_confirm open_confirm;
404 struct nfsd4_open_downgrade open_downgrade;
405 struct nfsd4_putfh putfh;
406 struct nfsd4_read read;
407 struct nfsd4_readdir readdir;
408 struct nfsd4_readlink readlink;
409 struct nfsd4_remove remove;
410 struct nfsd4_rename rename;
411 clientid_t renew;
412 struct nfsd4_secinfo secinfo;
413 struct nfsd4_setattr setattr;
414 struct nfsd4_setclientid setclientid;
415 struct nfsd4_setclientid_confirm setclientid_confirm;
416 struct nfsd4_verify verify;
417 struct nfsd4_write write;
418 struct nfsd4_release_lockowner release_lockowner;
419
420 /* NFSv4.1 */
421 struct nfsd4_exchange_id exchange_id;
422 struct nfsd4_create_session create_session;
423 struct nfsd4_destroy_session destroy_session;
424 struct nfsd4_sequence sequence;
425 } u;
426 struct nfs4_replay * replay;
427};
428
429struct nfsd4_compoundargs {
430 /* scratch variables for XDR decode */
431 __be32 * p;
432 __be32 * end;
433 struct page ** pagelist;
434 int pagelen;
435 __be32 tmp[8];
436 __be32 * tmpp;
437 struct tmpbuf {
438 struct tmpbuf *next;
439 void (*release)(const void *);
440 void *buf;
441 } *to_free;
442
443 struct svc_rqst *rqstp;
444
445 u32 taglen;
446 char * tag;
447 u32 minorversion;
448 u32 opcnt;
449 struct nfsd4_op *ops;
450 struct nfsd4_op iops[8];
451};
452
453struct nfsd4_compoundres {
454 /* scratch variables for XDR encode */
455 __be32 * p;
456 __be32 * end;
457 struct xdr_buf * xbuf;
458 struct svc_rqst * rqstp;
459
460 u32 taglen;
461 char * tag;
462 u32 opcnt;
463 __be32 * tagp; /* tag, opcount encode location */
464 struct nfsd4_compound_state cstate;
465};
466
467static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
468{
469 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
470 return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE;
471}
472
473static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
474{
475 return !resp->cstate.slot->sl_cachethis || nfsd4_is_solo_sequence(resp);
476}
477
478#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
479
480static inline void
481set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
482{
483 BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved);
484 cinfo->atomic = 1;
485 cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode);
486 if (cinfo->change_supported) {
487 cinfo->before_change = fhp->fh_pre_change;
488 cinfo->after_change = fhp->fh_post_change;
489 } else {
490 cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec;
491 cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
492 cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec;
493 cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec;
494 }
495}
496
497int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
498int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *,
499 struct nfsd4_compoundargs *);
500int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *,
501 struct nfsd4_compoundres *);
502void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
503void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op);
504__be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
505 struct dentry *dentry, __be32 *buffer, int *countp,
506 u32 *bmval, struct svc_rqst *, int ignore_crossmnt);
507extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
508 struct nfsd4_compound_state *,
509 struct nfsd4_setclientid *setclid);
510extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
511 struct nfsd4_compound_state *,
512 struct nfsd4_setclientid_confirm *setclientid_confirm);
513extern void nfsd4_store_cache_entry(struct nfsd4_compoundres *resp);
514extern __be32 nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp,
515 struct nfsd4_sequence *seq);
516extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp,
517 struct nfsd4_compound_state *,
518struct nfsd4_exchange_id *);
519 extern __be32 nfsd4_create_session(struct svc_rqst *,
520 struct nfsd4_compound_state *,
521 struct nfsd4_create_session *);
522extern __be32 nfsd4_sequence(struct svc_rqst *,
523 struct nfsd4_compound_state *,
524 struct nfsd4_sequence *);
525extern __be32 nfsd4_destroy_session(struct svc_rqst *,
526 struct nfsd4_compound_state *,
527 struct nfsd4_destroy_session *);
528extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *,
529 struct nfsd4_open *open);
530extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
531 struct svc_fh *current_fh, struct nfsd4_open *open);
532extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
533 struct nfsd4_compound_state *, struct nfsd4_open_confirm *oc);
534extern __be32 nfsd4_close(struct svc_rqst *rqstp,
535 struct nfsd4_compound_state *,
536 struct nfsd4_close *close);
537extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp,
538 struct nfsd4_compound_state *,
539 struct nfsd4_open_downgrade *od);
540extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
541 struct nfsd4_lock *lock);
542extern __be32 nfsd4_lockt(struct svc_rqst *rqstp,
543 struct nfsd4_compound_state *,
544 struct nfsd4_lockt *lockt);
545extern __be32 nfsd4_locku(struct svc_rqst *rqstp,
546 struct nfsd4_compound_state *,
547 struct nfsd4_locku *locku);
548extern __be32
549nfsd4_release_lockowner(struct svc_rqst *rqstp,
550 struct nfsd4_compound_state *,
551 struct nfsd4_release_lockowner *rlockowner);
552extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *);
553extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp,
554 struct nfsd4_compound_state *, struct nfsd4_delegreturn *dr);
555extern __be32 nfsd4_renew(struct svc_rqst *rqstp,
556 struct nfsd4_compound_state *, clientid_t *clid);
557#endif
558
559/*
560 * Local variables:
561 * c-basic-offset: 8
562 * End:
563 */
diff --git a/include/linux/node.h b/include/linux/node.h
index 681a697b9a86..06292dac3eab 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -21,13 +21,19 @@
21 21
22#include <linux/sysdev.h> 22#include <linux/sysdev.h>
23#include <linux/cpumask.h> 23#include <linux/cpumask.h>
24#include <linux/workqueue.h>
24 25
25struct node { 26struct node {
26 struct sys_device sysdev; 27 struct sys_device sysdev;
28
29#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
30 struct work_struct node_work;
31#endif
27}; 32};
28 33
29struct memory_block; 34struct memory_block;
30extern struct node node_devices[]; 35extern struct node node_devices[];
36typedef void (*node_registration_func_t)(struct node *);
31 37
32extern int register_node(struct node *, int, struct node *); 38extern int register_node(struct node *, int, struct node *);
33extern void unregister_node(struct node *node); 39extern void unregister_node(struct node *node);
@@ -39,6 +45,11 @@ extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
39extern int register_mem_sect_under_node(struct memory_block *mem_blk, 45extern int register_mem_sect_under_node(struct memory_block *mem_blk,
40 int nid); 46 int nid);
41extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk); 47extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk);
48
49#ifdef CONFIG_HUGETLBFS
50extern void register_hugetlbfs_with_node(node_registration_func_t doregister,
51 node_registration_func_t unregister);
52#endif
42#else 53#else
43static inline int register_one_node(int nid) 54static inline int register_one_node(int nid)
44{ 55{
@@ -65,6 +76,11 @@ static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
65{ 76{
66 return 0; 77 return 0;
67} 78}
79
80static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
81 node_registration_func_t unreg)
82{
83}
68#endif 84#endif
69 85
70#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 86#define to_node(sys_device) container_of(sys_device, struct node, sysdev)
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index b359c4a9ec9e..454997cccbd8 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -245,14 +245,19 @@ static inline int __next_node(int n, const nodemask_t *srcp)
245 return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1)); 245 return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1));
246} 246}
247 247
248static inline void init_nodemask_of_node(nodemask_t *mask, int node)
249{
250 nodes_clear(*mask);
251 node_set(node, *mask);
252}
253
248#define nodemask_of_node(node) \ 254#define nodemask_of_node(node) \
249({ \ 255({ \
250 typeof(_unused_nodemask_arg_) m; \ 256 typeof(_unused_nodemask_arg_) m; \
251 if (sizeof(m) == sizeof(unsigned long)) { \ 257 if (sizeof(m) == sizeof(unsigned long)) { \
252 m.bits[0] = 1UL<<(node); \ 258 m.bits[0] = 1UL << (node); \
253 } else { \ 259 } else { \
254 nodes_clear(m); \ 260 init_nodemask_of_node(&m, (node)); \
255 node_set((node), m); \
256 } \ 261 } \
257 m; \ 262 m; \
258}) 263})
@@ -480,15 +485,17 @@ static inline int num_node_state(enum node_states state)
480#define for_each_online_node(node) for_each_node_state(node, N_ONLINE) 485#define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
481 486
482/* 487/*
483 * For nodemask scrach area.(See CPUMASK_ALLOC() in cpumask.h) 488 * For nodemask scrach area.
489 * NODEMASK_ALLOC(type, name) allocates an object with a specified type and
490 * name.
484 */ 491 */
485 492#if NODES_SHIFT > 8 /* nodemask_t > 256 bytes */
486#if NODES_SHIFT > 8 /* nodemask_t > 64 bytes */ 493#define NODEMASK_ALLOC(type, name, gfp_flags) \
487#define NODEMASK_ALLOC(x, m) struct x *m = kmalloc(sizeof(*m), GFP_KERNEL) 494 type *name = kmalloc(sizeof(*name), gfp_flags)
488#define NODEMASK_FREE(m) kfree(m) 495#define NODEMASK_FREE(m) kfree(m)
489#else 496#else
490#define NODEMASK_ALLOC(x, m) struct x _m, *m = &_m 497#define NODEMASK_ALLOC(type, name, gfp_flags) type _name, *name = &_name
491#define NODEMASK_FREE(m) 498#define NODEMASK_FREE(m) do {} while (0)
492#endif 499#endif
493 500
494/* A example struture for using NODEMASK_ALLOC, used in mempolicy. */ 501/* A example struture for using NODEMASK_ALLOC, used in mempolicy. */
@@ -497,8 +504,10 @@ struct nodemask_scratch {
497 nodemask_t mask2; 504 nodemask_t mask2;
498}; 505};
499 506
500#define NODEMASK_SCRATCH(x) NODEMASK_ALLOC(nodemask_scratch, x) 507#define NODEMASK_SCRATCH(x) \
501#define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x) 508 NODEMASK_ALLOC(struct nodemask_scratch, x, \
509 GFP_KERNEL | __GFP_NORETRY)
510#define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x)
502 511
503 512
504#endif /* __LINUX_NODEMASK_H */ 513#endif /* __LINUX_NODEMASK_H */
diff --git a/include/linux/numa.h b/include/linux/numa.h
index a31a7301b159..3aaa31603a86 100644
--- a/include/linux/numa.h
+++ b/include/linux/numa.h
@@ -10,4 +10,6 @@
10 10
11#define MAX_NUMNODES (1 << NODES_SHIFT) 11#define MAX_NUMNODES (1 << NODES_SHIFT)
12 12
13#define NUMA_NO_NODE (-1)
14
13#endif /* _LINUX_NUMA_H */ 15#endif /* _LINUX_NUMA_H */
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 6aac5fe4f6f1..537662315627 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -10,6 +10,7 @@
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/nodemask.h>
13 14
14struct zonelist; 15struct zonelist;
15struct notifier_block; 16struct notifier_block;
@@ -26,7 +27,8 @@ enum oom_constraint {
26extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags); 27extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags);
27extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 28extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
28 29
29extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); 30extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
31 int order, nodemask_t *mask);
30extern int register_oom_notifier(struct notifier_block *nb); 32extern int register_oom_notifier(struct notifier_block *nb);
31extern int unregister_oom_notifier(struct notifier_block *nb); 33extern int unregister_oom_notifier(struct notifier_block *nb);
32 34
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 6b202b173955..49e907bd067f 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -99,7 +99,7 @@ enum pageflags {
99 PG_buddy, /* Page is free, on buddy lists */ 99 PG_buddy, /* Page is free, on buddy lists */
100 PG_swapbacked, /* Page is backed by RAM/swap */ 100 PG_swapbacked, /* Page is backed by RAM/swap */
101 PG_unevictable, /* Page is "unevictable" */ 101 PG_unevictable, /* Page is "unevictable" */
102#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 102#ifdef CONFIG_MMU
103 PG_mlocked, /* Page is vma mlocked */ 103 PG_mlocked, /* Page is vma mlocked */
104#endif 104#endif
105#ifdef CONFIG_ARCH_USES_PG_UNCACHED 105#ifdef CONFIG_ARCH_USES_PG_UNCACHED
@@ -259,12 +259,10 @@ PAGEFLAG_FALSE(SwapCache)
259PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) 259PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
260 TESTCLEARFLAG(Unevictable, unevictable) 260 TESTCLEARFLAG(Unevictable, unevictable)
261 261
262#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 262#ifdef CONFIG_MMU
263#define MLOCK_PAGES 1
264PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) 263PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
265 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked) 264 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked)
266#else 265#else
267#define MLOCK_PAGES 0
268PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked) 266PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked)
269 TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked) 267 TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked)
270#endif 268#endif
@@ -393,7 +391,7 @@ static inline void __ClearPageTail(struct page *page)
393 391
394#endif /* !PAGEFLAGS_EXTENDED */ 392#endif /* !PAGEFLAGS_EXTENDED */
395 393
396#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 394#ifdef CONFIG_MMU
397#define __PG_MLOCKED (1 << PG_mlocked) 395#define __PG_MLOCKED (1 << PG_mlocked)
398#else 396#else
399#define __PG_MLOCKED 0 397#define __PG_MLOCKED 0
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 4b938d4f3ac2..b0e4eb126236 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -57,6 +57,8 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
57static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ 57static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
58 { return test_and_clear_bit(PCG_##lname, &pc->flags); } 58 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
59 59
60TESTPCGFLAG(Locked, LOCK)
61
60/* Cache flag is set only once (at allocation) */ 62/* Cache flag is set only once (at allocation) */
61TESTPCGFLAG(Cache, CACHE) 63TESTPCGFLAG(Cache, CACHE)
62CLEARPCGFLAG(Cache, CACHE) 64CLEARPCGFLAG(Cache, CACHE)
@@ -86,11 +88,6 @@ static inline void lock_page_cgroup(struct page_cgroup *pc)
86 bit_spin_lock(PCG_LOCK, &pc->flags); 88 bit_spin_lock(PCG_LOCK, &pc->flags);
87} 89}
88 90
89static inline int trylock_page_cgroup(struct page_cgroup *pc)
90{
91 return bit_spin_trylock(PCG_LOCK, &pc->flags);
92}
93
94static inline void unlock_page_cgroup(struct page_cgroup *pc) 91static inline void unlock_page_cgroup(struct page_cgroup *pc)
95{ 92{
96 bit_spin_unlock(PCG_LOCK, &pc->flags); 93 bit_spin_unlock(PCG_LOCK, &pc->flags);
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 64a53f74c9a9..da7bdc23f279 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -681,7 +681,7 @@ struct perf_event_context {
681 * Protect the states of the events in the list, 681 * Protect the states of the events in the list,
682 * nr_active, and the list: 682 * nr_active, and the list:
683 */ 683 */
684 spinlock_t lock; 684 raw_spinlock_t lock;
685 /* 685 /*
686 * Protect the list of events. Locking either mutex or lock 686 * Protect the list of events. Locking either mutex or lock
687 * is sufficient to ensure the list doesn't change; to change 687 * is sufficient to ensure the list doesn't change; to change
diff --git a/include/linux/plist.h b/include/linux/plist.h
index 45926d77d6ac..8227f717c70f 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -81,7 +81,8 @@ struct plist_head {
81 struct list_head prio_list; 81 struct list_head prio_list;
82 struct list_head node_list; 82 struct list_head node_list;
83#ifdef CONFIG_DEBUG_PI_LIST 83#ifdef CONFIG_DEBUG_PI_LIST
84 spinlock_t *lock; 84 raw_spinlock_t *rawlock;
85 spinlock_t *spinlock;
85#endif 86#endif
86}; 87};
87 88
@@ -91,9 +92,11 @@ struct plist_node {
91}; 92};
92 93
93#ifdef CONFIG_DEBUG_PI_LIST 94#ifdef CONFIG_DEBUG_PI_LIST
94# define PLIST_HEAD_LOCK_INIT(_lock) .lock = _lock 95# define PLIST_HEAD_LOCK_INIT(_lock) .spinlock = _lock
96# define PLIST_HEAD_LOCK_INIT_RAW(_lock) .rawlock = _lock
95#else 97#else
96# define PLIST_HEAD_LOCK_INIT(_lock) 98# define PLIST_HEAD_LOCK_INIT(_lock)
99# define PLIST_HEAD_LOCK_INIT_RAW(_lock)
97#endif 100#endif
98 101
99#define _PLIST_HEAD_INIT(head) \ 102#define _PLIST_HEAD_INIT(head) \
@@ -107,11 +110,22 @@ struct plist_node {
107 */ 110 */
108#define PLIST_HEAD_INIT(head, _lock) \ 111#define PLIST_HEAD_INIT(head, _lock) \
109{ \ 112{ \
110 _PLIST_HEAD_INIT(head), \ 113 _PLIST_HEAD_INIT(head), \
111 PLIST_HEAD_LOCK_INIT(&(_lock)) \ 114 PLIST_HEAD_LOCK_INIT(&(_lock)) \
112} 115}
113 116
114/** 117/**
118 * PLIST_HEAD_INIT_RAW - static struct plist_head initializer
119 * @head: struct plist_head variable name
120 * @_lock: lock to initialize for this list
121 */
122#define PLIST_HEAD_INIT_RAW(head, _lock) \
123{ \
124 _PLIST_HEAD_INIT(head), \
125 PLIST_HEAD_LOCK_INIT_RAW(&(_lock)) \
126}
127
128/**
115 * PLIST_NODE_INIT - static struct plist_node initializer 129 * PLIST_NODE_INIT - static struct plist_node initializer
116 * @node: struct plist_node variable name 130 * @node: struct plist_node variable name
117 * @__prio: initial node priority 131 * @__prio: initial node priority
@@ -119,13 +133,13 @@ struct plist_node {
119#define PLIST_NODE_INIT(node, __prio) \ 133#define PLIST_NODE_INIT(node, __prio) \
120{ \ 134{ \
121 .prio = (__prio), \ 135 .prio = (__prio), \
122 .plist = { _PLIST_HEAD_INIT((node).plist) }, \ 136 .plist = { _PLIST_HEAD_INIT((node).plist) }, \
123} 137}
124 138
125/** 139/**
126 * plist_head_init - dynamic struct plist_head initializer 140 * plist_head_init - dynamic struct plist_head initializer
127 * @head: &struct plist_head pointer 141 * @head: &struct plist_head pointer
128 * @lock: list spinlock, remembered for debugging 142 * @lock: spinlock protecting the list (debugging)
129 */ 143 */
130static inline void 144static inline void
131plist_head_init(struct plist_head *head, spinlock_t *lock) 145plist_head_init(struct plist_head *head, spinlock_t *lock)
@@ -133,7 +147,24 @@ plist_head_init(struct plist_head *head, spinlock_t *lock)
133 INIT_LIST_HEAD(&head->prio_list); 147 INIT_LIST_HEAD(&head->prio_list);
134 INIT_LIST_HEAD(&head->node_list); 148 INIT_LIST_HEAD(&head->node_list);
135#ifdef CONFIG_DEBUG_PI_LIST 149#ifdef CONFIG_DEBUG_PI_LIST
136 head->lock = lock; 150 head->spinlock = lock;
151 head->rawlock = NULL;
152#endif
153}
154
155/**
156 * plist_head_init_raw - dynamic struct plist_head initializer
157 * @head: &struct plist_head pointer
158 * @lock: raw_spinlock protecting the list (debugging)
159 */
160static inline void
161plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock)
162{
163 INIT_LIST_HEAD(&head->prio_list);
164 INIT_LIST_HEAD(&head->node_list);
165#ifdef CONFIG_DEBUG_PI_LIST
166 head->rawlock = lock;
167 head->spinlock = NULL;
137#endif 168#endif
138} 169}
139 170
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 0d65934246af..198b8f9fe05e 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -219,7 +219,7 @@ struct dev_pm_ops {
219 * to RAM and hibernation. 219 * to RAM and hibernation.
220 */ 220 */
221#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ 221#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
222struct dev_pm_ops name = { \ 222const struct dev_pm_ops name = { \
223 .suspend = suspend_fn, \ 223 .suspend = suspend_fn, \
224 .resume = resume_fn, \ 224 .resume = resume_fn, \
225 .freeze = suspend_fn, \ 225 .freeze = suspend_fn, \
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 7456d7d87a19..56f2d63a5cbb 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -105,12 +105,7 @@ static inline int ptrace_reparented(struct task_struct *child)
105{ 105{
106 return child->real_parent != child->parent; 106 return child->real_parent != child->parent;
107} 107}
108static inline void ptrace_link(struct task_struct *child, 108
109 struct task_struct *new_parent)
110{
111 if (unlikely(child->ptrace))
112 __ptrace_link(child, new_parent);
113}
114static inline void ptrace_unlink(struct task_struct *child) 109static inline void ptrace_unlink(struct task_struct *child)
115{ 110{
116 if (unlikely(child->ptrace)) 111 if (unlikely(child->ptrace))
@@ -169,9 +164,9 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
169 INIT_LIST_HEAD(&child->ptraced); 164 INIT_LIST_HEAD(&child->ptraced);
170 child->parent = child->real_parent; 165 child->parent = child->real_parent;
171 child->ptrace = 0; 166 child->ptrace = 0;
172 if (unlikely(ptrace)) { 167 if (unlikely(ptrace) && (current->ptrace & PT_PTRACED)) {
173 child->ptrace = current->ptrace; 168 child->ptrace = current->ptrace;
174 ptrace_link(child, current->parent); 169 __ptrace_link(child, current->parent);
175 } 170 }
176} 171}
177 172
@@ -278,6 +273,18 @@ static inline void user_enable_block_step(struct task_struct *task)
278} 273}
279#endif /* arch_has_block_step */ 274#endif /* arch_has_block_step */
280 275
276#ifdef ARCH_HAS_USER_SINGLE_STEP_INFO
277extern void user_single_step_siginfo(struct task_struct *tsk,
278 struct pt_regs *regs, siginfo_t *info);
279#else
280static inline void user_single_step_siginfo(struct task_struct *tsk,
281 struct pt_regs *regs, siginfo_t *info)
282{
283 memset(info, 0, sizeof(*info));
284 info->si_signo = SIGTRAP;
285}
286#endif
287
281#ifndef arch_ptrace_stop_needed 288#ifndef arch_ptrace_stop_needed
282/** 289/**
283 * arch_ptrace_stop_needed - Decide whether arch_ptrace_stop() should be called 290 * arch_ptrace_stop_needed - Decide whether arch_ptrace_stop() should be called
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index a05b4a20768d..c96c1858fe2c 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2051,25 +2051,12 @@ void set_de_name_and_namelen(struct reiserfs_dir_entry *de);
2051int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, 2051int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
2052 struct treepath *path, struct reiserfs_dir_entry *de); 2052 struct treepath *path, struct reiserfs_dir_entry *de);
2053struct dentry *reiserfs_get_parent(struct dentry *); 2053struct dentry *reiserfs_get_parent(struct dentry *);
2054/* procfs.c */
2055
2056#if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO )
2057#define REISERFS_PROC_INFO
2058#else
2059#undef REISERFS_PROC_INFO
2060#endif
2061 2054
2055#ifdef CONFIG_REISERFS_PROC_INFO
2062int reiserfs_proc_info_init(struct super_block *sb); 2056int reiserfs_proc_info_init(struct super_block *sb);
2063int reiserfs_proc_info_done(struct super_block *sb); 2057int reiserfs_proc_info_done(struct super_block *sb);
2064struct proc_dir_entry *reiserfs_proc_register_global(char *name,
2065 read_proc_t * func);
2066void reiserfs_proc_unregister_global(const char *name);
2067int reiserfs_proc_info_global_init(void); 2058int reiserfs_proc_info_global_init(void);
2068int reiserfs_proc_info_global_done(void); 2059int reiserfs_proc_info_global_done(void);
2069int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
2070 int count, int *eof, void *data);
2071
2072#if defined( REISERFS_PROC_INFO )
2073 2060
2074#define PROC_EXP( e ) e 2061#define PROC_EXP( e ) e
2075 2062
@@ -2084,6 +2071,26 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
2084 PROC_INFO_ADD( sb, free_at[ ( level ) ], B_FREE_SPACE( bh ) ); \ 2071 PROC_INFO_ADD( sb, free_at[ ( level ) ], B_FREE_SPACE( bh ) ); \
2085 PROC_INFO_ADD( sb, items_at[ ( level ) ], B_NR_ITEMS( bh ) ) 2072 PROC_INFO_ADD( sb, items_at[ ( level ) ], B_NR_ITEMS( bh ) )
2086#else 2073#else
2074static inline int reiserfs_proc_info_init(struct super_block *sb)
2075{
2076 return 0;
2077}
2078
2079static inline int reiserfs_proc_info_done(struct super_block *sb)
2080{
2081 return 0;
2082}
2083
2084static inline int reiserfs_proc_info_global_init(void)
2085{
2086 return 0;
2087}
2088
2089static inline int reiserfs_proc_info_global_done(void)
2090{
2091 return 0;
2092}
2093
2087#define PROC_EXP( e ) 2094#define PROC_EXP( e )
2088#define VOID_V ( ( void ) 0 ) 2095#define VOID_V ( ( void ) 0 )
2089#define PROC_INFO_MAX( sb, field, value ) VOID_V 2096#define PROC_INFO_MAX( sb, field, value ) VOID_V
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index cb0ba7032609..b019ae64e2ab 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -26,6 +26,9 @@
26 */ 26 */
27struct anon_vma { 27struct anon_vma {
28 spinlock_t lock; /* Serialize access to vma list */ 28 spinlock_t lock; /* Serialize access to vma list */
29#ifdef CONFIG_KSM
30 atomic_t ksm_refcount;
31#endif
29 /* 32 /*
30 * NOTE: the LSB of the head.next is set by 33 * NOTE: the LSB of the head.next is set by
31 * mm_take_all_locks() _after_ taking the above lock. So the 34 * mm_take_all_locks() _after_ taking the above lock. So the
@@ -38,6 +41,34 @@ struct anon_vma {
38}; 41};
39 42
40#ifdef CONFIG_MMU 43#ifdef CONFIG_MMU
44#ifdef CONFIG_KSM
45static inline void ksm_refcount_init(struct anon_vma *anon_vma)
46{
47 atomic_set(&anon_vma->ksm_refcount, 0);
48}
49
50static inline int ksm_refcount(struct anon_vma *anon_vma)
51{
52 return atomic_read(&anon_vma->ksm_refcount);
53}
54#else
55static inline void ksm_refcount_init(struct anon_vma *anon_vma)
56{
57}
58
59static inline int ksm_refcount(struct anon_vma *anon_vma)
60{
61 return 0;
62}
63#endif /* CONFIG_KSM */
64
65static inline struct anon_vma *page_anon_vma(struct page *page)
66{
67 if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) !=
68 PAGE_MAPPING_ANON)
69 return NULL;
70 return page_rmapping(page);
71}
41 72
42static inline void anon_vma_lock(struct vm_area_struct *vma) 73static inline void anon_vma_lock(struct vm_area_struct *vma)
43{ 74{
@@ -62,6 +93,7 @@ void __anon_vma_merge(struct vm_area_struct *, struct vm_area_struct *);
62void anon_vma_unlink(struct vm_area_struct *); 93void anon_vma_unlink(struct vm_area_struct *);
63void anon_vma_link(struct vm_area_struct *); 94void anon_vma_link(struct vm_area_struct *);
64void __anon_vma_link(struct vm_area_struct *); 95void __anon_vma_link(struct vm_area_struct *);
96void anon_vma_free(struct anon_vma *);
65 97
66/* 98/*
67 * rmap interfaces called when adding or removing pte of page 99 * rmap interfaces called when adding or removing pte of page
@@ -81,6 +113,9 @@ static inline void page_dup_rmap(struct page *page)
81 */ 113 */
82int page_referenced(struct page *, int is_locked, 114int page_referenced(struct page *, int is_locked,
83 struct mem_cgroup *cnt, unsigned long *vm_flags); 115 struct mem_cgroup *cnt, unsigned long *vm_flags);
116int page_referenced_one(struct page *, struct vm_area_struct *,
117 unsigned long address, unsigned int *mapcount, unsigned long *vm_flags);
118
84enum ttu_flags { 119enum ttu_flags {
85 TTU_UNMAP = 0, /* unmap mode */ 120 TTU_UNMAP = 0, /* unmap mode */
86 TTU_MIGRATION = 1, /* migration mode */ 121 TTU_MIGRATION = 1, /* migration mode */
@@ -94,6 +129,8 @@ enum ttu_flags {
94#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) 129#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK)
95 130
96int try_to_unmap(struct page *, enum ttu_flags flags); 131int try_to_unmap(struct page *, enum ttu_flags flags);
132int try_to_unmap_one(struct page *, struct vm_area_struct *,
133 unsigned long address, enum ttu_flags flags);
97 134
98/* 135/*
99 * Called from mm/filemap_xip.c to unmap empty zero page 136 * Called from mm/filemap_xip.c to unmap empty zero page
@@ -127,6 +164,12 @@ struct anon_vma *page_lock_anon_vma(struct page *page);
127void page_unlock_anon_vma(struct anon_vma *anon_vma); 164void page_unlock_anon_vma(struct anon_vma *anon_vma);
128int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); 165int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma);
129 166
167/*
168 * Called by migrate.c to remove migration ptes, but might be used more later.
169 */
170int rmap_walk(struct page *page, int (*rmap_one)(struct page *,
171 struct vm_area_struct *, unsigned long, void *), void *arg);
172
130#else /* !CONFIG_MMU */ 173#else /* !CONFIG_MMU */
131 174
132#define anon_vma_init() do {} while (0) 175#define anon_vma_init() do {} while (0)
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index f19b00b7d530..281d8fd775e8 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -24,7 +24,7 @@
24 * @owner: the mutex owner 24 * @owner: the mutex owner
25 */ 25 */
26struct rt_mutex { 26struct rt_mutex {
27 spinlock_t wait_lock; 27 raw_spinlock_t wait_lock;
28 struct plist_head wait_list; 28 struct plist_head wait_list;
29 struct task_struct *owner; 29 struct task_struct *owner;
30#ifdef CONFIG_DEBUG_RT_MUTEXES 30#ifdef CONFIG_DEBUG_RT_MUTEXES
@@ -63,8 +63,8 @@ struct hrtimer_sleeper;
63#endif 63#endif
64 64
65#define __RT_MUTEX_INITIALIZER(mutexname) \ 65#define __RT_MUTEX_INITIALIZER(mutexname) \
66 { .wait_lock = __SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ 66 { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
67 , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list, mutexname.wait_lock) \ 67 , .wait_list = PLIST_HEAD_INIT_RAW(mutexname.wait_list, mutexname.wait_lock) \
68 , .owner = NULL \ 68 , .owner = NULL \
69 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)} 69 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
70 70
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 14fc906ed602..05330fc5b436 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -368,11 +368,9 @@ enum {
368#define RTAX_MAX (__RTAX_MAX - 1) 368#define RTAX_MAX (__RTAX_MAX - 1)
369 369
370#define RTAX_FEATURE_ECN 0x00000001 370#define RTAX_FEATURE_ECN 0x00000001
371#define RTAX_FEATURE_NO_SACK 0x00000002 371#define RTAX_FEATURE_SACK 0x00000002
372#define RTAX_FEATURE_NO_TSTAMP 0x00000004 372#define RTAX_FEATURE_TIMESTAMP 0x00000004
373#define RTAX_FEATURE_ALLFRAG 0x00000008 373#define RTAX_FEATURE_ALLFRAG 0x00000008
374#define RTAX_FEATURE_NO_WSCALE 0x00000010
375#define RTAX_FEATURE_NO_DSACK 0x00000020
376 374
377struct rta_session { 375struct rta_session {
378 __u8 proto; 376 __u8 proto;
diff --git a/include/linux/rwlock.h b/include/linux/rwlock.h
new file mode 100644
index 000000000000..71e0b00b6f2c
--- /dev/null
+++ b/include/linux/rwlock.h
@@ -0,0 +1,125 @@
1#ifndef __LINUX_RWLOCK_H
2#define __LINUX_RWLOCK_H
3
4#ifndef __LINUX_SPINLOCK_H
5# error "please don't include this file directly"
6#endif
7
8/*
9 * rwlock related methods
10 *
11 * split out from spinlock.h
12 *
13 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
14 * Released under the General Public License (GPL).
15 */
16
17#ifdef CONFIG_DEBUG_SPINLOCK
18 extern void __rwlock_init(rwlock_t *lock, const char *name,
19 struct lock_class_key *key);
20# define rwlock_init(lock) \
21do { \
22 static struct lock_class_key __key; \
23 \
24 __rwlock_init((lock), #lock, &__key); \
25} while (0)
26#else
27# define rwlock_init(lock) \
28 do { *(lock) = __RW_LOCK_UNLOCKED(lock); } while (0)
29#endif
30
31#ifdef CONFIG_DEBUG_SPINLOCK
32 extern void do_raw_read_lock(rwlock_t *lock);
33#define do_raw_read_lock_flags(lock, flags) do_raw_read_lock(lock)
34 extern int do_raw_read_trylock(rwlock_t *lock);
35 extern void do_raw_read_unlock(rwlock_t *lock);
36 extern void do_raw_write_lock(rwlock_t *lock);
37#define do_raw_write_lock_flags(lock, flags) do_raw_write_lock(lock)
38 extern int do_raw_write_trylock(rwlock_t *lock);
39 extern void do_raw_write_unlock(rwlock_t *lock);
40#else
41# define do_raw_read_lock(rwlock) arch_read_lock(&(rwlock)->raw_lock)
42# define do_raw_read_lock_flags(lock, flags) \
43 arch_read_lock_flags(&(lock)->raw_lock, *(flags))
44# define do_raw_read_trylock(rwlock) arch_read_trylock(&(rwlock)->raw_lock)
45# define do_raw_read_unlock(rwlock) arch_read_unlock(&(rwlock)->raw_lock)
46# define do_raw_write_lock(rwlock) arch_write_lock(&(rwlock)->raw_lock)
47# define do_raw_write_lock_flags(lock, flags) \
48 arch_write_lock_flags(&(lock)->raw_lock, *(flags))
49# define do_raw_write_trylock(rwlock) arch_write_trylock(&(rwlock)->raw_lock)
50# define do_raw_write_unlock(rwlock) arch_write_unlock(&(rwlock)->raw_lock)
51#endif
52
53#define read_can_lock(rwlock) arch_read_can_lock(&(rwlock)->raw_lock)
54#define write_can_lock(rwlock) arch_write_can_lock(&(rwlock)->raw_lock)
55
56/*
57 * Define the various rw_lock methods. Note we define these
58 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various
59 * methods are defined as nops in the case they are not required.
60 */
61#define read_trylock(lock) __cond_lock(lock, _raw_read_trylock(lock))
62#define write_trylock(lock) __cond_lock(lock, _raw_write_trylock(lock))
63
64#define write_lock(lock) _raw_write_lock(lock)
65#define read_lock(lock) _raw_read_lock(lock)
66
67#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
68
69#define read_lock_irqsave(lock, flags) \
70 do { \
71 typecheck(unsigned long, flags); \
72 flags = _raw_read_lock_irqsave(lock); \
73 } while (0)
74#define write_lock_irqsave(lock, flags) \
75 do { \
76 typecheck(unsigned long, flags); \
77 flags = _raw_write_lock_irqsave(lock); \
78 } while (0)
79
80#else
81
82#define read_lock_irqsave(lock, flags) \
83 do { \
84 typecheck(unsigned long, flags); \
85 _raw_read_lock_irqsave(lock, flags); \
86 } while (0)
87#define write_lock_irqsave(lock, flags) \
88 do { \
89 typecheck(unsigned long, flags); \
90 _raw_write_lock_irqsave(lock, flags); \
91 } while (0)
92
93#endif
94
95#define read_lock_irq(lock) _raw_read_lock_irq(lock)
96#define read_lock_bh(lock) _raw_read_lock_bh(lock)
97#define write_lock_irq(lock) _raw_write_lock_irq(lock)
98#define write_lock_bh(lock) _raw_write_lock_bh(lock)
99#define read_unlock(lock) _raw_read_unlock(lock)
100#define write_unlock(lock) _raw_write_unlock(lock)
101#define read_unlock_irq(lock) _raw_read_unlock_irq(lock)
102#define write_unlock_irq(lock) _raw_write_unlock_irq(lock)
103
104#define read_unlock_irqrestore(lock, flags) \
105 do { \
106 typecheck(unsigned long, flags); \
107 _raw_read_unlock_irqrestore(lock, flags); \
108 } while (0)
109#define read_unlock_bh(lock) _raw_read_unlock_bh(lock)
110
111#define write_unlock_irqrestore(lock, flags) \
112 do { \
113 typecheck(unsigned long, flags); \
114 _raw_write_unlock_irqrestore(lock, flags); \
115 } while (0)
116#define write_unlock_bh(lock) _raw_write_unlock_bh(lock)
117
118#define write_trylock_irqsave(lock, flags) \
119({ \
120 local_irq_save(flags); \
121 write_trylock(lock) ? \
122 1 : ({ local_irq_restore(flags); 0; }); \
123})
124
125#endif /* __LINUX_RWLOCK_H */
diff --git a/include/linux/rwlock_api_smp.h b/include/linux/rwlock_api_smp.h
new file mode 100644
index 000000000000..9c9f0495d37c
--- /dev/null
+++ b/include/linux/rwlock_api_smp.h
@@ -0,0 +1,282 @@
1#ifndef __LINUX_RWLOCK_API_SMP_H
2#define __LINUX_RWLOCK_API_SMP_H
3
4#ifndef __LINUX_SPINLOCK_API_SMP_H
5# error "please don't include this file directly"
6#endif
7
8/*
9 * include/linux/rwlock_api_smp.h
10 *
11 * spinlock API declarations on SMP (and debug)
12 * (implemented in kernel/spinlock.c)
13 *
14 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
15 * Released under the General Public License (GPL).
16 */
17
18void __lockfunc _raw_read_lock(rwlock_t *lock) __acquires(lock);
19void __lockfunc _raw_write_lock(rwlock_t *lock) __acquires(lock);
20void __lockfunc _raw_read_lock_bh(rwlock_t *lock) __acquires(lock);
21void __lockfunc _raw_write_lock_bh(rwlock_t *lock) __acquires(lock);
22void __lockfunc _raw_read_lock_irq(rwlock_t *lock) __acquires(lock);
23void __lockfunc _raw_write_lock_irq(rwlock_t *lock) __acquires(lock);
24unsigned long __lockfunc _raw_read_lock_irqsave(rwlock_t *lock)
25 __acquires(lock);
26unsigned long __lockfunc _raw_write_lock_irqsave(rwlock_t *lock)
27 __acquires(lock);
28int __lockfunc _raw_read_trylock(rwlock_t *lock);
29int __lockfunc _raw_write_trylock(rwlock_t *lock);
30void __lockfunc _raw_read_unlock(rwlock_t *lock) __releases(lock);
31void __lockfunc _raw_write_unlock(rwlock_t *lock) __releases(lock);
32void __lockfunc _raw_read_unlock_bh(rwlock_t *lock) __releases(lock);
33void __lockfunc _raw_write_unlock_bh(rwlock_t *lock) __releases(lock);
34void __lockfunc _raw_read_unlock_irq(rwlock_t *lock) __releases(lock);
35void __lockfunc _raw_write_unlock_irq(rwlock_t *lock) __releases(lock);
36void __lockfunc
37_raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
38 __releases(lock);
39void __lockfunc
40_raw_write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
41 __releases(lock);
42
43#ifdef CONFIG_INLINE_READ_LOCK
44#define _raw_read_lock(lock) __raw_read_lock(lock)
45#endif
46
47#ifdef CONFIG_INLINE_WRITE_LOCK
48#define _raw_write_lock(lock) __raw_write_lock(lock)
49#endif
50
51#ifdef CONFIG_INLINE_READ_LOCK_BH
52#define _raw_read_lock_bh(lock) __raw_read_lock_bh(lock)
53#endif
54
55#ifdef CONFIG_INLINE_WRITE_LOCK_BH
56#define _raw_write_lock_bh(lock) __raw_write_lock_bh(lock)
57#endif
58
59#ifdef CONFIG_INLINE_READ_LOCK_IRQ
60#define _raw_read_lock_irq(lock) __raw_read_lock_irq(lock)
61#endif
62
63#ifdef CONFIG_INLINE_WRITE_LOCK_IRQ
64#define _raw_write_lock_irq(lock) __raw_write_lock_irq(lock)
65#endif
66
67#ifdef CONFIG_INLINE_READ_LOCK_IRQSAVE
68#define _raw_read_lock_irqsave(lock) __raw_read_lock_irqsave(lock)
69#endif
70
71#ifdef CONFIG_INLINE_WRITE_LOCK_IRQSAVE
72#define _raw_write_lock_irqsave(lock) __raw_write_lock_irqsave(lock)
73#endif
74
75#ifdef CONFIG_INLINE_READ_TRYLOCK
76#define _raw_read_trylock(lock) __raw_read_trylock(lock)
77#endif
78
79#ifdef CONFIG_INLINE_WRITE_TRYLOCK
80#define _raw_write_trylock(lock) __raw_write_trylock(lock)
81#endif
82
83#ifdef CONFIG_INLINE_READ_UNLOCK
84#define _raw_read_unlock(lock) __raw_read_unlock(lock)
85#endif
86
87#ifdef CONFIG_INLINE_WRITE_UNLOCK
88#define _raw_write_unlock(lock) __raw_write_unlock(lock)
89#endif
90
91#ifdef CONFIG_INLINE_READ_UNLOCK_BH
92#define _raw_read_unlock_bh(lock) __raw_read_unlock_bh(lock)
93#endif
94
95#ifdef CONFIG_INLINE_WRITE_UNLOCK_BH
96#define _raw_write_unlock_bh(lock) __raw_write_unlock_bh(lock)
97#endif
98
99#ifdef CONFIG_INLINE_READ_UNLOCK_IRQ
100#define _raw_read_unlock_irq(lock) __raw_read_unlock_irq(lock)
101#endif
102
103#ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQ
104#define _raw_write_unlock_irq(lock) __raw_write_unlock_irq(lock)
105#endif
106
107#ifdef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE
108#define _raw_read_unlock_irqrestore(lock, flags) \
109 __raw_read_unlock_irqrestore(lock, flags)
110#endif
111
112#ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE
113#define _raw_write_unlock_irqrestore(lock, flags) \
114 __raw_write_unlock_irqrestore(lock, flags)
115#endif
116
117static inline int __raw_read_trylock(rwlock_t *lock)
118{
119 preempt_disable();
120 if (do_raw_read_trylock(lock)) {
121 rwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_);
122 return 1;
123 }
124 preempt_enable();
125 return 0;
126}
127
128static inline int __raw_write_trylock(rwlock_t *lock)
129{
130 preempt_disable();
131 if (do_raw_write_trylock(lock)) {
132 rwlock_acquire(&lock->dep_map, 0, 1, _RET_IP_);
133 return 1;
134 }
135 preempt_enable();
136 return 0;
137}
138
139/*
140 * If lockdep is enabled then we use the non-preemption spin-ops
141 * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are
142 * not re-enabled during lock-acquire (which the preempt-spin-ops do):
143 */
144#if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC)
145
146static inline void __raw_read_lock(rwlock_t *lock)
147{
148 preempt_disable();
149 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
150 LOCK_CONTENDED(lock, do_raw_read_trylock, do_raw_read_lock);
151}
152
153static inline unsigned long __raw_read_lock_irqsave(rwlock_t *lock)
154{
155 unsigned long flags;
156
157 local_irq_save(flags);
158 preempt_disable();
159 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
160 LOCK_CONTENDED_FLAGS(lock, do_raw_read_trylock, do_raw_read_lock,
161 do_raw_read_lock_flags, &flags);
162 return flags;
163}
164
165static inline void __raw_read_lock_irq(rwlock_t *lock)
166{
167 local_irq_disable();
168 preempt_disable();
169 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
170 LOCK_CONTENDED(lock, do_raw_read_trylock, do_raw_read_lock);
171}
172
173static inline void __raw_read_lock_bh(rwlock_t *lock)
174{
175 local_bh_disable();
176 preempt_disable();
177 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
178 LOCK_CONTENDED(lock, do_raw_read_trylock, do_raw_read_lock);
179}
180
181static inline unsigned long __raw_write_lock_irqsave(rwlock_t *lock)
182{
183 unsigned long flags;
184
185 local_irq_save(flags);
186 preempt_disable();
187 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
188 LOCK_CONTENDED_FLAGS(lock, do_raw_write_trylock, do_raw_write_lock,
189 do_raw_write_lock_flags, &flags);
190 return flags;
191}
192
193static inline void __raw_write_lock_irq(rwlock_t *lock)
194{
195 local_irq_disable();
196 preempt_disable();
197 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
198 LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock);
199}
200
201static inline void __raw_write_lock_bh(rwlock_t *lock)
202{
203 local_bh_disable();
204 preempt_disable();
205 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
206 LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock);
207}
208
209static inline void __raw_write_lock(rwlock_t *lock)
210{
211 preempt_disable();
212 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
213 LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock);
214}
215
216#endif /* CONFIG_PREEMPT */
217
218static inline void __raw_write_unlock(rwlock_t *lock)
219{
220 rwlock_release(&lock->dep_map, 1, _RET_IP_);
221 do_raw_write_unlock(lock);
222 preempt_enable();
223}
224
225static inline void __raw_read_unlock(rwlock_t *lock)
226{
227 rwlock_release(&lock->dep_map, 1, _RET_IP_);
228 do_raw_read_unlock(lock);
229 preempt_enable();
230}
231
232static inline void
233__raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
234{
235 rwlock_release(&lock->dep_map, 1, _RET_IP_);
236 do_raw_read_unlock(lock);
237 local_irq_restore(flags);
238 preempt_enable();
239}
240
241static inline void __raw_read_unlock_irq(rwlock_t *lock)
242{
243 rwlock_release(&lock->dep_map, 1, _RET_IP_);
244 do_raw_read_unlock(lock);
245 local_irq_enable();
246 preempt_enable();
247}
248
249static inline void __raw_read_unlock_bh(rwlock_t *lock)
250{
251 rwlock_release(&lock->dep_map, 1, _RET_IP_);
252 do_raw_read_unlock(lock);
253 preempt_enable_no_resched();
254 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
255}
256
257static inline void __raw_write_unlock_irqrestore(rwlock_t *lock,
258 unsigned long flags)
259{
260 rwlock_release(&lock->dep_map, 1, _RET_IP_);
261 do_raw_write_unlock(lock);
262 local_irq_restore(flags);
263 preempt_enable();
264}
265
266static inline void __raw_write_unlock_irq(rwlock_t *lock)
267{
268 rwlock_release(&lock->dep_map, 1, _RET_IP_);
269 do_raw_write_unlock(lock);
270 local_irq_enable();
271 preempt_enable();
272}
273
274static inline void __raw_write_unlock_bh(rwlock_t *lock)
275{
276 rwlock_release(&lock->dep_map, 1, _RET_IP_);
277 do_raw_write_unlock(lock);
278 preempt_enable_no_resched();
279 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
280}
281
282#endif /* __LINUX_RWLOCK_API_SMP_H */
diff --git a/include/linux/rwlock_types.h b/include/linux/rwlock_types.h
new file mode 100644
index 000000000000..bd31808c7d8e
--- /dev/null
+++ b/include/linux/rwlock_types.h
@@ -0,0 +1,56 @@
1#ifndef __LINUX_RWLOCK_TYPES_H
2#define __LINUX_RWLOCK_TYPES_H
3
4/*
5 * include/linux/rwlock_types.h - generic rwlock type definitions
6 * and initializers
7 *
8 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
9 * Released under the General Public License (GPL).
10 */
11typedef struct {
12 arch_rwlock_t raw_lock;
13#ifdef CONFIG_GENERIC_LOCKBREAK
14 unsigned int break_lock;
15#endif
16#ifdef CONFIG_DEBUG_SPINLOCK
17 unsigned int magic, owner_cpu;
18 void *owner;
19#endif
20#ifdef CONFIG_DEBUG_LOCK_ALLOC
21 struct lockdep_map dep_map;
22#endif
23} rwlock_t;
24
25#define RWLOCK_MAGIC 0xdeaf1eed
26
27#ifdef CONFIG_DEBUG_LOCK_ALLOC
28# define RW_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }
29#else
30# define RW_DEP_MAP_INIT(lockname)
31#endif
32
33#ifdef CONFIG_DEBUG_SPINLOCK
34#define __RW_LOCK_UNLOCKED(lockname) \
35 (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \
36 .magic = RWLOCK_MAGIC, \
37 .owner = SPINLOCK_OWNER_INIT, \
38 .owner_cpu = -1, \
39 RW_DEP_MAP_INIT(lockname) }
40#else
41#define __RW_LOCK_UNLOCKED(lockname) \
42 (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \
43 RW_DEP_MAP_INIT(lockname) }
44#endif
45
46/*
47 * RW_LOCK_UNLOCKED defeat lockdep state tracking and is hence
48 * deprecated.
49 *
50 * Please use DEFINE_RWLOCK() or __RW_LOCK_UNLOCKED() as appropriate.
51 */
52#define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init)
53
54#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x)
55
56#endif /* __LINUX_RWLOCK_TYPES_H */
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index 6c3c0f6c261f..bdfcc2527970 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -68,11 +68,7 @@ extern int __down_write_trylock(struct rw_semaphore *sem);
68extern void __up_read(struct rw_semaphore *sem); 68extern void __up_read(struct rw_semaphore *sem);
69extern void __up_write(struct rw_semaphore *sem); 69extern void __up_write(struct rw_semaphore *sem);
70extern void __downgrade_write(struct rw_semaphore *sem); 70extern void __downgrade_write(struct rw_semaphore *sem);
71 71extern int rwsem_is_locked(struct rw_semaphore *sem);
72static inline int rwsem_is_locked(struct rw_semaphore *sem)
73{
74 return (sem->activity != 0);
75}
76 72
77#endif /* __KERNEL__ */ 73#endif /* __KERNEL__ */
78#endif /* _LINUX_RWSEM_SPINLOCK_H */ 74#endif /* _LINUX_RWSEM_SPINLOCK_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 294eb2f80144..244c287a5ac1 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1409,7 +1409,7 @@ struct task_struct {
1409#endif 1409#endif
1410 1410
1411 /* Protection of the PI data structures: */ 1411 /* Protection of the PI data structures: */
1412 spinlock_t pi_lock; 1412 raw_spinlock_t pi_lock;
1413 1413
1414#ifdef CONFIG_RT_MUTEXES 1414#ifdef CONFIG_RT_MUTEXES
1415 /* PI waiters blocked on a rt_mutex held by this task */ 1415 /* PI waiters blocked on a rt_mutex held by this task */
@@ -1446,8 +1446,10 @@ struct task_struct {
1446 gfp_t lockdep_reclaim_gfp; 1446 gfp_t lockdep_reclaim_gfp;
1447#endif 1447#endif
1448 1448
1449#ifdef CONFIG_FS_JOURNAL_INFO
1449/* journalling filesystem info */ 1450/* journalling filesystem info */
1450 void *journal_info; 1451 void *journal_info;
1452#endif
1451 1453
1452/* stacked block device info */ 1454/* stacked block device info */
1453 struct bio *bio_list, **bio_tail; 1455 struct bio *bio_list, **bio_tail;
@@ -1542,6 +1544,14 @@ struct task_struct {
1542 unsigned long trace_recursion; 1544 unsigned long trace_recursion;
1543#endif /* CONFIG_TRACING */ 1545#endif /* CONFIG_TRACING */
1544 unsigned long stack_start; 1546 unsigned long stack_start;
1547#ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */
1548 struct memcg_batch_info {
1549 int do_batch; /* incremented when batch uncharge started */
1550 struct mem_cgroup *memcg; /* target memcg of uncharge */
1551 unsigned long bytes; /* uncharged usage */
1552 unsigned long memsw_bytes; /* uncharged mem+swap usage */
1553 } memcg_batch;
1554#endif
1545}; 1555};
1546 1556
1547/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1557/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -2073,7 +2083,6 @@ extern int kill_proc_info(int, struct siginfo *, pid_t);
2073extern int do_notify_parent(struct task_struct *, int); 2083extern int do_notify_parent(struct task_struct *, int);
2074extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); 2084extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
2075extern void force_sig(int, struct task_struct *); 2085extern void force_sig(int, struct task_struct *);
2076extern void force_sig_specific(int, struct task_struct *);
2077extern int send_sig(int, struct task_struct *, int); 2086extern int send_sig(int, struct task_struct *, int);
2078extern void zap_other_threads(struct task_struct *p); 2087extern void zap_other_threads(struct task_struct *p);
2079extern struct sigqueue *sigqueue_alloc(void); 2088extern struct sigqueue *sigqueue_alloc(void);
@@ -2092,11 +2101,6 @@ static inline int kill_cad_pid(int sig, int priv)
2092#define SEND_SIG_PRIV ((struct siginfo *) 1) 2101#define SEND_SIG_PRIV ((struct siginfo *) 1)
2093#define SEND_SIG_FORCED ((struct siginfo *) 2) 2102#define SEND_SIG_FORCED ((struct siginfo *) 2)
2094 2103
2095static inline int is_si_special(const struct siginfo *info)
2096{
2097 return info <= SEND_SIG_FORCED;
2098}
2099
2100/* 2104/*
2101 * True if we are on the alternate signal stack. 2105 * True if we are on the alternate signal stack.
2102 */ 2106 */
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 1b191c176bcd..8a4adbef8a0f 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -86,6 +86,7 @@ struct task_struct;
86struct sem { 86struct sem {
87 int semval; /* current value */ 87 int semval; /* current value */
88 int sempid; /* pid of last operation */ 88 int sempid; /* pid of last operation */
89 struct list_head sem_pending; /* pending single-sop operations */
89}; 90};
90 91
91/* One sem_array data structure for each set of semaphores in the system. */ 92/* One sem_array data structure for each set of semaphores in the system. */
@@ -96,11 +97,13 @@ struct sem_array {
96 struct sem *sem_base; /* ptr to first semaphore in array */ 97 struct sem *sem_base; /* ptr to first semaphore in array */
97 struct list_head sem_pending; /* pending operations to be processed */ 98 struct list_head sem_pending; /* pending operations to be processed */
98 struct list_head list_id; /* undo requests on this array */ 99 struct list_head list_id; /* undo requests on this array */
99 unsigned long sem_nsems; /* no. of semaphores in array */ 100 int sem_nsems; /* no. of semaphores in array */
101 int complex_count; /* pending complex operations */
100}; 102};
101 103
102/* One queue for each sleeping process in the system. */ 104/* One queue for each sleeping process in the system. */
103struct sem_queue { 105struct sem_queue {
106 struct list_head simple_list; /* queue of pending operations */
104 struct list_head list; /* queue of pending operations */ 107 struct list_head list; /* queue of pending operations */
105 struct task_struct *sleeper; /* this process */ 108 struct task_struct *sleeper; /* this process */
106 struct sem_undo *undo; /* undo structure */ 109 struct sem_undo *undo; /* undo structure */
diff --git a/include/linux/sm501-regs.h b/include/linux/sm501-regs.h
index d53642d2d899..67ed2c542831 100644
--- a/include/linux/sm501-regs.h
+++ b/include/linux/sm501-regs.h
@@ -31,6 +31,8 @@
31#define SM501_SYSCTRL_PCI_SUBSYS_LOCK (1<<11) 31#define SM501_SYSCTRL_PCI_SUBSYS_LOCK (1<<11)
32#define SM501_SYSCTRL_PCI_BURST_READ_EN (1<<15) 32#define SM501_SYSCTRL_PCI_BURST_READ_EN (1<<15)
33 33
34#define SM501_SYSCTRL_2D_ENGINE_STATUS (1<<19)
35
34/* miscellaneous control */ 36/* miscellaneous control */
35 37
36#define SM501_MISC_CONTROL (0x000004) 38#define SM501_MISC_CONTROL (0x000004)
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 71dccfeb0d88..86088213334a 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -8,13 +8,13 @@
8 * 8 *
9 * on SMP builds: 9 * on SMP builds:
10 * 10 *
11 * asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the 11 * asm/spinlock_types.h: contains the arch_spinlock_t/arch_rwlock_t and the
12 * initializers 12 * initializers
13 * 13 *
14 * linux/spinlock_types.h: 14 * linux/spinlock_types.h:
15 * defines the generic type and initializers 15 * defines the generic type and initializers
16 * 16 *
17 * asm/spinlock.h: contains the __raw_spin_*()/etc. lowlevel 17 * asm/spinlock.h: contains the arch_spin_*()/etc. lowlevel
18 * implementations, mostly inline assembly code 18 * implementations, mostly inline assembly code
19 * 19 *
20 * (also included on UP-debug builds:) 20 * (also included on UP-debug builds:)
@@ -34,7 +34,7 @@
34 * defines the generic type and initializers 34 * defines the generic type and initializers
35 * 35 *
36 * linux/spinlock_up.h: 36 * linux/spinlock_up.h:
37 * contains the __raw_spin_*()/etc. version of UP 37 * contains the arch_spin_*()/etc. version of UP
38 * builds. (which are NOPs on non-debug, non-preempt 38 * builds. (which are NOPs on non-debug, non-preempt
39 * builds) 39 * builds)
40 * 40 *
@@ -75,12 +75,12 @@
75#define __lockfunc __attribute__((section(".spinlock.text"))) 75#define __lockfunc __attribute__((section(".spinlock.text")))
76 76
77/* 77/*
78 * Pull the raw_spinlock_t and raw_rwlock_t definitions: 78 * Pull the arch_spinlock_t and arch_rwlock_t definitions:
79 */ 79 */
80#include <linux/spinlock_types.h> 80#include <linux/spinlock_types.h>
81 81
82/* 82/*
83 * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them): 83 * Pull the arch_spin*() functions/declarations (UP-nondebug doesnt need them):
84 */ 84 */
85#ifdef CONFIG_SMP 85#ifdef CONFIG_SMP
86# include <asm/spinlock.h> 86# include <asm/spinlock.h>
@@ -89,45 +89,31 @@
89#endif 89#endif
90 90
91#ifdef CONFIG_DEBUG_SPINLOCK 91#ifdef CONFIG_DEBUG_SPINLOCK
92 extern void __spin_lock_init(spinlock_t *lock, const char *name, 92 extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
93 struct lock_class_key *key); 93 struct lock_class_key *key);
94# define spin_lock_init(lock) \ 94# define raw_spin_lock_init(lock) \
95do { \ 95do { \
96 static struct lock_class_key __key; \ 96 static struct lock_class_key __key; \
97 \ 97 \
98 __spin_lock_init((lock), #lock, &__key); \ 98 __raw_spin_lock_init((lock), #lock, &__key); \
99} while (0) 99} while (0)
100 100
101#else 101#else
102# define spin_lock_init(lock) \ 102# define raw_spin_lock_init(lock) \
103 do { *(lock) = __SPIN_LOCK_UNLOCKED(lock); } while (0) 103 do { *(lock) = __RAW_SPIN_LOCK_UNLOCKED(lock); } while (0)
104#endif 104#endif
105 105
106#ifdef CONFIG_DEBUG_SPINLOCK 106#define raw_spin_is_locked(lock) arch_spin_is_locked(&(lock)->raw_lock)
107 extern void __rwlock_init(rwlock_t *lock, const char *name,
108 struct lock_class_key *key);
109# define rwlock_init(lock) \
110do { \
111 static struct lock_class_key __key; \
112 \
113 __rwlock_init((lock), #lock, &__key); \
114} while (0)
115#else
116# define rwlock_init(lock) \
117 do { *(lock) = __RW_LOCK_UNLOCKED(lock); } while (0)
118#endif
119
120#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock)
121 107
122#ifdef CONFIG_GENERIC_LOCKBREAK 108#ifdef CONFIG_GENERIC_LOCKBREAK
123#define spin_is_contended(lock) ((lock)->break_lock) 109#define raw_spin_is_contended(lock) ((lock)->break_lock)
124#else 110#else
125 111
126#ifdef __raw_spin_is_contended 112#ifdef arch_spin_is_contended
127#define spin_is_contended(lock) __raw_spin_is_contended(&(lock)->raw_lock) 113#define raw_spin_is_contended(lock) arch_spin_is_contended(&(lock)->raw_lock)
128#else 114#else
129#define spin_is_contended(lock) (((void)(lock), 0)) 115#define raw_spin_is_contended(lock) (((void)(lock), 0))
130#endif /*__raw_spin_is_contended*/ 116#endif /*arch_spin_is_contended*/
131#endif 117#endif
132 118
133/* The lock does not imply full memory barrier. */ 119/* The lock does not imply full memory barrier. */
@@ -136,182 +122,260 @@ static inline void smp_mb__after_lock(void) { smp_mb(); }
136#endif 122#endif
137 123
138/** 124/**
139 * spin_unlock_wait - wait until the spinlock gets unlocked 125 * raw_spin_unlock_wait - wait until the spinlock gets unlocked
140 * @lock: the spinlock in question. 126 * @lock: the spinlock in question.
141 */ 127 */
142#define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock) 128#define raw_spin_unlock_wait(lock) arch_spin_unlock_wait(&(lock)->raw_lock)
143 129
144#ifdef CONFIG_DEBUG_SPINLOCK 130#ifdef CONFIG_DEBUG_SPINLOCK
145 extern void _raw_spin_lock(spinlock_t *lock); 131 extern void do_raw_spin_lock(raw_spinlock_t *lock);
146#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 132#define do_raw_spin_lock_flags(lock, flags) do_raw_spin_lock(lock)
147 extern int _raw_spin_trylock(spinlock_t *lock); 133 extern int do_raw_spin_trylock(raw_spinlock_t *lock);
148 extern void _raw_spin_unlock(spinlock_t *lock); 134 extern void do_raw_spin_unlock(raw_spinlock_t *lock);
149 extern void _raw_read_lock(rwlock_t *lock);
150#define _raw_read_lock_flags(lock, flags) _raw_read_lock(lock)
151 extern int _raw_read_trylock(rwlock_t *lock);
152 extern void _raw_read_unlock(rwlock_t *lock);
153 extern void _raw_write_lock(rwlock_t *lock);
154#define _raw_write_lock_flags(lock, flags) _raw_write_lock(lock)
155 extern int _raw_write_trylock(rwlock_t *lock);
156 extern void _raw_write_unlock(rwlock_t *lock);
157#else 135#else
158# define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock) 136static inline void do_raw_spin_lock(raw_spinlock_t *lock)
159# define _raw_spin_lock_flags(lock, flags) \ 137{
160 __raw_spin_lock_flags(&(lock)->raw_lock, *(flags)) 138 arch_spin_lock(&lock->raw_lock);
161# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock) 139}
162# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock) 140
163# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) 141static inline void
164# define _raw_read_lock_flags(lock, flags) \ 142do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags)
165 __raw_read_lock_flags(&(lock)->raw_lock, *(flags)) 143{
166# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) 144 arch_spin_lock_flags(&lock->raw_lock, *flags);
167# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock) 145}
168# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock) 146
169# define _raw_write_lock_flags(lock, flags) \ 147static inline int do_raw_spin_trylock(raw_spinlock_t *lock)
170 __raw_write_lock_flags(&(lock)->raw_lock, *(flags)) 148{
171# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) 149 return arch_spin_trylock(&(lock)->raw_lock);
172# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock) 150}
151
152static inline void do_raw_spin_unlock(raw_spinlock_t *lock)
153{
154 arch_spin_unlock(&lock->raw_lock);
155}
173#endif 156#endif
174 157
175#define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock)
176#define write_can_lock(rwlock) __raw_write_can_lock(&(rwlock)->raw_lock)
177
178/* 158/*
179 * Define the various spin_lock and rw_lock methods. Note we define these 159 * Define the various spin_lock methods. Note we define these
180 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various 160 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The
181 * methods are defined as nops in the case they are not required. 161 * various methods are defined as nops in the case they are not
162 * required.
182 */ 163 */
183#define spin_trylock(lock) __cond_lock(lock, _spin_trylock(lock)) 164#define raw_spin_trylock(lock) __cond_lock(lock, _raw_spin_trylock(lock))
184#define read_trylock(lock) __cond_lock(lock, _read_trylock(lock))
185#define write_trylock(lock) __cond_lock(lock, _write_trylock(lock))
186 165
187#define spin_lock(lock) _spin_lock(lock) 166#define raw_spin_lock(lock) _raw_spin_lock(lock)
188 167
189#ifdef CONFIG_DEBUG_LOCK_ALLOC 168#ifdef CONFIG_DEBUG_LOCK_ALLOC
190# define spin_lock_nested(lock, subclass) _spin_lock_nested(lock, subclass) 169# define raw_spin_lock_nested(lock, subclass) \
191# define spin_lock_nest_lock(lock, nest_lock) \ 170 _raw_spin_lock_nested(lock, subclass)
171
172# define raw_spin_lock_nest_lock(lock, nest_lock) \
192 do { \ 173 do { \
193 typecheck(struct lockdep_map *, &(nest_lock)->dep_map);\ 174 typecheck(struct lockdep_map *, &(nest_lock)->dep_map);\
194 _spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \ 175 _raw_spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \
195 } while (0) 176 } while (0)
196#else 177#else
197# define spin_lock_nested(lock, subclass) _spin_lock(lock) 178# define raw_spin_lock_nested(lock, subclass) _raw_spin_lock(lock)
198# define spin_lock_nest_lock(lock, nest_lock) _spin_lock(lock) 179# define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock)
199#endif 180#endif
200 181
201#define write_lock(lock) _write_lock(lock)
202#define read_lock(lock) _read_lock(lock)
203
204#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 182#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
205 183
206#define spin_lock_irqsave(lock, flags) \ 184#define raw_spin_lock_irqsave(lock, flags) \
207 do { \ 185 do { \
208 typecheck(unsigned long, flags); \ 186 typecheck(unsigned long, flags); \
209 flags = _spin_lock_irqsave(lock); \ 187 flags = _raw_spin_lock_irqsave(lock); \
210 } while (0)
211#define read_lock_irqsave(lock, flags) \
212 do { \
213 typecheck(unsigned long, flags); \
214 flags = _read_lock_irqsave(lock); \
215 } while (0)
216#define write_lock_irqsave(lock, flags) \
217 do { \
218 typecheck(unsigned long, flags); \
219 flags = _write_lock_irqsave(lock); \
220 } while (0) 188 } while (0)
221 189
222#ifdef CONFIG_DEBUG_LOCK_ALLOC 190#ifdef CONFIG_DEBUG_LOCK_ALLOC
223#define spin_lock_irqsave_nested(lock, flags, subclass) \ 191#define raw_spin_lock_irqsave_nested(lock, flags, subclass) \
224 do { \ 192 do { \
225 typecheck(unsigned long, flags); \ 193 typecheck(unsigned long, flags); \
226 flags = _spin_lock_irqsave_nested(lock, subclass); \ 194 flags = _raw_spin_lock_irqsave_nested(lock, subclass); \
227 } while (0) 195 } while (0)
228#else 196#else
229#define spin_lock_irqsave_nested(lock, flags, subclass) \ 197#define raw_spin_lock_irqsave_nested(lock, flags, subclass) \
230 do { \ 198 do { \
231 typecheck(unsigned long, flags); \ 199 typecheck(unsigned long, flags); \
232 flags = _spin_lock_irqsave(lock); \ 200 flags = _raw_spin_lock_irqsave(lock); \
233 } while (0) 201 } while (0)
234#endif 202#endif
235 203
236#else 204#else
237 205
238#define spin_lock_irqsave(lock, flags) \ 206#define raw_spin_lock_irqsave(lock, flags) \
239 do { \
240 typecheck(unsigned long, flags); \
241 _spin_lock_irqsave(lock, flags); \
242 } while (0)
243#define read_lock_irqsave(lock, flags) \
244 do { \
245 typecheck(unsigned long, flags); \
246 _read_lock_irqsave(lock, flags); \
247 } while (0)
248#define write_lock_irqsave(lock, flags) \
249 do { \ 207 do { \
250 typecheck(unsigned long, flags); \ 208 typecheck(unsigned long, flags); \
251 _write_lock_irqsave(lock, flags); \ 209 _raw_spin_lock_irqsave(lock, flags); \
252 } while (0) 210 } while (0)
253#define spin_lock_irqsave_nested(lock, flags, subclass) \
254 spin_lock_irqsave(lock, flags)
255 211
256#endif 212#define raw_spin_lock_irqsave_nested(lock, flags, subclass) \
213 raw_spin_lock_irqsave(lock, flags)
257 214
258#define spin_lock_irq(lock) _spin_lock_irq(lock) 215#endif
259#define spin_lock_bh(lock) _spin_lock_bh(lock)
260#define read_lock_irq(lock) _read_lock_irq(lock)
261#define read_lock_bh(lock) _read_lock_bh(lock)
262#define write_lock_irq(lock) _write_lock_irq(lock)
263#define write_lock_bh(lock) _write_lock_bh(lock)
264#define spin_unlock(lock) _spin_unlock(lock)
265#define read_unlock(lock) _read_unlock(lock)
266#define write_unlock(lock) _write_unlock(lock)
267#define spin_unlock_irq(lock) _spin_unlock_irq(lock)
268#define read_unlock_irq(lock) _read_unlock_irq(lock)
269#define write_unlock_irq(lock) _write_unlock_irq(lock)
270
271#define spin_unlock_irqrestore(lock, flags) \
272 do { \
273 typecheck(unsigned long, flags); \
274 _spin_unlock_irqrestore(lock, flags); \
275 } while (0)
276#define spin_unlock_bh(lock) _spin_unlock_bh(lock)
277 216
278#define read_unlock_irqrestore(lock, flags) \ 217#define raw_spin_lock_irq(lock) _raw_spin_lock_irq(lock)
279 do { \ 218#define raw_spin_lock_bh(lock) _raw_spin_lock_bh(lock)
280 typecheck(unsigned long, flags); \ 219#define raw_spin_unlock(lock) _raw_spin_unlock(lock)
281 _read_unlock_irqrestore(lock, flags); \ 220#define raw_spin_unlock_irq(lock) _raw_spin_unlock_irq(lock)
282 } while (0)
283#define read_unlock_bh(lock) _read_unlock_bh(lock)
284 221
285#define write_unlock_irqrestore(lock, flags) \ 222#define raw_spin_unlock_irqrestore(lock, flags) \
286 do { \ 223 do { \
287 typecheck(unsigned long, flags); \ 224 typecheck(unsigned long, flags); \
288 _write_unlock_irqrestore(lock, flags); \ 225 _raw_spin_unlock_irqrestore(lock, flags); \
289 } while (0) 226 } while (0)
290#define write_unlock_bh(lock) _write_unlock_bh(lock) 227#define raw_spin_unlock_bh(lock) _raw_spin_unlock_bh(lock)
291 228
292#define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock)) 229#define raw_spin_trylock_bh(lock) \
230 __cond_lock(lock, _raw_spin_trylock_bh(lock))
293 231
294#define spin_trylock_irq(lock) \ 232#define raw_spin_trylock_irq(lock) \
295({ \ 233({ \
296 local_irq_disable(); \ 234 local_irq_disable(); \
297 spin_trylock(lock) ? \ 235 raw_spin_trylock(lock) ? \
298 1 : ({ local_irq_enable(); 0; }); \ 236 1 : ({ local_irq_enable(); 0; }); \
299}) 237})
300 238
301#define spin_trylock_irqsave(lock, flags) \ 239#define raw_spin_trylock_irqsave(lock, flags) \
302({ \ 240({ \
303 local_irq_save(flags); \ 241 local_irq_save(flags); \
304 spin_trylock(lock) ? \ 242 raw_spin_trylock(lock) ? \
305 1 : ({ local_irq_restore(flags); 0; }); \ 243 1 : ({ local_irq_restore(flags); 0; }); \
306}) 244})
307 245
308#define write_trylock_irqsave(lock, flags) \ 246/**
309({ \ 247 * raw_spin_can_lock - would raw_spin_trylock() succeed?
310 local_irq_save(flags); \ 248 * @lock: the spinlock in question.
311 write_trylock(lock) ? \ 249 */
312 1 : ({ local_irq_restore(flags); 0; }); \ 250#define raw_spin_can_lock(lock) (!raw_spin_is_locked(lock))
251
252/* Include rwlock functions */
253#include <linux/rwlock.h>
254
255/*
256 * Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
257 */
258#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
259# include <linux/spinlock_api_smp.h>
260#else
261# include <linux/spinlock_api_up.h>
262#endif
263
264/*
265 * Map the spin_lock functions to the raw variants for PREEMPT_RT=n
266 */
267
268static inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
269{
270 return &lock->rlock;
271}
272
273#define spin_lock_init(_lock) \
274do { \
275 spinlock_check(_lock); \
276 raw_spin_lock_init(&(_lock)->rlock); \
277} while (0)
278
279static inline void spin_lock(spinlock_t *lock)
280{
281 raw_spin_lock(&lock->rlock);
282}
283
284static inline void spin_lock_bh(spinlock_t *lock)
285{
286 raw_spin_lock_bh(&lock->rlock);
287}
288
289static inline int spin_trylock(spinlock_t *lock)
290{
291 return raw_spin_trylock(&lock->rlock);
292}
293
294#define spin_lock_nested(lock, subclass) \
295do { \
296 raw_spin_lock_nested(spinlock_check(lock), subclass); \
297} while (0)
298
299#define spin_lock_nest_lock(lock, nest_lock) \
300do { \
301 raw_spin_lock_nest_lock(spinlock_check(lock), nest_lock); \
302} while (0)
303
304static inline void spin_lock_irq(spinlock_t *lock)
305{
306 raw_spin_lock_irq(&lock->rlock);
307}
308
309#define spin_lock_irqsave(lock, flags) \
310do { \
311 raw_spin_lock_irqsave(spinlock_check(lock), flags); \
312} while (0)
313
314#define spin_lock_irqsave_nested(lock, flags, subclass) \
315do { \
316 raw_spin_lock_irqsave_nested(spinlock_check(lock), flags, subclass); \
317} while (0)
318
319static inline void spin_unlock(spinlock_t *lock)
320{
321 raw_spin_unlock(&lock->rlock);
322}
323
324static inline void spin_unlock_bh(spinlock_t *lock)
325{
326 raw_spin_unlock_bh(&lock->rlock);
327}
328
329static inline void spin_unlock_irq(spinlock_t *lock)
330{
331 raw_spin_unlock_irq(&lock->rlock);
332}
333
334static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
335{
336 raw_spin_unlock_irqrestore(&lock->rlock, flags);
337}
338
339static inline int spin_trylock_bh(spinlock_t *lock)
340{
341 return raw_spin_trylock_bh(&lock->rlock);
342}
343
344static inline int spin_trylock_irq(spinlock_t *lock)
345{
346 return raw_spin_trylock_irq(&lock->rlock);
347}
348
349#define spin_trylock_irqsave(lock, flags) \
350({ \
351 raw_spin_trylock_irqsave(spinlock_check(lock), flags); \
313}) 352})
314 353
354static inline void spin_unlock_wait(spinlock_t *lock)
355{
356 raw_spin_unlock_wait(&lock->rlock);
357}
358
359static inline int spin_is_locked(spinlock_t *lock)
360{
361 return raw_spin_is_locked(&lock->rlock);
362}
363
364static inline int spin_is_contended(spinlock_t *lock)
365{
366 return raw_spin_is_contended(&lock->rlock);
367}
368
369static inline int spin_can_lock(spinlock_t *lock)
370{
371 return raw_spin_can_lock(&lock->rlock);
372}
373
374static inline void assert_spin_locked(spinlock_t *lock)
375{
376 assert_raw_spin_locked(&lock->rlock);
377}
378
315/* 379/*
316 * Pull the atomic_t declaration: 380 * Pull the atomic_t declaration:
317 * (asm-mips/atomic.h needs above definitions) 381 * (asm-mips/atomic.h needs above definitions)
@@ -329,19 +393,4 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
329#define atomic_dec_and_lock(atomic, lock) \ 393#define atomic_dec_and_lock(atomic, lock) \
330 __cond_lock(lock, _atomic_dec_and_lock(atomic, lock)) 394 __cond_lock(lock, _atomic_dec_and_lock(atomic, lock))
331 395
332/**
333 * spin_can_lock - would spin_trylock() succeed?
334 * @lock: the spinlock in question.
335 */
336#define spin_can_lock(lock) (!spin_is_locked(lock))
337
338/*
339 * Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
340 */
341#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
342# include <linux/spinlock_api_smp.h>
343#else
344# include <linux/spinlock_api_up.h>
345#endif
346
347#endif /* __LINUX_SPINLOCK_H */ 396#endif /* __LINUX_SPINLOCK_H */
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 8264a7f459bc..e253ccd7a604 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -17,165 +17,76 @@
17 17
18int in_lock_functions(unsigned long addr); 18int in_lock_functions(unsigned long addr);
19 19
20#define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) 20#define assert_raw_spin_locked(x) BUG_ON(!raw_spin_is_locked(x))
21 21
22void __lockfunc _spin_lock(spinlock_t *lock) __acquires(lock); 22void __lockfunc _raw_spin_lock(raw_spinlock_t *lock) __acquires(lock);
23void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass) 23void __lockfunc _raw_spin_lock_nested(raw_spinlock_t *lock, int subclass)
24 __acquires(lock); 24 __acquires(lock);
25void __lockfunc _spin_lock_nest_lock(spinlock_t *lock, struct lockdep_map *map) 25void __lockfunc
26 __acquires(lock); 26_raw_spin_lock_nest_lock(raw_spinlock_t *lock, struct lockdep_map *map)
27void __lockfunc _read_lock(rwlock_t *lock) __acquires(lock); 27 __acquires(lock);
28void __lockfunc _write_lock(rwlock_t *lock) __acquires(lock); 28void __lockfunc _raw_spin_lock_bh(raw_spinlock_t *lock) __acquires(lock);
29void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(lock); 29void __lockfunc _raw_spin_lock_irq(raw_spinlock_t *lock)
30void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(lock); 30 __acquires(lock);
31void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(lock); 31
32void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(lock); 32unsigned long __lockfunc _raw_spin_lock_irqsave(raw_spinlock_t *lock)
33void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(lock); 33 __acquires(lock);
34void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock); 34unsigned long __lockfunc
35unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) 35_raw_spin_lock_irqsave_nested(raw_spinlock_t *lock, int subclass)
36 __acquires(lock); 36 __acquires(lock);
37unsigned long __lockfunc _spin_lock_irqsave_nested(spinlock_t *lock, int subclass) 37int __lockfunc _raw_spin_trylock(raw_spinlock_t *lock);
38 __acquires(lock); 38int __lockfunc _raw_spin_trylock_bh(raw_spinlock_t *lock);
39unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) 39void __lockfunc _raw_spin_unlock(raw_spinlock_t *lock) __releases(lock);
40 __acquires(lock); 40void __lockfunc _raw_spin_unlock_bh(raw_spinlock_t *lock) __releases(lock);
41unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) 41void __lockfunc _raw_spin_unlock_irq(raw_spinlock_t *lock) __releases(lock);
42 __acquires(lock); 42void __lockfunc
43int __lockfunc _spin_trylock(spinlock_t *lock); 43_raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags)
44int __lockfunc _read_trylock(rwlock_t *lock); 44 __releases(lock);
45int __lockfunc _write_trylock(rwlock_t *lock);
46int __lockfunc _spin_trylock_bh(spinlock_t *lock);
47void __lockfunc _spin_unlock(spinlock_t *lock) __releases(lock);
48void __lockfunc _read_unlock(rwlock_t *lock) __releases(lock);
49void __lockfunc _write_unlock(rwlock_t *lock) __releases(lock);
50void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(lock);
51void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(lock);
52void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(lock);
53void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(lock);
54void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(lock);
55void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(lock);
56void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
57 __releases(lock);
58void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
59 __releases(lock);
60void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
61 __releases(lock);
62 45
63#ifdef CONFIG_INLINE_SPIN_LOCK 46#ifdef CONFIG_INLINE_SPIN_LOCK
64#define _spin_lock(lock) __spin_lock(lock) 47#define _raw_spin_lock(lock) __raw_spin_lock(lock)
65#endif
66
67#ifdef CONFIG_INLINE_READ_LOCK
68#define _read_lock(lock) __read_lock(lock)
69#endif
70
71#ifdef CONFIG_INLINE_WRITE_LOCK
72#define _write_lock(lock) __write_lock(lock)
73#endif 48#endif
74 49
75#ifdef CONFIG_INLINE_SPIN_LOCK_BH 50#ifdef CONFIG_INLINE_SPIN_LOCK_BH
76#define _spin_lock_bh(lock) __spin_lock_bh(lock) 51#define _raw_spin_lock_bh(lock) __raw_spin_lock_bh(lock)
77#endif
78
79#ifdef CONFIG_INLINE_READ_LOCK_BH
80#define _read_lock_bh(lock) __read_lock_bh(lock)
81#endif
82
83#ifdef CONFIG_INLINE_WRITE_LOCK_BH
84#define _write_lock_bh(lock) __write_lock_bh(lock)
85#endif 52#endif
86 53
87#ifdef CONFIG_INLINE_SPIN_LOCK_IRQ 54#ifdef CONFIG_INLINE_SPIN_LOCK_IRQ
88#define _spin_lock_irq(lock) __spin_lock_irq(lock) 55#define _raw_spin_lock_irq(lock) __raw_spin_lock_irq(lock)
89#endif
90
91#ifdef CONFIG_INLINE_READ_LOCK_IRQ
92#define _read_lock_irq(lock) __read_lock_irq(lock)
93#endif
94
95#ifdef CONFIG_INLINE_WRITE_LOCK_IRQ
96#define _write_lock_irq(lock) __write_lock_irq(lock)
97#endif 56#endif
98 57
99#ifdef CONFIG_INLINE_SPIN_LOCK_IRQSAVE 58#ifdef CONFIG_INLINE_SPIN_LOCK_IRQSAVE
100#define _spin_lock_irqsave(lock) __spin_lock_irqsave(lock) 59#define _raw_spin_lock_irqsave(lock) __raw_spin_lock_irqsave(lock)
101#endif
102
103#ifdef CONFIG_INLINE_READ_LOCK_IRQSAVE
104#define _read_lock_irqsave(lock) __read_lock_irqsave(lock)
105#endif
106
107#ifdef CONFIG_INLINE_WRITE_LOCK_IRQSAVE
108#define _write_lock_irqsave(lock) __write_lock_irqsave(lock)
109#endif 60#endif
110 61
111#ifdef CONFIG_INLINE_SPIN_TRYLOCK 62#ifdef CONFIG_INLINE_SPIN_TRYLOCK
112#define _spin_trylock(lock) __spin_trylock(lock) 63#define _raw_spin_trylock(lock) __raw_spin_trylock(lock)
113#endif
114
115#ifdef CONFIG_INLINE_READ_TRYLOCK
116#define _read_trylock(lock) __read_trylock(lock)
117#endif
118
119#ifdef CONFIG_INLINE_WRITE_TRYLOCK
120#define _write_trylock(lock) __write_trylock(lock)
121#endif 64#endif
122 65
123#ifdef CONFIG_INLINE_SPIN_TRYLOCK_BH 66#ifdef CONFIG_INLINE_SPIN_TRYLOCK_BH
124#define _spin_trylock_bh(lock) __spin_trylock_bh(lock) 67#define _raw_spin_trylock_bh(lock) __raw_spin_trylock_bh(lock)
125#endif 68#endif
126 69
127#ifdef CONFIG_INLINE_SPIN_UNLOCK 70#ifdef CONFIG_INLINE_SPIN_UNLOCK
128#define _spin_unlock(lock) __spin_unlock(lock) 71#define _raw_spin_unlock(lock) __raw_spin_unlock(lock)
129#endif
130
131#ifdef CONFIG_INLINE_READ_UNLOCK
132#define _read_unlock(lock) __read_unlock(lock)
133#endif
134
135#ifdef CONFIG_INLINE_WRITE_UNLOCK
136#define _write_unlock(lock) __write_unlock(lock)
137#endif 72#endif
138 73
139#ifdef CONFIG_INLINE_SPIN_UNLOCK_BH 74#ifdef CONFIG_INLINE_SPIN_UNLOCK_BH
140#define _spin_unlock_bh(lock) __spin_unlock_bh(lock) 75#define _raw_spin_unlock_bh(lock) __raw_spin_unlock_bh(lock)
141#endif
142
143#ifdef CONFIG_INLINE_READ_UNLOCK_BH
144#define _read_unlock_bh(lock) __read_unlock_bh(lock)
145#endif
146
147#ifdef CONFIG_INLINE_WRITE_UNLOCK_BH
148#define _write_unlock_bh(lock) __write_unlock_bh(lock)
149#endif 76#endif
150 77
151#ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQ 78#ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQ
152#define _spin_unlock_irq(lock) __spin_unlock_irq(lock) 79#define _raw_spin_unlock_irq(lock) __raw_spin_unlock_irq(lock)
153#endif
154
155#ifdef CONFIG_INLINE_READ_UNLOCK_IRQ
156#define _read_unlock_irq(lock) __read_unlock_irq(lock)
157#endif
158
159#ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQ
160#define _write_unlock_irq(lock) __write_unlock_irq(lock)
161#endif 80#endif
162 81
163#ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE 82#ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE
164#define _spin_unlock_irqrestore(lock, flags) __spin_unlock_irqrestore(lock, flags) 83#define _raw_spin_unlock_irqrestore(lock, flags) __raw_spin_unlock_irqrestore(lock, flags)
165#endif
166
167#ifdef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE
168#define _read_unlock_irqrestore(lock, flags) __read_unlock_irqrestore(lock, flags)
169#endif
170
171#ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE
172#define _write_unlock_irqrestore(lock, flags) __write_unlock_irqrestore(lock, flags)
173#endif 84#endif
174 85
175static inline int __spin_trylock(spinlock_t *lock) 86static inline int __raw_spin_trylock(raw_spinlock_t *lock)
176{ 87{
177 preempt_disable(); 88 preempt_disable();
178 if (_raw_spin_trylock(lock)) { 89 if (do_raw_spin_trylock(lock)) {
179 spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); 90 spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
180 return 1; 91 return 1;
181 } 92 }
@@ -183,28 +94,6 @@ static inline int __spin_trylock(spinlock_t *lock)
183 return 0; 94 return 0;
184} 95}
185 96
186static inline int __read_trylock(rwlock_t *lock)
187{
188 preempt_disable();
189 if (_raw_read_trylock(lock)) {
190 rwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_);
191 return 1;
192 }
193 preempt_enable();
194 return 0;
195}
196
197static inline int __write_trylock(rwlock_t *lock)
198{
199 preempt_disable();
200 if (_raw_write_trylock(lock)) {
201 rwlock_acquire(&lock->dep_map, 0, 1, _RET_IP_);
202 return 1;
203 }
204 preempt_enable();
205 return 0;
206}
207
208/* 97/*
209 * If lockdep is enabled then we use the non-preemption spin-ops 98 * If lockdep is enabled then we use the non-preemption spin-ops
210 * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are 99 * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are
@@ -212,14 +101,7 @@ static inline int __write_trylock(rwlock_t *lock)
212 */ 101 */
213#if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC) 102#if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC)
214 103
215static inline void __read_lock(rwlock_t *lock) 104static inline unsigned long __raw_spin_lock_irqsave(raw_spinlock_t *lock)
216{
217 preempt_disable();
218 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
219 LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
220}
221
222static inline unsigned long __spin_lock_irqsave(spinlock_t *lock)
223{ 105{
224 unsigned long flags; 106 unsigned long flags;
225 107
@@ -228,205 +110,79 @@ static inline unsigned long __spin_lock_irqsave(spinlock_t *lock)
228 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); 110 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
229 /* 111 /*
230 * On lockdep we dont want the hand-coded irq-enable of 112 * On lockdep we dont want the hand-coded irq-enable of
231 * _raw_spin_lock_flags() code, because lockdep assumes 113 * do_raw_spin_lock_flags() code, because lockdep assumes
232 * that interrupts are not re-enabled during lock-acquire: 114 * that interrupts are not re-enabled during lock-acquire:
233 */ 115 */
234#ifdef CONFIG_LOCKDEP 116#ifdef CONFIG_LOCKDEP
235 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); 117 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock);
236#else 118#else
237 _raw_spin_lock_flags(lock, &flags); 119 do_raw_spin_lock_flags(lock, &flags);
238#endif 120#endif
239 return flags; 121 return flags;
240} 122}
241 123
242static inline void __spin_lock_irq(spinlock_t *lock) 124static inline void __raw_spin_lock_irq(raw_spinlock_t *lock)
243{ 125{
244 local_irq_disable(); 126 local_irq_disable();
245 preempt_disable(); 127 preempt_disable();
246 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); 128 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
247 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); 129 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock);
248} 130}
249 131
250static inline void __spin_lock_bh(spinlock_t *lock) 132static inline void __raw_spin_lock_bh(raw_spinlock_t *lock)
251{ 133{
252 local_bh_disable(); 134 local_bh_disable();
253 preempt_disable(); 135 preempt_disable();
254 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); 136 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
255 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); 137 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock);
256}
257
258static inline unsigned long __read_lock_irqsave(rwlock_t *lock)
259{
260 unsigned long flags;
261
262 local_irq_save(flags);
263 preempt_disable();
264 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
265 LOCK_CONTENDED_FLAGS(lock, _raw_read_trylock, _raw_read_lock,
266 _raw_read_lock_flags, &flags);
267 return flags;
268}
269
270static inline void __read_lock_irq(rwlock_t *lock)
271{
272 local_irq_disable();
273 preempt_disable();
274 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
275 LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
276}
277
278static inline void __read_lock_bh(rwlock_t *lock)
279{
280 local_bh_disable();
281 preempt_disable();
282 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
283 LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
284}
285
286static inline unsigned long __write_lock_irqsave(rwlock_t *lock)
287{
288 unsigned long flags;
289
290 local_irq_save(flags);
291 preempt_disable();
292 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
293 LOCK_CONTENDED_FLAGS(lock, _raw_write_trylock, _raw_write_lock,
294 _raw_write_lock_flags, &flags);
295 return flags;
296}
297
298static inline void __write_lock_irq(rwlock_t *lock)
299{
300 local_irq_disable();
301 preempt_disable();
302 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
303 LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
304} 138}
305 139
306static inline void __write_lock_bh(rwlock_t *lock) 140static inline void __raw_spin_lock(raw_spinlock_t *lock)
307{
308 local_bh_disable();
309 preempt_disable();
310 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
311 LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
312}
313
314static inline void __spin_lock(spinlock_t *lock)
315{ 141{
316 preempt_disable(); 142 preempt_disable();
317 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); 143 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
318 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); 144 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock);
319}
320
321static inline void __write_lock(rwlock_t *lock)
322{
323 preempt_disable();
324 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
325 LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
326} 145}
327 146
328#endif /* CONFIG_PREEMPT */ 147#endif /* CONFIG_PREEMPT */
329 148
330static inline void __spin_unlock(spinlock_t *lock) 149static inline void __raw_spin_unlock(raw_spinlock_t *lock)
331{ 150{
332 spin_release(&lock->dep_map, 1, _RET_IP_); 151 spin_release(&lock->dep_map, 1, _RET_IP_);
333 _raw_spin_unlock(lock); 152 do_raw_spin_unlock(lock);
334 preempt_enable();
335}
336
337static inline void __write_unlock(rwlock_t *lock)
338{
339 rwlock_release(&lock->dep_map, 1, _RET_IP_);
340 _raw_write_unlock(lock);
341 preempt_enable();
342}
343
344static inline void __read_unlock(rwlock_t *lock)
345{
346 rwlock_release(&lock->dep_map, 1, _RET_IP_);
347 _raw_read_unlock(lock);
348 preempt_enable(); 153 preempt_enable();
349} 154}
350 155
351static inline void __spin_unlock_irqrestore(spinlock_t *lock, 156static inline void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock,
352 unsigned long flags) 157 unsigned long flags)
353{ 158{
354 spin_release(&lock->dep_map, 1, _RET_IP_); 159 spin_release(&lock->dep_map, 1, _RET_IP_);
355 _raw_spin_unlock(lock); 160 do_raw_spin_unlock(lock);
356 local_irq_restore(flags); 161 local_irq_restore(flags);
357 preempt_enable(); 162 preempt_enable();
358} 163}
359 164
360static inline void __spin_unlock_irq(spinlock_t *lock) 165static inline void __raw_spin_unlock_irq(raw_spinlock_t *lock)
361{ 166{
362 spin_release(&lock->dep_map, 1, _RET_IP_); 167 spin_release(&lock->dep_map, 1, _RET_IP_);
363 _raw_spin_unlock(lock); 168 do_raw_spin_unlock(lock);
364 local_irq_enable(); 169 local_irq_enable();
365 preempt_enable(); 170 preempt_enable();
366} 171}
367 172
368static inline void __spin_unlock_bh(spinlock_t *lock) 173static inline void __raw_spin_unlock_bh(raw_spinlock_t *lock)
369{ 174{
370 spin_release(&lock->dep_map, 1, _RET_IP_); 175 spin_release(&lock->dep_map, 1, _RET_IP_);
371 _raw_spin_unlock(lock); 176 do_raw_spin_unlock(lock);
372 preempt_enable_no_resched();
373 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
374}
375
376static inline void __read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
377{
378 rwlock_release(&lock->dep_map, 1, _RET_IP_);
379 _raw_read_unlock(lock);
380 local_irq_restore(flags);
381 preempt_enable();
382}
383
384static inline void __read_unlock_irq(rwlock_t *lock)
385{
386 rwlock_release(&lock->dep_map, 1, _RET_IP_);
387 _raw_read_unlock(lock);
388 local_irq_enable();
389 preempt_enable();
390}
391
392static inline void __read_unlock_bh(rwlock_t *lock)
393{
394 rwlock_release(&lock->dep_map, 1, _RET_IP_);
395 _raw_read_unlock(lock);
396 preempt_enable_no_resched(); 177 preempt_enable_no_resched();
397 local_bh_enable_ip((unsigned long)__builtin_return_address(0)); 178 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
398} 179}
399 180
400static inline void __write_unlock_irqrestore(rwlock_t *lock, 181static inline int __raw_spin_trylock_bh(raw_spinlock_t *lock)
401 unsigned long flags)
402{
403 rwlock_release(&lock->dep_map, 1, _RET_IP_);
404 _raw_write_unlock(lock);
405 local_irq_restore(flags);
406 preempt_enable();
407}
408
409static inline void __write_unlock_irq(rwlock_t *lock)
410{
411 rwlock_release(&lock->dep_map, 1, _RET_IP_);
412 _raw_write_unlock(lock);
413 local_irq_enable();
414 preempt_enable();
415}
416
417static inline void __write_unlock_bh(rwlock_t *lock)
418{
419 rwlock_release(&lock->dep_map, 1, _RET_IP_);
420 _raw_write_unlock(lock);
421 preempt_enable_no_resched();
422 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
423}
424
425static inline int __spin_trylock_bh(spinlock_t *lock)
426{ 182{
427 local_bh_disable(); 183 local_bh_disable();
428 preempt_disable(); 184 preempt_disable();
429 if (_raw_spin_trylock(lock)) { 185 if (do_raw_spin_trylock(lock)) {
430 spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); 186 spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
431 return 1; 187 return 1;
432 } 188 }
@@ -435,4 +191,6 @@ static inline int __spin_trylock_bh(spinlock_t *lock)
435 return 0; 191 return 0;
436} 192}
437 193
194#include <linux/rwlock_api_smp.h>
195
438#endif /* __LINUX_SPINLOCK_API_SMP_H */ 196#endif /* __LINUX_SPINLOCK_API_SMP_H */
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h
index 04e1d3164576..af1f47229e70 100644
--- a/include/linux/spinlock_api_up.h
+++ b/include/linux/spinlock_api_up.h
@@ -16,7 +16,7 @@
16 16
17#define in_lock_functions(ADDR) 0 17#define in_lock_functions(ADDR) 0
18 18
19#define assert_spin_locked(lock) do { (void)(lock); } while (0) 19#define assert_raw_spin_locked(lock) do { (void)(lock); } while (0)
20 20
21/* 21/*
22 * In the UP-nondebug case there's no real locking going on, so the 22 * In the UP-nondebug case there's no real locking going on, so the
@@ -40,7 +40,8 @@
40 do { preempt_enable(); __release(lock); (void)(lock); } while (0) 40 do { preempt_enable(); __release(lock); (void)(lock); } while (0)
41 41
42#define __UNLOCK_BH(lock) \ 42#define __UNLOCK_BH(lock) \
43 do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0) 43 do { preempt_enable_no_resched(); local_bh_enable(); \
44 __release(lock); (void)(lock); } while (0)
44 45
45#define __UNLOCK_IRQ(lock) \ 46#define __UNLOCK_IRQ(lock) \
46 do { local_irq_enable(); __UNLOCK(lock); } while (0) 47 do { local_irq_enable(); __UNLOCK(lock); } while (0)
@@ -48,34 +49,37 @@
48#define __UNLOCK_IRQRESTORE(lock, flags) \ 49#define __UNLOCK_IRQRESTORE(lock, flags) \
49 do { local_irq_restore(flags); __UNLOCK(lock); } while (0) 50 do { local_irq_restore(flags); __UNLOCK(lock); } while (0)
50 51
51#define _spin_lock(lock) __LOCK(lock) 52#define _raw_spin_lock(lock) __LOCK(lock)
52#define _spin_lock_nested(lock, subclass) __LOCK(lock) 53#define _raw_spin_lock_nested(lock, subclass) __LOCK(lock)
53#define _read_lock(lock) __LOCK(lock) 54#define _raw_read_lock(lock) __LOCK(lock)
54#define _write_lock(lock) __LOCK(lock) 55#define _raw_write_lock(lock) __LOCK(lock)
55#define _spin_lock_bh(lock) __LOCK_BH(lock) 56#define _raw_spin_lock_bh(lock) __LOCK_BH(lock)
56#define _read_lock_bh(lock) __LOCK_BH(lock) 57#define _raw_read_lock_bh(lock) __LOCK_BH(lock)
57#define _write_lock_bh(lock) __LOCK_BH(lock) 58#define _raw_write_lock_bh(lock) __LOCK_BH(lock)
58#define _spin_lock_irq(lock) __LOCK_IRQ(lock) 59#define _raw_spin_lock_irq(lock) __LOCK_IRQ(lock)
59#define _read_lock_irq(lock) __LOCK_IRQ(lock) 60#define _raw_read_lock_irq(lock) __LOCK_IRQ(lock)
60#define _write_lock_irq(lock) __LOCK_IRQ(lock) 61#define _raw_write_lock_irq(lock) __LOCK_IRQ(lock)
61#define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) 62#define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
62#define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) 63#define _raw_read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
63#define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) 64#define _raw_write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
64#define _spin_trylock(lock) ({ __LOCK(lock); 1; }) 65#define _raw_spin_trylock(lock) ({ __LOCK(lock); 1; })
65#define _read_trylock(lock) ({ __LOCK(lock); 1; }) 66#define _raw_read_trylock(lock) ({ __LOCK(lock); 1; })
66#define _write_trylock(lock) ({ __LOCK(lock); 1; }) 67#define _raw_write_trylock(lock) ({ __LOCK(lock); 1; })
67#define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; }) 68#define _raw_spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; })
68#define _spin_unlock(lock) __UNLOCK(lock) 69#define _raw_spin_unlock(lock) __UNLOCK(lock)
69#define _read_unlock(lock) __UNLOCK(lock) 70#define _raw_read_unlock(lock) __UNLOCK(lock)
70#define _write_unlock(lock) __UNLOCK(lock) 71#define _raw_write_unlock(lock) __UNLOCK(lock)
71#define _spin_unlock_bh(lock) __UNLOCK_BH(lock) 72#define _raw_spin_unlock_bh(lock) __UNLOCK_BH(lock)
72#define _write_unlock_bh(lock) __UNLOCK_BH(lock) 73#define _raw_write_unlock_bh(lock) __UNLOCK_BH(lock)
73#define _read_unlock_bh(lock) __UNLOCK_BH(lock) 74#define _raw_read_unlock_bh(lock) __UNLOCK_BH(lock)
74#define _spin_unlock_irq(lock) __UNLOCK_IRQ(lock) 75#define _raw_spin_unlock_irq(lock) __UNLOCK_IRQ(lock)
75#define _read_unlock_irq(lock) __UNLOCK_IRQ(lock) 76#define _raw_read_unlock_irq(lock) __UNLOCK_IRQ(lock)
76#define _write_unlock_irq(lock) __UNLOCK_IRQ(lock) 77#define _raw_write_unlock_irq(lock) __UNLOCK_IRQ(lock)
77#define _spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) 78#define _raw_spin_unlock_irqrestore(lock, flags) \
78#define _read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) 79 __UNLOCK_IRQRESTORE(lock, flags)
79#define _write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) 80#define _raw_read_unlock_irqrestore(lock, flags) \
81 __UNLOCK_IRQRESTORE(lock, flags)
82#define _raw_write_unlock_irqrestore(lock, flags) \
83 __UNLOCK_IRQRESTORE(lock, flags)
80 84
81#endif /* __LINUX_SPINLOCK_API_UP_H */ 85#endif /* __LINUX_SPINLOCK_API_UP_H */
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index 68d88f71f1a2..851b7783720d 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -17,8 +17,8 @@
17 17
18#include <linux/lockdep.h> 18#include <linux/lockdep.h>
19 19
20typedef struct { 20typedef struct raw_spinlock {
21 raw_spinlock_t raw_lock; 21 arch_spinlock_t raw_lock;
22#ifdef CONFIG_GENERIC_LOCKBREAK 22#ifdef CONFIG_GENERIC_LOCKBREAK
23 unsigned int break_lock; 23 unsigned int break_lock;
24#endif 24#endif
@@ -29,26 +29,10 @@ typedef struct {
29#ifdef CONFIG_DEBUG_LOCK_ALLOC 29#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 struct lockdep_map dep_map; 30 struct lockdep_map dep_map;
31#endif 31#endif
32} spinlock_t; 32} raw_spinlock_t;
33 33
34#define SPINLOCK_MAGIC 0xdead4ead 34#define SPINLOCK_MAGIC 0xdead4ead
35 35
36typedef struct {
37 raw_rwlock_t raw_lock;
38#ifdef CONFIG_GENERIC_LOCKBREAK
39 unsigned int break_lock;
40#endif
41#ifdef CONFIG_DEBUG_SPINLOCK
42 unsigned int magic, owner_cpu;
43 void *owner;
44#endif
45#ifdef CONFIG_DEBUG_LOCK_ALLOC
46 struct lockdep_map dep_map;
47#endif
48} rwlock_t;
49
50#define RWLOCK_MAGIC 0xdeaf1eed
51
52#define SPINLOCK_OWNER_INIT ((void *)-1L) 36#define SPINLOCK_OWNER_INIT ((void *)-1L)
53 37
54#ifdef CONFIG_DEBUG_LOCK_ALLOC 38#ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -57,44 +41,56 @@ typedef struct {
57# define SPIN_DEP_MAP_INIT(lockname) 41# define SPIN_DEP_MAP_INIT(lockname)
58#endif 42#endif
59 43
60#ifdef CONFIG_DEBUG_LOCK_ALLOC 44#ifdef CONFIG_DEBUG_SPINLOCK
61# define RW_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname } 45# define SPIN_DEBUG_INIT(lockname) \
46 .magic = SPINLOCK_MAGIC, \
47 .owner_cpu = -1, \
48 .owner = SPINLOCK_OWNER_INIT,
62#else 49#else
63# define RW_DEP_MAP_INIT(lockname) 50# define SPIN_DEBUG_INIT(lockname)
64#endif 51#endif
65 52
66#ifdef CONFIG_DEBUG_SPINLOCK 53#define __RAW_SPIN_LOCK_INITIALIZER(lockname) \
67# define __SPIN_LOCK_UNLOCKED(lockname) \ 54 { \
68 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ 55 .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
69 .magic = SPINLOCK_MAGIC, \ 56 SPIN_DEBUG_INIT(lockname) \
70 .owner = SPINLOCK_OWNER_INIT, \ 57 SPIN_DEP_MAP_INIT(lockname) }
71 .owner_cpu = -1, \ 58
72 SPIN_DEP_MAP_INIT(lockname) } 59#define __RAW_SPIN_LOCK_UNLOCKED(lockname) \
73#define __RW_LOCK_UNLOCKED(lockname) \ 60 (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname)
74 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ 61
75 .magic = RWLOCK_MAGIC, \ 62#define DEFINE_RAW_SPINLOCK(x) raw_spinlock_t x = __RAW_SPIN_LOCK_UNLOCKED(x)
76 .owner = SPINLOCK_OWNER_INIT, \ 63
77 .owner_cpu = -1, \ 64typedef struct spinlock {
78 RW_DEP_MAP_INIT(lockname) } 65 union {
79#else 66 struct raw_spinlock rlock;
80# define __SPIN_LOCK_UNLOCKED(lockname) \ 67
81 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ 68#ifdef CONFIG_DEBUG_LOCK_ALLOC
82 SPIN_DEP_MAP_INIT(lockname) } 69# define LOCK_PADSIZE (offsetof(struct raw_spinlock, dep_map))
83#define __RW_LOCK_UNLOCKED(lockname) \ 70 struct {
84 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ 71 u8 __padding[LOCK_PADSIZE];
85 RW_DEP_MAP_INIT(lockname) } 72 struct lockdep_map dep_map;
73 };
86#endif 74#endif
75 };
76} spinlock_t;
77
78#define __SPIN_LOCK_INITIALIZER(lockname) \
79 { { .rlock = __RAW_SPIN_LOCK_INITIALIZER(lockname) } }
80
81#define __SPIN_LOCK_UNLOCKED(lockname) \
82 (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname)
87 83
88/* 84/*
89 * SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED defeat lockdep state tracking and 85 * SPIN_LOCK_UNLOCKED defeats lockdep state tracking and is hence
90 * are hence deprecated. 86 * deprecated.
91 * Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or 87 * Please use DEFINE_SPINLOCK() or __SPIN_LOCK_UNLOCKED() as
92 * __SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate. 88 * appropriate.
93 */ 89 */
94#define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init) 90#define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init)
95#define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init)
96 91
97#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) 92#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
98#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) 93
94#include <linux/rwlock_types.h>
99 95
100#endif /* __LINUX_SPINLOCK_TYPES_H */ 96#endif /* __LINUX_SPINLOCK_TYPES_H */
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h
index 04135b0e198e..c09b6407ae1b 100644
--- a/include/linux/spinlock_types_up.h
+++ b/include/linux/spinlock_types_up.h
@@ -16,22 +16,22 @@
16 16
17typedef struct { 17typedef struct {
18 volatile unsigned int slock; 18 volatile unsigned int slock;
19} raw_spinlock_t; 19} arch_spinlock_t;
20 20
21#define __RAW_SPIN_LOCK_UNLOCKED { 1 } 21#define __ARCH_SPIN_LOCK_UNLOCKED { 1 }
22 22
23#else 23#else
24 24
25typedef struct { } raw_spinlock_t; 25typedef struct { } arch_spinlock_t;
26 26
27#define __RAW_SPIN_LOCK_UNLOCKED { } 27#define __ARCH_SPIN_LOCK_UNLOCKED { }
28 28
29#endif 29#endif
30 30
31typedef struct { 31typedef struct {
32 /* no debug version on UP */ 32 /* no debug version on UP */
33} raw_rwlock_t; 33} arch_rwlock_t;
34 34
35#define __RAW_RW_LOCK_UNLOCKED { } 35#define __ARCH_RW_LOCK_UNLOCKED { }
36 36
37#endif /* __LINUX_SPINLOCK_TYPES_UP_H */ 37#endif /* __LINUX_SPINLOCK_TYPES_UP_H */
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index d4841ed8215b..b14f6a91e19f 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -18,21 +18,21 @@
18 */ 18 */
19 19
20#ifdef CONFIG_DEBUG_SPINLOCK 20#ifdef CONFIG_DEBUG_SPINLOCK
21#define __raw_spin_is_locked(x) ((x)->slock == 0) 21#define arch_spin_is_locked(x) ((x)->slock == 0)
22 22
23static inline void __raw_spin_lock(raw_spinlock_t *lock) 23static inline void arch_spin_lock(arch_spinlock_t *lock)
24{ 24{
25 lock->slock = 0; 25 lock->slock = 0;
26} 26}
27 27
28static inline void 28static inline void
29__raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) 29arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags)
30{ 30{
31 local_irq_save(flags); 31 local_irq_save(flags);
32 lock->slock = 0; 32 lock->slock = 0;
33} 33}
34 34
35static inline int __raw_spin_trylock(raw_spinlock_t *lock) 35static inline int arch_spin_trylock(arch_spinlock_t *lock)
36{ 36{
37 char oldval = lock->slock; 37 char oldval = lock->slock;
38 38
@@ -41,7 +41,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
41 return oldval > 0; 41 return oldval > 0;
42} 42}
43 43
44static inline void __raw_spin_unlock(raw_spinlock_t *lock) 44static inline void arch_spin_unlock(arch_spinlock_t *lock)
45{ 45{
46 lock->slock = 1; 46 lock->slock = 1;
47} 47}
@@ -49,28 +49,28 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
49/* 49/*
50 * Read-write spinlocks. No debug version. 50 * Read-write spinlocks. No debug version.
51 */ 51 */
52#define __raw_read_lock(lock) do { (void)(lock); } while (0) 52#define arch_read_lock(lock) do { (void)(lock); } while (0)
53#define __raw_write_lock(lock) do { (void)(lock); } while (0) 53#define arch_write_lock(lock) do { (void)(lock); } while (0)
54#define __raw_read_trylock(lock) ({ (void)(lock); 1; }) 54#define arch_read_trylock(lock) ({ (void)(lock); 1; })
55#define __raw_write_trylock(lock) ({ (void)(lock); 1; }) 55#define arch_write_trylock(lock) ({ (void)(lock); 1; })
56#define __raw_read_unlock(lock) do { (void)(lock); } while (0) 56#define arch_read_unlock(lock) do { (void)(lock); } while (0)
57#define __raw_write_unlock(lock) do { (void)(lock); } while (0) 57#define arch_write_unlock(lock) do { (void)(lock); } while (0)
58 58
59#else /* DEBUG_SPINLOCK */ 59#else /* DEBUG_SPINLOCK */
60#define __raw_spin_is_locked(lock) ((void)(lock), 0) 60#define arch_spin_is_locked(lock) ((void)(lock), 0)
61/* for sched.c and kernel_lock.c: */ 61/* for sched.c and kernel_lock.c: */
62# define __raw_spin_lock(lock) do { (void)(lock); } while (0) 62# define arch_spin_lock(lock) do { (void)(lock); } while (0)
63# define __raw_spin_lock_flags(lock, flags) do { (void)(lock); } while (0) 63# define arch_spin_lock_flags(lock, flags) do { (void)(lock); } while (0)
64# define __raw_spin_unlock(lock) do { (void)(lock); } while (0) 64# define arch_spin_unlock(lock) do { (void)(lock); } while (0)
65# define __raw_spin_trylock(lock) ({ (void)(lock); 1; }) 65# define arch_spin_trylock(lock) ({ (void)(lock); 1; })
66#endif /* DEBUG_SPINLOCK */ 66#endif /* DEBUG_SPINLOCK */
67 67
68#define __raw_spin_is_contended(lock) (((void)(lock), 0)) 68#define arch_spin_is_contended(lock) (((void)(lock), 0))
69 69
70#define __raw_read_can_lock(lock) (((void)(lock), 1)) 70#define arch_read_can_lock(lock) (((void)(lock), 1))
71#define __raw_write_can_lock(lock) (((void)(lock), 1)) 71#define arch_write_can_lock(lock) (((void)(lock), 1))
72 72
73#define __raw_spin_unlock_wait(lock) \ 73#define arch_spin_unlock_wait(lock) \
74 do { cpu_relax(); } while (__raw_spin_is_locked(lock)) 74 do { cpu_relax(); } while (arch_spin_is_locked(lock))
75 75
76#endif /* __LINUX_SPINLOCK_UP_H */ 76#endif /* __LINUX_SPINLOCK_UP_H */
diff --git a/include/linux/string.h b/include/linux/string.h
index b8508868d5ad..651839a2a755 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -62,7 +62,15 @@ extern char * strnchr(const char *, size_t, int);
62#ifndef __HAVE_ARCH_STRRCHR 62#ifndef __HAVE_ARCH_STRRCHR
63extern char * strrchr(const char *,int); 63extern char * strrchr(const char *,int);
64#endif 64#endif
65extern char * __must_check strstrip(char *); 65extern char * __must_check skip_spaces(const char *);
66
67extern char *strim(char *);
68
69static inline __must_check char *strstrip(char *str)
70{
71 return strim(str);
72}
73
66#ifndef __HAVE_ARCH_STRSTR 74#ifndef __HAVE_ARCH_STRSTR
67extern char * strstr(const char *,const char *); 75extern char * strstr(const char *,const char *);
68#endif 76#endif
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 10709cbe96fd..c2786f20016f 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -28,9 +28,6 @@
28 28
29#ifdef __KERNEL__ 29#ifdef __KERNEL__
30 30
31#include <linux/timer.h>
32#include <linux/workqueue.h>
33
34/* 31/*
35 * Enable RPC debugging/profiling. 32 * Enable RPC debugging/profiling.
36 */ 33 */
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h
index 87b895d5c786..b78f16b1dea3 100644
--- a/include/linux/sunrpc/rpc_rdma.h
+++ b/include/linux/sunrpc/rpc_rdma.h
@@ -40,6 +40,8 @@
40#ifndef _LINUX_SUNRPC_RPC_RDMA_H 40#ifndef _LINUX_SUNRPC_RPC_RDMA_H
41#define _LINUX_SUNRPC_RPC_RDMA_H 41#define _LINUX_SUNRPC_RPC_RDMA_H
42 42
43#include <linux/types.h>
44
43struct rpcrdma_segment { 45struct rpcrdma_segment {
44 __be32 rs_handle; /* Registered memory handle */ 46 __be32 rs_handle; /* Registered memory handle */
45 __be32 rs_length; /* Length of the chunk in bytes */ 47 __be32 rs_length; /* Length of the chunk in bytes */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 52e8cb0a7569..5a3085b9b394 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -29,7 +29,6 @@ struct svc_pool_stats {
29 unsigned long packets; 29 unsigned long packets;
30 unsigned long sockets_queued; 30 unsigned long sockets_queued;
31 unsigned long threads_woken; 31 unsigned long threads_woken;
32 unsigned long overloads_avoided;
33 unsigned long threads_timedout; 32 unsigned long threads_timedout;
34}; 33};
35 34
@@ -50,7 +49,6 @@ struct svc_pool {
50 struct list_head sp_sockets; /* pending sockets */ 49 struct list_head sp_sockets; /* pending sockets */
51 unsigned int sp_nrthreads; /* # of threads in pool */ 50 unsigned int sp_nrthreads; /* # of threads in pool */
52 struct list_head sp_all_threads; /* all server threads */ 51 struct list_head sp_all_threads; /* all server threads */
53 int sp_nwaking; /* number of threads woken but not yet active */
54 struct svc_pool_stats sp_stats; /* statistics on pool operation */ 52 struct svc_pool_stats sp_stats; /* statistics on pool operation */
55} ____cacheline_aligned_in_smp; 53} ____cacheline_aligned_in_smp;
56 54
@@ -275,16 +273,11 @@ struct svc_rqst {
275 struct auth_domain * rq_client; /* RPC peer info */ 273 struct auth_domain * rq_client; /* RPC peer info */
276 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ 274 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */
277 struct svc_cacherep * rq_cacherep; /* cache info */ 275 struct svc_cacherep * rq_cacherep; /* cache info */
278 struct knfsd_fh * rq_reffh; /* Referrence filehandle, used to
279 * determine what device number
280 * to report (real or virtual)
281 */
282 int rq_splice_ok; /* turned off in gss privacy 276 int rq_splice_ok; /* turned off in gss privacy
283 * to prevent encrypting page 277 * to prevent encrypting page
284 * cache pages */ 278 * cache pages */
285 wait_queue_head_t rq_wait; /* synchronization */ 279 wait_queue_head_t rq_wait; /* synchronization */
286 struct task_struct *rq_task; /* service thread */ 280 struct task_struct *rq_task; /* service thread */
287 int rq_waking; /* 1 if thread is being woken */
288}; 281};
289 282
290/* 283/*
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 4ec90019c1a4..a2602a8207a6 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -145,38 +145,43 @@ enum {
145 SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */ 145 SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */
146 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */ 146 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
147 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */ 147 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
148 SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */
148 /* add others here before... */ 149 /* add others here before... */
149 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ 150 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
150}; 151};
151 152
152#define SWAP_CLUSTER_MAX 32 153#define SWAP_CLUSTER_MAX 32
153 154
154#define SWAP_MAP_MAX 0x7ffe 155#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */
155#define SWAP_MAP_BAD 0x7fff 156#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */
156#define SWAP_HAS_CACHE 0x8000 /* There is a swap cache of entry. */ 157#define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */
157#define SWAP_COUNT_MASK (~SWAP_HAS_CACHE) 158#define SWAP_CONT_MAX 0x7f /* Max count, in each swap_map continuation */
159#define COUNT_CONTINUED 0x80 /* See swap_map continuation for full count */
160#define SWAP_MAP_SHMEM 0xbf /* Owned by shmem/tmpfs, in first swap_map */
161
158/* 162/*
159 * The in-memory structure used to track swap areas. 163 * The in-memory structure used to track swap areas.
160 */ 164 */
161struct swap_info_struct { 165struct swap_info_struct {
162 unsigned long flags; 166 unsigned long flags; /* SWP_USED etc: see above */
163 int prio; /* swap priority */ 167 signed short prio; /* swap priority of this type */
164 int next; /* next entry on swap list */ 168 signed char type; /* strange name for an index */
165 struct file *swap_file; 169 signed char next; /* next type on the swap list */
166 struct block_device *bdev; 170 unsigned int max; /* extent of the swap_map */
167 struct list_head extent_list; 171 unsigned char *swap_map; /* vmalloc'ed array of usage counts */
168 struct swap_extent *curr_swap_extent; 172 unsigned int lowest_bit; /* index of first free in swap_map */
169 unsigned short *swap_map; 173 unsigned int highest_bit; /* index of last free in swap_map */
170 unsigned int lowest_bit; 174 unsigned int pages; /* total of usable pages of swap */
171 unsigned int highest_bit; 175 unsigned int inuse_pages; /* number of those currently in use */
176 unsigned int cluster_next; /* likely index for next allocation */
177 unsigned int cluster_nr; /* countdown to next cluster search */
172 unsigned int lowest_alloc; /* while preparing discard cluster */ 178 unsigned int lowest_alloc; /* while preparing discard cluster */
173 unsigned int highest_alloc; /* while preparing discard cluster */ 179 unsigned int highest_alloc; /* while preparing discard cluster */
174 unsigned int cluster_next; 180 struct swap_extent *curr_swap_extent;
175 unsigned int cluster_nr; 181 struct swap_extent first_swap_extent;
176 unsigned int pages; 182 struct block_device *bdev; /* swap device or bdev of swap file */
177 unsigned int max; 183 struct file *swap_file; /* seldom referenced */
178 unsigned int inuse_pages; 184 unsigned int old_block_size; /* seldom referenced */
179 unsigned int old_block_size;
180}; 185};
181 186
182struct swap_list_t { 187struct swap_list_t {
@@ -273,6 +278,7 @@ extern int scan_unevictable_register_node(struct node *node);
273extern void scan_unevictable_unregister_node(struct node *node); 278extern void scan_unevictable_unregister_node(struct node *node);
274 279
275extern int kswapd_run(int nid); 280extern int kswapd_run(int nid);
281extern void kswapd_stop(int nid);
276 282
277#ifdef CONFIG_MMU 283#ifdef CONFIG_MMU
278/* linux/mm/shmem.c */ 284/* linux/mm/shmem.c */
@@ -309,17 +315,18 @@ extern long total_swap_pages;
309extern void si_swapinfo(struct sysinfo *); 315extern void si_swapinfo(struct sysinfo *);
310extern swp_entry_t get_swap_page(void); 316extern swp_entry_t get_swap_page(void);
311extern swp_entry_t get_swap_page_of_type(int); 317extern swp_entry_t get_swap_page_of_type(int);
312extern void swap_duplicate(swp_entry_t);
313extern int swapcache_prepare(swp_entry_t);
314extern int valid_swaphandles(swp_entry_t, unsigned long *); 318extern int valid_swaphandles(swp_entry_t, unsigned long *);
319extern int add_swap_count_continuation(swp_entry_t, gfp_t);
320extern void swap_shmem_alloc(swp_entry_t);
321extern int swap_duplicate(swp_entry_t);
322extern int swapcache_prepare(swp_entry_t);
315extern void swap_free(swp_entry_t); 323extern void swap_free(swp_entry_t);
316extern void swapcache_free(swp_entry_t, struct page *page); 324extern void swapcache_free(swp_entry_t, struct page *page);
317extern int free_swap_and_cache(swp_entry_t); 325extern int free_swap_and_cache(swp_entry_t);
318extern int swap_type_of(dev_t, sector_t, struct block_device **); 326extern int swap_type_of(dev_t, sector_t, struct block_device **);
319extern unsigned int count_swap_pages(int, int); 327extern unsigned int count_swap_pages(int, int);
320extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); 328extern sector_t map_swap_page(struct page *, struct block_device **);
321extern sector_t swapdev_block(int, pgoff_t); 329extern sector_t swapdev_block(int, pgoff_t);
322extern struct swap_info_struct *get_swap_info_struct(unsigned);
323extern int reuse_swap_page(struct page *); 330extern int reuse_swap_page(struct page *);
324extern int try_to_free_swap(struct page *); 331extern int try_to_free_swap(struct page *);
325struct backing_dev_info; 332struct backing_dev_info;
@@ -384,8 +391,18 @@ static inline void show_swap_cache_info(void)
384#define free_swap_and_cache(swp) is_migration_entry(swp) 391#define free_swap_and_cache(swp) is_migration_entry(swp)
385#define swapcache_prepare(swp) is_migration_entry(swp) 392#define swapcache_prepare(swp) is_migration_entry(swp)
386 393
387static inline void swap_duplicate(swp_entry_t swp) 394static inline int add_swap_count_continuation(swp_entry_t swp, gfp_t gfp_mask)
388{ 395{
396 return 0;
397}
398
399static inline void swap_shmem_alloc(swp_entry_t swp)
400{
401}
402
403static inline int swap_duplicate(swp_entry_t swp)
404{
405 return 0;
389} 406}
390 407
391static inline void swap_free(swp_entry_t swp) 408static inline void swap_free(swp_entry_t swp)
diff --git a/include/linux/timb_gpio.h b/include/linux/timb_gpio.h
new file mode 100644
index 000000000000..ce456eaae861
--- /dev/null
+++ b/include/linux/timb_gpio.h
@@ -0,0 +1,37 @@
1/*
2 * timb_gpio.h timberdale FPGA GPIO driver, platform data definition
3 * Copyright (c) 2009 Intel Corporation
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 License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef _LINUX_TIMB_GPIO_H
20#define _LINUX_TIMB_GPIO_H
21
22/**
23 * struct timbgpio_platform_data - Platform data of the Timberdale GPIO driver
24 * @gpio_base The number of the first GPIO pin, set to -1 for
25 * dynamic number allocation.
26 * @nr_pins Number of pins that is supported by the hardware (1-32)
27 * @irq_base If IRQ is supported by the hardware, this is the base
28 * number of IRQ:s. One IRQ per pin will be used. Set to
29 * -1 if IRQ:s is not supported.
30 */
31struct timbgpio_platform_data {
32 int gpio_base;
33 int nr_pins;
34 int irq_base;
35};
36
37#endif
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 1eb44a924e56..10db0102a890 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -134,6 +134,13 @@ static inline __must_check int tracehook_report_syscall_entry(
134 */ 134 */
135static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step) 135static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
136{ 136{
137 if (step) {
138 siginfo_t info;
139 user_single_step_siginfo(current, regs, &info);
140 force_sig_info(SIGTRAP, &info, current);
141 return;
142 }
143
137 ptrace_report_syscall(regs); 144 ptrace_report_syscall(regs);
138} 145}
139 146
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 405a9035fe40..ef3a2947b102 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -350,8 +350,6 @@ extern void tty_write_flush(struct tty_struct *);
350 350
351extern struct ktermios tty_std_termios; 351extern struct ktermios tty_std_termios;
352 352
353extern int kmsg_redirect;
354
355extern void console_init(void); 353extern void console_init(void);
356extern int vcs_init(void); 354extern int vcs_init(void);
357 355
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 32b92298fd79..d4962a782b8a 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -294,6 +294,7 @@ struct v4l2_pix_format {
294 294
295/* Grey formats */ 295/* Grey formats */
296#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ 296#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
297#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
297#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ 298#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
298 299
299/* Palette formats */ 300/* Palette formats */
@@ -329,7 +330,11 @@ struct v4l2_pix_format {
329#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ 330#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
330#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ 331#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
331#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ 332#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */
332#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10bit raw bayer */ 333#define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */
334#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */
335#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */
336#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */
337#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */
333 /* 10bit raw bayer DPCM compressed to 8 bits */ 338 /* 10bit raw bayer DPCM compressed to 8 bits */
334#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') 339#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
335 /* 340 /*
@@ -732,6 +737,99 @@ struct v4l2_standard {
732}; 737};
733 738
734/* 739/*
740 * V I D E O T I M I N G S D V P R E S E T
741 */
742struct v4l2_dv_preset {
743 __u32 preset;
744 __u32 reserved[4];
745};
746
747/*
748 * D V P R E S E T S E N U M E R A T I O N
749 */
750struct v4l2_dv_enum_preset {
751 __u32 index;
752 __u32 preset;
753 __u8 name[32]; /* Name of the preset timing */
754 __u32 width;
755 __u32 height;
756 __u32 reserved[4];
757};
758
759/*
760 * D V P R E S E T V A L U E S
761 */
762#define V4L2_DV_INVALID 0
763#define V4L2_DV_480P59_94 1 /* BT.1362 */
764#define V4L2_DV_576P50 2 /* BT.1362 */
765#define V4L2_DV_720P24 3 /* SMPTE 296M */
766#define V4L2_DV_720P25 4 /* SMPTE 296M */
767#define V4L2_DV_720P30 5 /* SMPTE 296M */
768#define V4L2_DV_720P50 6 /* SMPTE 296M */
769#define V4L2_DV_720P59_94 7 /* SMPTE 274M */
770#define V4L2_DV_720P60 8 /* SMPTE 274M/296M */
771#define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */
772#define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */
773#define V4L2_DV_1080I25 11 /* BT.1120 */
774#define V4L2_DV_1080I50 12 /* SMPTE 296M */
775#define V4L2_DV_1080I60 13 /* SMPTE 296M */
776#define V4L2_DV_1080P24 14 /* SMPTE 296M */
777#define V4L2_DV_1080P25 15 /* SMPTE 296M */
778#define V4L2_DV_1080P30 16 /* SMPTE 296M */
779#define V4L2_DV_1080P50 17 /* BT.1120 */
780#define V4L2_DV_1080P60 18 /* BT.1120 */
781
782/*
783 * D V B T T I M I N G S
784 */
785
786/* BT.656/BT.1120 timing data */
787struct v4l2_bt_timings {
788 __u32 width; /* width in pixels */
789 __u32 height; /* height in lines */
790 __u32 interlaced; /* Interlaced or progressive */
791 __u32 polarities; /* Positive or negative polarity */
792 __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
793 __u32 hfrontporch; /* Horizpontal front porch in pixels */
794 __u32 hsync; /* Horizontal Sync length in pixels */
795 __u32 hbackporch; /* Horizontal back porch in pixels */
796 __u32 vfrontporch; /* Vertical front porch in pixels */
797 __u32 vsync; /* Vertical Sync length in lines */
798 __u32 vbackporch; /* Vertical back porch in lines */
799 __u32 il_vfrontporch; /* Vertical front porch for bottom field of
800 * interlaced field formats
801 */
802 __u32 il_vsync; /* Vertical sync length for bottom field of
803 * interlaced field formats
804 */
805 __u32 il_vbackporch; /* Vertical back porch for bottom field of
806 * interlaced field formats
807 */
808 __u32 reserved[16];
809} __attribute__ ((packed));
810
811/* Interlaced or progressive format */
812#define V4L2_DV_PROGRESSIVE 0
813#define V4L2_DV_INTERLACED 1
814
815/* Polarities. If bit is not set, it is assumed to be negative polarity */
816#define V4L2_DV_VSYNC_POS_POL 0x00000001
817#define V4L2_DV_HSYNC_POS_POL 0x00000002
818
819
820/* DV timings */
821struct v4l2_dv_timings {
822 __u32 type;
823 union {
824 struct v4l2_bt_timings bt;
825 __u32 reserved[32];
826 };
827} __attribute__ ((packed));
828
829/* Values for the type field */
830#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
831
832/*
735 * V I D E O I N P U T S 833 * V I D E O I N P U T S
736 */ 834 */
737struct v4l2_input { 835struct v4l2_input {
@@ -742,7 +840,8 @@ struct v4l2_input {
742 __u32 tuner; /* Associated tuner */ 840 __u32 tuner; /* Associated tuner */
743 v4l2_std_id std; 841 v4l2_std_id std;
744 __u32 status; 842 __u32 status;
745 __u32 reserved[4]; 843 __u32 capabilities;
844 __u32 reserved[3];
746}; 845};
747 846
748/* Values for the 'type' field */ 847/* Values for the 'type' field */
@@ -773,6 +872,11 @@ struct v4l2_input {
773#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ 872#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */
774#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ 873#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */
775 874
875/* capabilities flags */
876#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
877#define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
878#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */
879
776/* 880/*
777 * V I D E O O U T P U T S 881 * V I D E O O U T P U T S
778 */ 882 */
@@ -783,13 +887,19 @@ struct v4l2_output {
783 __u32 audioset; /* Associated audios (bitfield) */ 887 __u32 audioset; /* Associated audios (bitfield) */
784 __u32 modulator; /* Associated modulator */ 888 __u32 modulator; /* Associated modulator */
785 v4l2_std_id std; 889 v4l2_std_id std;
786 __u32 reserved[4]; 890 __u32 capabilities;
891 __u32 reserved[3];
787}; 892};
788/* Values for the 'type' field */ 893/* Values for the 'type' field */
789#define V4L2_OUTPUT_TYPE_MODULATOR 1 894#define V4L2_OUTPUT_TYPE_MODULATOR 1
790#define V4L2_OUTPUT_TYPE_ANALOG 2 895#define V4L2_OUTPUT_TYPE_ANALOG 2
791#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 896#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3
792 897
898/* capabilities flags */
899#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
900#define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
901#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */
902
793/* 903/*
794 * C O N T R O L S 904 * C O N T R O L S
795 */ 905 */
@@ -1624,6 +1734,13 @@ struct v4l2_dbg_chip_ident {
1624#endif 1734#endif
1625 1735
1626#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1736#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
1737#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset)
1738#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset)
1739#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset)
1740#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset)
1741#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
1742#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
1743
1627/* Reminder: when adding new ioctls please add support for them to 1744/* Reminder: when adding new ioctls please add support for them to
1628 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 1745 drivers/media/video/v4l2-compat-ioctl32.c as well! */
1629 1746
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index d85889710f9b..ee03bba9c5df 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -40,6 +40,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
40 PGSCAN_ZONE_RECLAIM_FAILED, 40 PGSCAN_ZONE_RECLAIM_FAILED,
41#endif 41#endif
42 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, 42 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
43 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
44 KSWAPD_SKIP_CONGESTION_WAIT,
43 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 45 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
44#ifdef CONFIG_HUGETLB_PAGE 46#ifdef CONFIG_HUGETLB_PAGE
45 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, 47 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
diff --git a/include/linux/vt.h b/include/linux/vt.h
index 7ffa11f06232..3fb9944e50a6 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -84,4 +84,19 @@ struct vt_setactivate {
84 84
85#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */ 85#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */
86 86
87#ifdef CONFIG_VT_CONSOLE
88
89extern int vt_kmsg_redirect(int new);
90
91#else
92
93static inline int vt_kmsg_redirect(int new)
94{
95 return 0;
96}
97
98#endif
99
100#define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
101
87#endif /* _LINUX_VT_H */ 102#endif /* _LINUX_VT_H */
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index e41a99ee353e..2c6af24b905e 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -26,26 +26,7 @@
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/spinlock.h> 29#include <media/ir-core.h>
30
31extern int media_ir_debug; /* media_ir_debug level (0,1,2) */
32#define IR_dprintk(level, fmt, arg...) if (media_ir_debug >= level) \
33 printk(KERN_DEBUG "%s: " fmt , __func__, ## arg)
34
35#define IR_TYPE_RC5 1
36#define IR_TYPE_PD 2 /* Pulse distance encoded IR */
37#define IR_TYPE_OTHER 99
38
39struct ir_scancode {
40 u16 scancode;
41 u32 keycode;
42};
43
44struct ir_scancode_table {
45 struct ir_scancode *scan;
46 int size;
47 spinlock_t lock;
48};
49 30
50#define RC5_START(x) (((x)>>12)&3) 31#define RC5_START(x) (((x)>>12)&3)
51#define RC5_TOGGLE(x) (((x)>>11)&1) 32#define RC5_TOGGLE(x) (((x)>>11)&1)
@@ -56,8 +37,6 @@ struct ir_input_state {
56 /* configuration */ 37 /* configuration */
57 int ir_type; 38 int ir_type;
58 39
59 struct ir_scancode_table keytable;
60
61 /* key info */ 40 /* key info */
62 u32 ir_key; /* ir scancode */ 41 u32 ir_key; /* ir scancode */
63 u32 keycode; /* linux key code */ 42 u32 keycode; /* linux key code */
@@ -105,7 +84,7 @@ struct card_ir {
105/* Routines from ir-functions.c */ 84/* Routines from ir-functions.c */
106 85
107int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 86int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
108 int ir_type, struct ir_scancode_table *ir_codes); 87 int ir_type);
109void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); 88void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
110void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, 89void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
111 u32 ir_key); 90 u32 ir_key);
@@ -118,19 +97,6 @@ u32 ir_rc5_decode(unsigned int code);
118void ir_rc5_timer_end(unsigned long data); 97void ir_rc5_timer_end(unsigned long data);
119void ir_rc5_timer_keyup(unsigned long data); 98void ir_rc5_timer_keyup(unsigned long data);
120 99
121/* Routines from ir-keytable.c */
122
123u32 ir_g_keycode_from_table(struct input_dev *input_dev,
124 u32 scancode);
125
126int ir_set_keycode_table(struct input_dev *input_dev,
127 struct ir_scancode_table *rc_tab);
128
129int ir_roundup_tablesize(int n_elems);
130int ir_copy_table(struct ir_scancode_table *destin,
131 const struct ir_scancode_table *origin);
132void ir_input_free(struct input_dev *input_dev);
133
134/* scancode->keycode map tables from ir-keymaps.c */ 100/* scancode->keycode map tables from ir-keymaps.c */
135 101
136extern struct ir_scancode_table ir_codes_empty_table; 102extern struct ir_scancode_table ir_codes_empty_table;
@@ -195,4 +161,5 @@ extern struct ir_scancode_table ir_codes_evga_indtube_table;
195extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table; 161extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table;
196extern struct ir_scancode_table ir_codes_videomate_s350_table; 162extern struct ir_scancode_table ir_codes_videomate_s350_table;
197extern struct ir_scancode_table ir_codes_gadmei_rm008z_table; 163extern struct ir_scancode_table ir_codes_gadmei_rm008z_table;
164extern struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table;
198#endif 165#endif
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
new file mode 100644
index 000000000000..299d201e1339
--- /dev/null
+++ b/include/media/ir-core.h
@@ -0,0 +1,62 @@
1/*
2 * Remote Controller core header
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _IR_CORE
15#define _IR_CORE
16
17#include <linux/input.h>
18#include <linux/spinlock.h>
19
20extern int ir_core_debug;
21#define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \
22 printk(KERN_DEBUG "%s: " fmt , __func__, ## arg)
23
24enum ir_type {
25 IR_TYPE_UNKNOWN = 0,
26 IR_TYPE_RC5 = 1,
27 IR_TYPE_PD = 2, /* Pulse distance encoded IR */
28 IR_TYPE_NEC = 3,
29 IR_TYPE_OTHER = 99,
30};
31
32struct ir_scancode {
33 u16 scancode;
34 u32 keycode;
35};
36
37struct ir_scancode_table {
38 struct ir_scancode *scan;
39 int size;
40 enum ir_type ir_type;
41 spinlock_t lock;
42};
43
44struct ir_input_dev {
45 struct input_dev *dev;
46 struct ir_scancode_table rc_tab;
47};
48
49/* Routines from ir-keytable.c */
50
51u32 ir_g_keycode_from_table(struct input_dev *input_dev,
52 u32 scancode);
53
54int ir_set_keycode_table(struct input_dev *input_dev,
55 struct ir_scancode_table *rc_tab);
56
57int ir_roundup_tablesize(int n_elems);
58int ir_input_register(struct input_dev *dev,
59 struct ir_scancode_table *ir_codes);
60void ir_input_unregister(struct input_dev *input_dev);
61
62#endif
diff --git a/include/media/mt9t112.h b/include/media/mt9t112.h
new file mode 100644
index 000000000000..a43c74ab05ec
--- /dev/null
+++ b/include/media/mt9t112.h
@@ -0,0 +1,30 @@
1/* mt9t112 Camera
2 *
3 * Copyright (C) 2009 Renesas Solutions Corp.
4 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __MT9T112_H__
12#define __MT9T112_H__
13
14#define MT9T112_FLAG_PCLK_RISING_EDGE (1 << 0)
15#define MT9T112_FLAG_DATAWIDTH_8 (1 << 1) /* default width is 10 */
16
17struct mt9t112_pll_divider {
18 u8 m, n;
19 u8 p1, p2, p3, p4, p5, p6, p7;
20};
21
22/*
23 * mt9t112 camera info
24 */
25struct mt9t112_camera_info {
26 u32 flags;
27 struct mt9t112_pll_divider divider;
28};
29
30#endif /* __MT9T112_H__ */
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 30d9629198ef..14c77efd6a85 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -1,4 +1,5 @@
1/* ov772x Camera 1/*
2 * ov772x Camera
2 * 3 *
3 * Copyright (C) 2008 Renesas Solutions Corp. 4 * Copyright (C) 2008 Renesas Solutions Corp.
4 * Kuninori Morimoto <morimoto.kuninori@renesas.com> 5 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
@@ -54,7 +55,6 @@ struct ov772x_edge_ctrl {
54struct ov772x_camera_info { 55struct ov772x_camera_info {
55 unsigned long buswidth; 56 unsigned long buswidth;
56 unsigned long flags; 57 unsigned long flags;
57 struct soc_camera_link link;
58 struct ov772x_edge_ctrl edgectrl; 58 struct ov772x_edge_ctrl edgectrl;
59}; 59};
60 60
diff --git a/include/media/rj54n1cb0c.h b/include/media/rj54n1cb0c.h
new file mode 100644
index 000000000000..8ae3288ae925
--- /dev/null
+++ b/include/media/rj54n1cb0c.h
@@ -0,0 +1,19 @@
1/*
2 * RJ54N1CB0C Private data
3 *
4 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __RJ54N1CB0C_H__
12#define __RJ54N1CB0C_H__
13
14struct rj54n1_pdata {
15 unsigned int mclk_freq;
16 bool ioctl_high;
17};
18
19#endif
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index eed5fccc83f3..4aeff96ff7d8 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -108,8 +108,6 @@ struct saa7146_fh {
108 108
109struct saa7146_vv 109struct saa7146_vv
110{ 110{
111 int vbi_minor;
112
113 /* vbi capture */ 111 /* vbi capture */
114 struct saa7146_dmaqueue vbi_q; 112 struct saa7146_dmaqueue vbi_q;
115 /* vbi workaround interrupt queue */ 113 /* vbi workaround interrupt queue */
@@ -117,8 +115,6 @@ struct saa7146_vv
117 int vbi_fieldcount; 115 int vbi_fieldcount;
118 struct saa7146_fh *vbi_streaming; 116 struct saa7146_fh *vbi_streaming;
119 117
120 int video_minor;
121
122 int video_status; 118 int video_status;
123 struct saa7146_fh *video_fh; 119 struct saa7146_fh *video_fh;
124 120
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 0f3524cff435..b67747836878 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -3,6 +3,8 @@
3 3
4#define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */ 4#define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */
5#define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */ 5#define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */
6#define SH_CEU_FLAG_HSYNC_LOW (1 << 2) /* default High if possible */
7#define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */
6 8
7struct sh_mobile_ceu_info { 9struct sh_mobile_ceu_info {
8 unsigned long flags; 10 unsigned long flags;
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 3d74e60032dd..dcc5b86bcb6c 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -24,18 +24,13 @@ struct soc_camera_device {
24 struct device *pdev; /* Platform device */ 24 struct device *pdev; /* Platform device */
25 s32 user_width; 25 s32 user_width;
26 s32 user_height; 26 s32 user_height;
27 unsigned short width_min; 27 enum v4l2_colorspace colorspace;
28 unsigned short height_min;
29 unsigned short y_skip_top; /* Lines to skip at the top */
30 unsigned char iface; /* Host number */ 28 unsigned char iface; /* Host number */
31 unsigned char devnum; /* Device number per host */ 29 unsigned char devnum; /* Device number per host */
32 unsigned char buswidth; /* See comment in .c */
33 struct soc_camera_sense *sense; /* See comment in struct definition */ 30 struct soc_camera_sense *sense; /* See comment in struct definition */
34 struct soc_camera_ops *ops; 31 struct soc_camera_ops *ops;
35 struct video_device *vdev; 32 struct video_device *vdev;
36 const struct soc_camera_data_format *current_fmt; 33 const struct soc_camera_format_xlate *current_fmt;
37 const struct soc_camera_data_format *formats;
38 int num_formats;
39 struct soc_camera_format_xlate *user_formats; 34 struct soc_camera_format_xlate *user_formats;
40 int num_user_formats; 35 int num_user_formats;
41 enum v4l2_field field; /* Preserve field over close() */ 36 enum v4l2_field field; /* Preserve field over close() */
@@ -107,6 +102,8 @@ struct soc_camera_link {
107 int i2c_adapter_id; 102 int i2c_adapter_id;
108 struct i2c_board_info *board_info; 103 struct i2c_board_info *board_info;
109 const char *module_name; 104 const char *module_name;
105 void *priv;
106
110 /* 107 /*
111 * For non-I2C devices platform platform has to provide methods to 108 * For non-I2C devices platform platform has to provide methods to
112 * add a device to the system and to remove 109 * add a device to the system and to remove
@@ -162,23 +159,13 @@ static inline struct v4l2_subdev *soc_camera_to_subdev(
162int soc_camera_host_register(struct soc_camera_host *ici); 159int soc_camera_host_register(struct soc_camera_host *ici);
163void soc_camera_host_unregister(struct soc_camera_host *ici); 160void soc_camera_host_unregister(struct soc_camera_host *ici);
164 161
165const struct soc_camera_data_format *soc_camera_format_by_fourcc(
166 struct soc_camera_device *icd, unsigned int fourcc);
167const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( 162const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc(
168 struct soc_camera_device *icd, unsigned int fourcc); 163 struct soc_camera_device *icd, unsigned int fourcc);
169 164
170struct soc_camera_data_format {
171 const char *name;
172 unsigned int depth;
173 __u32 fourcc;
174 enum v4l2_colorspace colorspace;
175};
176
177/** 165/**
178 * struct soc_camera_format_xlate - match between host and sensor formats 166 * struct soc_camera_format_xlate - match between host and sensor formats
179 * @cam_fmt: sensor format provided by the sensor 167 * @code: code of a sensor provided format
180 * @host_fmt: host format after host translation from cam_fmt 168 * @host_fmt: host format after host translation from code
181 * @buswidth: bus width for this format
182 * 169 *
183 * Host and sensor translation structure. Used in table of host and sensor 170 * Host and sensor translation structure. Used in table of host and sensor
184 * formats matchings in soc_camera_device. A host can override the generic list 171 * formats matchings in soc_camera_device. A host can override the generic list
@@ -186,9 +173,8 @@ struct soc_camera_data_format {
186 * format setup. 173 * format setup.
187 */ 174 */
188struct soc_camera_format_xlate { 175struct soc_camera_format_xlate {
189 const struct soc_camera_data_format *cam_fmt; 176 enum v4l2_mbus_pixelcode code;
190 const struct soc_camera_data_format *host_fmt; 177 const struct soc_mbus_pixelfmt *host_fmt;
191 unsigned char buswidth;
192}; 178};
193 179
194struct soc_camera_ops { 180struct soc_camera_ops {
diff --git a/include/media/soc_camera_platform.h b/include/media/soc_camera_platform.h
index bb70401b8141..0ecefe227b76 100644
--- a/include/media/soc_camera_platform.h
+++ b/include/media/soc_camera_platform.h
@@ -19,11 +19,10 @@ struct device;
19struct soc_camera_platform_info { 19struct soc_camera_platform_info {
20 const char *format_name; 20 const char *format_name;
21 unsigned long format_depth; 21 unsigned long format_depth;
22 struct v4l2_pix_format format; 22 struct v4l2_mbus_framefmt format;
23 unsigned long bus_param; 23 unsigned long bus_param;
24 struct device *dev; 24 struct device *dev;
25 int (*set_capture)(struct soc_camera_platform_info *info, int enable); 25 int (*set_capture)(struct soc_camera_platform_info *info, int enable);
26 struct soc_camera_link link;
27}; 26};
28 27
29#endif /* __SOC_CAMERA_H__ */ 28#endif /* __SOC_CAMERA_H__ */
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h
new file mode 100644
index 000000000000..037cd7be001e
--- /dev/null
+++ b/include/media/soc_mediabus.h
@@ -0,0 +1,65 @@
1/*
2 * SoC-camera Media Bus API extensions
3 *
4 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef SOC_MEDIABUS_H
12#define SOC_MEDIABUS_H
13
14#include <linux/videodev2.h>
15
16#include <media/v4l2-mediabus.h>
17
18/**
19 * enum soc_mbus_packing - data packing types on the media-bus
20 * @SOC_MBUS_PACKING_NONE: no packing, bit-for-bit transfer to RAM
21 * @SOC_MBUS_PACKING_2X8_PADHI: 16 bits transferred in 2 8-bit samples, in the
22 * possibly incomplete byte high bits are padding
23 * @SOC_MBUS_PACKING_2X8_PADLO: as above, but low bits are padding
24 * @SOC_MBUS_PACKING_EXTEND16: sample width (e.g., 10 bits) has to be extended
25 * to 16 bits
26 */
27enum soc_mbus_packing {
28 SOC_MBUS_PACKING_NONE,
29 SOC_MBUS_PACKING_2X8_PADHI,
30 SOC_MBUS_PACKING_2X8_PADLO,
31 SOC_MBUS_PACKING_EXTEND16,
32};
33
34/**
35 * enum soc_mbus_order - sample order on the media bus
36 * @SOC_MBUS_ORDER_LE: least significant sample first
37 * @SOC_MBUS_ORDER_BE: most significant sample first
38 */
39enum soc_mbus_order {
40 SOC_MBUS_ORDER_LE,
41 SOC_MBUS_ORDER_BE,
42};
43
44/**
45 * struct soc_mbus_pixelfmt - Data format on the media bus
46 * @name: Name of the format
47 * @fourcc: Fourcc code, that will be obtained if the data is
48 * stored in memory in the following way:
49 * @packing: Type of sample-packing, that has to be used
50 * @order: Sample order when storing in memory
51 * @bits_per_sample: How many bits the bridge has to sample
52 */
53struct soc_mbus_pixelfmt {
54 const char *name;
55 u32 fourcc;
56 enum soc_mbus_packing packing;
57 enum soc_mbus_order order;
58 u8 bits_per_sample;
59};
60
61const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
62 enum v4l2_mbus_pixelcode code);
63s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
64
65#endif
diff --git a/include/media/tw9910.h b/include/media/tw9910.h
index 73231e7880d8..5e2895a05e6b 100644
--- a/include/media/tw9910.h
+++ b/include/media/tw9910.h
@@ -32,7 +32,6 @@ enum tw9910_mpout_pin {
32struct tw9910_video_info { 32struct tw9910_video_info {
33 unsigned long buswidth; 33 unsigned long buswidth;
34 enum tw9910_mpout_pin mpout; 34 enum tw9910_mpout_pin mpout;
35 struct soc_camera_link link;
36}; 35};
37 36
38 37
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 91942dbe64e3..6cc107d198a0 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -267,6 +267,8 @@ enum {
267 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ 267 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
268 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ 268 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
269 V4L2_IDENT_MT9T031 = 45020, 269 V4L2_IDENT_MT9T031 = 45020,
270 V4L2_IDENT_MT9T111 = 45021,
271 V4L2_IDENT_MT9T112 = 45022,
270 V4L2_IDENT_MT9V111 = 45031, 272 V4L2_IDENT_MT9V111 = 45031,
271 V4L2_IDENT_MT9V112 = 45032, 273 V4L2_IDENT_MT9V112 = 45032,
272 274
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 1c25b10da34b..1c7b259f341c 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -212,5 +212,5 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
212 unsigned int *h, unsigned int hmin, 212 unsigned int *h, unsigned int hmin,
213 unsigned int hmax, unsigned int halign, 213 unsigned int hmax, unsigned int halign,
214 unsigned int salign); 214 unsigned int salign);
215 215int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info);
216#endif /* V4L2_COMMON_H_ */ 216#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 73c9867d744c..2dee93892ea2 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -28,10 +28,10 @@ struct v4l2_ioctl_callbacks;
28struct video_device; 28struct video_device;
29struct v4l2_device; 29struct v4l2_device;
30 30
31/* Flag to mark the video_device struct as unregistered. 31/* Flag to mark the video_device struct as registered.
32 Drivers can set this flag if they want to block all future 32 Drivers can clear this flag if they want to block all future
33 device access. It is set by video_unregister_device. */ 33 device access. It is cleared by video_unregister_device. */
34#define V4L2_FL_UNREGISTERED (0) 34#define V4L2_FL_REGISTERED (0)
35 35
36struct v4l2_file_operations { 36struct v4l2_file_operations {
37 struct module *owner; 37 struct module *owner;
@@ -96,9 +96,7 @@ struct video_device
96/* Register video devices. Note that if video_register_device fails, 96/* Register video devices. Note that if video_register_device fails,
97 the release() callback of the video_device structure is *not* called, so 97 the release() callback of the video_device structure is *not* called, so
98 the caller is responsible for freeing any data. Usually that means that 98 the caller is responsible for freeing any data. Usually that means that
99 you call video_device_release() on failure. 99 you call video_device_release() on failure. */
100
101 Also note that vdev->minor is set to -1 if the registration failed. */
102int __must_check video_register_device(struct video_device *vdev, int type, int nr); 100int __must_check video_register_device(struct video_device *vdev, int type, int nr);
103 101
104/* Same as video_register_device, but no warning is issued if the desired 102/* Same as video_register_device, but no warning is issued if the desired
@@ -106,7 +104,7 @@ int __must_check video_register_device(struct video_device *vdev, int type, int
106int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr); 104int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr);
107 105
108/* Unregister video devices. Will do nothing if vdev == NULL or 106/* Unregister video devices. Will do nothing if vdev == NULL or
109 vdev->minor < 0. */ 107 video_is_registered() returns false. */
110void video_unregister_device(struct video_device *vdev); 108void video_unregister_device(struct video_device *vdev);
111 109
112/* helper functions to alloc/release struct video_device, the 110/* helper functions to alloc/release struct video_device, the
@@ -141,9 +139,14 @@ static inline void *video_drvdata(struct file *file)
141 return video_get_drvdata(video_devdata(file)); 139 return video_get_drvdata(video_devdata(file));
142} 140}
143 141
144static inline int video_is_unregistered(struct video_device *vdev) 142static inline const char *video_device_node_name(struct video_device *vdev)
143{
144 return dev_name(&vdev->dev);
145}
146
147static inline int video_is_registered(struct video_device *vdev)
145{ 148{
146 return test_bit(V4L2_FL_UNREGISTERED, &vdev->flags); 149 return test_bit(V4L2_FL_REGISTERED, &vdev->flags);
147} 150}
148 151
149#endif /* _V4L2_DEV_H */ 152#endif /* _V4L2_DEV_H */
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 7a4529defa88..e8ba0f2efbae 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -239,6 +239,21 @@ struct v4l2_ioctl_ops {
239 int (*vidioc_enum_frameintervals) (struct file *file, void *fh, 239 int (*vidioc_enum_frameintervals) (struct file *file, void *fh,
240 struct v4l2_frmivalenum *fival); 240 struct v4l2_frmivalenum *fival);
241 241
242 /* DV Timings IOCTLs */
243 int (*vidioc_enum_dv_presets) (struct file *file, void *fh,
244 struct v4l2_dv_enum_preset *preset);
245
246 int (*vidioc_s_dv_preset) (struct file *file, void *fh,
247 struct v4l2_dv_preset *preset);
248 int (*vidioc_g_dv_preset) (struct file *file, void *fh,
249 struct v4l2_dv_preset *preset);
250 int (*vidioc_query_dv_preset) (struct file *file, void *fh,
251 struct v4l2_dv_preset *qpreset);
252 int (*vidioc_s_dv_timings) (struct file *file, void *fh,
253 struct v4l2_dv_timings *timings);
254 int (*vidioc_g_dv_timings) (struct file *file, void *fh,
255 struct v4l2_dv_timings *timings);
256
242 /* For other private ioctls */ 257 /* For other private ioctls */
243 long (*vidioc_default) (struct file *file, void *fh, 258 long (*vidioc_default) (struct file *file, void *fh,
244 int cmd, void *arg); 259 int cmd, void *arg);
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
new file mode 100644
index 000000000000..0dbe02ada259
--- /dev/null
+++ b/include/media/v4l2-mediabus.h
@@ -0,0 +1,61 @@
1/*
2 * Media Bus API header
3 *
4 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef V4L2_MEDIABUS_H
12#define V4L2_MEDIABUS_H
13
14/*
15 * These pixel codes uniquely identify data formats on the media bus. Mostly
16 * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
17 * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
18 * data format is fixed. Additionally, "2X8" means that one pixel is transferred
19 * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
20 * transferred over the bus: "LE" means that the least significant bits are
21 * transferred first, "BE" means that the most significant bits are transferred
22 * first, and "PADHI" and "PADLO" define which bits - low or high, in the
23 * incomplete high byte, are filled with padding bits.
24 */
25enum v4l2_mbus_pixelcode {
26 V4L2_MBUS_FMT_FIXED = 1,
27 V4L2_MBUS_FMT_YUYV8_2X8_LE,
28 V4L2_MBUS_FMT_YVYU8_2X8_LE,
29 V4L2_MBUS_FMT_YUYV8_2X8_BE,
30 V4L2_MBUS_FMT_YVYU8_2X8_BE,
31 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE,
32 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE,
33 V4L2_MBUS_FMT_RGB565_2X8_LE,
34 V4L2_MBUS_FMT_RGB565_2X8_BE,
35 V4L2_MBUS_FMT_SBGGR8_1X8,
36 V4L2_MBUS_FMT_SBGGR10_1X10,
37 V4L2_MBUS_FMT_GREY8_1X8,
38 V4L2_MBUS_FMT_Y10_1X10,
39 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE,
40 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE,
41 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE,
42 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE,
43};
44
45/**
46 * struct v4l2_mbus_framefmt - frame format on the media bus
47 * @width: frame width
48 * @height: frame height
49 * @code: data format code
50 * @field: used interlacing type
51 * @colorspace: colorspace of the data
52 */
53struct v4l2_mbus_framefmt {
54 __u32 width;
55 __u32 height;
56 enum v4l2_mbus_pixelcode code;
57 enum v4l2_field field;
58 enum v4l2_colorspace colorspace;
59};
60
61#endif
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 00bf17608453..9ba99cd39ee7 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -22,6 +22,7 @@
22#define _V4L2_SUBDEV_H 22#define _V4L2_SUBDEV_H
23 23
24#include <media/v4l2-common.h> 24#include <media/v4l2-common.h>
25#include <media/v4l2-mediabus.h>
25 26
26/* generic v4l2_device notify callback notification values */ 27/* generic v4l2_device notify callback notification values */
27#define V4L2_SUBDEV_IR_RX_NOTIFY _IOW('v', 0, u32) 28#define V4L2_SUBDEV_IR_RX_NOTIFY _IOW('v', 0, u32)
@@ -207,7 +208,7 @@ struct v4l2_subdev_audio_ops {
207 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by 208 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
208 video input devices. 209 video input devices.
209 210
210 s_crystal_freq: sets the frequency of the crystal used to generate the 211 s_crystal_freq: sets the frequency of the crystal used to generate the
211 clocks in Hz. An extra flags field allows device specific configuration 212 clocks in Hz. An extra flags field allows device specific configuration
212 regarding clock frequency dividers, etc. If not used, then set flags 213 regarding clock frequency dividers, etc. If not used, then set flags
213 to 0. If the frequency is not supported, then -EINVAL is returned. 214 to 0. If the frequency is not supported, then -EINVAL is returned.
@@ -217,6 +218,26 @@ struct v4l2_subdev_audio_ops {
217 218
218 s_routing: see s_routing in audio_ops, except this version is for video 219 s_routing: see s_routing in audio_ops, except this version is for video
219 devices. 220 devices.
221
222 s_dv_preset: set dv (Digital Video) preset in the sub device. Similar to
223 s_std()
224
225 query_dv_preset: query dv preset in the sub device. This is similar to
226 querystd()
227
228 s_dv_timings(): Set custom dv timings in the sub device. This is used
229 when sub device is capable of setting detailed timing information
230 in the hardware to generate/detect the video signal.
231
232 g_dv_timings(): Get custom dv timings in the sub device.
233
234 enum_mbus_fmt: enumerate pixel formats, provided by a video data source
235
236 g_mbus_fmt: get the current pixel format, provided by a video data source
237
238 try_mbus_fmt: try to set a pixel format on a video data source
239
240 s_mbus_fmt: set a pixel format on a video data source
220 */ 241 */
221struct v4l2_subdev_video_ops { 242struct v4l2_subdev_video_ops {
222 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); 243 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
@@ -240,6 +261,33 @@ struct v4l2_subdev_video_ops {
240 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 261 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
241 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); 262 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
242 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); 263 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
264 int (*s_dv_preset)(struct v4l2_subdev *sd,
265 struct v4l2_dv_preset *preset);
266 int (*query_dv_preset)(struct v4l2_subdev *sd,
267 struct v4l2_dv_preset *preset);
268 int (*s_dv_timings)(struct v4l2_subdev *sd,
269 struct v4l2_dv_timings *timings);
270 int (*g_dv_timings)(struct v4l2_subdev *sd,
271 struct v4l2_dv_timings *timings);
272 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, int index,
273 enum v4l2_mbus_pixelcode *code);
274 int (*g_mbus_fmt)(struct v4l2_subdev *sd,
275 struct v4l2_mbus_framefmt *fmt);
276 int (*try_mbus_fmt)(struct v4l2_subdev *sd,
277 struct v4l2_mbus_framefmt *fmt);
278 int (*s_mbus_fmt)(struct v4l2_subdev *sd,
279 struct v4l2_mbus_framefmt *fmt);
280};
281
282/**
283 * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations
284 * @g_skip_top_lines: number of lines at the top of the image to be skipped.
285 * This is needed for some sensors, which always corrupt
286 * several top lines of the output image, or which send their
287 * metadata in them.
288 */
289struct v4l2_subdev_sensor_ops {
290 int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines);
243}; 291};
244 292
245/* 293/*
@@ -326,11 +374,12 @@ struct v4l2_subdev_ir_ops {
326}; 374};
327 375
328struct v4l2_subdev_ops { 376struct v4l2_subdev_ops {
329 const struct v4l2_subdev_core_ops *core; 377 const struct v4l2_subdev_core_ops *core;
330 const struct v4l2_subdev_tuner_ops *tuner; 378 const struct v4l2_subdev_tuner_ops *tuner;
331 const struct v4l2_subdev_audio_ops *audio; 379 const struct v4l2_subdev_audio_ops *audio;
332 const struct v4l2_subdev_video_ops *video; 380 const struct v4l2_subdev_video_ops *video;
333 const struct v4l2_subdev_ir_ops *ir; 381 const struct v4l2_subdev_ir_ops *ir;
382 const struct v4l2_subdev_sensor_ops *sensor;
334}; 383};
335 384
336#define V4L2_SUBDEV_NAME_SIZE 32 385#define V4L2_SUBDEV_NAME_SIZE 32
diff --git a/include/net/dst.h b/include/net/dst.h
index 387cb3cfde7e..39c4a5963e12 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -113,7 +113,7 @@ dst_metric(const struct dst_entry *dst, int metric)
113static inline u32 113static inline u32
114dst_feature(const struct dst_entry *dst, u32 feature) 114dst_feature(const struct dst_entry *dst, u32 feature)
115{ 115{
116 return (dst ? dst_metric(dst, RTAX_FEATURES) & feature : 0); 116 return dst_metric(dst, RTAX_FEATURES) & feature;
117} 117}
118 118
119static inline u32 dst_mtu(const struct dst_entry *dst) 119static inline u32 dst_mtu(const struct dst_entry *dst)
diff --git a/include/net/ip.h b/include/net/ip.h
index e6b9d12d5f62..85108cfbb1ae 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -337,6 +337,7 @@ enum ip_defrag_users {
337 IP_DEFRAG_CALL_RA_CHAIN, 337 IP_DEFRAG_CALL_RA_CHAIN,
338 IP_DEFRAG_CONNTRACK_IN, 338 IP_DEFRAG_CONNTRACK_IN,
339 IP_DEFRAG_CONNTRACK_OUT, 339 IP_DEFRAG_CONNTRACK_OUT,
340 IP_DEFRAG_CONNTRACK_BRIDGE_IN,
340 IP_DEFRAG_VS_IN, 341 IP_DEFRAG_VS_IN,
341 IP_DEFRAG_VS_OUT, 342 IP_DEFRAG_VS_OUT,
342 IP_DEFRAG_VS_FWD 343 IP_DEFRAG_VS_FWD
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 92db8617d188..ccab5946c830 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -350,8 +350,16 @@ static inline int ipv6_prefix_equal(const struct in6_addr *a1,
350 350
351struct inet_frag_queue; 351struct inet_frag_queue;
352 352
353enum ip6_defrag_users {
354 IP6_DEFRAG_LOCAL_DELIVER,
355 IP6_DEFRAG_CONNTRACK_IN,
356 IP6_DEFRAG_CONNTRACK_OUT,
357 IP6_DEFRAG_CONNTRACK_BRIDGE_IN,
358};
359
353struct ip6_create_arg { 360struct ip6_create_arg {
354 __be32 id; 361 __be32 id;
362 u32 user;
355 struct in6_addr *src; 363 struct in6_addr *src;
356 struct in6_addr *dst; 364 struct in6_addr *dst;
357}; 365};
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
index abc55ad75c2b..1ee717eb5b09 100644
--- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
+++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
@@ -9,7 +9,7 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;
9 9
10extern int nf_ct_frag6_init(void); 10extern int nf_ct_frag6_init(void);
11extern void nf_ct_frag6_cleanup(void); 11extern void nf_ct_frag6_cleanup(void);
12extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb); 12extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user);
13extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb, 13extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
14 struct net_device *in, 14 struct net_device *in,
15 struct net_device *out, 15 struct net_device *out,
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 1b6f7d348cee..34f5cc24d903 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -408,8 +408,7 @@ extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
408extern void tcp_parse_options(struct sk_buff *skb, 408extern void tcp_parse_options(struct sk_buff *skb,
409 struct tcp_options_received *opt_rx, 409 struct tcp_options_received *opt_rx,
410 u8 **hvpp, 410 u8 **hvpp,
411 int estab, 411 int estab);
412 struct dst_entry *dst);
413 412
414extern u8 *tcp_parse_md5sig_option(struct tcphdr *th); 413extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
415 414
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index 483057b2f4b4..fa0d52b8e622 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -36,6 +36,7 @@
36 36
37#include <linux/in.h> 37#include <linux/in.h>
38#include <linux/in6.h> 38#include <linux/in6.h>
39#include <linux/if_arp.h>
39#include <linux/netdevice.h> 40#include <linux/netdevice.h>
40#include <linux/socket.h> 41#include <linux/socket.h>
41#include <rdma/ib_verbs.h> 42#include <rdma/ib_verbs.h>
@@ -60,8 +61,8 @@ struct rdma_dev_addr {
60 unsigned char src_dev_addr[MAX_ADDR_LEN]; 61 unsigned char src_dev_addr[MAX_ADDR_LEN];
61 unsigned char dst_dev_addr[MAX_ADDR_LEN]; 62 unsigned char dst_dev_addr[MAX_ADDR_LEN];
62 unsigned char broadcast[MAX_ADDR_LEN]; 63 unsigned char broadcast[MAX_ADDR_LEN];
63 enum rdma_node_type dev_type; 64 unsigned short dev_type;
64 struct net_device *src_dev; 65 int bound_dev_if;
65}; 66};
66 67
67/** 68/**
@@ -121,40 +122,29 @@ static inline void ib_addr_get_mgid(struct rdma_dev_addr *dev_addr,
121 memcpy(gid, dev_addr->broadcast + 4, sizeof *gid); 122 memcpy(gid, dev_addr->broadcast + 4, sizeof *gid);
122} 123}
123 124
124static inline void ib_addr_get_sgid(struct rdma_dev_addr *dev_addr, 125static inline int rdma_addr_gid_offset(struct rdma_dev_addr *dev_addr)
125 union ib_gid *gid)
126{ 126{
127 memcpy(gid, dev_addr->src_dev_addr + 4, sizeof *gid); 127 return dev_addr->dev_type == ARPHRD_INFINIBAND ? 4 : 0;
128} 128}
129 129
130static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr, 130static inline void rdma_addr_get_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid)
131 union ib_gid *gid)
132{ 131{
133 memcpy(dev_addr->src_dev_addr + 4, gid, sizeof *gid); 132 memcpy(gid, dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof *gid);
134} 133}
135 134
136static inline void ib_addr_get_dgid(struct rdma_dev_addr *dev_addr, 135static inline void rdma_addr_set_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid)
137 union ib_gid *gid)
138{ 136{
139 memcpy(gid, dev_addr->dst_dev_addr + 4, sizeof *gid); 137 memcpy(dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), gid, sizeof *gid);
140} 138}
141 139
142static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr, 140static inline void rdma_addr_get_dgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid)
143 union ib_gid *gid)
144{ 141{
145 memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); 142 memcpy(gid, dev_addr->dst_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof *gid);
146} 143}
147 144
148static inline void iw_addr_get_sgid(struct rdma_dev_addr *dev_addr, 145static inline void rdma_addr_set_dgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid)
149 union ib_gid *gid)
150{
151 memcpy(gid, dev_addr->src_dev_addr, sizeof *gid);
152}
153
154static inline void iw_addr_get_dgid(struct rdma_dev_addr *dev_addr,
155 union ib_gid *gid)
156{ 146{
157 memcpy(gid, dev_addr->dst_dev_addr, sizeof *gid); 147 memcpy(dev_addr->dst_dev_addr + rdma_addr_gid_offset(dev_addr), gid, sizeof *gid);
158} 148}
159 149
160#endif /* IB_ADDR_H */ 150#endif /* IB_ADDR_H */
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index 3841c1aff692..1082afaed158 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -379,4 +379,10 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
379 struct ib_sa_path_rec *rec, 379 struct ib_sa_path_rec *rec,
380 struct ib_ah_attr *ah_attr); 380 struct ib_ah_attr *ah_attr);
381 381
382/**
383 * ib_sa_unpack_path - Convert a path record from MAD format to struct
384 * ib_sa_path_rec.
385 */
386void ib_sa_unpack_path(void *attribute, struct ib_sa_path_rec *rec);
387
382#endif /* IB_SA_H */ 388#endif /* IB_SA_H */
diff --git a/include/rdma/ib_user_sa.h b/include/rdma/ib_user_sa.h
index 659120157e14..cfc7c9ba781e 100644
--- a/include/rdma/ib_user_sa.h
+++ b/include/rdma/ib_user_sa.h
@@ -35,6 +35,22 @@
35 35
36#include <linux/types.h> 36#include <linux/types.h>
37 37
38enum {
39 IB_PATH_GMP = 1,
40 IB_PATH_PRIMARY = (1<<1),
41 IB_PATH_ALTERNATE = (1<<2),
42 IB_PATH_OUTBOUND = (1<<3),
43 IB_PATH_INBOUND = (1<<4),
44 IB_PATH_INBOUND_REVERSE = (1<<5),
45 IB_PATH_BIDIRECTIONAL = IB_PATH_OUTBOUND | IB_PATH_INBOUND_REVERSE
46};
47
48struct ib_path_rec_data {
49 __u32 flags;
50 __u32 reserved;
51 __u32 path_rec[16];
52};
53
38struct ib_user_path_rec { 54struct ib_user_path_rec {
39 __u8 dgid[16]; 55 __u8 dgid[16];
40 __u8 sgid[16]; 56 __u8 sgid[16];
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index c179318edd92..09509edb1c5f 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1425,6 +1425,11 @@ int ib_destroy_qp(struct ib_qp *qp);
1425 * @send_wr: A list of work requests to post on the send queue. 1425 * @send_wr: A list of work requests to post on the send queue.
1426 * @bad_send_wr: On an immediate failure, this parameter will reference 1426 * @bad_send_wr: On an immediate failure, this parameter will reference
1427 * the work request that failed to be posted on the QP. 1427 * the work request that failed to be posted on the QP.
1428 *
1429 * While IBA Vol. 1 section 11.4.1.1 specifies that if an immediate
1430 * error is returned, the QP state shall not be affected,
1431 * ib_post_send() will return an immediate error after queueing any
1432 * earlier work requests in the list.
1428 */ 1433 */
1429static inline int ib_post_send(struct ib_qp *qp, 1434static inline int ib_post_send(struct ib_qp *qp,
1430 struct ib_send_wr *send_wr, 1435 struct ib_send_wr *send_wr,
diff --git a/include/rdma/rdma_user_cm.h b/include/rdma/rdma_user_cm.h
index c55705460b87..1d165022c02d 100644
--- a/include/rdma/rdma_user_cm.h
+++ b/include/rdma/rdma_user_cm.h
@@ -215,12 +215,14 @@ struct rdma_ucm_event_resp {
215 215
216/* Option levels */ 216/* Option levels */
217enum { 217enum {
218 RDMA_OPTION_ID = 0 218 RDMA_OPTION_ID = 0,
219 RDMA_OPTION_IB = 1
219}; 220};
220 221
221/* Option details */ 222/* Option details */
222enum { 223enum {
223 RDMA_OPTION_ID_TOS = 0 224 RDMA_OPTION_ID_TOS = 0,
225 RDMA_OPTION_IB_PATH = 1
224}; 226};
225 227
226struct rdma_ucm_set_option { 228struct rdma_ucm_set_option {
diff --git a/include/video/da8xx-fb.h b/include/video/da8xx-fb.h
index c051a50ed528..89d43b3d4cb9 100644
--- a/include/video/da8xx-fb.h
+++ b/include/video/da8xx-fb.h
@@ -38,6 +38,7 @@ struct da8xx_lcdc_platform_data {
38 const char manu_name[10]; 38 const char manu_name[10];
39 void *controller_data; 39 void *controller_data;
40 const char type[25]; 40 const char type[25];
41 void (*panel_power_ctrl)(int);
41}; 42};
42 43
43struct lcd_ctrl_config { 44struct lcd_ctrl_config {
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index 25144ab22b95..288205457713 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -50,6 +50,8 @@ struct sh_mobile_lcdc_board_cfg {
50 void *board_data; 50 void *board_data;
51 int (*setup_sys)(void *board_data, void *sys_ops_handle, 51 int (*setup_sys)(void *board_data, void *sys_ops_handle,
52 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 52 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
53 void (*start_transfer)(void *board_data, void *sys_ops_handle,
54 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
53 void (*display_on)(void *board_data); 55 void (*display_on)(void *board_data);
54 void (*display_off)(void *board_data); 56 void (*display_off)(void *board_data);
55}; 57};