aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/fcntl.h8
-rw-r--r--include/asm-generic/ioctls.h8
-rw-r--r--include/asm-generic/statfs.h9
-rw-r--r--include/asm-generic/termbits.h1
-rw-r--r--include/asm-generic/unistd.h4
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/auto_fs.h1
-rw-r--r--include/linux/backing-dev.h23
-rw-r--r--include/linux/bio.h158
-rw-r--r--include/linux/blk_types.h194
-rw-r--r--include/linux/blkdev.h142
-rw-r--r--include/linux/blktrace_api.h18
-rw-r--r--include/linux/buffer_head.h20
-rw-r--r--include/linux/coda_psdev.h8
-rw-r--r--include/linux/console_struct.h4
-rw-r--r--include/linux/dcache.h1
-rw-r--r--include/linux/dnotify.h1
-rw-r--r--include/linux/drbd.h2
-rw-r--r--include/linux/drbd_nl.h9
-rw-r--r--include/linux/ext3_fs.h2
-rw-r--r--include/linux/fanotify.h105
-rw-r--r--include/linux/fb.h4
-rw-r--r--include/linux/fs.h127
-rw-r--r--include/linux/fsnotify.h161
-rw-r--r--include/linux/fsnotify_backend.h211
-rw-r--r--include/linux/gpio_keys.h2
-rw-r--r--include/linux/i2c.h2
-rw-r--r--include/linux/inotify.h185
-rw-r--r--include/linux/input.h53
-rw-r--r--include/linux/istallion.h2
-rw-r--r--include/linux/jffs2.h3
-rw-r--r--include/linux/mbcache.h20
-rw-r--r--include/linux/mm.h1
-rw-r--r--include/linux/mount.h6
-rw-r--r--include/linux/mtd/bbm.h24
-rw-r--r--include/linux/mtd/blktrans.h16
-rw-r--r--include/linux/mtd/cfi.h20
-rw-r--r--include/linux/mtd/cfi_endian.h19
-rw-r--r--include/linux/mtd/compatmac.h10
-rw-r--r--include/linux/mtd/concat.h17
-rw-r--r--include/linux/mtd/doc2000.h23
-rw-r--r--include/linux/mtd/flashchip.h21
-rw-r--r--include/linux/mtd/gen_probe.h19
-rw-r--r--include/linux/mtd/map.h19
-rw-r--r--include/linux/mtd/mtd.h19
-rw-r--r--include/linux/mtd/nand.h8
-rw-r--r--include/linux/mtd/nand_ecc.h4
-rw-r--r--include/linux/mtd/nftl.h17
-rw-r--r--include/linux/mtd/onenand.h2
-rw-r--r--include/linux/mtd/physmap.h1
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/posix-timers.h2
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/reiserfs_fs_i.h4
-rw-r--r--include/linux/resource.h9
-rw-r--r--include/linux/security.h10
-rw-r--r--include/linux/serial.h9
-rw-r--r--include/linux/serial_8250.h5
-rw-r--r--include/linux/serial_core.h11
-rw-r--r--include/linux/serial_mfd.h47
-rw-r--r--include/linux/serial_reg.h16
-rw-r--r--include/linux/statfs.h25
-rw-r--r--include/linux/syscalls.h8
-rw-r--r--include/linux/tty.h52
-rw-r--r--include/linux/usb.h5
-rw-r--r--include/linux/usb/composite.h6
-rw-r--r--include/linux/usb/ehci_def.h23
-rw-r--r--include/linux/usb/functionfs.h6
-rw-r--r--include/linux/usb/hcd.h31
-rw-r--r--include/linux/usb/otg.h11
-rw-r--r--include/linux/usb/quirks.h4
-rw-r--r--include/linux/usb/ulpi.h40
-rw-r--r--include/linux/videodev2.h1
-rw-r--r--include/linux/vt_kern.h64
-rw-r--r--include/media/cx2341x.h97
-rw-r--r--include/media/cx25840.h87
-rw-r--r--include/media/ir-core.h41
-rw-r--r--include/media/lirc.h5
-rw-r--r--include/media/rc-map.h1
-rw-r--r--include/media/v4l2-ctrls.h460
-rw-r--r--include/media/v4l2-dev.h4
-rw-r--r--include/media/v4l2-device.h4
-rw-r--r--include/media/v4l2-subdev.h54
-rw-r--r--include/mtd/mtd-abi.h18
-rw-r--r--include/mtd/mtd-user.h17
-rw-r--r--include/mtd/nftl-user.h16
-rw-r--r--include/mtd/ubi-user.h2
-rw-r--r--include/trace/events/block.h15
-rw-r--r--include/trace/events/writeback.h159
90 files changed, 2234 insertions, 878 deletions
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index fcd268ce0674..e3cbc38bdcc2 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -3,6 +3,14 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6/*
7 * FMODE_EXEC is 0x20
8 * FMODE_NONOTIFY is 0x1000000
9 * These cannot be used by userspace O_* until internal and external open
10 * flags are split.
11 * -Eric Paris
12 */
13
6#define O_ACCMODE 00000003 14#define O_ACCMODE 00000003
7#define O_RDONLY 00000000 15#define O_RDONLY 00000000
8#define O_WRONLY 00000001 16#define O_WRONLY 00000001
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
index a799e20a769e..8554cb6a81b9 100644
--- a/include/asm-generic/ioctls.h
+++ b/include/asm-generic/ioctls.h
@@ -69,6 +69,7 @@
69#define TCSETX 0x5433 69#define TCSETX 0x5433
70#define TCSETXF 0x5434 70#define TCSETXF 0x5434
71#define TCSETXW 0x5435 71#define TCSETXW 0x5435
72#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
72 73
73#define FIONCLEX 0x5450 74#define FIONCLEX 0x5450
74#define FIOCLEX 0x5451 75#define FIOCLEX 0x5451
@@ -87,12 +88,10 @@
87#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ 88#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
88 89
89/* 90/*
90 * some architectures define FIOQSIZE as 0x545E, which is used for 91 * Some arches already define FIOQSIZE due to a historical
91 * TIOCGHAYESESP on others 92 * conflict with a Hayes modem-specific ioctl value.
92 */ 93 */
93#ifndef FIOQSIZE 94#ifndef FIOQSIZE
94# define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
95# define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
96# define FIOQSIZE 0x5460 95# define FIOQSIZE 0x5460
97#endif 96#endif
98 97
@@ -104,6 +103,7 @@
104#define TIOCPKT_START 8 103#define TIOCPKT_START 8
105#define TIOCPKT_NOSTOP 16 104#define TIOCPKT_NOSTOP 16
106#define TIOCPKT_DOSTOP 32 105#define TIOCPKT_DOSTOP 32
106#define TIOCPKT_IOCTL 64
107 107
108#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ 108#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
109 109
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
index 3b4fb3e52f0d..0fd28e028de1 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -33,7 +33,8 @@ struct statfs {
33 __kernel_fsid_t f_fsid; 33 __kernel_fsid_t f_fsid;
34 __statfs_word f_namelen; 34 __statfs_word f_namelen;
35 __statfs_word f_frsize; 35 __statfs_word f_frsize;
36 __statfs_word f_spare[5]; 36 __statfs_word f_flags;
37 __statfs_word f_spare[4];
37}; 38};
38 39
39/* 40/*
@@ -55,7 +56,8 @@ struct statfs64 {
55 __kernel_fsid_t f_fsid; 56 __kernel_fsid_t f_fsid;
56 __statfs_word f_namelen; 57 __statfs_word f_namelen;
57 __statfs_word f_frsize; 58 __statfs_word f_frsize;
58 __statfs_word f_spare[5]; 59 __statfs_word f_flags;
60 __statfs_word f_spare[4];
59} ARCH_PACK_STATFS64; 61} ARCH_PACK_STATFS64;
60 62
61/* 63/*
@@ -77,7 +79,8 @@ struct compat_statfs64 {
77 __kernel_fsid_t f_fsid; 79 __kernel_fsid_t f_fsid;
78 __u32 f_namelen; 80 __u32 f_namelen;
79 __u32 f_frsize; 81 __u32 f_frsize;
80 __u32 f_spare[5]; 82 __u32 f_flags;
83 __u32 f_spare[4];
81} ARCH_PACK_COMPAT_STATFS64; 84} ARCH_PACK_COMPAT_STATFS64;
82 85
83#endif 86#endif
diff --git a/include/asm-generic/termbits.h b/include/asm-generic/termbits.h
index 1c9773d48cb0..232b4781aef3 100644
--- a/include/asm-generic/termbits.h
+++ b/include/asm-generic/termbits.h
@@ -178,6 +178,7 @@ struct ktermios {
178#define FLUSHO 0010000 178#define FLUSHO 0010000
179#define PENDIN 0040000 179#define PENDIN 0040000
180#define IEXTEN 0100000 180#define IEXTEN 0100000
181#define EXTPROC 0200000
181 182
182/* tcflow() and TCXONC use these */ 183/* tcflow() and TCXONC use these */
183#define TCOOFF 0 184#define TCOOFF 0
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index c17cebc49952..e1898090f22c 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -640,9 +640,11 @@ __SYSCALL(__NR_recvmmsg, sys_recvmmsg)
640 640
641#define __NR_wait4 260 641#define __NR_wait4 260
642__SYSCALL(__NR_wait4, sys_wait4) 642__SYSCALL(__NR_wait4, sys_wait4)
643#define __NR_prlimit64 261
644__SYSCALL(__NR_prlimit64, sys_prlimit64)
643 645
644#undef __NR_syscalls 646#undef __NR_syscalls
645#define __NR_syscalls 261 647#define __NR_syscalls 262
646 648
647/* 649/*
648 * All syscalls below here should go away really, 650 * All syscalls below here should go away really,
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 9aa9bcadf869..9d65d4d0bd9c 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -39,6 +39,7 @@ header-y += ax25.h
39header-y += b1lli.h 39header-y += b1lli.h
40header-y += baycom.h 40header-y += baycom.h
41header-y += bfs_fs.h 41header-y += bfs_fs.h
42header-y += blk_types.h
42header-y += blkpg.h 43header-y += blkpg.h
43header-y += bpqether.h 44header-y += bpqether.h
44header-y += bsg.h 45header-y += bsg.h
@@ -210,6 +211,7 @@ unifdef-y += ethtool.h
210unifdef-y += eventpoll.h 211unifdef-y += eventpoll.h
211unifdef-y += signalfd.h 212unifdef-y += signalfd.h
212unifdef-y += ext2_fs.h 213unifdef-y += ext2_fs.h
214unifdef-y += fanotify.h
213unifdef-y += fb.h 215unifdef-y += fb.h
214unifdef-y += fcntl.h 216unifdef-y += fcntl.h
215unifdef-y += filter.h 217unifdef-y += filter.h
diff --git a/include/linux/audit.h b/include/linux/audit.h
index f391d45c8aea..e24afabc548f 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -544,7 +544,7 @@ extern int audit_signals;
544#define audit_putname(n) do { ; } while (0) 544#define audit_putname(n) do { ; } while (0)
545#define __audit_inode(n,d) do { ; } while (0) 545#define __audit_inode(n,d) do { ; } while (0)
546#define __audit_inode_child(i,p) do { ; } while (0) 546#define __audit_inode_child(i,p) do { ; } while (0)
547#define audit_inode(n,d) do { ; } while (0) 547#define audit_inode(n,d) do { (void)(d); } while (0)
548#define audit_inode_child(i,p) do { ; } while (0) 548#define audit_inode_child(i,p) do { ; } while (0)
549#define audit_core_dumps(i) do { ; } while (0) 549#define audit_core_dumps(i) do { ; } while (0)
550#define auditsc_get_stamp(c,t,s) (0) 550#define auditsc_get_stamp(c,t,s) (0)
diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index 7b09c8348fd3..da64e15004b6 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -79,6 +79,7 @@ struct autofs_packet_expire {
79#define AUTOFS_IOC_FAIL _IO(0x93,0x61) 79#define AUTOFS_IOC_FAIL _IO(0x93,0x61)
80#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62) 80#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62)
81#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int) 81#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int)
82#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t)
82#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long) 83#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
83#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire) 84#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire)
84 85
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index e9aec0d099df..7628219e5386 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -45,22 +45,21 @@ enum bdi_stat_item {
45#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) 45#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
46 46
47struct bdi_writeback { 47struct bdi_writeback {
48 struct list_head list; /* hangs off the bdi */ 48 struct backing_dev_info *bdi; /* our parent bdi */
49
50 struct backing_dev_info *bdi; /* our parent bdi */
51 unsigned int nr; 49 unsigned int nr;
52 50
53 unsigned long last_old_flush; /* last old data flush */ 51 unsigned long last_old_flush; /* last old data flush */
52 unsigned long last_active; /* last time bdi thread was active */
54 53
55 struct task_struct *task; /* writeback task */ 54 struct task_struct *task; /* writeback thread */
56 struct list_head b_dirty; /* dirty inodes */ 55 struct timer_list wakeup_timer; /* used for delayed bdi thread wakeup */
57 struct list_head b_io; /* parked for writeback */ 56 struct list_head b_dirty; /* dirty inodes */
58 struct list_head b_more_io; /* parked for more writeback */ 57 struct list_head b_io; /* parked for writeback */
58 struct list_head b_more_io; /* parked for more writeback */
59}; 59};
60 60
61struct backing_dev_info { 61struct backing_dev_info {
62 struct list_head bdi_list; 62 struct list_head bdi_list;
63 struct rcu_head rcu_head;
64 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ 63 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
65 unsigned long state; /* Always use atomic bitops on this */ 64 unsigned long state; /* Always use atomic bitops on this */
66 unsigned int capabilities; /* Device capabilities */ 65 unsigned int capabilities; /* Device capabilities */
@@ -80,8 +79,7 @@ struct backing_dev_info {
80 unsigned int max_ratio, max_prop_frac; 79 unsigned int max_ratio, max_prop_frac;
81 80
82 struct bdi_writeback wb; /* default writeback info for this bdi */ 81 struct bdi_writeback wb; /* default writeback info for this bdi */
83 spinlock_t wb_lock; /* protects update side of wb_list */ 82 spinlock_t wb_lock; /* protects work_list */
84 struct list_head wb_list; /* the flusher threads hanging off this bdi */
85 83
86 struct list_head work_list; 84 struct list_head work_list;
87 85
@@ -105,9 +103,10 @@ void bdi_unregister(struct backing_dev_info *bdi);
105int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); 103int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
106void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages); 104void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages);
107void bdi_start_background_writeback(struct backing_dev_info *bdi); 105void bdi_start_background_writeback(struct backing_dev_info *bdi);
108int bdi_writeback_task(struct bdi_writeback *wb); 106int bdi_writeback_thread(void *data);
109int bdi_has_dirty_io(struct backing_dev_info *bdi); 107int bdi_has_dirty_io(struct backing_dev_info *bdi);
110void bdi_arm_supers_timer(void); 108void bdi_arm_supers_timer(void);
109void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
111 110
112extern spinlock_t bdi_lock; 111extern spinlock_t bdi_lock;
113extern struct list_head bdi_list; 112extern struct list_head bdi_list;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 7fc5606e6ea5..5274103434ad 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
@@ -28,6 +28,9 @@
28 28
29#include <asm/io.h> 29#include <asm/io.h>
30 30
31/* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
32#include <linux/blk_types.h>
33
31#define BIO_DEBUG 34#define BIO_DEBUG
32 35
33#ifdef BIO_DEBUG 36#ifdef BIO_DEBUG
@@ -41,154 +44,6 @@
41#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) 44#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
42 45
43/* 46/*
44 * was unsigned short, but we might as well be ready for > 64kB I/O pages
45 */
46struct bio_vec {
47 struct page *bv_page;
48 unsigned int bv_len;
49 unsigned int bv_offset;
50};
51
52struct bio_set;
53struct bio;
54struct bio_integrity_payload;
55typedef void (bio_end_io_t) (struct bio *, int);
56typedef void (bio_destructor_t) (struct bio *);
57
58/*
59 * main unit of I/O for the block layer and lower layers (ie drivers and
60 * stacking drivers)
61 */
62struct bio {
63 sector_t bi_sector; /* device address in 512 byte
64 sectors */
65 struct bio *bi_next; /* request queue link */
66 struct block_device *bi_bdev;
67 unsigned long bi_flags; /* status, command, etc */
68 unsigned long bi_rw; /* bottom bits READ/WRITE,
69 * top bits priority
70 */
71
72 unsigned short bi_vcnt; /* how many bio_vec's */
73 unsigned short bi_idx; /* current index into bvl_vec */
74
75 /* Number of segments in this BIO after
76 * physical address coalescing is performed.
77 */
78 unsigned int bi_phys_segments;
79
80 unsigned int bi_size; /* residual I/O count */
81
82 /*
83 * To keep track of the max segment size, we account for the
84 * sizes of the first and last mergeable segments in this bio.
85 */
86 unsigned int bi_seg_front_size;
87 unsigned int bi_seg_back_size;
88
89 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
90
91 unsigned int bi_comp_cpu; /* completion CPU */
92
93 atomic_t bi_cnt; /* pin count */
94
95 struct bio_vec *bi_io_vec; /* the actual vec list */
96
97 bio_end_io_t *bi_end_io;
98
99 void *bi_private;
100#if defined(CONFIG_BLK_DEV_INTEGRITY)
101 struct bio_integrity_payload *bi_integrity; /* data integrity */
102#endif
103
104 bio_destructor_t *bi_destructor; /* destructor */
105
106 /*
107 * We can inline a number of vecs at the end of the bio, to avoid
108 * double allocations for a small number of bio_vecs. This member
109 * MUST obviously be kept at the very end of the bio.
110 */
111 struct bio_vec bi_inline_vecs[0];
112};
113
114/*
115 * bio flags
116 */
117#define BIO_UPTODATE 0 /* ok after I/O completion */
118#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
119#define BIO_EOF 2 /* out-out-bounds error */
120#define BIO_SEG_VALID 3 /* bi_phys_segments valid */
121#define BIO_CLONED 4 /* doesn't own data */
122#define BIO_BOUNCED 5 /* bio is a bounce bio */
123#define BIO_USER_MAPPED 6 /* contains user pages */
124#define BIO_EOPNOTSUPP 7 /* not supported */
125#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
126#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
127#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
128#define BIO_QUIET 11 /* Make BIO Quiet */
129#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
130
131/*
132 * top 4 bits of bio flags indicate the pool this bio came from
133 */
134#define BIO_POOL_BITS (4)
135#define BIO_POOL_NONE ((1UL << BIO_POOL_BITS) - 1)
136#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
137#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
138#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
139
140/*
141 * bio bi_rw flags
142 *
143 * bit 0 -- data direction
144 * If not set, bio is a read from device. If set, it's a write to device.
145 * bit 1 -- fail fast device errors
146 * bit 2 -- fail fast transport errors
147 * bit 3 -- fail fast driver errors
148 * bit 4 -- rw-ahead when set
149 * bit 5 -- barrier
150 * Insert a serialization point in the IO queue, forcing previously
151 * submitted IO to be completed before this one is issued.
152 * bit 6 -- synchronous I/O hint.
153 * bit 7 -- Unplug the device immediately after submitting this bio.
154 * bit 8 -- metadata request
155 * Used for tracing to differentiate metadata and data IO. May also
156 * get some preferential treatment in the IO scheduler
157 * bit 9 -- discard sectors
158 * Informs the lower level device that this range of sectors is no longer
159 * used by the file system and may thus be freed by the device. Used
160 * for flash based storage.
161 * Don't want driver retries for any fast fail whatever the reason.
162 * bit 10 -- Tell the IO scheduler not to wait for more requests after this
163 one has been submitted, even if it is a SYNC request.
164 */
165enum bio_rw_flags {
166 BIO_RW,
167 BIO_RW_FAILFAST_DEV,
168 BIO_RW_FAILFAST_TRANSPORT,
169 BIO_RW_FAILFAST_DRIVER,
170 /* above flags must match REQ_* */
171 BIO_RW_AHEAD,
172 BIO_RW_BARRIER,
173 BIO_RW_SYNCIO,
174 BIO_RW_UNPLUG,
175 BIO_RW_META,
176 BIO_RW_DISCARD,
177 BIO_RW_NOIDLE,
178};
179
180/*
181 * First four bits must match between bio->bi_rw and rq->cmd_flags, make
182 * that explicit here.
183 */
184#define BIO_RW_RQ_MASK 0xf
185
186static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
187{
188 return (bio->bi_rw & (1 << flag)) != 0;
189}
190
191/*
192 * upper 16 bits of bi_rw define the io priority of this bio 47 * upper 16 bits of bi_rw define the io priority of this bio
193 */ 48 */
194#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS) 49#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS)
@@ -211,7 +66,10 @@ static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
211#define bio_offset(bio) bio_iovec((bio))->bv_offset 66#define bio_offset(bio) bio_iovec((bio))->bv_offset
212#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 67#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
213#define bio_sectors(bio) ((bio)->bi_size >> 9) 68#define bio_sectors(bio) ((bio)->bi_size >> 9)
214#define bio_empty_barrier(bio) (bio_rw_flagged(bio, BIO_RW_BARRIER) && !bio_has_data(bio) && !bio_rw_flagged(bio, BIO_RW_DISCARD)) 69#define bio_empty_barrier(bio) \
70 ((bio->bi_rw & REQ_HARDBARRIER) && \
71 !bio_has_data(bio) && \
72 !(bio->bi_rw & REQ_DISCARD))
215 73
216static inline unsigned int bio_cur_bytes(struct bio *bio) 74static inline unsigned int bio_cur_bytes(struct bio *bio)
217{ 75{
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
new file mode 100644
index 000000000000..53691774d34e
--- /dev/null
+++ b/include/linux/blk_types.h
@@ -0,0 +1,194 @@
1/*
2 * Block data types and constants. Directly include this file only to
3 * break include dependency loop.
4 */
5#ifndef __LINUX_BLK_TYPES_H
6#define __LINUX_BLK_TYPES_H
7
8#ifdef CONFIG_BLOCK
9
10#include <linux/types.h>
11
12struct bio_set;
13struct bio;
14struct bio_integrity_payload;
15struct page;
16struct block_device;
17typedef void (bio_end_io_t) (struct bio *, int);
18typedef void (bio_destructor_t) (struct bio *);
19
20/*
21 * was unsigned short, but we might as well be ready for > 64kB I/O pages
22 */
23struct bio_vec {
24 struct page *bv_page;
25 unsigned int bv_len;
26 unsigned int bv_offset;
27};
28
29/*
30 * main unit of I/O for the block layer and lower layers (ie drivers and
31 * stacking drivers)
32 */
33struct bio {
34 sector_t bi_sector; /* device address in 512 byte
35 sectors */
36 struct bio *bi_next; /* request queue link */
37 struct block_device *bi_bdev;
38 unsigned long bi_flags; /* status, command, etc */
39 unsigned long bi_rw; /* bottom bits READ/WRITE,
40 * top bits priority
41 */
42
43 unsigned short bi_vcnt; /* how many bio_vec's */
44 unsigned short bi_idx; /* current index into bvl_vec */
45
46 /* Number of segments in this BIO after
47 * physical address coalescing is performed.
48 */
49 unsigned int bi_phys_segments;
50
51 unsigned int bi_size; /* residual I/O count */
52
53 /*
54 * To keep track of the max segment size, we account for the
55 * sizes of the first and last mergeable segments in this bio.
56 */
57 unsigned int bi_seg_front_size;
58 unsigned int bi_seg_back_size;
59
60 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
61
62 unsigned int bi_comp_cpu; /* completion CPU */
63
64 atomic_t bi_cnt; /* pin count */
65
66 struct bio_vec *bi_io_vec; /* the actual vec list */
67
68 bio_end_io_t *bi_end_io;
69
70 void *bi_private;
71#if defined(CONFIG_BLK_DEV_INTEGRITY)
72 struct bio_integrity_payload *bi_integrity; /* data integrity */
73#endif
74
75 bio_destructor_t *bi_destructor; /* destructor */
76
77 /*
78 * We can inline a number of vecs at the end of the bio, to avoid
79 * double allocations for a small number of bio_vecs. This member
80 * MUST obviously be kept at the very end of the bio.
81 */
82 struct bio_vec bi_inline_vecs[0];
83};
84
85/*
86 * bio flags
87 */
88#define BIO_UPTODATE 0 /* ok after I/O completion */
89#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
90#define BIO_EOF 2 /* out-out-bounds error */
91#define BIO_SEG_VALID 3 /* bi_phys_segments valid */
92#define BIO_CLONED 4 /* doesn't own data */
93#define BIO_BOUNCED 5 /* bio is a bounce bio */
94#define BIO_USER_MAPPED 6 /* contains user pages */
95#define BIO_EOPNOTSUPP 7 /* not supported */
96#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
97#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
98#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
99#define BIO_QUIET 11 /* Make BIO Quiet */
100#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
101
102/*
103 * top 4 bits of bio flags indicate the pool this bio came from
104 */
105#define BIO_POOL_BITS (4)
106#define BIO_POOL_NONE ((1UL << BIO_POOL_BITS) - 1)
107#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
108#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
109#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
110
111#endif /* CONFIG_BLOCK */
112
113/*
114 * Request flags. For use in the cmd_flags field of struct request, and in
115 * bi_rw of struct bio. Note that some flags are only valid in either one.
116 */
117enum rq_flag_bits {
118 /* common flags */
119 __REQ_WRITE, /* not set, read. set, write */
120 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
121 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
122 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
123
124 __REQ_HARDBARRIER, /* may not be passed by drive either */
125 __REQ_SYNC, /* request is sync (sync write or read) */
126 __REQ_META, /* metadata io request */
127 __REQ_DISCARD, /* request to discard sectors */
128 __REQ_NOIDLE, /* don't anticipate more IO after this one */
129
130 /* bio only flags */
131 __REQ_UNPLUG, /* unplug the immediately after submission */
132 __REQ_RAHEAD, /* read ahead, can fail anytime */
133
134 /* request only flags */
135 __REQ_SORTED, /* elevator knows about this request */
136 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
137 __REQ_FUA, /* forced unit access */
138 __REQ_NOMERGE, /* don't touch this for merging */
139 __REQ_STARTED, /* drive already may have started this one */
140 __REQ_DONTPREP, /* don't call prep for this one */
141 __REQ_QUEUED, /* uses queueing */
142 __REQ_ELVPRIV, /* elevator private data attached */
143 __REQ_FAILED, /* set if the request failed */
144 __REQ_QUIET, /* don't worry about errors */
145 __REQ_PREEMPT, /* set for "ide_preempt" requests */
146 __REQ_ORDERED_COLOR, /* is before or after barrier */
147 __REQ_ALLOCED, /* request came from our alloc pool */
148 __REQ_COPY_USER, /* contains copies of user pages */
149 __REQ_INTEGRITY, /* integrity metadata has been remapped */
150 __REQ_FLUSH, /* request for cache flush */
151 __REQ_IO_STAT, /* account I/O stat */
152 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
153 __REQ_NR_BITS, /* stops here */
154};
155
156#define REQ_WRITE (1 << __REQ_WRITE)
157#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV)
158#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
159#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
160#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
161#define REQ_SYNC (1 << __REQ_SYNC)
162#define REQ_META (1 << __REQ_META)
163#define REQ_DISCARD (1 << __REQ_DISCARD)
164#define REQ_NOIDLE (1 << __REQ_NOIDLE)
165
166#define REQ_FAILFAST_MASK \
167 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
168#define REQ_COMMON_MASK \
169 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_HARDBARRIER | REQ_SYNC | \
170 REQ_META| REQ_DISCARD | REQ_NOIDLE)
171
172#define REQ_UNPLUG (1 << __REQ_UNPLUG)
173#define REQ_RAHEAD (1 << __REQ_RAHEAD)
174
175#define REQ_SORTED (1 << __REQ_SORTED)
176#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
177#define REQ_FUA (1 << __REQ_FUA)
178#define REQ_NOMERGE (1 << __REQ_NOMERGE)
179#define REQ_STARTED (1 << __REQ_STARTED)
180#define REQ_DONTPREP (1 << __REQ_DONTPREP)
181#define REQ_QUEUED (1 << __REQ_QUEUED)
182#define REQ_ELVPRIV (1 << __REQ_ELVPRIV)
183#define REQ_FAILED (1 << __REQ_FAILED)
184#define REQ_QUIET (1 << __REQ_QUIET)
185#define REQ_PREEMPT (1 << __REQ_PREEMPT)
186#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
187#define REQ_ALLOCED (1 << __REQ_ALLOCED)
188#define REQ_COPY_USER (1 << __REQ_COPY_USER)
189#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
190#define REQ_FLUSH (1 << __REQ_FLUSH)
191#define REQ_IO_STAT (1 << __REQ_IO_STAT)
192#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
193
194#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 09a840264d6f..89c855c5655c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -60,7 +60,6 @@ enum rq_cmd_type_bits {
60 REQ_TYPE_PM_RESUME, /* resume request */ 60 REQ_TYPE_PM_RESUME, /* resume request */
61 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ 61 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */
62 REQ_TYPE_SPECIAL, /* driver defined type */ 62 REQ_TYPE_SPECIAL, /* driver defined type */
63 REQ_TYPE_LINUX_BLOCK, /* generic block layer message */
64 /* 63 /*
65 * for ATA/ATAPI devices. this really doesn't belong here, ide should 64 * for ATA/ATAPI devices. this really doesn't belong here, ide should
66 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver 65 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver
@@ -70,84 +69,6 @@ enum rq_cmd_type_bits {
70 REQ_TYPE_ATA_PC, 69 REQ_TYPE_ATA_PC,
71}; 70};
72 71
73/*
74 * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being
75 * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a
76 * SCSI cdb.
77 *
78 * 0x00 -> 0x3f are driver private, to be used for whatever purpose they need,
79 * typically to differentiate REQ_TYPE_SPECIAL requests.
80 *
81 */
82enum {
83 REQ_LB_OP_EJECT = 0x40, /* eject request */
84 REQ_LB_OP_FLUSH = 0x41, /* flush request */
85};
86
87/*
88 * request type modified bits. first four bits match BIO_RW* bits, important
89 */
90enum rq_flag_bits {
91 __REQ_RW, /* not set, read. set, write */
92 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
93 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
94 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
95 /* above flags must match BIO_RW_* */
96 __REQ_DISCARD, /* request to discard sectors */
97 __REQ_SORTED, /* elevator knows about this request */
98 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
99 __REQ_HARDBARRIER, /* may not be passed by drive either */
100 __REQ_FUA, /* forced unit access */
101 __REQ_NOMERGE, /* don't touch this for merging */
102 __REQ_STARTED, /* drive already may have started this one */
103 __REQ_DONTPREP, /* don't call prep for this one */
104 __REQ_QUEUED, /* uses queueing */
105 __REQ_ELVPRIV, /* elevator private data attached */
106 __REQ_FAILED, /* set if the request failed */
107 __REQ_QUIET, /* don't worry about errors */
108 __REQ_PREEMPT, /* set for "ide_preempt" requests */
109 __REQ_ORDERED_COLOR, /* is before or after barrier */
110 __REQ_RW_SYNC, /* request is sync (sync write or read) */
111 __REQ_ALLOCED, /* request came from our alloc pool */
112 __REQ_RW_META, /* metadata io request */
113 __REQ_COPY_USER, /* contains copies of user pages */
114 __REQ_INTEGRITY, /* integrity metadata has been remapped */
115 __REQ_NOIDLE, /* Don't anticipate more IO after this one */
116 __REQ_IO_STAT, /* account I/O stat */
117 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
118 __REQ_NR_BITS, /* stops here */
119};
120
121#define REQ_RW (1 << __REQ_RW)
122#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV)
123#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
124#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
125#define REQ_DISCARD (1 << __REQ_DISCARD)
126#define REQ_SORTED (1 << __REQ_SORTED)
127#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
128#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
129#define REQ_FUA (1 << __REQ_FUA)
130#define REQ_NOMERGE (1 << __REQ_NOMERGE)
131#define REQ_STARTED (1 << __REQ_STARTED)
132#define REQ_DONTPREP (1 << __REQ_DONTPREP)
133#define REQ_QUEUED (1 << __REQ_QUEUED)
134#define REQ_ELVPRIV (1 << __REQ_ELVPRIV)
135#define REQ_FAILED (1 << __REQ_FAILED)
136#define REQ_QUIET (1 << __REQ_QUIET)
137#define REQ_PREEMPT (1 << __REQ_PREEMPT)
138#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
139#define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
140#define REQ_ALLOCED (1 << __REQ_ALLOCED)
141#define REQ_RW_META (1 << __REQ_RW_META)
142#define REQ_COPY_USER (1 << __REQ_COPY_USER)
143#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
144#define REQ_NOIDLE (1 << __REQ_NOIDLE)
145#define REQ_IO_STAT (1 << __REQ_IO_STAT)
146#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
147
148#define REQ_FAILFAST_MASK (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | \
149 REQ_FAILFAST_DRIVER)
150
151#define BLK_MAX_CDB 16 72#define BLK_MAX_CDB 16
152 73
153/* 74/*
@@ -264,6 +185,7 @@ struct request_pm_state
264typedef void (request_fn_proc) (struct request_queue *q); 185typedef void (request_fn_proc) (struct request_queue *q);
265typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); 186typedef int (make_request_fn) (struct request_queue *q, struct bio *bio);
266typedef int (prep_rq_fn) (struct request_queue *, struct request *); 187typedef int (prep_rq_fn) (struct request_queue *, struct request *);
188typedef void (unprep_rq_fn) (struct request_queue *, struct request *);
267typedef void (unplug_fn) (struct request_queue *); 189typedef void (unplug_fn) (struct request_queue *);
268 190
269struct bio_vec; 191struct bio_vec;
@@ -275,7 +197,6 @@ struct bvec_merge_data {
275}; 197};
276typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *, 198typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *,
277 struct bio_vec *); 199 struct bio_vec *);
278typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
279typedef void (softirq_done_fn)(struct request *); 200typedef void (softirq_done_fn)(struct request *);
280typedef int (dma_drain_needed_fn)(struct request *); 201typedef int (dma_drain_needed_fn)(struct request *);
281typedef int (lld_busy_fn) (struct request_queue *q); 202typedef int (lld_busy_fn) (struct request_queue *q);
@@ -346,9 +267,9 @@ struct request_queue
346 request_fn_proc *request_fn; 267 request_fn_proc *request_fn;
347 make_request_fn *make_request_fn; 268 make_request_fn *make_request_fn;
348 prep_rq_fn *prep_rq_fn; 269 prep_rq_fn *prep_rq_fn;
270 unprep_rq_fn *unprep_rq_fn;
349 unplug_fn *unplug_fn; 271 unplug_fn *unplug_fn;
350 merge_bvec_fn *merge_bvec_fn; 272 merge_bvec_fn *merge_bvec_fn;
351 prepare_flush_fn *prepare_flush_fn;
352 softirq_done_fn *softirq_done_fn; 273 softirq_done_fn *softirq_done_fn;
353 rq_timed_out_fn *rq_timed_out_fn; 274 rq_timed_out_fn *rq_timed_out_fn;
354 dma_drain_needed_fn *dma_drain_needed; 275 dma_drain_needed_fn *dma_drain_needed;
@@ -467,11 +388,13 @@ struct request_queue
467#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ 388#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */
468#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ 389#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */
469#define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ 390#define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */
391#define QUEUE_FLAG_ADD_RANDOM 18 /* Contributes to random pool */
470 392
471#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 393#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
472 (1 << QUEUE_FLAG_CLUSTER) | \ 394 (1 << QUEUE_FLAG_CLUSTER) | \
473 (1 << QUEUE_FLAG_STACKABLE) | \ 395 (1 << QUEUE_FLAG_STACKABLE) | \
474 (1 << QUEUE_FLAG_SAME_COMP)) 396 (1 << QUEUE_FLAG_SAME_COMP) | \
397 (1 << QUEUE_FLAG_ADD_RANDOM))
475 398
476static inline int queue_is_locked(struct request_queue *q) 399static inline int queue_is_locked(struct request_queue *q)
477{ 400{
@@ -596,38 +519,26 @@ enum {
596 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) 519 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags)
597#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) 520#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
598#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) 521#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
522#define blk_queue_add_random(q) test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags)
599#define blk_queue_flushing(q) ((q)->ordseq) 523#define blk_queue_flushing(q) ((q)->ordseq)
600#define blk_queue_stackable(q) \ 524#define blk_queue_stackable(q) \
601 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) 525 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
602#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) 526#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)
603 527
604#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) 528#define blk_noretry_request(rq) \
605#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) 529 ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
606#define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) 530 REQ_FAILFAST_DRIVER))
607#define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) 531
608 532#define blk_account_rq(rq) \
609#define blk_failfast_dev(rq) ((rq)->cmd_flags & REQ_FAILFAST_DEV) 533 (((rq)->cmd_flags & REQ_STARTED) && \
610#define blk_failfast_transport(rq) ((rq)->cmd_flags & REQ_FAILFAST_TRANSPORT) 534 ((rq)->cmd_type == REQ_TYPE_FS || \
611#define blk_failfast_driver(rq) ((rq)->cmd_flags & REQ_FAILFAST_DRIVER) 535 ((rq)->cmd_flags & REQ_DISCARD)))
612#define blk_noretry_request(rq) (blk_failfast_dev(rq) || \ 536
613 blk_failfast_transport(rq) || \
614 blk_failfast_driver(rq))
615#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
616#define blk_rq_io_stat(rq) ((rq)->cmd_flags & REQ_IO_STAT)
617#define blk_rq_quiet(rq) ((rq)->cmd_flags & REQ_QUIET)
618
619#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
620
621#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND)
622#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME)
623#define blk_pm_request(rq) \ 537#define blk_pm_request(rq) \
624 (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) 538 ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND || \
539 (rq)->cmd_type == REQ_TYPE_PM_RESUME)
625 540
626#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) 541#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1)
627#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED)
628#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER)
629#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
630#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD)
631#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 542#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
632/* rq->queuelist of dequeued request must be list_empty() */ 543/* rq->queuelist of dequeued request must be list_empty() */
633#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) 544#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
@@ -641,7 +552,7 @@ enum {
641 */ 552 */
642static inline bool rw_is_sync(unsigned int rw_flags) 553static inline bool rw_is_sync(unsigned int rw_flags)
643{ 554{
644 return !(rw_flags & REQ_RW) || (rw_flags & REQ_RW_SYNC); 555 return !(rw_flags & REQ_WRITE) || (rw_flags & REQ_SYNC);
645} 556}
646 557
647static inline bool rq_is_sync(struct request *rq) 558static inline bool rq_is_sync(struct request *rq)
@@ -649,9 +560,6 @@ static inline bool rq_is_sync(struct request *rq)
649 return rw_is_sync(rq->cmd_flags); 560 return rw_is_sync(rq->cmd_flags);
650} 561}
651 562
652#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
653#define rq_noidle(rq) ((rq)->cmd_flags & REQ_NOIDLE)
654
655static inline int blk_queue_full(struct request_queue *q, int sync) 563static inline int blk_queue_full(struct request_queue *q, int sync)
656{ 564{
657 if (sync) 565 if (sync)
@@ -684,7 +592,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int sync)
684 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) 592 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
685#define rq_mergeable(rq) \ 593#define rq_mergeable(rq) \
686 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ 594 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
687 (blk_discard_rq(rq) || blk_fs_request((rq)))) 595 (((rq)->cmd_flags & REQ_DISCARD) || \
596 (rq)->cmd_type == REQ_TYPE_FS))
688 597
689/* 598/*
690 * q->prep_rq_fn return values 599 * q->prep_rq_fn return values
@@ -709,7 +618,7 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn;
709#define BLK_BOUNCE_HIGH -1ULL 618#define BLK_BOUNCE_HIGH -1ULL
710#endif 619#endif
711#define BLK_BOUNCE_ANY (-1ULL) 620#define BLK_BOUNCE_ANY (-1ULL)
712#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) 621#define BLK_BOUNCE_ISA (DMA_BIT_MASK(24))
713 622
714/* 623/*
715 * default timeout for SG_IO if none specified 624 * default timeout for SG_IO if none specified
@@ -781,6 +690,8 @@ extern struct request *blk_make_request(struct request_queue *, struct bio *,
781 gfp_t); 690 gfp_t);
782extern void blk_insert_request(struct request_queue *, struct request *, int, void *); 691extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
783extern void blk_requeue_request(struct request_queue *, struct request *); 692extern void blk_requeue_request(struct request_queue *, struct request *);
693extern void blk_add_request_payload(struct request *rq, struct page *page,
694 unsigned int len);
784extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); 695extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
785extern int blk_lld_busy(struct request_queue *q); 696extern int blk_lld_busy(struct request_queue *q);
786extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src, 697extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
@@ -915,6 +826,7 @@ extern void blk_complete_request(struct request *);
915extern void __blk_complete_request(struct request *); 826extern void __blk_complete_request(struct request *);
916extern void blk_abort_request(struct request *); 827extern void blk_abort_request(struct request *);
917extern void blk_abort_queue(struct request_queue *); 828extern void blk_abort_queue(struct request_queue *);
829extern void blk_unprep_request(struct request *);
918 830
919/* 831/*
920 * Access functions for manipulating queue properties 832 * Access functions for manipulating queue properties
@@ -959,6 +871,7 @@ extern int blk_queue_dma_drain(struct request_queue *q,
959extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn); 871extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn);
960extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); 872extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
961extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); 873extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
874extern void blk_queue_unprep_rq(struct request_queue *, unprep_rq_fn *ufn);
962extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); 875extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
963extern void blk_queue_dma_alignment(struct request_queue *, int); 876extern void blk_queue_dma_alignment(struct request_queue *, int);
964extern void blk_queue_update_dma_alignment(struct request_queue *, int); 877extern void blk_queue_update_dma_alignment(struct request_queue *, int);
@@ -966,7 +879,7 @@ extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
966extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); 879extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
967extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); 880extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
968extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 881extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
969extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); 882extern int blk_queue_ordered(struct request_queue *, unsigned);
970extern bool blk_do_ordered(struct request_queue *, struct request **); 883extern bool blk_do_ordered(struct request_queue *, struct request **);
971extern unsigned blk_ordered_cur_seq(struct request_queue *); 884extern unsigned blk_ordered_cur_seq(struct request_queue *);
972extern unsigned blk_ordered_req_seq(struct request *); 885extern unsigned blk_ordered_req_seq(struct request *);
@@ -1020,7 +933,7 @@ static inline int sb_issue_discard(struct super_block *sb,
1020{ 933{
1021 block <<= (sb->s_blocksize_bits - 9); 934 block <<= (sb->s_blocksize_bits - 9);
1022 nr_blocks <<= (sb->s_blocksize_bits - 9); 935 nr_blocks <<= (sb->s_blocksize_bits - 9);
1023 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL, 936 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_NOFS,
1024 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER); 937 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
1025} 938}
1026 939
@@ -1333,7 +1246,6 @@ static inline int blk_integrity_rq(struct request *rq)
1333struct block_device_operations { 1246struct block_device_operations {
1334 int (*open) (struct block_device *, fmode_t); 1247 int (*open) (struct block_device *, fmode_t);
1335 int (*release) (struct gendisk *, fmode_t); 1248 int (*release) (struct gendisk *, fmode_t);
1336 int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1337 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1249 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1338 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1250 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1339 int (*direct_access) (struct block_device *, sector_t, 1251 int (*direct_access) (struct block_device *, sector_t,
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 416bf62d6d46..3395cf7130f5 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -5,6 +5,7 @@
5#ifdef __KERNEL__ 5#ifdef __KERNEL__
6#include <linux/blkdev.h> 6#include <linux/blkdev.h>
7#include <linux/relay.h> 7#include <linux/relay.h>
8#include <linux/compat.h>
8#endif 9#endif
9 10
10/* 11/*
@@ -220,11 +221,26 @@ static inline int blk_trace_init_sysfs(struct device *dev)
220 221
221#endif /* CONFIG_BLK_DEV_IO_TRACE */ 222#endif /* CONFIG_BLK_DEV_IO_TRACE */
222 223
224#ifdef CONFIG_COMPAT
225
226struct compat_blk_user_trace_setup {
227 char name[32];
228 u16 act_mask;
229 u32 buf_size;
230 u32 buf_nr;
231 compat_u64 start_lba;
232 compat_u64 end_lba;
233 u32 pid;
234};
235#define BLKTRACESETUP32 _IOWR(0x12, 115, struct compat_blk_user_trace_setup)
236
237#endif
238
223#if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK) 239#if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK)
224 240
225static inline int blk_cmd_buf_len(struct request *rq) 241static inline int blk_cmd_buf_len(struct request *rq)
226{ 242{
227 return blk_pc_request(rq) ? rq->cmd_len * 3 : 1; 243 return (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? rq->cmd_len * 3 : 1;
228} 244}
229 245
230extern void blk_dump_cmd(char *buf, struct request *rq); 246extern void blk_dump_cmd(char *buf, struct request *rq);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 2ce51fac7d3d..43e649a72529 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -203,12 +203,10 @@ int block_write_full_page_endio(struct page *page, get_block_t *get_block,
203int block_read_full_page(struct page*, get_block_t*); 203int block_read_full_page(struct page*, get_block_t*);
204int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, 204int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc,
205 unsigned long from); 205 unsigned long from);
206int block_write_begin_newtrunc(struct file *, struct address_space *, 206int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
207 loff_t, unsigned, unsigned, 207 unsigned flags, struct page **pagep, get_block_t *get_block);
208 struct page **, void **, get_block_t*); 208int __block_write_begin(struct page *page, loff_t pos, unsigned len,
209int block_write_begin(struct file *, struct address_space *, 209 get_block_t *get_block);
210 loff_t, unsigned, unsigned,
211 struct page **, void **, get_block_t*);
212int block_write_end(struct file *, struct address_space *, 210int block_write_end(struct file *, struct address_space *,
213 loff_t, unsigned, unsigned, 211 loff_t, unsigned, unsigned,
214 struct page *, void *); 212 struct page *, void *);
@@ -217,9 +215,6 @@ int generic_write_end(struct file *, struct address_space *,
217 struct page *, void *); 215 struct page *, void *);
218void page_zero_new_buffers(struct page *page, unsigned from, unsigned to); 216void page_zero_new_buffers(struct page *page, unsigned from, unsigned to);
219int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); 217int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
220int cont_write_begin_newtrunc(struct file *, struct address_space *, loff_t,
221 unsigned, unsigned, struct page **, void **,
222 get_block_t *, loff_t *);
223int cont_write_begin(struct file *, struct address_space *, loff_t, 218int cont_write_begin(struct file *, struct address_space *, loff_t,
224 unsigned, unsigned, struct page **, void **, 219 unsigned, unsigned, struct page **, void **,
225 get_block_t *, loff_t *); 220 get_block_t *, loff_t *);
@@ -230,12 +225,7 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
230void block_sync_page(struct page *); 225void block_sync_page(struct page *);
231sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 226sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
232int block_truncate_page(struct address_space *, loff_t, get_block_t *); 227int block_truncate_page(struct address_space *, loff_t, get_block_t *);
233int file_fsync(struct file *, int); 228int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned,
234int nobh_write_begin_newtrunc(struct file *, struct address_space *,
235 loff_t, unsigned, unsigned,
236 struct page **, void **, get_block_t*);
237int nobh_write_begin(struct file *, struct address_space *,
238 loff_t, unsigned, unsigned,
239 struct page **, void **, get_block_t*); 229 struct page **, void **, get_block_t*);
240int nobh_write_end(struct file *, struct address_space *, 230int nobh_write_end(struct file *, struct address_space *,
241 loff_t, unsigned, unsigned, 231 loff_t, unsigned, unsigned,
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 8859e2ede9fe..284b520934a0 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -86,9 +86,9 @@ struct upc_req {
86 wait_queue_head_t uc_sleep; /* process' wait queue */ 86 wait_queue_head_t uc_sleep; /* process' wait queue */
87}; 87};
88 88
89#define REQ_ASYNC 0x1 89#define CODA_REQ_ASYNC 0x1
90#define REQ_READ 0x2 90#define CODA_REQ_READ 0x2
91#define REQ_WRITE 0x4 91#define CODA_REQ_WRITE 0x4
92#define REQ_ABORT 0x8 92#define CODA_REQ_ABORT 0x8
93 93
94#endif 94#endif
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 38fe59dc89ae..7f0c32908568 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -21,6 +21,8 @@ struct vt_struct;
21#define NPAR 16 21#define NPAR 16
22 22
23struct vc_data { 23struct vc_data {
24 struct tty_port port; /* Upper level data */
25
24 unsigned short vc_num; /* Console number */ 26 unsigned short vc_num; /* Console number */
25 unsigned int vc_cols; /* [#] Console size */ 27 unsigned int vc_cols; /* [#] Console size */
26 unsigned int vc_rows; 28 unsigned int vc_rows;
@@ -56,7 +58,6 @@ struct vc_data {
56 /* VT terminal data */ 58 /* VT terminal data */
57 unsigned int vc_state; /* Escape sequence parser state */ 59 unsigned int vc_state; /* Escape sequence parser state */
58 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ 60 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
59 struct tty_struct *vc_tty; /* TTY we are attached to */
60 /* data for manual vt switching */ 61 /* data for manual vt switching */
61 struct vt_mode vt_mode; 62 struct vt_mode vt_mode;
62 struct pid *vt_pid; 63 struct pid *vt_pid;
@@ -105,6 +106,7 @@ struct vc_data {
105 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ 106 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
106 unsigned long vc_uni_pagedir; 107 unsigned long vc_uni_pagedir;
107 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ 108 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
109 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
108 /* additional information is in vt_kern.h */ 110 /* additional information is in vt_kern.h */
109}; 111};
110 112
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index eebb617c17d8..d23be0386e2d 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -315,6 +315,7 @@ extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
315 315
316extern char *__d_path(const struct path *path, struct path *root, char *, int); 316extern char *__d_path(const struct path *path, struct path *root, char *, int);
317extern char *d_path(const struct path *, char *, int); 317extern char *d_path(const struct path *, char *, int);
318extern char *__dentry_path(struct dentry *, char *, int);
318extern char *dentry_path(struct dentry *, char *, int); 319extern char *dentry_path(struct dentry *, char *, int);
319 320
320/* Allocation counts.. */ 321/* Allocation counts.. */
diff --git a/include/linux/dnotify.h b/include/linux/dnotify.h
index ecc06286226d..3290555a52ee 100644
--- a/include/linux/dnotify.h
+++ b/include/linux/dnotify.h
@@ -28,6 +28,7 @@ struct dnotify_struct {
28 FS_CREATE | FS_DN_RENAME |\ 28 FS_CREATE | FS_DN_RENAME |\
29 FS_MOVED_FROM | FS_MOVED_TO) 29 FS_MOVED_FROM | FS_MOVED_TO)
30 30
31extern int dir_notify_enable;
31extern void dnotify_flush(struct file *, fl_owner_t); 32extern void dnotify_flush(struct file *, fl_owner_t);
32extern int fcntl_dirnotify(int, struct file *, unsigned long); 33extern int fcntl_dirnotify(int, struct file *, unsigned long);
33 34
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index b8d2516668aa..479ee3a1d901 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -53,7 +53,7 @@
53 53
54 54
55extern const char *drbd_buildtag(void); 55extern const char *drbd_buildtag(void);
56#define REL_VERSION "8.3.8" 56#define REL_VERSION "8.3.8.1"
57#define API_VERSION 88 57#define API_VERSION 88
58#define PRO_VERSION_MIN 86 58#define PRO_VERSION_MIN 86
59#define PRO_VERSION_MAX 94 59#define PRO_VERSION_MAX 94
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
index ce77a746fc9d..5f042810a56c 100644
--- a/include/linux/drbd_nl.h
+++ b/include/linux/drbd_nl.h
@@ -78,10 +78,11 @@ NL_PACKET(syncer_conf, 8,
78 NL_INTEGER( 30, T_MAY_IGNORE, rate) 78 NL_INTEGER( 30, T_MAY_IGNORE, rate)
79 NL_INTEGER( 31, T_MAY_IGNORE, after) 79 NL_INTEGER( 31, T_MAY_IGNORE, after)
80 NL_INTEGER( 32, T_MAY_IGNORE, al_extents) 80 NL_INTEGER( 32, T_MAY_IGNORE, al_extents)
81 NL_INTEGER( 71, T_MAY_IGNORE, dp_volume) 81/* NL_INTEGER( 71, T_MAY_IGNORE, dp_volume)
82 NL_INTEGER( 72, T_MAY_IGNORE, dp_interval) 82 * NL_INTEGER( 72, T_MAY_IGNORE, dp_interval)
83 NL_INTEGER( 73, T_MAY_IGNORE, throttle_th) 83 * NL_INTEGER( 73, T_MAY_IGNORE, throttle_th)
84 NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th) 84 * NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th)
85 * feature will be reimplemented differently with 8.3.9 */
85 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX) 86 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX)
86 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32) 87 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32)
87 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX) 88 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX)
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 3d3a9915dde2..6ce1bca01724 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -895,7 +895,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
895extern struct inode *ext3_iget(struct super_block *, unsigned long); 895extern struct inode *ext3_iget(struct super_block *, unsigned long);
896extern int ext3_write_inode (struct inode *, struct writeback_control *); 896extern int ext3_write_inode (struct inode *, struct writeback_control *);
897extern int ext3_setattr (struct dentry *, struct iattr *); 897extern int ext3_setattr (struct dentry *, struct iattr *);
898extern void ext3_delete_inode (struct inode *); 898extern void ext3_evict_inode (struct inode *);
899extern int ext3_sync_inode (handle_t *, struct inode *); 899extern int ext3_sync_inode (handle_t *, struct inode *);
900extern void ext3_discard_reservation (struct inode *); 900extern void ext3_discard_reservation (struct inode *);
901extern void ext3_dirty_inode(struct inode *); 901extern void ext3_dirty_inode(struct inode *);
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
new file mode 100644
index 000000000000..f0949a57ca9d
--- /dev/null
+++ b/include/linux/fanotify.h
@@ -0,0 +1,105 @@
1#ifndef _LINUX_FANOTIFY_H
2#define _LINUX_FANOTIFY_H
3
4#include <linux/types.h>
5
6/* the following events that user-space can register for */
7#define FAN_ACCESS 0x00000001 /* File was accessed */
8#define FAN_MODIFY 0x00000002 /* File was modified */
9#define FAN_CLOSE_WRITE 0x00000008 /* Unwrittable file closed */
10#define FAN_CLOSE_NOWRITE 0x00000010 /* Writtable file closed */
11#define FAN_OPEN 0x00000020 /* File was opened */
12
13#define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */
14
15/* FIXME currently Q's have no limit.... */
16#define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
17
18#define FAN_OPEN_PERM 0x00010000 /* File open in perm check */
19#define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */
20
21/* helper events */
22#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */
23
24/* flags used for fanotify_init() */
25#define FAN_CLOEXEC 0x00000001
26#define FAN_NONBLOCK 0x00000002
27
28#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK)
29
30/* flags used for fanotify_modify_mark() */
31#define FAN_MARK_ADD 0x00000001
32#define FAN_MARK_REMOVE 0x00000002
33#define FAN_MARK_DONT_FOLLOW 0x00000004
34#define FAN_MARK_ONLYDIR 0x00000008
35#define FAN_MARK_MOUNT 0x00000010
36#define FAN_MARK_IGNORED_MASK 0x00000020
37#define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040
38#define FAN_MARK_FLUSH 0x00000080
39
40#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\
41 FAN_MARK_REMOVE |\
42 FAN_MARK_DONT_FOLLOW |\
43 FAN_MARK_ONLYDIR |\
44 FAN_MARK_MOUNT |\
45 FAN_MARK_IGNORED_MASK |\
46 FAN_MARK_IGNORED_SURV_MODIFY)
47
48/*
49 * All of the events - we build the list by hand so that we can add flags in
50 * the future and not break backward compatibility. Apps will get only the
51 * events that they originally wanted. Be sure to add new events here!
52 */
53#define FAN_ALL_EVENTS (FAN_ACCESS |\
54 FAN_MODIFY |\
55 FAN_CLOSE |\
56 FAN_OPEN)
57
58/*
59 * All events which require a permission response from userspace
60 */
61#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM |\
62 FAN_ACCESS_PERM)
63
64#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS |\
65 FAN_ALL_PERM_EVENTS |\
66 FAN_Q_OVERFLOW)
67
68#define FANOTIFY_METADATA_VERSION 1
69
70struct fanotify_event_metadata {
71 __u32 event_len;
72 __u32 vers;
73 __s32 fd;
74 __u64 mask;
75 __s64 pid;
76} __attribute__ ((packed));
77
78struct fanotify_response {
79 __s32 fd;
80 __u32 response;
81} __attribute__ ((packed));
82
83/* Legit userspace responses to a _PERM event */
84#define FAN_ALLOW 0x01
85#define FAN_DENY 0x02
86
87/* Helper functions to deal with fanotify_event_metadata buffers */
88#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
89
90#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, \
91 (struct fanotify_event_metadata*)(((char *)(meta)) + \
92 (meta)->event_len))
93
94#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && \
95 (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \
96 (long)(meta)->event_len <= (long)(len))
97
98#ifdef __KERNEL__
99
100struct fanotify_wait {
101 struct fsnotify_event *event;
102 __s32 fd;
103};
104#endif /* __KERNEL__ */
105#endif /* _LINUX_FANOTIFY_H */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 0c5659c41b01..f0268deca658 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -825,6 +825,10 @@ struct fb_tile_ops {
825 */ 825 */
826#define FBINFO_BE_MATH 0x100000 826#define FBINFO_BE_MATH 0x100000
827 827
828/* report to the VT layer that this fb driver can accept forced console
829 output like oopses */
830#define FBINFO_CAN_FORCE_OUTPUT 0x200000
831
828struct fb_info { 832struct fb_info {
829 int node; 833 int node;
830 int flags; 834 int flags;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 488efec09d14..1542e0e52b2e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -8,6 +8,7 @@
8 8
9#include <linux/limits.h> 9#include <linux/limits.h>
10#include <linux/ioctl.h> 10#include <linux/ioctl.h>
11#include <linux/blk_types.h>
11 12
12/* 13/*
13 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 14 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -91,6 +92,9 @@ struct inodes_stat_t {
91/* Expect random access pattern */ 92/* Expect random access pattern */
92#define FMODE_RANDOM ((__force fmode_t)0x1000) 93#define FMODE_RANDOM ((__force fmode_t)0x1000)
93 94
95/* File was opened by fanotify and shouldn't generate fanotify events */
96#define FMODE_NONOTIFY ((__force fmode_t)16777216) /* 0x1000000 */
97
94/* 98/*
95 * The below are the various read and write types that we support. Some of 99 * The below are the various read and write types that we support. Some of
96 * them include behavioral modifiers that send information down to the 100 * them include behavioral modifiers that send information down to the
@@ -118,7 +122,7 @@ struct inodes_stat_t {
118 * immediately wait on this read without caring about 122 * immediately wait on this read without caring about
119 * unplugging. 123 * unplugging.
120 * READA Used for read-ahead operations. Lower priority, and the 124 * READA Used for read-ahead operations. Lower priority, and the
121 * block layer could (in theory) choose to ignore this 125 * block layer could (in theory) choose to ignore this
122 * request if it runs into resource problems. 126 * request if it runs into resource problems.
123 * WRITE A normal async write. Device will be plugged. 127 * WRITE A normal async write. Device will be plugged.
124 * SWRITE Like WRITE, but a special case for ll_rw_block() that 128 * SWRITE Like WRITE, but a special case for ll_rw_block() that
@@ -137,7 +141,7 @@ struct inodes_stat_t {
137 * SWRITE_SYNC 141 * SWRITE_SYNC
138 * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. 142 * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer.
139 * See SWRITE. 143 * See SWRITE.
140 * WRITE_BARRIER Like WRITE, but tells the block layer that all 144 * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all
141 * previously submitted writes must be safely on storage 145 * previously submitted writes must be safely on storage
142 * before this one is started. Also guarantees that when 146 * before this one is started. Also guarantees that when
143 * this write is complete, it itself is also safely on 147 * this write is complete, it itself is also safely on
@@ -145,29 +149,31 @@ struct inodes_stat_t {
145 * of this IO. 149 * of this IO.
146 * 150 *
147 */ 151 */
148#define RW_MASK 1 152#define RW_MASK REQ_WRITE
149#define RWA_MASK 2 153#define RWA_MASK REQ_RAHEAD
150#define READ 0 154
151#define WRITE 1 155#define READ 0
152#define READA 2 /* read-ahead - don't block if no resources */ 156#define WRITE RW_MASK
153#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 157#define READA RWA_MASK
154#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 158#define SWRITE (WRITE | READA)
155#define READ_META (READ | (1 << BIO_RW_META)) 159
156#define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 160#define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG)
157#define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 161#define READ_META (READ | REQ_META)
158#define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) 162#define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE)
159#define WRITE_META (WRITE | (1 << BIO_RW_META)) 163#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
160#define SWRITE_SYNC_PLUG \ 164#define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC)
161 (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 165#define WRITE_META (WRITE | REQ_META)
162#define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 166#define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
163#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) 167 REQ_HARDBARRIER)
168#define SWRITE_SYNC_PLUG (SWRITE | REQ_SYNC | REQ_NOIDLE)
169#define SWRITE_SYNC (SWRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
164 170
165/* 171/*
166 * These aren't really reads or writes, they pass down information about 172 * These aren't really reads or writes, they pass down information about
167 * parts of device that are now unused by the file system. 173 * parts of device that are now unused by the file system.
168 */ 174 */
169#define DISCARD_NOBARRIER (WRITE | (1 << BIO_RW_DISCARD)) 175#define DISCARD_NOBARRIER (WRITE | REQ_DISCARD)
170#define DISCARD_BARRIER (DISCARD_NOBARRIER | (1 << BIO_RW_BARRIER)) 176#define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER)
171 177
172#define SEL_IN 1 178#define SEL_IN 1
173#define SEL_OUT 2 179#define SEL_OUT 2
@@ -210,6 +216,7 @@ struct inodes_stat_t {
210#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 216#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
211#define MS_I_VERSION (1<<23) /* Update inode I_version field */ 217#define MS_I_VERSION (1<<23) /* Update inode I_version field */
212#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ 218#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
219#define MS_BORN (1<<29)
213#define MS_ACTIVE (1<<30) 220#define MS_ACTIVE (1<<30)
214#define MS_NOUSER (1<<31) 221#define MS_NOUSER (1<<31)
215 222
@@ -408,9 +415,6 @@ extern int get_max_files(void);
408extern int sysctl_nr_open; 415extern int sysctl_nr_open;
409extern struct inodes_stat_t inodes_stat; 416extern struct inodes_stat_t inodes_stat;
410extern int leases_enable, lease_break_time; 417extern int leases_enable, lease_break_time;
411#ifdef CONFIG_DNOTIFY
412extern int dir_notify_enable;
413#endif
414 418
415struct buffer_head; 419struct buffer_head;
416typedef int (get_block_t)(struct inode *inode, sector_t iblock, 420typedef int (get_block_t)(struct inode *inode, sector_t iblock,
@@ -771,12 +775,7 @@ struct inode {
771 775
772#ifdef CONFIG_FSNOTIFY 776#ifdef CONFIG_FSNOTIFY
773 __u32 i_fsnotify_mask; /* all events this inode cares about */ 777 __u32 i_fsnotify_mask; /* all events this inode cares about */
774 struct hlist_head i_fsnotify_mark_entries; /* fsnotify mark entries */ 778 struct hlist_head i_fsnotify_marks;
775#endif
776
777#ifdef CONFIG_INOTIFY
778 struct list_head inotify_watches; /* watches on this inode */
779 struct mutex inotify_mutex; /* protects the watches list */
780#endif 779#endif
781 780
782 unsigned long i_state; 781 unsigned long i_state;
@@ -1564,8 +1563,8 @@ struct super_operations {
1564 1563
1565 void (*dirty_inode) (struct inode *); 1564 void (*dirty_inode) (struct inode *);
1566 int (*write_inode) (struct inode *, struct writeback_control *wbc); 1565 int (*write_inode) (struct inode *, struct writeback_control *wbc);
1567 void (*drop_inode) (struct inode *); 1566 int (*drop_inode) (struct inode *);
1568 void (*delete_inode) (struct inode *); 1567 void (*evict_inode) (struct inode *);
1569 void (*put_super) (struct super_block *); 1568 void (*put_super) (struct super_block *);
1570 void (*write_super) (struct super_block *); 1569 void (*write_super) (struct super_block *);
1571 int (*sync_fs)(struct super_block *sb, int wait); 1570 int (*sync_fs)(struct super_block *sb, int wait);
@@ -1573,7 +1572,6 @@ struct super_operations {
1573 int (*unfreeze_fs) (struct super_block *); 1572 int (*unfreeze_fs) (struct super_block *);
1574 int (*statfs) (struct dentry *, struct kstatfs *); 1573 int (*statfs) (struct dentry *, struct kstatfs *);
1575 int (*remount_fs) (struct super_block *, int *, char *); 1574 int (*remount_fs) (struct super_block *, int *, char *);
1576 void (*clear_inode) (struct inode *);
1577 void (*umount_begin) (struct super_block *); 1575 void (*umount_begin) (struct super_block *);
1578 1576
1579 int (*show_options)(struct seq_file *, struct vfsmount *); 1577 int (*show_options)(struct seq_file *, struct vfsmount *);
@@ -1618,8 +1616,8 @@ struct super_operations {
1618 * I_FREEING Set when inode is about to be freed but still has dirty 1616 * I_FREEING Set when inode is about to be freed but still has dirty
1619 * pages or buffers attached or the inode itself is still 1617 * pages or buffers attached or the inode itself is still
1620 * dirty. 1618 * dirty.
1621 * I_CLEAR Set by clear_inode(). In this state the inode is clean 1619 * I_CLEAR Added by end_writeback(). In this state the inode is clean
1622 * and can be destroyed. 1620 * and can be destroyed. Inode keeps I_FREEING.
1623 * 1621 *
1624 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are 1622 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
1625 * prohibited for many purposes. iget() must wait for 1623 * prohibited for many purposes. iget() must wait for
@@ -1816,7 +1814,8 @@ extern struct vfsmount *collect_mounts(struct path *);
1816extern void drop_collected_mounts(struct vfsmount *); 1814extern void drop_collected_mounts(struct vfsmount *);
1817extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1815extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1818 struct vfsmount *); 1816 struct vfsmount *);
1819extern int vfs_statfs(struct dentry *, struct kstatfs *); 1817extern int vfs_statfs(struct path *, struct kstatfs *);
1818extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1820extern int freeze_super(struct super_block *super); 1819extern int freeze_super(struct super_block *super);
1821extern int thaw_super(struct super_block *super); 1820extern int thaw_super(struct super_block *super);
1822 1821
@@ -2166,9 +2165,8 @@ extern void iput(struct inode *);
2166extern struct inode * igrab(struct inode *); 2165extern struct inode * igrab(struct inode *);
2167extern ino_t iunique(struct super_block *, ino_t); 2166extern ino_t iunique(struct super_block *, ino_t);
2168extern int inode_needs_sync(struct inode *inode); 2167extern int inode_needs_sync(struct inode *inode);
2169extern void generic_delete_inode(struct inode *inode); 2168extern int generic_delete_inode(struct inode *inode);
2170extern void generic_drop_inode(struct inode *inode); 2169extern int generic_drop_inode(struct inode *inode);
2171extern int generic_detach_inode(struct inode *inode);
2172 2170
2173extern struct inode *ilookup5_nowait(struct super_block *sb, 2171extern struct inode *ilookup5_nowait(struct super_block *sb,
2174 unsigned long hashval, int (*test)(struct inode *, void *), 2172 unsigned long hashval, int (*test)(struct inode *, void *),
@@ -2185,7 +2183,7 @@ extern void unlock_new_inode(struct inode *);
2185 2183
2186extern void __iget(struct inode * inode); 2184extern void __iget(struct inode * inode);
2187extern void iget_failed(struct inode *); 2185extern void iget_failed(struct inode *);
2188extern void clear_inode(struct inode *); 2186extern void end_writeback(struct inode *);
2189extern void destroy_inode(struct inode *); 2187extern void destroy_inode(struct inode *);
2190extern void __destroy_inode(struct inode *); 2188extern void __destroy_inode(struct inode *);
2191extern struct inode *new_inode(struct super_block *); 2189extern struct inode *new_inode(struct super_block *);
@@ -2201,7 +2199,6 @@ static inline void insert_inode_hash(struct inode *inode) {
2201extern void file_move(struct file *f, struct list_head *list); 2199extern void file_move(struct file *f, struct list_head *list);
2202extern void file_kill(struct file *f); 2200extern void file_kill(struct file *f);
2203#ifdef CONFIG_BLOCK 2201#ifdef CONFIG_BLOCK
2204struct bio;
2205extern void submit_bio(int, struct bio *); 2202extern void submit_bio(int, struct bio *);
2206extern int bdev_read_only(struct block_device *); 2203extern int bdev_read_only(struct block_device *);
2207#endif 2204#endif
@@ -2268,19 +2265,8 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
2268#endif 2265#endif
2269 2266
2270#ifdef CONFIG_BLOCK 2267#ifdef CONFIG_BLOCK
2271struct bio;
2272typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode, 2268typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
2273 loff_t file_offset); 2269 loff_t file_offset);
2274void dio_end_io(struct bio *bio, int error);
2275
2276ssize_t __blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, struct inode *inode,
2277 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2278 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2279 dio_submit_t submit_io, int lock_type);
2280ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2281 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2282 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2283 dio_submit_t submit_io, int lock_type);
2284 2270
2285enum { 2271enum {
2286 /* need locking between buffered and direct access */ 2272 /* need locking between buffered and direct access */
@@ -2290,24 +2276,13 @@ enum {
2290 DIO_SKIP_HOLES = 0x02, 2276 DIO_SKIP_HOLES = 0x02,
2291}; 2277};
2292 2278
2293static inline ssize_t blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, 2279void dio_end_io(struct bio *bio, int error);
2294 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2280
2295 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2281ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2296 dio_iodone_t end_io) 2282 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2297{ 2283 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2298 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset, 2284 dio_submit_t submit_io, int flags);
2299 nr_segs, get_block, end_io, NULL,
2300 DIO_LOCKING | DIO_SKIP_HOLES);
2301}
2302 2285
2303static inline ssize_t blockdev_direct_IO_no_locking_newtrunc(int rw, struct kiocb *iocb,
2304 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2305 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2306 dio_iodone_t end_io)
2307{
2308 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset,
2309 nr_segs, get_block, end_io, NULL, 0);
2310}
2311static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2286static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2312 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2287 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2313 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2288 loff_t offset, unsigned long nr_segs, get_block_t get_block,
@@ -2317,15 +2292,6 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2317 nr_segs, get_block, end_io, NULL, 2292 nr_segs, get_block, end_io, NULL,
2318 DIO_LOCKING | DIO_SKIP_HOLES); 2293 DIO_LOCKING | DIO_SKIP_HOLES);
2319} 2294}
2320
2321static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2322 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2323 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2324 dio_iodone_t end_io)
2325{
2326 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2327 nr_segs, get_block, end_io, NULL, 0);
2328}
2329#endif 2295#endif
2330 2296
2331extern const struct file_operations generic_ro_fops; 2297extern const struct file_operations generic_ro_fops;
@@ -2387,7 +2353,6 @@ extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2387extern int simple_unlink(struct inode *, struct dentry *); 2353extern int simple_unlink(struct inode *, struct dentry *);
2388extern int simple_rmdir(struct inode *, struct dentry *); 2354extern int simple_rmdir(struct inode *, struct dentry *);
2389extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2355extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2390extern int simple_setsize(struct inode *, loff_t);
2391extern int noop_fsync(struct file *, int); 2356extern int noop_fsync(struct file *, int);
2392extern int simple_empty(struct dentry *); 2357extern int simple_empty(struct dentry *);
2393extern int simple_readpage(struct file *file, struct page *page); 2358extern int simple_readpage(struct file *file, struct page *page);
@@ -2424,8 +2389,7 @@ extern int buffer_migrate_page(struct address_space *,
2424 2389
2425extern int inode_change_ok(const struct inode *, struct iattr *); 2390extern int inode_change_ok(const struct inode *, struct iattr *);
2426extern int inode_newsize_ok(const struct inode *, loff_t offset); 2391extern int inode_newsize_ok(const struct inode *, loff_t offset);
2427extern int __must_check inode_setattr(struct inode *, const struct iattr *); 2392extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2428extern void generic_setattr(struct inode *inode, const struct iattr *attr);
2429 2393
2430extern void file_update_time(struct file *file); 2394extern void file_update_time(struct file *file);
2431 2395
@@ -2516,7 +2480,8 @@ int proc_nr_files(struct ctl_table *table, int write,
2516int __init get_filesystem_list(char *buf); 2480int __init get_filesystem_list(char *buf);
2517 2481
2518#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) 2482#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
2519#define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) 2483#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2484 (flag & FMODE_NONOTIFY)))
2520 2485
2521#endif /* __KERNEL__ */ 2486#endif /* __KERNEL__ */
2522#endif /* _LINUX_FS_H */ 2487#endif /* _LINUX_FS_H */
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 01755909ce81..e4e2204187ee 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -11,8 +11,6 @@
11 * (C) Copyright 2005 Robert Love 11 * (C) Copyright 2005 Robert Love
12 */ 12 */
13 13
14#include <linux/dnotify.h>
15#include <linux/inotify.h>
16#include <linux/fsnotify_backend.h> 14#include <linux/fsnotify_backend.h>
17#include <linux/audit.h> 15#include <linux/audit.h>
18#include <linux/slab.h> 16#include <linux/slab.h>
@@ -21,35 +19,52 @@
21 * fsnotify_d_instantiate - instantiate a dentry for inode 19 * fsnotify_d_instantiate - instantiate a dentry for inode
22 * Called with dcache_lock held. 20 * Called with dcache_lock held.
23 */ 21 */
24static inline void fsnotify_d_instantiate(struct dentry *entry, 22static inline void fsnotify_d_instantiate(struct dentry *dentry,
25 struct inode *inode) 23 struct inode *inode)
26{ 24{
27 __fsnotify_d_instantiate(entry, inode); 25 __fsnotify_d_instantiate(dentry, inode);
28
29 inotify_d_instantiate(entry, inode);
30} 26}
31 27
32/* Notify this dentry's parent about a child's events. */ 28/* Notify this dentry's parent about a child's events. */
33static inline void fsnotify_parent(struct dentry *dentry, __u32 mask) 29static inline void fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask)
34{ 30{
35 __fsnotify_parent(dentry, mask); 31 if (!dentry)
32 dentry = file->f_path.dentry;
33
34 __fsnotify_parent(file, dentry, mask);
35}
36 36
37 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); 37/* simple call site for access decisions */
38static inline int fsnotify_perm(struct file *file, int mask)
39{
40 struct inode *inode = file->f_path.dentry->d_inode;
41 __u32 fsnotify_mask = 0;
42
43 if (file->f_mode & FMODE_NONOTIFY)
44 return 0;
45 if (!(mask & (MAY_READ | MAY_OPEN)))
46 return 0;
47 if (mask & MAY_OPEN)
48 fsnotify_mask = FS_OPEN_PERM;
49 else if (mask & MAY_READ)
50 fsnotify_mask = FS_ACCESS_PERM;
51 else
52 BUG();
53
54 return fsnotify(inode, fsnotify_mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
38} 55}
39 56
40/* 57/*
41 * fsnotify_d_move - entry has been moved 58 * fsnotify_d_move - dentry has been moved
42 * Called with dcache_lock and entry->d_lock held. 59 * Called with dcache_lock and dentry->d_lock held.
43 */ 60 */
44static inline void fsnotify_d_move(struct dentry *entry) 61static inline void fsnotify_d_move(struct dentry *dentry)
45{ 62{
46 /* 63 /*
47 * On move we need to update entry->d_flags to indicate if the new parent 64 * On move we need to update dentry->d_flags to indicate if the new parent
48 * cares about events from this entry. 65 * cares about events from this dentry.
49 */ 66 */
50 __fsnotify_update_dcache_flags(entry); 67 __fsnotify_update_dcache_flags(dentry);
51
52 inotify_d_move(entry);
53} 68}
54 69
55/* 70/*
@@ -57,8 +72,6 @@ static inline void fsnotify_d_move(struct dentry *entry)
57 */ 72 */
58static inline void fsnotify_link_count(struct inode *inode) 73static inline void fsnotify_link_count(struct inode *inode)
59{ 74{
60 inotify_inode_queue_event(inode, IN_ATTRIB, 0, NULL, NULL);
61
62 fsnotify(inode, FS_ATTRIB, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 75 fsnotify(inode, FS_ATTRIB, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
63} 76}
64 77
@@ -66,45 +79,31 @@ static inline void fsnotify_link_count(struct inode *inode)
66 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir 79 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
67 */ 80 */
68static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, 81static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
69 const char *old_name, 82 const unsigned char *old_name,
70 int isdir, struct inode *target, struct dentry *moved) 83 int isdir, struct inode *target, struct dentry *moved)
71{ 84{
72 struct inode *source = moved->d_inode; 85 struct inode *source = moved->d_inode;
73 u32 in_cookie = inotify_get_cookie();
74 u32 fs_cookie = fsnotify_get_cookie(); 86 u32 fs_cookie = fsnotify_get_cookie();
75 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM); 87 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM);
76 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO); 88 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO);
77 const char *new_name = moved->d_name.name; 89 const unsigned char *new_name = moved->d_name.name;
78 90
79 if (old_dir == new_dir) 91 if (old_dir == new_dir)
80 old_dir_mask |= FS_DN_RENAME; 92 old_dir_mask |= FS_DN_RENAME;
81 93
82 if (isdir) { 94 if (isdir) {
83 isdir = IN_ISDIR;
84 old_dir_mask |= FS_IN_ISDIR; 95 old_dir_mask |= FS_IN_ISDIR;
85 new_dir_mask |= FS_IN_ISDIR; 96 new_dir_mask |= FS_IN_ISDIR;
86 } 97 }
87 98
88 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir, in_cookie, old_name,
89 source);
90 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, in_cookie, new_name,
91 source);
92
93 fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie); 99 fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie);
94 fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie); 100 fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie);
95 101
96 if (target) { 102 if (target)
97 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL, NULL);
98 inotify_inode_is_dead(target);
99
100 /* this is really a link_count change not a removal */
101 fsnotify_link_count(target); 103 fsnotify_link_count(target);
102 }
103 104
104 if (source) { 105 if (source)
105 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
106 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); 106 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0);
107 }
108 audit_inode_child(moved, new_dir); 107 audit_inode_child(moved, new_dir);
109} 108}
110 109
@@ -117,6 +116,14 @@ static inline void fsnotify_inode_delete(struct inode *inode)
117} 116}
118 117
119/* 118/*
119 * fsnotify_vfsmount_delete - a vfsmount is being destroyed, clean up is needed
120 */
121static inline void fsnotify_vfsmount_delete(struct vfsmount *mnt)
122{
123 __fsnotify_vfsmount_delete(mnt);
124}
125
126/*
120 * fsnotify_nameremove - a filename was removed from a directory 127 * fsnotify_nameremove - a filename was removed from a directory
121 */ 128 */
122static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) 129static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
@@ -126,7 +133,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
126 if (isdir) 133 if (isdir)
127 mask |= FS_IN_ISDIR; 134 mask |= FS_IN_ISDIR;
128 135
129 fsnotify_parent(dentry, mask); 136 fsnotify_parent(NULL, dentry, mask);
130} 137}
131 138
132/* 139/*
@@ -134,9 +141,6 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
134 */ 141 */
135static inline void fsnotify_inoderemove(struct inode *inode) 142static inline void fsnotify_inoderemove(struct inode *inode)
136{ 143{
137 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL, NULL);
138 inotify_inode_is_dead(inode);
139
140 fsnotify(inode, FS_DELETE_SELF, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 144 fsnotify(inode, FS_DELETE_SELF, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
141 __fsnotify_inode_delete(inode); 145 __fsnotify_inode_delete(inode);
142} 146}
@@ -146,8 +150,6 @@ static inline void fsnotify_inoderemove(struct inode *inode)
146 */ 150 */
147static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) 151static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
148{ 152{
149 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
150 dentry->d_inode);
151 audit_inode_child(dentry, inode); 153 audit_inode_child(dentry, inode);
152 154
153 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 155 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
@@ -160,8 +162,6 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
160 */ 162 */
161static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) 163static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)
162{ 164{
163 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name,
164 inode);
165 fsnotify_link_count(inode); 165 fsnotify_link_count(inode);
166 audit_inode_child(new_dentry, dir); 166 audit_inode_child(new_dentry, dir);
167 167
@@ -176,7 +176,6 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
176 __u32 mask = (FS_CREATE | FS_IN_ISDIR); 176 __u32 mask = (FS_CREATE | FS_IN_ISDIR);
177 struct inode *d_inode = dentry->d_inode; 177 struct inode *d_inode = dentry->d_inode;
178 178
179 inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode);
180 audit_inode_child(dentry, inode); 179 audit_inode_child(dentry, inode);
181 180
182 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 181 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
@@ -185,52 +184,52 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
185/* 184/*
186 * fsnotify_access - file was read 185 * fsnotify_access - file was read
187 */ 186 */
188static inline void fsnotify_access(struct dentry *dentry) 187static inline void fsnotify_access(struct file *file)
189{ 188{
190 struct inode *inode = dentry->d_inode; 189 struct inode *inode = file->f_path.dentry->d_inode;
191 __u32 mask = FS_ACCESS; 190 __u32 mask = FS_ACCESS;
192 191
193 if (S_ISDIR(inode->i_mode)) 192 if (S_ISDIR(inode->i_mode))
194 mask |= FS_IN_ISDIR; 193 mask |= FS_IN_ISDIR;
195 194
196 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 195 if (!(file->f_mode & FMODE_NONOTIFY)) {
197 196 fsnotify_parent(file, NULL, mask);
198 fsnotify_parent(dentry, mask); 197 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
199 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 198 }
200} 199}
201 200
202/* 201/*
203 * fsnotify_modify - file was modified 202 * fsnotify_modify - file was modified
204 */ 203 */
205static inline void fsnotify_modify(struct dentry *dentry) 204static inline void fsnotify_modify(struct file *file)
206{ 205{
207 struct inode *inode = dentry->d_inode; 206 struct inode *inode = file->f_path.dentry->d_inode;
208 __u32 mask = FS_MODIFY; 207 __u32 mask = FS_MODIFY;
209 208
210 if (S_ISDIR(inode->i_mode)) 209 if (S_ISDIR(inode->i_mode))
211 mask |= FS_IN_ISDIR; 210 mask |= FS_IN_ISDIR;
212 211
213 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 212 if (!(file->f_mode & FMODE_NONOTIFY)) {
214 213 fsnotify_parent(file, NULL, mask);
215 fsnotify_parent(dentry, mask); 214 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
216 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 215 }
217} 216}
218 217
219/* 218/*
220 * fsnotify_open - file was opened 219 * fsnotify_open - file was opened
221 */ 220 */
222static inline void fsnotify_open(struct dentry *dentry) 221static inline void fsnotify_open(struct file *file)
223{ 222{
224 struct inode *inode = dentry->d_inode; 223 struct inode *inode = file->f_path.dentry->d_inode;
225 __u32 mask = FS_OPEN; 224 __u32 mask = FS_OPEN;
226 225
227 if (S_ISDIR(inode->i_mode)) 226 if (S_ISDIR(inode->i_mode))
228 mask |= FS_IN_ISDIR; 227 mask |= FS_IN_ISDIR;
229 228
230 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 229 if (!(file->f_mode & FMODE_NONOTIFY)) {
231 230 fsnotify_parent(file, NULL, mask);
232 fsnotify_parent(dentry, mask); 231 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
233 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 232 }
234} 233}
235 234
236/* 235/*
@@ -238,18 +237,17 @@ static inline void fsnotify_open(struct dentry *dentry)
238 */ 237 */
239static inline void fsnotify_close(struct file *file) 238static inline void fsnotify_close(struct file *file)
240{ 239{
241 struct dentry *dentry = file->f_path.dentry; 240 struct inode *inode = file->f_path.dentry->d_inode;
242 struct inode *inode = dentry->d_inode;
243 fmode_t mode = file->f_mode; 241 fmode_t mode = file->f_mode;
244 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; 242 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
245 243
246 if (S_ISDIR(inode->i_mode)) 244 if (S_ISDIR(inode->i_mode))
247 mask |= FS_IN_ISDIR; 245 mask |= FS_IN_ISDIR;
248 246
249 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 247 if (!(file->f_mode & FMODE_NONOTIFY)) {
250 248 fsnotify_parent(file, NULL, mask);
251 fsnotify_parent(dentry, mask); 249 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
252 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); 250 }
253} 251}
254 252
255/* 253/*
@@ -263,9 +261,7 @@ static inline void fsnotify_xattr(struct dentry *dentry)
263 if (S_ISDIR(inode->i_mode)) 261 if (S_ISDIR(inode->i_mode))
264 mask |= FS_IN_ISDIR; 262 mask |= FS_IN_ISDIR;
265 263
266 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 264 fsnotify_parent(NULL, dentry, mask);
267
268 fsnotify_parent(dentry, mask);
269 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 265 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
270} 266}
271 267
@@ -299,19 +295,18 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
299 if (mask) { 295 if (mask) {
300 if (S_ISDIR(inode->i_mode)) 296 if (S_ISDIR(inode->i_mode))
301 mask |= FS_IN_ISDIR; 297 mask |= FS_IN_ISDIR;
302 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
303 298
304 fsnotify_parent(dentry, mask); 299 fsnotify_parent(NULL, dentry, mask);
305 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 300 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
306 } 301 }
307} 302}
308 303
309#if defined(CONFIG_INOTIFY) || defined(CONFIG_FSNOTIFY) /* notify helpers */ 304#if defined(CONFIG_FSNOTIFY) /* notify helpers */
310 305
311/* 306/*
312 * fsnotify_oldname_init - save off the old filename before we change it 307 * fsnotify_oldname_init - save off the old filename before we change it
313 */ 308 */
314static inline const char *fsnotify_oldname_init(const char *name) 309static inline const unsigned char *fsnotify_oldname_init(const unsigned char *name)
315{ 310{
316 return kstrdup(name, GFP_KERNEL); 311 return kstrdup(name, GFP_KERNEL);
317} 312}
@@ -319,22 +314,22 @@ static inline const char *fsnotify_oldname_init(const char *name)
319/* 314/*
320 * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init 315 * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init
321 */ 316 */
322static inline void fsnotify_oldname_free(const char *old_name) 317static inline void fsnotify_oldname_free(const unsigned char *old_name)
323{ 318{
324 kfree(old_name); 319 kfree(old_name);
325} 320}
326 321
327#else /* CONFIG_INOTIFY || CONFIG_FSNOTIFY */ 322#else /* CONFIG_FSNOTIFY */
328 323
329static inline const char *fsnotify_oldname_init(const char *name) 324static inline const char *fsnotify_oldname_init(const unsigned char *name)
330{ 325{
331 return NULL; 326 return NULL;
332} 327}
333 328
334static inline void fsnotify_oldname_free(const char *old_name) 329static inline void fsnotify_oldname_free(const unsigned char *old_name)
335{ 330{
336} 331}
337 332
338#endif /* ! CONFIG_INOTIFY */ 333#endif /* CONFIG_FSNOTIFY */
339 334
340#endif /* _LINUX_FS_NOTIFY_H */ 335#endif /* _LINUX_FS_NOTIFY_H */
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 4d6f47b51189..9bbfd7204b04 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -41,6 +41,10 @@
41#define FS_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ 41#define FS_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
42#define FS_IN_IGNORED 0x00008000 /* last inotify event here */ 42#define FS_IN_IGNORED 0x00008000 /* last inotify event here */
43 43
44#define FS_OPEN_PERM 0x00010000 /* open event in an permission hook */
45#define FS_ACCESS_PERM 0x00020000 /* access event in a permissions hook */
46
47#define FS_EXCL_UNLINK 0x04000000 /* do not send events if object is unlinked */
44#define FS_IN_ISDIR 0x40000000 /* event occurred against dir */ 48#define FS_IN_ISDIR 0x40000000 /* event occurred against dir */
45#define FS_IN_ONESHOT 0x80000000 /* only send event once */ 49#define FS_IN_ONESHOT 0x80000000 /* only send event once */
46 50
@@ -58,13 +62,20 @@
58 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\ 62 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\
59 FS_DELETE) 63 FS_DELETE)
60 64
61/* listeners that hard code group numbers near the top */ 65#define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO)
62#define DNOTIFY_GROUP_NUM UINT_MAX 66
63#define INOTIFY_GROUP_NUM (DNOTIFY_GROUP_NUM-1) 67#define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \
68 FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \
69 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \
70 FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \
71 FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \
72 FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \
73 FS_IN_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \
74 FS_DN_MULTISHOT | FS_EVENT_ON_CHILD)
64 75
65struct fsnotify_group; 76struct fsnotify_group;
66struct fsnotify_event; 77struct fsnotify_event;
67struct fsnotify_mark_entry; 78struct fsnotify_mark;
68struct fsnotify_event_private_data; 79struct fsnotify_event_private_data;
69 80
70/* 81/*
@@ -80,10 +91,16 @@ struct fsnotify_event_private_data;
80 * valid group and inode to use to clean up. 91 * valid group and inode to use to clean up.
81 */ 92 */
82struct fsnotify_ops { 93struct fsnotify_ops {
83 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode, __u32 mask); 94 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode,
84 int (*handle_event)(struct fsnotify_group *group, struct fsnotify_event *event); 95 struct fsnotify_mark *inode_mark,
96 struct fsnotify_mark *vfsmount_mark,
97 __u32 mask, void *data, int data_type);
98 int (*handle_event)(struct fsnotify_group *group,
99 struct fsnotify_mark *inode_mark,
100 struct fsnotify_mark *vfsmount_mark,
101 struct fsnotify_event *event);
85 void (*free_group_priv)(struct fsnotify_group *group); 102 void (*free_group_priv)(struct fsnotify_group *group);
86 void (*freeing_mark)(struct fsnotify_mark_entry *entry, struct fsnotify_group *group); 103 void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);
87 void (*free_event_priv)(struct fsnotify_event_private_data *priv); 104 void (*free_event_priv)(struct fsnotify_event_private_data *priv);
88}; 105};
89 106
@@ -95,22 +112,6 @@ struct fsnotify_ops {
95 */ 112 */
96struct fsnotify_group { 113struct fsnotify_group {
97 /* 114 /*
98 * global list of all groups receiving events from fsnotify.
99 * anchored by fsnotify_groups and protected by either fsnotify_grp_mutex
100 * or fsnotify_grp_srcu depending on write vs read.
101 */
102 struct list_head group_list;
103
104 /*
105 * Defines all of the event types in which this group is interested.
106 * This mask is a bitwise OR of the FS_* events from above. Each time
107 * this mask changes for a group (if it changes) the correct functions
108 * must be called to update the global structures which indicate global
109 * interest in event types.
110 */
111 __u32 mask;
112
113 /*
114 * How the refcnt is used is up to each group. When the refcnt hits 0 115 * How the refcnt is used is up to each group. When the refcnt hits 0
115 * fsnotify will clean up all of the resources associated with this group. 116 * fsnotify will clean up all of the resources associated with this group.
116 * As an example, the dnotify group will always have a refcnt=1 and that 117 * As an example, the dnotify group will always have a refcnt=1 and that
@@ -119,7 +120,6 @@ struct fsnotify_group {
119 * closed. 120 * closed.
120 */ 121 */
121 atomic_t refcnt; /* things with interest in this group */ 122 atomic_t refcnt; /* things with interest in this group */
122 unsigned int group_num; /* simply prevents accidental group collision */
123 123
124 const struct fsnotify_ops *ops; /* how this group handles things */ 124 const struct fsnotify_ops *ops; /* how this group handles things */
125 125
@@ -130,15 +130,12 @@ struct fsnotify_group {
130 unsigned int q_len; /* events on the queue */ 130 unsigned int q_len; /* events on the queue */
131 unsigned int max_events; /* maximum events allowed on the list */ 131 unsigned int max_events; /* maximum events allowed on the list */
132 132
133 /* stores all fastapth entries assoc with this group so they can be cleaned on unregister */ 133 /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */
134 spinlock_t mark_lock; /* protect mark_entries list */ 134 spinlock_t mark_lock; /* protect marks_list */
135 atomic_t num_marks; /* 1 for each mark entry and 1 for not being 135 atomic_t num_marks; /* 1 for each mark and 1 for not being
136 * past the point of no return when freeing 136 * past the point of no return when freeing
137 * a group */ 137 * a group */
138 struct list_head mark_entries; /* all inode mark entries for this group */ 138 struct list_head marks_list; /* all inode marks for this group */
139
140 /* prevents double list_del of group_list. protected by global fsnotify_grp_mutex */
141 bool on_group_list;
142 139
143 /* groups can define private fields here or use the void *private */ 140 /* groups can define private fields here or use the void *private */
144 union { 141 union {
@@ -152,6 +149,17 @@ struct fsnotify_group {
152 struct user_struct *user; 149 struct user_struct *user;
153 } inotify_data; 150 } inotify_data;
154#endif 151#endif
152#ifdef CONFIG_FANOTIFY
153 struct fanotify_group_private_data {
154#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
155 /* allows a group to block waiting for a userspace response */
156 struct mutex access_mutex;
157 struct list_head access_list;
158 wait_queue_head_t access_waitq;
159#endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */
160 int f_flags;
161 } fanotify_data;
162#endif /* CONFIG_FANOTIFY */
155 }; 163 };
156}; 164};
157 165
@@ -195,35 +203,57 @@ struct fsnotify_event {
195 /* to_tell may ONLY be dereferenced during handle_event(). */ 203 /* to_tell may ONLY be dereferenced during handle_event(). */
196 struct inode *to_tell; /* either the inode the event happened to or its parent */ 204 struct inode *to_tell; /* either the inode the event happened to or its parent */
197 /* 205 /*
198 * depending on the event type we should have either a path or inode 206 * depending on the event type we should have either a file or inode
199 * We hold a reference on path, but NOT on inode. Since we have the ref on 207 * We hold a reference on file, but NOT on inode. Since we have the ref on
200 * the path, it may be dereferenced at any point during this object's 208 * the file, it may be dereferenced at any point during this object's
201 * lifetime. That reference is dropped when this object's refcnt hits 209 * lifetime. That reference is dropped when this object's refcnt hits
202 * 0. If this event contains an inode instead of a path, the inode may 210 * 0. If this event contains an inode instead of a file, the inode may
203 * ONLY be used during handle_event(). 211 * ONLY be used during handle_event().
204 */ 212 */
205 union { 213 union {
206 struct path path; 214 struct file *file;
207 struct inode *inode; 215 struct inode *inode;
208 }; 216 };
209/* when calling fsnotify tell it if the data is a path or inode */ 217/* when calling fsnotify tell it if the data is a path or inode */
210#define FSNOTIFY_EVENT_NONE 0 218#define FSNOTIFY_EVENT_NONE 0
211#define FSNOTIFY_EVENT_PATH 1 219#define FSNOTIFY_EVENT_FILE 1
212#define FSNOTIFY_EVENT_INODE 2 220#define FSNOTIFY_EVENT_INODE 2
213#define FSNOTIFY_EVENT_FILE 3
214 int data_type; /* which of the above union we have */ 221 int data_type; /* which of the above union we have */
215 atomic_t refcnt; /* how many groups still are using/need to send this event */ 222 atomic_t refcnt; /* how many groups still are using/need to send this event */
216 __u32 mask; /* the type of access, bitwise OR for FS_* event types */ 223 __u32 mask; /* the type of access, bitwise OR for FS_* event types */
217 224
218 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */ 225 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */
219 char *file_name; 226 const unsigned char *file_name;
220 size_t name_len; 227 size_t name_len;
228 struct pid *tgid;
229
230#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
231 __u32 response; /* userspace answer to question */
232#endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */
221 233
222 struct list_head private_data_list; /* groups can store private data here */ 234 struct list_head private_data_list; /* groups can store private data here */
223}; 235};
224 236
225/* 237/*
226 * a mark is simply an entry attached to an in core inode which allows an 238 * Inode specific fields in an fsnotify_mark
239 */
240struct fsnotify_inode_mark {
241 struct inode *inode; /* inode this mark is associated with */
242 struct hlist_node i_list; /* list of marks by inode->i_fsnotify_marks */
243 struct list_head free_i_list; /* tmp list used when freeing this mark */
244};
245
246/*
247 * Mount point specific fields in an fsnotify_mark
248 */
249struct fsnotify_vfsmount_mark {
250 struct vfsmount *mnt; /* vfsmount this mark is associated with */
251 struct hlist_node m_list; /* list of marks by inode->i_fsnotify_marks */
252 struct list_head free_m_list; /* tmp list used when freeing this mark */
253};
254
255/*
256 * a mark is simply an object attached to an in core inode which allows an
227 * fsnotify listener to indicate they are either no longer interested in events 257 * fsnotify listener to indicate they are either no longer interested in events
228 * of a type matching mask or only interested in those events. 258 * of a type matching mask or only interested in those events.
229 * 259 *
@@ -232,19 +262,28 @@ struct fsnotify_event {
232 * (such as dnotify) will flush these when the open fd is closed and not at 262 * (such as dnotify) will flush these when the open fd is closed and not at
233 * inode eviction or modification. 263 * inode eviction or modification.
234 */ 264 */
235struct fsnotify_mark_entry { 265struct fsnotify_mark {
236 __u32 mask; /* mask this mark entry is for */ 266 __u32 mask; /* mask this mark is for */
237 /* we hold ref for each i_list and g_list. also one ref for each 'thing' 267 /* we hold ref for each i_list and g_list. also one ref for each 'thing'
238 * in kernel that found and may be using this mark. */ 268 * in kernel that found and may be using this mark. */
239 atomic_t refcnt; /* active things looking at this mark */ 269 atomic_t refcnt; /* active things looking at this mark */
240 struct inode *inode; /* inode this entry is associated with */ 270 struct fsnotify_group *group; /* group this mark is for */
241 struct fsnotify_group *group; /* group this mark entry is for */ 271 struct list_head g_list; /* list of marks by group->i_fsnotify_marks */
242 struct hlist_node i_list; /* list of mark_entries by inode->i_fsnotify_mark_entries */ 272 spinlock_t lock; /* protect group and inode */
243 struct list_head g_list; /* list of mark_entries by group->i_fsnotify_mark_entries */ 273 union {
244 spinlock_t lock; /* protect group, inode, and killme */ 274 struct fsnotify_inode_mark i;
245 struct list_head free_i_list; /* tmp list used when freeing this mark */ 275 struct fsnotify_vfsmount_mark m;
276 };
277 __u32 ignored_mask; /* events types to ignore */
246 struct list_head free_g_list; /* tmp list used when freeing this mark */ 278 struct list_head free_g_list; /* tmp list used when freeing this mark */
247 void (*free_mark)(struct fsnotify_mark_entry *entry); /* called on final put+free */ 279#define FSNOTIFY_MARK_FLAG_INODE 0x01
280#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02
281#define FSNOTIFY_MARK_FLAG_OBJECT_PINNED 0x04
282#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x08
283#define FSNOTIFY_MARK_FLAG_ALIVE 0x10
284 unsigned int flags; /* vfsmount or inode mark? */
285 struct list_head destroy_list;
286 void (*free_mark)(struct fsnotify_mark *mark); /* called on final put+free */
248}; 287};
249 288
250#ifdef CONFIG_FSNOTIFY 289#ifdef CONFIG_FSNOTIFY
@@ -252,10 +291,11 @@ struct fsnotify_mark_entry {
252/* called from the vfs helpers */ 291/* called from the vfs helpers */
253 292
254/* main fsnotify call to send events */ 293/* main fsnotify call to send events */
255extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 294extern int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
256 const char *name, u32 cookie); 295 const unsigned char *name, u32 cookie);
257extern void __fsnotify_parent(struct dentry *dentry, __u32 mask); 296extern void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask);
258extern void __fsnotify_inode_delete(struct inode *inode); 297extern void __fsnotify_inode_delete(struct inode *inode);
298extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
259extern u32 fsnotify_get_cookie(void); 299extern u32 fsnotify_get_cookie(void);
260 300
261static inline int fsnotify_inode_watches_children(struct inode *inode) 301static inline int fsnotify_inode_watches_children(struct inode *inode)
@@ -304,15 +344,9 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode
304 344
305/* called from fsnotify listeners, such as fanotify or dnotify */ 345/* called from fsnotify listeners, such as fanotify or dnotify */
306 346
307/* must call when a group changes its ->mask */
308extern void fsnotify_recalc_global_mask(void);
309/* get a reference to an existing or create a new group */ 347/* get a reference to an existing or create a new group */
310extern struct fsnotify_group *fsnotify_obtain_group(unsigned int group_num, 348extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops);
311 __u32 mask, 349/* drop reference on a group from fsnotify_alloc_group */
312 const struct fsnotify_ops *ops);
313/* run all marks associated with this group and update group->mask */
314extern void fsnotify_recalc_group_mask(struct fsnotify_group *group);
315/* drop reference on a group from fsnotify_obtain_group */
316extern void fsnotify_put_group(struct fsnotify_group *group); 350extern void fsnotify_put_group(struct fsnotify_group *group);
317 351
318/* take a reference to an event */ 352/* take a reference to an event */
@@ -323,8 +357,11 @@ extern struct fsnotify_event_private_data *fsnotify_remove_priv_from_event(struc
323 struct fsnotify_event *event); 357 struct fsnotify_event *event);
324 358
325/* attach the event to the group notification queue */ 359/* attach the event to the group notification queue */
326extern int fsnotify_add_notify_event(struct fsnotify_group *group, struct fsnotify_event *event, 360extern struct fsnotify_event *fsnotify_add_notify_event(struct fsnotify_group *group,
327 struct fsnotify_event_private_data *priv); 361 struct fsnotify_event *event,
362 struct fsnotify_event_private_data *priv,
363 struct fsnotify_event *(*merge)(struct list_head *,
364 struct fsnotify_event *));
328/* true if the group notification queue is empty */ 365/* true if the group notification queue is empty */
329extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); 366extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
330/* return, but do not dequeue the first event on the notification queue */ 367/* return, but do not dequeue the first event on the notification queue */
@@ -334,38 +371,66 @@ extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group
334 371
335/* functions used to manipulate the marks attached to inodes */ 372/* functions used to manipulate the marks attached to inodes */
336 373
374/* run all marks associated with a vfsmount and update mnt->mnt_fsnotify_mask */
375extern void fsnotify_recalc_vfsmount_mask(struct vfsmount *mnt);
337/* run all marks associated with an inode and update inode->i_fsnotify_mask */ 376/* run all marks associated with an inode and update inode->i_fsnotify_mask */
338extern void fsnotify_recalc_inode_mask(struct inode *inode); 377extern void fsnotify_recalc_inode_mask(struct inode *inode);
339extern void fsnotify_init_mark(struct fsnotify_mark_entry *entry, void (*free_mark)(struct fsnotify_mark_entry *entry)); 378extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(struct fsnotify_mark *mark));
340/* find (and take a reference) to a mark associated with group and inode */ 379/* find (and take a reference) to a mark associated with group and inode */
341extern struct fsnotify_mark_entry *fsnotify_find_mark_entry(struct fsnotify_group *group, struct inode *inode); 380extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode);
381/* find (and take a reference) to a mark associated with group and vfsmount */
382extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt);
383/* copy the values from old into new */
384extern void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old);
385/* set the ignored_mask of a mark */
386extern void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask);
387/* set the mask of a mark (might pin the object into memory */
388extern void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask);
342/* attach the mark to both the group and the inode */ 389/* attach the mark to both the group and the inode */
343extern int fsnotify_add_mark(struct fsnotify_mark_entry *entry, struct fsnotify_group *group, struct inode *inode); 390extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
391 struct inode *inode, struct vfsmount *mnt, int allow_dups);
344/* given a mark, flag it to be freed when all references are dropped */ 392/* given a mark, flag it to be freed when all references are dropped */
345extern void fsnotify_destroy_mark_by_entry(struct fsnotify_mark_entry *entry); 393extern void fsnotify_destroy_mark(struct fsnotify_mark *mark);
394/* run all the marks in a group, and clear all of the vfsmount marks */
395extern void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group);
396/* run all the marks in a group, and clear all of the inode marks */
397extern void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group);
398/* run all the marks in a group, and clear all of the marks where mark->flags & flags is true*/
399extern void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, unsigned int flags);
346/* run all the marks in a group, and flag them to be freed */ 400/* run all the marks in a group, and flag them to be freed */
347extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group); 401extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group);
348extern void fsnotify_get_mark(struct fsnotify_mark_entry *entry); 402extern void fsnotify_get_mark(struct fsnotify_mark *mark);
349extern void fsnotify_put_mark(struct fsnotify_mark_entry *entry); 403extern void fsnotify_put_mark(struct fsnotify_mark *mark);
350extern void fsnotify_unmount_inodes(struct list_head *list); 404extern void fsnotify_unmount_inodes(struct list_head *list);
351 405
352/* put here because inotify does some weird stuff when destroying watches */ 406/* put here because inotify does some weird stuff when destroying watches */
353extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask, 407extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
354 void *data, int data_is, const char *name, 408 void *data, int data_is,
409 const unsigned char *name,
355 u32 cookie, gfp_t gfp); 410 u32 cookie, gfp_t gfp);
356 411
412/* fanotify likes to change events after they are on lists... */
413extern struct fsnotify_event *fsnotify_clone_event(struct fsnotify_event *old_event);
414extern int fsnotify_replace_event(struct fsnotify_event_holder *old_holder,
415 struct fsnotify_event *new_event);
416
357#else 417#else
358 418
359static inline void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 419static inline int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
360 const char *name, u32 cookie) 420 const unsigned char *name, u32 cookie)
361{} 421{
422 return 0;
423}
362 424
363static inline void __fsnotify_parent(struct dentry *dentry, __u32 mask) 425static inline void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask)
364{} 426{}
365 427
366static inline void __fsnotify_inode_delete(struct inode *inode) 428static inline void __fsnotify_inode_delete(struct inode *inode)
367{} 429{}
368 430
431static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt)
432{}
433
369static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) 434static inline void __fsnotify_update_dcache_flags(struct dentry *dentry)
370{} 435{}
371 436
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index cd0b3f30f48e..ce73a30113b4 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -17,6 +17,8 @@ struct gpio_keys_platform_data {
17 struct gpio_keys_button *buttons; 17 struct gpio_keys_button *buttons;
18 int nbuttons; 18 int nbuttons;
19 unsigned int rep:1; /* enable input subsystem auto repeat */ 19 unsigned int rep:1; /* enable input subsystem auto repeat */
20 int (*enable)(struct device *dev);
21 void (*disable)(struct device *dev);
20}; 22};
21 23
22#endif 24#endif
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 21067b418536..38dd4025aa4e 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -108,6 +108,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
108 * @shutdown: Callback for device shutdown 108 * @shutdown: Callback for device shutdown
109 * @suspend: Callback for device suspend 109 * @suspend: Callback for device suspend
110 * @resume: Callback for device resume 110 * @resume: Callback for device resume
111 * @alert: Alert callback, for example for the SMBus alert protocol
111 * @command: Callback for bus-wide signaling (optional) 112 * @command: Callback for bus-wide signaling (optional)
112 * @driver: Device driver model driver 113 * @driver: Device driver model driver
113 * @id_table: List of I2C devices supported by this driver 114 * @id_table: List of I2C devices supported by this driver
@@ -233,6 +234,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
233 * @addr: stored in i2c_client.addr 234 * @addr: stored in i2c_client.addr
234 * @platform_data: stored in i2c_client.dev.platform_data 235 * @platform_data: stored in i2c_client.dev.platform_data
235 * @archdata: copied into i2c_client.dev.archdata 236 * @archdata: copied into i2c_client.dev.archdata
237 * @of_node: pointer to OpenFirmware device node
236 * @irq: stored in i2c_client.irq 238 * @irq: stored in i2c_client.irq
237 * 239 *
238 * I2C doesn't actually support hardware probing, although controllers and 240 * I2C doesn't actually support hardware probing, although controllers and
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 37ea2894b3c0..d33041e2a42a 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -51,6 +51,7 @@ struct inotify_event {
51/* special flags */ 51/* special flags */
52#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */ 52#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */
53#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */ 53#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */
54#define IN_EXCL_UNLINK 0x04000000 /* exclude events on unlinked objects */
54#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */ 55#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */
55#define IN_ISDIR 0x40000000 /* event occurred against dir */ 56#define IN_ISDIR 0x40000000 /* event occurred against dir */
56#define IN_ONESHOT 0x80000000 /* only send event once */ 57#define IN_ONESHOT 0x80000000 /* only send event once */
@@ -70,177 +71,17 @@ struct inotify_event {
70#define IN_NONBLOCK O_NONBLOCK 71#define IN_NONBLOCK O_NONBLOCK
71 72
72#ifdef __KERNEL__ 73#ifdef __KERNEL__
73 74#include <linux/sysctl.h>
74#include <linux/dcache.h> 75extern struct ctl_table inotify_table[]; /* for sysctl */
75#include <linux/fs.h> 76
76 77#define ALL_INOTIFY_BITS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
77/* 78 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
78 * struct inotify_watch - represents a watch request on a specific inode 79 IN_MOVED_TO | IN_CREATE | IN_DELETE | \
79 * 80 IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | \
80 * h_list is protected by ih->mutex of the associated inotify_handle. 81 IN_Q_OVERFLOW | IN_IGNORED | IN_ONLYDIR | \
81 * i_list, mask are protected by inode->inotify_mutex of the associated inode. 82 IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | \
82 * ih, inode, and wd are never written to once the watch is created. 83 IN_ISDIR | IN_ONESHOT)
83 * 84
84 * Callers must use the established inotify interfaces to access inotify_watch 85#endif
85 * contents. The content of this structure is private to the inotify
86 * implementation.
87 */
88struct inotify_watch {
89 struct list_head h_list; /* entry in inotify_handle's list */
90 struct list_head i_list; /* entry in inode's list */
91 atomic_t count; /* reference count */
92 struct inotify_handle *ih; /* associated inotify handle */
93 struct inode *inode; /* associated inode */
94 __s32 wd; /* watch descriptor */
95 __u32 mask; /* event mask for this watch */
96};
97
98struct inotify_operations {
99 void (*handle_event)(struct inotify_watch *, u32, u32, u32,
100 const char *, struct inode *);
101 void (*destroy_watch)(struct inotify_watch *);
102};
103
104#ifdef CONFIG_INOTIFY
105
106/* Kernel API for producing events */
107
108extern void inotify_d_instantiate(struct dentry *, struct inode *);
109extern void inotify_d_move(struct dentry *);
110extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
111 const char *, struct inode *);
112extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
113 const char *);
114extern void inotify_unmount_inodes(struct list_head *);
115extern void inotify_inode_is_dead(struct inode *);
116extern u32 inotify_get_cookie(void);
117
118/* Kernel Consumer API */
119
120extern struct inotify_handle *inotify_init(const struct inotify_operations *);
121extern void inotify_init_watch(struct inotify_watch *);
122extern void inotify_destroy(struct inotify_handle *);
123extern __s32 inotify_find_watch(struct inotify_handle *, struct inode *,
124 struct inotify_watch **);
125extern __s32 inotify_find_update_watch(struct inotify_handle *, struct inode *,
126 u32);
127extern __s32 inotify_add_watch(struct inotify_handle *, struct inotify_watch *,
128 struct inode *, __u32);
129extern __s32 inotify_clone_watch(struct inotify_watch *, struct inotify_watch *);
130extern void inotify_evict_watch(struct inotify_watch *);
131extern int inotify_rm_watch(struct inotify_handle *, struct inotify_watch *);
132extern int inotify_rm_wd(struct inotify_handle *, __u32);
133extern void inotify_remove_watch_locked(struct inotify_handle *,
134 struct inotify_watch *);
135extern void get_inotify_watch(struct inotify_watch *);
136extern void put_inotify_watch(struct inotify_watch *);
137extern int pin_inotify_watch(struct inotify_watch *);
138extern void unpin_inotify_watch(struct inotify_watch *);
139
140#else
141
142static inline void inotify_d_instantiate(struct dentry *dentry,
143 struct inode *inode)
144{
145}
146
147static inline void inotify_d_move(struct dentry *dentry)
148{
149}
150
151static inline void inotify_inode_queue_event(struct inode *inode,
152 __u32 mask, __u32 cookie,
153 const char *filename,
154 struct inode *n_inode)
155{
156}
157
158static inline void inotify_dentry_parent_queue_event(struct dentry *dentry,
159 __u32 mask, __u32 cookie,
160 const char *filename)
161{
162}
163
164static inline void inotify_unmount_inodes(struct list_head *list)
165{
166}
167
168static inline void inotify_inode_is_dead(struct inode *inode)
169{
170}
171
172static inline u32 inotify_get_cookie(void)
173{
174 return 0;
175}
176
177static inline struct inotify_handle *inotify_init(const struct inotify_operations *ops)
178{
179 return ERR_PTR(-EOPNOTSUPP);
180}
181
182static inline void inotify_init_watch(struct inotify_watch *watch)
183{
184}
185
186static inline void inotify_destroy(struct inotify_handle *ih)
187{
188}
189
190static inline __s32 inotify_find_watch(struct inotify_handle *ih, struct inode *inode,
191 struct inotify_watch **watchp)
192{
193 return -EOPNOTSUPP;
194}
195
196static inline __s32 inotify_find_update_watch(struct inotify_handle *ih,
197 struct inode *inode, u32 mask)
198{
199 return -EOPNOTSUPP;
200}
201
202static inline __s32 inotify_add_watch(struct inotify_handle *ih,
203 struct inotify_watch *watch,
204 struct inode *inode, __u32 mask)
205{
206 return -EOPNOTSUPP;
207}
208
209static inline int inotify_rm_watch(struct inotify_handle *ih,
210 struct inotify_watch *watch)
211{
212 return -EOPNOTSUPP;
213}
214
215static inline int inotify_rm_wd(struct inotify_handle *ih, __u32 wd)
216{
217 return -EOPNOTSUPP;
218}
219
220static inline void inotify_remove_watch_locked(struct inotify_handle *ih,
221 struct inotify_watch *watch)
222{
223}
224
225static inline void get_inotify_watch(struct inotify_watch *watch)
226{
227}
228
229static inline void put_inotify_watch(struct inotify_watch *watch)
230{
231}
232
233extern inline int pin_inotify_watch(struct inotify_watch *watch)
234{
235 return 0;
236}
237
238extern inline void unpin_inotify_watch(struct inotify_watch *watch)
239{
240}
241
242#endif /* CONFIG_INOTIFY */
243
244#endif /* __KERNEL __ */
245 86
246#endif /* _LINUX_INOTIFY_H */ 87#endif /* _LINUX_INOTIFY_H */
diff --git a/include/linux/input.h b/include/linux/input.h
index 339d043ccb53..896a92227bc4 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -776,6 +776,7 @@ struct input_absinfo {
776#define REP_DELAY 0x00 776#define REP_DELAY 0x00
777#define REP_PERIOD 0x01 777#define REP_PERIOD 0x01
778#define REP_MAX 0x01 778#define REP_MAX 0x01
779#define REP_CNT (REP_MAX+1)
779 780
780/* 781/*
781 * Sounds 782 * Sounds
@@ -1099,21 +1100,18 @@ struct input_mt_slot {
1099 * @repeat_key: stores key code of the last key pressed; used to implement 1100 * @repeat_key: stores key code of the last key pressed; used to implement
1100 * software autorepeat 1101 * software autorepeat
1101 * @timer: timer for software autorepeat 1102 * @timer: timer for software autorepeat
1102 * @abs: current values for reports from absolute axes
1103 * @rep: current values for autorepeat parameters (delay, rate) 1103 * @rep: current values for autorepeat parameters (delay, rate)
1104 * @mt: pointer to array of struct input_mt_slot holding current values 1104 * @mt: pointer to array of struct input_mt_slot holding current values
1105 * of tracked contacts 1105 * of tracked contacts
1106 * @mtsize: number of MT slots the device uses 1106 * @mtsize: number of MT slots the device uses
1107 * @slot: MT slot currently being transmitted 1107 * @slot: MT slot currently being transmitted
1108 * @absinfo: array of &struct absinfo elements holding information
1109 * about absolute axes (current value, min, max, flat, fuzz,
1110 * resolution)
1108 * @key: reflects current state of device's keys/buttons 1111 * @key: reflects current state of device's keys/buttons
1109 * @led: reflects current state of device's LEDs 1112 * @led: reflects current state of device's LEDs
1110 * @snd: reflects current state of sound effects 1113 * @snd: reflects current state of sound effects
1111 * @sw: reflects current state of device's switches 1114 * @sw: reflects current state of device's switches
1112 * @absmax: maximum values for events coming from absolute axes
1113 * @absmin: minimum values for events coming from absolute axes
1114 * @absfuzz: describes noisiness for axes
1115 * @absflat: size of the center flat position (used by joydev)
1116 * @absres: resolution used for events coming form absolute axes
1117 * @open: this method is called when the very first user calls 1115 * @open: this method is called when the very first user calls
1118 * input_open_device(). The driver must prepare the device 1116 * input_open_device(). The driver must prepare the device
1119 * to start generating events (start polling thread, 1117 * to start generating events (start polling thread,
@@ -1180,24 +1178,19 @@ struct input_dev {
1180 unsigned int repeat_key; 1178 unsigned int repeat_key;
1181 struct timer_list timer; 1179 struct timer_list timer;
1182 1180
1183 int abs[ABS_CNT]; 1181 int rep[REP_CNT];
1184 int rep[REP_MAX + 1];
1185 1182
1186 struct input_mt_slot *mt; 1183 struct input_mt_slot *mt;
1187 int mtsize; 1184 int mtsize;
1188 int slot; 1185 int slot;
1189 1186
1187 struct input_absinfo *absinfo;
1188
1190 unsigned long key[BITS_TO_LONGS(KEY_CNT)]; 1189 unsigned long key[BITS_TO_LONGS(KEY_CNT)];
1191 unsigned long led[BITS_TO_LONGS(LED_CNT)]; 1190 unsigned long led[BITS_TO_LONGS(LED_CNT)];
1192 unsigned long snd[BITS_TO_LONGS(SND_CNT)]; 1191 unsigned long snd[BITS_TO_LONGS(SND_CNT)];
1193 unsigned long sw[BITS_TO_LONGS(SW_CNT)]; 1192 unsigned long sw[BITS_TO_LONGS(SW_CNT)];
1194 1193
1195 int absmax[ABS_CNT];
1196 int absmin[ABS_CNT];
1197 int absfuzz[ABS_CNT];
1198 int absflat[ABS_CNT];
1199 int absres[ABS_CNT];
1200
1201 int (*open)(struct input_dev *dev); 1194 int (*open)(struct input_dev *dev);
1202 void (*close)(struct input_dev *dev); 1195 void (*close)(struct input_dev *dev);
1203 int (*flush)(struct input_dev *dev, struct file *file); 1196 int (*flush)(struct input_dev *dev, struct file *file);
@@ -1459,16 +1452,32 @@ static inline void input_set_events_per_packet(struct input_dev *dev, int n_even
1459 dev->hint_events_per_packet = n_events; 1452 dev->hint_events_per_packet = n_events;
1460} 1453}
1461 1454
1462static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1455void input_alloc_absinfo(struct input_dev *dev);
1463{ 1456void input_set_abs_params(struct input_dev *dev, unsigned int axis,
1464 dev->absmin[axis] = min; 1457 int min, int max, int fuzz, int flat);
1465 dev->absmax[axis] = max; 1458
1466 dev->absfuzz[axis] = fuzz; 1459#define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \
1467 dev->absflat[axis] = flat; 1460static inline int input_abs_get_##_suffix(struct input_dev *dev, \
1468 1461 unsigned int axis) \
1469 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); 1462{ \
1463 return dev->absinfo ? dev->absinfo[axis]._item : 0; \
1464} \
1465 \
1466static inline void input_abs_set_##_suffix(struct input_dev *dev, \
1467 unsigned int axis, int val) \
1468{ \
1469 input_alloc_absinfo(dev); \
1470 if (dev->absinfo) \
1471 dev->absinfo[axis]._item = val; \
1470} 1472}
1471 1473
1474INPUT_GENERATE_ABS_ACCESSORS(val, value)
1475INPUT_GENERATE_ABS_ACCESSORS(min, minimum)
1476INPUT_GENERATE_ABS_ACCESSORS(max, maximum)
1477INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz)
1478INPUT_GENERATE_ABS_ACCESSORS(flat, flat)
1479INPUT_GENERATE_ABS_ACCESSORS(res, resolution)
1480
1472int input_get_keycode(struct input_dev *dev, 1481int input_get_keycode(struct input_dev *dev,
1473 unsigned int scancode, unsigned int *keycode); 1482 unsigned int scancode, unsigned int *keycode);
1474int input_set_keycode(struct input_dev *dev, 1483int input_set_keycode(struct input_dev *dev,
diff --git a/include/linux/istallion.h b/include/linux/istallion.h
index 7faca98c7d14..ad700a60c158 100644
--- a/include/linux/istallion.h
+++ b/include/linux/istallion.h
@@ -86,7 +86,7 @@ struct stlibrd {
86 unsigned long magic; 86 unsigned long magic;
87 unsigned int brdnr; 87 unsigned int brdnr;
88 unsigned int brdtype; 88 unsigned int brdtype;
89 unsigned int state; 89 unsigned long state;
90 unsigned int nrpanels; 90 unsigned int nrpanels;
91 unsigned int nrports; 91 unsigned int nrports;
92 unsigned int nrdevs; 92 unsigned int nrdevs;
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index edb9231f1898..a18b719f49d4 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * JFFS2 -- Journalling Flash File System, Version 2. 2 * JFFS2 -- Journalling Flash File System, Version 2.
3 * 3 *
4 * Copyright (C) 2001-2003 Red Hat, Inc. 4 * Copyright © 2001-2007 Red Hat, Inc.
5 * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
5 * 6 *
6 * Created by David Woodhouse <dwmw2@infradead.org> 7 * Created by David Woodhouse <dwmw2@infradead.org>
7 * 8 *
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h
index a09b84e4fdb4..54cbbac1e71d 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -4,9 +4,6 @@
4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
5*/ 5*/
6 6
7/* Hardwire the number of additional indexes */
8#define MB_CACHE_INDEXES_COUNT 1
9
10struct mb_cache_entry { 7struct mb_cache_entry {
11 struct list_head e_lru_list; 8 struct list_head e_lru_list;
12 struct mb_cache *e_cache; 9 struct mb_cache *e_cache;
@@ -18,17 +15,12 @@ struct mb_cache_entry {
18 struct { 15 struct {
19 struct list_head o_list; 16 struct list_head o_list;
20 unsigned int o_key; 17 unsigned int o_key;
21 } e_indexes[0]; 18 } e_index;
22};
23
24struct mb_cache_op {
25 int (*free)(struct mb_cache_entry *, gfp_t);
26}; 19};
27 20
28/* Functions on caches */ 21/* Functions on caches */
29 22
30struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t, 23struct mb_cache *mb_cache_create(const char *, int);
31 int, int);
32void mb_cache_shrink(struct block_device *); 24void mb_cache_shrink(struct block_device *);
33void mb_cache_destroy(struct mb_cache *); 25void mb_cache_destroy(struct mb_cache *);
34 26
@@ -36,17 +28,15 @@ void mb_cache_destroy(struct mb_cache *);
36 28
37struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *, gfp_t); 29struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *, gfp_t);
38int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *, 30int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *,
39 sector_t, unsigned int[]); 31 sector_t, unsigned int);
40void mb_cache_entry_release(struct mb_cache_entry *); 32void mb_cache_entry_release(struct mb_cache_entry *);
41void mb_cache_entry_free(struct mb_cache_entry *); 33void mb_cache_entry_free(struct mb_cache_entry *);
42struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *, 34struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *,
43 struct block_device *, 35 struct block_device *,
44 sector_t); 36 sector_t);
45#if !defined(MB_CACHE_INDEXES_COUNT) || (MB_CACHE_INDEXES_COUNT > 0) 37struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache,
46struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache, int,
47 struct block_device *, 38 struct block_device *,
48 unsigned int); 39 unsigned int);
49struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache_entry *, int, 40struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache_entry *,
50 struct block_device *, 41 struct block_device *,
51 unsigned int); 42 unsigned int);
52#endif
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7a9ab7db1975..709f6728fc90 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -815,6 +815,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
815} 815}
816 816
817extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); 817extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
818extern void truncate_setsize(struct inode *inode, loff_t newsize);
818extern int vmtruncate(struct inode *inode, loff_t offset); 819extern int vmtruncate(struct inode *inode, loff_t offset);
819extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end); 820extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end);
820 821
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 4bd05474d11d..907210bd9f9c 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -56,7 +56,11 @@ struct vfsmount {
56 struct list_head mnt_mounts; /* list of children, anchored here */ 56 struct list_head mnt_mounts; /* list of children, anchored here */
57 struct list_head mnt_child; /* and going through their mnt_child */ 57 struct list_head mnt_child; /* and going through their mnt_child */
58 int mnt_flags; 58 int mnt_flags;
59 /* 4 bytes hole on 64bits arches */ 59 /* 4 bytes hole on 64bits arches without fsnotify */
60#ifdef CONFIG_FSNOTIFY
61 __u32 mnt_fsnotify_mask;
62 struct hlist_head mnt_fsnotify_marks;
63#endif
60 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ 64 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
61 struct list_head mnt_list; 65 struct list_head mnt_list;
62 struct list_head mnt_expire; /* link in fs-specific expiry list */ 66 struct list_head mnt_expire; /* link in fs-specific expiry list */
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 9c3757c5759d..7fa20beb2ab9 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -4,12 +4,26 @@
4 * NAND family Bad Block Management (BBM) header file 4 * NAND family Bad Block Management (BBM) header file
5 * - Bad Block Table (BBT) implementation 5 * - Bad Block Table (BBT) implementation
6 * 6 *
7 * Copyright (c) 2005 Samsung Electronics 7 * Copyright © 2005 Samsung Electronics
8 * Kyungmin Park <kyungmin.park@samsung.com> 8 * Kyungmin Park <kyungmin.park@samsung.com>
9 * 9 *
10 * Copyright (c) 2000-2005 10 * Copyright © 2000-2005
11 * Thomas Gleixner <tglx@linuxtronix.de> 11 * Thomas Gleixner <tglx@linuxtronix.de>
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 *
13 */ 27 */
14#ifndef __LINUX_MTD_BBM_H 28#ifndef __LINUX_MTD_BBM_H
15#define __LINUX_MTD_BBM_H 29#define __LINUX_MTD_BBM_H
@@ -82,6 +96,12 @@ struct nand_bbt_descr {
82#define NAND_BBT_SAVECONTENT 0x00002000 96#define NAND_BBT_SAVECONTENT 0x00002000
83/* Search good / bad pattern on the first and the second page */ 97/* Search good / bad pattern on the first and the second page */
84#define NAND_BBT_SCAN2NDPAGE 0x00004000 98#define NAND_BBT_SCAN2NDPAGE 0x00004000
99/* Search good / bad pattern on the last page of the eraseblock */
100#define NAND_BBT_SCANLASTPAGE 0x00008000
101/* Chip stores bad block marker on BOTH 1st and 6th bytes of OOB */
102#define NAND_BBT_SCANBYTE1AND6 0x00100000
103/* The nand_bbt_descr was created dynamicaly and must be freed */
104#define NAND_BBT_DYNAMICSTRUCT 0x00200000
85 105
86/* The maximum number of blocks to scan for a bbt */ 106/* The maximum number of blocks to scan for a bbt */
87#define NAND_BBT_SCAN_MAXBLOCKS 4 107#define NAND_BBT_SCAN_MAXBLOCKS 4
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index b481ccd7ff3c..26529ebd59cc 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -1,7 +1,19 @@
1/* 1/*
2 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 2 * Copyright © 2003-2010 David Woodhouse <dwmw2@infradead.org>
3 * 3 *
4 * Interface to Linux block layer for MTD 'translation layers'. 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; either version 2 of the License, or
7 * (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
5 * 17 *
6 */ 18 */
7 19
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 574d9ee066f1..d2118b0eac9a 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -1,6 +1,20 @@
1 1/*
2/* Common Flash Interface structures 2 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 * See http://support.intel.com/design/flash/technote/index.htm 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; either version 2 of the License, or
7 * (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
4 */ 18 */
5 19
6#ifndef __MTD_CFI_H__ 20#ifndef __MTD_CFI_H__
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h
index d802f7736be3..51cc3f5917a8 100644
--- a/include/linux/mtd/cfi_endian.h
+++ b/include/linux/mtd/cfi_endian.h
@@ -1,3 +1,22 @@
1/*
2 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
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; either version 2 of the License, or
7 * (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
19
1#include <asm/byteorder.h> 20#include <asm/byteorder.h>
2 21
3#ifndef CONFIG_MTD_CFI_ADV_OPTIONS 22#ifndef CONFIG_MTD_CFI_ADV_OPTIONS
diff --git a/include/linux/mtd/compatmac.h b/include/linux/mtd/compatmac.h
deleted file mode 100644
index 7d1300d9bd51..000000000000
--- a/include/linux/mtd/compatmac.h
+++ /dev/null
@@ -1,10 +0,0 @@
1
2#ifndef __LINUX_MTD_COMPATMAC_H__
3#define __LINUX_MTD_COMPATMAC_H__
4
5/* Nothing to see here. We write 2.5-compatible code and this
6 file makes it all OK in older kernels, but it's empty in _current_
7 kernels. Include guard just to make GCC ignore it in future inclusions
8 anyway... */
9
10#endif /* __LINUX_MTD_COMPATMAC_H__ */
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h
index e80c674daeb3..ccdbe93a909c 100644
--- a/include/linux/mtd/concat.h
+++ b/include/linux/mtd/concat.h
@@ -1,9 +1,22 @@
1/* 1/*
2 * MTD device concatenation layer definitions 2 * MTD device concatenation layer definitions
3 * 3 *
4 * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> 4 * Copyright © 2002 Robert Kaiser <rkaiser@sysgo.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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
5 * 19 *
6 * This code is GPL
7 */ 20 */
8 21
9#ifndef MTD_CONCAT_H 22#ifndef MTD_CONCAT_H
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 0a6d516ab71d..0f6fea73a1f6 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -1,12 +1,25 @@
1/* 1/*
2 * Linux driver for Disk-On-Chip devices 2 * Linux driver for Disk-On-Chip devices
3 * 3 *
4 * Copyright (C) 1999 Machine Vision Holdings, Inc. 4 * Copyright © 1999 Machine Vision Holdings, Inc.
5 * Copyright (C) 2001-2003 David Woodhouse <dwmw2@infradead.org> 5 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
6 * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> 6 * Copyright © 2002-2003 Greg Ungerer <gerg@snapgear.com>
7 * Copyright (C) 2002-2003 SnapGear Inc 7 * Copyright © 2002-2003 SnapGear Inc
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
8 * 22 *
9 * Released under GPL
10 */ 23 */
11 24
12#ifndef __MTD_DOC2000_H__ 25#ifndef __MTD_DOC2000_H__
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index f43e9b49b751..b63fa457febd 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -1,10 +1,21 @@
1
2/* 1/*
3 * struct flchip definition 2 * Copyright © 2000 Red Hat UK Limited
3 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
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 as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
4 * 14 *
5 * Contains information about the location and state of a given flash device 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6 * 18 *
7 * (C) 2000 Red Hat. GPLd.
8 */ 19 */
9 20
10#ifndef __MTD_FLASHCHIP_H__ 21#ifndef __MTD_FLASHCHIP_H__
@@ -92,7 +103,7 @@ struct flchip {
92/* This is used to handle contention on write/erase operations 103/* This is used to handle contention on write/erase operations
93 between partitions of the same physical chip. */ 104 between partitions of the same physical chip. */
94struct flchip_shared { 105struct flchip_shared {
95 spinlock_t lock; 106 struct mutex lock;
96 struct flchip *writing; 107 struct flchip *writing;
97 struct flchip *erasing; 108 struct flchip *erasing;
98}; 109};
diff --git a/include/linux/mtd/gen_probe.h b/include/linux/mtd/gen_probe.h
index df362ddf2949..2c456054fded 100644
--- a/include/linux/mtd/gen_probe.h
+++ b/include/linux/mtd/gen_probe.h
@@ -1,6 +1,21 @@
1/* 1/*
2 * (C) 2001, 2001 Red Hat, Inc. 2 * Copyright © 2001 Red Hat UK Limited
3 * GPL'd 3 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
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 as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
4 */ 19 */
5 20
6#ifndef __LINUX_MTD_GEN_PROBE_H__ 21#ifndef __LINUX_MTD_GEN_PROBE_H__
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index de89eca864ce..a9e6ba46865e 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -1,3 +1,21 @@
1/*
2 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> et al.
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; either version 2 of the License, or
7 * (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
1 19
2/* Overhauled routines for dealing with different mmap regions of flash */ 20/* Overhauled routines for dealing with different mmap regions of flash */
3 21
@@ -9,7 +27,6 @@
9#include <linux/string.h> 27#include <linux/string.h>
10#include <linux/bug.h> 28#include <linux/bug.h>
11 29
12#include <linux/mtd/compatmac.h>
13 30
14#include <asm/unaligned.h> 31#include <asm/unaligned.h>
15#include <asm/system.h> 32#include <asm/system.h>
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 5326435a7571..8485e42a9b09 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -1,7 +1,20 @@
1/* 1/*
2 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
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; either version 2 of the License, or
7 * (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3 * 17 *
4 * Released under GPL
5 */ 18 */
6 19
7#ifndef __MTD_MTD_H__ 20#ifndef __MTD_MTD_H__
@@ -13,7 +26,6 @@
13#include <linux/notifier.h> 26#include <linux/notifier.h>
14#include <linux/device.h> 27#include <linux/device.h>
15 28
16#include <linux/mtd/compatmac.h>
17#include <mtd/mtd-abi.h> 29#include <mtd/mtd-abi.h>
18 30
19#include <asm/div64.h> 31#include <asm/div64.h>
@@ -216,6 +228,7 @@ struct mtd_info {
216 /* Chip-supported device locking */ 228 /* Chip-supported device locking */
217 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 229 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
218 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 230 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
231 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
219 232
220 /* Power Management functions */ 233 /* Power Management functions */
221 int (*suspend) (struct mtd_info *mtd); 234 int (*suspend) (struct mtd_info *mtd);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index a81b185e23a7..102e12c58cb3 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -1,9 +1,9 @@
1/* 1/*
2 * linux/include/linux/mtd/nand.h 2 * linux/include/linux/mtd/nand.h
3 * 3 *
4 * Copyright (c) 2000 David Woodhouse <dwmw2@infradead.org> 4 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
5 * Steven J. Hill <sjhill@realitydiluted.com> 5 * Steven J. Hill <sjhill@realitydiluted.com>
6 * Thomas Gleixner <tglx@linutronix.de> 6 * Thomas Gleixner <tglx@linutronix.de>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -181,8 +181,6 @@ typedef enum {
181#define NAND_NO_READRDY 0x00000100 181#define NAND_NO_READRDY 0x00000100
182/* Chip does not allow subpage writes */ 182/* Chip does not allow subpage writes */
183#define NAND_NO_SUBPAGE_WRITE 0x00000200 183#define NAND_NO_SUBPAGE_WRITE 0x00000200
184/* Chip stores bad block marker on the last page of the eraseblock */
185#define NAND_BB_LAST_PAGE 0x00000400
186 184
187/* Device is one of 'new' xD cards that expose fake nand command set */ 185/* Device is one of 'new' xD cards that expose fake nand command set */
188#define NAND_BROKEN_XD 0x00000400 186#define NAND_BROKEN_XD 0x00000400
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 41bc013571d0..4d8406c81652 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -1,7 +1,9 @@
1/* 1/*
2 * drivers/mtd/nand_ecc.h 2 * drivers/mtd/nand_ecc.h
3 * 3 *
4 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 4 * Copyright (C) 2000-2010 Steven J. Hill <sjhill@realitydiluted.com>
5 * David Woodhouse <dwmw2@infradead.org>
6 * Thomas Gleixner <tglx@linutronix.de>
5 * 7 *
6 * This program is free software; you can redistribute it and/or modify 8 * 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 9 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index dcaf611ed748..b059629e22bc 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -1,5 +1,20 @@
1/* 1/*
2 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
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; either version 2 of the License, or
7 * (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
3 */ 18 */
4 19
5#ifndef __MTD_NFTL_H__ 20#ifndef __MTD_NFTL_H__
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index c26ff86ad08a..0c8815bfae1c 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -68,6 +68,7 @@ struct onenand_bufferram {
68 * @write_word: [REPLACEABLE] hardware specific function for write 68 * @write_word: [REPLACEABLE] hardware specific function for write
69 * register of OneNAND 69 * register of OneNAND
70 * @mmcontrol: sync burst read function 70 * @mmcontrol: sync burst read function
71 * @chip_probe: [REPLACEABLE] hardware specific function for chip probe
71 * @block_markbad: function to mark a block as bad 72 * @block_markbad: function to mark a block as bad
72 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning 73 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning
73 * Bad block Table 74 * Bad block Table
@@ -114,6 +115,7 @@ struct onenand_chip {
114 unsigned short (*read_word)(void __iomem *addr); 115 unsigned short (*read_word)(void __iomem *addr);
115 void (*write_word)(unsigned short value, void __iomem *addr); 116 void (*write_word)(unsigned short value, void __iomem *addr);
116 void (*mmcontrol)(struct mtd_info *mtd, int sync_read); 117 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
118 int (*chip_probe)(struct mtd_info *mtd);
117 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 119 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
118 int (*scan_bbt)(struct mtd_info *mtd); 120 int (*scan_bbt)(struct mtd_info *mtd);
119 121
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 76f7cabf07d3..bcfd9f777454 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -25,6 +25,7 @@ struct physmap_flash_data {
25 void (*set_vpp)(struct map_info *, int); 25 void (*set_vpp)(struct map_info *, int);
26 unsigned int nr_parts; 26 unsigned int nr_parts;
27 unsigned int pfow_base; 27 unsigned int pfow_base;
28 char *probe_type;
28 struct mtd_partition *parts; 29 struct mtd_partition *parts;
29}; 30};
30 31
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c81eec4d3c35..f6a3b2d36cad 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2372,6 +2372,9 @@
2372#define PCI_VENDOR_ID_AKS 0x416c 2372#define PCI_VENDOR_ID_AKS 0x416c
2373#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 2373#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100
2374 2374
2375#define PCI_VENDOR_ID_ACCESSIO 0x494f
2376#define PCI_DEVICE_ID_ACCESSIO_WDG_CSM 0x22c0
2377
2375#define PCI_VENDOR_ID_S3 0x5333 2378#define PCI_VENDOR_ID_S3 0x5333
2376#define PCI_DEVICE_ID_S3_TRIO 0x8811 2379#define PCI_DEVICE_ID_S3_TRIO 0x8811
2377#define PCI_DEVICE_ID_S3_868 0x8880 2380#define PCI_DEVICE_ID_S3_868 0x8880
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 4f71bf4e628c..3e23844a6990 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -117,6 +117,6 @@ void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
117 117
118long clock_nanosleep_restart(struct restart_block *restart_block); 118long clock_nanosleep_restart(struct restart_block *restart_block);
119 119
120void update_rlimit_cpu(unsigned long rlim_new); 120void update_rlimit_cpu(struct task_struct *task, unsigned long rlim_new);
121 121
122#endif 122#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index ba394163dea1..91a4177e60ce 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2033,7 +2033,7 @@ void reiserfs_read_locked_inode(struct inode *inode,
2033 struct reiserfs_iget_args *args); 2033 struct reiserfs_iget_args *args);
2034int reiserfs_find_actor(struct inode *inode, void *p); 2034int reiserfs_find_actor(struct inode *inode, void *p);
2035int reiserfs_init_locked_inode(struct inode *inode, void *p); 2035int reiserfs_init_locked_inode(struct inode *inode, void *p);
2036void reiserfs_delete_inode(struct inode *inode); 2036void reiserfs_evict_inode(struct inode *inode);
2037int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc); 2037int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc);
2038int reiserfs_get_block(struct inode *inode, sector_t block, 2038int reiserfs_get_block(struct inode *inode, sector_t block,
2039 struct buffer_head *bh_result, int create); 2039 struct buffer_head *bh_result, int create);
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index 89f4d3abbf5a..97959bdfe214 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -25,7 +25,6 @@ typedef enum {
25 i_link_saved_truncate_mask = 0x0020, 25 i_link_saved_truncate_mask = 0x0020,
26 i_has_xattr_dir = 0x0040, 26 i_has_xattr_dir = 0x0040,
27 i_data_log = 0x0080, 27 i_data_log = 0x0080,
28 i_ever_mapped = 0x0100
29} reiserfs_inode_flags; 28} reiserfs_inode_flags;
30 29
31struct reiserfs_inode_info { 30struct reiserfs_inode_info {
@@ -53,7 +52,8 @@ struct reiserfs_inode_info {
53 ** flushed */ 52 ** flushed */
54 unsigned int i_trans_id; 53 unsigned int i_trans_id;
55 struct reiserfs_journal_list *i_jl; 54 struct reiserfs_journal_list *i_jl;
56 struct mutex i_mmap; 55 atomic_t openers;
56 struct mutex tailpack;
57#ifdef CONFIG_REISERFS_FS_XATTR 57#ifdef CONFIG_REISERFS_FS_XATTR
58 struct rw_semaphore i_xattr_sem; 58 struct rw_semaphore i_xattr_sem;
59#endif 59#endif
diff --git a/include/linux/resource.h b/include/linux/resource.h
index f1e914eefeab..88d36f9145ba 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -43,6 +43,13 @@ struct rlimit {
43 unsigned long rlim_max; 43 unsigned long rlim_max;
44}; 44};
45 45
46#define RLIM64_INFINITY (~0ULL)
47
48struct rlimit64 {
49 __u64 rlim_cur;
50 __u64 rlim_max;
51};
52
46#define PRIO_MIN (-20) 53#define PRIO_MIN (-20)
47#define PRIO_MAX 20 54#define PRIO_MAX 20
48 55
@@ -73,6 +80,8 @@ struct rlimit {
73struct task_struct; 80struct task_struct;
74 81
75int getrusage(struct task_struct *p, int who, struct rusage __user *ru); 82int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
83int do_prlimit(struct task_struct *tsk, unsigned int resource,
84 struct rlimit *new_rlim, struct rlimit *old_rlim);
76 85
77#endif /* __KERNEL__ */ 86#endif /* __KERNEL__ */
78 87
diff --git a/include/linux/security.h b/include/linux/security.h
index 723a93df756a..a22219afff09 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -23,6 +23,7 @@
23#define __LINUX_SECURITY_H 23#define __LINUX_SECURITY_H
24 24
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/fsnotify.h>
26#include <linux/binfmts.h> 27#include <linux/binfmts.h>
27#include <linux/signal.h> 28#include <linux/signal.h>
28#include <linux/resource.h> 29#include <linux/resource.h>
@@ -1498,7 +1499,8 @@ struct security_operations {
1498 int (*task_setnice) (struct task_struct *p, int nice); 1499 int (*task_setnice) (struct task_struct *p, int nice);
1499 int (*task_setioprio) (struct task_struct *p, int ioprio); 1500 int (*task_setioprio) (struct task_struct *p, int ioprio);
1500 int (*task_getioprio) (struct task_struct *p); 1501 int (*task_getioprio) (struct task_struct *p);
1501 int (*task_setrlimit) (unsigned int resource, struct rlimit *new_rlim); 1502 int (*task_setrlimit) (struct task_struct *p, unsigned int resource,
1503 struct rlimit *new_rlim);
1502 int (*task_setscheduler) (struct task_struct *p, int policy, 1504 int (*task_setscheduler) (struct task_struct *p, int policy,
1503 struct sched_param *lp); 1505 struct sched_param *lp);
1504 int (*task_getscheduler) (struct task_struct *p); 1506 int (*task_getscheduler) (struct task_struct *p);
@@ -1748,7 +1750,8 @@ void security_task_getsecid(struct task_struct *p, u32 *secid);
1748int security_task_setnice(struct task_struct *p, int nice); 1750int security_task_setnice(struct task_struct *p, int nice);
1749int security_task_setioprio(struct task_struct *p, int ioprio); 1751int security_task_setioprio(struct task_struct *p, int ioprio);
1750int security_task_getioprio(struct task_struct *p); 1752int security_task_getioprio(struct task_struct *p);
1751int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim); 1753int security_task_setrlimit(struct task_struct *p, unsigned int resource,
1754 struct rlimit *new_rlim);
1752int security_task_setscheduler(struct task_struct *p, 1755int security_task_setscheduler(struct task_struct *p,
1753 int policy, struct sched_param *lp); 1756 int policy, struct sched_param *lp);
1754int security_task_getscheduler(struct task_struct *p); 1757int security_task_getscheduler(struct task_struct *p);
@@ -2310,7 +2313,8 @@ static inline int security_task_getioprio(struct task_struct *p)
2310 return 0; 2313 return 0;
2311} 2314}
2312 2315
2313static inline int security_task_setrlimit(unsigned int resource, 2316static inline int security_task_setrlimit(struct task_struct *p,
2317 unsigned int resource,
2314 struct rlimit *new_rlim) 2318 struct rlimit *new_rlim)
2315{ 2319{
2316 return 0; 2320 return 0;
diff --git a/include/linux/serial.h b/include/linux/serial.h
index c8613c3ff9d3..1ebc694a6d52 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -77,7 +77,8 @@ struct serial_struct {
77#define PORT_16654 11 77#define PORT_16654 11
78#define PORT_16850 12 78#define PORT_16850 12
79#define PORT_RSA 13 /* RSA-DV II/S card */ 79#define PORT_RSA 13 /* RSA-DV II/S card */
80#define PORT_MAX 13 80#define PORT_U6_16550A 14
81#define PORT_MAX 14
81 82
82#define SERIAL_IO_PORT 0 83#define SERIAL_IO_PORT 0
83#define SERIAL_IO_HUB6 1 84#define SERIAL_IO_HUB6 1
@@ -151,7 +152,7 @@ struct serial_uart_config {
151#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART) 152#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)
152#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) 153#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
153 154
154#define ASYNC_FLAGS ((1U << ASYNCB_LAST_USER) - 1) 155#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
155#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \ 156#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \
156 ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY) 157 ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY)
157#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) 158#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
@@ -210,8 +211,10 @@ struct serial_rs485 {
210#define SER_RS485_ENABLED (1 << 0) 211#define SER_RS485_ENABLED (1 << 0)
211#define SER_RS485_RTS_ON_SEND (1 << 1) 212#define SER_RS485_RTS_ON_SEND (1 << 1)
212#define SER_RS485_RTS_AFTER_SEND (1 << 2) 213#define SER_RS485_RTS_AFTER_SEND (1 << 2)
214#define SER_RS485_RTS_BEFORE_SEND (1 << 3)
213 __u32 delay_rts_before_send; /* Milliseconds */ 215 __u32 delay_rts_before_send; /* Milliseconds */
214 __u32 padding[6]; /* Memory is cheap, new structs 216 __u32 delay_rts_after_send; /* Milliseconds */
217 __u32 padding[5]; /* Memory is cheap, new structs
215 are a royal PITA .. */ 218 are a royal PITA .. */
216}; 219};
217 220
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index fb46aba11fb5..7638deaaba65 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -32,6 +32,9 @@ struct plat_serial8250_port {
32 unsigned int type; /* If UPF_FIXED_TYPE */ 32 unsigned int type; /* If UPF_FIXED_TYPE */
33 unsigned int (*serial_in)(struct uart_port *, int); 33 unsigned int (*serial_in)(struct uart_port *, int);
34 void (*serial_out)(struct uart_port *, int, int); 34 void (*serial_out)(struct uart_port *, int, int);
35 void (*set_termios)(struct uart_port *,
36 struct ktermios *new,
37 struct ktermios *old);
35}; 38};
36 39
37/* 40/*
@@ -71,5 +74,7 @@ extern int early_serial_setup(struct uart_port *port);
71extern int serial8250_find_port(struct uart_port *p); 74extern int serial8250_find_port(struct uart_port *p);
72extern int serial8250_find_port_for_earlycon(void); 75extern int serial8250_find_port_for_earlycon(void);
73extern int setup_early_serial8250_console(char *cmdline); 76extern int setup_early_serial8250_console(char *cmdline);
77extern void serial8250_do_set_termios(struct uart_port *port,
78 struct ktermios *termios, struct ktermios *old);
74 79
75#endif 80#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index f10db6e5f3b5..8129ca2d57e3 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -186,6 +186,12 @@
186#define PORT_ALTERA_JTAGUART 91 186#define PORT_ALTERA_JTAGUART 91
187#define PORT_ALTERA_UART 92 187#define PORT_ALTERA_UART 92
188 188
189/* MAX3107 */
190#define PORT_MAX3107 94
191
192/* High Speed UART for Medfield */
193#define PORT_MFD 95
194
189#ifdef __KERNEL__ 195#ifdef __KERNEL__
190 196
191#include <linux/compiler.h> 197#include <linux/compiler.h>
@@ -220,7 +226,7 @@ struct uart_ops {
220 void (*flush_buffer)(struct uart_port *); 226 void (*flush_buffer)(struct uart_port *);
221 void (*set_termios)(struct uart_port *, struct ktermios *new, 227 void (*set_termios)(struct uart_port *, struct ktermios *new,
222 struct ktermios *old); 228 struct ktermios *old);
223 void (*set_ldisc)(struct uart_port *); 229 void (*set_ldisc)(struct uart_port *, int new);
224 void (*pm)(struct uart_port *, unsigned int state, 230 void (*pm)(struct uart_port *, unsigned int state,
225 unsigned int oldstate); 231 unsigned int oldstate);
226 int (*set_wake)(struct uart_port *, unsigned int state); 232 int (*set_wake)(struct uart_port *, unsigned int state);
@@ -276,6 +282,9 @@ struct uart_port {
276 unsigned char __iomem *membase; /* read/write[bwl] */ 282 unsigned char __iomem *membase; /* read/write[bwl] */
277 unsigned int (*serial_in)(struct uart_port *, int); 283 unsigned int (*serial_in)(struct uart_port *, int);
278 void (*serial_out)(struct uart_port *, int, int); 284 void (*serial_out)(struct uart_port *, int, int);
285 void (*set_termios)(struct uart_port *,
286 struct ktermios *new,
287 struct ktermios *old);
279 unsigned int irq; /* irq number */ 288 unsigned int irq; /* irq number */
280 unsigned long irqflags; /* irq flags */ 289 unsigned long irqflags; /* irq flags */
281 unsigned int uartclk; /* base uart clock */ 290 unsigned int uartclk; /* base uart clock */
diff --git a/include/linux/serial_mfd.h b/include/linux/serial_mfd.h
new file mode 100644
index 000000000000..2b071e0b034d
--- /dev/null
+++ b/include/linux/serial_mfd.h
@@ -0,0 +1,47 @@
1#ifndef _SERIAL_MFD_H_
2#define _SERIAL_MFD_H_
3
4/* HW register offset definition */
5#define UART_FOR 0x08
6#define UART_PS 0x0C
7#define UART_MUL 0x0D
8#define UART_DIV 0x0E
9
10#define HSU_GBL_IEN 0x0
11#define HSU_GBL_IST 0x4
12
13#define HSU_GBL_INT_BIT_PORT0 0x0
14#define HSU_GBL_INT_BIT_PORT1 0x1
15#define HSU_GBL_INT_BIT_PORT2 0x2
16#define HSU_GBL_INT_BIT_IRI 0x3
17#define HSU_GBL_INT_BIT_HDLC 0x4
18#define HSU_GBL_INT_BIT_DMA 0x5
19
20#define HSU_GBL_ISR 0x8
21#define HSU_GBL_DMASR 0x400
22#define HSU_GBL_DMAISR 0x404
23
24#define HSU_PORT_REG_OFFSET 0x80
25#define HSU_PORT0_REG_OFFSET 0x80
26#define HSU_PORT1_REG_OFFSET 0x100
27#define HSU_PORT2_REG_OFFSET 0x180
28#define HSU_PORT_REG_LENGTH 0x80
29
30#define HSU_DMA_CHANS_REG_OFFSET 0x500
31#define HSU_DMA_CHANS_REG_LENGTH 0x40
32
33#define HSU_CH_SR 0x0 /* channel status reg */
34#define HSU_CH_CR 0x4 /* control reg */
35#define HSU_CH_DCR 0x8 /* descriptor control reg */
36#define HSU_CH_BSR 0x10 /* max fifo buffer size reg */
37#define HSU_CH_MOTSR 0x14 /* minimum ocp transfer size */
38#define HSU_CH_D0SAR 0x20 /* desc 0 start addr */
39#define HSU_CH_D0TSR 0x24 /* desc 0 transfer size */
40#define HSU_CH_D1SAR 0x28
41#define HSU_CH_D1TSR 0x2C
42#define HSU_CH_D2SAR 0x30
43#define HSU_CH_D2TSR 0x34
44#define HSU_CH_D3SAR 0x38
45#define HSU_CH_D3TSR 0x3C
46
47#endif
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index cf9327c051ad..c7a0ce11cd47 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -221,8 +221,24 @@
221#define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */ 221#define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */
222#define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ 222#define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */
223 223
224/*
225 * Intel MID on-chip HSU (High Speed UART) defined bits
226 */
227#define UART_FCR_HSU_64_1B 0x00 /* receive FIFO treshold = 1 */
228#define UART_FCR_HSU_64_16B 0x40 /* receive FIFO treshold = 16 */
229#define UART_FCR_HSU_64_32B 0x80 /* receive FIFO treshold = 32 */
230#define UART_FCR_HSU_64_56B 0xc0 /* receive FIFO treshold = 56 */
231
232#define UART_FCR_HSU_16_1B 0x00 /* receive FIFO treshold = 1 */
233#define UART_FCR_HSU_16_4B 0x40 /* receive FIFO treshold = 4 */
234#define UART_FCR_HSU_16_8B 0x80 /* receive FIFO treshold = 8 */
235#define UART_FCR_HSU_16_14B 0xc0 /* receive FIFO treshold = 14 */
224 236
237#define UART_FCR_HSU_64B_FIFO 0x20 /* chose 64 bytes FIFO */
238#define UART_FCR_HSU_16B_FIFO 0x00 /* chose 16 bytes FIFO */
225 239
240#define UART_FCR_HALF_EMPT_TXI 0x00 /* trigger TX_EMPT IRQ for half empty */
241#define UART_FCR_FULL_EMPT_TXI 0x08 /* trigger TX_EMPT IRQ for full empty */
226 242
227/* 243/*
228 * These register definitions are for the 16C950 244 * These register definitions are for the 16C950
diff --git a/include/linux/statfs.h b/include/linux/statfs.h
index b34cc829f98d..0166d320a75d 100644
--- a/include/linux/statfs.h
+++ b/include/linux/statfs.h
@@ -2,7 +2,6 @@
2#define _LINUX_STATFS_H 2#define _LINUX_STATFS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5
6#include <asm/statfs.h> 5#include <asm/statfs.h>
7 6
8struct kstatfs { 7struct kstatfs {
@@ -16,7 +15,29 @@ struct kstatfs {
16 __kernel_fsid_t f_fsid; 15 __kernel_fsid_t f_fsid;
17 long f_namelen; 16 long f_namelen;
18 long f_frsize; 17 long f_frsize;
19 long f_spare[5]; 18 long f_flags;
19 long f_spare[4];
20}; 20};
21 21
22/*
23 * Definitions for the flag in f_flag.
24 *
25 * Generally these flags are equivalent to the MS_ flags used in the mount
26 * ABI. The exception is ST_VALID which has the same value as MS_REMOUNT
27 * which doesn't make any sense for statfs.
28 */
29#define ST_RDONLY 0x0001 /* mount read-only */
30#define ST_NOSUID 0x0002 /* ignore suid and sgid bits */
31#define ST_NODEV 0x0004 /* disallow access to device special files */
32#define ST_NOEXEC 0x0008 /* disallow program execution */
33#define ST_SYNCHRONOUS 0x0010 /* writes are synced at once */
34#define ST_VALID 0x0020 /* f_flags support is implemented */
35#define ST_MANDLOCK 0x0040 /* allow mandatory locks on an FS */
36/* 0x0080 used for ST_WRITE in glibc */
37/* 0x0100 used for ST_APPEND in glibc */
38/* 0x0200 used for ST_IMMUTABLE in glibc */
39#define ST_NOATIME 0x0400 /* do not update access times */
40#define ST_NODIRATIME 0x0800 /* do not update directory access times */
41#define ST_RELATIME 0x1000 /* update atime relative to mtime/ctime */
42
22#endif 43#endif
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a6bfd1367d2a..1b67bd333b5e 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -35,6 +35,7 @@ struct oldold_utsname;
35struct old_utsname; 35struct old_utsname;
36struct pollfd; 36struct pollfd;
37struct rlimit; 37struct rlimit;
38struct rlimit64;
38struct rusage; 39struct rusage;
39struct sched_param; 40struct sched_param;
40struct sel_arg_struct; 41struct sel_arg_struct;
@@ -644,6 +645,9 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *r
644#endif 645#endif
645asmlinkage long sys_setrlimit(unsigned int resource, 646asmlinkage long sys_setrlimit(unsigned int resource,
646 struct rlimit __user *rlim); 647 struct rlimit __user *rlim);
648asmlinkage long sys_prlimit64(pid_t pid, unsigned int resource,
649 const struct rlimit64 __user *new_rlim,
650 struct rlimit64 __user *old_rlim);
647asmlinkage long sys_getrusage(int who, struct rusage __user *ru); 651asmlinkage long sys_getrusage(int who, struct rusage __user *ru);
648asmlinkage long sys_umask(int mask); 652asmlinkage long sys_umask(int mask);
649 653
@@ -811,6 +815,10 @@ asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
811asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int, 815asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
812 struct timespec __user *, const sigset_t __user *, 816 struct timespec __user *, const sigset_t __user *,
813 size_t); 817 size_t);
818asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags);
819asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
820 u64 mask, int fd,
821 const char __user *pathname);
814 822
815int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 823int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
816 824
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 7802a243ee13..1437da3ddc62 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -13,6 +13,7 @@
13#include <linux/tty_driver.h> 13#include <linux/tty_driver.h>
14#include <linux/tty_ldisc.h> 14#include <linux/tty_ldisc.h>
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/smp_lock.h>
16 17
17#include <asm/system.h> 18#include <asm/system.h>
18 19
@@ -179,6 +180,7 @@ struct tty_bufhead {
179#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO) 180#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO)
180#define L_PENDIN(tty) _L_FLAG((tty), PENDIN) 181#define L_PENDIN(tty) _L_FLAG((tty), PENDIN)
181#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN) 182#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN)
183#define L_EXTPROC(tty) _L_FLAG((tty), EXTPROC)
182 184
183struct device; 185struct device;
184struct signal_struct; 186struct signal_struct;
@@ -415,6 +417,7 @@ extern int is_ignored(int sig);
415extern int tty_signal(int sig, struct tty_struct *tty); 417extern int tty_signal(int sig, struct tty_struct *tty);
416extern void tty_hangup(struct tty_struct *tty); 418extern void tty_hangup(struct tty_struct *tty);
417extern void tty_vhangup(struct tty_struct *tty); 419extern void tty_vhangup(struct tty_struct *tty);
420extern void tty_vhangup_locked(struct tty_struct *tty);
418extern void tty_vhangup_self(void); 421extern void tty_vhangup_self(void);
419extern void tty_unhangup(struct file *filp); 422extern void tty_unhangup(struct file *filp);
420extern int tty_hung_up_p(struct file *filp); 423extern int tty_hung_up_p(struct file *filp);
@@ -575,5 +578,54 @@ extern int vt_ioctl(struct tty_struct *tty, struct file *file,
575extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, 578extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file,
576 unsigned int cmd, unsigned long arg); 579 unsigned int cmd, unsigned long arg);
577 580
581/* tty_mutex.c */
582/* functions for preparation of BKL removal */
583extern void __lockfunc tty_lock(void) __acquires(tty_lock);
584extern void __lockfunc tty_unlock(void) __releases(tty_lock);
585extern struct task_struct *__big_tty_mutex_owner;
586#define tty_locked() (current == __big_tty_mutex_owner)
587
588/*
589 * wait_event_interruptible_tty -- wait for a condition with the tty lock held
590 *
591 * The condition we are waiting for might take a long time to
592 * become true, or might depend on another thread taking the
593 * BTM. In either case, we need to drop the BTM to guarantee
594 * forward progress. This is a leftover from the conversion
595 * from the BKL and should eventually get removed as the BTM
596 * falls out of use.
597 *
598 * Do not use in new code.
599 */
600#define wait_event_interruptible_tty(wq, condition) \
601({ \
602 int __ret = 0; \
603 if (!(condition)) { \
604 __wait_event_interruptible_tty(wq, condition, __ret); \
605 } \
606 __ret; \
607})
608
609#define __wait_event_interruptible_tty(wq, condition, ret) \
610do { \
611 DEFINE_WAIT(__wait); \
612 \
613 for (;;) { \
614 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
615 if (condition) \
616 break; \
617 if (!signal_pending(current)) { \
618 tty_unlock(); \
619 schedule(); \
620 tty_lock(); \
621 continue; \
622 } \
623 ret = -ERESTARTSYS; \
624 break; \
625 } \
626 finish_wait(&wq, &__wait); \
627} while (0)
628
629
578#endif /* __KERNEL__ */ 630#endif /* __KERNEL__ */
579#endif 631#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d5922a877994..35fe6ab222bb 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -127,6 +127,8 @@ enum usb_interface_condition {
127 * queued reset so that usb_cancel_queued_reset() doesn't try to 127 * queued reset so that usb_cancel_queued_reset() doesn't try to
128 * remove from the workqueue when running inside the worker 128 * remove from the workqueue when running inside the worker
129 * thread. See __usb_queue_reset_device(). 129 * thread. See __usb_queue_reset_device().
130 * @resetting_device: USB core reset the device, so use alt setting 0 as
131 * current; needs bandwidth alloc after reset.
130 * 132 *
131 * USB device drivers attach to interfaces on a physical device. Each 133 * USB device drivers attach to interfaces on a physical device. Each
132 * interface encapsulates a single high level function, such as feeding 134 * interface encapsulates a single high level function, such as feeding
@@ -843,7 +845,7 @@ struct usb_driver {
843 845
844 void (*disconnect) (struct usb_interface *intf); 846 void (*disconnect) (struct usb_interface *intf);
845 847
846 int (*ioctl) (struct usb_interface *intf, unsigned int code, 848 int (*unlocked_ioctl) (struct usb_interface *intf, unsigned int code,
847 void *buf); 849 void *buf);
848 850
849 int (*suspend) (struct usb_interface *intf, pm_message_t message); 851 int (*suspend) (struct usb_interface *intf, pm_message_t message);
@@ -1015,6 +1017,7 @@ typedef void (*usb_complete_t)(struct urb *);
1015 * is a different endpoint (and pipe) from "out" endpoint two. 1017 * is a different endpoint (and pipe) from "out" endpoint two.
1016 * The current configuration controls the existence, type, and 1018 * The current configuration controls the existence, type, and
1017 * maximum packet size of any given endpoint. 1019 * maximum packet size of any given endpoint.
1020 * @stream_id: the endpoint's stream ID for bulk streams
1018 * @dev: Identifies the USB device to perform the request. 1021 * @dev: Identifies the USB device to perform the request.
1019 * @status: This is read in non-iso completion functions to get the 1022 * @status: This is read in non-iso completion functions to get the
1020 * status of the particular request. ISO requests only use it 1023 * status of the particular request. ISO requests only use it
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 139353efad34..890bc1472190 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -276,6 +276,8 @@ struct usb_composite_driver {
276 int (*bind)(struct usb_composite_dev *); 276 int (*bind)(struct usb_composite_dev *);
277 int (*unbind)(struct usb_composite_dev *); 277 int (*unbind)(struct usb_composite_dev *);
278 278
279 void (*disconnect)(struct usb_composite_dev *);
280
279 /* global suspend hooks */ 281 /* global suspend hooks */
280 void (*suspend)(struct usb_composite_dev *); 282 void (*suspend)(struct usb_composite_dev *);
281 void (*resume)(struct usb_composite_dev *); 283 void (*resume)(struct usb_composite_dev *);
@@ -342,6 +344,10 @@ struct usb_composite_dev {
342}; 344};
343 345
344extern int usb_string_id(struct usb_composite_dev *c); 346extern int usb_string_id(struct usb_composite_dev *c);
347extern int usb_string_ids_tab(struct usb_composite_dev *c,
348 struct usb_string *str);
349extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
350
345 351
346/* messaging utils */ 352/* messaging utils */
347#define DBG(d, fmt, args...) \ 353#define DBG(d, fmt, args...) \
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 80287af2a738..2e262cb15425 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -39,6 +39,12 @@ struct ehci_caps {
39#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */ 39#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */
40 40
41 u32 hcc_params; /* HCCPARAMS - offset 0x8 */ 41 u32 hcc_params; /* HCCPARAMS - offset 0x8 */
42/* EHCI 1.1 addendum */
43#define HCC_32FRAME_PERIODIC_LIST(p) ((p)&(1 << 19))
44#define HCC_PER_PORT_CHANGE_EVENT(p) ((p)&(1 << 18))
45#define HCC_LPM(p) ((p)&(1 << 17))
46#define HCC_HW_PREFETCH(p) ((p)&(1 << 16))
47
42#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */ 48#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */
43#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */ 49#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */
44#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */ 50#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */
@@ -54,6 +60,13 @@ struct ehci_regs {
54 60
55 /* USBCMD: offset 0x00 */ 61 /* USBCMD: offset 0x00 */
56 u32 command; 62 u32 command;
63
64/* EHCI 1.1 addendum */
65#define CMD_HIRD (0xf<<24) /* host initiated resume duration */
66#define CMD_PPCEE (1<<15) /* per port change event enable */
67#define CMD_FSP (1<<14) /* fully synchronized prefetch */
68#define CMD_ASPE (1<<13) /* async schedule prefetch enable */
69#define CMD_PSPE (1<<12) /* periodic schedule prefetch enable */
57/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */ 70/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */
58#define CMD_PARK (1<<11) /* enable "park" on async qh */ 71#define CMD_PARK (1<<11) /* enable "park" on async qh */
59#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */ 72#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */
@@ -67,6 +80,7 @@ struct ehci_regs {
67 80
68 /* USBSTS: offset 0x04 */ 81 /* USBSTS: offset 0x04 */
69 u32 status; 82 u32 status;
83#define STS_PPCE_MASK (0xff<<16) /* Per-Port change event 1-16 */
70#define STS_ASS (1<<15) /* Async Schedule Status */ 84#define STS_ASS (1<<15) /* Async Schedule Status */
71#define STS_PSS (1<<14) /* Periodic Schedule Status */ 85#define STS_PSS (1<<14) /* Periodic Schedule Status */
72#define STS_RECL (1<<13) /* Reclamation */ 86#define STS_RECL (1<<13) /* Reclamation */
@@ -100,6 +114,14 @@ struct ehci_regs {
100 114
101 /* PORTSC: offset 0x44 */ 115 /* PORTSC: offset 0x44 */
102 u32 port_status[0]; /* up to N_PORTS */ 116 u32 port_status[0]; /* up to N_PORTS */
117/* EHCI 1.1 addendum */
118#define PORTSC_SUSPEND_STS_ACK 0
119#define PORTSC_SUSPEND_STS_NYET 1
120#define PORTSC_SUSPEND_STS_STALL 2
121#define PORTSC_SUSPEND_STS_ERR 3
122
123#define PORT_DEV_ADDR (0x7f<<25) /* device address */
124#define PORT_SSTS (0x3<<23) /* suspend status */
103/* 31:23 reserved */ 125/* 31:23 reserved */
104#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ 126#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 127#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
@@ -115,6 +137,7 @@ struct ehci_regs {
115#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ 137#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */
116/* 11:10 for detecting lowspeed devices (reset vs release ownership) */ 138/* 11:10 for detecting lowspeed devices (reset vs release ownership) */
117/* 9 reserved */ 139/* 9 reserved */
140#define PORT_LPM (1<<9) /* LPM transaction */
118#define PORT_RESET (1<<8) /* reset port */ 141#define PORT_RESET (1<<8) /* reset port */
119#define PORT_SUSPEND (1<<7) /* suspend port */ 142#define PORT_SUSPEND (1<<7) /* suspend port */
120#define PORT_RESUME (1<<6) /* resume it */ 143#define PORT_RESUME (1<<6) /* resume it */
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index a34a2a043b21..6f649c13193b 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -180,9 +180,9 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
180static void functionfs_unbind(struct ffs_data *ffs) 180static void functionfs_unbind(struct ffs_data *ffs)
181 __attribute__((nonnull)); 181 __attribute__((nonnull));
182 182
183static int functionfs_add(struct usb_composite_dev *cdev, 183static int functionfs_bind_config(struct usb_composite_dev *cdev,
184 struct usb_configuration *c, 184 struct usb_configuration *c,
185 struct ffs_data *ffs) 185 struct ffs_data *ffs)
186 __attribute__((warn_unused_result, nonnull)); 186 __attribute__((warn_unused_result, nonnull));
187 187
188 188
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 2e3a4ea1a3da..3b571f1ffbb3 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -89,18 +89,33 @@ struct usb_hcd {
89 */ 89 */
90 const struct hc_driver *driver; /* hw-specific hooks */ 90 const struct hc_driver *driver; /* hw-specific hooks */
91 91
92 /* Flags that need to be manipulated atomically */ 92 /* Flags that need to be manipulated atomically because they can
93 * change while the host controller is running. Always use
94 * set_bit() or clear_bit() to change their values.
95 */
93 unsigned long flags; 96 unsigned long flags;
94#define HCD_FLAG_HW_ACCESSIBLE 0x00000001 97#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */
95#define HCD_FLAG_SAW_IRQ 0x00000002 98#define HCD_FLAG_SAW_IRQ 1
99#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
100#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
101#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
102
103 /* The flags can be tested using these macros; they are likely to
104 * be slightly faster than test_bit().
105 */
106#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE))
107#define HCD_SAW_IRQ(hcd) ((hcd)->flags & (1U << HCD_FLAG_SAW_IRQ))
108#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
109#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
110#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
96 111
112 /* Flags that get set only during HCD registration or removal. */
97 unsigned rh_registered:1;/* is root hub registered? */ 113 unsigned rh_registered:1;/* is root hub registered? */
114 unsigned rh_pollable:1; /* may we poll the root hub? */
98 115
99 /* The next flag is a stopgap, to be removed when all the HCDs 116 /* The next flag is a stopgap, to be removed when all the HCDs
100 * support the new root-hub polling mechanism. */ 117 * support the new root-hub polling mechanism. */
101 unsigned uses_new_polling:1; 118 unsigned uses_new_polling:1;
102 unsigned poll_rh:1; /* poll for rh status? */
103 unsigned poll_pending:1; /* status has changed? */
104 unsigned wireless:1; /* Wireless USB HCD */ 119 unsigned wireless:1; /* Wireless USB HCD */
105 unsigned authorized_default:1; 120 unsigned authorized_default:1;
106 unsigned has_tt:1; /* Integrated TT in root hub */ 121 unsigned has_tt:1; /* Integrated TT in root hub */
@@ -198,7 +213,7 @@ struct hc_driver {
198 * a whole, not just the root hub; they're for PCI bus glue. 213 * a whole, not just the root hub; they're for PCI bus glue.
199 */ 214 */
200 /* called after suspending the hub, before entering D3 etc */ 215 /* called after suspending the hub, before entering D3 etc */
201 int (*pci_suspend)(struct usb_hcd *hcd); 216 int (*pci_suspend)(struct usb_hcd *hcd, bool do_wakeup);
202 217
203 /* called after entering D0 (etc), before resuming the hub */ 218 /* called after entering D0 (etc), before resuming the hub */
204 int (*pci_resume)(struct usb_hcd *hcd, bool hibernated); 219 int (*pci_resume)(struct usb_hcd *hcd, bool hibernated);
@@ -299,6 +314,10 @@ struct hc_driver {
299 int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev, 314 int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev,
300 struct usb_tt *tt, gfp_t mem_flags); 315 struct usb_tt *tt, gfp_t mem_flags);
301 int (*reset_device)(struct usb_hcd *, struct usb_device *); 316 int (*reset_device)(struct usb_hcd *, struct usb_device *);
317 /* Notifies the HCD after a device is connected and its
318 * address is set
319 */
320 int (*update_device)(struct usb_hcd *, struct usb_device *);
302}; 321};
303 322
304extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 323extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index f8302d036a76..545cba73ccaf 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -43,13 +43,6 @@ enum usb_xceiv_events {
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */ 43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44}; 44};
45 45
46#define USB_OTG_PULLUP_ID (1 << 0)
47#define USB_OTG_PULLDOWN_DP (1 << 1)
48#define USB_OTG_PULLDOWN_DM (1 << 2)
49#define USB_OTG_EXT_VBUS_INDICATOR (1 << 3)
50#define USB_OTG_DRV_VBUS (1 << 4)
51#define USB_OTG_DRV_VBUS_EXT (1 << 5)
52
53struct otg_transceiver; 46struct otg_transceiver;
54 47
55/* for transceivers connected thru an ULPI interface, the user must 48/* for transceivers connected thru an ULPI interface, the user must
@@ -146,10 +139,10 @@ static inline int otg_io_read(struct otg_transceiver *otg, u32 reg)
146 return -EINVAL; 139 return -EINVAL;
147} 140}
148 141
149static inline int otg_io_write(struct otg_transceiver *otg, u32 reg, u32 val) 142static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg)
150{ 143{
151 if (otg->io_ops && otg->io_ops->write) 144 if (otg->io_ops && otg->io_ops->write)
152 return otg->io_ops->write(otg, reg, val); 145 return otg->io_ops->write(otg, val, reg);
153 146
154 return -EINVAL; 147 return -EINVAL;
155} 148}
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 16b7f3347545..3e93de7ecbc3 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -26,4 +26,8 @@
26 and can't handle talking to these interfaces */ 26 and can't handle talking to these interfaces */
27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020 27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020
28 28
29/* device needs a pause during initialization, after we read the device
30 descriptor */
31#define USB_QUIRK_DELAY_INIT 0x00000040
32
29#endif /* __LINUX_USB_QUIRKS_H */ 33#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 2369d07c3c87..82b1507f4735 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -11,6 +11,42 @@
11#ifndef __LINUX_USB_ULPI_H 11#ifndef __LINUX_USB_ULPI_H
12#define __LINUX_USB_ULPI_H 12#define __LINUX_USB_ULPI_H
13 13
14#include <linux/usb/otg.h>
15/*-------------------------------------------------------------------------*/
16
17/*
18 * ULPI Flags
19 */
20#define ULPI_OTG_ID_PULLUP (1 << 0)
21#define ULPI_OTG_DP_PULLDOWN_DIS (1 << 1)
22#define ULPI_OTG_DM_PULLDOWN_DIS (1 << 2)
23#define ULPI_OTG_DISCHRGVBUS (1 << 3)
24#define ULPI_OTG_CHRGVBUS (1 << 4)
25#define ULPI_OTG_DRVVBUS (1 << 5)
26#define ULPI_OTG_DRVVBUS_EXT (1 << 6)
27#define ULPI_OTG_EXTVBUSIND (1 << 7)
28
29#define ULPI_IC_6PIN_SERIAL (1 << 8)
30#define ULPI_IC_3PIN_SERIAL (1 << 9)
31#define ULPI_IC_CARKIT (1 << 10)
32#define ULPI_IC_CLKSUSPM (1 << 11)
33#define ULPI_IC_AUTORESUME (1 << 12)
34#define ULPI_IC_EXTVBUS_INDINV (1 << 13)
35#define ULPI_IC_IND_PASSTHRU (1 << 14)
36#define ULPI_IC_PROTECT_DIS (1 << 15)
37
38#define ULPI_FC_HS (1 << 16)
39#define ULPI_FC_FS (1 << 17)
40#define ULPI_FC_LS (1 << 18)
41#define ULPI_FC_FS4LS (1 << 19)
42#define ULPI_FC_TERMSEL (1 << 20)
43#define ULPI_FC_OP_NORM (1 << 21)
44#define ULPI_FC_OP_NODRV (1 << 22)
45#define ULPI_FC_OP_DIS_NRZI (1 << 23)
46#define ULPI_FC_OP_NSYNC_NEOP (1 << 24)
47#define ULPI_FC_RST (1 << 25)
48#define ULPI_FC_SUSPM (1 << 26)
49
14/*-------------------------------------------------------------------------*/ 50/*-------------------------------------------------------------------------*/
15 51
16/* 52/*
@@ -58,6 +94,10 @@
58 94
59/*-------------------------------------------------------------------------*/ 95/*-------------------------------------------------------------------------*/
60 96
97/*
98 * Register Bits
99 */
100
61/* Function Control */ 101/* Function Control */
62#define ULPI_FUNC_CTRL_XCVRSEL (1 << 0) 102#define ULPI_FUNC_CTRL_XCVRSEL (1 << 0)
63#define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0) 103#define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0)
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 047f7e6edb86..61490c6dcdbd 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -277,6 +277,7 @@ struct v4l2_pix_format {
277#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ 277#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
278#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ 278#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
279#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ 279#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
280#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */
280#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ 281#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
281#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ 282#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
282#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ 283#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 7f56db4a79f0..6625cc1ab758 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -76,17 +76,52 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \ 76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
77 ((vc)->vc_toggle_meta ? 0x80 : 0)]) 77 ((vc)->vc_toggle_meta ? 0x80 : 0)])
78#else 78#else
79#define con_set_trans_old(arg) (0) 79static inline int con_set_trans_old(unsigned char __user *table)
80#define con_get_trans_old(arg) (-EINVAL) 80{
81#define con_set_trans_new(arg) (0) 81 return 0;
82#define con_get_trans_new(arg) (-EINVAL) 82}
83#define con_clear_unimap(vc, ui) (0) 83static inline int con_get_trans_old(unsigned char __user *table)
84#define con_set_unimap(vc, ct, list) (0) 84{
85#define con_set_default_unimap(vc) (0) 85 return -EINVAL;
86#define con_copy_unimap(d, s) (0) 86}
87#define con_get_unimap(vc, ct, uct, list) (-EINVAL) 87static inline int con_set_trans_new(unsigned short __user *table)
88#define con_free_unimap(vc) do { ; } while (0) 88{
89#define con_protect_unimap(vc, rdonly) do { ; } while (0) 89 return 0;
90}
91static inline int con_get_trans_new(unsigned short __user *table)
92{
93 return -EINVAL;
94}
95static inline int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui)
96{
97 return 0;
98}
99static inline
100int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
101{
102 return 0;
103}
104static inline
105int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct,
106 struct unipair __user *list)
107{
108 return -EINVAL;
109}
110static inline int con_set_default_unimap(struct vc_data *vc)
111{
112 return 0;
113}
114static inline void con_free_unimap(struct vc_data *vc)
115{
116}
117static inline void con_protect_unimap(struct vc_data *vc, int rdonly)
118{
119}
120static inline
121int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc)
122{
123 return 0;
124}
90 125
91#define vc_translate(vc, c) (c) 126#define vc_translate(vc, c) (c)
92#endif 127#endif
@@ -100,6 +135,13 @@ extern int unbind_con_driver(const struct consw *csw, int first, int last,
100 int deflt); 135 int deflt);
101int vty_init(const struct file_operations *console_fops); 136int vty_init(const struct file_operations *console_fops);
102 137
138static inline bool vt_force_oops_output(struct vc_data *vc)
139{
140 if (oops_in_progress && vc->vc_panic_force_write)
141 return true;
142 return false;
143}
144
103/* 145/*
104 * vc_screen.c shares this temporary buffer with the console write code so that 146 * vc_screen.c shares this temporary buffer with the console write code so that
105 * we can easily avoid touching user space while holding the console spinlock. 147 * we can easily avoid touching user space while holding the console spinlock.
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
index 9ebe8558b9b6..8d08ebfe20b7 100644
--- a/include/media/cx2341x.h
+++ b/include/media/cx2341x.h
@@ -19,6 +19,8 @@
19#ifndef CX2341X_H 19#ifndef CX2341X_H
20#define CX2341X_H 20#define CX2341X_H
21 21
22#include <media/v4l2-ctrls.h>
23
22enum cx2341x_port { 24enum cx2341x_port {
23 CX2341X_PORT_MEMORY = 0, 25 CX2341X_PORT_MEMORY = 0,
24 CX2341X_PORT_STREAMING = 1, 26 CX2341X_PORT_STREAMING = 1,
@@ -99,6 +101,101 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
99void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); 101void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p);
100void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix); 102void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix);
101 103
104struct cx2341x_handler;
105
106struct cx2341x_handler_ops {
107 /* needed for the video clock freq */
108 int (*s_audio_sampling_freq)(struct cx2341x_handler *hdl, u32 val);
109 /* needed for dualwatch */
110 int (*s_audio_mode)(struct cx2341x_handler *hdl, u32 val);
111 /* needed for setting up the video resolution */
112 int (*s_video_encoding)(struct cx2341x_handler *hdl, u32 val);
113 /* needed for setting up the sliced vbi insertion data structures */
114 int (*s_stream_vbi_fmt)(struct cx2341x_handler *hdl, u32 val);
115};
116
117struct cx2341x_handler {
118 u32 capabilities;
119 enum cx2341x_port port;
120 u16 width;
121 u16 height;
122 u16 is_50hz;
123 u32 audio_properties;
124
125 struct v4l2_ctrl_handler hdl;
126 void *priv;
127 cx2341x_mbox_func func;
128 const struct cx2341x_handler_ops *ops;
129
130 struct v4l2_ctrl *stream_vbi_fmt;
131
132 struct {
133 /* audio cluster */
134 struct v4l2_ctrl *audio_sampling_freq;
135 struct v4l2_ctrl *audio_encoding;
136 struct v4l2_ctrl *audio_l2_bitrate;
137 struct v4l2_ctrl *audio_mode;
138 struct v4l2_ctrl *audio_mode_extension;
139 struct v4l2_ctrl *audio_emphasis;
140 struct v4l2_ctrl *audio_crc;
141 struct v4l2_ctrl *audio_ac3_bitrate;
142 };
143
144 struct {
145 /* video gop cluster */
146 struct v4l2_ctrl *video_b_frames;
147 struct v4l2_ctrl *video_gop_size;
148 };
149
150 struct {
151 /* stream type cluster */
152 struct v4l2_ctrl *stream_type;
153 struct v4l2_ctrl *video_encoding;
154 struct v4l2_ctrl *video_bitrate_mode;
155 struct v4l2_ctrl *video_bitrate;
156 struct v4l2_ctrl *video_bitrate_peak;
157 };
158
159 struct {
160 /* video mute cluster */
161 struct v4l2_ctrl *video_mute;
162 struct v4l2_ctrl *video_mute_yuv;
163 };
164
165 struct {
166 /* video filter mode cluster */
167 struct v4l2_ctrl *video_spatial_filter_mode;
168 struct v4l2_ctrl *video_temporal_filter_mode;
169 struct v4l2_ctrl *video_median_filter_type;
170 };
171
172 struct {
173 /* video filter type cluster */
174 struct v4l2_ctrl *video_luma_spatial_filter_type;
175 struct v4l2_ctrl *video_chroma_spatial_filter_type;
176 };
177
178 struct {
179 /* video filter cluster */
180 struct v4l2_ctrl *video_spatial_filter;
181 struct v4l2_ctrl *video_temporal_filter;
182 };
183
184 struct {
185 /* video median cluster */
186 struct v4l2_ctrl *video_luma_median_filter_top;
187 struct v4l2_ctrl *video_luma_median_filter_bottom;
188 struct v4l2_ctrl *video_chroma_median_filter_top;
189 struct v4l2_ctrl *video_chroma_median_filter_bottom;
190 };
191};
192
193int cx2341x_handler_init(struct cx2341x_handler *cxhdl,
194 unsigned nr_of_controls_hint);
195void cx2341x_handler_set_50hz(struct cx2341x_handler *cxhdl, int is_50hz);
196int cx2341x_handler_setup(struct cx2341x_handler *cxhdl);
197void cx2341x_handler_set_busy(struct cx2341x_handler *cxhdl, int busy);
198
102/* Firmware names */ 199/* Firmware names */
103#define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw" 200#define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw"
104/* Decoder firmware for the cx23415 only */ 201/* Decoder firmware for the cx23415 only */
diff --git a/include/media/cx25840.h b/include/media/cx25840.h
index 0b0cb1776796..46d1a141208e 100644
--- a/include/media/cx25840.h
+++ b/include/media/cx25840.h
@@ -97,4 +97,91 @@ enum cx25840_audio_input {
97 CX25840_AUDIO8, 97 CX25840_AUDIO8,
98}; 98};
99 99
100enum cx25840_io_pin {
101 CX25840_PIN_DVALID_PRGM0 = 0,
102 CX25840_PIN_FIELD_PRGM1,
103 CX25840_PIN_HRESET_PRGM2,
104 CX25840_PIN_VRESET_HCTL_PRGM3,
105 CX25840_PIN_IRQ_N_PRGM4,
106 CX25840_PIN_IR_TX_PRGM6,
107 CX25840_PIN_IR_RX_PRGM5,
108 CX25840_PIN_GPIO0_PRGM8,
109 CX25840_PIN_GPIO1_PRGM9,
110 CX25840_PIN_SA_SDIN, /* Alternate GP Input only */
111 CX25840_PIN_SA_SDOUT, /* Alternate GP Input only */
112 CX25840_PIN_PLL_CLK_PRGM7,
113 CX25840_PIN_CHIP_SEL_VIPCLK, /* Output only */
114};
115
116enum cx25840_io_pad {
117 /* Output pads */
118 CX25840_PAD_DEFAULT = 0,
119 CX25840_PAD_ACTIVE,
120 CX25840_PAD_VACTIVE,
121 CX25840_PAD_CBFLAG,
122 CX25840_PAD_VID_DATA_EXT0,
123 CX25840_PAD_VID_DATA_EXT1,
124 CX25840_PAD_GPO0,
125 CX25840_PAD_GPO1,
126 CX25840_PAD_GPO2,
127 CX25840_PAD_GPO3,
128 CX25840_PAD_IRQ_N,
129 CX25840_PAD_AC_SYNC,
130 CX25840_PAD_AC_SDOUT,
131 CX25840_PAD_PLL_CLK,
132 CX25840_PAD_VRESET,
133 CX25840_PAD_RESERVED,
134 /* Pads for PLL_CLK output only */
135 CX25840_PAD_XTI_X5_DLL,
136 CX25840_PAD_AUX_PLL,
137 CX25840_PAD_VID_PLL,
138 CX25840_PAD_XTI,
139 /* Input Pads */
140 CX25840_PAD_GPI0,
141 CX25840_PAD_GPI1,
142 CX25840_PAD_GPI2,
143 CX25840_PAD_GPI3,
144};
145
146enum cx25840_io_pin_strength {
147 CX25840_PIN_DRIVE_MEDIUM = 0,
148 CX25840_PIN_DRIVE_SLOW,
149 CX25840_PIN_DRIVE_FAST,
150};
151
152enum cx23885_io_pin {
153 CX23885_PIN_IR_RX_GPIO19,
154 CX23885_PIN_IR_TX_GPIO20,
155 CX23885_PIN_I2S_SDAT_GPIO21,
156 CX23885_PIN_I2S_WCLK_GPIO22,
157 CX23885_PIN_I2S_BCLK_GPIO23,
158 CX23885_PIN_IRQ_N_GPIO16,
159};
160
161enum cx23885_io_pad {
162 CX23885_PAD_IR_RX,
163 CX23885_PAD_GPIO19,
164 CX23885_PAD_IR_TX,
165 CX23885_PAD_GPIO20,
166 CX23885_PAD_I2S_SDAT,
167 CX23885_PAD_GPIO21,
168 CX23885_PAD_I2S_WCLK,
169 CX23885_PAD_GPIO22,
170 CX23885_PAD_I2S_BCLK,
171 CX23885_PAD_GPIO23,
172 CX23885_PAD_IRQ_N,
173 CX23885_PAD_GPIO16,
174};
175
176/* pvr150_workaround activates a workaround for a hardware bug that is
177 present in Hauppauge PVR-150 (and possibly PVR-500) cards that have
178 certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The
179 audio autodetect fails on some channels for these models and the workaround
180 is to select the audio standard explicitly. Many thanks to Hauppauge for
181 providing this information.
182 This platform data only needs to be supplied by the ivtv driver. */
183struct cx25840_platform_data {
184 int pvr150_workaround;
185};
186
100#endif 187#endif
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 513e60dd1010..eb7fddf8f607 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -41,6 +41,11 @@ enum rc_driver_type {
41 * anything with it. Yet, as the same keycode table can be used with other 41 * anything with it. Yet, as the same keycode table can be used with other
42 * devices, a mask is provided to allow its usage. Drivers should generally 42 * devices, a mask is provided to allow its usage. Drivers should generally
43 * leave this field in blank 43 * leave this field in blank
44 * @timeout: optional time after which device stops sending data
45 * @min_timeout: minimum timeout supported by device
46 * @max_timeout: maximum timeout supported by device
47 * @rx_resolution : resolution (in ns) of input sampler
48 * @tx_resolution: resolution (in ns) of output sampler
44 * @priv: driver-specific data, to be used on the callbacks 49 * @priv: driver-specific data, to be used on the callbacks
45 * @change_protocol: allow changing the protocol used on hardware decoders 50 * @change_protocol: allow changing the protocol used on hardware decoders
46 * @open: callback to allow drivers to enable polling/irq when IR input device 51 * @open: callback to allow drivers to enable polling/irq when IR input device
@@ -49,19 +54,36 @@ enum rc_driver_type {
49 * is opened. 54 * is opened.
50 * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs) 55 * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs)
51 * @s_tx_carrier: set transmit carrier frequency 56 * @s_tx_carrier: set transmit carrier frequency
57 * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%)
58 * @s_rx_carrier: inform driver about carrier it is expected to handle
52 * @tx_ir: transmit IR 59 * @tx_ir: transmit IR
60 * @s_idle: optional: enable/disable hardware idle mode, upon which,
61 device doesn't interrupt host until it sees IR pulses
62 * @s_learning_mode: enable wide band receiver used for learning
53 */ 63 */
54struct ir_dev_props { 64struct ir_dev_props {
55 enum rc_driver_type driver_type; 65 enum rc_driver_type driver_type;
56 unsigned long allowed_protos; 66 unsigned long allowed_protos;
57 u32 scanmask; 67 u32 scanmask;
68
69 u32 timeout;
70 u32 min_timeout;
71 u32 max_timeout;
72
73 u32 rx_resolution;
74 u32 tx_resolution;
75
58 void *priv; 76 void *priv;
59 int (*change_protocol)(void *priv, u64 ir_type); 77 int (*change_protocol)(void *priv, u64 ir_type);
60 int (*open)(void *priv); 78 int (*open)(void *priv);
61 void (*close)(void *priv); 79 void (*close)(void *priv);
62 int (*s_tx_mask)(void *priv, u32 mask); 80 int (*s_tx_mask)(void *priv, u32 mask);
63 int (*s_tx_carrier)(void *priv, u32 carrier); 81 int (*s_tx_carrier)(void *priv, u32 carrier);
82 int (*s_tx_duty_cycle)(void *priv, u32 duty_cycle);
83 int (*s_rx_carrier_range)(void *priv, u32 min, u32 max);
64 int (*tx_ir)(void *priv, int *txbuf, u32 n); 84 int (*tx_ir)(void *priv, int *txbuf, u32 n);
85 void (*s_idle)(void *priv, int enable);
86 int (*s_learning_mode)(void *priv, int enable);
65}; 87};
66 88
67struct ir_input_dev { 89struct ir_input_dev {
@@ -69,9 +91,10 @@ struct ir_input_dev {
69 char *driver_name; /* Name of the driver module */ 91 char *driver_name; /* Name of the driver module */
70 struct ir_scancode_table rc_tab; /* scan/key table */ 92 struct ir_scancode_table rc_tab; /* scan/key table */
71 unsigned long devno; /* device number */ 93 unsigned long devno; /* device number */
72 const struct ir_dev_props *props; /* Device properties */ 94 struct ir_dev_props *props; /* Device properties */
73 struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ 95 struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */
74 struct input_dev *input_dev; /* the input device associated with this device */ 96 struct input_dev *input_dev; /* the input device associated with this device */
97 bool idle;
75 98
76 /* key info - needed by IR keycode handlers */ 99 /* key info - needed by IR keycode handlers */
77 spinlock_t keylock; /* protects the below members */ 100 spinlock_t keylock; /* protects the below members */
@@ -95,12 +118,12 @@ enum raw_event_type {
95/* From ir-keytable.c */ 118/* From ir-keytable.c */
96int __ir_input_register(struct input_dev *dev, 119int __ir_input_register(struct input_dev *dev,
97 const struct ir_scancode_table *ir_codes, 120 const struct ir_scancode_table *ir_codes,
98 const struct ir_dev_props *props, 121 struct ir_dev_props *props,
99 const char *driver_name); 122 const char *driver_name);
100 123
101static inline int ir_input_register(struct input_dev *dev, 124static inline int ir_input_register(struct input_dev *dev,
102 const char *map_name, 125 const char *map_name,
103 const struct ir_dev_props *props, 126 struct ir_dev_props *props,
104 const char *driver_name) { 127 const char *driver_name) {
105 struct ir_scancode_table *ir_codes; 128 struct ir_scancode_table *ir_codes;
106 struct ir_input_dev *ir_dev; 129 struct ir_input_dev *ir_dev;
@@ -110,8 +133,12 @@ static inline int ir_input_register(struct input_dev *dev,
110 return -EINVAL; 133 return -EINVAL;
111 134
112 ir_codes = get_rc_map(map_name); 135 ir_codes = get_rc_map(map_name);
113 if (!ir_codes) 136 if (!ir_codes) {
114 return -EINVAL; 137 ir_codes = get_rc_map(RC_MAP_EMPTY);
138
139 if (!ir_codes)
140 return -EINVAL;
141 }
115 142
116 rc = __ir_input_register(dev, ir_codes, props, driver_name); 143 rc = __ir_input_register(dev, ir_codes, props, driver_name);
117 if (rc < 0) 144 if (rc < 0)
@@ -144,6 +171,10 @@ struct ir_raw_event {
144void ir_raw_event_handle(struct input_dev *input_dev); 171void ir_raw_event_handle(struct input_dev *input_dev);
145int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev); 172int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev);
146int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type); 173int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type);
174int ir_raw_event_store_with_filter(struct input_dev *input_dev,
175 struct ir_raw_event *ev);
176void ir_raw_event_set_idle(struct input_dev *input_dev, int idle);
177
147static inline void ir_raw_event_reset(struct input_dev *input_dev) 178static inline void ir_raw_event_reset(struct input_dev *input_dev)
148{ 179{
149 struct ir_raw_event ev = { .pulse = false, .duration = 0 }; 180 struct ir_raw_event ev = { .pulse = false, .duration = 0 };
diff --git a/include/media/lirc.h b/include/media/lirc.h
index 42c467c50519..6678a169fd9e 100644
--- a/include/media/lirc.h
+++ b/include/media/lirc.h
@@ -77,6 +77,7 @@
77#define LIRC_CAN_SET_REC_FILTER 0x08000000 77#define LIRC_CAN_SET_REC_FILTER 0x08000000
78 78
79#define LIRC_CAN_MEASURE_CARRIER 0x02000000 79#define LIRC_CAN_MEASURE_CARRIER 0x02000000
80#define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000
80 81
81#define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK) 82#define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK)
82#define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK) 83#define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK)
@@ -145,7 +146,7 @@
145 * if enabled from the next key press on the driver will send 146 * if enabled from the next key press on the driver will send
146 * LIRC_MODE2_FREQUENCY packets 147 * LIRC_MODE2_FREQUENCY packets
147 */ 148 */
148#define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32) 149#define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32)
149 150
150/* 151/*
151 * to set a range use 152 * to set a range use
@@ -162,4 +163,6 @@
162#define LIRC_SETUP_START _IO('i', 0x00000021) 163#define LIRC_SETUP_START _IO('i', 0x00000021)
163#define LIRC_SETUP_END _IO('i', 0x00000022) 164#define LIRC_SETUP_END _IO('i', 0x00000022)
164 165
166#define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32)
167
165#endif 168#endif
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 9569d0863f8b..a9c041d49662 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -114,6 +114,7 @@ void rc_map_init(void);
114#define RC_MAP_PURPLETV "rc-purpletv" 114#define RC_MAP_PURPLETV "rc-purpletv"
115#define RC_MAP_PV951 "rc-pv951" 115#define RC_MAP_PV951 "rc-pv951"
116#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" 116#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new"
117#define RC_MAP_RC5_STREAMZAP "rc-rc5-streamzap"
117#define RC_MAP_RC5_TV "rc-rc5-tv" 118#define RC_MAP_RC5_TV "rc-rc5-tv"
118#define RC_MAP_RC6_MCE "rc-rc6-mce" 119#define RC_MAP_RC6_MCE "rc-rc6-mce"
119#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" 120#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
new file mode 100644
index 000000000000..9b7bea928a88
--- /dev/null
+++ b/include/media/v4l2-ctrls.h
@@ -0,0 +1,460 @@
1/*
2 V4L2 controls support header.
3
4 Copyright (C) 2010 Hans Verkuil <hverkuil@xs4all.nl>
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 as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _V4L2_CTRLS_H
22#define _V4L2_CTRLS_H
23
24#include <linux/list.h>
25#include <linux/device.h>
26
27/* forward references */
28struct v4l2_ctrl_handler;
29struct v4l2_ctrl;
30struct video_device;
31struct v4l2_subdev;
32
33/** struct v4l2_ctrl_ops - The control operations that the driver has to provide.
34 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
35 * for volatile (and usually read-only) controls such as a control
36 * that returns the current signal strength which changes
37 * continuously.
38 * If not set, then the currently cached value will be returned.
39 * @try_ctrl: Test whether the control's value is valid. Only relevant when
40 * the usual min/max/step checks are not sufficient.
41 * @s_ctrl: Actually set the new control value. s_ctrl is compulsory. The
42 * ctrl->handler->lock is held when these ops are called, so no
43 * one else can access controls owned by that handler.
44 */
45struct v4l2_ctrl_ops {
46 int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl);
47 int (*try_ctrl)(struct v4l2_ctrl *ctrl);
48 int (*s_ctrl)(struct v4l2_ctrl *ctrl);
49};
50
51/** struct v4l2_ctrl - The control structure.
52 * @node: The list node.
53 * @handler: The handler that owns the control.
54 * @cluster: Point to start of cluster array.
55 * @ncontrols: Number of controls in cluster array.
56 * @has_new: Internal flag: set when there is a valid new value.
57 * @done: Internal flag: set for each processed control.
58 * @is_private: If set, then this control is private to its handler and it
59 * will not be added to any other handlers. Drivers can set
60 * this flag.
61 * @is_volatile: If set, then this control is volatile. This means that the
62 * control's current value cannot be cached and needs to be
63 * retrieved through the g_volatile_ctrl op. Drivers can set
64 * this flag.
65 * @ops: The control ops.
66 * @id: The control ID.
67 * @name: The control name.
68 * @type: The control type.
69 * @minimum: The control's minimum value.
70 * @maximum: The control's maximum value.
71 * @default_value: The control's default value.
72 * @step: The control's step value for non-menu controls.
73 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
74 * easy to skip menu items that are not valid. If bit X is set,
75 * then menu item X is skipped. Of course, this only works for
76 * menus with <= 32 menu items. There are no menus that come
77 * close to that number, so this is OK. Should we ever need more,
78 * then this will have to be extended to a u64 or a bit array.
79 * @qmenu: A const char * array for all menu items. Array entries that are
80 * empty strings ("") correspond to non-existing menu items (this
81 * is in addition to the menu_skip_mask above). The last entry
82 * must be NULL.
83 * @flags: The control's flags.
84 * @cur: The control's current value.
85 * @val: The control's new s32 value.
86 * @val64: The control's new s64 value.
87 * @string: The control's new string value.
88 * @priv: The control's private pointer. For use by the driver. It is
89 * untouched by the control framework. Note that this pointer is
90 * not freed when the control is deleted. Should this be needed
91 * then a new internal bitfield can be added to tell the framework
92 * to free this pointer.
93 */
94struct v4l2_ctrl {
95 /* Administrative fields */
96 struct list_head node;
97 struct v4l2_ctrl_handler *handler;
98 struct v4l2_ctrl **cluster;
99 unsigned ncontrols;
100 unsigned int has_new:1;
101 unsigned int done:1;
102
103 unsigned int is_private:1;
104 unsigned int is_volatile:1;
105
106 const struct v4l2_ctrl_ops *ops;
107 u32 id;
108 const char *name;
109 enum v4l2_ctrl_type type;
110 s32 minimum, maximum, default_value;
111 union {
112 u32 step;
113 u32 menu_skip_mask;
114 };
115 const char **qmenu;
116 unsigned long flags;
117 union {
118 s32 val;
119 s64 val64;
120 char *string;
121 } cur;
122 union {
123 s32 val;
124 s64 val64;
125 char *string;
126 };
127 void *priv;
128};
129
130/** struct v4l2_ctrl_ref - The control reference.
131 * @node: List node for the sorted list.
132 * @next: Single-link list node for the hash.
133 * @ctrl: The actual control information.
134 *
135 * Each control handler has a list of these refs. The list_head is used to
136 * keep a sorted-by-control-ID list of all controls, while the next pointer
137 * is used to link the control in the hash's bucket.
138 */
139struct v4l2_ctrl_ref {
140 struct list_head node;
141 struct v4l2_ctrl_ref *next;
142 struct v4l2_ctrl *ctrl;
143};
144
145/** struct v4l2_ctrl_handler - The control handler keeps track of all the
146 * controls: both the controls owned by the handler and those inherited
147 * from other handlers.
148 * @lock: Lock to control access to this handler and its controls.
149 * @ctrls: The list of controls owned by this handler.
150 * @ctrl_refs: The list of control references.
151 * @cached: The last found control reference. It is common that the same
152 * control is needed multiple times, so this is a simple
153 * optimization.
154 * @buckets: Buckets for the hashing. Allows for quick control lookup.
155 * @nr_of_buckets: Total number of buckets in the array.
156 * @error: The error code of the first failed control addition.
157 */
158struct v4l2_ctrl_handler {
159 struct mutex lock;
160 struct list_head ctrls;
161 struct list_head ctrl_refs;
162 struct v4l2_ctrl_ref *cached;
163 struct v4l2_ctrl_ref **buckets;
164 u16 nr_of_buckets;
165 int error;
166};
167
168/** struct v4l2_ctrl_config - Control configuration structure.
169 * @ops: The control ops.
170 * @id: The control ID.
171 * @name: The control name.
172 * @type: The control type.
173 * @min: The control's minimum value.
174 * @max: The control's maximum value.
175 * @step: The control's step value for non-menu controls.
176 * @def: The control's default value.
177 * @flags: The control's flags.
178 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
179 * easy to skip menu items that are not valid. If bit X is set,
180 * then menu item X is skipped. Of course, this only works for
181 * menus with <= 32 menu items. There are no menus that come
182 * close to that number, so this is OK. Should we ever need more,
183 * then this will have to be extended to a u64 or a bit array.
184 * @qmenu: A const char * array for all menu items. Array entries that are
185 * empty strings ("") correspond to non-existing menu items (this
186 * is in addition to the menu_skip_mask above). The last entry
187 * must be NULL.
188 * @is_private: If set, then this control is private to its handler and it
189 * will not be added to any other handlers.
190 * @is_volatile: If set, then this control is volatile. This means that the
191 * control's current value cannot be cached and needs to be
192 * retrieved through the g_volatile_ctrl op.
193 */
194struct v4l2_ctrl_config {
195 const struct v4l2_ctrl_ops *ops;
196 u32 id;
197 const char *name;
198 enum v4l2_ctrl_type type;
199 s32 min;
200 s32 max;
201 u32 step;
202 s32 def;
203 u32 flags;
204 u32 menu_skip_mask;
205 const char **qmenu;
206 unsigned int is_private:1;
207 unsigned int is_volatile:1;
208};
209
210/** v4l2_ctrl_fill() - Fill in the control fields based on the control ID.
211 *
212 * This works for all standard V4L2 controls.
213 * For non-standard controls it will only fill in the given arguments
214 * and @name will be NULL.
215 *
216 * This function will overwrite the contents of @name, @type and @flags.
217 * The contents of @min, @max, @step and @def may be modified depending on
218 * the type.
219 *
220 * Do not use in drivers! It is used internally for backwards compatibility
221 * control handling only. Once all drivers are converted to use the new
222 * control framework this function will no longer be exported.
223 */
224void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
225 s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags);
226
227
228/** v4l2_ctrl_handler_init() - Initialize the control handler.
229 * @hdl: The control handler.
230 * @nr_of_controls_hint: A hint of how many controls this handler is
231 * expected to refer to. This is the total number, so including
232 * any inherited controls. It doesn't have to be precise, but if
233 * it is way off, then you either waste memory (too many buckets
234 * are allocated) or the control lookup becomes slower (not enough
235 * buckets are allocated, so there are more slow list lookups).
236 * It will always work, though.
237 *
238 * Returns an error if the buckets could not be allocated. This error will
239 * also be stored in @hdl->error.
240 */
241int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl,
242 unsigned nr_of_controls_hint);
243
244/** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free
245 * the control list.
246 * @hdl: The control handler.
247 *
248 * Does nothing if @hdl == NULL.
249 */
250void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl);
251
252/** v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
253 * to the handler to initialize the hardware to the current control values.
254 * @hdl: The control handler.
255 *
256 * Button controls will be skipped, as are read-only controls.
257 *
258 * If @hdl == NULL, then this just returns 0.
259 */
260int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
261
262/** v4l2_ctrl_handler_log_status() - Log all controls owned by the handler.
263 * @hdl: The control handler.
264 * @prefix: The prefix to use when logging the control values. If the
265 * prefix does not end with a space, then ": " will be added
266 * after the prefix. If @prefix == NULL, then no prefix will be
267 * used.
268 *
269 * For use with VIDIOC_LOG_STATUS.
270 *
271 * Does nothing if @hdl == NULL.
272 */
273void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
274 const char *prefix);
275
276/** v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2
277 * control.
278 * @hdl: The control handler.
279 * @cfg: The control's configuration data.
280 * @priv: The control's driver-specific private data.
281 *
282 * If the &v4l2_ctrl struct could not be allocated then NULL is returned
283 * and @hdl->error is set to the error code (if it wasn't set already).
284 */
285struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
286 const struct v4l2_ctrl_config *cfg, void *priv);
287
288/** v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu control.
289 * @hdl: The control handler.
290 * @ops: The control ops.
291 * @id: The control ID.
292 * @min: The control's minimum value.
293 * @max: The control's maximum value.
294 * @step: The control's step value
295 * @def: The control's default value.
296 *
297 * If the &v4l2_ctrl struct could not be allocated, or the control
298 * ID is not known, then NULL is returned and @hdl->error is set to the
299 * appropriate error code (if it wasn't set already).
300 *
301 * If @id refers to a menu control, then this function will return NULL.
302 *
303 * Use v4l2_ctrl_new_std_menu() when adding menu controls.
304 */
305struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
306 const struct v4l2_ctrl_ops *ops,
307 u32 id, s32 min, s32 max, u32 step, s32 def);
308
309/** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control.
310 * @hdl: The control handler.
311 * @ops: The control ops.
312 * @id: The control ID.
313 * @max: The control's maximum value.
314 * @mask: The control's skip mask for menu controls. This makes it
315 * easy to skip menu items that are not valid. If bit X is set,
316 * then menu item X is skipped. Of course, this only works for
317 * menus with <= 32 menu items. There are no menus that come
318 * close to that number, so this is OK. Should we ever need more,
319 * then this will have to be extended to a u64 or a bit array.
320 * @def: The control's default value.
321 *
322 * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
323 * determines which menu items are to be skipped.
324 *
325 * If @id refers to a non-menu control, then this function will return NULL.
326 */
327struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
328 const struct v4l2_ctrl_ops *ops,
329 u32 id, s32 max, s32 mask, s32 def);
330
331/** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler.
332 * @hdl: The control handler.
333 * @ctrl: The control to add.
334 *
335 * It will return NULL if it was unable to add the control reference.
336 * If the control already belonged to the handler, then it will do
337 * nothing and just return @ctrl.
338 */
339struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl,
340 struct v4l2_ctrl *ctrl);
341
342/** v4l2_ctrl_add_handler() - Add all controls from handler @add to
343 * handler @hdl.
344 * @hdl: The control handler.
345 * @add: The control handler whose controls you want to add to
346 * the @hdl control handler.
347 *
348 * Does nothing if either of the two is a NULL pointer.
349 * In case of an error @hdl->error will be set to the error code (if it
350 * wasn't set already).
351 */
352int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
353 struct v4l2_ctrl_handler *add);
354
355
356/** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster.
357 * @ncontrols: The number of controls in this cluster.
358 * @controls: The cluster control array of size @ncontrols.
359 */
360void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls);
361
362
363/** v4l2_ctrl_find() - Find a control with the given ID.
364 * @hdl: The control handler.
365 * @id: The control ID to find.
366 *
367 * If @hdl == NULL this will return NULL as well. Will lock the handler so
368 * do not use from inside &v4l2_ctrl_ops.
369 */
370struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
371
372/** v4l2_ctrl_activate() - Make the control active or inactive.
373 * @ctrl: The control to (de)activate.
374 * @active: True if the control should become active.
375 *
376 * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically.
377 * Does nothing if @ctrl == NULL.
378 * This will usually be called from within the s_ctrl op.
379 *
380 * This function can be called regardless of whether the control handler
381 * is locked or not.
382 */
383void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
384
385/** v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
386 * @ctrl: The control to (de)activate.
387 * @grabbed: True if the control should become grabbed.
388 *
389 * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
390 * Does nothing if @ctrl == NULL.
391 * This will usually be called when starting or stopping streaming in the
392 * driver.
393 *
394 * This function can be called regardless of whether the control handler
395 * is locked or not.
396 */
397void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
398
399/** v4l2_ctrl_lock() - Helper function to lock the handler
400 * associated with the control.
401 * @ctrl: The control to lock.
402 */
403static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
404{
405 mutex_lock(&ctrl->handler->lock);
406}
407
408/** v4l2_ctrl_lock() - Helper function to unlock the handler
409 * associated with the control.
410 * @ctrl: The control to unlock.
411 */
412static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
413{
414 mutex_unlock(&ctrl->handler->lock);
415}
416
417/** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver.
418 * @ctrl: The control.
419 *
420 * This returns the control's value safely by going through the control
421 * framework. This function will lock the control's handler, so it cannot be
422 * used from within the &v4l2_ctrl_ops functions.
423 *
424 * This function is for integer type controls only.
425 */
426s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
427
428/** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver.
429 * @ctrl: The control.
430 * @val: The new value.
431 *
432 * This set the control's new value safely by going through the control
433 * framework. This function will lock the control's handler, so it cannot be
434 * used from within the &v4l2_ctrl_ops functions.
435 *
436 * This function is for integer type controls only.
437 */
438int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
439
440
441/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */
442int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
443int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
444int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
445int v4l2_s_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
446int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
447int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
448int v4l2_s_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
449
450/* Helpers for subdevices. If the associated ctrl_handler == NULL then they
451 will all return -EINVAL. */
452int v4l2_subdev_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
453int v4l2_subdev_querymenu(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
454int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
455int v4l2_subdev_try_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
456int v4l2_subdev_s_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
457int v4l2_subdev_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
458int v4l2_subdev_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
459
460#endif
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index bebe44b03e0f..1efcacbed01a 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -27,6 +27,7 @@
27struct v4l2_ioctl_callbacks; 27struct v4l2_ioctl_callbacks;
28struct video_device; 28struct video_device;
29struct v4l2_device; 29struct v4l2_device;
30struct v4l2_ctrl_handler;
30 31
31/* Flag to mark the video_device struct as registered. 32/* Flag to mark the video_device struct as registered.
32 Drivers can clear this flag if they want to block all future 33 Drivers can clear this flag if they want to block all future
@@ -67,6 +68,9 @@ struct video_device
67 struct device *parent; /* device parent */ 68 struct device *parent; /* device parent */
68 struct v4l2_device *v4l2_dev; /* v4l2_device parent */ 69 struct v4l2_device *v4l2_dev; /* v4l2_device parent */
69 70
71 /* Control handler associated with this device node. May be NULL. */
72 struct v4l2_ctrl_handler *ctrl_handler;
73
70 /* device info */ 74 /* device info */
71 char name[32]; 75 char name[32];
72 int vfl_type; 76 int vfl_type;
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 5d5d550e63ad..8bcbd7a0271c 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -32,6 +32,8 @@
32 32
33#define V4L2_DEVICE_NAME_SIZE (20 + 16) 33#define V4L2_DEVICE_NAME_SIZE (20 + 16)
34 34
35struct v4l2_ctrl_handler;
36
35struct v4l2_device { 37struct v4l2_device {
36 /* dev->driver_data points to this struct. 38 /* dev->driver_data points to this struct.
37 Note: dev might be NULL if there is no parent device 39 Note: dev might be NULL if there is no parent device
@@ -47,6 +49,8 @@ struct v4l2_device {
47 /* notify callback called by some sub-devices. */ 49 /* notify callback called by some sub-devices. */
48 void (*notify)(struct v4l2_subdev *sd, 50 void (*notify)(struct v4l2_subdev *sd,
49 unsigned int notification, void *arg); 51 unsigned int notification, void *arg);
52 /* The control handler. May be NULL. */
53 struct v4l2_ctrl_handler *ctrl_handler;
50}; 54};
51 55
52/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev. 56/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev.
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 02c6f4d11ed3..4a97d7341a94 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -35,6 +35,7 @@
35#define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 35#define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001
36 36
37struct v4l2_device; 37struct v4l2_device;
38struct v4l2_ctrl_handler;
38struct v4l2_subdev; 39struct v4l2_subdev;
39struct tuner_setup; 40struct tuner_setup;
40 41
@@ -90,10 +91,31 @@ struct v4l2_decode_vbi_line {
90 not yet implemented) since ops provide proper type-checking. 91 not yet implemented) since ops provide proper type-checking.
91 */ 92 */
92 93
94/* Subdevice external IO pin configuration */
95#define V4L2_SUBDEV_IO_PIN_DISABLE (1 << 0) /* ENABLE assumed */
96#define V4L2_SUBDEV_IO_PIN_OUTPUT (1 << 1)
97#define V4L2_SUBDEV_IO_PIN_INPUT (1 << 2)
98#define V4L2_SUBDEV_IO_PIN_SET_VALUE (1 << 3) /* Set output value */
99#define V4L2_SUBDEV_IO_PIN_ACTIVE_LOW (1 << 4) /* ACTIVE HIGH assumed */
100
101struct v4l2_subdev_io_pin_config {
102 u32 flags; /* V4L2_SUBDEV_IO_PIN_* flags for this pin's config */
103 u8 pin; /* Chip external IO pin to configure */
104 u8 function; /* Internal signal pad/function to route to IO pin */
105 u8 value; /* Initial value for pin - e.g. GPIO output value */
106 u8 strength; /* Pin drive strength */
107};
108
93/* s_config: if set, then it is always called by the v4l2_i2c_new_subdev* 109/* s_config: if set, then it is always called by the v4l2_i2c_new_subdev*
94 functions after the v4l2_subdev was registered. It is used to pass 110 functions after the v4l2_subdev was registered. It is used to pass
95 platform data to the subdev which can be used during initialization. 111 platform data to the subdev which can be used during initialization.
96 112
113 s_io_pin_config: configure one or more chip I/O pins for chips that
114 multiplex different internal signal pads out to IO pins. This function
115 takes a pointer to an array of 'n' pin configuration entries, one for
116 each pin being configured. This function could be called at times
117 other than just subdevice initialization.
118
97 init: initialize the sensor registors to some sort of reasonable default 119 init: initialize the sensor registors to some sort of reasonable default
98 values. Do not use for new drivers and should be removed in existing 120 values. Do not use for new drivers and should be removed in existing
99 drivers. 121 drivers.
@@ -110,11 +132,18 @@ struct v4l2_decode_vbi_line {
110 132
111 s_power: puts subdevice in power saving mode (on == 0) or normal operation 133 s_power: puts subdevice in power saving mode (on == 0) or normal operation
112 mode (on == 1). 134 mode (on == 1).
135
136 interrupt_service_routine: Called by the bridge chip's interrupt service
137 handler, when an interrupt status has be raised due to this subdev,
138 so that this subdev can handle the details. It may schedule work to be
139 performed later. It must not sleep. *Called from an IRQ context*.
113 */ 140 */
114struct v4l2_subdev_core_ops { 141struct v4l2_subdev_core_ops {
115 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 142 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
116 int (*log_status)(struct v4l2_subdev *sd); 143 int (*log_status)(struct v4l2_subdev *sd);
117 int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data); 144 int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data);
145 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n,
146 struct v4l2_subdev_io_pin_config *pincfg);
118 int (*init)(struct v4l2_subdev *sd, u32 val); 147 int (*init)(struct v4l2_subdev *sd, u32 val);
119 int (*load_fw)(struct v4l2_subdev *sd); 148 int (*load_fw)(struct v4l2_subdev *sd);
120 int (*reset)(struct v4l2_subdev *sd, u32 val); 149 int (*reset)(struct v4l2_subdev *sd, u32 val);
@@ -133,6 +162,8 @@ struct v4l2_subdev_core_ops {
133 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 162 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
134#endif 163#endif
135 int (*s_power)(struct v4l2_subdev *sd, int on); 164 int (*s_power)(struct v4l2_subdev *sd, int on);
165 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
166 u32 status, bool *handled);
136}; 167};
137 168
138/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. 169/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio.
@@ -307,11 +338,6 @@ struct v4l2_subdev_sensor_ops {
307}; 338};
308 339
309/* 340/*
310 interrupt_service_routine: Called by the bridge chip's interrupt service
311 handler, when an IR interrupt status has be raised due to this subdev,
312 so that this subdev can handle the details. It may schedule work to be
313 performed later. It must not sleep. *Called from an IRQ context*.
314
315 [rt]x_g_parameters: Get the current operating parameters and state of the 341 [rt]x_g_parameters: Get the current operating parameters and state of the
316 the IR receiver or transmitter. 342 the IR receiver or transmitter.
317 343
@@ -335,14 +361,9 @@ struct v4l2_subdev_sensor_ops {
335 */ 361 */
336 362
337enum v4l2_subdev_ir_mode { 363enum v4l2_subdev_ir_mode {
338 V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* space & mark widths in nanosecs */ 364 V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* uses struct ir_raw_event records */
339}; 365};
340 366
341/* Data format of data read or written for V4L2_SUBDEV_IR_MODE_PULSE_WIDTH */
342#define V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS 0x7fffffff
343#define V4L2_SUBDEV_IR_PULSE_LEVEL_MASK 0x80000000
344#define V4L2_SUBDEV_IR_PULSE_RX_SEQ_END 0xffffffff
345
346struct v4l2_subdev_ir_parameters { 367struct v4l2_subdev_ir_parameters {
347 /* Either Rx or Tx */ 368 /* Either Rx or Tx */
348 unsigned int bytes_per_data_element; /* of data in read or write call */ 369 unsigned int bytes_per_data_element; /* of data in read or write call */
@@ -356,7 +377,10 @@ struct v4l2_subdev_ir_parameters {
356 u32 max_pulse_width; /* ns, valid only for baseband signal */ 377 u32 max_pulse_width; /* ns, valid only for baseband signal */
357 unsigned int carrier_freq; /* Hz, valid only for modulated signal*/ 378 unsigned int carrier_freq; /* Hz, valid only for modulated signal*/
358 unsigned int duty_cycle; /* percent, valid only for modulated signal*/ 379 unsigned int duty_cycle; /* percent, valid only for modulated signal*/
359 bool invert; /* logically invert sense of mark/space */ 380 bool invert_level; /* invert signal level */
381
382 /* Tx only */
383 bool invert_carrier_sense; /* Send 0/space as a carrier burst */
360 384
361 /* Rx only */ 385 /* Rx only */
362 u32 noise_filter_min_width; /* ns, min time of a valid pulse */ 386 u32 noise_filter_min_width; /* ns, min time of a valid pulse */
@@ -366,10 +390,6 @@ struct v4l2_subdev_ir_parameters {
366}; 390};
367 391
368struct v4l2_subdev_ir_ops { 392struct v4l2_subdev_ir_ops {
369 /* Common to receiver and transmitter */
370 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
371 u32 status, bool *handled);
372
373 /* Receiver */ 393 /* Receiver */
374 int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count, 394 int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count,
375 ssize_t *num); 395 ssize_t *num);
@@ -415,6 +435,8 @@ struct v4l2_subdev {
415 u32 flags; 435 u32 flags;
416 struct v4l2_device *v4l2_dev; 436 struct v4l2_device *v4l2_dev;
417 const struct v4l2_subdev_ops *ops; 437 const struct v4l2_subdev_ops *ops;
438 /* The control handler of this subdev. May be NULL. */
439 struct v4l2_ctrl_handler *ctrl_handler;
418 /* name must be unique */ 440 /* name must be unique */
419 char name[V4L2_SUBDEV_NAME_SIZE]; 441 char name[V4L2_SUBDEV_NAME_SIZE];
420 /* can be used to group similar subdevs, value is driver-specific */ 442 /* can be used to group similar subdevs, value is driver-specific */
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index be51ae2bd0ff..4debb4514634 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -1,5 +1,20 @@
1/* 1/*
2 * Portions of MTD ABI definition which are shared by kernel and user space 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
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; either version 2 of the License, or
7 * (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
3 */ 18 */
4 19
5#ifndef __MTD_ABI_H__ 20#ifndef __MTD_ABI_H__
@@ -110,6 +125,7 @@ struct otp_info {
110#define MEMERASE64 _IOW('M', 20, struct erase_info_user64) 125#define MEMERASE64 _IOW('M', 20, struct erase_info_user64)
111#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64) 126#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64)
112#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64) 127#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64)
128#define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
113 129
114/* 130/*
115 * Obsolete legacy interface. Keep it in order not to break userspace 131 * Obsolete legacy interface. Keep it in order not to break userspace
diff --git a/include/mtd/mtd-user.h b/include/mtd/mtd-user.h
index 170ceca3b2d0..aa3c2f86a913 100644
--- a/include/mtd/mtd-user.h
+++ b/include/mtd/mtd-user.h
@@ -1,5 +1,20 @@
1/* 1/*
2 * MTD ABI header for use by user space only. 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
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; either version 2 of the License, or
7 * (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
3 */ 18 */
4 19
5#ifndef __MTD_USER_H__ 20#ifndef __MTD_USER_H__
diff --git a/include/mtd/nftl-user.h b/include/mtd/nftl-user.h
index 98e9e57f22de..bdeabd86ad99 100644
--- a/include/mtd/nftl-user.h
+++ b/include/mtd/nftl-user.h
@@ -1,5 +1,19 @@
1/* 1/*
2 * Parts of NFTL headers shared with userspace 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
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; either version 2 of the License, or
7 * (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3 * 17 *
4 */ 18 */
5 19
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
index 466a8320f1e6..c0d47ad4b103 100644
--- a/include/mtd/ubi-user.h
+++ b/include/mtd/ubi-user.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) International Business Machines Corp., 2006 2 * Copyright © International Business Machines Corp., 2006
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 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 5 * it under the terms of the GNU General Public License as published by
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index d870a918559c..d8ce278515c3 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -25,8 +25,10 @@ DECLARE_EVENT_CLASS(block_rq_with_error,
25 25
26 TP_fast_assign( 26 TP_fast_assign(
27 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 27 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
28 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); 28 __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
29 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); 29 0 : blk_rq_pos(rq);
30 __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
31 0 : blk_rq_sectors(rq);
30 __entry->errors = rq->errors; 32 __entry->errors = rq->errors;
31 33
32 blk_fill_rwbs_rq(__entry->rwbs, rq); 34 blk_fill_rwbs_rq(__entry->rwbs, rq);
@@ -109,9 +111,12 @@ DECLARE_EVENT_CLASS(block_rq,
109 111
110 TP_fast_assign( 112 TP_fast_assign(
111 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 113 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
112 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); 114 __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
113 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); 115 0 : blk_rq_pos(rq);
114 __entry->bytes = blk_pc_request(rq) ? blk_rq_bytes(rq) : 0; 116 __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
117 0 : blk_rq_sectors(rq);
118 __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
119 blk_rq_bytes(rq) : 0;
115 120
116 blk_fill_rwbs_rq(__entry->rwbs, rq); 121 blk_fill_rwbs_rq(__entry->rwbs, rq);
117 blk_dump_cmd(__get_str(cmd), rq); 122 blk_dump_cmd(__get_str(cmd), rq);
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
new file mode 100644
index 000000000000..f345f66ae9d1
--- /dev/null
+++ b/include/trace/events/writeback.h
@@ -0,0 +1,159 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM writeback
3
4#if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_WRITEBACK_H
6
7#include <linux/backing-dev.h>
8#include <linux/device.h>
9#include <linux/writeback.h>
10
11struct wb_writeback_work;
12
13DECLARE_EVENT_CLASS(writeback_work_class,
14 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
15 TP_ARGS(bdi, work),
16 TP_STRUCT__entry(
17 __array(char, name, 32)
18 __field(long, nr_pages)
19 __field(dev_t, sb_dev)
20 __field(int, sync_mode)
21 __field(int, for_kupdate)
22 __field(int, range_cyclic)
23 __field(int, for_background)
24 ),
25 TP_fast_assign(
26 strncpy(__entry->name, dev_name(bdi->dev), 32);
27 __entry->nr_pages = work->nr_pages;
28 __entry->sb_dev = work->sb ? work->sb->s_dev : 0;
29 __entry->sync_mode = work->sync_mode;
30 __entry->for_kupdate = work->for_kupdate;
31 __entry->range_cyclic = work->range_cyclic;
32 __entry->for_background = work->for_background;
33 ),
34 TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
35 "kupdate=%d range_cyclic=%d background=%d",
36 __entry->name,
37 MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev),
38 __entry->nr_pages,
39 __entry->sync_mode,
40 __entry->for_kupdate,
41 __entry->range_cyclic,
42 __entry->for_background
43 )
44);
45#define DEFINE_WRITEBACK_WORK_EVENT(name) \
46DEFINE_EVENT(writeback_work_class, name, \
47 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
48 TP_ARGS(bdi, work))
49DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread);
50DEFINE_WRITEBACK_WORK_EVENT(writeback_queue);
51DEFINE_WRITEBACK_WORK_EVENT(writeback_exec);
52
53TRACE_EVENT(writeback_pages_written,
54 TP_PROTO(long pages_written),
55 TP_ARGS(pages_written),
56 TP_STRUCT__entry(
57 __field(long, pages)
58 ),
59 TP_fast_assign(
60 __entry->pages = pages_written;
61 ),
62 TP_printk("%ld", __entry->pages)
63);
64
65DECLARE_EVENT_CLASS(writeback_class,
66 TP_PROTO(struct backing_dev_info *bdi),
67 TP_ARGS(bdi),
68 TP_STRUCT__entry(
69 __array(char, name, 32)
70 ),
71 TP_fast_assign(
72 strncpy(__entry->name, dev_name(bdi->dev), 32);
73 ),
74 TP_printk("bdi %s",
75 __entry->name
76 )
77);
78#define DEFINE_WRITEBACK_EVENT(name) \
79DEFINE_EVENT(writeback_class, name, \
80 TP_PROTO(struct backing_dev_info *bdi), \
81 TP_ARGS(bdi))
82
83DEFINE_WRITEBACK_EVENT(writeback_nowork);
84DEFINE_WRITEBACK_EVENT(writeback_wake_thread);
85DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread);
86DEFINE_WRITEBACK_EVENT(writeback_bdi_register);
87DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister);
88DEFINE_WRITEBACK_EVENT(writeback_thread_start);
89DEFINE_WRITEBACK_EVENT(writeback_thread_stop);
90
91DECLARE_EVENT_CLASS(wbc_class,
92 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
93 TP_ARGS(wbc, bdi),
94 TP_STRUCT__entry(
95 __array(char, name, 32)
96 __field(long, nr_to_write)
97 __field(long, pages_skipped)
98 __field(int, sync_mode)
99 __field(int, nonblocking)
100 __field(int, encountered_congestion)
101 __field(int, for_kupdate)
102 __field(int, for_background)
103 __field(int, for_reclaim)
104 __field(int, range_cyclic)
105 __field(int, more_io)
106 __field(unsigned long, older_than_this)
107 __field(long, range_start)
108 __field(long, range_end)
109 ),
110
111 TP_fast_assign(
112 strncpy(__entry->name, dev_name(bdi->dev), 32);
113 __entry->nr_to_write = wbc->nr_to_write;
114 __entry->pages_skipped = wbc->pages_skipped;
115 __entry->sync_mode = wbc->sync_mode;
116 __entry->for_kupdate = wbc->for_kupdate;
117 __entry->for_background = wbc->for_background;
118 __entry->for_reclaim = wbc->for_reclaim;
119 __entry->range_cyclic = wbc->range_cyclic;
120 __entry->more_io = wbc->more_io;
121 __entry->older_than_this = wbc->older_than_this ?
122 *wbc->older_than_this : 0;
123 __entry->range_start = (long)wbc->range_start;
124 __entry->range_end = (long)wbc->range_end;
125 ),
126
127 TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d "
128 "bgrd=%d reclm=%d cyclic=%d more=%d older=0x%lx "
129 "start=0x%lx end=0x%lx",
130 __entry->name,
131 __entry->nr_to_write,
132 __entry->pages_skipped,
133 __entry->sync_mode,
134 __entry->for_kupdate,
135 __entry->for_background,
136 __entry->for_reclaim,
137 __entry->range_cyclic,
138 __entry->more_io,
139 __entry->older_than_this,
140 __entry->range_start,
141 __entry->range_end)
142)
143
144#define DEFINE_WBC_EVENT(name) \
145DEFINE_EVENT(wbc_class, name, \
146 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
147 TP_ARGS(wbc, bdi))
148DEFINE_WBC_EVENT(wbc_writeback_start);
149DEFINE_WBC_EVENT(wbc_writeback_written);
150DEFINE_WBC_EVENT(wbc_writeback_wait);
151DEFINE_WBC_EVENT(wbc_balance_dirty_start);
152DEFINE_WBC_EVENT(wbc_balance_dirty_written);
153DEFINE_WBC_EVENT(wbc_balance_dirty_wait);
154DEFINE_WBC_EVENT(wbc_writepage);
155
156#endif /* _TRACE_WRITEBACK_H */
157
158/* This part must be outside protection */
159#include <trace/define_trace.h>