aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2006-04-02 00:08:05 -0500
committerDmitry Torokhov <dtor_core@ameritech.net>2006-04-02 00:08:05 -0500
commit95d465fd750897ab32462a6702fbfe1b122cbbc0 (patch)
tree65c38b2f11c51bb6932e44dd6c92f15b0091abfe /include/linux
parent642fde17dceceb56c7ba2762733ac688666ae657 (diff)
parent683aa4012f53b2ada0f430487e05d37b0d94e90a (diff)
Manual merge with Linus.
Conflicts: arch/powerpc/kernel/setup-common.c drivers/input/keyboard/hil_kbd.c drivers/input/mouse/hil_ptr.c
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/adb.h2
-rw-r--r--include/linux/amba/clcd.h12
-rw-r--r--include/linux/amba/serial.h6
-rw-r--r--include/linux/arcdevice.h9
-rw-r--r--include/linux/ata.h29
-rw-r--r--include/linux/audit.h130
-rw-r--r--include/linux/auto_fs4.h51
-rw-r--r--include/linux/backlight.h25
-rw-r--r--include/linux/bitmap.h3
-rw-r--r--include/linux/bitops.h131
-rw-r--r--include/linux/blkdev.h33
-rw-r--r--include/linux/blktrace_api.h277
-rw-r--r--include/linux/bootmem.h4
-rw-r--r--include/linux/buffer_head.h26
-rw-r--r--include/linux/cache.h4
-rw-r--r--include/linux/capability.h3
-rw-r--r--include/linux/cdev.h4
-rw-r--r--include/linux/cdrom.h5
-rw-r--r--include/linux/clk.h4
-rw-r--r--include/linux/coda_linux.h6
-rw-r--r--include/linux/compat.h46
-rw-r--r--include/linux/compat_ioctl.h6
-rw-r--r--include/linux/cpu.h3
-rw-r--r--include/linux/cpumask.h51
-rw-r--r--include/linux/cpuset.h29
-rw-r--r--include/linux/crash_dump.h2
-rw-r--r--include/linux/crypto.h10
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/dccp.h132
-rw-r--r--include/linux/debugfs.h17
-rw-r--r--include/linux/device-mapper.h1
-rw-r--r--include/linux/device.h5
-rw-r--r--include/linux/dio.h32
-rw-r--r--include/linux/dm-ioctl.h17
-rw-r--r--include/linux/dma-mapping.h2
-rw-r--r--include/linux/dmi.h2
-rw-r--r--include/linux/dn.h44
-rw-r--r--include/linux/dvb/audio.h13
-rw-r--r--include/linux/dvb/video.h13
-rw-r--r--include/linux/efi.h20
-rw-r--r--include/linux/efs_fs.h2
-rw-r--r--include/linux/elevator.h10
-rw-r--r--include/linux/eventpoll.h8
-rw-r--r--include/linux/ext3_fs.h18
-rw-r--r--include/linux/ext3_fs_i.h7
-rw-r--r--include/linux/fb.h4
-rw-r--r--include/linux/file.h28
-rw-r--r--include/linux/fs.h135
-rw-r--r--include/linux/fsl_devices.h27
-rw-r--r--include/linux/fsnotify.h33
-rw-r--r--include/linux/futex.h89
-rw-r--r--include/linux/gameport.h4
-rw-r--r--include/linux/generic_serial.h4
-rw-r--r--include/linux/genhd.h29
-rw-r--r--include/linux/gigaset_dev.h32
-rw-r--r--include/linux/highmem.h12
-rw-r--r--include/linux/hpet.h36
-rw-r--r--include/linux/hrtimer.h57
-rw-r--r--include/linux/hugetlb.h47
-rw-r--r--include/linux/hwmon-sysfs.h24
-rw-r--r--include/linux/i2c-id.h6
-rw-r--r--include/linux/i2c.h6
-rw-r--r--include/linux/i2o.h4
-rw-r--r--include/linux/icmpv6.h11
-rw-r--r--include/linux/ide.h1
-rw-r--r--include/linux/if.h29
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init.h4
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/inotify.h11
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/ipmi.h3
-rw-r--r--include/linux/ipmi_msgdefs.h1
-rw-r--r--include/linux/ipmi_smi.h63
-rw-r--r--include/linux/ipv6.h14
-rw-r--r--include/linux/ipv6_route.h10
-rw-r--r--include/linux/irda.h1
-rw-r--r--include/linux/irq.h49
-rw-r--r--include/linux/jbd.h13
-rw-r--r--include/linux/kernel.h10
-rw-r--r--include/linux/kernel_stat.h2
-rw-r--r--include/linux/kobj_map.h4
-rw-r--r--include/linux/kobject.h4
-rw-r--r--include/linux/kprobes.h3
-rw-r--r--include/linux/ktime.h20
-rw-r--r--include/linux/leds.h111
-rw-r--r--include/linux/libata.h205
-rw-r--r--include/linux/linkage.h16
-rw-r--r--include/linux/list.h24
-rw-r--r--include/linux/lockd/lockd.h27
-rw-r--r--include/linux/lockd/share.h2
-rw-r--r--include/linux/lockd/xdr.h1
-rw-r--r--include/linux/loop.h3
-rw-r--r--include/linux/m48t86.h16
-rw-r--r--include/linux/major.h1
-rw-r--r--include/linux/memory.h1
-rw-r--r--include/linux/mempolicy.h5
-rw-r--r--include/linux/mempool.h38
-rw-r--r--include/linux/migrate.h39
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/mm.h48
-rw-r--r--include/linux/mm_inline.h2
-rw-r--r--include/linux/mmzone.h91
-rw-r--r--include/linux/module.h30
-rw-r--r--include/linux/moduleparam.h7
-rw-r--r--include/linux/msdos_fs.h12
-rw-r--r--include/linux/mtd/blktrans.h4
-rw-r--r--include/linux/mtd/doc2000.h4
-rw-r--r--include/linux/mtd/inftl.h5
-rw-r--r--include/linux/mv643xx.h27
-rw-r--r--include/linux/namei.h1
-rw-r--r--include/linux/nbd.h3
-rw-r--r--include/linux/ncp_fs.h4
-rw-r--r--include/linux/ncp_fs_i.h2
-rw-r--r--include/linux/ncp_fs_sb.h5
-rw-r--r--include/linux/net.h10
-rw-r--r--include/linux/netdevice.h94
-rw-r--r--include/linux/netfilter.h9
-rw-r--r--include/linux/netfilter/nfnetlink.h1
-rw-r--r--include/linux/netfilter/nfnetlink_log.h6
-rw-r--r--include/linux/netfilter/x_tables.h101
-rw-r--r--include/linux/netfilter/xt_policy.h58
-rw-r--r--include/linux/netfilter_arp/arp_tables.h37
-rw-r--r--include/linux/netfilter_bridge.h27
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h19
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h30
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h70
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h69
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h69
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h69
-rw-r--r--include/linux/netlink.h1
-rw-r--r--include/linux/nfs_fs.h106
-rw-r--r--include/linux/nfs_fs_i.h8
-rw-r--r--include/linux/nfs_fs_sb.h6
-rw-r--r--include/linux/nfs_xdr.h5
-rw-r--r--include/linux/nfsd/export.h29
-rw-r--r--include/linux/nodemask.h4
-rw-r--r--include/linux/notifier.h96
-rw-r--r--include/linux/oprofile.h14
-rw-r--r--include/linux/page-flags.h24
-rw-r--r--include/linux/pagemap.h9
-rw-r--r--include/linux/pci.h12
-rw-r--r--include/linux/pci_ids.h16
-rw-r--r--include/linux/pfn.h9
-rw-r--r--include/linux/pid.h98
-rw-r--r--include/linux/pipe_fs_i.h8
-rw-r--r--include/linux/platform.h43
-rw-r--r--include/linux/pm.h3
-rw-r--r--include/linux/poll.h17
-rw-r--r--include/linux/ppdev.h2
-rw-r--r--include/linux/proc_fs.h15
-rw-r--r--include/linux/profile.h2
-rw-r--r--include/linux/qnx4_fs.h4
-rw-r--r--include/linux/quota.h8
-rw-r--r--include/linux/radix-tree.h13
-rw-r--r--include/linux/raid/md.h3
-rw-r--r--include/linux/raid/md_k.h21
-rw-r--r--include/linux/raid/md_p.h32
-rw-r--r--include/linux/raid/raid1.h2
-rw-r--r--include/linux/raid/raid5.h25
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/rcupdate.h2
-rw-r--r--include/linux/reiserfs_fs.h9
-rw-r--r--include/linux/reiserfs_xattr.h6
-rw-r--r--include/linux/relay.h (renamed from include/linux/relayfs_fs.h)44
-rw-r--r--include/linux/rtc.h96
-rw-r--r--include/linux/rtnetlink.h27
-rw-r--r--include/linux/sched.h85
-rw-r--r--include/linux/security.h80
-rw-r--r--include/linux/seq_file.h4
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/serial_core.h6
-rw-r--r--include/linux/serio.h6
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/skbuff.h76
-rw-r--r--include/linux/slab.h43
-rw-r--r--include/linux/smp.h29
-rw-r--r--include/linux/socket.h1
-rw-r--r--include/linux/sound.h12
-rw-r--r--include/linux/stat.h2
-rw-r--r--include/linux/statfs.h10
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/sunrpc/cache.h145
-rw-r--r--include/linux/sunrpc/clnt.h20
-rw-r--r--include/linux/sunrpc/gss_krb5.h2
-rw-r--r--include/linux/sunrpc/metrics.h77
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--include/linux/sunrpc/sched.h9
-rw-r--r--include/linux/sunrpc/stats.h4
-rw-r--r--include/linux/sunrpc/svcauth.h12
-rw-r--r--include/linux/sunrpc/svcsock.h2
-rw-r--r--include/linux/sunrpc/xprt.h13
-rw-r--r--include/linux/swap.h43
-rw-r--r--include/linux/synclink.h11
-rw-r--r--include/linux/syscalls.h5
-rw-r--r--include/linux/sysctl.h27
-rw-r--r--include/linux/tcp.h6
-rw-r--r--include/linux/threads.h3
-rw-r--r--include/linux/time.h19
-rw-r--r--include/linux/timer.h17
-rw-r--r--include/linux/timex.h43
-rw-r--r--include/linux/tiocl.h1
-rw-r--r--include/linux/topology.h9
-rw-r--r--include/linux/tty.h8
-rw-r--r--include/linux/tty_flip.h16
-rw-r--r--include/linux/types.h4
-rw-r--r--include/linux/udf_fs_i.h21
-rw-r--r--include/linux/udf_fs_sb.h4
-rw-r--r--include/linux/ufs_fs.h4
-rw-r--r--include/linux/usb.h4
-rw-r--r--include/linux/usb_gadget.h7
-rw-r--r--include/linux/videodev2.h87
-rw-r--r--include/linux/vt_kern.h5
-rw-r--r--include/linux/wireless.h10
-rw-r--r--include/linux/workqueue.h6
-rw-r--r--include/linux/writeback.h14
-rw-r--r--include/linux/x1205.h31
-rw-r--r--include/linux/x25.h26
-rw-r--r--include/linux/xfrm.h30
-rw-r--r--include/linux/zorro.h33
223 files changed, 3508 insertions, 1963 deletions
diff --git a/include/linux/adb.h b/include/linux/adb.h
index e9fdc63483c7..b7305b178279 100644
--- a/include/linux/adb.h
+++ b/include/linux/adb.h
@@ -85,7 +85,7 @@ enum adb_message {
85 ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */ 85 ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */
86}; 86};
87extern struct adb_driver *adb_controller; 87extern struct adb_driver *adb_controller;
88extern struct notifier_block *adb_client_list; 88extern struct blocking_notifier_head adb_client_list;
89 89
90int adb_request(struct adb_request *req, void (*done)(struct adb_request *), 90int adb_request(struct adb_request *req, void (*done)(struct adb_request *),
91 int flags, int nbytes, ...); 91 int flags, int nbytes, ...);
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h
index 6b8d73dc1ab0..9cf64b1b688b 100644
--- a/include/linux/amba/clcd.h
+++ b/include/linux/amba/clcd.h
@@ -54,6 +54,7 @@
54#define CNTL_LCDBPP4 (2 << 1) 54#define CNTL_LCDBPP4 (2 << 1)
55#define CNTL_LCDBPP8 (3 << 1) 55#define CNTL_LCDBPP8 (3 << 1)
56#define CNTL_LCDBPP16 (4 << 1) 56#define CNTL_LCDBPP16 (4 << 1)
57#define CNTL_LCDBPP16_565 (6 << 1)
57#define CNTL_LCDBPP24 (5 << 1) 58#define CNTL_LCDBPP24 (5 << 1)
58#define CNTL_LCDBW (1 << 4) 59#define CNTL_LCDBW (1 << 4)
59#define CNTL_LCDTFT (1 << 5) 60#define CNTL_LCDTFT (1 << 5)
@@ -209,7 +210,16 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
209 val |= CNTL_LCDBPP8; 210 val |= CNTL_LCDBPP8;
210 break; 211 break;
211 case 16: 212 case 16:
212 val |= CNTL_LCDBPP16; 213 /*
214 * PL110 cannot choose between 5551 and 565 modes in
215 * its control register
216 */
217 if ((fb->dev->periphid & 0x000fffff) == 0x00041110)
218 val |= CNTL_LCDBPP16;
219 else if (fb->fb.var.green.length == 5)
220 val |= CNTL_LCDBPP16;
221 else
222 val |= CNTL_LCDBPP16_565;
213 break; 223 break;
214 case 32: 224 case 32:
215 val |= CNTL_LCDBPP24; 225 val |= CNTL_LCDBPP24;
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index dc726ffccebd..48ee32a18ac5 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -158,4 +158,10 @@
158#define UART01x_RSR_ANY (UART01x_RSR_OE|UART01x_RSR_BE|UART01x_RSR_PE|UART01x_RSR_FE) 158#define UART01x_RSR_ANY (UART01x_RSR_OE|UART01x_RSR_BE|UART01x_RSR_PE|UART01x_RSR_FE)
159#define UART01x_FR_MODEM_ANY (UART01x_FR_DCD|UART01x_FR_DSR|UART01x_FR_CTS) 159#define UART01x_FR_MODEM_ANY (UART01x_FR_DCD|UART01x_FR_DSR|UART01x_FR_CTS)
160 160
161#ifndef __ASSEMBLY__
162struct amba_pl010_data {
163 void (*set_mctrl)(struct amba_device *dev, void __iomem *base, unsigned int mctrl);
164};
165#endif
166
161#endif 167#endif
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index 7198f129e135..231ba090ae34 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -206,7 +206,6 @@ struct ArcProto {
206 206
207extern struct ArcProto *arc_proto_map[256], *arc_proto_default, 207extern struct ArcProto *arc_proto_map[256], *arc_proto_default,
208 *arc_bcast_proto, *arc_raw_proto; 208 *arc_bcast_proto, *arc_raw_proto;
209extern struct ArcProto arc_proto_null;
210 209
211 210
212/* 211/*
@@ -334,17 +333,9 @@ void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
334#define arcnet_dump_skb(dev,skb,desc) ; 333#define arcnet_dump_skb(dev,skb,desc) ;
335#endif 334#endif
336 335
337#if (ARCNET_DEBUG_MAX & D_RX) || (ARCNET_DEBUG_MAX & D_TX)
338void arcnet_dump_packet(struct net_device *dev, int bufnum, char *desc,
339 int take_arcnet_lock);
340#else
341#define arcnet_dump_packet(dev, bufnum, desc,take_arcnet_lock) ;
342#endif
343
344void arcnet_unregister_proto(struct ArcProto *proto); 336void arcnet_unregister_proto(struct ArcProto *proto);
345irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs); 337irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs);
346struct net_device *alloc_arcdev(char *name); 338struct net_device *alloc_arcdev(char *name);
347void arcnet_rx(struct net_device *dev, int bufnum);
348 339
349#endif /* __KERNEL__ */ 340#endif /* __KERNEL__ */
350#endif /* _LINUX_ARCDEVICE_H */ 341#endif /* _LINUX_ARCDEVICE_H */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 94f77cce27fa..312a2c0c64e6 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -146,6 +146,8 @@ enum {
146 ATA_CMD_STANDBYNOW1 = 0xE0, 146 ATA_CMD_STANDBYNOW1 = 0xE0,
147 ATA_CMD_IDLEIMMEDIATE = 0xE1, 147 ATA_CMD_IDLEIMMEDIATE = 0xE1,
148 ATA_CMD_INIT_DEV_PARAMS = 0x91, 148 ATA_CMD_INIT_DEV_PARAMS = 0x91,
149 ATA_CMD_READ_NATIVE_MAX = 0xF8,
150 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
149 151
150 /* SETFEATURES stuff */ 152 /* SETFEATURES stuff */
151 SETFEATURES_XFER = 0x03, 153 SETFEATURES_XFER = 0x03,
@@ -204,7 +206,6 @@ enum ata_tf_protocols {
204 ATA_PROT_UNKNOWN, /* unknown/invalid */ 206 ATA_PROT_UNKNOWN, /* unknown/invalid */
205 ATA_PROT_NODATA, /* no data */ 207 ATA_PROT_NODATA, /* no data */
206 ATA_PROT_PIO, /* PIO single sector */ 208 ATA_PROT_PIO, /* PIO single sector */
207 ATA_PROT_PIO_MULT, /* PIO multiple sector */
208 ATA_PROT_DMA, /* DMA */ 209 ATA_PROT_DMA, /* DMA */
209 ATA_PROT_ATAPI, /* packet command, PIO data xfer*/ 210 ATA_PROT_ATAPI, /* packet command, PIO data xfer*/
210 ATA_PROT_ATAPI_NODATA, /* packet command, no data */ 211 ATA_PROT_ATAPI_NODATA, /* packet command, no data */
@@ -247,18 +248,22 @@ struct ata_taskfile {
247}; 248};
248 249
249#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 250#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
251#define ata_id_is_cfa(id) ((id)[0] == 0x848A)
250#define ata_id_is_sata(id) ((id)[93] == 0) 252#define ata_id_is_sata(id) ((id)[93] == 0)
251#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) 253#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
252#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) 254#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
255#define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10))
253#define ata_id_has_fua(id) ((id)[84] & (1 << 6)) 256#define ata_id_has_fua(id) ((id)[84] & (1 << 6))
254#define ata_id_has_flush(id) ((id)[83] & (1 << 12)) 257#define ata_id_has_flush(id) ((id)[83] & (1 << 12))
255#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13)) 258#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
256#define ata_id_has_lba48(id) ((id)[83] & (1 << 10)) 259#define ata_id_has_lba48(id) ((id)[83] & (1 << 10))
260#define ata_id_has_hpa(id) ((id)[82] & (1 << 10))
257#define ata_id_has_wcache(id) ((id)[82] & (1 << 5)) 261#define ata_id_has_wcache(id) ((id)[82] & (1 << 5))
258#define ata_id_has_pm(id) ((id)[82] & (1 << 3)) 262#define ata_id_has_pm(id) ((id)[82] & (1 << 3))
259#define ata_id_has_lba(id) ((id)[49] & (1 << 9)) 263#define ata_id_has_lba(id) ((id)[49] & (1 << 9))
260#define ata_id_has_dma(id) ((id)[49] & (1 << 8)) 264#define ata_id_has_dma(id) ((id)[49] & (1 << 8))
261#define ata_id_removeable(id) ((id)[0] & (1 << 7)) 265#define ata_id_removeable(id) ((id)[0] & (1 << 7))
266#define ata_id_has_dword_io(id) ((id)[50] & (1 << 0))
262#define ata_id_u32(id,n) \ 267#define ata_id_u32(id,n) \
263 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) 268 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
264#define ata_id_u64(id,n) \ 269#define ata_id_u64(id,n) \
@@ -267,6 +272,16 @@ struct ata_taskfile {
267 ((u64) (id)[(n) + 1] << 16) | \ 272 ((u64) (id)[(n) + 1] << 16) | \
268 ((u64) (id)[(n) + 0]) ) 273 ((u64) (id)[(n) + 0]) )
269 274
275static inline unsigned int ata_id_major_version(const u16 *id)
276{
277 unsigned int mver;
278
279 for (mver = 14; mver >= 1; mver--)
280 if (id[ATA_ID_MAJOR_VER] & (1 << mver))
281 break;
282 return mver;
283}
284
270static inline int ata_id_current_chs_valid(const u16 *id) 285static inline int ata_id_current_chs_valid(const u16 *id)
271{ 286{
272 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 287 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -302,4 +317,16 @@ static inline int ata_ok(u8 status)
302 == ATA_DRDY); 317 == ATA_DRDY);
303} 318}
304 319
320static inline int lba_28_ok(u64 block, u32 n_block)
321{
322 /* check the ending block number */
323 return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256);
324}
325
326static inline int lba_48_ok(u64 block, u32 n_block)
327{
328 /* check the ending block number */
329 return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536);
330}
331
305#endif /* __LINUX_ATA_H__ */ 332#endif /* __LINUX_ATA_H__ */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index da3c01955f3d..1c47c59058c1 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -33,27 +33,42 @@
33 * 1200 - 1299 messages internal to the audit daemon 33 * 1200 - 1299 messages internal to the audit daemon
34 * 1300 - 1399 audit event messages 34 * 1300 - 1399 audit event messages
35 * 1400 - 1499 SE Linux use 35 * 1400 - 1499 SE Linux use
36 * 1500 - 1999 future use 36 * 1500 - 1599 kernel LSPP events
37 * 2000 is for otherwise unclassified kernel audit messages 37 * 1600 - 1699 kernel crypto events
38 * 1700 - 1799 kernel anomaly records
39 * 1800 - 1999 future kernel use (maybe integrity labels and related events)
40 * 2000 is for otherwise unclassified kernel audit messages (legacy)
41 * 2001 - 2099 unused (kernel)
42 * 2100 - 2199 user space anomaly records
43 * 2200 - 2299 user space actions taken in response to anomalies
44 * 2300 - 2399 user space generated LSPP events
45 * 2400 - 2499 user space crypto events
46 * 2500 - 2999 future user space (maybe integrity labels and related events)
38 * 47 *
39 * Messages from 1000-1199 are bi-directional. 1200-1299 are exclusively user 48 * Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are
40 * space. Anything over that is kernel --> user space communication. 49 * exclusively user space. 1300-2099 is kernel --> user space
50 * communication.
41 */ 51 */
42#define AUDIT_GET 1000 /* Get status */ 52#define AUDIT_GET 1000 /* Get status */
43#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ 53#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */
44#define AUDIT_LIST 1002 /* List syscall filtering rules */ 54#define AUDIT_LIST 1002 /* List syscall rules -- deprecated */
45#define AUDIT_ADD 1003 /* Add syscall filtering rule */ 55#define AUDIT_ADD 1003 /* Add syscall rule -- deprecated */
46#define AUDIT_DEL 1004 /* Delete syscall filtering rule */ 56#define AUDIT_DEL 1004 /* Delete syscall rule -- deprecated */
47#define AUDIT_USER 1005 /* Message from userspace -- deprecated */ 57#define AUDIT_USER 1005 /* Message from userspace -- deprecated */
48#define AUDIT_LOGIN 1006 /* Define the login id and information */ 58#define AUDIT_LOGIN 1006 /* Define the login id and information */
49#define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */ 59#define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */
50#define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */ 60#define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */
51#define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */ 61#define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */
52#define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */ 62#define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */
63#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */
64#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */
65#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */
53 66
54#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ 67#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
55#define AUDIT_USER_AVC 1107 /* We filter this differently */ 68#define AUDIT_USER_AVC 1107 /* We filter this differently */
56#define AUDIT_LAST_USER_MSG 1199 69#define AUDIT_LAST_USER_MSG 1199
70#define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */
71#define AUDIT_LAST_USER_MSG2 2999
57 72
58#define AUDIT_DAEMON_START 1200 /* Daemon startup record */ 73#define AUDIT_DAEMON_START 1200 /* Daemon startup record */
59#define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */ 74#define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */
@@ -72,6 +87,13 @@
72#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 87#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
73#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 88#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
74#define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */ 89#define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */
90#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */
91#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */
92#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */
93
94#define AUDIT_FIRST_KERN_ANOM_MSG 1700
95#define AUDIT_LAST_KERN_ANOM_MSG 1799
96#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */
75 97
76#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ 98#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */
77 99
@@ -81,8 +103,9 @@
81#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */ 103#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */
82#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */ 104#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */
83#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */ 105#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */
106#define AUDIT_FILTER_TYPE 0x05 /* Apply rule at audit_log_start */
84 107
85#define AUDIT_NR_FILTERS 5 108#define AUDIT_NR_FILTERS 6
86 109
87#define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */ 110#define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */
88 111
@@ -98,6 +121,13 @@
98#define AUDIT_WORD(nr) ((__u32)((nr)/32)) 121#define AUDIT_WORD(nr) ((__u32)((nr)/32))
99#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) 122#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32))
100 123
124/* This bitmask is used to validate user input. It represents all bits that
125 * are currently used in an audit field constant understood by the kernel.
126 * If you are adding a new #define AUDIT_<whatever>, please ensure that
127 * AUDIT_UNUSED_BITS is updated if need be. */
128#define AUDIT_UNUSED_BITS 0x0FFFFC00
129
130
101/* Rule fields */ 131/* Rule fields */
102 /* These are useful when checking the 132 /* These are useful when checking the
103 * task structure at task creation time 133 * task structure at task creation time
@@ -114,6 +144,7 @@
114#define AUDIT_LOGINUID 9 144#define AUDIT_LOGINUID 9
115#define AUDIT_PERS 10 145#define AUDIT_PERS 10
116#define AUDIT_ARCH 11 146#define AUDIT_ARCH 11
147#define AUDIT_MSGTYPE 12
117 148
118 /* These are ONLY useful when checking 149 /* These are ONLY useful when checking
119 * at syscall exit time (AUDIT_AT_EXIT). */ 150 * at syscall exit time (AUDIT_AT_EXIT). */
@@ -128,8 +159,28 @@
128#define AUDIT_ARG2 (AUDIT_ARG0+2) 159#define AUDIT_ARG2 (AUDIT_ARG0+2)
129#define AUDIT_ARG3 (AUDIT_ARG0+3) 160#define AUDIT_ARG3 (AUDIT_ARG0+3)
130 161
131#define AUDIT_NEGATE 0x80000000 162#define AUDIT_NEGATE 0x80000000
132 163
164/* These are the supported operators.
165 * 4 2 1
166 * = > <
167 * -------
168 * 0 0 0 0 nonsense
169 * 0 0 1 1 <
170 * 0 1 0 2 >
171 * 0 1 1 3 !=
172 * 1 0 0 4 =
173 * 1 0 1 5 <=
174 * 1 1 0 6 >=
175 * 1 1 1 7 all operators
176 */
177#define AUDIT_LESS_THAN 0x10000000
178#define AUDIT_GREATER_THAN 0x20000000
179#define AUDIT_NOT_EQUAL 0x30000000
180#define AUDIT_EQUAL 0x40000000
181#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL)
182#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL)
183#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL)
133 184
134/* Status symbols */ 185/* Status symbols */
135 /* Mask values */ 186 /* Mask values */
@@ -186,6 +237,26 @@ struct audit_status {
186 __u32 backlog; /* messages waiting in queue */ 237 __u32 backlog; /* messages waiting in queue */
187}; 238};
188 239
240/* audit_rule_data supports filter rules with both integer and string
241 * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and
242 * AUDIT_LIST_RULES requests.
243 */
244struct audit_rule_data {
245 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
246 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
247 __u32 field_count;
248 __u32 mask[AUDIT_BITMASK_SIZE]; /* syscall(s) affected */
249 __u32 fields[AUDIT_MAX_FIELDS];
250 __u32 values[AUDIT_MAX_FIELDS];
251 __u32 fieldflags[AUDIT_MAX_FIELDS];
252 __u32 buflen; /* total length of string fields */
253 char buf[0]; /* string fields buffer */
254};
255
256/* audit_rule is supported to maintain backward compatibility with
257 * userspace. It supports integer fields only and corresponds to
258 * AUDIT_ADD, AUDIT_DEL and AUDIT_LIST requests.
259 */
189struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */ 260struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */
190 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */ 261 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
191 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */ 262 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
@@ -222,22 +293,33 @@ extern void audit_syscall_entry(struct task_struct *task, int arch,
222extern void audit_syscall_exit(struct task_struct *task, int failed, long return_code); 293extern void audit_syscall_exit(struct task_struct *task, int failed, long return_code);
223extern void audit_getname(const char *name); 294extern void audit_getname(const char *name);
224extern void audit_putname(const char *name); 295extern void audit_putname(const char *name);
225extern void audit_inode(const char *name, const struct inode *inode, unsigned flags); 296extern void __audit_inode(const char *name, const struct inode *inode, unsigned flags);
297extern void __audit_inode_child(const char *dname, const struct inode *inode,
298 unsigned long pino);
299static inline void audit_inode(const char *name, const struct inode *inode,
300 unsigned flags) {
301 if (unlikely(current->audit_context))
302 __audit_inode(name, inode, flags);
303}
304static inline void audit_inode_child(const char *dname,
305 const struct inode *inode,
306 unsigned long pino) {
307 if (unlikely(current->audit_context))
308 __audit_inode_child(dname, inode, pino);
309}
226 310
227 /* Private API (for audit.c only) */ 311 /* Private API (for audit.c only) */
228extern int audit_receive_filter(int type, int pid, int uid, int seq,
229 void *data, uid_t loginuid);
230extern unsigned int audit_serial(void); 312extern unsigned int audit_serial(void);
231extern void auditsc_get_stamp(struct audit_context *ctx, 313extern void auditsc_get_stamp(struct audit_context *ctx,
232 struct timespec *t, unsigned int *serial); 314 struct timespec *t, unsigned int *serial);
233extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); 315extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
234extern uid_t audit_get_loginuid(struct audit_context *ctx); 316extern uid_t audit_get_loginuid(struct audit_context *ctx);
235extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 317extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode, struct kern_ipc_perm *ipcp);
236extern int audit_socketcall(int nargs, unsigned long *args); 318extern int audit_socketcall(int nargs, unsigned long *args);
237extern int audit_sockaddr(int len, void *addr); 319extern int audit_sockaddr(int len, void *addr);
238extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt); 320extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt);
239extern void audit_signal_info(int sig, struct task_struct *t); 321extern void audit_signal_info(int sig, struct task_struct *t);
240extern int audit_filter_user(struct netlink_skb_parms *cb, int type); 322extern int audit_set_macxattr(const char *name);
241#else 323#else
242#define audit_alloc(t) ({ 0; }) 324#define audit_alloc(t) ({ 0; })
243#define audit_free(t) do { ; } while (0) 325#define audit_free(t) do { ; } while (0)
@@ -245,16 +327,18 @@ extern int audit_filter_user(struct netlink_skb_parms *cb, int type);
245#define audit_syscall_exit(t,f,r) do { ; } while (0) 327#define audit_syscall_exit(t,f,r) do { ; } while (0)
246#define audit_getname(n) do { ; } while (0) 328#define audit_getname(n) do { ; } while (0)
247#define audit_putname(n) do { ; } while (0) 329#define audit_putname(n) do { ; } while (0)
330#define __audit_inode(n,i,f) do { ; } while (0)
331#define __audit_inode_child(d,i,p) do { ; } while (0)
248#define audit_inode(n,i,f) do { ; } while (0) 332#define audit_inode(n,i,f) do { ; } while (0)
249#define audit_receive_filter(t,p,u,s,d,l) ({ -EOPNOTSUPP; }) 333#define audit_inode_child(d,i,p) do { ; } while (0)
250#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0) 334#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
251#define audit_get_loginuid(c) ({ -1; }) 335#define audit_get_loginuid(c) ({ -1; })
252#define audit_ipc_perms(q,u,g,m) ({ 0; }) 336#define audit_ipc_perms(q,u,g,m,i) ({ 0; })
253#define audit_socketcall(n,a) ({ 0; }) 337#define audit_socketcall(n,a) ({ 0; })
254#define audit_sockaddr(len, addr) ({ 0; }) 338#define audit_sockaddr(len, addr) ({ 0; })
255#define audit_avc_path(dentry, mnt) ({ 0; }) 339#define audit_avc_path(dentry, mnt) ({ 0; })
256#define audit_signal_info(s,t) do { ; } while (0) 340#define audit_signal_info(s,t) do { ; } while (0)
257#define audit_filter_user(cb,t) ({ 1; }) 341#define audit_set_macxattr(n) do { ; } while (0)
258#endif 342#endif
259 343
260#ifdef CONFIG_AUDIT 344#ifdef CONFIG_AUDIT
@@ -278,12 +362,11 @@ extern void audit_log_d_path(struct audit_buffer *ab,
278 const char *prefix, 362 const char *prefix,
279 struct dentry *dentry, 363 struct dentry *dentry,
280 struct vfsmount *vfsmnt); 364 struct vfsmount *vfsmnt);
281 /* Private API (for auditsc.c only) */ 365 /* Private API (for audit.c only) */
282extern void audit_send_reply(int pid, int seq, int type, 366extern int audit_filter_user(struct netlink_skb_parms *cb, int type);
283 int done, int multi, 367extern int audit_filter_type(int type);
284 void *payload, int size); 368extern int audit_receive_filter(int type, int pid, int uid, int seq,
285extern void audit_log_lost(const char *message); 369 void *data, size_t datasz, uid_t loginuid);
286extern struct semaphore audit_netlink_sem;
287#else 370#else
288#define audit_log(c,g,t,f,...) do { ; } while (0) 371#define audit_log(c,g,t,f,...) do { ; } while (0)
289#define audit_log_start(c,g,t) ({ NULL; }) 372#define audit_log_start(c,g,t) ({ NULL; })
@@ -293,6 +376,7 @@ extern struct semaphore audit_netlink_sem;
293#define audit_log_hex(a,b,l) do { ; } while (0) 376#define audit_log_hex(a,b,l) do { ; } while (0)
294#define audit_log_untrustedstring(a,s) do { ; } while (0) 377#define audit_log_untrustedstring(a,s) do { ; } while (0)
295#define audit_log_d_path(b,p,d,v) do { ; } while (0) 378#define audit_log_d_path(b,p,d,v) do { ; } while (0)
379#define audit_panic(m) do { ; } while (0)
296#endif 380#endif
297#endif 381#endif
298#endif 382#endif
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index 9343c89d843c..0a6bc52ffe88 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -19,18 +19,37 @@
19#undef AUTOFS_MIN_PROTO_VERSION 19#undef AUTOFS_MIN_PROTO_VERSION
20#undef AUTOFS_MAX_PROTO_VERSION 20#undef AUTOFS_MAX_PROTO_VERSION
21 21
22#define AUTOFS_PROTO_VERSION 4 22#define AUTOFS_PROTO_VERSION 5
23#define AUTOFS_MIN_PROTO_VERSION 3 23#define AUTOFS_MIN_PROTO_VERSION 3
24#define AUTOFS_MAX_PROTO_VERSION 4 24#define AUTOFS_MAX_PROTO_VERSION 5
25 25
26#define AUTOFS_PROTO_SUBVERSION 7 26#define AUTOFS_PROTO_SUBVERSION 0
27 27
28/* Mask for expire behaviour */ 28/* Mask for expire behaviour */
29#define AUTOFS_EXP_IMMEDIATE 1 29#define AUTOFS_EXP_IMMEDIATE 1
30#define AUTOFS_EXP_LEAVES 2 30#define AUTOFS_EXP_LEAVES 2
31 31
32/* New message type */ 32/* Daemon notification packet types */
33#define autofs_ptype_expire_multi 2 /* Expire entry (umount request) */ 33enum autofs_notify {
34 NFY_NONE,
35 NFY_MOUNT,
36 NFY_EXPIRE
37};
38
39/* Kernel protocol version 4 packet types */
40
41/* Expire entry (umount request) */
42#define autofs_ptype_expire_multi 2
43
44/* Kernel protocol version 5 packet types */
45
46/* Indirect mount missing and expire requests. */
47#define autofs_ptype_missing_indirect 3
48#define autofs_ptype_expire_indirect 4
49
50/* Direct mount missing and expire requests */
51#define autofs_ptype_missing_direct 5
52#define autofs_ptype_expire_direct 6
34 53
35/* v4 multi expire (via pipe) */ 54/* v4 multi expire (via pipe) */
36struct autofs_packet_expire_multi { 55struct autofs_packet_expire_multi {
@@ -40,14 +59,36 @@ struct autofs_packet_expire_multi {
40 char name[NAME_MAX+1]; 59 char name[NAME_MAX+1];
41}; 60};
42 61
62/* autofs v5 common packet struct */
63struct autofs_v5_packet {
64 struct autofs_packet_hdr hdr;
65 autofs_wqt_t wait_queue_token;
66 __u32 dev;
67 __u64 ino;
68 __u32 uid;
69 __u32 gid;
70 __u32 pid;
71 __u32 tgid;
72 __u32 len;
73 char name[NAME_MAX+1];
74};
75
76typedef struct autofs_v5_packet autofs_packet_missing_indirect_t;
77typedef struct autofs_v5_packet autofs_packet_expire_indirect_t;
78typedef struct autofs_v5_packet autofs_packet_missing_direct_t;
79typedef struct autofs_v5_packet autofs_packet_expire_direct_t;
80
43union autofs_packet_union { 81union autofs_packet_union {
44 struct autofs_packet_hdr hdr; 82 struct autofs_packet_hdr hdr;
45 struct autofs_packet_missing missing; 83 struct autofs_packet_missing missing;
46 struct autofs_packet_expire expire; 84 struct autofs_packet_expire expire;
47 struct autofs_packet_expire_multi expire_multi; 85 struct autofs_packet_expire_multi expire_multi;
86 struct autofs_v5_packet v5_packet;
48}; 87};
49 88
50#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int) 89#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int)
90#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI
91#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI
51#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int) 92#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int)
52#define AUTOFS_IOC_ASKREGHOST _IOR(0x93,0x68,int) 93#define AUTOFS_IOC_ASKREGHOST _IOR(0x93,0x68,int)
53#define AUTOFS_IOC_TOGGLEREGHOST _IOR(0x93,0x69,int) 94#define AUTOFS_IOC_TOGGLEREGHOST _IOR(0x93,0x69,int)
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index bb9e54322322..75e91f5b6a04 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -19,20 +19,25 @@ struct fb_info;
19struct backlight_properties { 19struct backlight_properties {
20 /* Owner module */ 20 /* Owner module */
21 struct module *owner; 21 struct module *owner;
22 /* Get the backlight power status (0: full on, 1..3: power saving 22
23 modes; 4: full off), see FB_BLANK_XXX */ 23 /* Notify the backlight driver some property has changed */
24 int (*get_power)(struct backlight_device *); 24 int (*update_status)(struct backlight_device *);
25 /* Enable or disable power to the LCD (0: on; 4: off, see FB_BLANK_XXX) */ 25 /* Return the current backlight brightness (accounting for power,
26 int (*set_power)(struct backlight_device *, int power); 26 fb_blank etc.) */
27 /* Maximal value for brightness (read-only) */
28 int max_brightness;
29 /* Get current backlight brightness */
30 int (*get_brightness)(struct backlight_device *); 27 int (*get_brightness)(struct backlight_device *);
31 /* Set backlight brightness (0..max_brightness) */
32 int (*set_brightness)(struct backlight_device *, int brightness);
33 /* Check if given framebuffer device is the one bound to this backlight; 28 /* Check if given framebuffer device is the one bound to this backlight;
34 return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ 29 return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
35 int (*check_fb)(struct fb_info *); 30 int (*check_fb)(struct fb_info *);
31
32 /* Current User requested brightness (0 - max_brightness) */
33 int brightness;
34 /* Maximal value for brightness (read-only) */
35 int max_brightness;
36 /* Current FB Power mode (0: full on, 1..3: power saving
37 modes; 4: full off), see FB_BLANK_XXX */
38 int power;
39 /* FB Blanking active? (values as for power) */
40 int fb_blank;
36}; 41};
37 42
38struct backlight_device { 43struct backlight_device {
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 7d8ff97b3e92..d9ed27969855 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -46,6 +46,9 @@
46 * bitmap_parse(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf 46 * bitmap_parse(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
47 * bitmap_scnlistprintf(buf, len, src, nbits) Print bitmap src as list to buf 47 * bitmap_scnlistprintf(buf, len, src, nbits) Print bitmap src as list to buf
48 * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from list 48 * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from list
49 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region
50 * bitmap_release_region(bitmap, pos, order) Free specified bit region
51 * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region
49 */ 52 */
50 53
51/* 54/*
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 208650b1ad3a..5d1eabcde5d5 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -3,88 +3,11 @@
3#include <asm/types.h> 3#include <asm/types.h>
4 4
5/* 5/*
6 * ffs: find first bit set. This is defined the same way as
7 * the libc and compiler builtin ffs routines, therefore
8 * differs in spirit from the above ffz (man ffs).
9 */
10
11static inline int generic_ffs(int x)
12{
13 int r = 1;
14
15 if (!x)
16 return 0;
17 if (!(x & 0xffff)) {
18 x >>= 16;
19 r += 16;
20 }
21 if (!(x & 0xff)) {
22 x >>= 8;
23 r += 8;
24 }
25 if (!(x & 0xf)) {
26 x >>= 4;
27 r += 4;
28 }
29 if (!(x & 3)) {
30 x >>= 2;
31 r += 2;
32 }
33 if (!(x & 1)) {
34 x >>= 1;
35 r += 1;
36 }
37 return r;
38}
39
40/*
41 * fls: find last bit set.
42 */
43
44static __inline__ int generic_fls(int x)
45{
46 int r = 32;
47
48 if (!x)
49 return 0;
50 if (!(x & 0xffff0000u)) {
51 x <<= 16;
52 r -= 16;
53 }
54 if (!(x & 0xff000000u)) {
55 x <<= 8;
56 r -= 8;
57 }
58 if (!(x & 0xf0000000u)) {
59 x <<= 4;
60 r -= 4;
61 }
62 if (!(x & 0xc0000000u)) {
63 x <<= 2;
64 r -= 2;
65 }
66 if (!(x & 0x80000000u)) {
67 x <<= 1;
68 r -= 1;
69 }
70 return r;
71}
72
73/*
74 * Include this here because some architectures need generic_ffs/fls in 6 * Include this here because some architectures need generic_ffs/fls in
75 * scope 7 * scope
76 */ 8 */
77#include <asm/bitops.h> 9#include <asm/bitops.h>
78 10
79
80static inline int generic_fls64(__u64 x)
81{
82 __u32 h = x >> 32;
83 if (h)
84 return fls(h) + 32;
85 return fls(x);
86}
87
88static __inline__ int get_bitmask_order(unsigned int count) 11static __inline__ int get_bitmask_order(unsigned int count)
89{ 12{
90 int order; 13 int order;
@@ -103,54 +26,9 @@ static __inline__ int get_count_order(unsigned int count)
103 return order; 26 return order;
104} 27}
105 28
106/*
107 * hweightN: returns the hamming weight (i.e. the number
108 * of bits set) of a N-bit word
109 */
110
111static inline unsigned int generic_hweight32(unsigned int w)
112{
113 unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
114 res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
115 res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
116 res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
117 return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
118}
119
120static inline unsigned int generic_hweight16(unsigned int w)
121{
122 unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555);
123 res = (res & 0x3333) + ((res >> 2) & 0x3333);
124 res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F);
125 return (res & 0x00FF) + ((res >> 8) & 0x00FF);
126}
127
128static inline unsigned int generic_hweight8(unsigned int w)
129{
130 unsigned int res = (w & 0x55) + ((w >> 1) & 0x55);
131 res = (res & 0x33) + ((res >> 2) & 0x33);
132 return (res & 0x0F) + ((res >> 4) & 0x0F);
133}
134
135static inline unsigned long generic_hweight64(__u64 w)
136{
137#if BITS_PER_LONG < 64
138 return generic_hweight32((unsigned int)(w >> 32)) +
139 generic_hweight32((unsigned int)w);
140#else
141 u64 res;
142 res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
143 res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
144 res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
145 res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
146 res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
147 return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
148#endif
149}
150
151static inline unsigned long hweight_long(unsigned long w) 29static inline unsigned long hweight_long(unsigned long w)
152{ 30{
153 return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w); 31 return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
154} 32}
155 33
156/* 34/*
@@ -175,4 +53,11 @@ static inline __u32 ror32(__u32 word, unsigned int shift)
175 return (word >> shift) | (word << (32 - shift)); 53 return (word >> shift) | (word << (32 - shift));
176} 54}
177 55
56static inline unsigned fls_long(unsigned long l)
57{
58 if (sizeof(l) == 4)
59 return fls(l);
60 return fls64(l);
61}
62
178#endif 63#endif
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 860e7a485a5f..d0cac8b58de7 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -22,6 +22,7 @@ typedef struct request_queue request_queue_t;
22struct elevator_queue; 22struct elevator_queue;
23typedef struct elevator_queue elevator_t; 23typedef struct elevator_queue elevator_t;
24struct request_pm_state; 24struct request_pm_state;
25struct blk_trace;
25 26
26#define BLKDEV_MIN_RQ 4 27#define BLKDEV_MIN_RQ 4
27#define BLKDEV_MAX_RQ 128 /* Default maximum */ 28#define BLKDEV_MAX_RQ 128 /* Default maximum */
@@ -54,23 +55,29 @@ struct as_io_context {
54 55
55struct cfq_queue; 56struct cfq_queue;
56struct cfq_io_context { 57struct cfq_io_context {
57 /* 58 struct rb_node rb_node;
58 * circular list of cfq_io_contexts belonging to a process io context
59 */
60 struct list_head list;
61 struct cfq_queue *cfqq;
62 void *key; 59 void *key;
63 60
61 struct cfq_queue *cfqq[2];
62
64 struct io_context *ioc; 63 struct io_context *ioc;
65 64
66 unsigned long last_end_request; 65 unsigned long last_end_request;
67 unsigned long last_queue; 66 sector_t last_request_pos;
67 unsigned long last_queue;
68
68 unsigned long ttime_total; 69 unsigned long ttime_total;
69 unsigned long ttime_samples; 70 unsigned long ttime_samples;
70 unsigned long ttime_mean; 71 unsigned long ttime_mean;
71 72
72 void (*dtor)(struct cfq_io_context *); 73 unsigned int seek_samples;
73 void (*exit)(struct cfq_io_context *); 74 u64 seek_total;
75 sector_t seek_mean;
76
77 struct list_head queue_list;
78
79 void (*dtor)(struct io_context *); /* destructor */
80 void (*exit)(struct io_context *); /* called on task exit */
74}; 81};
75 82
76/* 83/*
@@ -91,7 +98,7 @@ struct io_context {
91 int nr_batch_requests; /* Number of requests left in the batch */ 98 int nr_batch_requests; /* Number of requests left in the batch */
92 99
93 struct as_io_context *aic; 100 struct as_io_context *aic;
94 struct cfq_io_context *cic; 101 struct rb_root cic_root;
95}; 102};
96 103
97void put_io_context(struct io_context *ioc); 104void put_io_context(struct io_context *ioc);
@@ -404,8 +411,6 @@ struct request_queue
404 411
405 struct blk_queue_tag *queue_tags; 412 struct blk_queue_tag *queue_tags;
406 413
407 atomic_t refcnt;
408
409 unsigned int nr_sorted; 414 unsigned int nr_sorted;
410 unsigned int in_flight; 415 unsigned int in_flight;
411 416
@@ -416,6 +421,8 @@ struct request_queue
416 unsigned int sg_reserved_size; 421 unsigned int sg_reserved_size;
417 int node; 422 int node;
418 423
424 struct blk_trace *blk_trace;
425
419 /* 426 /*
420 * reserved for flush operations 427 * reserved for flush operations
421 */ 428 */
@@ -424,6 +431,8 @@ struct request_queue
424 struct request pre_flush_rq, bar_rq, post_flush_rq; 431 struct request pre_flush_rq, bar_rq, post_flush_rq;
425 struct request *orig_bar_rq; 432 struct request *orig_bar_rq;
426 unsigned int bi_size; 433 unsigned int bi_size;
434
435 struct mutex sysfs_lock;
427}; 436};
428 437
429#define RQ_INACTIVE (-1) 438#define RQ_INACTIVE (-1)
@@ -725,7 +734,7 @@ extern long nr_blockdev_pages(void);
725int blk_get_queue(request_queue_t *); 734int blk_get_queue(request_queue_t *);
726request_queue_t *blk_alloc_queue(gfp_t); 735request_queue_t *blk_alloc_queue(gfp_t);
727request_queue_t *blk_alloc_queue_node(gfp_t, int); 736request_queue_t *blk_alloc_queue_node(gfp_t, int);
728#define blk_put_queue(q) blk_cleanup_queue((q)) 737extern void blk_put_queue(request_queue_t *);
729 738
730/* 739/*
731 * tag stuff 740 * tag stuff
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
new file mode 100644
index 000000000000..b34d3e73d5ea
--- /dev/null
+++ b/include/linux/blktrace_api.h
@@ -0,0 +1,277 @@
1#ifndef BLKTRACE_H
2#define BLKTRACE_H
3
4#include <linux/config.h>
5#include <linux/blkdev.h>
6#include <linux/relay.h>
7
8/*
9 * Trace categories
10 */
11enum blktrace_cat {
12 BLK_TC_READ = 1 << 0, /* reads */
13 BLK_TC_WRITE = 1 << 1, /* writes */
14 BLK_TC_BARRIER = 1 << 2, /* barrier */
15 BLK_TC_SYNC = 1 << 3, /* barrier */
16 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */
17 BLK_TC_REQUEUE = 1 << 5, /* requeueing */
18 BLK_TC_ISSUE = 1 << 6, /* issue */
19 BLK_TC_COMPLETE = 1 << 7, /* completions */
20 BLK_TC_FS = 1 << 8, /* fs requests */
21 BLK_TC_PC = 1 << 9, /* pc requests */
22 BLK_TC_NOTIFY = 1 << 10, /* special message */
23
24 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */
25};
26
27#define BLK_TC_SHIFT (16)
28#define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT)
29
30/*
31 * Basic trace actions
32 */
33enum blktrace_act {
34 __BLK_TA_QUEUE = 1, /* queued */
35 __BLK_TA_BACKMERGE, /* back merged to existing rq */
36 __BLK_TA_FRONTMERGE, /* front merge to existing rq */
37 __BLK_TA_GETRQ, /* allocated new request */
38 __BLK_TA_SLEEPRQ, /* sleeping on rq allocation */
39 __BLK_TA_REQUEUE, /* request requeued */
40 __BLK_TA_ISSUE, /* sent to driver */
41 __BLK_TA_COMPLETE, /* completed by driver */
42 __BLK_TA_PLUG, /* queue was plugged */
43 __BLK_TA_UNPLUG_IO, /* queue was unplugged by io */
44 __BLK_TA_UNPLUG_TIMER, /* queue was unplugged by timer */
45 __BLK_TA_INSERT, /* insert request */
46 __BLK_TA_SPLIT, /* bio was split */
47 __BLK_TA_BOUNCE, /* bio was bounced */
48 __BLK_TA_REMAP, /* bio was remapped */
49};
50
51/*
52 * Trace actions in full. Additionally, read or write is masked
53 */
54#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE))
55#define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
56#define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
57#define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE))
58#define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE))
59#define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE))
60#define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE))
61#define BLK_TA_COMPLETE (__BLK_TA_COMPLETE| BLK_TC_ACT(BLK_TC_COMPLETE))
62#define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE))
63#define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE))
64#define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE))
65#define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE))
66#define BLK_TA_SPLIT (__BLK_TA_SPLIT)
67#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
68#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
69
70#define BLK_IO_TRACE_MAGIC 0x65617400
71#define BLK_IO_TRACE_VERSION 0x07
72
73/*
74 * The trace itself
75 */
76struct blk_io_trace {
77 u32 magic; /* MAGIC << 8 | version */
78 u32 sequence; /* event number */
79 u64 time; /* in microseconds */
80 u64 sector; /* disk offset */
81 u32 bytes; /* transfer length */
82 u32 action; /* what happened */
83 u32 pid; /* who did it */
84 u32 device; /* device number */
85 u32 cpu; /* on what cpu did it happen */
86 u16 error; /* completion error */
87 u16 pdu_len; /* length of data after this trace */
88};
89
90/*
91 * The remap event
92 */
93struct blk_io_trace_remap {
94 u32 device;
95 u32 __pad;
96 u64 sector;
97};
98
99enum {
100 Blktrace_setup = 1,
101 Blktrace_running,
102 Blktrace_stopped,
103};
104
105struct blk_trace {
106 int trace_state;
107 struct rchan *rchan;
108 unsigned long *sequence;
109 u16 act_mask;
110 u64 start_lba;
111 u64 end_lba;
112 u32 pid;
113 u32 dev;
114 struct dentry *dir;
115 struct dentry *dropped_file;
116 atomic_t dropped;
117};
118
119/*
120 * User setup structure passed with BLKTRACESTART
121 */
122struct blk_user_trace_setup {
123 char name[BDEVNAME_SIZE]; /* output */
124 u16 act_mask; /* input */
125 u32 buf_size; /* input */
126 u32 buf_nr; /* input */
127 u64 start_lba;
128 u64 end_lba;
129 u32 pid;
130};
131
132#if defined(CONFIG_BLK_DEV_IO_TRACE)
133extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
134extern void blk_trace_shutdown(request_queue_t *);
135extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
136
137/**
138 * blk_add_trace_rq - Add a trace for a request oriented action
139 * @q: queue the io is for
140 * @rq: the source request
141 * @what: the action
142 *
143 * Description:
144 * Records an action against a request. Will log the bio offset + size.
145 *
146 **/
147static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq,
148 u32 what)
149{
150 struct blk_trace *bt = q->blk_trace;
151 int rw = rq->flags & 0x07;
152
153 if (likely(!bt))
154 return;
155
156 if (blk_pc_request(rq)) {
157 what |= BLK_TC_ACT(BLK_TC_PC);
158 __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd);
159 } else {
160 what |= BLK_TC_ACT(BLK_TC_FS);
161 __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9, rw, what, rq->errors, 0, NULL);
162 }
163}
164
165/**
166 * blk_add_trace_bio - Add a trace for a bio oriented action
167 * @q: queue the io is for
168 * @bio: the source bio
169 * @what: the action
170 *
171 * Description:
172 * Records an action against a bio. Will log the bio offset + size.
173 *
174 **/
175static inline void blk_add_trace_bio(struct request_queue *q, struct bio *bio,
176 u32 what)
177{
178 struct blk_trace *bt = q->blk_trace;
179
180 if (likely(!bt))
181 return;
182
183 __blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, !bio_flagged(bio, BIO_UPTODATE), 0, NULL);
184}
185
186/**
187 * blk_add_trace_generic - Add a trace for a generic action
188 * @q: queue the io is for
189 * @bio: the source bio
190 * @rw: the data direction
191 * @what: the action
192 *
193 * Description:
194 * Records a simple trace
195 *
196 **/
197static inline void blk_add_trace_generic(struct request_queue *q,
198 struct bio *bio, int rw, u32 what)
199{
200 struct blk_trace *bt = q->blk_trace;
201
202 if (likely(!bt))
203 return;
204
205 if (bio)
206 blk_add_trace_bio(q, bio, what);
207 else
208 __blk_add_trace(bt, 0, 0, rw, what, 0, 0, NULL);
209}
210
211/**
212 * blk_add_trace_pdu_int - Add a trace for a bio with an integer payload
213 * @q: queue the io is for
214 * @what: the action
215 * @bio: the source bio
216 * @pdu: the integer payload
217 *
218 * Description:
219 * Adds a trace with some integer payload. This might be an unplug
220 * option given as the action, with the depth at unplug time given
221 * as the payload
222 *
223 **/
224static inline void blk_add_trace_pdu_int(struct request_queue *q, u32 what,
225 struct bio *bio, unsigned int pdu)
226{
227 struct blk_trace *bt = q->blk_trace;
228 u64 rpdu = cpu_to_be64(pdu);
229
230 if (likely(!bt))
231 return;
232
233 if (bio)
234 __blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, !bio_flagged(bio, BIO_UPTODATE), sizeof(rpdu), &rpdu);
235 else
236 __blk_add_trace(bt, 0, 0, 0, what, 0, sizeof(rpdu), &rpdu);
237}
238
239/**
240 * blk_add_trace_remap - Add a trace for a remap operation
241 * @q: queue the io is for
242 * @bio: the source bio
243 * @dev: target device
244 * @from: source sector
245 * @to: target sector
246 *
247 * Description:
248 * Device mapper or raid target sometimes need to split a bio because
249 * it spans a stripe (or similar). Add a trace for that action.
250 *
251 **/
252static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
253 dev_t dev, sector_t from, sector_t to)
254{
255 struct blk_trace *bt = q->blk_trace;
256 struct blk_io_trace_remap r;
257
258 if (likely(!bt))
259 return;
260
261 r.device = cpu_to_be32(dev);
262 r.sector = cpu_to_be64(to);
263
264 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
265}
266
267#else /* !CONFIG_BLK_DEV_IO_TRACE */
268#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY)
269#define blk_trace_shutdown(q) do { } while (0)
270#define blk_add_trace_rq(q, rq, what) do { } while (0)
271#define blk_add_trace_bio(q, rq, what) do { } while (0)
272#define blk_add_trace_generic(q, rq, rw, what) do { } while (0)
273#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0)
274#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0)
275#endif /* CONFIG_BLK_DEV_IO_TRACE */
276
277#endif
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 993da8cc9706..de3eb8d8ae26 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -38,6 +38,7 @@ typedef struct bootmem_data {
38 unsigned long last_pos; 38 unsigned long last_pos;
39 unsigned long last_success; /* Previous allocation point. To speed 39 unsigned long last_success; /* Previous allocation point. To speed
40 * up searching */ 40 * up searching */
41 struct list_head list;
41} bootmem_data_t; 42} bootmem_data_t;
42 43
43extern unsigned long __init bootmem_bootmap_pages (unsigned long); 44extern unsigned long __init bootmem_bootmap_pages (unsigned long);
@@ -51,6 +52,9 @@ extern void * __init __alloc_bootmem_low_node(pg_data_t *pgdat,
51 unsigned long size, 52 unsigned long size,
52 unsigned long align, 53 unsigned long align,
53 unsigned long goal); 54 unsigned long goal);
55extern void * __init __alloc_bootmem_core(struct bootmem_data *bdata,
56 unsigned long size, unsigned long align, unsigned long goal,
57 unsigned long limit);
54#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 58#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
55extern void __init reserve_bootmem (unsigned long addr, unsigned long size); 59extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
56#define alloc_bootmem(x) \ 60#define alloc_bootmem(x) \
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 9f159baf153f..fb7e9b7ccbe3 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -46,25 +46,28 @@ struct address_space;
46typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate); 46typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
47 47
48/* 48/*
49 * Keep related fields in common cachelines. The most commonly accessed 49 * Historically, a buffer_head was used to map a single block
50 * field (b_state) goes at the start so the compiler does not generate 50 * within a page, and of course as the unit of I/O through the
51 * indexed addressing for it. 51 * filesystem and block layers. Nowadays the basic I/O unit
52 * is the bio, and buffer_heads are used for extracting block
53 * mappings (via a get_block_t call), for tracking state within
54 * a page (via a page_mapping) and for wrapping bio submission
55 * for backward compatibility reasons (e.g. submit_bh).
52 */ 56 */
53struct buffer_head { 57struct buffer_head {
54 /* First cache line: */
55 unsigned long b_state; /* buffer state bitmap (see above) */ 58 unsigned long b_state; /* buffer state bitmap (see above) */
56 struct buffer_head *b_this_page;/* circular list of page's buffers */ 59 struct buffer_head *b_this_page;/* circular list of page's buffers */
57 struct page *b_page; /* the page this bh is mapped to */ 60 struct page *b_page; /* the page this bh is mapped to */
58 atomic_t b_count; /* users using this block */
59 u32 b_size; /* block size */
60 61
61 sector_t b_blocknr; /* block number */ 62 sector_t b_blocknr; /* start block number */
62 char *b_data; /* pointer to data block */ 63 size_t b_size; /* size of mapping */
64 char *b_data; /* pointer to data within the page */
63 65
64 struct block_device *b_bdev; 66 struct block_device *b_bdev;
65 bh_end_io_t *b_end_io; /* I/O completion */ 67 bh_end_io_t *b_end_io; /* I/O completion */
66 void *b_private; /* reserved for b_end_io */ 68 void *b_private; /* reserved for b_end_io */
67 struct list_head b_assoc_buffers; /* associated with another mapping */ 69 struct list_head b_assoc_buffers; /* associated with another mapping */
70 atomic_t b_count; /* users using this buffer_head */
68}; 71};
69 72
70/* 73/*
@@ -189,8 +192,8 @@ extern int buffer_heads_over_limit;
189 * address_spaces. 192 * address_spaces.
190 */ 193 */
191int try_to_release_page(struct page * page, gfp_t gfp_mask); 194int try_to_release_page(struct page * page, gfp_t gfp_mask);
192int block_invalidatepage(struct page *page, unsigned long offset); 195void block_invalidatepage(struct page *page, unsigned long offset);
193int do_invalidatepage(struct page *page, unsigned long offset); 196void do_invalidatepage(struct page *page, unsigned long offset);
194int block_write_full_page(struct page *page, get_block_t *get_block, 197int block_write_full_page(struct page *page, get_block_t *get_block,
195 struct writeback_control *wbc); 198 struct writeback_control *wbc);
196int block_read_full_page(struct page*, get_block_t*); 199int block_read_full_page(struct page*, get_block_t*);
@@ -200,7 +203,7 @@ int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
200int generic_cont_expand(struct inode *inode, loff_t size); 203int generic_cont_expand(struct inode *inode, loff_t size);
201int generic_cont_expand_simple(struct inode *inode, loff_t size); 204int generic_cont_expand_simple(struct inode *inode, loff_t size);
202int block_commit_write(struct page *page, unsigned from, unsigned to); 205int block_commit_write(struct page *page, unsigned from, unsigned to);
203int block_sync_page(struct page *); 206void block_sync_page(struct page *);
204sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 207sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
205int generic_commit_write(struct file *, struct page *, unsigned, unsigned); 208int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
206int block_truncate_page(struct address_space *, loff_t, get_block_t *); 209int block_truncate_page(struct address_space *, loff_t, get_block_t *);
@@ -277,6 +280,7 @@ map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block)
277 set_buffer_mapped(bh); 280 set_buffer_mapped(bh);
278 bh->b_bdev = sb->s_bdev; 281 bh->b_bdev = sb->s_bdev;
279 bh->b_blocknr = block; 282 bh->b_blocknr = block;
283 bh->b_size = sb->s_blocksize;
280} 284}
281 285
282/* 286/*
diff --git a/include/linux/cache.h b/include/linux/cache.h
index d22e632f41fb..cc4b3aafad9a 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,9 +13,7 @@
13#define SMP_CACHE_BYTES L1_CACHE_BYTES 13#define SMP_CACHE_BYTES L1_CACHE_BYTES
14#endif 14#endif
15 15
16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) || defined(CONFIG_PARISC) 16#ifndef __read_mostly
17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18#else
19#define __read_mostly 17#define __read_mostly
20#endif 18#endif
21 19
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 5a23ce752629..6548b35ab9f6 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -357,7 +357,8 @@ static inline kernel_cap_t cap_invert(kernel_cap_t c)
357 357
358#define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) 358#define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK)
359 359
360extern int capable(int cap); 360int capable(int cap);
361int __capable(struct task_struct *t, int cap);
361 362
362#endif /* __KERNEL__ */ 363#endif /* __KERNEL__ */
363 364
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 8da37e29cb87..2216638962d2 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -5,13 +5,13 @@
5struct cdev { 5struct cdev {
6 struct kobject kobj; 6 struct kobject kobj;
7 struct module *owner; 7 struct module *owner;
8 struct file_operations *ops; 8 const struct file_operations *ops;
9 struct list_head list; 9 struct list_head list;
10 dev_t dev; 10 dev_t dev;
11 unsigned int count; 11 unsigned int count;
12}; 12};
13 13
14void cdev_init(struct cdev *, struct file_operations *); 14void cdev_init(struct cdev *, const struct file_operations *);
15 15
16struct cdev *cdev_alloc(void); 16struct cdev *cdev_alloc(void);
17 17
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index b68fdf1f3156..3c9b0bc05123 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -378,7 +378,6 @@ struct cdrom_generic_command
378#define CDC_MEDIA_CHANGED 0x80 /* media changed */ 378#define CDC_MEDIA_CHANGED 0x80 /* media changed */
379#define CDC_PLAY_AUDIO 0x100 /* audio functions */ 379#define CDC_PLAY_AUDIO 0x100 /* audio functions */
380#define CDC_RESET 0x200 /* hard reset device */ 380#define CDC_RESET 0x200 /* hard reset device */
381#define CDC_IOCTLS 0x400 /* driver has non-standard ioctls */
382#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ 381#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */
383#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */ 382#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */
384#define CDC_CD_R 0x2000 /* drive is a CD-R */ 383#define CDC_CD_R 0x2000 /* drive is a CD-R */
@@ -974,9 +973,7 @@ struct cdrom_device_ops {
974 int (*reset) (struct cdrom_device_info *); 973 int (*reset) (struct cdrom_device_info *);
975 /* play stuff */ 974 /* play stuff */
976 int (*audio_ioctl) (struct cdrom_device_info *,unsigned int, void *); 975 int (*audio_ioctl) (struct cdrom_device_info *,unsigned int, void *);
977 /* dev-specific */ 976
978 int (*dev_ioctl) (struct cdrom_device_info *,
979 unsigned int, unsigned long);
980/* driver specifications */ 977/* driver specifications */
981 const int capability; /* capability flags */ 978 const int capability; /* capability flags */
982 int n_minors; /* number of active minor devices */ 979 int n_minors; /* number of active minor devices */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 12848f81bb37..5ca8c6fddb56 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -8,8 +8,8 @@
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11#ifndef ASMARM_CLOCK_H 11#ifndef __LINUX_CLK_H
12#define ASMARM_CLOCK_H 12#define __LINUX_CLK_H
13 13
14struct device; 14struct device;
15 15
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index cc621ec409d8..b3ecf8f71d97 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -30,9 +30,9 @@ extern struct inode_operations coda_ioctl_inode_operations;
30extern struct address_space_operations coda_file_aops; 30extern struct address_space_operations coda_file_aops;
31extern struct address_space_operations coda_symlink_aops; 31extern struct address_space_operations coda_symlink_aops;
32 32
33extern struct file_operations coda_dir_operations; 33extern const struct file_operations coda_dir_operations;
34extern struct file_operations coda_file_operations; 34extern const struct file_operations coda_file_operations;
35extern struct file_operations coda_ioctl_operations; 35extern const struct file_operations coda_ioctl_operations;
36 36
37/* operations shared over more than one file */ 37/* operations shared over more than one file */
38int coda_open(struct inode *i, struct file *f); 38int coda_open(struct inode *i, struct file *f);
diff --git a/include/linux/compat.h b/include/linux/compat.h
index c9ab2a26348c..6d3a654be1ae 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -45,6 +45,32 @@ struct compat_tms {
45 compat_clock_t tms_cstime; 45 compat_clock_t tms_cstime;
46}; 46};
47 47
48struct compat_timex {
49 compat_uint_t modes;
50 compat_long_t offset;
51 compat_long_t freq;
52 compat_long_t maxerror;
53 compat_long_t esterror;
54 compat_int_t status;
55 compat_long_t constant;
56 compat_long_t precision;
57 compat_long_t tolerance;
58 struct compat_timeval time;
59 compat_long_t tick;
60 compat_long_t ppsfreq;
61 compat_long_t jitter;
62 compat_int_t shift;
63 compat_long_t stabil;
64 compat_long_t jitcnt;
65 compat_long_t calcnt;
66 compat_long_t errcnt;
67 compat_long_t stbcnt;
68
69 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
70 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
71 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
72};
73
48#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) 74#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
49 75
50typedef struct { 76typedef struct {
@@ -121,6 +147,24 @@ typedef struct compat_sigevent {
121 } _sigev_un; 147 } _sigev_un;
122} compat_sigevent_t; 148} compat_sigevent_t;
123 149
150struct compat_robust_list {
151 compat_uptr_t next;
152};
153
154struct compat_robust_list_head {
155 struct compat_robust_list list;
156 compat_long_t futex_offset;
157 compat_uptr_t list_op_pending;
158};
159
160extern void compat_exit_robust_list(struct task_struct *curr);
161
162asmlinkage long
163compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
164 compat_size_t len);
165asmlinkage long
166compat_sys_get_robust_list(int pid, compat_uptr_t *head_ptr,
167 compat_size_t __user *len_ptr);
124 168
125long compat_sys_semctl(int first, int second, int third, void __user *uptr); 169long compat_sys_semctl(int first, int second, int third, void __user *uptr);
126long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); 170long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
@@ -181,5 +225,7 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs,
181 return lhs->tv_nsec - rhs->tv_nsec; 225 return lhs->tv_nsec - rhs->tv_nsec;
182} 226}
183 227
228asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
229
184#endif /* CONFIG_COMPAT */ 230#endif /* CONFIG_COMPAT */
185#endif /* _LINUX_COMPAT_H */ 231#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index ae7dfb790df3..89ab677cb993 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -97,6 +97,10 @@ COMPATIBLE_IOCTL(BLKRRPART)
97COMPATIBLE_IOCTL(BLKFLSBUF) 97COMPATIBLE_IOCTL(BLKFLSBUF)
98COMPATIBLE_IOCTL(BLKSECTSET) 98COMPATIBLE_IOCTL(BLKSECTSET)
99COMPATIBLE_IOCTL(BLKSSZGET) 99COMPATIBLE_IOCTL(BLKSSZGET)
100COMPATIBLE_IOCTL(BLKTRACESTART)
101COMPATIBLE_IOCTL(BLKTRACESTOP)
102COMPATIBLE_IOCTL(BLKTRACESETUP)
103COMPATIBLE_IOCTL(BLKTRACETEARDOWN)
100ULONG_IOCTL(BLKRASET) 104ULONG_IOCTL(BLKRASET)
101ULONG_IOCTL(BLKFRASET) 105ULONG_IOCTL(BLKFRASET)
102/* RAID */ 106/* RAID */
@@ -136,6 +140,7 @@ COMPATIBLE_IOCTL(DM_TABLE_DEPS_32)
136COMPATIBLE_IOCTL(DM_TABLE_STATUS_32) 140COMPATIBLE_IOCTL(DM_TABLE_STATUS_32)
137COMPATIBLE_IOCTL(DM_LIST_VERSIONS_32) 141COMPATIBLE_IOCTL(DM_LIST_VERSIONS_32)
138COMPATIBLE_IOCTL(DM_TARGET_MSG_32) 142COMPATIBLE_IOCTL(DM_TARGET_MSG_32)
143COMPATIBLE_IOCTL(DM_DEV_SET_GEOMETRY_32)
139COMPATIBLE_IOCTL(DM_VERSION) 144COMPATIBLE_IOCTL(DM_VERSION)
140COMPATIBLE_IOCTL(DM_REMOVE_ALL) 145COMPATIBLE_IOCTL(DM_REMOVE_ALL)
141COMPATIBLE_IOCTL(DM_LIST_DEVICES) 146COMPATIBLE_IOCTL(DM_LIST_DEVICES)
@@ -151,6 +156,7 @@ COMPATIBLE_IOCTL(DM_TABLE_DEPS)
151COMPATIBLE_IOCTL(DM_TABLE_STATUS) 156COMPATIBLE_IOCTL(DM_TABLE_STATUS)
152COMPATIBLE_IOCTL(DM_LIST_VERSIONS) 157COMPATIBLE_IOCTL(DM_LIST_VERSIONS)
153COMPATIBLE_IOCTL(DM_TARGET_MSG) 158COMPATIBLE_IOCTL(DM_TARGET_MSG)
159COMPATIBLE_IOCTL(DM_DEV_SET_GEOMETRY)
154/* Big K */ 160/* Big K */
155COMPATIBLE_IOCTL(PIO_FONT) 161COMPATIBLE_IOCTL(PIO_FONT)
156COMPATIBLE_IOCTL(GIO_FONT) 162COMPATIBLE_IOCTL(GIO_FONT)
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 0ed1d4853c69..08d50c53aab4 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -32,7 +32,7 @@ struct cpu {
32}; 32};
33 33
34extern int register_cpu(struct cpu *, int, struct node *); 34extern int register_cpu(struct cpu *, int, struct node *);
35extern struct sys_device *get_cpu_sysdev(int cpu); 35extern struct sys_device *get_cpu_sysdev(unsigned cpu);
36#ifdef CONFIG_HOTPLUG_CPU 36#ifdef CONFIG_HOTPLUG_CPU
37extern void unregister_cpu(struct cpu *, struct node *); 37extern void unregister_cpu(struct cpu *, struct node *);
38#endif 38#endif
@@ -74,7 +74,6 @@ extern int lock_cpu_hotplug_interruptible(void);
74 register_cpu_notifier(&fn##_nb); \ 74 register_cpu_notifier(&fn##_nb); \
75} 75}
76int cpu_down(unsigned int cpu); 76int cpu_down(unsigned int cpu);
77extern int __attribute__((weak)) smp_prepare_cpu(int cpu);
78#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) 77#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
79#else 78#else
80#define lock_cpu_hotplug() do { } while (0) 79#define lock_cpu_hotplug() do { } while (0)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 60e56c6e03dd..9cbb781d6f80 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -67,7 +67,7 @@
67 * 67 *
68 * int any_online_cpu(mask) First online cpu in mask 68 * int any_online_cpu(mask) First online cpu in mask
69 * 69 *
70 * for_each_cpu(cpu) for-loop cpu over cpu_possible_map 70 * for_each_possible_cpu(cpu) for-loop cpu over cpu_possible_map
71 * for_each_online_cpu(cpu) for-loop cpu over cpu_online_map 71 * for_each_online_cpu(cpu) for-loop cpu over cpu_online_map
72 * for_each_present_cpu(cpu) for-loop cpu over cpu_present_map 72 * for_each_present_cpu(cpu) for-loop cpu over cpu_present_map
73 * 73 *
@@ -212,17 +212,15 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
212 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); 212 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
213} 213}
214 214
215#define first_cpu(src) __first_cpu(&(src), NR_CPUS) 215#ifdef CONFIG_SMP
216static inline int __first_cpu(const cpumask_t *srcp, int nbits) 216int __first_cpu(const cpumask_t *srcp);
217{ 217#define first_cpu(src) __first_cpu(&(src))
218 return min_t(int, nbits, find_first_bit(srcp->bits, nbits)); 218int __next_cpu(int n, const cpumask_t *srcp);
219} 219#define next_cpu(n, src) __next_cpu((n), &(src))
220 220#else
221#define next_cpu(n, src) __next_cpu((n), &(src), NR_CPUS) 221#define first_cpu(src) 0
222static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits) 222#define next_cpu(n, src) 1
223{ 223#endif
224 return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1));
225}
226 224
227#define cpumask_of_cpu(cpu) \ 225#define cpumask_of_cpu(cpu) \
228({ \ 226({ \
@@ -398,27 +396,18 @@ extern cpumask_t cpu_present_map;
398#define cpu_present(cpu) ((cpu) == 0) 396#define cpu_present(cpu) ((cpu) == 0)
399#endif 397#endif
400 398
401#define any_online_cpu(mask) \ 399#ifdef CONFIG_SMP
402({ \ 400int highest_possible_processor_id(void);
403 int cpu; \ 401#define any_online_cpu(mask) __any_online_cpu(&(mask))
404 for_each_cpu_mask(cpu, (mask)) \ 402int __any_online_cpu(const cpumask_t *mask);
405 if (cpu_online(cpu)) \ 403#else
406 break; \ 404#define highest_possible_processor_id() 0
407 cpu; \ 405#define any_online_cpu(mask) 0
408}) 406#endif
409 407
410#define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) 408#define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
409#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
411#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) 410#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map)
412#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) 411#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
413 412
414/* Find the highest possible smp_processor_id() */
415#define highest_possible_processor_id() \
416({ \
417 unsigned int cpu, highest = 0; \
418 for_each_cpu_mask(cpu, cpu_possible_map) \
419 highest = cpu; \
420 highest; \
421})
422
423
424#endif /* __LINUX_CPUMASK_H */ 413#endif /* __LINUX_CPUMASK_H */
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 3bc606927116..9354722a9217 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -4,7 +4,7 @@
4 * cpuset interface 4 * cpuset interface
5 * 5 *
6 * Copyright (C) 2003 BULL SA 6 * Copyright (C) 2003 BULL SA
7 * Copyright (C) 2004 Silicon Graphics, Inc. 7 * Copyright (C) 2004-2006 Silicon Graphics, Inc.
8 * 8 *
9 */ 9 */
10 10
@@ -51,6 +51,18 @@ extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
51extern void cpuset_lock(void); 51extern void cpuset_lock(void);
52extern void cpuset_unlock(void); 52extern void cpuset_unlock(void);
53 53
54extern int cpuset_mem_spread_node(void);
55
56static inline int cpuset_do_page_mem_spread(void)
57{
58 return current->flags & PF_SPREAD_PAGE;
59}
60
61static inline int cpuset_do_slab_mem_spread(void)
62{
63 return current->flags & PF_SPREAD_SLAB;
64}
65
54#else /* !CONFIG_CPUSETS */ 66#else /* !CONFIG_CPUSETS */
55 67
56static inline int cpuset_init_early(void) { return 0; } 68static inline int cpuset_init_early(void) { return 0; }
@@ -99,6 +111,21 @@ static inline char *cpuset_task_status_allowed(struct task_struct *task,
99static inline void cpuset_lock(void) {} 111static inline void cpuset_lock(void) {}
100static inline void cpuset_unlock(void) {} 112static inline void cpuset_unlock(void) {}
101 113
114static inline int cpuset_mem_spread_node(void)
115{
116 return 0;
117}
118
119static inline int cpuset_do_page_mem_spread(void)
120{
121 return 0;
122}
123
124static inline int cpuset_do_slab_mem_spread(void)
125{
126 return 0;
127}
128
102#endif /* !CONFIG_CPUSETS */ 129#endif /* !CONFIG_CPUSETS */
103 130
104#endif /* _LINUX_CPUSET_H */ 131#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 534d750d922d..32503657f14f 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -11,7 +11,7 @@
11extern unsigned long long elfcorehdr_addr; 11extern unsigned long long elfcorehdr_addr;
12extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 12extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
13 unsigned long, int); 13 unsigned long, int);
14extern struct file_operations proc_vmcore_operations; 14extern const struct file_operations proc_vmcore_operations;
15extern struct proc_dir_entry *proc_vmcore; 15extern struct proc_dir_entry *proc_vmcore;
16 16
17#endif /* CONFIG_CRASH_DUMP */ 17#endif /* CONFIG_CRASH_DUMP */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index d88bf8aa8b47..0ab1bc1152ca 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -229,6 +229,8 @@ struct crypto_tfm {
229 } crt_u; 229 } crt_u;
230 230
231 struct crypto_alg *__crt_alg; 231 struct crypto_alg *__crt_alg;
232
233 char __crt_ctx[] __attribute__ ((__aligned__));
232}; 234};
233 235
234/* 236/*
@@ -301,7 +303,13 @@ static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm)
301 303
302static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) 304static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
303{ 305{
304 return (void *)&tfm[1]; 306 return tfm->__crt_ctx;
307}
308
309static inline unsigned int crypto_tfm_ctx_alignment(void)
310{
311 struct crypto_tfm *tfm;
312 return __alignof__(tfm->__crt_ctx);
305} 313}
306 314
307/* 315/*
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 4361f3789975..836325ee0931 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -162,6 +162,8 @@ d_iput: no no no yes
162#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ 162#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
163#define DCACHE_UNHASHED 0x0010 163#define DCACHE_UNHASHED 0x0010
164 164
165#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */
166
165extern spinlock_t dcache_lock; 167extern spinlock_t dcache_lock;
166 168
167/** 169/**
@@ -273,6 +275,7 @@ extern void d_move(struct dentry *, struct dentry *);
273/* appendix may either be NULL or be used for transname suffixes */ 275/* appendix may either be NULL or be used for transname suffixes */
274extern struct dentry * d_lookup(struct dentry *, struct qstr *); 276extern struct dentry * d_lookup(struct dentry *, struct qstr *);
275extern struct dentry * __d_lookup(struct dentry *, struct qstr *); 277extern struct dentry * __d_lookup(struct dentry *, struct qstr *);
278extern struct dentry * d_hash_and_lookup(struct dentry *, struct qstr *);
276 279
277/* validate "insecure" dentry pointer */ 280/* validate "insecure" dentry pointer */
278extern int d_validate(struct dentry *, struct dentry *); 281extern int d_validate(struct dentry *, struct dentry *);
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 088529f54965..676333b9fad0 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -18,7 +18,7 @@
18 * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x 18 * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x
19 */ 19 */
20struct dccp_hdr { 20struct dccp_hdr {
21 __u16 dccph_sport, 21 __be16 dccph_sport,
22 dccph_dport; 22 dccph_dport;
23 __u8 dccph_doff; 23 __u8 dccph_doff;
24#if defined(__LITTLE_ENDIAN_BITFIELD) 24#if defined(__LITTLE_ENDIAN_BITFIELD)
@@ -32,18 +32,18 @@ struct dccp_hdr {
32#endif 32#endif
33 __u16 dccph_checksum; 33 __u16 dccph_checksum;
34#if defined(__LITTLE_ENDIAN_BITFIELD) 34#if defined(__LITTLE_ENDIAN_BITFIELD)
35 __u32 dccph_x:1, 35 __u8 dccph_x:1,
36 dccph_type:4, 36 dccph_type:4,
37 dccph_reserved:3, 37 dccph_reserved:3;
38 dccph_seq:24;
39#elif defined(__BIG_ENDIAN_BITFIELD) 38#elif defined(__BIG_ENDIAN_BITFIELD)
40 __u32 dccph_reserved:3, 39 __u8 dccph_reserved:3,
41 dccph_type:4, 40 dccph_type:4,
42 dccph_x:1, 41 dccph_x:1;
43 dccph_seq:24;
44#else 42#else
45#error "Adjust your <asm/byteorder.h> defines" 43#error "Adjust your <asm/byteorder.h> defines"
46#endif 44#endif
45 __u8 dccph_seq2;
46 __be16 dccph_seq;
47}; 47};
48 48
49/** 49/**
@@ -52,7 +52,7 @@ struct dccp_hdr {
52 * @dccph_seq_low - low 24 bits of a 48 bit seq packet 52 * @dccph_seq_low - low 24 bits of a 48 bit seq packet
53 */ 53 */
54struct dccp_hdr_ext { 54struct dccp_hdr_ext {
55 __u32 dccph_seq_low; 55 __be32 dccph_seq_low;
56}; 56};
57 57
58/** 58/**
@@ -62,7 +62,7 @@ struct dccp_hdr_ext {
62 * @dccph_req_options - list of options (must be a multiple of 32 bits 62 * @dccph_req_options - list of options (must be a multiple of 32 bits
63 */ 63 */
64struct dccp_hdr_request { 64struct dccp_hdr_request {
65 __u32 dccph_req_service; 65 __be32 dccph_req_service;
66}; 66};
67/** 67/**
68 * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets 68 * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets
@@ -71,9 +71,9 @@ struct dccp_hdr_request {
71 * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR 71 * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
72 */ 72 */
73struct dccp_hdr_ack_bits { 73struct dccp_hdr_ack_bits {
74 __u32 dccph_reserved1:8, 74 __be16 dccph_reserved1;
75 dccph_ack_nr_high:24; 75 __be16 dccph_ack_nr_high;
76 __u32 dccph_ack_nr_low; 76 __be32 dccph_ack_nr_low;
77}; 77};
78/** 78/**
79 * struct dccp_hdr_response - Conection initiation response header 79 * struct dccp_hdr_response - Conection initiation response header
@@ -85,7 +85,7 @@ struct dccp_hdr_ack_bits {
85 */ 85 */
86struct dccp_hdr_response { 86struct dccp_hdr_response {
87 struct dccp_hdr_ack_bits dccph_resp_ack; 87 struct dccp_hdr_ack_bits dccph_resp_ack;
88 __u32 dccph_resp_service; 88 __be32 dccph_resp_service;
89}; 89};
90 90
91/** 91/**
@@ -154,6 +154,10 @@ enum {
154 DCCPO_MANDATORY = 1, 154 DCCPO_MANDATORY = 1,
155 DCCPO_MIN_RESERVED = 3, 155 DCCPO_MIN_RESERVED = 3,
156 DCCPO_MAX_RESERVED = 31, 156 DCCPO_MAX_RESERVED = 31,
157 DCCPO_CHANGE_L = 32,
158 DCCPO_CONFIRM_L = 33,
159 DCCPO_CHANGE_R = 34,
160 DCCPO_CONFIRM_R = 35,
157 DCCPO_NDP_COUNT = 37, 161 DCCPO_NDP_COUNT = 37,
158 DCCPO_ACK_VECTOR_0 = 38, 162 DCCPO_ACK_VECTOR_0 = 38,
159 DCCPO_ACK_VECTOR_1 = 39, 163 DCCPO_ACK_VECTOR_1 = 39,
@@ -168,7 +172,9 @@ enum {
168/* DCCP features */ 172/* DCCP features */
169enum { 173enum {
170 DCCPF_RESERVED = 0, 174 DCCPF_RESERVED = 0,
175 DCCPF_CCID = 1,
171 DCCPF_SEQUENCE_WINDOW = 3, 176 DCCPF_SEQUENCE_WINDOW = 3,
177 DCCPF_ACK_RATIO = 5,
172 DCCPF_SEND_ACK_VECTOR = 6, 178 DCCPF_SEND_ACK_VECTOR = 6,
173 DCCPF_SEND_NDP_COUNT = 7, 179 DCCPF_SEND_NDP_COUNT = 7,
174 /* 10-127 reserved */ 180 /* 10-127 reserved */
@@ -176,9 +182,18 @@ enum {
176 DCCPF_MAX_CCID_SPECIFIC = 255, 182 DCCPF_MAX_CCID_SPECIFIC = 255,
177}; 183};
178 184
185/* this structure is argument to DCCP_SOCKOPT_CHANGE_X */
186struct dccp_so_feat {
187 __u8 dccpsf_feat;
188 __u8 *dccpsf_val;
189 __u8 dccpsf_len;
190};
191
179/* DCCP socket options */ 192/* DCCP socket options */
180#define DCCP_SOCKOPT_PACKET_SIZE 1 193#define DCCP_SOCKOPT_PACKET_SIZE 1
181#define DCCP_SOCKOPT_SERVICE 2 194#define DCCP_SOCKOPT_SERVICE 2
195#define DCCP_SOCKOPT_CHANGE_L 3
196#define DCCP_SOCKOPT_CHANGE_R 4
182#define DCCP_SOCKOPT_CCID_RX_INFO 128 197#define DCCP_SOCKOPT_CCID_RX_INFO 128
183#define DCCP_SOCKOPT_CCID_TX_INFO 192 198#define DCCP_SOCKOPT_CCID_TX_INFO 192
184 199
@@ -254,16 +269,12 @@ static inline unsigned int dccp_basic_hdr_len(const struct sk_buff *skb)
254static inline __u64 dccp_hdr_seq(const struct sk_buff *skb) 269static inline __u64 dccp_hdr_seq(const struct sk_buff *skb)
255{ 270{
256 const struct dccp_hdr *dh = dccp_hdr(skb); 271 const struct dccp_hdr *dh = dccp_hdr(skb);
257#if defined(__LITTLE_ENDIAN_BITFIELD) 272 __u64 seq_nr = ntohs(dh->dccph_seq);
258 __u64 seq_nr = ntohl(dh->dccph_seq << 8);
259#elif defined(__BIG_ENDIAN_BITFIELD)
260 __u64 seq_nr = ntohl(dh->dccph_seq);
261#else
262#error "Adjust your <asm/byteorder.h> defines"
263#endif
264 273
265 if (dh->dccph_x != 0) 274 if (dh->dccph_x != 0)
266 seq_nr = (seq_nr << 32) + ntohl(dccp_hdrx(skb)->dccph_seq_low); 275 seq_nr = (seq_nr << 32) + ntohl(dccp_hdrx(skb)->dccph_seq_low);
276 else
277 seq_nr += (u32)dh->dccph_seq2 << 16;
267 278
268 return seq_nr; 279 return seq_nr;
269} 280}
@@ -281,13 +292,7 @@ static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *
281static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb) 292static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
282{ 293{
283 const struct dccp_hdr_ack_bits *dhack = dccp_hdr_ack_bits(skb); 294 const struct dccp_hdr_ack_bits *dhack = dccp_hdr_ack_bits(skb);
284#if defined(__LITTLE_ENDIAN_BITFIELD) 295 return ((u64)ntohs(dhack->dccph_ack_nr_high) << 32) + ntohl(dhack->dccph_ack_nr_low);
285 return (((u64)ntohl(dhack->dccph_ack_nr_high << 8)) << 32) + ntohl(dhack->dccph_ack_nr_low);
286#elif defined(__BIG_ENDIAN_BITFIELD)
287 return (((u64)ntohl(dhack->dccph_ack_nr_high)) << 32) + ntohl(dhack->dccph_ack_nr_low);
288#else
289#error "Adjust your <asm/byteorder.h> defines"
290#endif
291} 296}
292 297
293static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb) 298static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb)
@@ -314,38 +319,60 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
314 319
315/* initial values for each feature */ 320/* initial values for each feature */
316#define DCCPF_INITIAL_SEQUENCE_WINDOW 100 321#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
317/* FIXME: for now we're using CCID 3 (TFRC) */ 322#define DCCPF_INITIAL_ACK_RATIO 2
318#define DCCPF_INITIAL_CCID 3 323#define DCCPF_INITIAL_CCID 2
319#define DCCPF_INITIAL_SEND_ACK_VECTOR 0 324#define DCCPF_INITIAL_SEND_ACK_VECTOR 1
320/* FIXME: for now we're default to 1 but it should really be 0 */ 325/* FIXME: for now we're default to 1 but it should really be 0 */
321#define DCCPF_INITIAL_SEND_NDP_COUNT 1 326#define DCCPF_INITIAL_SEND_NDP_COUNT 1
322 327
323#define DCCP_NDP_LIMIT 0xFFFFFF 328#define DCCP_NDP_LIMIT 0xFFFFFF
324 329
325/** 330/**
326 * struct dccp_options - option values for a DCCP connection 331 * struct dccp_minisock - Minimal DCCP connection representation
327 * @dccpo_sequence_window - Sequence Window Feature (section 7.5.2) 332 *
328 * @dccpo_ccid - Congestion Control Id (CCID) (section 10) 333 * Will be used to pass the state from dccp_request_sock to dccp_sock.
329 * @dccpo_send_ack_vector - Send Ack Vector Feature (section 11.5) 334 *
330 * @dccpo_send_ndp_count - Send NDP Count Feature (7.7.2) 335 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
336 * @dccpms_ccid - Congestion Control Id (CCID) (section 10)
337 * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5)
338 * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2)
331 */ 339 */
332struct dccp_options { 340struct dccp_minisock {
333 __u64 dccpo_sequence_window; 341 __u64 dccpms_sequence_window;
334 __u8 dccpo_rx_ccid; 342 __u8 dccpms_rx_ccid;
335 __u8 dccpo_tx_ccid; 343 __u8 dccpms_tx_ccid;
336 __u8 dccpo_send_ack_vector; 344 __u8 dccpms_send_ack_vector;
337 __u8 dccpo_send_ndp_count; 345 __u8 dccpms_send_ndp_count;
346 __u8 dccpms_ack_ratio;
347 struct list_head dccpms_pending;
348 struct list_head dccpms_conf;
349};
350
351struct dccp_opt_conf {
352 __u8 *dccpoc_val;
353 __u8 dccpoc_len;
354};
355
356struct dccp_opt_pend {
357 struct list_head dccpop_node;
358 __u8 dccpop_type;
359 __u8 dccpop_feat;
360 __u8 *dccpop_val;
361 __u8 dccpop_len;
362 int dccpop_conf;
363 struct dccp_opt_conf *dccpop_sc;
338}; 364};
339 365
340extern void __dccp_options_init(struct dccp_options *dccpo); 366extern void __dccp_minisock_init(struct dccp_minisock *dmsk);
341extern void dccp_options_init(struct dccp_options *dccpo); 367extern void dccp_minisock_init(struct dccp_minisock *dmsk);
368
342extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb); 369extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb);
343 370
344struct dccp_request_sock { 371struct dccp_request_sock {
345 struct inet_request_sock dreq_inet_rsk; 372 struct inet_request_sock dreq_inet_rsk;
346 __u64 dreq_iss; 373 __u64 dreq_iss;
347 __u64 dreq_isr; 374 __u64 dreq_isr;
348 __u32 dreq_service; 375 __be32 dreq_service;
349}; 376};
350 377
351static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) 378static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req)
@@ -373,13 +400,13 @@ enum dccp_role {
373 400
374struct dccp_service_list { 401struct dccp_service_list {
375 __u32 dccpsl_nr; 402 __u32 dccpsl_nr;
376 __u32 dccpsl_list[0]; 403 __be32 dccpsl_list[0];
377}; 404};
378 405
379#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1) 406#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1)
380 407
381static inline int dccp_list_has_service(const struct dccp_service_list *sl, 408static inline int dccp_list_has_service(const struct dccp_service_list *sl,
382 const u32 service) 409 const __be32 service)
383{ 410{
384 if (likely(sl != NULL)) { 411 if (likely(sl != NULL)) {
385 u32 i = sl->dccpsl_nr; 412 u32 i = sl->dccpsl_nr;
@@ -425,17 +452,17 @@ struct dccp_sock {
425 __u64 dccps_gss; 452 __u64 dccps_gss;
426 __u64 dccps_gsr; 453 __u64 dccps_gsr;
427 __u64 dccps_gar; 454 __u64 dccps_gar;
428 __u32 dccps_service; 455 __be32 dccps_service;
429 struct dccp_service_list *dccps_service_list; 456 struct dccp_service_list *dccps_service_list;
430 struct timeval dccps_timestamp_time; 457 struct timeval dccps_timestamp_time;
431 __u32 dccps_timestamp_echo; 458 __u32 dccps_timestamp_echo;
432 __u32 dccps_packet_size; 459 __u32 dccps_packet_size;
460 __u16 dccps_l_ack_ratio;
461 __u16 dccps_r_ack_ratio;
433 unsigned long dccps_ndp_count; 462 unsigned long dccps_ndp_count;
434 __u32 dccps_mss_cache; 463 __u32 dccps_mss_cache;
435 struct dccp_options dccps_options; 464 struct dccp_minisock dccps_minisock;
436 struct dccp_ackvec *dccps_hc_rx_ackvec; 465 struct dccp_ackvec *dccps_hc_rx_ackvec;
437 void *dccps_hc_rx_ccid_private;
438 void *dccps_hc_tx_ccid_private;
439 struct ccid *dccps_hc_rx_ccid; 466 struct ccid *dccps_hc_rx_ccid;
440 struct ccid *dccps_hc_tx_ccid; 467 struct ccid *dccps_hc_tx_ccid;
441 struct dccp_options_received dccps_options_received; 468 struct dccp_options_received dccps_options_received;
@@ -450,6 +477,11 @@ static inline struct dccp_sock *dccp_sk(const struct sock *sk)
450 return (struct dccp_sock *)sk; 477 return (struct dccp_sock *)sk;
451} 478}
452 479
480static inline struct dccp_minisock *dccp_msk(const struct sock *sk)
481{
482 return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock;
483}
484
453static inline int dccp_service_not_initialized(const struct sock *sk) 485static inline int dccp_service_not_initialized(const struct sock *sk)
454{ 486{
455 return dccp_sk(sk)->dccps_service == DCCP_SERVICE_INVALID_VALUE; 487 return dccp_sk(sk)->dccps_service == DCCP_SERVICE_INVALID_VALUE;
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index a5fa6a6eede8..176e2d371577 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -21,10 +21,15 @@
21 21
22struct file_operations; 22struct file_operations;
23 23
24struct debugfs_blob_wrapper {
25 void *data;
26 unsigned long size;
27};
28
24#if defined(CONFIG_DEBUG_FS) 29#if defined(CONFIG_DEBUG_FS)
25struct dentry *debugfs_create_file(const char *name, mode_t mode, 30struct dentry *debugfs_create_file(const char *name, mode_t mode,
26 struct dentry *parent, void *data, 31 struct dentry *parent, void *data,
27 struct file_operations *fops); 32 const struct file_operations *fops);
28 33
29struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); 34struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
30 35
@@ -39,6 +44,9 @@ struct dentry *debugfs_create_u32(const char *name, mode_t mode,
39struct dentry *debugfs_create_bool(const char *name, mode_t mode, 44struct dentry *debugfs_create_bool(const char *name, mode_t mode,
40 struct dentry *parent, u32 *value); 45 struct dentry *parent, u32 *value);
41 46
47struct dentry *debugfs_create_blob(const char *name, mode_t mode,
48 struct dentry *parent,
49 struct debugfs_blob_wrapper *blob);
42#else 50#else
43 51
44#include <linux/err.h> 52#include <linux/err.h>
@@ -94,6 +102,13 @@ static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode,
94 return ERR_PTR(-ENODEV); 102 return ERR_PTR(-ENODEV);
95} 103}
96 104
105static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode,
106 struct dentry *parent,
107 struct debugfs_blob_wrapper *blob)
108{
109 return ERR_PTR(-ENODEV);
110}
111
97#endif 112#endif
98 113
99#endif 114#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 51e0e95a421a..aee10b2ea4c6 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -97,6 +97,7 @@ struct io_restrictions {
97 unsigned short hardsect_size; 97 unsigned short hardsect_size;
98 unsigned int max_segment_size; 98 unsigned int max_segment_size;
99 unsigned long seg_boundary_mask; 99 unsigned long seg_boundary_mask;
100 unsigned char no_cluster; /* inverted so that 0 is default */
100}; 101};
101 102
102struct dm_target { 103struct dm_target {
diff --git a/include/linux/device.h b/include/linux/device.h
index 58df18d9cd3e..f6e72a65a3f2 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -378,6 +378,7 @@ extern void device_bind_driver(struct device * dev);
378extern void device_release_driver(struct device * dev); 378extern void device_release_driver(struct device * dev);
379extern int device_attach(struct device * dev); 379extern int device_attach(struct device * dev);
380extern void driver_attach(struct device_driver * drv); 380extern void driver_attach(struct device_driver * drv);
381extern void device_reprobe(struct device *dev);
381 382
382 383
383/* 384/*
@@ -399,7 +400,7 @@ extern struct device * get_device(struct device * dev);
399extern void put_device(struct device * dev); 400extern void put_device(struct device * dev);
400 401
401 402
402/* drivers/base/power.c */ 403/* drivers/base/power/shutdown.c */
403extern void device_shutdown(void); 404extern void device_shutdown(void);
404 405
405 406
@@ -424,6 +425,8 @@ extern void firmware_unregister(struct subsystem *);
424 dev_printk(KERN_INFO , dev , format , ## arg) 425 dev_printk(KERN_INFO , dev , format , ## arg)
425#define dev_warn(dev, format, arg...) \ 426#define dev_warn(dev, format, arg...) \
426 dev_printk(KERN_WARNING , dev , format , ## arg) 427 dev_printk(KERN_WARNING , dev , format , ## arg)
428#define dev_notice(dev, format, arg...) \
429 dev_printk(KERN_NOTICE , dev , format , ## arg)
427 430
428/* Create alias, so I can be autoloaded. */ 431/* Create alias, so I can be autoloaded. */
429#define MODULE_ALIAS_CHARDEV(major,minor) \ 432#define MODULE_ALIAS_CHARDEV(major,minor) \
diff --git a/include/linux/dio.h b/include/linux/dio.h
index fae9395fcf4f..1e65ebc2a3db 100644
--- a/include/linux/dio.h
+++ b/include/linux/dio.h
@@ -276,37 +276,5 @@ static inline void dio_set_drvdata (struct dio_dev *d, void *data)
276 dev_set_drvdata(&d->dev, data); 276 dev_set_drvdata(&d->dev, data);
277} 277}
278 278
279/*
280 * A helper function which helps ensure correct dio_driver
281 * setup and cleanup for commonly-encountered hotplug/modular cases
282 *
283 * This MUST stay in a header, as it checks for -DMODULE
284 */
285static inline int dio_module_init(struct dio_driver *drv)
286{
287 int rc = dio_register_driver(drv);
288
289 if (rc > 0)
290 return 0;
291
292 /* iff CONFIG_HOTPLUG and built into kernel, we should
293 * leave the driver around for future hotplug events.
294 * For the module case, a hotplug daemon of some sort
295 * should load a module in response to an insert event. */
296#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
297 if (rc == 0)
298 return 0;
299#else
300 if (rc == 0)
301 rc = -ENODEV;
302#endif
303
304 /* if we get here, we need to clean up DIO driver instance
305 * and return some sort of error */
306 dio_unregister_driver(drv);
307
308 return rc;
309}
310
311#endif /* __KERNEL__ */ 279#endif /* __KERNEL__ */
312#endif /* ndef _LINUX_DIO_H */ 280#endif /* ndef _LINUX_DIO_H */
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index fa75ba0d635e..c67c6786612a 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -80,6 +80,16 @@
80 * 80 *
81 * DM_TARGET_MSG: 81 * DM_TARGET_MSG:
82 * Pass a message string to the target at a specific offset of a device. 82 * Pass a message string to the target at a specific offset of a device.
83 *
84 * DM_DEV_SET_GEOMETRY:
85 * Set the geometry of a device by passing in a string in this format:
86 *
87 * "cylinders heads sectors_per_track start_sector"
88 *
89 * Beware that CHS geometry is nearly obsolete and only provided
90 * for compatibility with dm devices that can be booted by a PC
91 * BIOS. See struct hd_geometry for range limits. Also note that
92 * the geometry is erased if the device size changes.
83 */ 93 */
84 94
85/* 95/*
@@ -218,6 +228,7 @@ enum {
218 /* Added later */ 228 /* Added later */
219 DM_LIST_VERSIONS_CMD, 229 DM_LIST_VERSIONS_CMD,
220 DM_TARGET_MSG_CMD, 230 DM_TARGET_MSG_CMD,
231 DM_DEV_SET_GEOMETRY_CMD
221}; 232};
222 233
223/* 234/*
@@ -247,6 +258,7 @@ typedef char ioctl_struct[308];
247#define DM_TABLE_STATUS_32 _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, ioctl_struct) 258#define DM_TABLE_STATUS_32 _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, ioctl_struct)
248#define DM_LIST_VERSIONS_32 _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, ioctl_struct) 259#define DM_LIST_VERSIONS_32 _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, ioctl_struct)
249#define DM_TARGET_MSG_32 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, ioctl_struct) 260#define DM_TARGET_MSG_32 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, ioctl_struct)
261#define DM_DEV_SET_GEOMETRY_32 _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, ioctl_struct)
250#endif 262#endif
251 263
252#define DM_IOCTL 0xfd 264#define DM_IOCTL 0xfd
@@ -270,11 +282,12 @@ typedef char ioctl_struct[308];
270#define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl) 282#define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl)
271 283
272#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) 284#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
285#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
273 286
274#define DM_VERSION_MAJOR 4 287#define DM_VERSION_MAJOR 4
275#define DM_VERSION_MINOR 5 288#define DM_VERSION_MINOR 6
276#define DM_VERSION_PATCHLEVEL 0 289#define DM_VERSION_PATCHLEVEL 0
277#define DM_VERSION_EXTRA "-ioctl (2005-10-04)" 290#define DM_VERSION_EXTRA "-ioctl (2006-02-17)"
278 291
279/* Status bits */ 292/* Status bits */
280#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 293#define DM_READONLY_FLAG (1 << 0) /* In/Out */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 2d80cc761a15..9b4751aecc23 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -20,6 +20,8 @@ enum dma_data_direction {
20#define DMA_31BIT_MASK 0x000000007fffffffULL 20#define DMA_31BIT_MASK 0x000000007fffffffULL
21#define DMA_30BIT_MASK 0x000000003fffffffULL 21#define DMA_30BIT_MASK 0x000000003fffffffULL
22#define DMA_29BIT_MASK 0x000000001fffffffULL 22#define DMA_29BIT_MASK 0x000000001fffffffULL
23#define DMA_28BIT_MASK 0x000000000fffffffULL
24#define DMA_24BIT_MASK 0x0000000000ffffffULL
23 25
24#include <asm/dma-mapping.h> 26#include <asm/dma-mapping.h>
25 27
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 2e6bbe014157..64fd6c366604 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -68,6 +68,7 @@ extern char * dmi_get_system_info(int field);
68extern struct dmi_device * dmi_find_device(int type, const char *name, 68extern struct dmi_device * dmi_find_device(int type, const char *name,
69 struct dmi_device *from); 69 struct dmi_device *from);
70extern void dmi_scan_machine(void); 70extern void dmi_scan_machine(void);
71extern int dmi_get_year(int field);
71 72
72#else 73#else
73 74
@@ -75,6 +76,7 @@ static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
75static inline char * dmi_get_system_info(int field) { return NULL; } 76static inline char * dmi_get_system_info(int field) { return NULL; }
76static inline struct dmi_device * dmi_find_device(int type, const char *name, 77static inline struct dmi_device * dmi_find_device(int type, const char *name,
77 struct dmi_device *from) { return NULL; } 78 struct dmi_device *from) { return NULL; }
79static inline int dmi_get_year(int year) { return 0; }
78 80
79#endif 81#endif
80 82
diff --git a/include/linux/dn.h b/include/linux/dn.h
index 782cae49e64c..10b6a6fd5837 100644
--- a/include/linux/dn.h
+++ b/include/linux/dn.h
@@ -71,17 +71,17 @@
71 71
72struct dn_naddr 72struct dn_naddr
73{ 73{
74 unsigned short a_len; 74 __le16 a_len;
75 unsigned char a_addr[DN_MAXADDL]; 75 __u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */
76}; 76};
77 77
78struct sockaddr_dn 78struct sockaddr_dn
79{ 79{
80 unsigned short sdn_family; 80 __u16 sdn_family;
81 unsigned char sdn_flags; 81 __u8 sdn_flags;
82 unsigned char sdn_objnum; 82 __u8 sdn_objnum;
83 unsigned short sdn_objnamel; 83 __le16 sdn_objnamel;
84 unsigned char sdn_objname[DN_MAXOBJL]; 84 __u8 sdn_objname[DN_MAXOBJL];
85 struct dn_naddr sdn_add; 85 struct dn_naddr sdn_add;
86}; 86};
87#define sdn_nodeaddrl sdn_add.a_len /* Node address length */ 87#define sdn_nodeaddrl sdn_add.a_len /* Node address length */
@@ -93,38 +93,38 @@ struct sockaddr_dn
93 * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure 93 * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure
94 */ 94 */
95struct optdata_dn { 95struct optdata_dn {
96 unsigned short opt_status; /* Extended status return */ 96 __le16 opt_status; /* Extended status return */
97#define opt_sts opt_status 97#define opt_sts opt_status
98 unsigned short opt_optl; /* Length of user data */ 98 __le16 opt_optl; /* Length of user data */
99 unsigned char opt_data[16]; /* User data */ 99 __u8 opt_data[16]; /* User data */
100}; 100};
101 101
102struct accessdata_dn 102struct accessdata_dn
103{ 103{
104 unsigned char acc_accl; 104 __u8 acc_accl;
105 unsigned char acc_acc[DN_MAXACCL]; 105 __u8 acc_acc[DN_MAXACCL];
106 unsigned char acc_passl; 106 __u8 acc_passl;
107 unsigned char acc_pass[DN_MAXACCL]; 107 __u8 acc_pass[DN_MAXACCL];
108 unsigned char acc_userl; 108 __u8 acc_userl;
109 unsigned char acc_user[DN_MAXACCL]; 109 __u8 acc_user[DN_MAXACCL];
110}; 110};
111 111
112/* 112/*
113 * DECnet logical link information structure 113 * DECnet logical link information structure
114 */ 114 */
115struct linkinfo_dn { 115struct linkinfo_dn {
116 unsigned short idn_segsize; /* Segment size for link */ 116 __le16 idn_segsize; /* Segment size for link */
117 unsigned char idn_linkstate; /* Logical link state */ 117 __u8 idn_linkstate; /* Logical link state */
118}; 118};
119 119
120/* 120/*
121 * Ethernet address format (for DECnet) 121 * Ethernet address format (for DECnet)
122 */ 122 */
123union etheraddress { 123union etheraddress {
124 unsigned char dne_addr[6]; /* Full ethernet address */ 124 __u8 dne_addr[6]; /* Full ethernet address */
125 struct { 125 struct {
126 unsigned char dne_hiord[4]; /* DECnet HIORD prefix */ 126 __u8 dne_hiord[4]; /* DECnet HIORD prefix */
127 unsigned char dne_nodeaddr[2]; /* DECnet node address */ 127 __u8 dne_nodeaddr[2]; /* DECnet node address */
128 } dne_remote; 128 } dne_remote;
129}; 129};
130 130
@@ -133,7 +133,7 @@ union etheraddress {
133 * DECnet physical socket address format 133 * DECnet physical socket address format
134 */ 134 */
135struct dn_addr { 135struct dn_addr {
136 unsigned short dna_family; /* AF_DECnet */ 136 __le16 dna_family; /* AF_DECnet */
137 union etheraddress dna_netaddr; /* DECnet ethernet address */ 137 union etheraddress dna_netaddr; /* DECnet ethernet address */
138}; 138};
139 139
diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h
index 2b8797084685..0874a67c6b92 100644
--- a/include/linux/dvb/audio.h
+++ b/include/linux/dvb/audio.h
@@ -121,4 +121,17 @@ typedef uint16_t audio_attributes_t;
121#define AUDIO_SET_ATTRIBUTES _IOW('o', 17, audio_attributes_t) 121#define AUDIO_SET_ATTRIBUTES _IOW('o', 17, audio_attributes_t)
122#define AUDIO_SET_KARAOKE _IOW('o', 18, audio_karaoke_t) 122#define AUDIO_SET_KARAOKE _IOW('o', 18, audio_karaoke_t)
123 123
124/**
125 * AUDIO_GET_PTS
126 *
127 * Read the 33 bit presentation time stamp as defined
128 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
129 *
130 * The PTS should belong to the currently played
131 * frame if possible, but may also be a value close to it
132 * like the PTS of the last decoded frame or the last PTS
133 * extracted by the PES parser.
134 */
135#define AUDIO_GET_PTS _IOR('o', 19, __u64)
136
124#endif /* _DVBAUDIO_H_ */ 137#endif /* _DVBAUDIO_H_ */
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index b81e58b2ebf8..faebfda397ff 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -200,4 +200,17 @@ typedef uint16_t video_attributes_t;
200#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t) 200#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
201#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int) 201#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int)
202 202
203/**
204 * VIDEO_GET_PTS
205 *
206 * Read the 33 bit presentation time stamp as defined
207 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
208 *
209 * The PTS should belong to the currently played
210 * frame if possible, but may also be a value close to it
211 * like the PTS of the last decoded frame or the last PTS
212 * extracted by the PES parser.
213 */
214#define VIDEO_GET_PTS _IOR('o', 57, __u64)
215
203#endif /*_DVBVIDEO_H_*/ 216#endif /*_DVBVIDEO_H_*/
diff --git a/include/linux/efi.h b/include/linux/efi.h
index c7c5dd316182..e203613d3aec 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -240,19 +240,21 @@ struct efi_memory_map {
240 unsigned long desc_size; 240 unsigned long desc_size;
241}; 241};
242 242
243#define EFI_INVALID_TABLE_ADDR (~0UL)
244
243/* 245/*
244 * All runtime access to EFI goes through this structure: 246 * All runtime access to EFI goes through this structure:
245 */ 247 */
246extern struct efi { 248extern struct efi {
247 efi_system_table_t *systab; /* EFI system table */ 249 efi_system_table_t *systab; /* EFI system table */
248 void *mps; /* MPS table */ 250 unsigned long mps; /* MPS table */
249 void *acpi; /* ACPI table (IA64 ext 0.71) */ 251 unsigned long acpi; /* ACPI table (IA64 ext 0.71) */
250 void *acpi20; /* ACPI table (ACPI 2.0) */ 252 unsigned long acpi20; /* ACPI table (ACPI 2.0) */
251 void *smbios; /* SM BIOS table */ 253 unsigned long smbios; /* SM BIOS table */
252 void *sal_systab; /* SAL system table */ 254 unsigned long sal_systab; /* SAL system table */
253 void *boot_info; /* boot info table */ 255 unsigned long boot_info; /* boot info table */
254 void *hcdp; /* HCDP table */ 256 unsigned long hcdp; /* HCDP table */
255 void *uga; /* UGA table */ 257 unsigned long uga; /* UGA table */
256 efi_get_time_t *get_time; 258 efi_get_time_t *get_time;
257 efi_set_time_t *set_time; 259 efi_set_time_t *set_time;
258 efi_get_wakeup_time_t *get_wakeup_time; 260 efi_get_wakeup_time_t *get_wakeup_time;
@@ -292,6 +294,8 @@ extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if pos
292extern u64 efi_get_iobase (void); 294extern u64 efi_get_iobase (void);
293extern u32 efi_mem_type (unsigned long phys_addr); 295extern u32 efi_mem_type (unsigned long phys_addr);
294extern u64 efi_mem_attributes (unsigned long phys_addr); 296extern u64 efi_mem_attributes (unsigned long phys_addr);
297extern int efi_mem_attribute_range (unsigned long phys_addr, unsigned long size,
298 u64 attr);
295extern int __init efi_uart_console_only (void); 299extern int __init efi_uart_console_only (void);
296extern void efi_initialize_iomem_resources(struct resource *code_resource, 300extern void efi_initialize_iomem_resources(struct resource *code_resource,
297 struct resource *data_resource); 301 struct resource *data_resource);
diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h
index 28f368c526fb..fbfa6b52e2fb 100644
--- a/include/linux/efs_fs.h
+++ b/include/linux/efs_fs.h
@@ -37,7 +37,7 @@ static inline struct efs_sb_info *SUPER_INFO(struct super_block *sb)
37struct statfs; 37struct statfs;
38 38
39extern struct inode_operations efs_dir_inode_operations; 39extern struct inode_operations efs_dir_inode_operations;
40extern struct file_operations efs_dir_operations; 40extern const struct file_operations efs_dir_operations;
41extern struct address_space_operations efs_symlink_aops; 41extern struct address_space_operations efs_symlink_aops;
42 42
43extern void efs_read_inode(struct inode *); 43extern void efs_read_inode(struct inode *);
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 18cf1f3e1184..ad133fcfb239 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -48,10 +48,17 @@ struct elevator_ops
48 48
49 elevator_init_fn *elevator_init_fn; 49 elevator_init_fn *elevator_init_fn;
50 elevator_exit_fn *elevator_exit_fn; 50 elevator_exit_fn *elevator_exit_fn;
51 void (*trim)(struct io_context *);
51}; 52};
52 53
53#define ELV_NAME_MAX (16) 54#define ELV_NAME_MAX (16)
54 55
56struct elv_fs_entry {
57 struct attribute attr;
58 ssize_t (*show)(elevator_t *, char *);
59 ssize_t (*store)(elevator_t *, const char *, size_t);
60};
61
55/* 62/*
56 * identifies an elevator type, such as AS or deadline 63 * identifies an elevator type, such as AS or deadline
57 */ 64 */
@@ -60,7 +67,7 @@ struct elevator_type
60 struct list_head list; 67 struct list_head list;
61 struct elevator_ops ops; 68 struct elevator_ops ops;
62 struct elevator_type *elevator_type; 69 struct elevator_type *elevator_type;
63 struct kobj_type *elevator_ktype; 70 struct elv_fs_entry *elevator_attrs;
64 char elevator_name[ELV_NAME_MAX]; 71 char elevator_name[ELV_NAME_MAX];
65 struct module *elevator_owner; 72 struct module *elevator_owner;
66}; 73};
@@ -74,6 +81,7 @@ struct elevator_queue
74 void *elevator_data; 81 void *elevator_data;
75 struct kobject kobj; 82 struct kobject kobj;
76 struct elevator_type *elevator_type; 83 struct elevator_type *elevator_type;
84 struct mutex sysfs_lock;
77}; 85};
78 86
79/* 87/*
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 1289f0ec4c00..1e4bdfcf83a2 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -52,7 +52,12 @@ struct file;
52#ifdef CONFIG_EPOLL 52#ifdef CONFIG_EPOLL
53 53
54/* Used to initialize the epoll bits inside the "struct file" */ 54/* Used to initialize the epoll bits inside the "struct file" */
55void eventpoll_init_file(struct file *file); 55static inline void eventpoll_init_file(struct file *file)
56{
57 INIT_LIST_HEAD(&file->f_ep_links);
58 spin_lock_init(&file->f_ep_lock);
59}
60
56 61
57/* Used to release the epoll bits inside the "struct file" */ 62/* Used to release the epoll bits inside the "struct file" */
58void eventpoll_release_file(struct file *file); 63void eventpoll_release_file(struct file *file);
@@ -85,7 +90,6 @@ static inline void eventpoll_release(struct file *file)
85 eventpoll_release_file(file); 90 eventpoll_release_file(file);
86} 91}
87 92
88
89#else 93#else
90 94
91static inline void eventpoll_init_file(struct file *file) {} 95static inline void eventpoll_init_file(struct file *file) {}
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index c0272d73ab20..3ade6a4e3bdd 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -36,7 +36,8 @@ struct statfs;
36 * Define EXT3_RESERVATION to reserve data blocks for expanding files 36 * Define EXT3_RESERVATION to reserve data blocks for expanding files
37 */ 37 */
38#define EXT3_DEFAULT_RESERVE_BLOCKS 8 38#define EXT3_DEFAULT_RESERVE_BLOCKS 8
39#define EXT3_MAX_RESERVE_BLOCKS 1024 39/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
40#define EXT3_MAX_RESERVE_BLOCKS 1027
40#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0 41#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
41/* 42/*
42 * Always enable hashed directories 43 * Always enable hashed directories
@@ -732,6 +733,8 @@ struct dir_private_info {
732extern int ext3_bg_has_super(struct super_block *sb, int group); 733extern int ext3_bg_has_super(struct super_block *sb, int group);
733extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group); 734extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group);
734extern int ext3_new_block (handle_t *, struct inode *, unsigned long, int *); 735extern int ext3_new_block (handle_t *, struct inode *, unsigned long, int *);
736extern int ext3_new_blocks (handle_t *, struct inode *, unsigned long,
737 unsigned long *, int *);
735extern void ext3_free_blocks (handle_t *, struct inode *, unsigned long, 738extern void ext3_free_blocks (handle_t *, struct inode *, unsigned long,
736 unsigned long); 739 unsigned long);
737extern void ext3_free_blocks_sb (handle_t *, struct super_block *, 740extern void ext3_free_blocks_sb (handle_t *, struct super_block *,
@@ -772,9 +775,12 @@ extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
772 775
773 776
774/* inode.c */ 777/* inode.c */
775extern int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int); 778int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int);
776extern struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); 779struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
777extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); 780struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
781int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
782 sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result,
783 int create, int extend_disksize);
778 784
779extern void ext3_read_inode (struct inode *); 785extern void ext3_read_inode (struct inode *);
780extern int ext3_write_inode (struct inode *, int); 786extern int ext3_write_inode (struct inode *, int);
@@ -827,11 +833,11 @@ do { \
827 */ 833 */
828 834
829/* dir.c */ 835/* dir.c */
830extern struct file_operations ext3_dir_operations; 836extern const struct file_operations ext3_dir_operations;
831 837
832/* file.c */ 838/* file.c */
833extern struct inode_operations ext3_file_inode_operations; 839extern struct inode_operations ext3_file_inode_operations;
834extern struct file_operations ext3_file_operations; 840extern const struct file_operations ext3_file_operations;
835 841
836/* namei.c */ 842/* namei.c */
837extern struct inode_operations ext3_dir_inode_operations; 843extern struct inode_operations ext3_dir_inode_operations;
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index e71dd98dbcae..7abf90147180 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -19,6 +19,7 @@
19#include <linux/rwsem.h> 19#include <linux/rwsem.h>
20#include <linux/rbtree.h> 20#include <linux/rbtree.h>
21#include <linux/seqlock.h> 21#include <linux/seqlock.h>
22#include <linux/mutex.h>
22 23
23struct ext3_reserve_window { 24struct ext3_reserve_window {
24 __u32 _rsv_start; /* First byte reserved */ 25 __u32 _rsv_start; /* First byte reserved */
@@ -122,16 +123,16 @@ struct ext3_inode_info {
122 __u16 i_extra_isize; 123 __u16 i_extra_isize;
123 124
124 /* 125 /*
125 * truncate_sem is for serialising ext3_truncate() against 126 * truncate_mutex is for serialising ext3_truncate() against
126 * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's 127 * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's
127 * data tree are chopped off during truncate. We can't do that in 128 * data tree are chopped off during truncate. We can't do that in
128 * ext3 because whenever we perform intermediate commits during 129 * ext3 because whenever we perform intermediate commits during
129 * truncate, the inode and all the metadata blocks *must* be in a 130 * truncate, the inode and all the metadata blocks *must* be in a
130 * consistent state which allows truncation of the orphans to restart 131 * consistent state which allows truncation of the orphans to restart
131 * during recovery. Hence we must fix the get_block-vs-truncate race 132 * during recovery. Hence we must fix the get_block-vs-truncate race
132 * by other means, so we have truncate_sem. 133 * by other means, so we have truncate_mutex.
133 */ 134 */
134 struct semaphore truncate_sem; 135 struct mutex truncate_mutex;
135 struct inode vfs_inode; 136 struct inode vfs_inode;
136}; 137};
137 138
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 2cb19e6503aa..315d89740ddf 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -734,7 +734,7 @@ struct fb_tile_ops {
734 734
735/* A driver may set this flag to indicate that it does want a set_par to be 735/* A driver may set this flag to indicate that it does want a set_par to be
736 * called every time when fbcon_switch is executed. The advantage is that with 736 * called every time when fbcon_switch is executed. The advantage is that with
737 * this flag set you can really be shure that set_par is always called before 737 * this flag set you can really be sure that set_par is always called before
738 * any of the functions dependant on the correct hardware state or altering 738 * any of the functions dependant on the correct hardware state or altering
739 * that state, even if you are using some broken X releases. The disadvantage 739 * that state, even if you are using some broken X releases. The disadvantage
740 * is that it introduces unwanted delays to every console switch if set_par 740 * is that it introduces unwanted delays to every console switch if set_par
@@ -839,12 +839,10 @@ struct fb_info {
839#define FB_LEFT_POS(bpp) (32 - bpp) 839#define FB_LEFT_POS(bpp) (32 - bpp)
840#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits)) 840#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits))
841#define FB_SHIFT_LOW(val, bits) ((val) << (bits)) 841#define FB_SHIFT_LOW(val, bits) ((val) << (bits))
842#define FB_BIT_NR(b) (7 - (b))
843#else 842#else
844#define FB_LEFT_POS(bpp) (0) 843#define FB_LEFT_POS(bpp) (0)
845#define FB_SHIFT_HIGH(val, bits) ((val) << (bits)) 844#define FB_SHIFT_HIGH(val, bits) ((val) << (bits))
846#define FB_SHIFT_LOW(val, bits) ((val) >> (bits)) 845#define FB_SHIFT_LOW(val, bits) ((val) >> (bits))
847#define FB_BIT_NR(b) (b)
848#endif 846#endif
849 847
850 /* 848 /*
diff --git a/include/linux/file.h b/include/linux/file.h
index 9901b850f2e4..9f7c2513866f 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -10,6 +10,7 @@
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/rcupdate.h> 12#include <linux/rcupdate.h>
13#include <linux/types.h>
13 14
14/* 15/*
15 * The default fd array needs to be at least BITS_PER_LONG, 16 * The default fd array needs to be at least BITS_PER_LONG,
@@ -17,10 +18,22 @@
17 */ 18 */
18#define NR_OPEN_DEFAULT BITS_PER_LONG 19#define NR_OPEN_DEFAULT BITS_PER_LONG
19 20
21/*
22 * The embedded_fd_set is a small fd_set,
23 * suitable for most tasks (which open <= BITS_PER_LONG files)
24 */
25struct embedded_fd_set {
26 unsigned long fds_bits[1];
27};
28
29/*
30 * More than this number of fds: we use a separately allocated fd_set
31 */
32#define EMBEDDED_FD_SET_SIZE (BITS_PER_BYTE * sizeof(struct embedded_fd_set))
33
20struct fdtable { 34struct fdtable {
21 unsigned int max_fds; 35 unsigned int max_fds;
22 int max_fdset; 36 int max_fdset;
23 int next_fd;
24 struct file ** fd; /* current fd array */ 37 struct file ** fd; /* current fd array */
25 fd_set *close_on_exec; 38 fd_set *close_on_exec;
26 fd_set *open_fds; 39 fd_set *open_fds;
@@ -33,13 +46,20 @@ struct fdtable {
33 * Open file table structure 46 * Open file table structure
34 */ 47 */
35struct files_struct { 48struct files_struct {
49 /*
50 * read mostly part
51 */
36 atomic_t count; 52 atomic_t count;
37 struct fdtable *fdt; 53 struct fdtable *fdt;
38 struct fdtable fdtab; 54 struct fdtable fdtab;
39 fd_set close_on_exec_init; 55 /*
40 fd_set open_fds_init; 56 * written part on a separate cache line in SMP
57 */
58 spinlock_t file_lock ____cacheline_aligned_in_smp;
59 int next_fd;
60 struct embedded_fd_set close_on_exec_init;
61 struct embedded_fd_set open_fds_init;
41 struct file * fd_array[NR_OPEN_DEFAULT]; 62 struct file * fd_array[NR_OPEN_DEFAULT];
42 spinlock_t file_lock; /* Protects concurrent writers. Nests inside tsk->alloc_lock */
43}; 63};
44 64
45#define files_fdtable(files) (rcu_dereference((files)->fdt)) 65#define files_fdtable(files) (rcu_dereference((files)->fdt))
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 128d0082522c..4ed7e602d703 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -65,6 +65,11 @@ extern int dir_notify_enable;
65#define FMODE_PREAD 8 65#define FMODE_PREAD 8
66#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ 66#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */
67 67
68/* File is being opened for execution. Primary users of this flag are
69 distributed filesystems that can use it to achieve correct ETXTBUSY
70 behavior for cross-node execution/opening_for_writing of files */
71#define FMODE_EXEC 16
72
68#define RW_MASK 1 73#define RW_MASK 1
69#define RWA_MASK 2 74#define RWA_MASK 2
70#define READ 0 75#define READ 0
@@ -103,7 +108,9 @@ extern int dir_notify_enable;
103#define MS_BIND 4096 108#define MS_BIND 4096
104#define MS_MOVE 8192 109#define MS_MOVE 8192
105#define MS_REC 16384 110#define MS_REC 16384
106#define MS_VERBOSE 32768 111#define MS_VERBOSE 32768 /* War is peace. Verbosity is silence.
112 MS_VERBOSE is deprecated. */
113#define MS_SILENT 32768
107#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ 114#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
108#define MS_UNBINDABLE (1<<17) /* change to unbindable */ 115#define MS_UNBINDABLE (1<<17) /* change to unbindable */
109#define MS_PRIVATE (1<<18) /* change to private */ 116#define MS_PRIVATE (1<<18) /* change to private */
@@ -197,6 +204,10 @@ extern int dir_notify_enable;
197#define BLKBSZGET _IOR(0x12,112,size_t) 204#define BLKBSZGET _IOR(0x12,112,size_t)
198#define BLKBSZSET _IOW(0x12,113,size_t) 205#define BLKBSZSET _IOW(0x12,113,size_t)
199#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */ 206#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
207#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
208#define BLKTRACESTART _IO(0x12,116)
209#define BLKTRACESTOP _IO(0x12,117)
210#define BLKTRACETEARDOWN _IO(0x12,118)
200 211
201#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 212#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
202#define FIBMAP _IO(0x00,1) /* bmap access */ 213#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -241,9 +252,6 @@ extern void __init files_init(unsigned long);
241struct buffer_head; 252struct buffer_head;
242typedef int (get_block_t)(struct inode *inode, sector_t iblock, 253typedef int (get_block_t)(struct inode *inode, sector_t iblock,
243 struct buffer_head *bh_result, int create); 254 struct buffer_head *bh_result, int create);
244typedef int (get_blocks_t)(struct inode *inode, sector_t iblock,
245 unsigned long max_blocks,
246 struct buffer_head *bh_result, int create);
247typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, 255typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
248 ssize_t bytes, void *private); 256 ssize_t bytes, void *private);
249 257
@@ -339,12 +347,12 @@ struct writeback_control;
339struct address_space_operations { 347struct address_space_operations {
340 int (*writepage)(struct page *page, struct writeback_control *wbc); 348 int (*writepage)(struct page *page, struct writeback_control *wbc);
341 int (*readpage)(struct file *, struct page *); 349 int (*readpage)(struct file *, struct page *);
342 int (*sync_page)(struct page *); 350 void (*sync_page)(struct page *);
343 351
344 /* Write back some dirty pages from this mapping. */ 352 /* Write back some dirty pages from this mapping. */
345 int (*writepages)(struct address_space *, struct writeback_control *); 353 int (*writepages)(struct address_space *, struct writeback_control *);
346 354
347 /* Set a page dirty */ 355 /* Set a page dirty. Return true if this dirtied it */
348 int (*set_page_dirty)(struct page *page); 356 int (*set_page_dirty)(struct page *page);
349 357
350 int (*readpages)(struct file *filp, struct address_space *mapping, 358 int (*readpages)(struct file *filp, struct address_space *mapping,
@@ -358,7 +366,7 @@ struct address_space_operations {
358 int (*commit_write)(struct file *, struct page *, unsigned, unsigned); 366 int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
359 /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ 367 /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
360 sector_t (*bmap)(struct address_space *, sector_t); 368 sector_t (*bmap)(struct address_space *, sector_t);
361 int (*invalidatepage) (struct page *, unsigned long); 369 void (*invalidatepage) (struct page *, unsigned long);
362 int (*releasepage) (struct page *, gfp_t); 370 int (*releasepage) (struct page *, gfp_t);
363 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 371 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
364 loff_t offset, unsigned long nr_segs); 372 loff_t offset, unsigned long nr_segs);
@@ -397,11 +405,14 @@ struct block_device {
397 dev_t bd_dev; /* not a kdev_t - it's a search key */ 405 dev_t bd_dev; /* not a kdev_t - it's a search key */
398 struct inode * bd_inode; /* will die */ 406 struct inode * bd_inode; /* will die */
399 int bd_openers; 407 int bd_openers;
400 struct semaphore bd_sem; /* open/close mutex */ 408 struct mutex bd_mutex; /* open/close mutex */
401 struct semaphore bd_mount_sem; /* mount mutex */ 409 struct mutex bd_mount_mutex; /* mount mutex */
402 struct list_head bd_inodes; 410 struct list_head bd_inodes;
403 void * bd_holder; 411 void * bd_holder;
404 int bd_holders; 412 int bd_holders;
413#ifdef CONFIG_SYSFS
414 struct list_head bd_holder_list;
415#endif
405 struct block_device * bd_contains; 416 struct block_device * bd_contains;
406 unsigned bd_block_size; 417 unsigned bd_block_size;
407 struct hd_struct * bd_part; 418 struct hd_struct * bd_part;
@@ -479,13 +490,13 @@ struct inode {
479 unsigned int i_blkbits; 490 unsigned int i_blkbits;
480 unsigned long i_blksize; 491 unsigned long i_blksize;
481 unsigned long i_version; 492 unsigned long i_version;
482 unsigned long i_blocks; 493 blkcnt_t i_blocks;
483 unsigned short i_bytes; 494 unsigned short i_bytes;
484 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 495 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
485 struct mutex i_mutex; 496 struct mutex i_mutex;
486 struct rw_semaphore i_alloc_sem; 497 struct rw_semaphore i_alloc_sem;
487 struct inode_operations *i_op; 498 struct inode_operations *i_op;
488 struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 499 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
489 struct super_block *i_sb; 500 struct super_block *i_sb;
490 struct file_lock *i_flock; 501 struct file_lock *i_flock;
491 struct address_space *i_mapping; 502 struct address_space *i_mapping;
@@ -509,7 +520,7 @@ struct inode {
509 520
510#ifdef CONFIG_INOTIFY 521#ifdef CONFIG_INOTIFY
511 struct list_head inotify_watches; /* watches on this inode */ 522 struct list_head inotify_watches; /* watches on this inode */
512 struct semaphore inotify_sem; /* protects the watches list */ 523 struct mutex inotify_mutex; /* protects the watches list */
513#endif 524#endif
514 525
515 unsigned long i_state; 526 unsigned long i_state;
@@ -625,7 +636,7 @@ struct file {
625 } f_u; 636 } f_u;
626 struct dentry *f_dentry; 637 struct dentry *f_dentry;
627 struct vfsmount *f_vfsmnt; 638 struct vfsmount *f_vfsmnt;
628 struct file_operations *f_op; 639 const struct file_operations *f_op;
629 atomic_t f_count; 640 atomic_t f_count;
630 unsigned int f_flags; 641 unsigned int f_flags;
631 mode_t f_mode; 642 mode_t f_mode;
@@ -667,7 +678,6 @@ extern spinlock_t files_lock;
667#define FL_POSIX 1 678#define FL_POSIX 1
668#define FL_FLOCK 2 679#define FL_FLOCK 2
669#define FL_ACCESS 8 /* not trying to lock, just looking */ 680#define FL_ACCESS 8 /* not trying to lock, just looking */
670#define FL_LOCKD 16 /* lock held by rpc.lockd */
671#define FL_LEASE 32 /* lease held on this file */ 681#define FL_LEASE 32 /* lease held on this file */
672#define FL_SLEEP 128 /* A blocking lock */ 682#define FL_SLEEP 128 /* A blocking lock */
673 683
@@ -731,8 +741,6 @@ struct file_lock {
731#define OFFT_OFFSET_MAX INT_LIMIT(off_t) 741#define OFFT_OFFSET_MAX INT_LIMIT(off_t)
732#endif 742#endif
733 743
734extern struct list_head file_lock_list;
735
736#include <linux/fcntl.h> 744#include <linux/fcntl.h>
737 745
738extern int fcntl_getlk(struct file *, struct flock __user *); 746extern int fcntl_getlk(struct file *, struct flock __user *);
@@ -749,15 +757,22 @@ extern void send_sigio(struct fown_struct *fown, int fd, int band);
749extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); 757extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
750extern int fcntl_getlease(struct file *filp); 758extern int fcntl_getlease(struct file *filp);
751 759
760/* fs/sync.c */
761#define SYNC_FILE_RANGE_WAIT_BEFORE 1
762#define SYNC_FILE_RANGE_WRITE 2
763#define SYNC_FILE_RANGE_WAIT_AFTER 4
764extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte,
765 int flags);
766
752/* fs/locks.c */ 767/* fs/locks.c */
753extern void locks_init_lock(struct file_lock *); 768extern void locks_init_lock(struct file_lock *);
754extern void locks_copy_lock(struct file_lock *, struct file_lock *); 769extern void locks_copy_lock(struct file_lock *, struct file_lock *);
755extern void locks_remove_posix(struct file *, fl_owner_t); 770extern void locks_remove_posix(struct file *, fl_owner_t);
756extern void locks_remove_flock(struct file *); 771extern void locks_remove_flock(struct file *);
757extern struct file_lock *posix_test_lock(struct file *, struct file_lock *); 772extern int posix_test_lock(struct file *, struct file_lock *, struct file_lock *);
773extern int posix_lock_file_conf(struct file *, struct file_lock *, struct file_lock *);
758extern int posix_lock_file(struct file *, struct file_lock *); 774extern int posix_lock_file(struct file *, struct file_lock *);
759extern int posix_lock_file_wait(struct file *, struct file_lock *); 775extern int posix_lock_file_wait(struct file *, struct file_lock *);
760extern void posix_block_lock(struct file_lock *, struct file_lock *);
761extern int posix_unblock_lock(struct file *, struct file_lock *); 776extern int posix_unblock_lock(struct file *, struct file_lock *);
762extern int posix_locks_deadlock(struct file_lock *, struct file_lock *); 777extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);
763extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 778extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
@@ -847,7 +862,7 @@ struct super_block {
847 * The next field is for VFS *only*. No filesystems have any business 862 * The next field is for VFS *only*. No filesystems have any business
848 * even looking at it. You had been warned. 863 * even looking at it. You had been warned.
849 */ 864 */
850 struct semaphore s_vfs_rename_sem; /* Kludge */ 865 struct mutex s_vfs_rename_mutex; /* Kludge */
851 866
852 /* Granuality of c/m/atime in ns. 867 /* Granuality of c/m/atime in ns.
853 Cannot be worse than a second */ 868 Cannot be worse than a second */
@@ -1024,6 +1039,8 @@ struct file_operations {
1024 int (*check_flags)(int); 1039 int (*check_flags)(int);
1025 int (*dir_notify)(struct file *filp, unsigned long arg); 1040 int (*dir_notify)(struct file *filp, unsigned long arg);
1026 int (*flock) (struct file *, int, struct file_lock *); 1041 int (*flock) (struct file *, int, struct file_lock *);
1042 ssize_t (*splice_write)(struct inode *, struct file *, size_t, unsigned int);
1043 ssize_t (*splice_read)(struct file *, struct inode *, size_t, unsigned int);
1027}; 1044};
1028 1045
1029struct inode_operations { 1046struct inode_operations {
@@ -1086,6 +1103,7 @@ struct super_operations {
1086 void (*umount_begin) (struct super_block *); 1103 void (*umount_begin) (struct super_block *);
1087 1104
1088 int (*show_options)(struct seq_file *, struct vfsmount *); 1105 int (*show_options)(struct seq_file *, struct vfsmount *);
1106 int (*show_stats)(struct seq_file *, struct vfsmount *);
1089 1107
1090 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1108 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1091 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1109 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
@@ -1115,6 +1133,18 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1115 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1133 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1116} 1134}
1117 1135
1136static inline void inode_inc_link_count(struct inode *inode)
1137{
1138 inode->i_nlink++;
1139 mark_inode_dirty(inode);
1140}
1141
1142static inline void inode_dec_link_count(struct inode *inode)
1143{
1144 inode->i_nlink--;
1145 mark_inode_dirty(inode);
1146}
1147
1118extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); 1148extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
1119static inline void file_accessed(struct file *file) 1149static inline void file_accessed(struct file *file)
1120{ 1150{
@@ -1369,11 +1399,11 @@ extern void bd_set_size(struct block_device *, loff_t size);
1369extern void bd_forget(struct inode *inode); 1399extern void bd_forget(struct inode *inode);
1370extern void bdput(struct block_device *); 1400extern void bdput(struct block_device *);
1371extern struct block_device *open_by_devnum(dev_t, unsigned); 1401extern struct block_device *open_by_devnum(dev_t, unsigned);
1372extern struct file_operations def_blk_fops; 1402extern const struct file_operations def_blk_fops;
1373extern struct address_space_operations def_blk_aops; 1403extern struct address_space_operations def_blk_aops;
1374extern struct file_operations def_chr_fops; 1404extern const struct file_operations def_chr_fops;
1375extern struct file_operations bad_sock_fops; 1405extern const struct file_operations bad_sock_fops;
1376extern struct file_operations def_fifo_fops; 1406extern const struct file_operations def_fifo_fops;
1377extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 1407extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
1378extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); 1408extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
1379extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1409extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
@@ -1381,34 +1411,34 @@ extern int blkdev_get(struct block_device *, mode_t, unsigned);
1381extern int blkdev_put(struct block_device *); 1411extern int blkdev_put(struct block_device *);
1382extern int bd_claim(struct block_device *, void *); 1412extern int bd_claim(struct block_device *, void *);
1383extern void bd_release(struct block_device *); 1413extern void bd_release(struct block_device *);
1414#ifdef CONFIG_SYSFS
1415extern int bd_claim_by_disk(struct block_device *, void *, struct gendisk *);
1416extern void bd_release_from_disk(struct block_device *, struct gendisk *);
1417#else
1418#define bd_claim_by_disk(bdev, holder, disk) bd_claim(bdev, holder)
1419#define bd_release_from_disk(bdev, disk) bd_release(bdev)
1420#endif
1384 1421
1385/* fs/char_dev.c */ 1422/* fs/char_dev.c */
1423#define CHRDEV_MAJOR_HASH_SIZE 255
1386extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); 1424extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
1387extern int register_chrdev_region(dev_t, unsigned, const char *); 1425extern int register_chrdev_region(dev_t, unsigned, const char *);
1388extern int register_chrdev(unsigned int, const char *, 1426extern int register_chrdev(unsigned int, const char *,
1389 struct file_operations *); 1427 const struct file_operations *);
1390extern int unregister_chrdev(unsigned int, const char *); 1428extern int unregister_chrdev(unsigned int, const char *);
1391extern void unregister_chrdev_region(dev_t, unsigned); 1429extern void unregister_chrdev_region(dev_t, unsigned);
1392extern int chrdev_open(struct inode *, struct file *); 1430extern int chrdev_open(struct inode *, struct file *);
1393extern int get_chrdev_list(char *); 1431extern void chrdev_show(struct seq_file *,off_t);
1394extern void *acquire_chrdev_list(void);
1395extern int count_chrdev_list(void);
1396extern void *get_next_chrdev(void *);
1397extern int get_chrdev_info(void *, int *, char **);
1398extern void release_chrdev_list(void *);
1399 1432
1400/* fs/block_dev.c */ 1433/* fs/block_dev.c */
1434#define BLKDEV_MAJOR_HASH_SIZE 255
1401#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 1435#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
1402extern const char *__bdevname(dev_t, char *buffer); 1436extern const char *__bdevname(dev_t, char *buffer);
1403extern const char *bdevname(struct block_device *bdev, char *buffer); 1437extern const char *bdevname(struct block_device *bdev, char *buffer);
1404extern struct block_device *lookup_bdev(const char *); 1438extern struct block_device *lookup_bdev(const char *);
1405extern struct block_device *open_bdev_excl(const char *, int, void *); 1439extern struct block_device *open_bdev_excl(const char *, int, void *);
1406extern void close_bdev_excl(struct block_device *); 1440extern void close_bdev_excl(struct block_device *);
1407extern void *acquire_blkdev_list(void); 1441extern void blkdev_show(struct seq_file *,off_t);
1408extern int count_blkdev_list(void);
1409extern void *get_next_blkdev(void *);
1410extern int get_blkdev_info(void *, int *, char **);
1411extern void release_blkdev_list(void *);
1412 1442
1413extern void init_special_inode(struct inode *, umode_t, dev_t); 1443extern void init_special_inode(struct inode *, umode_t, dev_t);
1414 1444
@@ -1416,9 +1446,9 @@ extern void init_special_inode(struct inode *, umode_t, dev_t);
1416extern void make_bad_inode(struct inode *); 1446extern void make_bad_inode(struct inode *);
1417extern int is_bad_inode(struct inode *); 1447extern int is_bad_inode(struct inode *);
1418 1448
1419extern struct file_operations read_fifo_fops; 1449extern const struct file_operations read_fifo_fops;
1420extern struct file_operations write_fifo_fops; 1450extern const struct file_operations write_fifo_fops;
1421extern struct file_operations rdwr_fifo_fops; 1451extern const struct file_operations rdwr_fifo_fops;
1422 1452
1423extern int fs_may_remount_ro(struct super_block *); 1453extern int fs_may_remount_ro(struct super_block *);
1424 1454
@@ -1455,6 +1485,12 @@ extern int filemap_fdatawait(struct address_space *);
1455extern int filemap_write_and_wait(struct address_space *mapping); 1485extern int filemap_write_and_wait(struct address_space *mapping);
1456extern int filemap_write_and_wait_range(struct address_space *mapping, 1486extern int filemap_write_and_wait_range(struct address_space *mapping,
1457 loff_t lstart, loff_t lend); 1487 loff_t lstart, loff_t lend);
1488extern int wait_on_page_writeback_range(struct address_space *mapping,
1489 pgoff_t start, pgoff_t end);
1490extern int __filemap_fdatawrite_range(struct address_space *mapping,
1491 loff_t start, loff_t end, int sync_mode);
1492
1493extern long do_fsync(struct file *file, int datasync);
1458extern void sync_supers(void); 1494extern void sync_supers(void);
1459extern void sync_filesystems(int wait); 1495extern void sync_filesystems(int wait);
1460extern void emergency_sync(void); 1496extern void emergency_sync(void);
@@ -1534,7 +1570,6 @@ extern void destroy_inode(struct inode *);
1534extern struct inode *new_inode(struct super_block *); 1570extern struct inode *new_inode(struct super_block *);
1535extern int remove_suid(struct dentry *); 1571extern int remove_suid(struct dentry *);
1536extern void remove_dquot_ref(struct super_block *, int, struct list_head *); 1572extern void remove_dquot_ref(struct super_block *, int, struct list_head *);
1537extern struct semaphore iprune_sem;
1538 1573
1539extern void __insert_inode_hash(struct inode *, unsigned long hashval); 1574extern void __insert_inode_hash(struct inode *, unsigned long hashval);
1540extern void remove_inode_hash(struct inode *); 1575extern void remove_inode_hash(struct inode *);
@@ -1576,6 +1611,8 @@ extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor
1576extern void do_generic_mapping_read(struct address_space *mapping, 1611extern void do_generic_mapping_read(struct address_space *mapping,
1577 struct file_ra_state *, struct file *, 1612 struct file_ra_state *, struct file *,
1578 loff_t *, read_descriptor_t *, read_actor_t); 1613 loff_t *, read_descriptor_t *, read_actor_t);
1614extern ssize_t generic_file_splice_read(struct file *, struct inode *, size_t, unsigned int);
1615extern ssize_t generic_file_splice_write(struct inode *, struct file *, size_t, unsigned int);
1579extern void 1616extern void
1580file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 1617file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
1581extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, 1618extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov,
@@ -1619,7 +1656,7 @@ static inline void do_generic_file_read(struct file * filp, loff_t *ppos,
1619 1656
1620ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 1657ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1621 struct block_device *bdev, const struct iovec *iov, loff_t offset, 1658 struct block_device *bdev, const struct iovec *iov, loff_t offset,
1622 unsigned long nr_segs, get_blocks_t get_blocks, dio_iodone_t end_io, 1659 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
1623 int lock_type); 1660 int lock_type);
1624 1661
1625enum { 1662enum {
@@ -1630,32 +1667,32 @@ enum {
1630 1667
1631static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 1668static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
1632 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 1669 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
1633 loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, 1670 loff_t offset, unsigned long nr_segs, get_block_t get_block,
1634 dio_iodone_t end_io) 1671 dio_iodone_t end_io)
1635{ 1672{
1636 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 1673 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
1637 nr_segs, get_blocks, end_io, DIO_LOCKING); 1674 nr_segs, get_block, end_io, DIO_LOCKING);
1638} 1675}
1639 1676
1640static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, 1677static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
1641 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 1678 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
1642 loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, 1679 loff_t offset, unsigned long nr_segs, get_block_t get_block,
1643 dio_iodone_t end_io) 1680 dio_iodone_t end_io)
1644{ 1681{
1645 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 1682 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
1646 nr_segs, get_blocks, end_io, DIO_NO_LOCKING); 1683 nr_segs, get_block, end_io, DIO_NO_LOCKING);
1647} 1684}
1648 1685
1649static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb, 1686static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb,
1650 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 1687 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
1651 loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, 1688 loff_t offset, unsigned long nr_segs, get_block_t get_block,
1652 dio_iodone_t end_io) 1689 dio_iodone_t end_io)
1653{ 1690{
1654 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 1691 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
1655 nr_segs, get_blocks, end_io, DIO_OWN_LOCKING); 1692 nr_segs, get_block, end_io, DIO_OWN_LOCKING);
1656} 1693}
1657 1694
1658extern struct file_operations generic_ro_fops; 1695extern const struct file_operations generic_ro_fops;
1659 1696
1660#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) 1697#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
1661 1698
@@ -1711,9 +1748,9 @@ extern int simple_commit_write(struct file *file, struct page *page,
1711 1748
1712extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *); 1749extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *);
1713extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); 1750extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
1714extern struct file_operations simple_dir_operations; 1751extern const struct file_operations simple_dir_operations;
1715extern struct inode_operations simple_dir_inode_operations; 1752extern struct inode_operations simple_dir_inode_operations;
1716struct tree_descr { char *name; struct file_operations *ops; int mode; }; 1753struct tree_descr { char *name; const struct file_operations *ops; int mode; };
1717struct dentry *d_alloc_name(struct dentry *, const char *); 1754struct dentry *d_alloc_name(struct dentry *, const char *);
1718extern int simple_fill_super(struct super_block *, int, struct tree_descr *); 1755extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
1719extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count); 1756extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index a9f1cfd096ff..a3a0e078f79d 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -83,5 +83,32 @@ struct fsl_i2c_platform_data {
83#define FSL_I2C_DEV_SEPARATE_DFSRR 0x00000001 83#define FSL_I2C_DEV_SEPARATE_DFSRR 0x00000001
84#define FSL_I2C_DEV_CLOCK_5200 0x00000002 84#define FSL_I2C_DEV_CLOCK_5200 0x00000002
85 85
86
87enum fsl_usb2_operating_modes {
88 FSL_USB2_MPH_HOST,
89 FSL_USB2_DR_HOST,
90 FSL_USB2_DR_DEVICE,
91 FSL_USB2_DR_OTG,
92};
93
94enum fsl_usb2_phy_modes {
95 FSL_USB2_PHY_NONE,
96 FSL_USB2_PHY_ULPI,
97 FSL_USB2_PHY_UTMI,
98 FSL_USB2_PHY_UTMI_WIDE,
99 FSL_USB2_PHY_SERIAL,
100};
101
102struct fsl_usb2_platform_data {
103 /* board specific information */
104 enum fsl_usb2_operating_modes operating_mode;
105 enum fsl_usb2_phy_modes phy_mode;
106 unsigned int port_enables;
107};
108
109/* Flags in fsl_usb2_mph_platform_data */
110#define FSL_USB2_PORT0_ENABLED 0x00000001
111#define FSL_USB2_PORT1_ENABLED 0x00000002
112
86#endif /* _FSL_DEVICE_H_ */ 113#endif /* _FSL_DEVICE_H_ */
87#endif /* __KERNEL__ */ 114#endif /* __KERNEL__ */
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 03b8e7932b83..11438eff4d44 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -15,6 +15,26 @@
15 15
16#include <linux/dnotify.h> 16#include <linux/dnotify.h>
17#include <linux/inotify.h> 17#include <linux/inotify.h>
18#include <linux/audit.h>
19
20/*
21 * fsnotify_d_instantiate - instantiate a dentry for inode
22 * Called with dcache_lock held.
23 */
24static inline void fsnotify_d_instantiate(struct dentry *entry,
25 struct inode *inode)
26{
27 inotify_d_instantiate(entry, inode);
28}
29
30/*
31 * fsnotify_d_move - entry has been moved
32 * Called with dcache_lock and entry->d_lock held.
33 */
34static inline void fsnotify_d_move(struct dentry *entry)
35{
36 inotify_d_move(entry);
37}
18 38
19/* 39/*
20 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir 40 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
@@ -45,6 +65,8 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
45 if (source) { 65 if (source) {
46 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL); 66 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL);
47 } 67 }
68 audit_inode_child(old_name, source, old_dir->i_ino);
69 audit_inode_child(new_name, target, new_dir->i_ino);
48} 70}
49 71
50/* 72/*
@@ -70,19 +92,22 @@ static inline void fsnotify_inoderemove(struct inode *inode)
70/* 92/*
71 * fsnotify_create - 'name' was linked in 93 * fsnotify_create - 'name' was linked in
72 */ 94 */
73static inline void fsnotify_create(struct inode *inode, const char *name) 95static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
74{ 96{
75 inode_dir_notify(inode, DN_CREATE); 97 inode_dir_notify(inode, DN_CREATE);
76 inotify_inode_queue_event(inode, IN_CREATE, 0, name); 98 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name);
99 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino);
77} 100}
78 101
79/* 102/*
80 * fsnotify_mkdir - directory 'name' was created 103 * fsnotify_mkdir - directory 'name' was created
81 */ 104 */
82static inline void fsnotify_mkdir(struct inode *inode, const char *name) 105static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
83{ 106{
84 inode_dir_notify(inode, DN_CREATE); 107 inode_dir_notify(inode, DN_CREATE);
85 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, name); 108 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0,
109 dentry->d_name.name);
110 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino);
86} 111}
87 112
88/* 113/*
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 10f96c31971e..966a5b3da439 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_FUTEX_H 1#ifndef _LINUX_FUTEX_H
2#define _LINUX_FUTEX_H 2#define _LINUX_FUTEX_H
3 3
4#include <linux/sched.h>
5
4/* Second argument to futex syscall */ 6/* Second argument to futex syscall */
5 7
6 8
@@ -11,10 +13,97 @@
11#define FUTEX_CMP_REQUEUE 4 13#define FUTEX_CMP_REQUEUE 4
12#define FUTEX_WAKE_OP 5 14#define FUTEX_WAKE_OP 5
13 15
16/*
17 * Support for robust futexes: the kernel cleans up held futexes at
18 * thread exit time.
19 */
20
21/*
22 * Per-lock list entry - embedded in user-space locks, somewhere close
23 * to the futex field. (Note: user-space uses a double-linked list to
24 * achieve O(1) list add and remove, but the kernel only needs to know
25 * about the forward link)
26 *
27 * NOTE: this structure is part of the syscall ABI, and must not be
28 * changed.
29 */
30struct robust_list {
31 struct robust_list __user *next;
32};
33
34/*
35 * Per-thread list head:
36 *
37 * NOTE: this structure is part of the syscall ABI, and must only be
38 * changed if the change is first communicated with the glibc folks.
39 * (When an incompatible change is done, we'll increase the structure
40 * size, which glibc will detect)
41 */
42struct robust_list_head {
43 /*
44 * The head of the list. Points back to itself if empty:
45 */
46 struct robust_list list;
47
48 /*
49 * This relative offset is set by user-space, it gives the kernel
50 * the relative position of the futex field to examine. This way
51 * we keep userspace flexible, to freely shape its data-structure,
52 * without hardcoding any particular offset into the kernel:
53 */
54 long futex_offset;
55
56 /*
57 * The death of the thread may race with userspace setting
58 * up a lock's links. So to handle this race, userspace first
59 * sets this field to the address of the to-be-taken lock,
60 * then does the lock acquire, and then adds itself to the
61 * list, and then clears this field. Hence the kernel will
62 * always have full knowledge of all locks that the thread
63 * _might_ have taken. We check the owner TID in any case,
64 * so only truly owned locks will be handled.
65 */
66 struct robust_list __user *list_op_pending;
67};
68
69/*
70 * Are there any waiters for this robust futex:
71 */
72#define FUTEX_WAITERS 0x80000000
73
74/*
75 * The kernel signals via this bit that a thread holding a futex
76 * has exited without unlocking the futex. The kernel also does
77 * a FUTEX_WAKE on such futexes, after setting the bit, to wake
78 * up any possible waiters:
79 */
80#define FUTEX_OWNER_DIED 0x40000000
81
82/*
83 * The rest of the robust-futex field is for the TID:
84 */
85#define FUTEX_TID_MASK 0x3fffffff
86
87/*
88 * This limit protects against a deliberately circular list.
89 * (Not worth introducing an rlimit for it)
90 */
91#define ROBUST_LIST_LIMIT 2048
92
14long do_futex(unsigned long uaddr, int op, int val, 93long do_futex(unsigned long uaddr, int op, int val,
15 unsigned long timeout, unsigned long uaddr2, int val2, 94 unsigned long timeout, unsigned long uaddr2, int val2,
16 int val3); 95 int val3);
17 96
97extern int handle_futex_death(u32 __user *uaddr, struct task_struct *curr);
98
99#ifdef CONFIG_FUTEX
100extern void exit_robust_list(struct task_struct *curr);
101#else
102static inline void exit_robust_list(struct task_struct *curr)
103{
104}
105#endif
106
18#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */ 107#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */
19#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */ 108#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */
20#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */ 109#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index 3e1b9b285258..71e7b2847cb3 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -120,7 +120,7 @@ static inline void gameport_set_name(struct gameport *gameport, const char *name
120} 120}
121 121
122/* 122/*
123 * Use the following fucntions to manipulate gameport's per-port 123 * Use the following functions to manipulate gameport's per-port
124 * driver-specific data. 124 * driver-specific data.
125 */ 125 */
126static inline void *gameport_get_drvdata(struct gameport *gameport) 126static inline void *gameport_get_drvdata(struct gameport *gameport)
@@ -134,7 +134,7 @@ static inline void gameport_set_drvdata(struct gameport *gameport, void *data)
134} 134}
135 135
136/* 136/*
137 * Use the following fucntions to pin gameport's driver in process context 137 * Use the following functions to pin gameport's driver in process context
138 */ 138 */
139static inline int gameport_pin_driver(struct gameport *gameport) 139static inline int gameport_pin_driver(struct gameport *gameport)
140{ 140{
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index 0abe9d9a0069..652611a4bdcd 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -12,6 +12,8 @@
12#ifndef GENERIC_SERIAL_H 12#ifndef GENERIC_SERIAL_H
13#define GENERIC_SERIAL_H 13#define GENERIC_SERIAL_H
14 14
15#include <linux/mutex.h>
16
15struct real_driver { 17struct real_driver {
16 void (*disable_tx_interrupts) (void *); 18 void (*disable_tx_interrupts) (void *);
17 void (*enable_tx_interrupts) (void *); 19 void (*enable_tx_interrupts) (void *);
@@ -34,7 +36,7 @@ struct gs_port {
34 int xmit_head; 36 int xmit_head;
35 int xmit_tail; 37 int xmit_tail;
36 int xmit_cnt; 38 int xmit_cnt;
37 struct semaphore port_write_sem; 39 struct mutex port_write_mutex;
38 int flags; 40 int flags;
39 wait_queue_head_t open_wait; 41 wait_queue_head_t open_wait;
40 wait_queue_head_t close_wait; 42 wait_queue_head_t close_wait;
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index eef5ccdcd731..10a27f29d692 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -78,6 +78,7 @@ struct hd_struct {
78 sector_t start_sect; 78 sector_t start_sect;
79 sector_t nr_sects; 79 sector_t nr_sects;
80 struct kobject kobj; 80 struct kobject kobj;
81 struct kobject *holder_dir;
81 unsigned ios[2], sectors[2]; /* READs and WRITEs */ 82 unsigned ios[2], sectors[2]; /* READs and WRITEs */
82 int policy, partno; 83 int policy, partno;
83}; 84};
@@ -89,12 +90,12 @@ struct hd_struct {
89#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 90#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
90 91
91struct disk_stats { 92struct disk_stats {
92 unsigned sectors[2]; /* READs and WRITEs */ 93 unsigned long sectors[2]; /* READs and WRITEs */
93 unsigned ios[2]; 94 unsigned long ios[2];
94 unsigned merges[2]; 95 unsigned long merges[2];
95 unsigned ticks[2]; 96 unsigned long ticks[2];
96 unsigned io_ticks; 97 unsigned long io_ticks;
97 unsigned time_in_queue; 98 unsigned long time_in_queue;
98}; 99};
99 100
100struct gendisk { 101struct gendisk {
@@ -114,6 +115,8 @@ struct gendisk {
114 int number; /* more of the same */ 115 int number; /* more of the same */
115 struct device *driverfs_dev; 116 struct device *driverfs_dev;
116 struct kobject kobj; 117 struct kobject kobj;
118 struct kobject *holder_dir;
119 struct kobject *slave_dir;
117 120
118 struct timer_rand_state *random; 121 struct timer_rand_state *random;
119 int policy; 122 int policy;
@@ -149,22 +152,16 @@ struct disk_attribute {
149({ \ 152({ \
150 typeof(gendiskp->dkstats->field) res = 0; \ 153 typeof(gendiskp->dkstats->field) res = 0; \
151 int i; \ 154 int i; \
152 for (i=0; i < NR_CPUS; i++) { \ 155 for_each_possible_cpu(i) \
153 if (!cpu_possible(i)) \
154 continue; \
155 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \ 156 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \
156 } \
157 res; \ 157 res; \
158}) 158})
159 159
160static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { 160static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) {
161 int i; 161 int i;
162 for (i=0; i < NR_CPUS; i++) { 162 for_each_possible_cpu(i)
163 if (cpu_possible(i)) { 163 memset(per_cpu_ptr(gendiskp->dkstats, i), value,
164 memset(per_cpu_ptr(gendiskp->dkstats, i), value, 164 sizeof (struct disk_stats));
165 sizeof (struct disk_stats));
166 }
167 }
168} 165}
169 166
170#else 167#else
diff --git a/include/linux/gigaset_dev.h b/include/linux/gigaset_dev.h
new file mode 100644
index 000000000000..70ad09c8ad1e
--- /dev/null
+++ b/include/linux/gigaset_dev.h
@@ -0,0 +1,32 @@
1/*
2 * interface to user space for the gigaset driver
3 *
4 * Copyright (c) 2004 by Hansjoerg Lipp <hjlipp@web.de>
5 *
6 * =====================================================================
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 * =====================================================================
12 * Version: $Id: gigaset_dev.h,v 1.4.4.4 2005/11/21 22:28:09 hjlipp Exp $
13 * =====================================================================
14 */
15
16#ifndef GIGASET_INTERFACE_H
17#define GIGASET_INTERFACE_H
18
19#include <linux/ioctl.h>
20
21#define GIGASET_IOCTL 0x47
22
23#define GIGVER_DRIVER 0
24#define GIGVER_COMPAT 1
25#define GIGVER_FWBASE 2
26
27#define GIGASET_REDIR _IOWR (GIGASET_IOCTL, 0, int)
28#define GIGASET_CONFIG _IOWR (GIGASET_IOCTL, 1, int)
29#define GIGASET_BRKCHARS _IOW (GIGASET_IOCTL, 2, unsigned char[6]) //FIXME [6] okay?
30#define GIGASET_VERSION _IOWR (GIGASET_IOCTL, 3, unsigned[4])
31
32#endif
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 6bece9280eb7..892c4ea1b425 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -7,6 +7,18 @@
7 7
8#include <asm/cacheflush.h> 8#include <asm/cacheflush.h>
9 9
10#ifndef ARCH_HAS_FLUSH_ANON_PAGE
11static inline void flush_anon_page(struct page *page, unsigned long vmaddr)
12{
13}
14#endif
15
16#ifndef ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
17static inline void flush_kernel_dcache_page(struct page *page)
18{
19}
20#endif
21
10#ifdef CONFIG_HIGHMEM 22#ifdef CONFIG_HIGHMEM
11 23
12#include <asm/highmem.h> 24#include <asm/highmem.h>
diff --git a/include/linux/hpet.h b/include/linux/hpet.h
index 27238194b212..707f7cb9e795 100644
--- a/include/linux/hpet.h
+++ b/include/linux/hpet.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5 5
6#ifdef __KERNEL__
7
6/* 8/*
7 * Offsets into HPET Registers 9 * Offsets into HPET Registers
8 */ 10 */
@@ -85,22 +87,6 @@ struct hpet {
85#define Tn_FSB_INT_ADDR_SHIFT (32UL) 87#define Tn_FSB_INT_ADDR_SHIFT (32UL)
86#define Tn_FSB_INT_VAL_MASK (0x00000000ffffffffULL) 88#define Tn_FSB_INT_VAL_MASK (0x00000000ffffffffULL)
87 89
88struct hpet_info {
89 unsigned long hi_ireqfreq; /* Hz */
90 unsigned long hi_flags; /* information */
91 unsigned short hi_hpet;
92 unsigned short hi_timer;
93};
94
95#define HPET_INFO_PERIODIC 0x0001 /* timer is periodic */
96
97#define HPET_IE_ON _IO('h', 0x01) /* interrupt on */
98#define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */
99#define HPET_INFO _IOR('h', 0x03, struct hpet_info)
100#define HPET_EPI _IO('h', 0x04) /* enable periodic */
101#define HPET_DPI _IO('h', 0x05) /* disable periodic */
102#define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */
103
104/* 90/*
105 * exported interfaces 91 * exported interfaces
106 */ 92 */
@@ -133,4 +119,22 @@ int hpet_register(struct hpet_task *, int);
133int hpet_unregister(struct hpet_task *); 119int hpet_unregister(struct hpet_task *);
134int hpet_control(struct hpet_task *, unsigned int, unsigned long); 120int hpet_control(struct hpet_task *, unsigned int, unsigned long);
135 121
122#endif /* __KERNEL__ */
123
124struct hpet_info {
125 unsigned long hi_ireqfreq; /* Hz */
126 unsigned long hi_flags; /* information */
127 unsigned short hi_hpet;
128 unsigned short hi_timer;
129};
130
131#define HPET_INFO_PERIODIC 0x0001 /* timer is periodic */
132
133#define HPET_IE_ON _IO('h', 0x01) /* interrupt on */
134#define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */
135#define HPET_INFO _IOR('h', 0x03, struct hpet_info)
136#define HPET_EPI _IO('h', 0x04) /* enable periodic */
137#define HPET_DPI _IO('h', 0x05) /* disable periodic */
138#define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */
139
136#endif /* !__HPET__ */ 140#endif /* !__HPET__ */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 6401c31d6add..b20939287613 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -34,15 +34,7 @@ enum hrtimer_restart {
34 HRTIMER_RESTART, 34 HRTIMER_RESTART,
35}; 35};
36 36
37/* 37#define HRTIMER_INACTIVE ((void *)1UL)
38 * Timer states:
39 */
40enum hrtimer_state {
41 HRTIMER_INACTIVE, /* Timer is inactive */
42 HRTIMER_EXPIRED, /* Timer is expired */
43 HRTIMER_RUNNING, /* Timer is running the callback function */
44 HRTIMER_PENDING, /* Timer is pending */
45};
46 38
47struct hrtimer_base; 39struct hrtimer_base;
48 40
@@ -53,9 +45,7 @@ struct hrtimer_base;
53 * @expires: the absolute expiry time in the hrtimers internal 45 * @expires: the absolute expiry time in the hrtimers internal
54 * representation. The time is related to the clock on 46 * representation. The time is related to the clock on
55 * which the timer is based. 47 * which the timer is based.
56 * @state: state of the timer
57 * @function: timer expiry callback function 48 * @function: timer expiry callback function
58 * @data: argument for the callback function
59 * @base: pointer to the timer base (per cpu and per clock) 49 * @base: pointer to the timer base (per cpu and per clock)
60 * 50 *
61 * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE() 51 * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE()
@@ -63,23 +53,36 @@ struct hrtimer_base;
63struct hrtimer { 53struct hrtimer {
64 struct rb_node node; 54 struct rb_node node;
65 ktime_t expires; 55 ktime_t expires;
66 enum hrtimer_state state; 56 int (*function)(struct hrtimer *);
67 int (*function)(void *);
68 void *data;
69 struct hrtimer_base *base; 57 struct hrtimer_base *base;
70}; 58};
71 59
72/** 60/**
61 * struct hrtimer_sleeper - simple sleeper structure
62 *
63 * @timer: embedded timer structure
64 * @task: task to wake up
65 *
66 * task is set to NULL, when the timer expires.
67 */
68struct hrtimer_sleeper {
69 struct hrtimer timer;
70 struct task_struct *task;
71};
72
73/**
73 * struct hrtimer_base - the timer base for a specific clock 74 * struct hrtimer_base - the timer base for a specific clock
74 * 75 *
75 * @index: clock type index for per_cpu support when moving a timer 76 * @index: clock type index for per_cpu support when moving a timer
76 * to a base on another cpu. 77 * to a base on another cpu.
77 * @lock: lock protecting the base and associated timers 78 * @lock: lock protecting the base and associated timers
78 * @active: red black tree root node for the active timers 79 * @active: red black tree root node for the active timers
79 * @first: pointer to the timer node which expires first 80 * @first: pointer to the timer node which expires first
80 * @resolution: the resolution of the clock, in nanoseconds 81 * @resolution: the resolution of the clock, in nanoseconds
81 * @get_time: function to retrieve the current time of the clock 82 * @get_time: function to retrieve the current time of the clock
82 * @curr_timer: the timer which is executing a callback right now 83 * @get_sofirq_time: function to retrieve the current time from the softirq
84 * @curr_timer: the timer which is executing a callback right now
85 * @softirq_time: the time when running the hrtimer queue in the softirq
83 */ 86 */
84struct hrtimer_base { 87struct hrtimer_base {
85 clockid_t index; 88 clockid_t index;
@@ -88,7 +91,9 @@ struct hrtimer_base {
88 struct rb_node *first; 91 struct rb_node *first;
89 ktime_t resolution; 92 ktime_t resolution;
90 ktime_t (*get_time)(void); 93 ktime_t (*get_time)(void);
94 ktime_t (*get_softirq_time)(void);
91 struct hrtimer *curr_timer; 95 struct hrtimer *curr_timer;
96 ktime_t softirq_time;
92}; 97};
93 98
94/* 99/*
@@ -122,11 +127,12 @@ extern ktime_t hrtimer_get_next_event(void);
122 127
123static inline int hrtimer_active(const struct hrtimer *timer) 128static inline int hrtimer_active(const struct hrtimer *timer)
124{ 129{
125 return timer->state == HRTIMER_PENDING; 130 return timer->node.rb_parent != HRTIMER_INACTIVE;
126} 131}
127 132
128/* Forward a hrtimer so it expires after now: */ 133/* Forward a hrtimer so it expires after now: */
129extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval); 134extern unsigned long
135hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval);
130 136
131/* Precise sleep: */ 137/* Precise sleep: */
132extern long hrtimer_nanosleep(struct timespec *rqtp, 138extern long hrtimer_nanosleep(struct timespec *rqtp,
@@ -134,6 +140,9 @@ extern long hrtimer_nanosleep(struct timespec *rqtp,
134 const enum hrtimer_mode mode, 140 const enum hrtimer_mode mode,
135 const clockid_t clockid); 141 const clockid_t clockid);
136 142
143extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
144 struct task_struct *tsk);
145
137/* Soft interrupt function to run the hrtimer queues: */ 146/* Soft interrupt function to run the hrtimer queues: */
138extern void hrtimer_run_queues(void); 147extern void hrtimer_run_queues(void);
139 148
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 68d82ad6b17c..4c5e610fe442 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -20,10 +20,7 @@ void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long)
20int hugetlb_prefault(struct address_space *, struct vm_area_struct *); 20int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
21int hugetlb_report_meminfo(char *); 21int hugetlb_report_meminfo(char *);
22int hugetlb_report_node_meminfo(int, char *); 22int hugetlb_report_node_meminfo(int, char *);
23int is_hugepage_mem_enough(size_t);
24unsigned long hugetlb_total_pages(void); 23unsigned long hugetlb_total_pages(void);
25struct page *alloc_huge_page(struct vm_area_struct *, unsigned long);
26void free_huge_page(struct page *);
27int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, 24int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
28 unsigned long address, int write_access); 25 unsigned long address, int write_access);
29 26
@@ -39,18 +36,35 @@ struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
39 int write); 36 int write);
40struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, 37struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
41 pmd_t *pmd, int write); 38 pmd_t *pmd, int write);
42int is_aligned_hugepage_range(unsigned long addr, unsigned long len);
43int pmd_huge(pmd_t pmd); 39int pmd_huge(pmd_t pmd);
40void hugetlb_change_protection(struct vm_area_struct *vma,
41 unsigned long address, unsigned long end, pgprot_t newprot);
44 42
45#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE 43#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE
46#define is_hugepage_only_range(mm, addr, len) 0 44#define is_hugepage_only_range(mm, addr, len) 0
47#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ 45#endif
48 do { } while (0) 46
47#ifndef ARCH_HAS_HUGETLB_FREE_PGD_RANGE
48#define hugetlb_free_pgd_range free_pgd_range
49#else
50void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
51 unsigned long end, unsigned long floor,
52 unsigned long ceiling);
49#endif 53#endif
50 54
51#ifndef ARCH_HAS_PREPARE_HUGEPAGE_RANGE 55#ifndef ARCH_HAS_PREPARE_HUGEPAGE_RANGE
52#define prepare_hugepage_range(addr, len) \ 56/*
53 is_aligned_hugepage_range(addr, len) 57 * If the arch doesn't supply something else, assume that hugepage
58 * size aligned regions are ok without further preparation.
59 */
60static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
61{
62 if (len & ~HPAGE_MASK)
63 return -EINVAL;
64 if (addr & ~HPAGE_MASK)
65 return -EINVAL;
66 return 0;
67}
54#else 68#else
55int prepare_hugepage_range(unsigned long addr, unsigned long len); 69int prepare_hugepage_range(unsigned long addr, unsigned long len);
56#endif 70#endif
@@ -87,20 +101,17 @@ static inline unsigned long hugetlb_total_pages(void)
87#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) 101#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
88#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) 102#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; })
89#define unmap_hugepage_range(vma, start, end) BUG() 103#define unmap_hugepage_range(vma, start, end) BUG()
90#define is_hugepage_mem_enough(size) 0
91#define hugetlb_report_meminfo(buf) 0 104#define hugetlb_report_meminfo(buf) 0
92#define hugetlb_report_node_meminfo(n, buf) 0 105#define hugetlb_report_node_meminfo(n, buf) 0
93#define follow_huge_pmd(mm, addr, pmd, write) NULL 106#define follow_huge_pmd(mm, addr, pmd, write) NULL
94#define is_aligned_hugepage_range(addr, len) 0
95#define prepare_hugepage_range(addr, len) (-EINVAL) 107#define prepare_hugepage_range(addr, len) (-EINVAL)
96#define pmd_huge(x) 0 108#define pmd_huge(x) 0
97#define is_hugepage_only_range(mm, addr, len) 0 109#define is_hugepage_only_range(mm, addr, len) 0
98#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ 110#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
99 do { } while (0)
100#define alloc_huge_page(vma, addr) ({ NULL; })
101#define free_huge_page(p) ({ (void)(p); BUG(); })
102#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) 111#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; })
103 112
113#define hugetlb_change_protection(vma, address, end, newprot)
114
104#ifndef HPAGE_MASK 115#ifndef HPAGE_MASK
105#define HPAGE_MASK PAGE_MASK /* Keep the compiler happy */ 116#define HPAGE_MASK PAGE_MASK /* Keep the compiler happy */
106#define HPAGE_SIZE PAGE_SIZE 117#define HPAGE_SIZE PAGE_SIZE
@@ -128,6 +139,8 @@ struct hugetlbfs_sb_info {
128 139
129struct hugetlbfs_inode_info { 140struct hugetlbfs_inode_info {
130 struct shared_policy policy; 141 struct shared_policy policy;
142 /* Protected by the (global) hugetlb_lock */
143 unsigned long prereserved_hpages;
131 struct inode vfs_inode; 144 struct inode vfs_inode;
132}; 145};
133 146
@@ -141,9 +154,13 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
141 return sb->s_fs_info; 154 return sb->s_fs_info;
142} 155}
143 156
144extern struct file_operations hugetlbfs_file_operations; 157extern const struct file_operations hugetlbfs_file_operations;
145extern struct vm_operations_struct hugetlb_vm_ops; 158extern struct vm_operations_struct hugetlb_vm_ops;
146struct file *hugetlb_zero_setup(size_t); 159struct file *hugetlb_zero_setup(size_t);
160int hugetlb_extend_reservation(struct hugetlbfs_inode_info *info,
161 unsigned long atleast_hpages);
162void hugetlb_truncate_reservation(struct hugetlbfs_inode_info *info,
163 unsigned long atmost_hpages);
147int hugetlb_get_quota(struct address_space *mapping); 164int hugetlb_get_quota(struct address_space *mapping);
148void hugetlb_put_quota(struct address_space *mapping); 165void hugetlb_put_quota(struct address_space *mapping);
149 166
diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h
index 7eb4004b3601..a90c09d331c1 100644
--- a/include/linux/hwmon-sysfs.h
+++ b/include/linux/hwmon-sysfs.h
@@ -27,11 +27,13 @@ struct sensor_device_attribute{
27#define to_sensor_dev_attr(_dev_attr) \ 27#define to_sensor_dev_attr(_dev_attr) \
28 container_of(_dev_attr, struct sensor_device_attribute, dev_attr) 28 container_of(_dev_attr, struct sensor_device_attribute, dev_attr)
29 29
30#define SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index) \ 30#define SENSOR_ATTR(_name, _mode, _show, _store, _index) \
31struct sensor_device_attribute sensor_dev_attr_##_name = { \ 31 { .dev_attr = __ATTR(_name, _mode, _show, _store), \
32 .dev_attr = __ATTR(_name,_mode,_show,_store), \ 32 .index = _index }
33 .index = _index, \ 33
34} 34#define SENSOR_DEVICE_ATTR(_name, _mode, _show, _store, _index) \
35struct sensor_device_attribute sensor_dev_attr_##_name \
36 = SENSOR_ATTR(_name, _mode, _show, _store, _index)
35 37
36struct sensor_device_attribute_2 { 38struct sensor_device_attribute_2 {
37 struct device_attribute dev_attr; 39 struct device_attribute dev_attr;
@@ -41,11 +43,13 @@ struct sensor_device_attribute_2 {
41#define to_sensor_dev_attr_2(_dev_attr) \ 43#define to_sensor_dev_attr_2(_dev_attr) \
42 container_of(_dev_attr, struct sensor_device_attribute_2, dev_attr) 44 container_of(_dev_attr, struct sensor_device_attribute_2, dev_attr)
43 45
46#define SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index) \
47 { .dev_attr = __ATTR(_name, _mode, _show, _store), \
48 .index = _index, \
49 .nr = _nr }
50
44#define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index) \ 51#define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index) \
45struct sensor_device_attribute_2 sensor_dev_attr_##_name = { \ 52struct sensor_device_attribute_2 sensor_dev_attr_##_name \
46 .dev_attr = __ATTR(_name,_mode,_show,_store), \ 53 = SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index)
47 .index = _index, \
48 .nr = _nr, \
49}
50 54
51#endif /* _LINUX_HWMON_SYSFS_H */ 55#endif /* _LINUX_HWMON_SYSFS_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 474c8f4f5d4f..c8b81f419fd8 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -108,6 +108,10 @@
108#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */ 108#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */
109#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */ 109#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */
110#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */ 110#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */
111#define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */
112#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */
113#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */
114#define I2C_DRIVERID_RS5C372 84 /* Ricoh RS5C372 RTC */
111 115
112#define I2C_DRIVERID_I2CDEV 900 116#define I2C_DRIVERID_I2CDEV 900
113#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 117#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
@@ -172,7 +176,6 @@
172#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */ 176#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */
173#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */ 177#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */
174#define I2C_HW_B_TSUNA 0x010012 /* DEC Tsunami chipset */ 178#define I2C_HW_B_TSUNA 0x010012 /* DEC Tsunami chipset */
175#define I2C_HW_B_FRODO 0x010013 /* 2d3D SA-1110 Development Board */
176#define I2C_HW_B_OMAHA 0x010014 /* Omaha I2C interface (ARM) */ 179#define I2C_HW_B_OMAHA 0x010014 /* Omaha I2C interface (ARM) */
177#define I2C_HW_B_GUIDE 0x010015 /* Guide bit-basher */ 180#define I2C_HW_B_GUIDE 0x010015 /* Guide bit-basher */
178#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */ 181#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */
@@ -185,6 +188,7 @@
185#define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ 188#define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */
186#define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ 189#define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */
187#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ 190#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */
191#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
188 192
189/* --- PCF 8584 based algorithms */ 193/* --- PCF 8584 based algorithms */
190#define I2C_HW_P_LP 0x020000 /* Parallel port interface */ 194#define I2C_HW_P_LP 0x020000 /* Parallel port interface */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 63f1d63cc1d8..1635ee25918f 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -32,7 +32,7 @@
32#include <linux/mod_devicetable.h> 32#include <linux/mod_devicetable.h>
33#include <linux/device.h> /* for struct device */ 33#include <linux/device.h> /* for struct device */
34#include <linux/sched.h> /* for completion */ 34#include <linux/sched.h> /* for completion */
35#include <asm/semaphore.h> 35#include <linux/mutex.h>
36 36
37/* --- For i2c-isa ---------------------------------------------------- */ 37/* --- For i2c-isa ---------------------------------------------------- */
38 38
@@ -225,8 +225,8 @@ struct i2c_adapter {
225 int (*client_unregister)(struct i2c_client *); 225 int (*client_unregister)(struct i2c_client *);
226 226
227 /* data fields that are valid for all devices */ 227 /* data fields that are valid for all devices */
228 struct semaphore bus_lock; 228 struct mutex bus_lock;
229 struct semaphore clist_lock; 229 struct mutex clist_lock;
230 230
231 int timeout; 231 int timeout;
232 int retries; 232 int retries;
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 5a9d8c599171..dd7d627bf66f 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -950,9 +950,7 @@ static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
950 if (!pool->slab) 950 if (!pool->slab)
951 goto free_name; 951 goto free_name;
952 952
953 pool->mempool = 953 pool->mempool = mempool_create_slab_pool(min_nr, pool->slab);
954 mempool_create(min_nr, mempool_alloc_slab, mempool_free_slab,
955 pool->slab);
956 if (!pool->mempool) 954 if (!pool->mempool)
957 goto free_slab; 955 goto free_slab;
958 956
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 0cf6c8b12caf..c771a7db9871 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -40,14 +40,16 @@ struct icmp6hdr {
40 struct icmpv6_nd_ra { 40 struct icmpv6_nd_ra {
41 __u8 hop_limit; 41 __u8 hop_limit;
42#if defined(__LITTLE_ENDIAN_BITFIELD) 42#if defined(__LITTLE_ENDIAN_BITFIELD)
43 __u8 reserved:6, 43 __u8 reserved:4,
44 router_pref:2,
44 other:1, 45 other:1,
45 managed:1; 46 managed:1;
46 47
47#elif defined(__BIG_ENDIAN_BITFIELD) 48#elif defined(__BIG_ENDIAN_BITFIELD)
48 __u8 managed:1, 49 __u8 managed:1,
49 other:1, 50 other:1,
50 reserved:6; 51 router_pref:2,
52 reserved:4;
51#else 53#else
52#error "Please fix <asm/byteorder.h>" 54#error "Please fix <asm/byteorder.h>"
53#endif 55#endif
@@ -70,8 +72,13 @@ struct icmp6hdr {
70#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed 72#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed
71#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other 73#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other
72#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime 74#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime
75#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
73}; 76};
74 77
78#define ICMPV6_ROUTER_PREF_LOW 0x3
79#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
80#define ICMPV6_ROUTER_PREF_HIGH 0x1
81#define ICMPV6_ROUTER_PREF_INVALID 0x2
75 82
76#define ICMPV6_DEST_UNREACH 1 83#define ICMPV6_DEST_UNREACH 1
77#define ICMPV6_PKT_TOOBIG 2 84#define ICMPV6_PKT_TOOBIG 2
diff --git a/include/linux/ide.h b/include/linux/ide.h
index a7fc4cc79b23..8d2db412ba9c 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -792,6 +792,7 @@ typedef struct hwif_s {
792 unsigned no_dsc : 1; /* 0 default, 1 dsc_overlap disabled */ 792 unsigned no_dsc : 1; /* 0 default, 1 dsc_overlap disabled */
793 unsigned auto_poll : 1; /* supports nop auto-poll */ 793 unsigned auto_poll : 1; /* supports nop auto-poll */
794 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 794 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
795 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */
795 796
796 struct device gendev; 797 struct device gendev;
797 struct completion gendev_rel_comp; /* To deal with device release() */ 798 struct completion gendev_rel_comp; /* To deal with device release() */
diff --git a/include/linux/if.h b/include/linux/if.h
index ce627d9092ef..374e20ad8b0d 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -33,7 +33,7 @@
33#define IFF_LOOPBACK 0x8 /* is a loopback net */ 33#define IFF_LOOPBACK 0x8 /* is a loopback net */
34#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ 34#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */
35#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ 35#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
36#define IFF_RUNNING 0x40 /* interface running and carrier ok */ 36#define IFF_RUNNING 0x40 /* interface RFC2863 OPER_UP */
37#define IFF_NOARP 0x80 /* no ARP protocol */ 37#define IFF_NOARP 0x80 /* no ARP protocol */
38#define IFF_PROMISC 0x100 /* receive all packets */ 38#define IFF_PROMISC 0x100 /* receive all packets */
39#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ 39#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/
@@ -43,15 +43,22 @@
43 43
44#define IFF_MULTICAST 0x1000 /* Supports multicast */ 44#define IFF_MULTICAST 0x1000 /* Supports multicast */
45 45
46#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_MASTER|IFF_SLAVE|IFF_RUNNING)
47
48#define IFF_PORTSEL 0x2000 /* can set media type */ 46#define IFF_PORTSEL 0x2000 /* can set media type */
49#define IFF_AUTOMEDIA 0x4000 /* auto media select active */ 47#define IFF_AUTOMEDIA 0x4000 /* auto media select active */
50#define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/ 48#define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/
51 49
50#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */
51#define IFF_DORMANT 0x20000 /* driver signals dormant */
52
53#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|\
54 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
55
52/* Private (from user) interface flags (netdevice->priv_flags). */ 56/* Private (from user) interface flags (netdevice->priv_flags). */
53#define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */ 57#define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */
54#define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */ 58#define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */
59#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */
60#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */
61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
55 62
56#define IF_GET_IFACE 0x0001 /* for querying only */ 63#define IF_GET_IFACE 0x0001 /* for querying only */
57#define IF_GET_PROTO 0x0002 64#define IF_GET_PROTO 0x0002
@@ -80,6 +87,22 @@
80#define IF_PROTO_FR_ETH_PVC 0x200B 87#define IF_PROTO_FR_ETH_PVC 0x200B
81#define IF_PROTO_RAW 0x200C /* RAW Socket */ 88#define IF_PROTO_RAW 0x200C /* RAW Socket */
82 89
90/* RFC 2863 operational status */
91enum {
92 IF_OPER_UNKNOWN,
93 IF_OPER_NOTPRESENT,
94 IF_OPER_DOWN,
95 IF_OPER_LOWERLAYERDOWN,
96 IF_OPER_TESTING,
97 IF_OPER_DORMANT,
98 IF_OPER_UP,
99};
100
101/* link modes */
102enum {
103 IF_LINK_MODE_DEFAULT,
104 IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */
105};
83 106
84/* 107/*
85 * Device mapping structure. I'd just gone off and designed a 108 * Device mapping structure. I'd just gone off and designed a
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 7a92c1ce1457..ab08f35cbc35 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -61,6 +61,7 @@
61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ 61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
62#define ETH_P_IPX 0x8137 /* IPX over DIX */ 62#define ETH_P_IPX 0x8137 /* IPX over DIX */
63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ 63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
64#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
64#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol 65#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
65 * defined in draft-wilson-wrec-wccp-v2-00.txt */ 66 * defined in draft-wilson-wrec-wccp-v2-00.txt */
66#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ 67#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
diff --git a/include/linux/in.h b/include/linux/in.h
index ba355384016a..94f557fa4636 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -72,6 +72,7 @@ struct in_addr {
72#define IP_FREEBIND 15 72#define IP_FREEBIND 15
73#define IP_IPSEC_POLICY 16 73#define IP_IPSEC_POLICY 16
74#define IP_XFRM_POLICY 17 74#define IP_XFRM_POLICY 17
75#define IP_PASSSEC 18
75 76
76/* BSD compatibility */ 77/* BSD compatibility */
77#define IP_RECVRETOPTS IP_RETOPTS 78#define IP_RECVRETOPTS IP_RETOPTS
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index fd7af86151b1..92297ff24e85 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -25,6 +25,7 @@ struct ipv4_devconf
25 int arp_filter; 25 int arp_filter;
26 int arp_announce; 26 int arp_announce;
27 int arp_ignore; 27 int arp_ignore;
28 int arp_accept;
28 int medium_id; 29 int medium_id;
29 int no_xfrm; 30 int no_xfrm;
30 int no_policy; 31 int no_policy;
diff --git a/include/linux/init.h b/include/linux/init.h
index ff8d8b8632f4..ed0ac7c39fdc 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -69,6 +69,10 @@ extern initcall_t __security_initcall_start[], __security_initcall_end[];
69 69
70/* Defined in init/main.c */ 70/* Defined in init/main.c */
71extern char saved_command_line[]; 71extern char saved_command_line[];
72
73/* used by init/main.c */
74extern void setup_arch(char **);
75
72#endif 76#endif
73 77
74#ifndef MODULE 78#ifndef MODULE
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index dcfd2ecccb5d..41ecbb847f32 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -7,11 +7,10 @@
7#define INIT_FDTABLE \ 7#define INIT_FDTABLE \
8{ \ 8{ \
9 .max_fds = NR_OPEN_DEFAULT, \ 9 .max_fds = NR_OPEN_DEFAULT, \
10 .max_fdset = __FD_SETSIZE, \ 10 .max_fdset = EMBEDDED_FD_SET_SIZE, \
11 .next_fd = 0, \
12 .fd = &init_files.fd_array[0], \ 11 .fd = &init_files.fd_array[0], \
13 .close_on_exec = &init_files.close_on_exec_init, \ 12 .close_on_exec = (fd_set *)&init_files.close_on_exec_init, \
14 .open_fds = &init_files.open_fds_init, \ 13 .open_fds = (fd_set *)&init_files.open_fds_init, \
15 .rcu = RCU_HEAD_INIT, \ 14 .rcu = RCU_HEAD_INIT, \
16 .free_files = NULL, \ 15 .free_files = NULL, \
17 .next = NULL, \ 16 .next = NULL, \
@@ -20,9 +19,10 @@
20#define INIT_FILES \ 19#define INIT_FILES \
21{ \ 20{ \
22 .count = ATOMIC_INIT(1), \ 21 .count = ATOMIC_INIT(1), \
23 .file_lock = SPIN_LOCK_UNLOCKED, \
24 .fdt = &init_files.fdtab, \ 22 .fdt = &init_files.fdtab, \
25 .fdtab = INIT_FDTABLE, \ 23 .fdtab = INIT_FDTABLE, \
24 .file_lock = SPIN_LOCK_UNLOCKED, \
25 .next_fd = 0, \
26 .close_on_exec_init = { { 0, } }, \ 26 .close_on_exec_init = { { 0, } }, \
27 .open_fds_init = { { 0, } }, \ 27 .open_fds_init = { { 0, } }, \
28 .fd_array = { NULL, } \ 28 .fd_array = { NULL, } \
@@ -62,6 +62,8 @@
62 .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \ 62 .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \
63 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \ 63 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \
64 .rlim = INIT_RLIMITS, \ 64 .rlim = INIT_RLIMITS, \
65 .pgrp = 1, \
66 .session = 1, \
65} 67}
66 68
67#define INIT_SIGHAND(sighand) { \ 69#define INIT_SIGHAND(sighand) { \
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 267c88b5f742..09e00433c78e 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -71,6 +71,8 @@ struct inotify_event {
71 71
72#ifdef CONFIG_INOTIFY 72#ifdef CONFIG_INOTIFY
73 73
74extern void inotify_d_instantiate(struct dentry *, struct inode *);
75extern void inotify_d_move(struct dentry *);
74extern void inotify_inode_queue_event(struct inode *, __u32, __u32, 76extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
75 const char *); 77 const char *);
76extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, 78extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
@@ -81,6 +83,15 @@ extern u32 inotify_get_cookie(void);
81 83
82#else 84#else
83 85
86static inline void inotify_d_instantiate(struct dentry *dentry,
87 struct inode *inode)
88{
89}
90
91static inline void inotify_d_move(struct dentry *dentry)
92{
93}
94
84static inline void inotify_inode_queue_event(struct inode *inode, 95static inline void inotify_inode_queue_event(struct inode *inode,
85 __u32 mask, __u32 cookie, 96 __u32 mask, __u32 cookie,
86 const char *filename) 97 const char *filename)
diff --git a/include/linux/input.h b/include/linux/input.h
index cf30f3cb191a..393da04f4301 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -957,7 +957,7 @@ struct input_handler {
957 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id); 957 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
958 void (*disconnect)(struct input_handle *handle); 958 void (*disconnect)(struct input_handle *handle);
959 959
960 struct file_operations *fops; 960 const struct file_operations *fops;
961 int minor; 961 int minor;
962 char *name; 962 char *name;
963 963
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index d6276e60b3bf..0a84b56935c2 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -36,6 +36,7 @@
36 36
37#include <linux/ipmi_msgdefs.h> 37#include <linux/ipmi_msgdefs.h>
38#include <linux/compiler.h> 38#include <linux/compiler.h>
39#include <linux/device.h>
39 40
40/* 41/*
41 * This file describes an interface to an IPMI driver. You have to 42 * This file describes an interface to an IPMI driver. You have to
@@ -397,7 +398,7 @@ struct ipmi_smi_watcher
397 the watcher list. So you can add and remove users from the 398 the watcher list. So you can add and remove users from the
398 IPMI interface, send messages, etc., but you cannot add 399 IPMI interface, send messages, etc., but you cannot add
399 or remove SMI watchers or SMI interfaces. */ 400 or remove SMI watchers or SMI interfaces. */
400 void (*new_smi)(int if_num); 401 void (*new_smi)(int if_num, struct device *dev);
401 void (*smi_gone)(int if_num); 402 void (*smi_gone)(int if_num);
402}; 403};
403 404
diff --git a/include/linux/ipmi_msgdefs.h b/include/linux/ipmi_msgdefs.h
index 03bc64dc2ec1..22f5e2afda4f 100644
--- a/include/linux/ipmi_msgdefs.h
+++ b/include/linux/ipmi_msgdefs.h
@@ -47,6 +47,7 @@
47#define IPMI_NETFN_APP_RESPONSE 0x07 47#define IPMI_NETFN_APP_RESPONSE 0x07
48#define IPMI_GET_DEVICE_ID_CMD 0x01 48#define IPMI_GET_DEVICE_ID_CMD 0x01
49#define IPMI_CLEAR_MSG_FLAGS_CMD 0x30 49#define IPMI_CLEAR_MSG_FLAGS_CMD 0x30
50#define IPMI_GET_DEVICE_GUID_CMD 0x08
50#define IPMI_GET_MSG_FLAGS_CMD 0x31 51#define IPMI_GET_MSG_FLAGS_CMD 0x31
51#define IPMI_SEND_MSG_CMD 0x34 52#define IPMI_SEND_MSG_CMD 0x34
52#define IPMI_GET_MSG_CMD 0x33 53#define IPMI_GET_MSG_CMD 0x33
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index e36ee157ad67..6d9c7e4da472 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -37,6 +37,9 @@
37#include <linux/ipmi_msgdefs.h> 37#include <linux/ipmi_msgdefs.h>
38#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/device.h>
41#include <linux/platform_device.h>
42#include <linux/ipmi_smi.h>
40 43
41/* This files describes the interface for IPMI system management interface 44/* This files describes the interface for IPMI system management interface
42 drivers to bind into the IPMI message handler. */ 45 drivers to bind into the IPMI message handler. */
@@ -79,6 +82,13 @@ struct ipmi_smi_handlers
79{ 82{
80 struct module *owner; 83 struct module *owner;
81 84
85 /* The low-level interface cannot start sending messages to
86 the upper layer until this function is called. This may
87 not be NULL, the lower layer must take the interface from
88 this call. */
89 int (*start_processing)(void *send_info,
90 ipmi_smi_t new_intf);
91
82 /* Called to enqueue an SMI message to be sent. This 92 /* Called to enqueue an SMI message to be sent. This
83 operation is not allowed to fail. If an error occurs, it 93 operation is not allowed to fail. If an error occurs, it
84 should report back the error in a received message. It may 94 should report back the error in a received message. It may
@@ -113,14 +123,57 @@ struct ipmi_smi_handlers
113 void (*dec_usecount)(void *send_info); 123 void (*dec_usecount)(void *send_info);
114}; 124};
115 125
126struct ipmi_device_id {
127 unsigned char device_id;
128 unsigned char device_revision;
129 unsigned char firmware_revision_1;
130 unsigned char firmware_revision_2;
131 unsigned char ipmi_version;
132 unsigned char additional_device_support;
133 unsigned int manufacturer_id;
134 unsigned int product_id;
135 unsigned char aux_firmware_revision[4];
136 unsigned int aux_firmware_revision_set : 1;
137};
138
139#define ipmi_version_major(v) ((v)->ipmi_version & 0xf)
140#define ipmi_version_minor(v) ((v)->ipmi_version >> 4)
141
142/* Take a pointer to a raw data buffer and a length and extract device
143 id information from it. The first byte of data must point to the
144 byte from the get device id response after the completion code.
145 The caller is responsible for making sure the length is at least
146 11 and the command completed without error. */
147static inline void ipmi_demangle_device_id(unsigned char *data,
148 unsigned int data_len,
149 struct ipmi_device_id *id)
150{
151 id->device_id = data[0];
152 id->device_revision = data[1];
153 id->firmware_revision_1 = data[2];
154 id->firmware_revision_2 = data[3];
155 id->ipmi_version = data[4];
156 id->additional_device_support = data[5];
157 id->manufacturer_id = data[6] | (data[7] << 8) | (data[8] << 16);
158 id->product_id = data[9] | (data[10] << 8);
159 if (data_len >= 15) {
160 memcpy(id->aux_firmware_revision, data+11, 4);
161 id->aux_firmware_revision_set = 1;
162 } else
163 id->aux_firmware_revision_set = 0;
164}
165
116/* Add a low-level interface to the IPMI driver. Note that if the 166/* Add a low-level interface to the IPMI driver. Note that if the
117 interface doesn't know its slave address, it should pass in zero. */ 167 interface doesn't know its slave address, it should pass in zero.
168 The low-level interface should not deliver any messages to the
169 upper layer until the start_processing() function in the handlers
170 is called, and the lower layer must get the interface from that
171 call. */
118int ipmi_register_smi(struct ipmi_smi_handlers *handlers, 172int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
119 void *send_info, 173 void *send_info,
120 unsigned char version_major, 174 struct ipmi_device_id *device_id,
121 unsigned char version_minor, 175 struct device *dev,
122 unsigned char slave_addr, 176 unsigned char slave_addr);
123 ipmi_smi_t *intf);
124 177
125/* 178/*
126 * Remove a low-level interface from the IPMI driver. This will 179 * Remove a low-level interface from the IPMI driver. This will
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 9c8f4c9ed429..1263d8cb3c18 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -145,6 +145,15 @@ struct ipv6_devconf {
145 __s32 max_desync_factor; 145 __s32 max_desync_factor;
146#endif 146#endif
147 __s32 max_addresses; 147 __s32 max_addresses;
148 __s32 accept_ra_defrtr;
149 __s32 accept_ra_pinfo;
150#ifdef CONFIG_IPV6_ROUTER_PREF
151 __s32 accept_ra_rtr_pref;
152 __s32 rtr_probe_interval;
153#ifdef CONFIG_IPV6_ROUTE_INFO
154 __s32 accept_ra_rt_info_max_plen;
155#endif
156#endif
148 void *sysctl; 157 void *sysctl;
149}; 158};
150 159
@@ -167,6 +176,11 @@ enum {
167 DEVCONF_MAX_DESYNC_FACTOR, 176 DEVCONF_MAX_DESYNC_FACTOR,
168 DEVCONF_MAX_ADDRESSES, 177 DEVCONF_MAX_ADDRESSES,
169 DEVCONF_FORCE_MLD_VERSION, 178 DEVCONF_FORCE_MLD_VERSION,
179 DEVCONF_ACCEPT_RA_DEFRTR,
180 DEVCONF_ACCEPT_RA_PINFO,
181 DEVCONF_ACCEPT_RA_RTR_PREF,
182 DEVCONF_RTR_PROBE_INTERVAL,
183 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
170 DEVCONF_MAX 184 DEVCONF_MAX
171}; 185};
172 186
diff --git a/include/linux/ipv6_route.h b/include/linux/ipv6_route.h
index d7c41d1d706a..b323ff577967 100644
--- a/include/linux/ipv6_route.h
+++ b/include/linux/ipv6_route.h
@@ -23,12 +23,22 @@
23#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ 23#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */
24#define RTF_EXPIRES 0x00400000 24#define RTF_EXPIRES 0x00400000
25 25
26#define RTF_ROUTEINFO 0x00800000 /* route information - RA */
27
26#define RTF_CACHE 0x01000000 /* cache entry */ 28#define RTF_CACHE 0x01000000 /* cache entry */
27#define RTF_FLOW 0x02000000 /* flow significant route */ 29#define RTF_FLOW 0x02000000 /* flow significant route */
28#define RTF_POLICY 0x04000000 /* policy route */ 30#define RTF_POLICY 0x04000000 /* policy route */
29 31
32#define RTF_PREF(pref) ((pref) << 27)
33#define RTF_PREF_MASK 0x18000000
34
30#define RTF_LOCAL 0x80000000 35#define RTF_LOCAL 0x80000000
31 36
37#ifdef __KERNEL__
38#define IPV6_EXTRACT_PREF(flag) (((flag) & RTF_PREF_MASK) >> 27)
39#define IPV6_DECODE_PREF(pref) ((pref) ^ 2) /* 1:low,2:med,3:high */
40#endif
41
32struct in6_rtmsg { 42struct in6_rtmsg {
33 struct in6_addr rtmsg_dst; 43 struct in6_addr rtmsg_dst;
34 struct in6_addr rtmsg_src; 44 struct in6_addr rtmsg_src;
diff --git a/include/linux/irda.h b/include/linux/irda.h
index 95dee174cdc5..09d8f105a5a8 100644
--- a/include/linux/irda.h
+++ b/include/linux/irda.h
@@ -76,6 +76,7 @@ typedef enum {
76 IRDA_MCP2120_DONGLE = 9, 76 IRDA_MCP2120_DONGLE = 9,
77 IRDA_ACT200L_DONGLE = 10, 77 IRDA_ACT200L_DONGLE = 10,
78 IRDA_MA600_DONGLE = 11, 78 IRDA_MA600_DONGLE = 11,
79 IRDA_TOIM3232_DONGLE = 12,
79} IRDA_DONGLE; 80} IRDA_DONGLE;
80 81
81/* Protocol types to be used for SOCK_DGRAM */ 82/* Protocol types to be used for SOCK_DGRAM */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 6c5d4c898ccb..ee2a82a572f7 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -114,53 +114,8 @@ static inline void set_native_irq_info(int irq, cpumask_t mask)
114#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE) 114#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE)
115extern cpumask_t pending_irq_cpumask[NR_IRQS]; 115extern cpumask_t pending_irq_cpumask[NR_IRQS];
116 116
117static inline void set_pending_irq(unsigned int irq, cpumask_t mask) 117void set_pending_irq(unsigned int irq, cpumask_t mask);
118{ 118void move_native_irq(int irq);
119 irq_desc_t *desc = irq_desc + irq;
120 unsigned long flags;
121
122 spin_lock_irqsave(&desc->lock, flags);
123 desc->move_irq = 1;
124 pending_irq_cpumask[irq] = mask;
125 spin_unlock_irqrestore(&desc->lock, flags);
126}
127
128static inline void
129move_native_irq(int irq)
130{
131 cpumask_t tmp;
132 irq_desc_t *desc = irq_descp(irq);
133
134 if (likely (!desc->move_irq))
135 return;
136
137 desc->move_irq = 0;
138
139 if (likely(cpus_empty(pending_irq_cpumask[irq])))
140 return;
141
142 if (!desc->handler->set_affinity)
143 return;
144
145 /* note - we hold the desc->lock */
146 cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map);
147
148 /*
149 * If there was a valid mask to work with, please
150 * do the disable, re-program, enable sequence.
151 * This is *not* particularly important for level triggered
152 * but in a edge trigger case, we might be setting rte
153 * when an active trigger is comming in. This could
154 * cause some ioapics to mal-function.
155 * Being paranoid i guess!
156 */
157 if (unlikely(!cpus_empty(tmp))) {
158 desc->handler->disable(irq);
159 desc->handler->set_affinity(irq,tmp);
160 desc->handler->enable(irq);
161 }
162 cpus_clear(pending_irq_cpumask[irq]);
163}
164 119
165#ifdef CONFIG_PCI_MSI 120#ifdef CONFIG_PCI_MSI
166/* 121/*
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 41ee79962bb2..6a425e370cb3 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -28,6 +28,9 @@
28#include <linux/journal-head.h> 28#include <linux/journal-head.h>
29#include <linux/stddef.h> 29#include <linux/stddef.h>
30#include <linux/bit_spinlock.h> 30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h>
32#include <linux/timer.h>
33
31#include <asm/semaphore.h> 34#include <asm/semaphore.h>
32#endif 35#endif
33 36
@@ -575,7 +578,7 @@ struct transaction_s
575 * @j_wait_checkpoint: Wait queue to trigger checkpointing 578 * @j_wait_checkpoint: Wait queue to trigger checkpointing
576 * @j_wait_commit: Wait queue to trigger commit 579 * @j_wait_commit: Wait queue to trigger commit
577 * @j_wait_updates: Wait queue to wait for updates to complete 580 * @j_wait_updates: Wait queue to wait for updates to complete
578 * @j_checkpoint_sem: Semaphore for locking against concurrent checkpoints 581 * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
579 * @j_head: Journal head - identifies the first unused block in the journal 582 * @j_head: Journal head - identifies the first unused block in the journal
580 * @j_tail: Journal tail - identifies the oldest still-used block in the 583 * @j_tail: Journal tail - identifies the oldest still-used block in the
581 * journal. 584 * journal.
@@ -645,7 +648,7 @@ struct journal_s
645 int j_barrier_count; 648 int j_barrier_count;
646 649
647 /* The barrier lock itself */ 650 /* The barrier lock itself */
648 struct semaphore j_barrier; 651 struct mutex j_barrier;
649 652
650 /* 653 /*
651 * Transactions: The current running transaction... 654 * Transactions: The current running transaction...
@@ -687,7 +690,7 @@ struct journal_s
687 wait_queue_head_t j_wait_updates; 690 wait_queue_head_t j_wait_updates;
688 691
689 /* Semaphore for locking against concurrent checkpoints */ 692 /* Semaphore for locking against concurrent checkpoints */
690 struct semaphore j_checkpoint_sem; 693 struct mutex j_checkpoint_mutex;
691 694
692 /* 695 /*
693 * Journal head: identifies the first unused block in the journal. 696 * Journal head: identifies the first unused block in the journal.
@@ -786,7 +789,7 @@ struct journal_s
786 unsigned long j_commit_interval; 789 unsigned long j_commit_interval;
787 790
788 /* The timer used to wakeup the commit thread: */ 791 /* The timer used to wakeup the commit thread: */
789 struct timer_list *j_commit_timer; 792 struct timer_list j_commit_timer;
790 793
791 /* 794 /*
792 * The revoke table: maintains the list of revoked blocks in the 795 * The revoke table: maintains the list of revoked blocks in the
@@ -892,7 +895,7 @@ extern int journal_dirty_metadata (handle_t *, struct buffer_head *);
892extern void journal_release_buffer (handle_t *, struct buffer_head *); 895extern void journal_release_buffer (handle_t *, struct buffer_head *);
893extern int journal_forget (handle_t *, struct buffer_head *); 896extern int journal_forget (handle_t *, struct buffer_head *);
894extern void journal_sync_buffer (struct buffer_head *); 897extern void journal_sync_buffer (struct buffer_head *);
895extern int journal_invalidatepage(journal_t *, 898extern void journal_invalidatepage(journal_t *,
896 struct page *, unsigned long); 899 struct page *, unsigned long);
897extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); 900extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
898extern int journal_stop(handle_t *); 901extern int journal_stop(handle_t *);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3b507bf05d09..a3720f973ea5 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -87,10 +87,13 @@ extern int cond_resched(void);
87 (__x < 0) ? -__x : __x; \ 87 (__x < 0) ? -__x : __x; \
88 }) 88 })
89 89
90extern struct notifier_block *panic_notifier_list; 90extern struct atomic_notifier_head panic_notifier_list;
91extern long (*panic_blink)(long time); 91extern long (*panic_blink)(long time);
92NORET_TYPE void panic(const char * fmt, ...) 92NORET_TYPE void panic(const char * fmt, ...)
93 __attribute__ ((NORET_AND format (printf, 1, 2))); 93 __attribute__ ((NORET_AND format (printf, 1, 2)));
94extern void oops_enter(void);
95extern void oops_exit(void);
96extern int oops_may_print(void);
94fastcall NORET_TYPE void do_exit(long error_code) 97fastcall NORET_TYPE void do_exit(long error_code)
95 ATTRIB_NORET; 98 ATTRIB_NORET;
96NORET_TYPE void complete_and_exit(struct completion *, long) 99NORET_TYPE void complete_and_exit(struct completion *, long)
@@ -151,9 +154,10 @@ static inline int __attribute_pure__ long_log2(unsigned long x)
151 return r; 154 return r;
152} 155}
153 156
154static inline unsigned long __attribute_const__ roundup_pow_of_two(unsigned long x) 157static inline unsigned long
158__attribute_const__ roundup_pow_of_two(unsigned long x)
155{ 159{
156 return (1UL << fls(x - 1)); 160 return 1UL << fls_long(x - 1);
157} 161}
158 162
159extern int printk_ratelimit(void); 163extern int printk_ratelimit(void);
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index a484572c302e..b46249082cca 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -46,7 +46,7 @@ static inline int kstat_irqs(int irq)
46{ 46{
47 int cpu, sum = 0; 47 int cpu, sum = 0;
48 48
49 for_each_cpu(cpu) 49 for_each_possible_cpu(cpu)
50 sum += kstat_cpu(cpu).irqs[irq]; 50 sum += kstat_cpu(cpu).irqs[irq];
51 51
52 return sum; 52 return sum;
diff --git a/include/linux/kobj_map.h b/include/linux/kobj_map.h
index cbe7d8008042..bafe178a381f 100644
--- a/include/linux/kobj_map.h
+++ b/include/linux/kobj_map.h
@@ -1,6 +1,6 @@
1#ifdef __KERNEL__ 1#ifdef __KERNEL__
2 2
3#include <asm/semaphore.h> 3#include <linux/mutex.h>
4 4
5typedef struct kobject *kobj_probe_t(dev_t, int *, void *); 5typedef struct kobject *kobj_probe_t(dev_t, int *, void *);
6struct kobj_map; 6struct kobj_map;
@@ -9,6 +9,6 @@ int kobj_map(struct kobj_map *, dev_t, unsigned long, struct module *,
9 kobj_probe_t *, int (*)(dev_t, void *), void *); 9 kobj_probe_t *, int (*)(dev_t, void *), void *);
10void kobj_unmap(struct kobj_map *, dev_t, unsigned long); 10void kobj_unmap(struct kobj_map *, dev_t, unsigned long);
11struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *); 11struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *);
12struct kobj_map *kobj_map_init(kobj_probe_t *, struct semaphore *); 12struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *);
13 13
14#endif 14#endif
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index c374b5fa8d3b..4cb1214ec290 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -80,6 +80,8 @@ extern void kobject_unregister(struct kobject *);
80extern struct kobject * kobject_get(struct kobject *); 80extern struct kobject * kobject_get(struct kobject *);
81extern void kobject_put(struct kobject *); 81extern void kobject_put(struct kobject *);
82 82
83extern struct kobject *kobject_add_dir(struct kobject *, const char *);
84
83extern char * kobject_get_path(struct kobject *, gfp_t); 85extern char * kobject_get_path(struct kobject *, gfp_t);
84 86
85struct kobj_type { 87struct kobj_type {
@@ -255,7 +257,7 @@ struct subsys_attribute {
255extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); 257extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
256extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); 258extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);
257 259
258#if defined(CONFIG_HOTPLUG) & defined(CONFIG_NET) 260#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
259void kobject_uevent(struct kobject *kobj, enum kobject_action action); 261void kobject_uevent(struct kobject *kobj, enum kobject_action action);
260 262
261int add_uevent_var(char **envp, int num_envp, int *cur_index, 263int add_uevent_var(char **envp, int num_envp, int *cur_index,
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 669756bc20a2..778adc0fa640 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -36,6 +36,7 @@
36#include <linux/percpu.h> 36#include <linux/percpu.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/rcupdate.h> 38#include <linux/rcupdate.h>
39#include <linux/mutex.h>
39 40
40#ifdef CONFIG_KPROBES 41#ifdef CONFIG_KPROBES
41#include <asm/kprobes.h> 42#include <asm/kprobes.h>
@@ -152,7 +153,7 @@ struct kretprobe_instance {
152}; 153};
153 154
154extern spinlock_t kretprobe_lock; 155extern spinlock_t kretprobe_lock;
155extern struct semaphore kprobe_mutex; 156extern struct mutex kprobe_mutex;
156extern int arch_prepare_kprobe(struct kprobe *p); 157extern int arch_prepare_kprobe(struct kprobe *p);
157extern void arch_arm_kprobe(struct kprobe *p); 158extern void arch_arm_kprobe(struct kprobe *p);
158extern void arch_disarm_kprobe(struct kprobe *p); 159extern void arch_disarm_kprobe(struct kprobe *p);
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index f3dec45ef874..62bc57580707 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -64,9 +64,6 @@ typedef union {
64 64
65#if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR) 65#if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)
66 66
67/* Define a ktime_t variable and initialize it to zero: */
68#define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 }
69
70/** 67/**
71 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value 68 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
72 * 69 *
@@ -113,9 +110,6 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
113/* Map the ktime_t to timeval conversion to ns_to_timeval function */ 110/* Map the ktime_t to timeval conversion to ns_to_timeval function */
114#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64) 111#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64)
115 112
116/* Map the ktime_t to clock_t conversion to the inline in jiffies.h: */
117#define ktime_to_clock_t(kt) nsec_to_clock_t((kt).tv64)
118
119/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ 113/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
120#define ktime_to_ns(kt) ((kt).tv64) 114#define ktime_to_ns(kt) ((kt).tv64)
121 115
@@ -136,9 +130,6 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
136 * tv.sec < 0 and 0 >= tv.nsec < NSEC_PER_SEC 130 * tv.sec < 0 and 0 >= tv.nsec < NSEC_PER_SEC
137 */ 131 */
138 132
139/* Define a ktime_t variable and initialize it to zero: */
140#define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 }
141
142/* Set a ktime_t variable to a value in sec/nsec representation: */ 133/* Set a ktime_t variable to a value in sec/nsec representation: */
143static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) 134static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
144{ 135{
@@ -255,17 +246,6 @@ static inline struct timeval ktime_to_timeval(const ktime_t kt)
255} 246}
256 247
257/** 248/**
258 * ktime_to_clock_t - convert a ktime_t variable to clock_t format
259 * @kt: the ktime_t variable to convert
260 *
261 * Returns a clock_t variable with the converted value
262 */
263static inline clock_t ktime_to_clock_t(const ktime_t kt)
264{
265 return nsec_to_clock_t( (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec);
266}
267
268/**
269 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds 249 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds
270 * @kt: the ktime_t variable to convert 250 * @kt: the ktime_t variable to convert
271 * 251 *
diff --git a/include/linux/leds.h b/include/linux/leds.h
new file mode 100644
index 000000000000..4617e75903b0
--- /dev/null
+++ b/include/linux/leds.h
@@ -0,0 +1,111 @@
1/*
2 * Driver model for leds and led triggers
3 *
4 * Copyright (C) 2005 John Lenz <lenz@cs.wisc.edu>
5 * Copyright (C) 2005 Richard Purdie <rpurdie@openedhand.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12#ifndef __LINUX_LEDS_H_INCLUDED
13#define __LINUX_LEDS_H_INCLUDED
14
15struct device;
16struct class_device;
17/*
18 * LED Core
19 */
20
21enum led_brightness {
22 LED_OFF = 0,
23 LED_HALF = 127,
24 LED_FULL = 255,
25};
26
27struct led_classdev {
28 const char *name;
29 int brightness;
30 int flags;
31#define LED_SUSPENDED (1 << 0)
32
33 /* A function to set the brightness of the led */
34 void (*brightness_set)(struct led_classdev *led_cdev,
35 enum led_brightness brightness);
36
37 struct class_device *class_dev;
38 /* LED Device linked list */
39 struct list_head node;
40
41 /* Trigger data */
42 char *default_trigger;
43#ifdef CONFIG_LEDS_TRIGGERS
44 rwlock_t trigger_lock;
45 /* Protects the trigger data below */
46
47 struct led_trigger *trigger;
48 struct list_head trig_list;
49 void *trigger_data;
50#endif
51};
52
53extern int led_classdev_register(struct device *parent,
54 struct led_classdev *led_cdev);
55extern void led_classdev_unregister(struct led_classdev *led_cdev);
56extern void led_classdev_suspend(struct led_classdev *led_cdev);
57extern void led_classdev_resume(struct led_classdev *led_cdev);
58
59/*
60 * LED Triggers
61 */
62#ifdef CONFIG_LEDS_TRIGGERS
63
64#define TRIG_NAME_MAX 50
65
66struct led_trigger {
67 /* Trigger Properties */
68 const char *name;
69 void (*activate)(struct led_classdev *led_cdev);
70 void (*deactivate)(struct led_classdev *led_cdev);
71
72 /* LEDs under control by this trigger (for simple triggers) */
73 rwlock_t leddev_list_lock;
74 struct list_head led_cdevs;
75
76 /* Link to next registered trigger */
77 struct list_head next_trig;
78};
79
80/* Registration functions for complex triggers */
81extern int led_trigger_register(struct led_trigger *trigger);
82extern void led_trigger_unregister(struct led_trigger *trigger);
83
84/* Registration functions for simple triggers */
85#define DEFINE_LED_TRIGGER(x) static struct led_trigger *x;
86#define DEFINE_LED_TRIGGER_GLOBAL(x) struct led_trigger *x;
87extern void led_trigger_register_simple(const char *name,
88 struct led_trigger **trigger);
89extern void led_trigger_unregister_simple(struct led_trigger *trigger);
90extern void led_trigger_event(struct led_trigger *trigger,
91 enum led_brightness event);
92
93#else
94
95/* Triggers aren't active - null macros */
96#define DEFINE_LED_TRIGGER(x)
97#define DEFINE_LED_TRIGGER_GLOBAL(x)
98#define led_trigger_register_simple(x, y) do {} while(0)
99#define led_trigger_unregister_simple(x) do {} while(0)
100#define led_trigger_event(x, y) do {} while(0)
101
102#endif
103
104/* Trigger specific functions */
105#ifdef CONFIG_LEDS_TRIGGER_IDE_DISK
106extern void ledtrig_ide_activity(void);
107#else
108#define ledtrig_ide_activity() do {} while(0)
109#endif
110
111#endif /* __LINUX_LEDS_H_INCLUDED */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index c91be5e64ede..0d61357604d5 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -35,7 +35,8 @@
35#include <linux/workqueue.h> 35#include <linux/workqueue.h>
36 36
37/* 37/*
38 * compile-time options 38 * compile-time options: to be removed as soon as all the drivers are
39 * converted to the new debugging mechanism
39 */ 40 */
40#undef ATA_DEBUG /* debugging output */ 41#undef ATA_DEBUG /* debugging output */
41#undef ATA_VERBOSE_DEBUG /* yet more debugging output */ 42#undef ATA_VERBOSE_DEBUG /* yet more debugging output */
@@ -61,15 +62,37 @@
61 62
62#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) 63#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
63 64
64#ifdef ATA_NDEBUG 65/* NEW: debug levels */
65#define assert(expr) 66#define HAVE_LIBATA_MSG 1
66#else 67
67#define assert(expr) \ 68enum {
68 if(unlikely(!(expr))) { \ 69 ATA_MSG_DRV = 0x0001,
69 printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \ 70 ATA_MSG_INFO = 0x0002,
70 #expr,__FILE__,__FUNCTION__,__LINE__); \ 71 ATA_MSG_PROBE = 0x0004,
71 } 72 ATA_MSG_WARN = 0x0008,
72#endif 73 ATA_MSG_MALLOC = 0x0010,
74 ATA_MSG_CTL = 0x0020,
75 ATA_MSG_INTR = 0x0040,
76 ATA_MSG_ERR = 0x0080,
77};
78
79#define ata_msg_drv(p) ((p)->msg_enable & ATA_MSG_DRV)
80#define ata_msg_info(p) ((p)->msg_enable & ATA_MSG_INFO)
81#define ata_msg_probe(p) ((p)->msg_enable & ATA_MSG_PROBE)
82#define ata_msg_warn(p) ((p)->msg_enable & ATA_MSG_WARN)
83#define ata_msg_malloc(p) ((p)->msg_enable & ATA_MSG_MALLOC)
84#define ata_msg_ctl(p) ((p)->msg_enable & ATA_MSG_CTL)
85#define ata_msg_intr(p) ((p)->msg_enable & ATA_MSG_INTR)
86#define ata_msg_err(p) ((p)->msg_enable & ATA_MSG_ERR)
87
88static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
89{
90 if (dval < 0 || dval >= (sizeof(u32) * 8))
91 return default_msg_enable_bits; /* should be 0x1 - only driver info msgs */
92 if (!dval)
93 return 0;
94 return (1 << dval) - 1;
95}
73 96
74/* defines only for the constants which don't work well as enums */ 97/* defines only for the constants which don't work well as enums */
75#define ATA_TAG_POISON 0xfafbfcfdU 98#define ATA_TAG_POISON 0xfafbfcfdU
@@ -99,8 +122,7 @@ enum {
99 /* struct ata_device stuff */ 122 /* struct ata_device stuff */
100 ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */ 123 ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */
101 ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */ 124 ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */
102 ATA_DFLAG_LOCK_SECTORS = (1 << 2), /* don't adjust max_sectors */ 125 ATA_DFLAG_LBA = (1 << 2), /* device supports LBA */
103 ATA_DFLAG_LBA = (1 << 3), /* device supports LBA */
104 126
105 ATA_DEV_UNKNOWN = 0, /* unknown device */ 127 ATA_DEV_UNKNOWN = 0, /* unknown device */
106 ATA_DEV_ATA = 1, /* ATA device */ 128 ATA_DEV_ATA = 1, /* ATA device */
@@ -115,9 +137,9 @@ enum {
115 ATA_FLAG_PORT_DISABLED = (1 << 2), /* port is disabled, ignore it */ 137 ATA_FLAG_PORT_DISABLED = (1 << 2), /* port is disabled, ignore it */
116 ATA_FLAG_SATA = (1 << 3), 138 ATA_FLAG_SATA = (1 << 3),
117 ATA_FLAG_NO_LEGACY = (1 << 4), /* no legacy mode check */ 139 ATA_FLAG_NO_LEGACY = (1 << 4), /* no legacy mode check */
118 ATA_FLAG_SRST = (1 << 5), /* use ATA SRST, not E.D.D. */ 140 ATA_FLAG_SRST = (1 << 5), /* (obsolete) use ATA SRST, not E.D.D. */
119 ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ 141 ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */
120 ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */ 142 ATA_FLAG_SATA_RESET = (1 << 7), /* (obsolete) use COMRESET */
121 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ 143 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */
122 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once 144 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once
123 * proper HSM is in place. */ 145 * proper HSM is in place. */
@@ -129,13 +151,19 @@ enum {
129 ATA_FLAG_PIO_LBA48 = (1 << 13), /* Host DMA engine is LBA28 only */ 151 ATA_FLAG_PIO_LBA48 = (1 << 13), /* Host DMA engine is LBA28 only */
130 ATA_FLAG_IRQ_MASK = (1 << 14), /* Mask IRQ in PIO xfers */ 152 ATA_FLAG_IRQ_MASK = (1 << 14), /* Mask IRQ in PIO xfers */
131 153
154 ATA_FLAG_FLUSH_PORT_TASK = (1 << 15), /* Flush port task */
155 ATA_FLAG_IN_EH = (1 << 16), /* EH in progress */
156
132 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 157 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
133 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 158 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
134 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */ 159 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */
135 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, 160 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
161 ATA_QCFLAG_EH_SCHEDULED = (1 << 5), /* EH scheduled */
136 162
163 /* host set flags */
164 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */
165
137 /* various lengths of time */ 166 /* various lengths of time */
138 ATA_TMOUT_EDD = 5 * HZ, /* heuristic */
139 ATA_TMOUT_PIO = 30 * HZ, 167 ATA_TMOUT_PIO = 30 * HZ,
140 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 168 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
141 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ 169 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
@@ -162,11 +190,19 @@ enum {
162 PORT_DISABLED = 2, 190 PORT_DISABLED = 2,
163 191
164 /* encoding various smaller bitmaps into a single 192 /* encoding various smaller bitmaps into a single
165 * unsigned long bitmap 193 * unsigned int bitmap
166 */ 194 */
167 ATA_SHIFT_UDMA = 0, 195 ATA_BITS_PIO = 5,
168 ATA_SHIFT_MWDMA = 8, 196 ATA_BITS_MWDMA = 3,
169 ATA_SHIFT_PIO = 11, 197 ATA_BITS_UDMA = 8,
198
199 ATA_SHIFT_PIO = 0,
200 ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_BITS_PIO,
201 ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_BITS_MWDMA,
202
203 ATA_MASK_PIO = ((1 << ATA_BITS_PIO) - 1) << ATA_SHIFT_PIO,
204 ATA_MASK_MWDMA = ((1 << ATA_BITS_MWDMA) - 1) << ATA_SHIFT_MWDMA,
205 ATA_MASK_UDMA = ((1 << ATA_BITS_UDMA) - 1) << ATA_SHIFT_UDMA,
170 206
171 /* size of buffer to pad xfers ending on unaligned boundaries */ 207 /* size of buffer to pad xfers ending on unaligned boundaries */
172 ATA_DMA_PAD_SZ = 4, 208 ATA_DMA_PAD_SZ = 4,
@@ -189,10 +225,15 @@ enum hsm_task_states {
189}; 225};
190 226
191enum ata_completion_errors { 227enum ata_completion_errors {
192 AC_ERR_OTHER = (1 << 0), 228 AC_ERR_DEV = (1 << 0), /* device reported error */
193 AC_ERR_DEV = (1 << 1), 229 AC_ERR_HSM = (1 << 1), /* host state machine violation */
194 AC_ERR_ATA_BUS = (1 << 2), 230 AC_ERR_TIMEOUT = (1 << 2), /* timeout */
195 AC_ERR_HOST_BUS = (1 << 3), 231 AC_ERR_MEDIA = (1 << 3), /* media error */
232 AC_ERR_ATA_BUS = (1 << 4), /* ATA bus error */
233 AC_ERR_HOST_BUS = (1 << 5), /* host bus error */
234 AC_ERR_SYSTEM = (1 << 6), /* system error */
235 AC_ERR_INVALID = (1 << 7), /* invalid argument */
236 AC_ERR_OTHER = (1 << 8), /* unknown */
196}; 237};
197 238
198/* forward declarations */ 239/* forward declarations */
@@ -202,7 +243,10 @@ struct ata_port;
202struct ata_queued_cmd; 243struct ata_queued_cmd;
203 244
204/* typedefs */ 245/* typedefs */
205typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc); 246typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
247typedef void (*ata_probeinit_fn_t)(struct ata_port *);
248typedef int (*ata_reset_fn_t)(struct ata_port *, int, unsigned int *);
249typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *);
206 250
207struct ata_ioports { 251struct ata_ioports {
208 unsigned long cmd_addr; 252 unsigned long cmd_addr;
@@ -237,6 +281,7 @@ struct ata_probe_ent {
237 unsigned long irq; 281 unsigned long irq;
238 unsigned int irq_flags; 282 unsigned int irq_flags;
239 unsigned long host_flags; 283 unsigned long host_flags;
284 unsigned long host_set_flags;
240 void __iomem *mmio_base; 285 void __iomem *mmio_base;
241 void *private_data; 286 void *private_data;
242}; 287};
@@ -249,6 +294,9 @@ struct ata_host_set {
249 unsigned int n_ports; 294 unsigned int n_ports;
250 void *private_data; 295 void *private_data;
251 const struct ata_port_operations *ops; 296 const struct ata_port_operations *ops;
297 unsigned long flags;
298 int simplex_claimed; /* Keep seperate in case we
299 ever need to do this locked */
252 struct ata_port * ports[0]; 300 struct ata_port * ports[0];
253}; 301};
254 302
@@ -305,7 +353,7 @@ struct ata_device {
305 unsigned long flags; /* ATA_DFLAG_xxx */ 353 unsigned long flags; /* ATA_DFLAG_xxx */
306 unsigned int class; /* ATA_DEV_xxx */ 354 unsigned int class; /* ATA_DEV_xxx */
307 unsigned int devno; /* 0 or 1 */ 355 unsigned int devno; /* 0 or 1 */
308 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ 356 u16 *id; /* IDENTIFY xxx DEVICE data */
309 u8 pio_mode; 357 u8 pio_mode;
310 u8 dma_mode; 358 u8 dma_mode;
311 u8 xfer_mode; 359 u8 xfer_mode;
@@ -313,6 +361,13 @@ struct ata_device {
313 361
314 unsigned int multi_count; /* sectors count for 362 unsigned int multi_count; /* sectors count for
315 READ/WRITE MULTIPLE */ 363 READ/WRITE MULTIPLE */
364 unsigned int max_sectors; /* per-device max sectors */
365 unsigned int cdb_len;
366
367 /* per-dev xfer mask */
368 unsigned int pio_mask;
369 unsigned int mwdma_mask;
370 unsigned int udma_mask;
316 371
317 /* for CHS addressing */ 372 /* for CHS addressing */
318 u16 cylinders; /* Number of cylinders */ 373 u16 cylinders; /* Number of cylinders */
@@ -342,7 +397,6 @@ struct ata_port {
342 unsigned int mwdma_mask; 397 unsigned int mwdma_mask;
343 unsigned int udma_mask; 398 unsigned int udma_mask;
344 unsigned int cbl; /* cable type; ATA_CBL_xxx */ 399 unsigned int cbl; /* cable type; ATA_CBL_xxx */
345 unsigned int cdb_len;
346 400
347 struct ata_device device[ATA_MAX_DEVICES]; 401 struct ata_device device[ATA_MAX_DEVICES];
348 402
@@ -352,13 +406,16 @@ struct ata_port {
352 406
353 struct ata_host_stats stats; 407 struct ata_host_stats stats;
354 struct ata_host_set *host_set; 408 struct ata_host_set *host_set;
409 struct device *dev;
355 410
356 struct work_struct packet_task; 411 struct work_struct port_task;
357 412
358 struct work_struct pio_task;
359 unsigned int hsm_task_state; 413 unsigned int hsm_task_state;
360 unsigned long pio_task_timeout; 414 unsigned long pio_task_timeout;
361 415
416 u32 msg_enable;
417 struct list_head eh_done_q;
418
362 void *private_data; 419 void *private_data;
363}; 420};
364 421
@@ -369,6 +426,7 @@ struct ata_port_operations {
369 426
370 void (*set_piomode) (struct ata_port *, struct ata_device *); 427 void (*set_piomode) (struct ata_port *, struct ata_device *);
371 void (*set_dmamode) (struct ata_port *, struct ata_device *); 428 void (*set_dmamode) (struct ata_port *, struct ata_device *);
429 unsigned long (*mode_filter) (const struct ata_port *, struct ata_device *, unsigned long);
372 430
373 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf); 431 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf);
374 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); 432 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
@@ -378,7 +436,10 @@ struct ata_port_operations {
378 u8 (*check_altstatus)(struct ata_port *ap); 436 u8 (*check_altstatus)(struct ata_port *ap);
379 void (*dev_select)(struct ata_port *ap, unsigned int device); 437 void (*dev_select)(struct ata_port *ap, unsigned int device);
380 438
381 void (*phy_reset) (struct ata_port *ap); 439 void (*phy_reset) (struct ata_port *ap); /* obsolete */
440 void (*set_mode) (struct ata_port *ap);
441 int (*probe_reset) (struct ata_port *ap, unsigned int *classes);
442
382 void (*post_set_mode) (struct ata_port *ap); 443 void (*post_set_mode) (struct ata_port *ap);
383 444
384 int (*check_atapi_dma) (struct ata_queued_cmd *qc); 445 int (*check_atapi_dma) (struct ata_queued_cmd *qc);
@@ -387,7 +448,7 @@ struct ata_port_operations {
387 void (*bmdma_start) (struct ata_queued_cmd *qc); 448 void (*bmdma_start) (struct ata_queued_cmd *qc);
388 449
389 void (*qc_prep) (struct ata_queued_cmd *qc); 450 void (*qc_prep) (struct ata_queued_cmd *qc);
390 int (*qc_issue) (struct ata_queued_cmd *qc); 451 unsigned int (*qc_issue) (struct ata_queued_cmd *qc);
391 452
392 void (*eng_timeout) (struct ata_port *ap); 453 void (*eng_timeout) (struct ata_port *ap);
393 454
@@ -435,6 +496,18 @@ extern void ata_port_probe(struct ata_port *);
435extern void __sata_phy_reset(struct ata_port *ap); 496extern void __sata_phy_reset(struct ata_port *ap);
436extern void sata_phy_reset(struct ata_port *ap); 497extern void sata_phy_reset(struct ata_port *ap);
437extern void ata_bus_reset(struct ata_port *ap); 498extern void ata_bus_reset(struct ata_port *ap);
499extern int ata_drive_probe_reset(struct ata_port *ap,
500 ata_probeinit_fn_t probeinit,
501 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
502 ata_postreset_fn_t postreset, unsigned int *classes);
503extern void ata_std_probeinit(struct ata_port *ap);
504extern int ata_std_softreset(struct ata_port *ap, int verbose,
505 unsigned int *classes);
506extern int sata_std_hardreset(struct ata_port *ap, int verbose,
507 unsigned int *class);
508extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes);
509extern int ata_dev_revalidate(struct ata_port *ap, struct ata_device *dev,
510 int post_reset);
438extern void ata_port_disable(struct ata_port *); 511extern void ata_port_disable(struct ata_port *);
439extern void ata_std_ports(struct ata_ioports *ioaddr); 512extern void ata_std_ports(struct ata_ioports *ioaddr);
440#ifdef CONFIG_PCI 513#ifdef CONFIG_PCI
@@ -443,6 +516,7 @@ extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_i
443extern void ata_pci_remove_one (struct pci_dev *pdev); 516extern void ata_pci_remove_one (struct pci_dev *pdev);
444extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state); 517extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state);
445extern int ata_pci_device_resume(struct pci_dev *pdev); 518extern int ata_pci_device_resume(struct pci_dev *pdev);
519extern int ata_pci_clear_simplex(struct pci_dev *pdev);
446#endif /* CONFIG_PCI */ 520#endif /* CONFIG_PCI */
447extern int ata_device_add(const struct ata_probe_ent *ent); 521extern int ata_device_add(const struct ata_probe_ent *ent);
448extern void ata_host_set_remove(struct ata_host_set *host_set); 522extern void ata_host_set_remove(struct ata_host_set *host_set);
@@ -450,13 +524,20 @@ extern int ata_scsi_detect(struct scsi_host_template *sht);
450extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 524extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
451extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 525extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
452extern int ata_scsi_error(struct Scsi_Host *host); 526extern int ata_scsi_error(struct Scsi_Host *host);
527extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
528extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
453extern int ata_scsi_release(struct Scsi_Host *host); 529extern int ata_scsi_release(struct Scsi_Host *host);
454extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 530extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
455extern int ata_scsi_device_resume(struct scsi_device *); 531extern int ata_scsi_device_resume(struct scsi_device *);
456extern int ata_scsi_device_suspend(struct scsi_device *); 532extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state);
457extern int ata_device_resume(struct ata_port *, struct ata_device *); 533extern int ata_device_resume(struct ata_port *, struct ata_device *);
458extern int ata_device_suspend(struct ata_port *, struct ata_device *); 534extern int ata_device_suspend(struct ata_port *, struct ata_device *, pm_message_t state);
459extern int ata_ratelimit(void); 535extern int ata_ratelimit(void);
536extern unsigned int ata_busy_sleep(struct ata_port *ap,
537 unsigned long timeout_pat,
538 unsigned long timeout);
539extern void ata_port_queue_task(struct ata_port *ap, void (*fn)(void *),
540 void *data, unsigned long delay);
460 541
461/* 542/*
462 * Default driver ops implementations 543 * Default driver ops implementations
@@ -470,26 +551,29 @@ extern void ata_std_dev_select (struct ata_port *ap, unsigned int device);
470extern u8 ata_check_status(struct ata_port *ap); 551extern u8 ata_check_status(struct ata_port *ap);
471extern u8 ata_altstatus(struct ata_port *ap); 552extern u8 ata_altstatus(struct ata_port *ap);
472extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); 553extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
554extern int ata_std_probe_reset(struct ata_port *ap, unsigned int *classes);
473extern int ata_port_start (struct ata_port *ap); 555extern int ata_port_start (struct ata_port *ap);
474extern void ata_port_stop (struct ata_port *ap); 556extern void ata_port_stop (struct ata_port *ap);
475extern void ata_host_stop (struct ata_host_set *host_set); 557extern void ata_host_stop (struct ata_host_set *host_set);
476extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 558extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
477extern void ata_qc_prep(struct ata_queued_cmd *qc); 559extern void ata_qc_prep(struct ata_queued_cmd *qc);
478extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); 560extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
561extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
479extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, 562extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
480 unsigned int buflen); 563 unsigned int buflen);
481extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 564extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
482 unsigned int n_elem); 565 unsigned int n_elem);
483extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); 566extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
484extern void ata_dev_id_string(const u16 *id, unsigned char *s, 567extern void ata_id_string(const u16 *id, unsigned char *s,
485 unsigned int ofs, unsigned int len); 568 unsigned int ofs, unsigned int len);
486extern void ata_dev_config(struct ata_port *ap, unsigned int i); 569extern void ata_id_c_string(const u16 *id, unsigned char *s,
570 unsigned int ofs, unsigned int len);
487extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 571extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
488extern void ata_bmdma_start (struct ata_queued_cmd *qc); 572extern void ata_bmdma_start (struct ata_queued_cmd *qc);
489extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 573extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
490extern u8 ata_bmdma_status(struct ata_port *ap); 574extern u8 ata_bmdma_status(struct ata_port *ap);
491extern void ata_bmdma_irq_clear(struct ata_port *ap); 575extern void ata_bmdma_irq_clear(struct ata_port *ap);
492extern void ata_qc_complete(struct ata_queued_cmd *qc); 576extern void __ata_qc_complete(struct ata_queued_cmd *qc);
493extern void ata_eng_timeout(struct ata_port *ap); 577extern void ata_eng_timeout(struct ata_port *ap);
494extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, 578extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev,
495 struct scsi_cmnd *cmd, 579 struct scsi_cmnd *cmd,
@@ -498,6 +582,8 @@ extern int ata_std_bios_param(struct scsi_device *sdev,
498 struct block_device *bdev, 582 struct block_device *bdev,
499 sector_t capacity, int geom[]); 583 sector_t capacity, int geom[]);
500extern int ata_scsi_slave_config(struct scsi_device *sdev); 584extern int ata_scsi_slave_config(struct scsi_device *sdev);
585extern struct ata_device *ata_dev_pair(struct ata_port *ap,
586 struct ata_device *adev);
501 587
502/* 588/*
503 * Timing helpers 589 * Timing helpers
@@ -540,7 +626,7 @@ extern void ata_pci_host_stop (struct ata_host_set *host_set);
540extern struct ata_probe_ent * 626extern struct ata_probe_ent *
541ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); 627ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask);
542extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); 628extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
543 629extern unsigned long ata_pci_default_filter(const struct ata_port *, struct ata_device *, unsigned long);
544#endif /* CONFIG_PCI */ 630#endif /* CONFIG_PCI */
545 631
546 632
@@ -586,10 +672,14 @@ static inline unsigned int ata_tag_valid(unsigned int tag)
586 return (tag < ATA_MAX_QUEUE) ? 1 : 0; 672 return (tag < ATA_MAX_QUEUE) ? 1 : 0;
587} 673}
588 674
675static inline unsigned int ata_class_present(unsigned int class)
676{
677 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI;
678}
679
589static inline unsigned int ata_dev_present(const struct ata_device *dev) 680static inline unsigned int ata_dev_present(const struct ata_device *dev)
590{ 681{
591 return ((dev->class == ATA_DEV_ATA) || 682 return ata_class_present(dev->class);
592 (dev->class == ATA_DEV_ATAPI));
593} 683}
594 684
595static inline u8 ata_chk_status(struct ata_port *ap) 685static inline u8 ata_chk_status(struct ata_port *ap)
@@ -657,9 +747,9 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
657 747
658 if (status & (ATA_BUSY | ATA_DRQ)) { 748 if (status & (ATA_BUSY | ATA_DRQ)) {
659 unsigned long l = ap->ioaddr.status_addr; 749 unsigned long l = ap->ioaddr.status_addr;
660 printk(KERN_WARNING 750 if (ata_msg_warn(ap))
661 "ATA: abnormal status 0x%X on port 0x%lX\n", 751 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
662 status, l); 752 status, l);
663 } 753 }
664 754
665 return status; 755 return status;
@@ -701,6 +791,24 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
701 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); 791 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno);
702} 792}
703 793
794/**
795 * ata_qc_complete - Complete an active ATA command
796 * @qc: Command to complete
797 * @err_mask: ATA Status register contents
798 *
799 * Indicate to the mid and upper layers that an ATA
800 * command has completed, with either an ok or not-ok status.
801 *
802 * LOCKING:
803 * spin_lock_irqsave(host_set lock)
804 */
805static inline void ata_qc_complete(struct ata_queued_cmd *qc)
806{
807 if (unlikely(qc->flags & ATA_QCFLAG_EH_SCHEDULED))
808 return;
809
810 __ata_qc_complete(qc);
811}
704 812
705/** 813/**
706 * ata_irq_on - Enable interrupts on a port. 814 * ata_irq_on - Enable interrupts on a port.
@@ -751,7 +859,8 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
751 859
752 status = ata_busy_wait(ap, bits, 1000); 860 status = ata_busy_wait(ap, bits, 1000);
753 if (status & bits) 861 if (status & bits)
754 DPRINTK("abnormal status 0x%X\n", status); 862 if (ata_msg_err(ap))
863 printk(KERN_ERR "abnormal status 0x%X\n", status);
755 864
756 /* get controller status; clear intr, err bits */ 865 /* get controller status; clear intr, err bits */
757 if (ap->flags & ATA_FLAG_MMIO) { 866 if (ap->flags & ATA_FLAG_MMIO) {
@@ -769,8 +878,10 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
769 post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 878 post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
770 } 879 }
771 880
772 VPRINTK("irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", 881 if (ata_msg_intr(ap))
773 host_stat, post_stat, status); 882 printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
883 __FUNCTION__,
884 host_stat, post_stat, status);
774 885
775 return status; 886 return status;
776} 887}
@@ -807,7 +918,7 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)
807static inline unsigned int ac_err_mask(u8 status) 918static inline unsigned int ac_err_mask(u8 status)
808{ 919{
809 if (status & ATA_BUSY) 920 if (status & ATA_BUSY)
810 return AC_ERR_ATA_BUS; 921 return AC_ERR_HSM;
811 if (status & (ATA_ERR | ATA_DF)) 922 if (status & (ATA_ERR | ATA_DF))
812 return AC_ERR_DEV; 923 return AC_ERR_DEV;
813 return 0; 924 return 0;
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 147eb01e0d4b..c08c9983e840 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -28,17 +28,27 @@
28#define ALIGN __ALIGN 28#define ALIGN __ALIGN
29#define ALIGN_STR __ALIGN_STR 29#define ALIGN_STR __ALIGN_STR
30 30
31#ifndef ENTRY
31#define ENTRY(name) \ 32#define ENTRY(name) \
32 .globl name; \ 33 .globl name; \
33 ALIGN; \ 34 ALIGN; \
34 name: 35 name:
36#endif
35 37
36#define KPROBE_ENTRY(name) \ 38#define KPROBE_ENTRY(name) \
37 .section .kprobes.text, "ax"; \ 39 .section .kprobes.text, "ax"; \
38 .globl name; \ 40 ENTRY(name)
39 ALIGN; \
40 name:
41 41
42#ifndef END
43#define END(name) \
44 .size name, .-name
45#endif
46
47#ifndef ENDPROC
48#define ENDPROC(name) \
49 .type name, @function; \
50 END(name)
51#endif
42 52
43#endif 53#endif
44 54
diff --git a/include/linux/list.h b/include/linux/list.h
index 47208bd99f9e..67258b47e9ca 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -411,6 +411,17 @@ static inline void list_splice_init(struct list_head *list,
411 pos = list_entry(pos->member.next, typeof(*pos), member)) 411 pos = list_entry(pos->member.next, typeof(*pos), member))
412 412
413/** 413/**
414 * list_for_each_entry_from - iterate over list of given type
415 * continuing from existing point
416 * @pos: the type * to use as a loop counter.
417 * @head: the head for your list.
418 * @member: the name of the list_struct within the struct.
419 */
420#define list_for_each_entry_from(pos, head, member) \
421 for (; prefetch(pos->member.next), &pos->member != (head); \
422 pos = list_entry(pos->member.next, typeof(*pos), member))
423
424/**
414 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry 425 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
415 * @pos: the type * to use as a loop counter. 426 * @pos: the type * to use as a loop counter.
416 * @n: another type * to use as temporary storage 427 * @n: another type * to use as temporary storage
@@ -438,6 +449,19 @@ static inline void list_splice_init(struct list_head *list,
438 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 449 pos = n, n = list_entry(n->member.next, typeof(*n), member))
439 450
440/** 451/**
452 * list_for_each_entry_safe_from - iterate over list of given type
453 * from existing point safe against removal of list entry
454 * @pos: the type * to use as a loop counter.
455 * @n: another type * to use as temporary storage
456 * @head: the head for your list.
457 * @member: the name of the list_struct within the struct.
458 */
459#define list_for_each_entry_safe_from(pos, n, head, member) \
460 for (n = list_entry(pos->member.next, typeof(*pos), member); \
461 &pos->member != (head); \
462 pos = n, n = list_entry(n->member.next, typeof(*n), member))
463
464/**
441 * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against 465 * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against
442 * removal of list entry 466 * removal of list entry
443 * @pos: the type * to use as a loop counter. 467 * @pos: the type * to use as a loop counter.
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index ef21ed296039..995f89dc8c04 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -14,6 +14,7 @@
14#include <linux/config.h> 14#include <linux/config.h>
15#include <linux/in.h> 15#include <linux/in.h>
16#include <linux/fs.h> 16#include <linux/fs.h>
17#include <linux/kref.h>
17#include <linux/utsname.h> 18#include <linux/utsname.h>
18#include <linux/nfsd/nfsfh.h> 19#include <linux/nfsd/nfsfh.h>
19#include <linux/lockd/bind.h> 20#include <linux/lockd/bind.h>
@@ -58,6 +59,8 @@ struct nlm_host {
58 unsigned long h_expires; /* eligible for GC */ 59 unsigned long h_expires; /* eligible for GC */
59 struct list_head h_lockowners; /* Lockowners for the client */ 60 struct list_head h_lockowners; /* Lockowners for the client */
60 spinlock_t h_lock; 61 spinlock_t h_lock;
62 struct list_head h_granted; /* Locks in GRANTED state */
63 struct list_head h_reclaim; /* Locks in RECLAIM state */
61}; 64};
62 65
63/* 66/*
@@ -83,9 +86,9 @@ struct nlm_rqst {
83 struct nlm_host * a_host; /* host handle */ 86 struct nlm_host * a_host; /* host handle */
84 struct nlm_args a_args; /* arguments */ 87 struct nlm_args a_args; /* arguments */
85 struct nlm_res a_res; /* result */ 88 struct nlm_res a_res; /* result */
86 struct nlm_wait * a_block; 89 struct nlm_block * a_block;
87 unsigned int a_retries; /* Retry count */ 90 unsigned int a_retries; /* Retry count */
88 char a_owner[NLMCLNT_OHSIZE]; 91 u8 a_owner[NLMCLNT_OHSIZE];
89}; 92};
90 93
91/* 94/*
@@ -110,16 +113,16 @@ struct nlm_file {
110 */ 113 */
111#define NLM_NEVER (~(unsigned long) 0) 114#define NLM_NEVER (~(unsigned long) 0)
112struct nlm_block { 115struct nlm_block {
116 struct kref b_count; /* Reference count */
113 struct nlm_block * b_next; /* linked list (all blocks) */ 117 struct nlm_block * b_next; /* linked list (all blocks) */
114 struct nlm_block * b_fnext; /* linked list (per file) */ 118 struct nlm_block * b_fnext; /* linked list (per file) */
115 struct nlm_rqst b_call; /* RPC args & callback info */ 119 struct nlm_rqst * b_call; /* RPC args & callback info */
116 struct svc_serv * b_daemon; /* NLM service */ 120 struct svc_serv * b_daemon; /* NLM service */
117 struct nlm_host * b_host; /* host handle for RPC clnt */ 121 struct nlm_host * b_host; /* host handle for RPC clnt */
118 unsigned long b_when; /* next re-xmit */ 122 unsigned long b_when; /* next re-xmit */
119 unsigned int b_id; /* block id */ 123 unsigned int b_id; /* block id */
120 unsigned char b_queued; /* re-queued */ 124 unsigned char b_queued; /* re-queued */
121 unsigned char b_granted; /* VFS granted lock */ 125 unsigned char b_granted; /* VFS granted lock */
122 unsigned char b_incall; /* doing callback */
123 unsigned char b_done; /* callback complete */ 126 unsigned char b_done; /* callback complete */
124 struct nlm_file * b_file; /* file in question */ 127 struct nlm_file * b_file; /* file in question */
125}; 128};
@@ -145,15 +148,16 @@ extern unsigned long nlmsvc_timeout;
145/* 148/*
146 * Lockd client functions 149 * Lockd client functions
147 */ 150 */
148struct nlm_rqst * nlmclnt_alloc_call(void); 151struct nlm_rqst * nlm_alloc_call(struct nlm_host *host);
149int nlmclnt_prepare_block(struct nlm_rqst *req, struct nlm_host *host, struct file_lock *fl); 152void nlm_release_call(struct nlm_rqst *);
150void nlmclnt_finish_block(struct nlm_rqst *req); 153int nlm_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
151long nlmclnt_block(struct nlm_rqst *req, long timeout); 154int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *);
155struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl);
156void nlmclnt_finish_block(struct nlm_wait *block);
157int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
152u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); 158u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *);
153void nlmclnt_recovery(struct nlm_host *, u32); 159void nlmclnt_recovery(struct nlm_host *, u32);
154int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 160int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
155int nlmclnt_setgrantargs(struct nlm_rqst *, struct nlm_lock *);
156void nlmclnt_freegrantargs(struct nlm_rqst *);
157 161
158/* 162/*
159 * Host cache 163 * Host cache
@@ -172,7 +176,6 @@ extern struct nlm_host *nlm_find_client(void);
172/* 176/*
173 * Server-side lock handling 177 * Server-side lock handling
174 */ 178 */
175int nlmsvc_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
176u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 179u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
177 struct nlm_lock *, int, struct nlm_cookie *); 180 struct nlm_lock *, int, struct nlm_cookie *);
178u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 181u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
@@ -180,7 +183,7 @@ u32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *,
180 struct nlm_lock *); 183 struct nlm_lock *);
181u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); 184u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
182unsigned long nlmsvc_retry_blocked(void); 185unsigned long nlmsvc_retry_blocked(void);
183int nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, 186void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
184 int action); 187 int action);
185void nlmsvc_grant_reply(struct svc_rqst *, struct nlm_cookie *, u32); 188void nlmsvc_grant_reply(struct svc_rqst *, struct nlm_cookie *, u32);
186 189
diff --git a/include/linux/lockd/share.h b/include/linux/lockd/share.h
index 5d8aa325f140..c75a424ebe4c 100644
--- a/include/linux/lockd/share.h
+++ b/include/linux/lockd/share.h
@@ -25,6 +25,6 @@ u32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *,
25 struct nlm_args *); 25 struct nlm_args *);
26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *, 26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *,
27 struct nlm_args *); 27 struct nlm_args *);
28int nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, int); 28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, int);
29 29
30#endif /* LINUX_LOCKD_SHARE_H */ 30#endif /* LINUX_LOCKD_SHARE_H */
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index d7a5cc4cfa97..bb0a0f1caa91 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -28,6 +28,7 @@ struct nlm_lock {
28 int len; /* length of "caller" */ 28 int len; /* length of "caller" */
29 struct nfs_fh fh; 29 struct nfs_fh fh;
30 struct xdr_netobj oh; 30 struct xdr_netobj oh;
31 u32 svid;
31 struct file_lock fl; 32 struct file_lock fl;
32}; 33};
33 34
diff --git a/include/linux/loop.h b/include/linux/loop.h
index f96506782ebe..e76c7611d6cc 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -17,6 +17,7 @@
17#include <linux/bio.h> 17#include <linux/bio.h>
18#include <linux/blkdev.h> 18#include <linux/blkdev.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/mutex.h>
20 21
21/* Possible states of device */ 22/* Possible states of device */
22enum { 23enum {
@@ -60,7 +61,7 @@ struct loop_device {
60 int lo_state; 61 int lo_state;
61 struct completion lo_done; 62 struct completion lo_done;
62 struct completion lo_bh_done; 63 struct completion lo_bh_done;
63 struct semaphore lo_ctl_mutex; 64 struct mutex lo_ctl_mutex;
64 int lo_pending; 65 int lo_pending;
65 66
66 request_queue_t *lo_queue; 67 request_queue_t *lo_queue;
diff --git a/include/linux/m48t86.h b/include/linux/m48t86.h
new file mode 100644
index 000000000000..9065199319d0
--- /dev/null
+++ b/include/linux/m48t86.h
@@ -0,0 +1,16 @@
1/*
2 * ST M48T86 / Dallas DS12887 RTC driver
3 * Copyright (c) 2006 Tower Technologies
4 *
5 * Author: Alessandro Zummo <a.zummo@towertech.it>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12struct m48t86_ops
13{
14 void (*writeb)(unsigned char value, unsigned long addr);
15 unsigned char (*readb)(unsigned long addr);
16};
diff --git a/include/linux/major.h b/include/linux/major.h
index e36a46702d94..0a74c52924c9 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -113,6 +113,7 @@
113 113
114#define UBD_MAJOR 98 114#define UBD_MAJOR 98
115 115
116#define PP_MAJOR 99
116#define JSFD_MAJOR 99 117#define JSFD_MAJOR 99
117 118
118#define PHONE_MAJOR 100 119#define PHONE_MAJOR 100
diff --git a/include/linux/memory.h b/include/linux/memory.h
index e251dc43d0f5..8f04143ca363 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -77,7 +77,6 @@ extern int remove_memory_block(unsigned long, struct mem_section *, int);
77 77
78#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 78#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
79 79
80struct notifier_block;
81 80
82#endif /* CONFIG_MEMORY_HOTPLUG */ 81#endif /* CONFIG_MEMORY_HOTPLUG */
83 82
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index bbd2221923c3..6a7621b2b12b 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -147,6 +147,7 @@ extern void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *new);
147extern void mpol_rebind_task(struct task_struct *tsk, 147extern void mpol_rebind_task(struct task_struct *tsk,
148 const nodemask_t *new); 148 const nodemask_t *new);
149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); 149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
150extern void mpol_fix_fork_child_flag(struct task_struct *p);
150#define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x)) 151#define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x))
151 152
152#ifdef CONFIG_CPUSET 153#ifdef CONFIG_CPUSET
@@ -248,6 +249,10 @@ static inline void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new)
248{ 249{
249} 250}
250 251
252static inline void mpol_fix_fork_child_flag(struct task_struct *p)
253{
254}
255
251#define set_cpuset_being_rebound(x) do {} while (0) 256#define set_cpuset_being_rebound(x) do {} while (0)
252 257
253static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, 258static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index f2427d7394b0..9be484d11283 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -6,6 +6,8 @@
6 6
7#include <linux/wait.h> 7#include <linux/wait.h>
8 8
9struct kmem_cache;
10
9typedef void * (mempool_alloc_t)(gfp_t gfp_mask, void *pool_data); 11typedef void * (mempool_alloc_t)(gfp_t gfp_mask, void *pool_data);
10typedef void (mempool_free_t)(void *element, void *pool_data); 12typedef void (mempool_free_t)(void *element, void *pool_data);
11 13
@@ -37,5 +39,41 @@ extern void mempool_free(void *element, mempool_t *pool);
37 */ 39 */
38void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data); 40void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data);
39void mempool_free_slab(void *element, void *pool_data); 41void mempool_free_slab(void *element, void *pool_data);
42static inline mempool_t *
43mempool_create_slab_pool(int min_nr, struct kmem_cache *kc)
44{
45 return mempool_create(min_nr, mempool_alloc_slab, mempool_free_slab,
46 (void *) kc);
47}
48
49/*
50 * 2 mempool_alloc_t's and a mempool_free_t to kmalloc/kzalloc and kfree
51 * the amount of memory specified by pool_data
52 */
53void *mempool_kmalloc(gfp_t gfp_mask, void *pool_data);
54void *mempool_kzalloc(gfp_t gfp_mask, void *pool_data);
55void mempool_kfree(void *element, void *pool_data);
56static inline mempool_t *mempool_create_kmalloc_pool(int min_nr, size_t size)
57{
58 return mempool_create(min_nr, mempool_kmalloc, mempool_kfree,
59 (void *) size);
60}
61static inline mempool_t *mempool_create_kzalloc_pool(int min_nr, size_t size)
62{
63 return mempool_create(min_nr, mempool_kzalloc, mempool_kfree,
64 (void *) size);
65}
66
67/*
68 * A mempool_alloc_t and mempool_free_t for a simple page allocator that
69 * allocates pages of the order specified by pool_data
70 */
71void *mempool_alloc_pages(gfp_t gfp_mask, void *pool_data);
72void mempool_free_pages(void *element, void *pool_data);
73static inline mempool_t *mempool_create_page_pool(int min_nr, int order)
74{
75 return mempool_create(min_nr, mempool_alloc_pages, mempool_free_pages,
76 (void *)(long)order);
77}
40 78
41#endif /* _LINUX_MEMPOOL_H */ 79#endif /* _LINUX_MEMPOOL_H */
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
new file mode 100644
index 000000000000..ff0a64073ebc
--- /dev/null
+++ b/include/linux/migrate.h
@@ -0,0 +1,39 @@
1#ifndef _LINUX_MIGRATE_H
2#define _LINUX_MIGRATE_H
3
4#include <linux/config.h>
5#include <linux/mm.h>
6
7#ifdef CONFIG_MIGRATION
8extern int isolate_lru_page(struct page *p, struct list_head *pagelist);
9extern int putback_lru_pages(struct list_head *l);
10extern int migrate_page(struct page *, struct page *);
11extern void migrate_page_copy(struct page *, struct page *);
12extern int migrate_page_remove_references(struct page *, struct page *, int);
13extern int migrate_pages(struct list_head *l, struct list_head *t,
14 struct list_head *moved, struct list_head *failed);
15extern int migrate_pages_to(struct list_head *pagelist,
16 struct vm_area_struct *vma, int dest);
17extern int fail_migrate_page(struct page *, struct page *);
18
19extern int migrate_prep(void);
20
21#else
22
23static inline int isolate_lru_page(struct page *p, struct list_head *list)
24 { return -ENOSYS; }
25static inline int putback_lru_pages(struct list_head *l) { return 0; }
26static inline int migrate_pages(struct list_head *l, struct list_head *t,
27 struct list_head *moved, struct list_head *failed) { return -ENOSYS; }
28
29static inline int migrate_pages_to(struct list_head *pagelist,
30 struct vm_area_struct *vma, int dest) { return 0; }
31
32static inline int migrate_prep(void) { return -ENOSYS; }
33
34/* Possible settings for the migrate_page() method in address_operations */
35#define migrate_page NULL
36#define fail_migrate_page NULL
37
38#endif /* CONFIG_MIGRATION */
39#endif /* _LINUX_MIGRATE_H */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 14ceebfc1efa..5b584dafb5a6 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -36,7 +36,7 @@ struct class_device;
36struct miscdevice { 36struct miscdevice {
37 int minor; 37 int minor;
38 const char *name; 38 const char *name;
39 struct file_operations *fops; 39 const struct file_operations *fops;
40 struct list_head list; 40 struct list_head list;
41 struct device *dev; 41 struct device *dev;
42 struct class_device *class; 42 struct class_device *class;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 498ff8778fb6..6aa016f1d3ae 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -286,43 +286,34 @@ struct page {
286 * 286 *
287 * Also, many kernel routines increase the page count before a critical 287 * Also, many kernel routines increase the page count before a critical
288 * routine so they can be sure the page doesn't go away from under them. 288 * routine so they can be sure the page doesn't go away from under them.
289 *
290 * Since 2.6.6 (approx), a free page has ->_count = -1. This is so that we
291 * can use atomic_add_negative(-1, page->_count) to detect when the page
292 * becomes free and so that we can also use atomic_inc_and_test to atomically
293 * detect when we just tried to grab a ref on a page which some other CPU has
294 * already deemed to be freeable.
295 *
296 * NO code should make assumptions about this internal detail! Use the provided
297 * macros which retain the old rules: page_count(page) == 0 is a free page.
298 */ 289 */
299 290
300/* 291/*
301 * Drop a ref, return true if the logical refcount fell to zero (the page has 292 * Drop a ref, return true if the logical refcount fell to zero (the page has
302 * no users) 293 * no users)
303 */ 294 */
304#define put_page_testzero(p) \ 295static inline int put_page_testzero(struct page *page)
305 ({ \ 296{
306 BUG_ON(atomic_read(&(p)->_count) == -1);\ 297 BUG_ON(atomic_read(&page->_count) == 0);
307 atomic_add_negative(-1, &(p)->_count); \ 298 return atomic_dec_and_test(&page->_count);
308 }) 299}
309 300
310/* 301/*
311 * Grab a ref, return true if the page previously had a logical refcount of 302 * Try to grab a ref unless the page has a refcount of zero, return false if
312 * zero. ie: returns true if we just grabbed an already-deemed-to-be-free page 303 * that is the case.
313 */ 304 */
314#define get_page_testone(p) atomic_inc_and_test(&(p)->_count) 305static inline int get_page_unless_zero(struct page *page)
315 306{
316#define set_page_count(p,v) atomic_set(&(p)->_count, (v) - 1) 307 return atomic_inc_not_zero(&page->_count);
317#define __put_page(p) atomic_dec(&(p)->_count) 308}
318 309
319extern void FASTCALL(__page_cache_release(struct page *)); 310extern void FASTCALL(__page_cache_release(struct page *));
320 311
321static inline int page_count(struct page *page) 312static inline int page_count(struct page *page)
322{ 313{
323 if (PageCompound(page)) 314 if (unlikely(PageCompound(page)))
324 page = (struct page *)page_private(page); 315 page = (struct page *)page_private(page);
325 return atomic_read(&page->_count) + 1; 316 return atomic_read(&page->_count);
326} 317}
327 318
328static inline void get_page(struct page *page) 319static inline void get_page(struct page *page)
@@ -332,8 +323,19 @@ static inline void get_page(struct page *page)
332 atomic_inc(&page->_count); 323 atomic_inc(&page->_count);
333} 324}
334 325
326/*
327 * Setup the page count before being freed into the page allocator for
328 * the first time (boot or memory hotplug)
329 */
330static inline void init_page_count(struct page *page)
331{
332 atomic_set(&page->_count, 1);
333}
334
335void put_page(struct page *page); 335void put_page(struct page *page);
336 336
337void split_page(struct page *page, unsigned int order);
338
337/* 339/*
338 * Multiple processes may "see" the same page. E.g. for untouched 340 * Multiple processes may "see" the same page. E.g. for untouched
339 * mappings of /dev/null, all processes see the same page full of 341 * mappings of /dev/null, all processes see the same page full of
@@ -1046,7 +1048,7 @@ int in_gate_area_no_task(unsigned long addr);
1046 1048
1047int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, 1049int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
1048 void __user *, size_t *, loff_t *); 1050 void __user *, size_t *, loff_t *);
1049int shrink_slab(unsigned long scanned, gfp_t gfp_mask, 1051unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
1050 unsigned long lru_pages); 1052 unsigned long lru_pages);
1051void drop_pagecache(void); 1053void drop_pagecache(void);
1052void drop_slab(void); 1054void drop_slab(void);
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 8ac854f7f190..3b6723dfaff3 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -32,7 +32,7 @@ del_page_from_lru(struct zone *zone, struct page *page)
32{ 32{
33 list_del(&page->lru); 33 list_del(&page->lru);
34 if (PageActive(page)) { 34 if (PageActive(page)) {
35 ClearPageActive(page); 35 __ClearPageActive(page);
36 zone->nr_active--; 36 zone->nr_active--;
37 } else { 37 } else {
38 zone->nr_inactive--; 38 zone->nr_inactive--;
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index ebfc238cc243..b5c21122c299 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -13,6 +13,7 @@
13#include <linux/numa.h> 13#include <linux/numa.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/seqlock.h> 15#include <linux/seqlock.h>
16#include <linux/nodemask.h>
16#include <asm/atomic.h> 17#include <asm/atomic.h>
17 18
18/* Free memory management - zoned buddy allocator. */ 19/* Free memory management - zoned buddy allocator. */
@@ -225,7 +226,6 @@ struct zone {
225 * Discontig memory support fields. 226 * Discontig memory support fields.
226 */ 227 */
227 struct pglist_data *zone_pgdat; 228 struct pglist_data *zone_pgdat;
228 struct page *zone_mem_map;
229 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ 229 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
230 unsigned long zone_start_pfn; 230 unsigned long zone_start_pfn;
231 231
@@ -307,7 +307,6 @@ typedef struct pglist_data {
307 unsigned long node_spanned_pages; /* total size of physical page 307 unsigned long node_spanned_pages; /* total size of physical page
308 range, including holes */ 308 range, including holes */
309 int node_id; 309 int node_id;
310 struct pglist_data *pgdat_next;
311 wait_queue_head_t kswapd_wait; 310 wait_queue_head_t kswapd_wait;
312 struct task_struct *kswapd; 311 struct task_struct *kswapd;
313 int kswapd_max_order; 312 int kswapd_max_order;
@@ -324,8 +323,6 @@ typedef struct pglist_data {
324 323
325#include <linux/memory_hotplug.h> 324#include <linux/memory_hotplug.h>
326 325
327extern struct pglist_data *pgdat_list;
328
329void __get_zone_counts(unsigned long *active, unsigned long *inactive, 326void __get_zone_counts(unsigned long *active, unsigned long *inactive,
330 unsigned long *free, struct pglist_data *pgdat); 327 unsigned long *free, struct pglist_data *pgdat);
331void get_zone_counts(unsigned long *active, unsigned long *inactive, 328void get_zone_counts(unsigned long *active, unsigned long *inactive,
@@ -350,57 +347,6 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
350 */ 347 */
351#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones) 348#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
352 349
353/**
354 * for_each_pgdat - helper macro to iterate over all nodes
355 * @pgdat - pointer to a pg_data_t variable
356 *
357 * Meant to help with common loops of the form
358 * pgdat = pgdat_list;
359 * while(pgdat) {
360 * ...
361 * pgdat = pgdat->pgdat_next;
362 * }
363 */
364#define for_each_pgdat(pgdat) \
365 for (pgdat = pgdat_list; pgdat; pgdat = pgdat->pgdat_next)
366
367/*
368 * next_zone - helper magic for for_each_zone()
369 * Thanks to William Lee Irwin III for this piece of ingenuity.
370 */
371static inline struct zone *next_zone(struct zone *zone)
372{
373 pg_data_t *pgdat = zone->zone_pgdat;
374
375 if (zone < pgdat->node_zones + MAX_NR_ZONES - 1)
376 zone++;
377 else if (pgdat->pgdat_next) {
378 pgdat = pgdat->pgdat_next;
379 zone = pgdat->node_zones;
380 } else
381 zone = NULL;
382
383 return zone;
384}
385
386/**
387 * for_each_zone - helper macro to iterate over all memory zones
388 * @zone - pointer to struct zone variable
389 *
390 * The user only needs to declare the zone variable, for_each_zone
391 * fills it in. This basically means for_each_zone() is an
392 * easier to read version of this piece of code:
393 *
394 * for (pgdat = pgdat_list; pgdat; pgdat = pgdat->node_next)
395 * for (i = 0; i < MAX_NR_ZONES; ++i) {
396 * struct zone * z = pgdat->node_zones + i;
397 * ...
398 * }
399 * }
400 */
401#define for_each_zone(zone) \
402 for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone))
403
404static inline int populated_zone(struct zone *zone) 350static inline int populated_zone(struct zone *zone)
405{ 351{
406 return (!!zone->present_pages); 352 return (!!zone->present_pages);
@@ -472,6 +418,30 @@ extern struct pglist_data contig_page_data;
472 418
473#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 419#endif /* !CONFIG_NEED_MULTIPLE_NODES */
474 420
421extern struct pglist_data *first_online_pgdat(void);
422extern struct pglist_data *next_online_pgdat(struct pglist_data *pgdat);
423extern struct zone *next_zone(struct zone *zone);
424
425/**
426 * for_each_pgdat - helper macro to iterate over all nodes
427 * @pgdat - pointer to a pg_data_t variable
428 */
429#define for_each_online_pgdat(pgdat) \
430 for (pgdat = first_online_pgdat(); \
431 pgdat; \
432 pgdat = next_online_pgdat(pgdat))
433/**
434 * for_each_zone - helper macro to iterate over all memory zones
435 * @zone - pointer to struct zone variable
436 *
437 * The user only needs to declare the zone variable, for_each_zone
438 * fills it in.
439 */
440#define for_each_zone(zone) \
441 for (zone = (first_online_pgdat())->node_zones; \
442 zone; \
443 zone = next_zone(zone))
444
475#ifdef CONFIG_SPARSEMEM 445#ifdef CONFIG_SPARSEMEM
476#include <asm/sparsemem.h> 446#include <asm/sparsemem.h>
477#endif 447#endif
@@ -602,17 +572,6 @@ static inline struct mem_section *__pfn_to_section(unsigned long pfn)
602 return __nr_to_section(pfn_to_section_nr(pfn)); 572 return __nr_to_section(pfn_to_section_nr(pfn));
603} 573}
604 574
605#define pfn_to_page(pfn) \
606({ \
607 unsigned long __pfn = (pfn); \
608 __section_mem_map_addr(__pfn_to_section(__pfn)) + __pfn; \
609})
610#define page_to_pfn(page) \
611({ \
612 page - __section_mem_map_addr(__nr_to_section( \
613 page_to_section(page))); \
614})
615
616static inline int pfn_valid(unsigned long pfn) 575static inline int pfn_valid(unsigned long pfn)
617{ 576{
618 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) 577 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
diff --git a/include/linux/module.h b/include/linux/module.h
index 84d75f3a8aca..eaec13ddd667 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -183,6 +183,7 @@ void *__symbol_get_gpl(const char *symbol);
183 183
184/* For every exported symbol, place a struct in the __ksymtab section */ 184/* For every exported symbol, place a struct in the __ksymtab section */
185#define __EXPORT_SYMBOL(sym, sec) \ 185#define __EXPORT_SYMBOL(sym, sec) \
186 extern typeof(sym) sym; \
186 __CRC_SYMBOL(sym, sec) \ 187 __CRC_SYMBOL(sym, sec) \
187 static const char __kstrtab_##sym[] \ 188 static const char __kstrtab_##sym[] \
188 __attribute__((section("__ksymtab_strings"))) \ 189 __attribute__((section("__ksymtab_strings"))) \
@@ -198,6 +199,9 @@ void *__symbol_get_gpl(const char *symbol);
198#define EXPORT_SYMBOL_GPL(sym) \ 199#define EXPORT_SYMBOL_GPL(sym) \
199 __EXPORT_SYMBOL(sym, "_gpl") 200 __EXPORT_SYMBOL(sym, "_gpl")
200 201
202#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
203 __EXPORT_SYMBOL(sym, "_gpl_future")
204
201#endif 205#endif
202 206
203struct module_ref 207struct module_ref
@@ -242,6 +246,7 @@ struct module
242 /* Sysfs stuff. */ 246 /* Sysfs stuff. */
243 struct module_kobject mkobj; 247 struct module_kobject mkobj;
244 struct module_param_attrs *param_attrs; 248 struct module_param_attrs *param_attrs;
249 struct module_attribute *modinfo_attrs;
245 const char *version; 250 const char *version;
246 const char *srcversion; 251 const char *srcversion;
247 252
@@ -255,6 +260,11 @@ struct module
255 unsigned int num_gpl_syms; 260 unsigned int num_gpl_syms;
256 const unsigned long *gpl_crcs; 261 const unsigned long *gpl_crcs;
257 262
263 /* symbols that will be GPL-only in the near future. */
264 const struct kernel_symbol *gpl_future_syms;
265 unsigned int num_gpl_future_syms;
266 const unsigned long *gpl_future_crcs;
267
258 /* Exception table */ 268 /* Exception table */
259 unsigned int num_exentries; 269 unsigned int num_exentries;
260 const struct exception_table_entry *extable; 270 const struct exception_table_entry *extable;
@@ -441,6 +451,7 @@ void module_remove_driver(struct device_driver *);
441#else /* !CONFIG_MODULES... */ 451#else /* !CONFIG_MODULES... */
442#define EXPORT_SYMBOL(sym) 452#define EXPORT_SYMBOL(sym)
443#define EXPORT_SYMBOL_GPL(sym) 453#define EXPORT_SYMBOL_GPL(sym)
454#define EXPORT_SYMBOL_GPL_FUTURE(sym)
444 455
445/* Given an address, look for it in the exception tables. */ 456/* Given an address, look for it in the exception tables. */
446static inline const struct exception_table_entry * 457static inline const struct exception_table_entry *
@@ -544,25 +555,6 @@ static inline void module_remove_driver(struct device_driver *driver)
544 555
545/* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */ 556/* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */
546 557
547struct obsolete_modparm {
548 char name[64];
549 char type[64-sizeof(void *)];
550 void *addr;
551};
552
553static inline void MODULE_PARM_(void) { }
554#ifdef MODULE
555/* DEPRECATED: Do not use. */
556#define MODULE_PARM(var,type) \
557extern struct obsolete_modparm __parm_##var \
558__attribute__((section("__obsparm"))); \
559struct obsolete_modparm __parm_##var = \
560{ __stringify(var), type, &MODULE_PARM_ }; \
561__MODULE_PARM_TYPE(var, type);
562#else
563#define MODULE_PARM(var,type) static void __attribute__((__unused__)) *__parm_##var = &MODULE_PARM_;
564#endif
565
566#define __MODULE_STRING(x) __stringify(x) 558#define __MODULE_STRING(x) __stringify(x)
567 559
568/* Use symbol_get and symbol_put instead. You'll thank me. */ 560/* Use symbol_get and symbol_put instead. You'll thank me. */
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index b5c98c43779e..7c0c2c198f1f 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -162,13 +162,6 @@ extern int param_array_get(char *buffer, struct kernel_param *kp);
162extern int param_set_copystring(const char *val, struct kernel_param *kp); 162extern int param_set_copystring(const char *val, struct kernel_param *kp);
163extern int param_get_string(char *buffer, struct kernel_param *kp); 163extern int param_get_string(char *buffer, struct kernel_param *kp);
164 164
165int param_array(const char *name,
166 const char *val,
167 unsigned int min, unsigned int max,
168 void *elem, int elemsize,
169 int (*set)(const char *, struct kernel_param *kp),
170 int *num);
171
172/* for exporting parameters in /sys/parameters */ 165/* for exporting parameters in /sys/parameters */
173 166
174struct module; 167struct module;
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index e933e2a355ad..d9035c73e5d1 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -184,6 +184,7 @@ struct fat_slot_info {
184#include <linux/string.h> 184#include <linux/string.h>
185#include <linux/nls.h> 185#include <linux/nls.h>
186#include <linux/fs.h> 186#include <linux/fs.h>
187#include <linux/mutex.h>
187 188
188struct fat_mount_options { 189struct fat_mount_options {
189 uid_t fs_uid; 190 uid_t fs_uid;
@@ -199,7 +200,7 @@ struct fat_mount_options {
199 sys_immutable:1, /* set = system files are immutable */ 200 sys_immutable:1, /* set = system files are immutable */
200 dotsOK:1, /* set = hidden and system files are named '.filename' */ 201 dotsOK:1, /* set = hidden and system files are named '.filename' */
201 isvfat:1, /* 0=no vfat long filename support, 1=vfat support */ 202 isvfat:1, /* 0=no vfat long filename support, 1=vfat support */
202 utf8:1, /* Use of UTF8 character set (Default) */ 203 utf8:1, /* Use of UTF-8 character set (Default) */
203 unicode_xlate:1, /* create escape sequences for unhandled Unicode */ 204 unicode_xlate:1, /* create escape sequences for unhandled Unicode */
204 numtail:1, /* Does first alias have a numeric '~1' type tail? */ 205 numtail:1, /* Does first alias have a numeric '~1' type tail? */
205 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */ 206 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */
@@ -226,7 +227,7 @@ struct msdos_sb_info {
226 unsigned long max_cluster; /* maximum cluster number */ 227 unsigned long max_cluster; /* maximum cluster number */
227 unsigned long root_cluster; /* first cluster of the root directory */ 228 unsigned long root_cluster; /* first cluster of the root directory */
228 unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */ 229 unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */
229 struct semaphore fat_lock; 230 struct mutex fat_lock;
230 unsigned int prev_free; /* previously allocated cluster number */ 231 unsigned int prev_free; /* previously allocated cluster number */
231 unsigned int free_clusters; /* -1 if undefined */ 232 unsigned int free_clusters; /* -1 if undefined */
232 struct fat_mount_options options; 233 struct fat_mount_options options;
@@ -333,7 +334,7 @@ extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
333 unsigned long *mapped_blocks); 334 unsigned long *mapped_blocks);
334 335
335/* fat/dir.c */ 336/* fat/dir.c */
336extern struct file_operations fat_dir_operations; 337extern const struct file_operations fat_dir_operations;
337extern int fat_search_long(struct inode *inode, const unsigned char *name, 338extern int fat_search_long(struct inode *inode, const unsigned char *name,
338 int name_len, struct fat_slot_info *sinfo); 339 int name_len, struct fat_slot_info *sinfo);
339extern int fat_dir_empty(struct inode *dir); 340extern int fat_dir_empty(struct inode *dir);
@@ -396,7 +397,7 @@ extern int fat_count_free_clusters(struct super_block *sb);
396/* fat/file.c */ 397/* fat/file.c */
397extern int fat_generic_ioctl(struct inode *inode, struct file *filp, 398extern int fat_generic_ioctl(struct inode *inode, struct file *filp,
398 unsigned int cmd, unsigned long arg); 399 unsigned int cmd, unsigned long arg);
399extern struct file_operations fat_file_operations; 400extern const struct file_operations fat_file_operations;
400extern struct inode_operations fat_file_inode_operations; 401extern struct inode_operations fat_file_inode_operations;
401extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); 402extern int fat_notify_change(struct dentry * dentry, struct iattr * attr);
402extern void fat_truncate(struct inode *inode); 403extern void fat_truncate(struct inode *inode);
@@ -419,6 +420,9 @@ extern int date_dos2unix(unsigned short time, unsigned short date);
419extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date); 420extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date);
420extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); 421extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs);
421 422
423int fat_cache_init(void);
424void fat_cache_destroy(void);
425
422#endif /* __KERNEL__ */ 426#endif /* __KERNEL__ */
423 427
424#endif 428#endif
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index f46afec6fbf8..72fc68c5ee96 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -10,7 +10,7 @@
10#ifndef __MTD_TRANS_H__ 10#ifndef __MTD_TRANS_H__
11#define __MTD_TRANS_H__ 11#define __MTD_TRANS_H__
12 12
13#include <asm/semaphore.h> 13#include <linux/mutex.h>
14 14
15struct hd_geometry; 15struct hd_geometry;
16struct mtd_info; 16struct mtd_info;
@@ -22,7 +22,7 @@ struct mtd_blktrans_dev {
22 struct mtd_blktrans_ops *tr; 22 struct mtd_blktrans_ops *tr;
23 struct list_head list; 23 struct list_head list;
24 struct mtd_info *mtd; 24 struct mtd_info *mtd;
25 struct semaphore sem; 25 struct mutex lock;
26 int devnum; 26 int devnum;
27 int blksize; 27 int blksize;
28 unsigned long size; 28 unsigned long size;
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 386a52cf8b1b..9addd073bf15 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -15,7 +15,7 @@
15#define __MTD_DOC2000_H__ 15#define __MTD_DOC2000_H__
16 16
17#include <linux/mtd/mtd.h> 17#include <linux/mtd/mtd.h>
18#include <asm/semaphore.h> 18#include <linux/mutex.h>
19 19
20#define DoC_Sig1 0 20#define DoC_Sig1 0
21#define DoC_Sig2 1 21#define DoC_Sig2 1
@@ -187,7 +187,7 @@ struct DiskOnChip {
187 int numchips; 187 int numchips;
188 struct Nand *chips; 188 struct Nand *chips;
189 struct mtd_info *nextdoc; 189 struct mtd_info *nextdoc;
190 struct semaphore lock; 190 struct mutex lock;
191}; 191};
192 192
193int doc_decode_ecc(unsigned char sector[512], unsigned char ecc1[6]); 193int doc_decode_ecc(unsigned char sector[512], unsigned char ecc1[6]);
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h
index 0268125a6271..d7eaa40e5ab0 100644
--- a/include/linux/mtd/inftl.h
+++ b/include/linux/mtd/inftl.h
@@ -52,6 +52,11 @@ struct INFTLrecord {
52int INFTL_mount(struct INFTLrecord *s); 52int INFTL_mount(struct INFTLrecord *s);
53int INFTL_formatblock(struct INFTLrecord *s, int block); 53int INFTL_formatblock(struct INFTLrecord *s, int block);
54 54
55extern char inftlmountrev[];
56
57void INFTL_dumptables(struct INFTLrecord *s);
58void INFTL_dumpVUchains(struct INFTLrecord *s);
59
55#endif /* __KERNEL__ */ 60#endif /* __KERNEL__ */
56 61
57#endif /* __MTD_INFTL_H__ */ 62#endif /* __MTD_INFTL_H__ */
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h
index 0b08cd692201..955d3069d727 100644
--- a/include/linux/mv643xx.h
+++ b/include/linux/mv643xx.h
@@ -1214,6 +1214,7 @@ struct mv64xxx_i2c_pdata {
1214#define MV643XX_ETH_FORCE_BP_MODE_NO_JAM 0 1214#define MV643XX_ETH_FORCE_BP_MODE_NO_JAM 0
1215#define MV643XX_ETH_FORCE_BP_MODE_JAM_TX (1<<7) 1215#define MV643XX_ETH_FORCE_BP_MODE_JAM_TX (1<<7)
1216#define MV643XX_ETH_FORCE_BP_MODE_JAM_TX_ON_RX_ERR (1<<8) 1216#define MV643XX_ETH_FORCE_BP_MODE_JAM_TX_ON_RX_ERR (1<<8)
1217#define MV643XX_ETH_SERIAL_PORT_CONTROL_RESERVED (1<<9)
1217#define MV643XX_ETH_FORCE_LINK_FAIL 0 1218#define MV643XX_ETH_FORCE_LINK_FAIL 0
1218#define MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL (1<<10) 1219#define MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL (1<<10)
1219#define MV643XX_ETH_RETRANSMIT_16_ATTEMPTS 0 1220#define MV643XX_ETH_RETRANSMIT_16_ATTEMPTS 0
@@ -1243,6 +1244,8 @@ struct mv64xxx_i2c_pdata {
1243#define MV643XX_ETH_SET_MII_SPEED_TO_10 0 1244#define MV643XX_ETH_SET_MII_SPEED_TO_10 0
1244#define MV643XX_ETH_SET_MII_SPEED_TO_100 (1<<24) 1245#define MV643XX_ETH_SET_MII_SPEED_TO_100 (1<<24)
1245 1246
1247#define MV643XX_ETH_MAX_RX_PACKET_MASK (0x7<<17)
1248
1246#define MV643XX_ETH_PORT_SERIAL_CONTROL_DEFAULT_VALUE \ 1249#define MV643XX_ETH_PORT_SERIAL_CONTROL_DEFAULT_VALUE \
1247 MV643XX_ETH_DO_NOT_FORCE_LINK_PASS | \ 1250 MV643XX_ETH_DO_NOT_FORCE_LINK_PASS | \
1248 MV643XX_ETH_ENABLE_AUTO_NEG_FOR_DUPLX | \ 1251 MV643XX_ETH_ENABLE_AUTO_NEG_FOR_DUPLX | \
@@ -1285,23 +1288,15 @@ struct mv64xxx_i2c_pdata {
1285#define MV643XX_ETH_NAME "mv643xx_eth" 1288#define MV643XX_ETH_NAME "mv643xx_eth"
1286 1289
1287struct mv643xx_eth_platform_data { 1290struct mv643xx_eth_platform_data {
1288 /*
1289 * Non-values for mac_addr, phy_addr, port_config, etc.
1290 * override the default value. Setting the corresponding
1291 * force_* field, causes the default value to be overridden
1292 * even when zero.
1293 */
1294 unsigned int force_phy_addr:1;
1295 unsigned int force_port_config:1;
1296 unsigned int force_port_config_extend:1;
1297 unsigned int force_port_sdma_config:1;
1298 unsigned int force_port_serial_control:1;
1299 int phy_addr;
1300 char *mac_addr; /* pointer to mac address */ 1291 char *mac_addr; /* pointer to mac address */
1301 u32 port_config; 1292 u16 force_phy_addr; /* force override if phy_addr == 0 */
1302 u32 port_config_extend; 1293 u16 phy_addr;
1303 u32 port_sdma_config; 1294
1304 u32 port_serial_control; 1295 /* If speed is 0, then speed and duplex are autonegotiated. */
1296 int speed; /* 0, SPEED_10, SPEED_100, SPEED_1000 */
1297 int duplex; /* DUPLEX_HALF or DUPLEX_FULL */
1298
1299 /* non-zero values of the following fields override defaults */
1305 u32 tx_queue_size; 1300 u32 tx_queue_size;
1306 u32 rx_queue_size; 1301 u32 rx_queue_size;
1307 u32 tx_sram_addr; 1302 u32 tx_sram_addr;
diff --git a/include/linux/namei.h b/include/linux/namei.h
index e6698013e4d0..58cb3d3d44b4 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -75,7 +75,6 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
75extern void release_open_intent(struct nameidata *); 75extern void release_open_intent(struct nameidata *);
76 76
77extern struct dentry * lookup_one_len(const char *, struct dentry *, int); 77extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
78extern __deprecated_for_modules struct dentry * lookup_hash(struct nameidata *);
79 78
80extern int follow_down(struct vfsmount **, struct dentry **); 79extern int follow_down(struct vfsmount **, struct dentry **);
81extern int follow_up(struct vfsmount **, struct dentry **); 80extern int follow_up(struct vfsmount **, struct dentry **);
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index f95d51fae733..a6ce409ec6fc 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -38,6 +38,7 @@ enum {
38#ifdef __KERNEL__ 38#ifdef __KERNEL__
39 39
40#include <linux/wait.h> 40#include <linux/wait.h>
41#include <linux/mutex.h>
41 42
42/* values for flags field */ 43/* values for flags field */
43#define NBD_READ_ONLY 0x0001 44#define NBD_READ_ONLY 0x0001
@@ -57,7 +58,7 @@ struct nbd_device {
57 struct request *active_req; 58 struct request *active_req;
58 wait_queue_head_t active_wq; 59 wait_queue_head_t active_wq;
59 60
60 struct semaphore tx_lock; 61 struct mutex tx_lock;
61 struct gendisk *disk; 62 struct gendisk *disk;
62 int blksize; 63 int blksize;
63 u64 bytesize; 64 u64 bytesize;
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index e01342568530..96dc237b8f03 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -209,7 +209,7 @@ void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
209 209
210/* linux/fs/ncpfs/dir.c */ 210/* linux/fs/ncpfs/dir.c */
211extern struct inode_operations ncp_dir_inode_operations; 211extern struct inode_operations ncp_dir_inode_operations;
212extern struct file_operations ncp_dir_operations; 212extern const struct file_operations ncp_dir_operations;
213int ncp_conn_logged_in(struct super_block *); 213int ncp_conn_logged_in(struct super_block *);
214int ncp_date_dos2unix(__le16 time, __le16 date); 214int ncp_date_dos2unix(__le16 time, __le16 date);
215void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 215void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
@@ -230,7 +230,7 @@ void ncp_unlock_server(struct ncp_server *server);
230 230
231/* linux/fs/ncpfs/file.c */ 231/* linux/fs/ncpfs/file.c */
232extern struct inode_operations ncp_file_inode_operations; 232extern struct inode_operations ncp_file_inode_operations;
233extern struct file_operations ncp_file_operations; 233extern const struct file_operations ncp_file_operations;
234int ncp_make_open(struct inode *, int); 234int ncp_make_open(struct inode *, int);
235 235
236/* linux/fs/ncpfs/mmap.c */ 236/* linux/fs/ncpfs/mmap.c */
diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h
index 415be1ec6f98..bdb4c8ae6924 100644
--- a/include/linux/ncp_fs_i.h
+++ b/include/linux/ncp_fs_i.h
@@ -19,7 +19,7 @@ struct ncp_inode_info {
19 __le32 DosDirNum; 19 __le32 DosDirNum;
20 __u8 volNumber; 20 __u8 volNumber;
21 __le32 nwattr; 21 __le32 nwattr;
22 struct semaphore open_sem; 22 struct mutex open_mutex;
23 atomic_t opened; 23 atomic_t opened;
24 int access; 24 int access;
25 int flags; 25 int flags;
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
index cf858eb80f0b..b089d9506283 100644
--- a/include/linux/ncp_fs_sb.h
+++ b/include/linux/ncp_fs_sb.h
@@ -11,6 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/ncp_mount.h> 12#include <linux/ncp_mount.h>
13#include <linux/net.h> 13#include <linux/net.h>
14#include <linux/mutex.h>
14 15
15#ifdef __KERNEL__ 16#ifdef __KERNEL__
16 17
@@ -51,7 +52,7 @@ struct ncp_server {
51 receive replies */ 52 receive replies */
52 53
53 int lock; /* To prevent mismatch in protocols. */ 54 int lock; /* To prevent mismatch in protocols. */
54 struct semaphore sem; 55 struct mutex mutex;
55 56
56 int current_size; /* for packet preparation */ 57 int current_size; /* for packet preparation */
57 int has_subfunction; 58 int has_subfunction;
@@ -96,7 +97,7 @@ struct ncp_server {
96 struct { 97 struct {
97 struct work_struct tq; /* STREAM/DGRAM: data/error ready */ 98 struct work_struct tq; /* STREAM/DGRAM: data/error ready */
98 struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */ 99 struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */
99 struct semaphore creq_sem; /* DGRAM only: lock accesses to rcv.creq */ 100 struct mutex creq_mutex; /* DGRAM only: lock accesses to rcv.creq */
100 101
101 unsigned int state; /* STREAM only: receiver state */ 102 unsigned int state; /* STREAM only: receiver state */
102 struct { 103 struct {
diff --git a/include/linux/net.h b/include/linux/net.h
index 28195a2d8ff0..84a490e5f0a1 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -143,12 +143,18 @@ struct proto_ops {
143 struct poll_table_struct *wait); 143 struct poll_table_struct *wait);
144 int (*ioctl) (struct socket *sock, unsigned int cmd, 144 int (*ioctl) (struct socket *sock, unsigned int cmd,
145 unsigned long arg); 145 unsigned long arg);
146 int (*compat_ioctl) (struct socket *sock, unsigned int cmd,
147 unsigned long arg);
146 int (*listen) (struct socket *sock, int len); 148 int (*listen) (struct socket *sock, int len);
147 int (*shutdown) (struct socket *sock, int flags); 149 int (*shutdown) (struct socket *sock, int flags);
148 int (*setsockopt)(struct socket *sock, int level, 150 int (*setsockopt)(struct socket *sock, int level,
149 int optname, char __user *optval, int optlen); 151 int optname, char __user *optval, int optlen);
150 int (*getsockopt)(struct socket *sock, int level, 152 int (*getsockopt)(struct socket *sock, int level,
151 int optname, char __user *optval, int __user *optlen); 153 int optname, char __user *optval, int __user *optlen);
154 int (*compat_setsockopt)(struct socket *sock, int level,
155 int optname, char __user *optval, int optlen);
156 int (*compat_getsockopt)(struct socket *sock, int level,
157 int optname, char __user *optval, int __user *optlen);
152 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 158 int (*sendmsg) (struct kiocb *iocb, struct socket *sock,
153 struct msghdr *m, size_t total_len); 159 struct msghdr *m, size_t total_len);
154 int (*recvmsg) (struct kiocb *iocb, struct socket *sock, 160 int (*recvmsg) (struct kiocb *iocb, struct socket *sock,
@@ -247,6 +253,8 @@ SOCKCALL_UWRAP(name, poll, (struct file *file, struct socket *sock, struct poll_
247 (file, sock, wait)) \ 253 (file, sock, wait)) \
248SOCKCALL_WRAP(name, ioctl, (struct socket *sock, unsigned int cmd, \ 254SOCKCALL_WRAP(name, ioctl, (struct socket *sock, unsigned int cmd, \
249 unsigned long arg), (sock, cmd, arg)) \ 255 unsigned long arg), (sock, cmd, arg)) \
256SOCKCALL_WRAP(name, compat_ioctl, (struct socket *sock, unsigned int cmd, \
257 unsigned long arg), (sock, cmd, arg)) \
250SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \ 258SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \
251SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \ 259SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \
252SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \ 260SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \
@@ -271,6 +279,7 @@ static const struct proto_ops name##_ops = { \
271 .getname = __lock_##name##_getname, \ 279 .getname = __lock_##name##_getname, \
272 .poll = __lock_##name##_poll, \ 280 .poll = __lock_##name##_poll, \
273 .ioctl = __lock_##name##_ioctl, \ 281 .ioctl = __lock_##name##_ioctl, \
282 .compat_ioctl = __lock_##name##_compat_ioctl, \
274 .listen = __lock_##name##_listen, \ 283 .listen = __lock_##name##_listen, \
275 .shutdown = __lock_##name##_shutdown, \ 284 .shutdown = __lock_##name##_shutdown, \
276 .setsockopt = __lock_##name##_setsockopt, \ 285 .setsockopt = __lock_##name##_setsockopt, \
@@ -279,6 +288,7 @@ static const struct proto_ops name##_ops = { \
279 .recvmsg = __lock_##name##_recvmsg, \ 288 .recvmsg = __lock_##name##_recvmsg, \
280 .mmap = __lock_##name##_mmap, \ 289 .mmap = __lock_##name##_mmap, \
281}; 290};
291
282#endif 292#endif
283 293
284#define MODULE_ALIAS_NETPROTO(proto) \ 294#define MODULE_ALIAS_NETPROTO(proto) \
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7fda03d338d1..40ccf8cc4239 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -230,7 +230,8 @@ enum netdev_state_t
230 __LINK_STATE_SCHED, 230 __LINK_STATE_SCHED,
231 __LINK_STATE_NOCARRIER, 231 __LINK_STATE_NOCARRIER,
232 __LINK_STATE_RX_SCHED, 232 __LINK_STATE_RX_SCHED,
233 __LINK_STATE_LINKWATCH_PENDING 233 __LINK_STATE_LINKWATCH_PENDING,
234 __LINK_STATE_DORMANT,
234}; 235};
235 236
236 237
@@ -335,11 +336,14 @@ struct net_device
335 */ 336 */
336 337
337 338
338 unsigned short flags; /* interface flags (a la BSD) */ 339 unsigned int flags; /* interface flags (a la BSD) */
339 unsigned short gflags; 340 unsigned short gflags;
340 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */ 341 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */
341 unsigned short padded; /* How much padding added by alloc_netdev() */ 342 unsigned short padded; /* How much padding added by alloc_netdev() */
342 343
344 unsigned char operstate; /* RFC2863 operstate */
345 unsigned char link_mode; /* mapping policy to operstate */
346
343 unsigned mtu; /* interface MTU value */ 347 unsigned mtu; /* interface MTU value */
344 unsigned short type; /* interface hardware type */ 348 unsigned short type; /* interface hardware type */
345 unsigned short hard_header_len; /* hardware hdr length */ 349 unsigned short hard_header_len; /* hardware hdr length */
@@ -594,20 +598,7 @@ DECLARE_PER_CPU(struct softnet_data,softnet_data);
594 598
595#define HAVE_NETIF_QUEUE 599#define HAVE_NETIF_QUEUE
596 600
597static inline void __netif_schedule(struct net_device *dev) 601extern void __netif_schedule(struct net_device *dev);
598{
599 if (!test_and_set_bit(__LINK_STATE_SCHED, &dev->state)) {
600 unsigned long flags;
601 struct softnet_data *sd;
602
603 local_irq_save(flags);
604 sd = &__get_cpu_var(softnet_data);
605 dev->next_sched = sd->output_queue;
606 sd->output_queue = dev;
607 raise_softirq_irqoff(NET_TX_SOFTIRQ);
608 local_irq_restore(flags);
609 }
610}
611 602
612static inline void netif_schedule(struct net_device *dev) 603static inline void netif_schedule(struct net_device *dev)
613{ 604{
@@ -671,13 +662,7 @@ static inline void dev_kfree_skb_irq(struct sk_buff *skb)
671/* Use this variant in places where it could be invoked 662/* Use this variant in places where it could be invoked
672 * either from interrupt or non-interrupt context. 663 * either from interrupt or non-interrupt context.
673 */ 664 */
674static inline void dev_kfree_skb_any(struct sk_buff *skb) 665extern void dev_kfree_skb_any(struct sk_buff *skb);
675{
676 if (in_irq() || irqs_disabled())
677 dev_kfree_skb_irq(skb);
678 else
679 dev_kfree_skb(skb);
680}
681 666
682#define HAVE_NETIF_RX 1 667#define HAVE_NETIF_RX 1
683extern int netif_rx(struct sk_buff *skb); 668extern int netif_rx(struct sk_buff *skb);
@@ -708,12 +693,18 @@ static inline void dev_put(struct net_device *dev)
708 atomic_dec(&dev->refcnt); 693 atomic_dec(&dev->refcnt);
709} 694}
710 695
711#define __dev_put(dev) atomic_dec(&(dev)->refcnt) 696static inline void dev_hold(struct net_device *dev)
712#define dev_hold(dev) atomic_inc(&(dev)->refcnt) 697{
698 atomic_inc(&dev->refcnt);
699}
713 700
714/* Carrier loss detection, dial on demand. The functions netif_carrier_on 701/* Carrier loss detection, dial on demand. The functions netif_carrier_on
715 * and _off may be called from IRQ context, but it is caller 702 * and _off may be called from IRQ context, but it is caller
716 * who is responsible for serialization of these calls. 703 * who is responsible for serialization of these calls.
704 *
705 * The name carrier is inappropriate, these functions should really be
706 * called netif_lowerlayer_*() because they represent the state of any
707 * kind of lower layer not just hardware media.
717 */ 708 */
718 709
719extern void linkwatch_fire_event(struct net_device *dev); 710extern void linkwatch_fire_event(struct net_device *dev);
@@ -729,29 +720,39 @@ extern void netif_carrier_on(struct net_device *dev);
729 720
730extern void netif_carrier_off(struct net_device *dev); 721extern void netif_carrier_off(struct net_device *dev);
731 722
732/* Hot-plugging. */ 723static inline void netif_dormant_on(struct net_device *dev)
733static inline int netif_device_present(struct net_device *dev)
734{ 724{
735 return test_bit(__LINK_STATE_PRESENT, &dev->state); 725 if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state))
726 linkwatch_fire_event(dev);
736} 727}
737 728
738static inline void netif_device_detach(struct net_device *dev) 729static inline void netif_dormant_off(struct net_device *dev)
739{ 730{
740 if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) && 731 if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state))
741 netif_running(dev)) { 732 linkwatch_fire_event(dev);
742 netif_stop_queue(dev);
743 }
744} 733}
745 734
746static inline void netif_device_attach(struct net_device *dev) 735static inline int netif_dormant(const struct net_device *dev)
747{ 736{
748 if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) && 737 return test_bit(__LINK_STATE_DORMANT, &dev->state);
749 netif_running(dev)) { 738}
750 netif_wake_queue(dev); 739
751 __netdev_watchdog_up(dev); 740
752 } 741static inline int netif_oper_up(const struct net_device *dev) {
742 return (dev->operstate == IF_OPER_UP ||
743 dev->operstate == IF_OPER_UNKNOWN /* backward compat */);
753} 744}
754 745
746/* Hot-plugging. */
747static inline int netif_device_present(struct net_device *dev)
748{
749 return test_bit(__LINK_STATE_PRESENT, &dev->state);
750}
751
752extern void netif_device_detach(struct net_device *dev);
753
754extern void netif_device_attach(struct net_device *dev);
755
755/* 756/*
756 * Network interface message level settings 757 * Network interface message level settings
757 */ 758 */
@@ -818,20 +819,7 @@ static inline int netif_rx_schedule_prep(struct net_device *dev)
818 * already been called and returned 1. 819 * already been called and returned 1.
819 */ 820 */
820 821
821static inline void __netif_rx_schedule(struct net_device *dev) 822extern void __netif_rx_schedule(struct net_device *dev);
822{
823 unsigned long flags;
824
825 local_irq_save(flags);
826 dev_hold(dev);
827 list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);
828 if (dev->quota < 0)
829 dev->quota += dev->weight;
830 else
831 dev->quota = dev->weight;
832 __raise_softirq_irqoff(NET_RX_SOFTIRQ);
833 local_irq_restore(flags);
834}
835 823
836/* Try to reschedule poll. Called by irq handler. */ 824/* Try to reschedule poll. Called by irq handler. */
837 825
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 468896939843..412e52ca9720 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -80,10 +80,14 @@ struct nf_sockopt_ops
80 int set_optmin; 80 int set_optmin;
81 int set_optmax; 81 int set_optmax;
82 int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); 82 int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len);
83 int (*compat_set)(struct sock *sk, int optval,
84 void __user *user, unsigned int len);
83 85
84 int get_optmin; 86 int get_optmin;
85 int get_optmax; 87 int get_optmax;
86 int (*get)(struct sock *sk, int optval, void __user *user, int *len); 88 int (*get)(struct sock *sk, int optval, void __user *user, int *len);
89 int (*compat_get)(struct sock *sk, int optval,
90 void __user *user, int *len);
87 91
88 /* Number of users inside set() or get(). */ 92 /* Number of users inside set() or get(). */
89 unsigned int use; 93 unsigned int use;
@@ -246,6 +250,11 @@ int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt,
246int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, 250int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt,
247 int *len); 251 int *len);
248 252
253int compat_nf_setsockopt(struct sock *sk, int pf, int optval,
254 char __user *opt, int len);
255int compat_nf_getsockopt(struct sock *sk, int pf, int optval,
256 char __user *opt, int *len);
257
249/* Packet queuing */ 258/* Packet queuing */
250struct nf_queue_handler { 259struct nf_queue_handler {
251 int (*outfn)(struct sk_buff *skb, struct nf_info *info, 260 int (*outfn)(struct sk_buff *skb, struct nf_info *info,
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 934a2479f160..9f5b12cf489b 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -164,6 +164,7 @@ extern void nfattr_parse(struct nfattr *tb[], int maxattr,
164 __res; \ 164 __res; \
165}) 165})
166 166
167extern int nfnetlink_has_listeners(unsigned int group);
167extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, 168extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
168 int echo); 169 int echo);
169extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); 170extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index b04b03880595..a7497c7436df 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -47,6 +47,8 @@ enum nfulnl_attr_type {
47 NFULA_PAYLOAD, /* opaque data payload */ 47 NFULA_PAYLOAD, /* opaque data payload */
48 NFULA_PREFIX, /* string prefix */ 48 NFULA_PREFIX, /* string prefix */
49 NFULA_UID, /* user id of socket */ 49 NFULA_UID, /* user id of socket */
50 NFULA_SEQ, /* instance-local sequence number */
51 NFULA_SEQ_GLOBAL, /* global sequence number */
50 52
51 __NFULA_MAX 53 __NFULA_MAX
52}; 54};
@@ -77,6 +79,7 @@ enum nfulnl_attr_config {
77 NFULA_CFG_NLBUFSIZ, /* u_int32_t buffer size */ 79 NFULA_CFG_NLBUFSIZ, /* u_int32_t buffer size */
78 NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */ 80 NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */
79 NFULA_CFG_QTHRESH, /* u_int32_t */ 81 NFULA_CFG_QTHRESH, /* u_int32_t */
82 NFULA_CFG_FLAGS, /* u_int16_t */
80 __NFULA_CFG_MAX 83 __NFULA_CFG_MAX
81}; 84};
82#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1) 85#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
@@ -85,4 +88,7 @@ enum nfulnl_attr_config {
85#define NFULNL_COPY_META 0x01 88#define NFULNL_COPY_META 0x01
86#define NFULNL_COPY_PACKET 0x02 89#define NFULNL_COPY_PACKET 0x02
87 90
91#define NFULNL_CFG_F_SEQ 0x0001
92#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002
93
88#endif /* _NFNETLINK_LOG_H */ 94#endif /* _NFNETLINK_LOG_H */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 6500d4e59d46..1350e47b0234 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -4,6 +4,62 @@
4#define XT_FUNCTION_MAXNAMELEN 30 4#define XT_FUNCTION_MAXNAMELEN 30
5#define XT_TABLE_MAXNAMELEN 32 5#define XT_TABLE_MAXNAMELEN 32
6 6
7struct xt_entry_match
8{
9 union {
10 struct {
11 u_int16_t match_size;
12
13 /* Used by userspace */
14 char name[XT_FUNCTION_MAXNAMELEN-1];
15
16 u_int8_t revision;
17 } user;
18 struct {
19 u_int16_t match_size;
20
21 /* Used inside the kernel */
22 struct xt_match *match;
23 } kernel;
24
25 /* Total length */
26 u_int16_t match_size;
27 } u;
28
29 unsigned char data[0];
30};
31
32struct xt_entry_target
33{
34 union {
35 struct {
36 u_int16_t target_size;
37
38 /* Used by userspace */
39 char name[XT_FUNCTION_MAXNAMELEN-1];
40
41 u_int8_t revision;
42 } user;
43 struct {
44 u_int16_t target_size;
45
46 /* Used inside the kernel */
47 struct xt_target *target;
48 } kernel;
49
50 /* Total length */
51 u_int16_t target_size;
52 } u;
53
54 unsigned char data[0];
55};
56
57struct xt_standard_target
58{
59 struct xt_entry_target target;
60 int verdict;
61};
62
7/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision 63/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
8 * kernel supports, if >= revision. */ 64 * kernel supports, if >= revision. */
9struct xt_get_revision 65struct xt_get_revision
@@ -92,8 +148,6 @@ struct xt_match
92 148
93 const char name[XT_FUNCTION_MAXNAMELEN-1]; 149 const char name[XT_FUNCTION_MAXNAMELEN-1];
94 150
95 u_int8_t revision;
96
97 /* Return true or false: return FALSE and set *hotdrop = 1 to 151 /* Return true or false: return FALSE and set *hotdrop = 1 to
98 force immediate packet drop. */ 152 force immediate packet drop. */
99 /* Arguments changed since 2.6.9, as this must now handle 153 /* Arguments changed since 2.6.9, as this must now handle
@@ -102,6 +156,7 @@ struct xt_match
102 int (*match)(const struct sk_buff *skb, 156 int (*match)(const struct sk_buff *skb,
103 const struct net_device *in, 157 const struct net_device *in,
104 const struct net_device *out, 158 const struct net_device *out,
159 const struct xt_match *match,
105 const void *matchinfo, 160 const void *matchinfo,
106 int offset, 161 int offset,
107 unsigned int protoff, 162 unsigned int protoff,
@@ -111,15 +166,25 @@ struct xt_match
111 /* Should return true or false. */ 166 /* Should return true or false. */
112 int (*checkentry)(const char *tablename, 167 int (*checkentry)(const char *tablename,
113 const void *ip, 168 const void *ip,
169 const struct xt_match *match,
114 void *matchinfo, 170 void *matchinfo,
115 unsigned int matchinfosize, 171 unsigned int matchinfosize,
116 unsigned int hook_mask); 172 unsigned int hook_mask);
117 173
118 /* Called when entry of this type deleted. */ 174 /* Called when entry of this type deleted. */
119 void (*destroy)(void *matchinfo, unsigned int matchinfosize); 175 void (*destroy)(const struct xt_match *match, void *matchinfo,
176 unsigned int matchinfosize);
120 177
121 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 178 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
122 struct module *me; 179 struct module *me;
180
181 char *table;
182 unsigned int matchsize;
183 unsigned int hooks;
184 unsigned short proto;
185
186 unsigned short family;
187 u_int8_t revision;
123}; 188};
124 189
125/* Registration hooks for targets. */ 190/* Registration hooks for targets. */
@@ -129,8 +194,6 @@ struct xt_target
129 194
130 const char name[XT_FUNCTION_MAXNAMELEN-1]; 195 const char name[XT_FUNCTION_MAXNAMELEN-1];
131 196
132 u_int8_t revision;
133
134 /* Returns verdict. Argument order changed since 2.6.9, as this 197 /* Returns verdict. Argument order changed since 2.6.9, as this
135 must now handle non-linear skbs, using skb_copy_bits and 198 must now handle non-linear skbs, using skb_copy_bits and
136 skb_ip_make_writable. */ 199 skb_ip_make_writable. */
@@ -138,6 +201,7 @@ struct xt_target
138 const struct net_device *in, 201 const struct net_device *in,
139 const struct net_device *out, 202 const struct net_device *out,
140 unsigned int hooknum, 203 unsigned int hooknum,
204 const struct xt_target *target,
141 const void *targinfo, 205 const void *targinfo,
142 void *userdata); 206 void *userdata);
143 207
@@ -147,15 +211,25 @@ struct xt_target
147 /* Should return true or false. */ 211 /* Should return true or false. */
148 int (*checkentry)(const char *tablename, 212 int (*checkentry)(const char *tablename,
149 const void *entry, 213 const void *entry,
214 const struct xt_target *target,
150 void *targinfo, 215 void *targinfo,
151 unsigned int targinfosize, 216 unsigned int targinfosize,
152 unsigned int hook_mask); 217 unsigned int hook_mask);
153 218
154 /* Called when entry of this type deleted. */ 219 /* Called when entry of this type deleted. */
155 void (*destroy)(void *targinfo, unsigned int targinfosize); 220 void (*destroy)(const struct xt_target *target, void *targinfo,
221 unsigned int targinfosize);
156 222
157 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 223 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
158 struct module *me; 224 struct module *me;
225
226 char *table;
227 unsigned int targetsize;
228 unsigned int hooks;
229 unsigned short proto;
230
231 unsigned short family;
232 u_int8_t revision;
159}; 233};
160 234
161/* Furniture shopping... */ 235/* Furniture shopping... */
@@ -202,10 +276,17 @@ struct xt_table_info
202 char *entries[NR_CPUS]; 276 char *entries[NR_CPUS];
203}; 277};
204 278
205extern int xt_register_target(int af, struct xt_target *target); 279extern int xt_register_target(struct xt_target *target);
206extern void xt_unregister_target(int af, struct xt_target *target); 280extern void xt_unregister_target(struct xt_target *target);
207extern int xt_register_match(int af, struct xt_match *target); 281extern int xt_register_match(struct xt_match *target);
208extern void xt_unregister_match(int af, struct xt_match *target); 282extern void xt_unregister_match(struct xt_match *target);
283
284extern int xt_check_match(const struct xt_match *match, unsigned short family,
285 unsigned int size, const char *table, unsigned int hook,
286 unsigned short proto, int inv_proto);
287extern int xt_check_target(const struct xt_target *target, unsigned short family,
288 unsigned int size, const char *table, unsigned int hook,
289 unsigned short proto, int inv_proto);
209 290
210extern int xt_register_table(struct xt_table *table, 291extern int xt_register_table(struct xt_table *table,
211 struct xt_table_info *bootstrap, 292 struct xt_table_info *bootstrap,
diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h
new file mode 100644
index 000000000000..a8132ec076fb
--- /dev/null
+++ b/include/linux/netfilter/xt_policy.h
@@ -0,0 +1,58 @@
1#ifndef _XT_POLICY_H
2#define _XT_POLICY_H
3
4#define XT_POLICY_MAX_ELEM 4
5
6enum xt_policy_flags
7{
8 XT_POLICY_MATCH_IN = 0x1,
9 XT_POLICY_MATCH_OUT = 0x2,
10 XT_POLICY_MATCH_NONE = 0x4,
11 XT_POLICY_MATCH_STRICT = 0x8,
12};
13
14enum xt_policy_modes
15{
16 XT_POLICY_MODE_TRANSPORT,
17 XT_POLICY_MODE_TUNNEL
18};
19
20struct xt_policy_spec
21{
22 u_int8_t saddr:1,
23 daddr:1,
24 proto:1,
25 mode:1,
26 spi:1,
27 reqid:1;
28};
29
30union xt_policy_addr
31{
32 struct in_addr a4;
33 struct in6_addr a6;
34};
35
36struct xt_policy_elem
37{
38 union xt_policy_addr saddr;
39 union xt_policy_addr smask;
40 union xt_policy_addr daddr;
41 union xt_policy_addr dmask;
42 u_int32_t spi;
43 u_int32_t reqid;
44 u_int8_t proto;
45 u_int8_t mode;
46
47 struct xt_policy_spec match;
48 struct xt_policy_spec invert;
49};
50
51struct xt_policy_info
52{
53 struct xt_policy_elem pol[XT_POLICY_MAX_ELEM];
54 u_int16_t flags;
55 u_int16_t len;
56};
57
58#endif /* _XT_POLICY_H */
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index fd21796e5131..62cc27daca4e 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -65,35 +65,8 @@ struct arpt_arp {
65 u_int16_t invflags; 65 u_int16_t invflags;
66}; 66};
67 67
68struct arpt_entry_target 68#define arpt_entry_target xt_entry_target
69{ 69#define arpt_standard_target xt_standard_target
70 union {
71 struct {
72 u_int16_t target_size;
73
74 /* Used by userspace */
75 char name[ARPT_FUNCTION_MAXNAMELEN-1];
76 u_int8_t revision;
77 } user;
78 struct {
79 u_int16_t target_size;
80
81 /* Used inside the kernel */
82 struct arpt_target *target;
83 } kernel;
84
85 /* Total length */
86 u_int16_t target_size;
87 } u;
88
89 unsigned char data[0];
90};
91
92struct arpt_standard_target
93{
94 struct arpt_entry_target target;
95 int verdict;
96};
97 70
98/* Values for "flag" field in struct arpt_ip (general arp structure). 71/* Values for "flag" field in struct arpt_ip (general arp structure).
99 * No flags defined yet. 72 * No flags defined yet.
@@ -263,8 +236,10 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e
263 */ 236 */
264#ifdef __KERNEL__ 237#ifdef __KERNEL__
265 238
266#define arpt_register_target(tgt) xt_register_target(NF_ARP, tgt) 239#define arpt_register_target(tgt) \
267#define arpt_unregister_target(tgt) xt_unregister_target(NF_ARP, tgt) 240({ (tgt)->family = NF_ARP; \
241 xt_register_target(tgt); })
242#define arpt_unregister_target(tgt) xt_unregister_target(tgt)
268 243
269extern int arpt_register_table(struct arpt_table *table, 244extern int arpt_register_table(struct arpt_table *table,
270 const struct arpt_replace *repl); 245 const struct arpt_replace *repl);
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index de4d397865ce..a75b84bb9a88 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -47,22 +47,6 @@ enum nf_br_hook_priorities {
47#define BRNF_BRIDGED 0x08 47#define BRNF_BRIDGED 0x08
48#define BRNF_NF_BRIDGE_PREROUTING 0x10 48#define BRNF_NF_BRIDGE_PREROUTING 0x10
49 49
50static inline
51struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb)
52{
53 struct nf_bridge_info **nf_bridge = &(skb->nf_bridge);
54
55 if ((*nf_bridge = kmalloc(sizeof(**nf_bridge), GFP_ATOMIC)) != NULL) {
56 atomic_set(&(*nf_bridge)->use, 1);
57 (*nf_bridge)->mask = 0;
58 (*nf_bridge)->physindev = (*nf_bridge)->physoutdev = NULL;
59#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
60 (*nf_bridge)->netoutdev = NULL;
61#endif
62 }
63
64 return *nf_bridge;
65}
66 50
67/* Only used in br_forward.c */ 51/* Only used in br_forward.c */
68static inline 52static inline
@@ -77,17 +61,6 @@ void nf_bridge_maybe_copy_header(struct sk_buff *skb)
77 } 61 }
78} 62}
79 63
80static inline
81void nf_bridge_save_header(struct sk_buff *skb)
82{
83 int header_size = 16;
84
85 if (skb->protocol == __constant_htons(ETH_P_8021Q))
86 header_size = 18;
87
88 memcpy(skb->nf_bridge->data, skb->data - header_size, header_size);
89}
90
91/* This is called by the IP fragmenting code and it ensures there is 64/* This is called by the IP fragmenting code and it ensures there is
92 * enough room for the encapsulating header (if there is one). */ 65 * enough room for the encapsulating header (if there is one). */
93static inline 66static inline
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index 215765f043e6..d54d7b278e96 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -29,6 +29,7 @@ union ip_conntrack_expect_proto {
29}; 29};
30 30
31/* Add protocol helper include file here */ 31/* Add protocol helper include file here */
32#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
32#include <linux/netfilter_ipv4/ip_conntrack_pptp.h> 33#include <linux/netfilter_ipv4/ip_conntrack_pptp.h>
33#include <linux/netfilter_ipv4/ip_conntrack_amanda.h> 34#include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
34#include <linux/netfilter_ipv4/ip_conntrack_ftp.h> 35#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
@@ -37,6 +38,7 @@ union ip_conntrack_expect_proto {
37/* per conntrack: application helper private data */ 38/* per conntrack: application helper private data */
38union ip_conntrack_help { 39union ip_conntrack_help {
39 /* insert conntrack helper private data (master) here */ 40 /* insert conntrack helper private data (master) here */
41 struct ip_ct_h323_master ct_h323_info;
40 struct ip_ct_pptp_master ct_pptp_info; 42 struct ip_ct_pptp_master ct_pptp_info;
41 struct ip_ct_ftp_master ct_ftp_info; 43 struct ip_ct_ftp_master ct_ftp_info;
42 struct ip_ct_irc_master ct_irc_info; 44 struct ip_ct_irc_master ct_irc_info;
@@ -306,29 +308,30 @@ DECLARE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache);
306 308
307#define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x) 309#define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x)
308 310
309extern struct notifier_block *ip_conntrack_chain; 311extern struct atomic_notifier_head ip_conntrack_chain;
310extern struct notifier_block *ip_conntrack_expect_chain; 312extern struct atomic_notifier_head ip_conntrack_expect_chain;
311 313
312static inline int ip_conntrack_register_notifier(struct notifier_block *nb) 314static inline int ip_conntrack_register_notifier(struct notifier_block *nb)
313{ 315{
314 return notifier_chain_register(&ip_conntrack_chain, nb); 316 return atomic_notifier_chain_register(&ip_conntrack_chain, nb);
315} 317}
316 318
317static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb) 319static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb)
318{ 320{
319 return notifier_chain_unregister(&ip_conntrack_chain, nb); 321 return atomic_notifier_chain_unregister(&ip_conntrack_chain, nb);
320} 322}
321 323
322static inline int 324static inline int
323ip_conntrack_expect_register_notifier(struct notifier_block *nb) 325ip_conntrack_expect_register_notifier(struct notifier_block *nb)
324{ 326{
325 return notifier_chain_register(&ip_conntrack_expect_chain, nb); 327 return atomic_notifier_chain_register(&ip_conntrack_expect_chain, nb);
326} 328}
327 329
328static inline int 330static inline int
329ip_conntrack_expect_unregister_notifier(struct notifier_block *nb) 331ip_conntrack_expect_unregister_notifier(struct notifier_block *nb)
330{ 332{
331 return notifier_chain_unregister(&ip_conntrack_expect_chain, nb); 333 return atomic_notifier_chain_unregister(&ip_conntrack_expect_chain,
334 nb);
332} 335}
333 336
334extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct); 337extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct);
@@ -353,14 +356,14 @@ static inline void ip_conntrack_event(enum ip_conntrack_events event,
353 struct ip_conntrack *ct) 356 struct ip_conntrack *ct)
354{ 357{
355 if (is_confirmed(ct) && !is_dying(ct)) 358 if (is_confirmed(ct) && !is_dying(ct))
356 notifier_call_chain(&ip_conntrack_chain, event, ct); 359 atomic_notifier_call_chain(&ip_conntrack_chain, event, ct);
357} 360}
358 361
359static inline void 362static inline void
360ip_conntrack_expect_event(enum ip_conntrack_expect_events event, 363ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
361 struct ip_conntrack_expect *exp) 364 struct ip_conntrack_expect *exp)
362{ 365{
363 notifier_call_chain(&ip_conntrack_expect_chain, event, exp); 366 atomic_notifier_call_chain(&ip_conntrack_expect_chain, event, exp);
364} 367}
365#else /* CONFIG_IP_NF_CONNTRACK_EVENTS */ 368#else /* CONFIG_IP_NF_CONNTRACK_EVENTS */
366static inline void ip_conntrack_event_cache(enum ip_conntrack_events event, 369static inline void ip_conntrack_event_cache(enum ip_conntrack_events event,
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
new file mode 100644
index 000000000000..0987cea53840
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
@@ -0,0 +1,30 @@
1#ifndef _IP_CONNTRACK_H323_H
2#define _IP_CONNTRACK_H323_H
3
4#ifdef __KERNEL__
5
6#define RAS_PORT 1719
7#define Q931_PORT 1720
8#define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */
9
10/* This structure exists only once per master */
11struct ip_ct_h323_master {
12
13 /* Original and NATed Q.931 or H.245 signal ports */
14 u_int16_t sig_port[IP_CT_DIR_MAX];
15
16 /* Original and NATed RTP ports */
17 u_int16_t rtp_port[H323_RTP_CHANNEL_MAX][IP_CT_DIR_MAX];
18
19 union {
20 /* RAS connection timeout */
21 u_int32_t timeout;
22
23 /* Next TPKT length (for separate TPKT header and data) */
24 u_int16_t tpkt_len[IP_CT_DIR_MAX];
25 };
26};
27
28#endif
29
30#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
index 41a107de17cf..e9f5ed1d9f68 100644
--- a/include/linux/netfilter_ipv4/ip_nat.h
+++ b/include/linux/netfilter_ipv4/ip_nat.h
@@ -23,7 +23,7 @@ struct ip_nat_seq {
23 * modification (if any) */ 23 * modification (if any) */
24 u_int32_t correction_pos; 24 u_int32_t correction_pos;
25 /* sequence number offset before and after last modification */ 25 /* sequence number offset before and after last modification */
26 int32_t offset_before, offset_after; 26 int16_t offset_before, offset_after;
27}; 27};
28 28
29/* Single range specification. */ 29/* Single range specification. */
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 76ba24b68515..d5b8c0d6a12b 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -52,61 +52,9 @@ struct ipt_ip {
52 u_int8_t invflags; 52 u_int8_t invflags;
53}; 53};
54 54
55struct ipt_entry_match 55#define ipt_entry_match xt_entry_match
56{ 56#define ipt_entry_target xt_entry_target
57 union { 57#define ipt_standard_target xt_standard_target
58 struct {
59 u_int16_t match_size;
60
61 /* Used by userspace */
62 char name[IPT_FUNCTION_MAXNAMELEN-1];
63
64 u_int8_t revision;
65 } user;
66 struct {
67 u_int16_t match_size;
68
69 /* Used inside the kernel */
70 struct ipt_match *match;
71 } kernel;
72
73 /* Total length */
74 u_int16_t match_size;
75 } u;
76
77 unsigned char data[0];
78};
79
80struct ipt_entry_target
81{
82 union {
83 struct {
84 u_int16_t target_size;
85
86 /* Used by userspace */
87 char name[IPT_FUNCTION_MAXNAMELEN-1];
88
89 u_int8_t revision;
90 } user;
91 struct {
92 u_int16_t target_size;
93
94 /* Used inside the kernel */
95 struct ipt_target *target;
96 } kernel;
97
98 /* Total length */
99 u_int16_t target_size;
100 } u;
101
102 unsigned char data[0];
103};
104
105struct ipt_standard_target
106{
107 struct ipt_entry_target target;
108 int verdict;
109};
110 58
111#define ipt_counters xt_counters 59#define ipt_counters xt_counters
112 60
@@ -321,11 +269,15 @@ ipt_get_target(struct ipt_entry *e)
321#include <linux/init.h> 269#include <linux/init.h>
322extern void ipt_init(void) __init; 270extern void ipt_init(void) __init;
323 271
324#define ipt_register_target(tgt) xt_register_target(AF_INET, tgt) 272#define ipt_register_target(tgt) \
325#define ipt_unregister_target(tgt) xt_unregister_target(AF_INET, tgt) 273({ (tgt)->family = AF_INET; \
274 xt_register_target(tgt); })
275#define ipt_unregister_target(tgt) xt_unregister_target(tgt)
326 276
327#define ipt_register_match(mtch) xt_register_match(AF_INET, mtch) 277#define ipt_register_match(mtch) \
328#define ipt_unregister_match(mtch) xt_unregister_match(AF_INET, mtch) 278({ (mtch)->family = AF_INET; \
279 xt_register_match(mtch); })
280#define ipt_unregister_match(mtch) xt_unregister_match(mtch)
329 281
330//#define ipt_register_table(tbl, repl) xt_register_table(AF_INET, tbl, repl) 282//#define ipt_register_table(tbl, repl) xt_register_table(AF_INET, tbl, repl)
331//#define ipt_unregister_table(tbl) xt_unregister_table(AF_INET, tbl) 283//#define ipt_unregister_table(tbl) xt_unregister_table(AF_INET, tbl)
diff --git a/include/linux/netfilter_ipv4/ipt_policy.h b/include/linux/netfilter_ipv4/ipt_policy.h
index a3f6eff39d33..b9478a255301 100644
--- a/include/linux/netfilter_ipv4/ipt_policy.h
+++ b/include/linux/netfilter_ipv4/ipt_policy.h
@@ -1,58 +1,21 @@
1#ifndef _IPT_POLICY_H 1#ifndef _IPT_POLICY_H
2#define _IPT_POLICY_H 2#define _IPT_POLICY_H
3 3
4#define IPT_POLICY_MAX_ELEM 4 4#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 5
6enum ipt_policy_flags 6/* ipt_policy_flags */
7{ 7#define IPT_POLICY_MATCH_IN XT_POLICY_MATCH_IN
8 IPT_POLICY_MATCH_IN = 0x1, 8#define IPT_POLICY_MATCH_OUT XT_POLICY_MATCH_OUT
9 IPT_POLICY_MATCH_OUT = 0x2, 9#define IPT_POLICY_MATCH_NONE XT_POLICY_MATCH_NONE
10 IPT_POLICY_MATCH_NONE = 0x4, 10#define IPT_POLICY_MATCH_STRICT XT_POLICY_MATCH_STRICT
11 IPT_POLICY_MATCH_STRICT = 0x8, 11
12}; 12/* ipt_policy_modes */
13 13#define IPT_POLICY_MODE_TRANSPORT XT_POLICY_MODE_TRANSPORT
14enum ipt_policy_modes 14#define IPT_POLICY_MODE_TUNNEL XT_POLICY_MODE_TUNNEL
15{ 15
16 IPT_POLICY_MODE_TRANSPORT, 16#define ipt_policy_spec xt_policy_spec
17 IPT_POLICY_MODE_TUNNEL 17#define ipt_policy_addr xt_policy_addr
18}; 18#define ipt_policy_elem xt_policy_elem
19 19#define ipt_policy_info xt_policy_info
20struct ipt_policy_spec
21{
22 u_int8_t saddr:1,
23 daddr:1,
24 proto:1,
25 mode:1,
26 spi:1,
27 reqid:1;
28};
29
30union ipt_policy_addr
31{
32 struct in_addr a4;
33 struct in6_addr a6;
34};
35
36struct ipt_policy_elem
37{
38 union ipt_policy_addr saddr;
39 union ipt_policy_addr smask;
40 union ipt_policy_addr daddr;
41 union ipt_policy_addr dmask;
42 u_int32_t spi;
43 u_int32_t reqid;
44 u_int8_t proto;
45 u_int8_t mode;
46
47 struct ipt_policy_spec match;
48 struct ipt_policy_spec invert;
49};
50
51struct ipt_policy_info
52{
53 struct ipt_policy_elem pol[IPT_POLICY_MAX_ELEM];
54 u_int16_t flags;
55 u_int16_t len;
56};
57 20
58#endif /* _IPT_POLICY_H */ 21#endif /* _IPT_POLICY_H */
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index f249b574f0fa..d0d5d1ee4be3 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -56,60 +56,9 @@ struct ip6t_ip6 {
56 u_int8_t invflags; 56 u_int8_t invflags;
57}; 57};
58 58
59/* FIXME: If alignment in kernel different from userspace? --RR */ 59#define ip6t_entry_match xt_entry_match
60struct ip6t_entry_match 60#define ip6t_entry_target xt_entry_target
61{ 61#define ip6t_standard_target xt_standard_target
62 union {
63 struct {
64 u_int16_t match_size;
65
66 /* Used by userspace */
67 char name[IP6T_FUNCTION_MAXNAMELEN-1];
68 u_int8_t revision;
69 } user;
70 struct {
71 u_int16_t match_size;
72
73 /* Used inside the kernel */
74 struct ip6t_match *match;
75 } kernel;
76
77 /* Total length */
78 u_int16_t match_size;
79 } u;
80
81 unsigned char data[0];
82};
83
84struct ip6t_entry_target
85{
86 union {
87 struct {
88 u_int16_t target_size;
89
90 /* Used by userspace */
91 char name[IP6T_FUNCTION_MAXNAMELEN-1];
92 u_int8_t revision;
93 } user;
94 struct {
95 u_int16_t target_size;
96
97 /* Used inside the kernel */
98 struct ip6t_target *target;
99 } kernel;
100
101 /* Total length */
102 u_int16_t target_size;
103 } u;
104
105 unsigned char data[0];
106};
107
108struct ip6t_standard_target
109{
110 struct ip6t_entry_target target;
111 int verdict;
112};
113 62
114#define ip6t_counters xt_counters 63#define ip6t_counters xt_counters
115 64
@@ -334,11 +283,15 @@ ip6t_get_target(struct ip6t_entry *e)
334#include <linux/init.h> 283#include <linux/init.h>
335extern void ip6t_init(void) __init; 284extern void ip6t_init(void) __init;
336 285
337#define ip6t_register_target(tgt) xt_register_target(AF_INET6, tgt) 286#define ip6t_register_target(tgt) \
338#define ip6t_unregister_target(tgt) xt_unregister_target(AF_INET6, tgt) 287({ (tgt)->family = AF_INET6; \
288 xt_register_target(tgt); })
289#define ip6t_unregister_target(tgt) xt_unregister_target(tgt)
339 290
340#define ip6t_register_match(match) xt_register_match(AF_INET6, match) 291#define ip6t_register_match(match) \
341#define ip6t_unregister_match(match) xt_unregister_match(AF_INET6, match) 292({ (match)->family = AF_INET6; \
293 xt_register_match(match); })
294#define ip6t_unregister_match(match) xt_unregister_match(match)
342 295
343extern int ip6t_register_table(struct ip6t_table *table, 296extern int ip6t_register_table(struct ip6t_table *table,
344 const struct ip6t_replace *repl); 297 const struct ip6t_replace *repl);
diff --git a/include/linux/netfilter_ipv6/ip6t_policy.h b/include/linux/netfilter_ipv6/ip6t_policy.h
index 671bd818300f..6bab3163d2fb 100644
--- a/include/linux/netfilter_ipv6/ip6t_policy.h
+++ b/include/linux/netfilter_ipv6/ip6t_policy.h
@@ -1,58 +1,21 @@
1#ifndef _IP6T_POLICY_H 1#ifndef _IP6T_POLICY_H
2#define _IP6T_POLICY_H 2#define _IP6T_POLICY_H
3 3
4#define IP6T_POLICY_MAX_ELEM 4 4#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 5
6enum ip6t_policy_flags 6/* ip6t_policy_flags */
7{ 7#define IP6T_POLICY_MATCH_IN XT_POLICY_MATCH_IN
8 IP6T_POLICY_MATCH_IN = 0x1, 8#define IP6T_POLICY_MATCH_OUT XT_POLICY_MATCH_OUT
9 IP6T_POLICY_MATCH_OUT = 0x2, 9#define IP6T_POLICY_MATCH_NONE XT_POLICY_MATCH_NONE
10 IP6T_POLICY_MATCH_NONE = 0x4, 10#define IP6T_POLICY_MATCH_STRICT XT_POLICY_MATCH_STRICT
11 IP6T_POLICY_MATCH_STRICT = 0x8, 11
12}; 12/* ip6t_policy_modes */
13 13#define IP6T_POLICY_MODE_TRANSPORT XT_POLICY_MODE_TRANSPORT
14enum ip6t_policy_modes 14#define IP6T_POLICY_MODE_TUNNEL XT_POLICY_MODE_TUNNEL
15{ 15
16 IP6T_POLICY_MODE_TRANSPORT, 16#define ip6t_policy_spec xt_policy_spec
17 IP6T_POLICY_MODE_TUNNEL 17#define ip6t_policy_addr xt_policy_addr
18}; 18#define ip6t_policy_elem xt_policy_elem
19 19#define ip6t_policy_info xt_policy_info
20struct ip6t_policy_spec
21{
22 u_int8_t saddr:1,
23 daddr:1,
24 proto:1,
25 mode:1,
26 spi:1,
27 reqid:1;
28};
29
30union ip6t_policy_addr
31{
32 struct in_addr a4;
33 struct in6_addr a6;
34};
35
36struct ip6t_policy_elem
37{
38 union ip6t_policy_addr saddr;
39 union ip6t_policy_addr smask;
40 union ip6t_policy_addr daddr;
41 union ip6t_policy_addr dmask;
42 u_int32_t spi;
43 u_int32_t reqid;
44 u_int8_t proto;
45 u_int8_t mode;
46
47 struct ip6t_policy_spec match;
48 struct ip6t_policy_spec invert;
49};
50
51struct ip6t_policy_info
52{
53 struct ip6t_policy_elem pol[IP6T_POLICY_MAX_ELEM];
54 u_int16_t flags;
55 u_int16_t len;
56};
57 20
58#endif /* _IP6T_POLICY_H */ 21#endif /* _IP6T_POLICY_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index c256ebe2a7b4..f8f3d1c927f8 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -151,6 +151,7 @@ struct netlink_skb_parms
151 151
152extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module); 152extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module);
153extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 153extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
154extern int netlink_has_listeners(struct sock *sk, unsigned int group);
154extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 155extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
155extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 156extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
156 __u32 group, gfp_t allocation); 157 __u32 group, gfp_t allocation);
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index b4dc6e2e10c9..c71227dd4389 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -56,9 +56,7 @@
56 * When flushing a cluster of dirty pages, there can be different 56 * When flushing a cluster of dirty pages, there can be different
57 * strategies: 57 * strategies:
58 */ 58 */
59#define FLUSH_AGING 0 /* only flush old buffers */
60#define FLUSH_SYNC 1 /* file being synced, or contention */ 59#define FLUSH_SYNC 1 /* file being synced, or contention */
61#define FLUSH_WAIT 2 /* wait for completion */
62#define FLUSH_STABLE 4 /* commit to stable storage */ 60#define FLUSH_STABLE 4 /* commit to stable storage */
63#define FLUSH_LOWPRI 8 /* low priority background flush */ 61#define FLUSH_LOWPRI 8 /* low priority background flush */
64#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 62#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
@@ -78,6 +76,7 @@ struct nfs_access_entry {
78struct nfs4_state; 76struct nfs4_state;
79struct nfs_open_context { 77struct nfs_open_context {
80 atomic_t count; 78 atomic_t count;
79 struct vfsmount *vfsmnt;
81 struct dentry *dentry; 80 struct dentry *dentry;
82 struct rpc_cred *cred; 81 struct rpc_cred *cred;
83 struct nfs4_state *state; 82 struct nfs4_state *state;
@@ -118,8 +117,7 @@ struct nfs_inode {
118 unsigned long cache_validity; /* bit mask */ 117 unsigned long cache_validity; /* bit mask */
119 118
120 /* 119 /*
121 * read_cache_jiffies is when we started read-caching this inode, 120 * read_cache_jiffies is when we started read-caching this inode.
122 * and read_cache_mtime is the mtime of the inode at that time.
123 * attrtimeo is for how long the cached information is assumed 121 * attrtimeo is for how long the cached information is assumed
124 * to be valid. A successful attribute revalidation doubles 122 * to be valid. A successful attribute revalidation doubles
125 * attrtimeo (up to acregmax/acdirmax), a failure resets it to 123 * attrtimeo (up to acregmax/acdirmax), a failure resets it to
@@ -128,11 +126,6 @@ struct nfs_inode {
128 * We need to revalidate the cached attrs for this inode if 126 * We need to revalidate the cached attrs for this inode if
129 * 127 *
130 * jiffies - read_cache_jiffies > attrtimeo 128 * jiffies - read_cache_jiffies > attrtimeo
131 *
132 * and invalidate any cached data/flush out any dirty pages if
133 * we find that
134 *
135 * mtime != read_cache_mtime
136 */ 129 */
137 unsigned long read_cache_jiffies; 130 unsigned long read_cache_jiffies;
138 unsigned long attrtimeo; 131 unsigned long attrtimeo;
@@ -311,12 +304,9 @@ extern void nfs_begin_attr_update(struct inode *);
311extern void nfs_end_attr_update(struct inode *); 304extern void nfs_end_attr_update(struct inode *);
312extern void nfs_begin_data_update(struct inode *); 305extern void nfs_begin_data_update(struct inode *);
313extern void nfs_end_data_update(struct inode *); 306extern void nfs_end_data_update(struct inode *);
314extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred);
315extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 307extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
316extern void put_nfs_open_context(struct nfs_open_context *ctx); 308extern void put_nfs_open_context(struct nfs_open_context *ctx);
317extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
318extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 309extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
319extern void nfs_file_clear_open_context(struct file *filp);
320 310
321/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 311/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
322extern u32 root_nfs_parse_addr(char *name); /*__init*/ 312extern u32 root_nfs_parse_addr(char *name); /*__init*/
@@ -334,7 +324,7 @@ extern struct inode_operations nfs_file_inode_operations;
334#ifdef CONFIG_NFS_V3 324#ifdef CONFIG_NFS_V3
335extern struct inode_operations nfs3_file_inode_operations; 325extern struct inode_operations nfs3_file_inode_operations;
336#endif /* CONFIG_NFS_V3 */ 326#endif /* CONFIG_NFS_V3 */
337extern struct file_operations nfs_file_operations; 327extern const struct file_operations nfs_file_operations;
338extern struct address_space_operations nfs_file_aops; 328extern struct address_space_operations nfs_file_aops;
339 329
340static inline struct rpc_cred *nfs_file_cred(struct file *file) 330static inline struct rpc_cred *nfs_file_cred(struct file *file)
@@ -381,7 +371,7 @@ extern struct inode_operations nfs_dir_inode_operations;
381#ifdef CONFIG_NFS_V3 371#ifdef CONFIG_NFS_V3
382extern struct inode_operations nfs3_dir_inode_operations; 372extern struct inode_operations nfs3_dir_inode_operations;
383#endif /* CONFIG_NFS_V3 */ 373#endif /* CONFIG_NFS_V3 */
384extern struct file_operations nfs_dir_operations; 374extern const struct file_operations nfs_dir_operations;
385extern struct dentry_operations nfs_dentry_operations; 375extern struct dentry_operations nfs_dentry_operations;
386 376
387extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 377extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);
@@ -415,21 +405,22 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
415extern int nfs_writepages(struct address_space *, struct writeback_control *); 405extern int nfs_writepages(struct address_space *, struct writeback_control *);
416extern int nfs_flush_incompatible(struct file *file, struct page *page); 406extern int nfs_flush_incompatible(struct file *file, struct page *page);
417extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 407extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
418extern void nfs_writeback_done(struct rpc_task *task, void *data); 408extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
419extern void nfs_writedata_release(void *data); 409extern void nfs_writedata_release(void *);
420 410
421#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 411#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
422extern void nfs_commit_done(struct rpc_task *, void *data); 412struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount);
423extern void nfs_commit_release(void *data); 413void nfs_commit_free(struct nfs_write_data *p);
424#endif 414#endif
425 415
426/* 416/*
427 * Try to write back everything synchronously (but check the 417 * Try to write back everything synchronously (but check the
428 * return value!) 418 * return value!)
429 */ 419 */
430extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int); 420extern int nfs_sync_inode_wait(struct inode *, unsigned long, unsigned int, int);
431#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 421#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
432extern int nfs_commit_inode(struct inode *, int); 422extern int nfs_commit_inode(struct inode *, int);
423extern void nfs_commit_release(void *wdata);
433#else 424#else
434static inline int 425static inline int
435nfs_commit_inode(struct inode *inode, int how) 426nfs_commit_inode(struct inode *inode, int how)
@@ -447,7 +438,7 @@ nfs_have_writebacks(struct inode *inode)
447static inline int 438static inline int
448nfs_wb_all(struct inode *inode) 439nfs_wb_all(struct inode *inode)
449{ 440{
450 int error = nfs_sync_inode(inode, 0, 0, FLUSH_WAIT); 441 int error = nfs_sync_inode_wait(inode, 0, 0, 0);
451 return (error < 0) ? error : 0; 442 return (error < 0) ? error : 0;
452} 443}
453 444
@@ -456,8 +447,8 @@ nfs_wb_all(struct inode *inode)
456 */ 447 */
457static inline int nfs_wb_page_priority(struct inode *inode, struct page* page, int how) 448static inline int nfs_wb_page_priority(struct inode *inode, struct page* page, int how)
458{ 449{
459 int error = nfs_sync_inode(inode, page->index, 1, 450 int error = nfs_sync_inode_wait(inode, page->index, 1,
460 how | FLUSH_WAIT | FLUSH_STABLE); 451 how | FLUSH_STABLE);
461 return (error < 0) ? error : 0; 452 return (error < 0) ? error : 0;
462} 453}
463 454
@@ -469,37 +460,8 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page)
469/* 460/*
470 * Allocate and free nfs_write_data structures 461 * Allocate and free nfs_write_data structures
471 */ 462 */
472extern mempool_t *nfs_wdata_mempool; 463extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount);
473 464extern void nfs_writedata_free(struct nfs_write_data *p);
474static inline struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount)
475{
476 struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS);
477
478 if (p) {
479 memset(p, 0, sizeof(*p));
480 INIT_LIST_HEAD(&p->pages);
481 if (pagecount < NFS_PAGEVEC_SIZE)
482 p->pagevec = &p->page_array[0];
483 else {
484 size_t size = ++pagecount * sizeof(struct page *);
485 p->pagevec = kmalloc(size, GFP_NOFS);
486 if (p->pagevec) {
487 memset(p->pagevec, 0, size);
488 } else {
489 mempool_free(p, nfs_wdata_mempool);
490 p = NULL;
491 }
492 }
493 }
494 return p;
495}
496
497static inline void nfs_writedata_free(struct nfs_write_data *p)
498{
499 if (p && (p->pagevec != &p->page_array[0]))
500 kfree(p->pagevec);
501 mempool_free(p, nfs_wdata_mempool);
502}
503 465
504/* 466/*
505 * linux/fs/nfs/read.c 467 * linux/fs/nfs/read.c
@@ -507,44 +469,14 @@ static inline void nfs_writedata_free(struct nfs_write_data *p)
507extern int nfs_readpage(struct file *, struct page *); 469extern int nfs_readpage(struct file *, struct page *);
508extern int nfs_readpages(struct file *, struct address_space *, 470extern int nfs_readpages(struct file *, struct address_space *,
509 struct list_head *, unsigned); 471 struct list_head *, unsigned);
510extern void nfs_readpage_result(struct rpc_task *, void *); 472extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
511extern void nfs_readdata_release(void *data); 473extern void nfs_readdata_release(void *data);
512
513 474
514/* 475/*
515 * Allocate and free nfs_read_data structures 476 * Allocate and free nfs_read_data structures
516 */ 477 */
517extern mempool_t *nfs_rdata_mempool; 478extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount);
518 479extern void nfs_readdata_free(struct nfs_read_data *p);
519static inline struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
520{
521 struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS);
522
523 if (p) {
524 memset(p, 0, sizeof(*p));
525 INIT_LIST_HEAD(&p->pages);
526 if (pagecount < NFS_PAGEVEC_SIZE)
527 p->pagevec = &p->page_array[0];
528 else {
529 size_t size = ++pagecount * sizeof(struct page *);
530 p->pagevec = kmalloc(size, GFP_NOFS);
531 if (p->pagevec) {
532 memset(p->pagevec, 0, size);
533 } else {
534 mempool_free(p, nfs_rdata_mempool);
535 p = NULL;
536 }
537 }
538 }
539 return p;
540}
541
542static inline void nfs_readdata_free(struct nfs_read_data *p)
543{
544 if (p && (p->pagevec != &p->page_array[0]))
545 kfree(p->pagevec);
546 mempool_free(p, nfs_rdata_mempool);
547}
548 480
549/* 481/*
550 * linux/fs/nfs3proc.c 482 * linux/fs/nfs3proc.c
diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h
index e2c18dabff86..861730275ba0 100644
--- a/include/linux/nfs_fs_i.h
+++ b/include/linux/nfs_fs_i.h
@@ -12,8 +12,8 @@ struct nlm_lockowner;
12 */ 12 */
13struct nfs_lock_info { 13struct nfs_lock_info {
14 u32 state; 14 u32 state;
15 u32 flags;
16 struct nlm_lockowner *owner; 15 struct nlm_lockowner *owner;
16 struct list_head list;
17}; 17};
18 18
19struct nfs4_lock_state; 19struct nfs4_lock_state;
@@ -21,10 +21,4 @@ struct nfs4_lock_info {
21 struct nfs4_lock_state *owner; 21 struct nfs4_lock_state *owner;
22}; 22};
23 23
24/*
25 * Lock flag values
26 */
27#define NFS_LCK_GRANTED 0x0001 /* lock has been granted */
28#define NFS_LCK_RECLAIM 0x0002 /* lock marked for reclaiming */
29
30#endif 24#endif
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 3d3a305488cf..65dec21af774 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -4,6 +4,8 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/backing-dev.h> 5#include <linux/backing-dev.h>
6 6
7struct nfs_iostats;
8
7/* 9/*
8 * NFS client parameters stored in the superblock. 10 * NFS client parameters stored in the superblock.
9 */ 11 */
@@ -12,6 +14,7 @@ struct nfs_server {
12 struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */ 14 struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */
13 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 15 struct rpc_clnt * client_acl; /* ACL RPC client handle */
14 struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */ 16 struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */
17 struct nfs_iostats * io_stats; /* I/O statistics */
15 struct backing_dev_info backing_dev_info; 18 struct backing_dev_info backing_dev_info;
16 int flags; /* various flags */ 19 int flags; /* various flags */
17 unsigned int caps; /* server capabilities */ 20 unsigned int caps; /* server capabilities */
@@ -26,10 +29,13 @@ struct nfs_server {
26 unsigned int acregmax; 29 unsigned int acregmax;
27 unsigned int acdirmin; 30 unsigned int acdirmin;
28 unsigned int acdirmax; 31 unsigned int acdirmax;
32 unsigned long retrans_timeo; /* retransmit timeout */
33 unsigned int retrans_count; /* number of retransmit tries */
29 unsigned int namelen; 34 unsigned int namelen;
30 char * hostname; /* remote hostname */ 35 char * hostname; /* remote hostname */
31 struct nfs_fh fh; 36 struct nfs_fh fh;
32 struct sockaddr_in addr; 37 struct sockaddr_in addr;
38 unsigned long mount_time; /* when this fs was mounted */
33#ifdef CONFIG_NFS_V4 39#ifdef CONFIG_NFS_V4
34 /* Our own IP address, as a null-terminated string. 40 /* Our own IP address, as a null-terminated string.
35 * This is used to generate the clientid, and the callback address. 41 * This is used to generate the clientid, and the callback address.
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 6d6f69ec5675..7fafc4c546b7 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -695,7 +695,6 @@ struct nfs_read_data {
695#ifdef CONFIG_NFS_V4 695#ifdef CONFIG_NFS_V4
696 unsigned long timestamp; /* For lease renewal */ 696 unsigned long timestamp; /* For lease renewal */
697#endif 697#endif
698 void (*complete) (struct nfs_read_data *, int);
699 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 698 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
700}; 699};
701 700
@@ -714,7 +713,6 @@ struct nfs_write_data {
714#ifdef CONFIG_NFS_V4 713#ifdef CONFIG_NFS_V4
715 unsigned long timestamp; /* For lease renewal */ 714 unsigned long timestamp; /* For lease renewal */
716#endif 715#endif
717 void (*complete) (struct nfs_write_data *, int);
718 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 716 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
719}; 717};
720 718
@@ -769,8 +767,11 @@ struct nfs_rpc_ops {
769 struct nfs_pathconf *); 767 struct nfs_pathconf *);
770 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); 768 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
771 void (*read_setup) (struct nfs_read_data *); 769 void (*read_setup) (struct nfs_read_data *);
770 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
772 void (*write_setup) (struct nfs_write_data *, int how); 771 void (*write_setup) (struct nfs_write_data *, int how);
772 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
773 void (*commit_setup) (struct nfs_write_data *, int how); 773 void (*commit_setup) (struct nfs_write_data *, int how);
774 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
774 int (*file_open) (struct inode *, struct file *); 775 int (*file_open) (struct inode *, struct file *);
775 int (*file_release) (struct inode *, struct file *); 776 int (*file_release) (struct inode *, struct file *);
776 int (*lock)(struct file *, int, struct file_lock *); 777 int (*lock)(struct file *, int, struct file_lock *);
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 6bad4766d3d9..d2a8abb5011a 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -67,7 +67,8 @@ struct svc_expkey {
67 int ek_fsidtype; 67 int ek_fsidtype;
68 u32 ek_fsid[3]; 68 u32 ek_fsid[3];
69 69
70 struct svc_export * ek_export; 70 struct vfsmount * ek_mnt;
71 struct dentry * ek_dentry;
71}; 72};
72 73
73#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) 74#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT))
@@ -85,9 +86,6 @@ void nfsd_export_shutdown(void);
85void nfsd_export_flush(void); 86void nfsd_export_flush(void);
86void exp_readlock(void); 87void exp_readlock(void);
87void exp_readunlock(void); 88void exp_readunlock(void);
88struct svc_expkey * exp_find_key(struct auth_domain *clp,
89 int fsid_type, u32 *fsidv,
90 struct cache_req *reqp);
91struct svc_export * exp_get_by_name(struct auth_domain *clp, 89struct svc_export * exp_get_by_name(struct auth_domain *clp,
92 struct vfsmount *mnt, 90 struct vfsmount *mnt,
93 struct dentry *dentry, 91 struct dentry *dentry,
@@ -101,35 +99,20 @@ int exp_rootfh(struct auth_domain *,
101int exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq); 99int exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq);
102int nfserrno(int errno); 100int nfserrno(int errno);
103 101
104extern void expkey_put(struct cache_head *item, struct cache_detail *cd); 102extern struct cache_detail svc_export_cache;
105extern void svc_export_put(struct cache_head *item, struct cache_detail *cd);
106extern struct cache_detail svc_export_cache, svc_expkey_cache;
107 103
108static inline void exp_put(struct svc_export *exp) 104static inline void exp_put(struct svc_export *exp)
109{ 105{
110 svc_export_put(&exp->h, &svc_export_cache); 106 cache_put(&exp->h, &svc_export_cache);
111} 107}
112 108
113static inline void exp_get(struct svc_export *exp) 109static inline void exp_get(struct svc_export *exp)
114{ 110{
115 cache_get(&exp->h); 111 cache_get(&exp->h);
116} 112}
117static inline struct svc_export * 113extern struct svc_export *
118exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv, 114exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv,
119 struct cache_req *reqp) 115 struct cache_req *reqp);
120{
121 struct svc_expkey *ek = exp_find_key(clp, fsid_type, fsidv, reqp);
122 if (ek && !IS_ERR(ek)) {
123 struct svc_export *exp = ek->ek_export;
124 int err;
125 exp_get(exp);
126 expkey_put(&ek->h, &svc_expkey_cache);
127 if ((err = cache_check(&svc_export_cache, &exp->h, reqp)))
128 exp = ERR_PTR(err);
129 return exp;
130 } else
131 return ERR_PTR(PTR_ERR(ek));
132}
133 116
134#endif /* __KERNEL__ */ 117#endif /* __KERNEL__ */
135 118
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index b959a4525cbd..1a9ef3e627d1 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -350,11 +350,15 @@ extern nodemask_t node_possible_map;
350#define num_possible_nodes() nodes_weight(node_possible_map) 350#define num_possible_nodes() nodes_weight(node_possible_map)
351#define node_online(node) node_isset((node), node_online_map) 351#define node_online(node) node_isset((node), node_online_map)
352#define node_possible(node) node_isset((node), node_possible_map) 352#define node_possible(node) node_isset((node), node_possible_map)
353#define first_online_node first_node(node_online_map)
354#define next_online_node(nid) next_node((nid), node_online_map)
353#else 355#else
354#define num_online_nodes() 1 356#define num_online_nodes() 1
355#define num_possible_nodes() 1 357#define num_possible_nodes() 1
356#define node_online(node) ((node) == 0) 358#define node_online(node) ((node) == 0)
357#define node_possible(node) ((node) == 0) 359#define node_possible(node) ((node) == 0)
360#define first_online_node 0
361#define next_online_node(nid) (MAX_NUMNODES)
358#endif 362#endif
359 363
360#define any_online_node(mask) \ 364#define any_online_node(mask) \
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 5937dd6053c3..51dbab9710c7 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -10,25 +10,107 @@
10#ifndef _LINUX_NOTIFIER_H 10#ifndef _LINUX_NOTIFIER_H
11#define _LINUX_NOTIFIER_H 11#define _LINUX_NOTIFIER_H
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/mutex.h>
14#include <linux/rwsem.h>
13 15
14struct notifier_block 16/*
15{ 17 * Notifier chains are of three types:
16 int (*notifier_call)(struct notifier_block *self, unsigned long, void *); 18 *
19 * Atomic notifier chains: Chain callbacks run in interrupt/atomic
20 * context. Callouts are not allowed to block.
21 * Blocking notifier chains: Chain callbacks run in process context.
22 * Callouts are allowed to block.
23 * Raw notifier chains: There are no restrictions on callbacks,
24 * registration, or unregistration. All locking and protection
25 * must be provided by the caller.
26 *
27 * atomic_notifier_chain_register() may be called from an atomic context,
28 * but blocking_notifier_chain_register() must be called from a process
29 * context. Ditto for the corresponding _unregister() routines.
30 *
31 * atomic_notifier_chain_unregister() and blocking_notifier_chain_unregister()
32 * _must not_ be called from within the call chain.
33 */
34
35struct notifier_block {
36 int (*notifier_call)(struct notifier_block *, unsigned long, void *);
17 struct notifier_block *next; 37 struct notifier_block *next;
18 int priority; 38 int priority;
19}; 39};
20 40
41struct atomic_notifier_head {
42 spinlock_t lock;
43 struct notifier_block *head;
44};
45
46struct blocking_notifier_head {
47 struct rw_semaphore rwsem;
48 struct notifier_block *head;
49};
50
51struct raw_notifier_head {
52 struct notifier_block *head;
53};
54
55#define ATOMIC_INIT_NOTIFIER_HEAD(name) do { \
56 spin_lock_init(&(name)->lock); \
57 (name)->head = NULL; \
58 } while (0)
59#define BLOCKING_INIT_NOTIFIER_HEAD(name) do { \
60 init_rwsem(&(name)->rwsem); \
61 (name)->head = NULL; \
62 } while (0)
63#define RAW_INIT_NOTIFIER_HEAD(name) do { \
64 (name)->head = NULL; \
65 } while (0)
66
67#define ATOMIC_NOTIFIER_INIT(name) { \
68 .lock = SPIN_LOCK_UNLOCKED, \
69 .head = NULL }
70#define BLOCKING_NOTIFIER_INIT(name) { \
71 .rwsem = __RWSEM_INITIALIZER((name).rwsem), \
72 .head = NULL }
73#define RAW_NOTIFIER_INIT(name) { \
74 .head = NULL }
75
76#define ATOMIC_NOTIFIER_HEAD(name) \
77 struct atomic_notifier_head name = \
78 ATOMIC_NOTIFIER_INIT(name)
79#define BLOCKING_NOTIFIER_HEAD(name) \
80 struct blocking_notifier_head name = \
81 BLOCKING_NOTIFIER_INIT(name)
82#define RAW_NOTIFIER_HEAD(name) \
83 struct raw_notifier_head name = \
84 RAW_NOTIFIER_INIT(name)
21 85
22#ifdef __KERNEL__ 86#ifdef __KERNEL__
23 87
24extern int notifier_chain_register(struct notifier_block **list, struct notifier_block *n); 88extern int atomic_notifier_chain_register(struct atomic_notifier_head *,
25extern int notifier_chain_unregister(struct notifier_block **nl, struct notifier_block *n); 89 struct notifier_block *);
26extern int notifier_call_chain(struct notifier_block **n, unsigned long val, void *v); 90extern int blocking_notifier_chain_register(struct blocking_notifier_head *,
91 struct notifier_block *);
92extern int raw_notifier_chain_register(struct raw_notifier_head *,
93 struct notifier_block *);
94
95extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *,
96 struct notifier_block *);
97extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *,
98 struct notifier_block *);
99extern int raw_notifier_chain_unregister(struct raw_notifier_head *,
100 struct notifier_block *);
101
102extern int atomic_notifier_call_chain(struct atomic_notifier_head *,
103 unsigned long val, void *v);
104extern int blocking_notifier_call_chain(struct blocking_notifier_head *,
105 unsigned long val, void *v);
106extern int raw_notifier_call_chain(struct raw_notifier_head *,
107 unsigned long val, void *v);
27 108
28#define NOTIFY_DONE 0x0000 /* Don't care */ 109#define NOTIFY_DONE 0x0000 /* Don't care */
29#define NOTIFY_OK 0x0001 /* Suits me */ 110#define NOTIFY_OK 0x0001 /* Suits me */
30#define NOTIFY_STOP_MASK 0x8000 /* Don't call further */ 111#define NOTIFY_STOP_MASK 0x8000 /* Don't call further */
31#define NOTIFY_BAD (NOTIFY_STOP_MASK|0x0002) /* Bad/Veto action */ 112#define NOTIFY_BAD (NOTIFY_STOP_MASK|0x0002)
113 /* Bad/Veto action */
32/* 114/*
33 * Clean way to return from the notifier and stop further calls. 115 * Clean way to return from the notifier and stop further calls.
34 */ 116 */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 559c4c38a9c7..0d514b252454 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -61,6 +61,16 @@ void oprofile_arch_exit(void);
61 */ 61 */
62void oprofile_add_sample(struct pt_regs * const regs, unsigned long event); 62void oprofile_add_sample(struct pt_regs * const regs, unsigned long event);
63 63
64/**
65 * Add an extended sample. Use this when the PC is not from the regs, and
66 * we cannot determine if we're in kernel mode from the regs.
67 *
68 * This function does perform a backtrace.
69 *
70 */
71void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
72 unsigned long event, int is_kernel);
73
64/* Use this instead when the PC value is not from the regs. Doesn't 74/* Use this instead when the PC value is not from the regs. Doesn't
65 * backtrace. */ 75 * backtrace. */
66void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event); 76void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event);
@@ -74,10 +84,10 @@ void oprofile_add_trace(unsigned long eip);
74 * the specified file operations. 84 * the specified file operations.
75 */ 85 */
76int oprofilefs_create_file(struct super_block * sb, struct dentry * root, 86int oprofilefs_create_file(struct super_block * sb, struct dentry * root,
77 char const * name, struct file_operations * fops); 87 char const * name, const struct file_operations * fops);
78 88
79int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root, 89int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root,
80 char const * name, struct file_operations * fops, int perm); 90 char const * name, const struct file_operations * fops, int perm);
81 91
82/** Create a file for read/write access to an unsigned long. */ 92/** Create a file for read/write access to an unsigned long. */
83int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root, 93int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root,
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index d52999c43336..9ea629c02a4b 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -86,8 +86,9 @@
86 * - The __xxx_page_state variants can be used safely when interrupts are 86 * - The __xxx_page_state variants can be used safely when interrupts are
87 * disabled. 87 * disabled.
88 * - The __xxx_page_state variants can be used if the field is only 88 * - The __xxx_page_state variants can be used if the field is only
89 * modified from process context, or only modified from interrupt context. 89 * modified from process context and protected from preemption, or only
90 * In this case, the field should be commented here. 90 * modified from interrupt context. In this case, the field should be
91 * commented here.
91 */ 92 */
92struct page_state { 93struct page_state {
93 unsigned long nr_dirty; /* Dirty writeable pages */ 94 unsigned long nr_dirty; /* Dirty writeable pages */
@@ -239,22 +240,19 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
239#define __ClearPageDirty(page) __clear_bit(PG_dirty, &(page)->flags) 240#define __ClearPageDirty(page) __clear_bit(PG_dirty, &(page)->flags)
240#define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags) 241#define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags)
241 242
242#define SetPageLRU(page) set_bit(PG_lru, &(page)->flags)
243#define PageLRU(page) test_bit(PG_lru, &(page)->flags) 243#define PageLRU(page) test_bit(PG_lru, &(page)->flags)
244#define TestSetPageLRU(page) test_and_set_bit(PG_lru, &(page)->flags) 244#define SetPageLRU(page) set_bit(PG_lru, &(page)->flags)
245#define TestClearPageLRU(page) test_and_clear_bit(PG_lru, &(page)->flags) 245#define ClearPageLRU(page) clear_bit(PG_lru, &(page)->flags)
246#define __ClearPageLRU(page) __clear_bit(PG_lru, &(page)->flags)
246 247
247#define PageActive(page) test_bit(PG_active, &(page)->flags) 248#define PageActive(page) test_bit(PG_active, &(page)->flags)
248#define SetPageActive(page) set_bit(PG_active, &(page)->flags) 249#define SetPageActive(page) set_bit(PG_active, &(page)->flags)
249#define ClearPageActive(page) clear_bit(PG_active, &(page)->flags) 250#define ClearPageActive(page) clear_bit(PG_active, &(page)->flags)
250#define TestClearPageActive(page) test_and_clear_bit(PG_active, &(page)->flags) 251#define __ClearPageActive(page) __clear_bit(PG_active, &(page)->flags)
251#define TestSetPageActive(page) test_and_set_bit(PG_active, &(page)->flags)
252 252
253#define PageSlab(page) test_bit(PG_slab, &(page)->flags) 253#define PageSlab(page) test_bit(PG_slab, &(page)->flags)
254#define SetPageSlab(page) set_bit(PG_slab, &(page)->flags) 254#define __SetPageSlab(page) __set_bit(PG_slab, &(page)->flags)
255#define ClearPageSlab(page) clear_bit(PG_slab, &(page)->flags) 255#define __ClearPageSlab(page) __clear_bit(PG_slab, &(page)->flags)
256#define TestClearPageSlab(page) test_and_clear_bit(PG_slab, &(page)->flags)
257#define TestSetPageSlab(page) test_and_set_bit(PG_slab, &(page)->flags)
258 256
259#ifdef CONFIG_HIGHMEM 257#ifdef CONFIG_HIGHMEM
260#define PageHighMem(page) is_highmem(page_zone(page)) 258#define PageHighMem(page) is_highmem(page_zone(page))
@@ -329,8 +327,8 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
329#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags) 327#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags)
330 328
331#define PageCompound(page) test_bit(PG_compound, &(page)->flags) 329#define PageCompound(page) test_bit(PG_compound, &(page)->flags)
332#define SetPageCompound(page) set_bit(PG_compound, &(page)->flags) 330#define __SetPageCompound(page) __set_bit(PG_compound, &(page)->flags)
333#define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags) 331#define __ClearPageCompound(page) __clear_bit(PG_compound, &(page)->flags)
334 332
335#ifdef CONFIG_SWAP 333#ifdef CONFIG_SWAP
336#define PageSwapCache(page) test_bit(PG_swapcache, &(page)->flags) 334#define PageSwapCache(page) test_bit(PG_swapcache, &(page)->flags)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index ee700c6eb442..9539efd4f7e6 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -51,6 +51,10 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
51#define page_cache_release(page) put_page(page) 51#define page_cache_release(page) put_page(page)
52void release_pages(struct page **pages, int nr, int cold); 52void release_pages(struct page **pages, int nr, int cold);
53 53
54#ifdef CONFIG_NUMA
55extern struct page *page_cache_alloc(struct address_space *x);
56extern struct page *page_cache_alloc_cold(struct address_space *x);
57#else
54static inline struct page *page_cache_alloc(struct address_space *x) 58static inline struct page *page_cache_alloc(struct address_space *x)
55{ 59{
56 return alloc_pages(mapping_gfp_mask(x), 0); 60 return alloc_pages(mapping_gfp_mask(x), 0);
@@ -60,6 +64,7 @@ static inline struct page *page_cache_alloc_cold(struct address_space *x)
60{ 64{
61 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0); 65 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0);
62} 66}
67#endif
63 68
64typedef int filler_t(void *, struct page *); 69typedef int filler_t(void *, struct page *);
65 70
@@ -67,8 +72,8 @@ extern struct page * find_get_page(struct address_space *mapping,
67 unsigned long index); 72 unsigned long index);
68extern struct page * find_lock_page(struct address_space *mapping, 73extern struct page * find_lock_page(struct address_space *mapping,
69 unsigned long index); 74 unsigned long index);
70extern struct page * find_trylock_page(struct address_space *mapping, 75extern __deprecated_for_modules struct page * find_trylock_page(
71 unsigned long index); 76 struct address_space *mapping, unsigned long index);
72extern struct page * find_or_create_page(struct address_space *mapping, 77extern struct page * find_or_create_page(struct address_space *mapping,
73 unsigned long index, gfp_t gfp_mask); 78 unsigned long index, gfp_t gfp_mask);
74unsigned find_get_pages(struct address_space *mapping, pgoff_t start, 79unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fe1a2b02fc55..0aad5a378e95 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -95,6 +95,11 @@ enum pci_channel_state {
95 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3, 95 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
96}; 96};
97 97
98typedef unsigned short __bitwise pci_bus_flags_t;
99enum pci_bus_flags {
100 PCI_BUS_FLAGS_NO_MSI = (pci_bus_flags_t) 1,
101};
102
98/* 103/*
99 * The pci_dev structure is used to describe PCI devices. 104 * The pci_dev structure is used to describe PCI devices.
100 */ 105 */
@@ -203,7 +208,7 @@ struct pci_bus {
203 char name[48]; 208 char name[48];
204 209
205 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */ 210 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */
206 unsigned short pad2; 211 pci_bus_flags_t bus_flags; /* Inherited by child busses */
207 struct device *bridge; 212 struct device *bridge;
208 struct class_device class_dev; 213 struct class_device class_dev;
209 struct bin_attribute *legacy_io; /* legacy I/O for this bus */ 214 struct bin_attribute *legacy_io; /* legacy I/O for this bus */
@@ -485,9 +490,9 @@ void pdev_sort_resources(struct pci_dev *, struct resource_list *);
485void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 490void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
486 int (*)(struct pci_dev *, u8, u8)); 491 int (*)(struct pci_dev *, u8, u8));
487#define HAVE_PCI_REQ_REGIONS 2 492#define HAVE_PCI_REQ_REGIONS 2
488int pci_request_regions(struct pci_dev *, char *); 493int pci_request_regions(struct pci_dev *, const char *);
489void pci_release_regions(struct pci_dev *); 494void pci_release_regions(struct pci_dev *);
490int pci_request_region(struct pci_dev *, int, char *); 495int pci_request_region(struct pci_dev *, int, const char *);
491void pci_release_region(struct pci_dev *, int); 496void pci_release_region(struct pci_dev *, int);
492 497
493/* drivers/pci/bus.c */ 498/* drivers/pci/bus.c */
@@ -516,6 +521,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
516void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 521void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
517 void *userdata); 522 void *userdata);
518int pci_cfg_space_size(struct pci_dev *dev); 523int pci_cfg_space_size(struct pci_dev *dev);
524unsigned char pci_bus_max_busnr(struct pci_bus* bus);
519 525
520/* kmem_cache style wrapper around pci_alloc_consistent() */ 526/* kmem_cache style wrapper around pci_alloc_consistent() */
521 527
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 1709b5009d2e..870fe38378b1 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -69,6 +69,7 @@
69#define PCI_CLASS_SYSTEM_TIMER 0x0802 69#define PCI_CLASS_SYSTEM_TIMER 0x0802
70#define PCI_CLASS_SYSTEM_RTC 0x0803 70#define PCI_CLASS_SYSTEM_RTC 0x0803
71#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 71#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804
72#define PCI_CLASS_SYSTEM_SDHCI 0x0805
72#define PCI_CLASS_SYSTEM_OTHER 0x0880 73#define PCI_CLASS_SYSTEM_OTHER 0x0880
73 74
74#define PCI_BASE_CLASS_INPUT 0x09 75#define PCI_BASE_CLASS_INPUT 0x09
@@ -641,6 +642,7 @@
641#define PCI_DEVICE_ID_SI_965 0x0965 642#define PCI_DEVICE_ID_SI_965 0x0965
642#define PCI_DEVICE_ID_SI_5511 0x5511 643#define PCI_DEVICE_ID_SI_5511 0x5511
643#define PCI_DEVICE_ID_SI_5513 0x5513 644#define PCI_DEVICE_ID_SI_5513 0x5513
645#define PCI_DEVICE_ID_SI_5517 0x5517
644#define PCI_DEVICE_ID_SI_5518 0x5518 646#define PCI_DEVICE_ID_SI_5518 0x5518
645#define PCI_DEVICE_ID_SI_5571 0x5571 647#define PCI_DEVICE_ID_SI_5571 0x5571
646#define PCI_DEVICE_ID_SI_5581 0x5581 648#define PCI_DEVICE_ID_SI_5581 0x5581
@@ -771,6 +773,7 @@
771#define PCI_DEVICE_ID_MOTOROLA_HAWK 0x4803 773#define PCI_DEVICE_ID_MOTOROLA_HAWK 0x4803
772#define PCI_DEVICE_ID_MOTOROLA_HARRIER 0x480b 774#define PCI_DEVICE_ID_MOTOROLA_HARRIER 0x480b
773#define PCI_DEVICE_ID_MOTOROLA_MPC5200 0x5803 775#define PCI_DEVICE_ID_MOTOROLA_MPC5200 0x5803
776#define PCI_DEVICE_ID_MOTOROLA_MPC5200B 0x5809
774 777
775#define PCI_VENDOR_ID_PROMISE 0x105a 778#define PCI_VENDOR_ID_PROMISE 0x105a
776#define PCI_DEVICE_ID_PROMISE_20265 0x0d30 779#define PCI_DEVICE_ID_PROMISE_20265 0x0d30
@@ -852,6 +855,8 @@
852#define PCI_DEVICE_ID_QLOGIC_ISP2432 0x2432 855#define PCI_DEVICE_ID_QLOGIC_ISP2432 0x2432
853#define PCI_DEVICE_ID_QLOGIC_ISP2512 0x2512 856#define PCI_DEVICE_ID_QLOGIC_ISP2512 0x2512
854#define PCI_DEVICE_ID_QLOGIC_ISP2522 0x2522 857#define PCI_DEVICE_ID_QLOGIC_ISP2522 0x2522
858#define PCI_DEVICE_ID_QLOGIC_ISP5422 0x5422
859#define PCI_DEVICE_ID_QLOGIC_ISP5432 0x5432
855 860
856#define PCI_VENDOR_ID_CYRIX 0x1078 861#define PCI_VENDOR_ID_CYRIX 0x1078
857#define PCI_DEVICE_ID_CYRIX_5510 0x0000 862#define PCI_DEVICE_ID_CYRIX_5510 0x0000
@@ -1049,6 +1054,7 @@
1049#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2 1054#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2
1050#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3 1055#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3
1051#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x00f9 1056#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x00f9
1057#define PCIE_DEVICE_ID_NVIDIA_QUADRO_NVS280 0x00fd
1052#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 1058#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100
1053#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 1059#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101
1054#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 1060#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103
@@ -1365,9 +1371,11 @@
1365#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008 1371#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008
1366#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 1372#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
1367#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 1373#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
1374#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103
1368#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 1375#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
1369#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 1376#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
1370#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 1377#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203
1378#define PCI_DEVICE_ID_SERVERWORKS_HT1000SB 0x0205
1371#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211 1379#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211
1372#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212 1380#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212
1373#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213 1381#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213
@@ -1856,16 +1864,24 @@
1856#define PCI_DEVICE_ID_TIGON3_5705M 0x165d 1864#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
1857#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e 1865#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
1858#define PCI_DEVICE_ID_TIGON3_5714 0x1668 1866#define PCI_DEVICE_ID_TIGON3_5714 0x1668
1867#define PCI_DEVICE_ID_TIGON3_5714S 0x1669
1859#define PCI_DEVICE_ID_TIGON3_5780 0x166a 1868#define PCI_DEVICE_ID_TIGON3_5780 0x166a
1860#define PCI_DEVICE_ID_TIGON3_5780S 0x166b 1869#define PCI_DEVICE_ID_TIGON3_5780S 0x166b
1861#define PCI_DEVICE_ID_TIGON3_5705F 0x166e 1870#define PCI_DEVICE_ID_TIGON3_5705F 0x166e
1871#define PCI_DEVICE_ID_TIGON3_5754M 0x1672
1872#define PCI_DEVICE_ID_TIGON3_5755M 0x1673
1862#define PCI_DEVICE_ID_TIGON3_5750 0x1676 1873#define PCI_DEVICE_ID_TIGON3_5750 0x1676
1863#define PCI_DEVICE_ID_TIGON3_5751 0x1677 1874#define PCI_DEVICE_ID_TIGON3_5751 0x1677
1864#define PCI_DEVICE_ID_TIGON3_5715 0x1678 1875#define PCI_DEVICE_ID_TIGON3_5715 0x1678
1876#define PCI_DEVICE_ID_TIGON3_5715S 0x1679
1877#define PCI_DEVICE_ID_TIGON3_5754 0x167a
1878#define PCI_DEVICE_ID_TIGON3_5755 0x167b
1865#define PCI_DEVICE_ID_TIGON3_5750M 0x167c 1879#define PCI_DEVICE_ID_TIGON3_5750M 0x167c
1866#define PCI_DEVICE_ID_TIGON3_5751M 0x167d 1880#define PCI_DEVICE_ID_TIGON3_5751M 0x167d
1867#define PCI_DEVICE_ID_TIGON3_5751F 0x167e 1881#define PCI_DEVICE_ID_TIGON3_5751F 0x167e
1882#define PCI_DEVICE_ID_TIGON3_5787M 0x1693
1868#define PCI_DEVICE_ID_TIGON3_5782 0x1696 1883#define PCI_DEVICE_ID_TIGON3_5782 0x1696
1884#define PCI_DEVICE_ID_TIGON3_5787 0x169b
1869#define PCI_DEVICE_ID_TIGON3_5788 0x169c 1885#define PCI_DEVICE_ID_TIGON3_5788 0x169c
1870#define PCI_DEVICE_ID_TIGON3_5789 0x169d 1886#define PCI_DEVICE_ID_TIGON3_5789 0x169d
1871#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 1887#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6
diff --git a/include/linux/pfn.h b/include/linux/pfn.h
new file mode 100644
index 000000000000..bb01f8b92b56
--- /dev/null
+++ b/include/linux/pfn.h
@@ -0,0 +1,9 @@
1#ifndef _LINUX_PFN_H_
2#define _LINUX_PFN_H_
3
4#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
5#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
6#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
7#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
8
9#endif
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 5b2fcb19d2da..29960b03bef7 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -1,55 +1,119 @@
1#ifndef _LINUX_PID_H 1#ifndef _LINUX_PID_H
2#define _LINUX_PID_H 2#define _LINUX_PID_H
3 3
4#include <linux/rcupdate.h>
5
4enum pid_type 6enum pid_type
5{ 7{
6 PIDTYPE_PID, 8 PIDTYPE_PID,
7 PIDTYPE_TGID,
8 PIDTYPE_PGID, 9 PIDTYPE_PGID,
9 PIDTYPE_SID, 10 PIDTYPE_SID,
10 PIDTYPE_MAX 11 PIDTYPE_MAX
11}; 12};
12 13
14/*
15 * What is struct pid?
16 *
17 * A struct pid is the kernel's internal notion of a process identifier.
18 * It refers to individual tasks, process groups, and sessions. While
19 * there are processes attached to it the struct pid lives in a hash
20 * table, so it and then the processes that it refers to can be found
21 * quickly from the numeric pid value. The attached processes may be
22 * quickly accessed by following pointers from struct pid.
23 *
24 * Storing pid_t values in the kernel and refering to them later has a
25 * problem. The process originally with that pid may have exited and the
26 * pid allocator wrapped, and another process could have come along
27 * and been assigned that pid.
28 *
29 * Referring to user space processes by holding a reference to struct
30 * task_struct has a problem. When the user space process exits
31 * the now useless task_struct is still kept. A task_struct plus a
32 * stack consumes around 10K of low kernel memory. More precisely
33 * this is THREAD_SIZE + sizeof(struct task_struct). By comparison
34 * a struct pid is about 64 bytes.
35 *
36 * Holding a reference to struct pid solves both of these problems.
37 * It is small so holding a reference does not consume a lot of
38 * resources, and since a new struct pid is allocated when the numeric
39 * pid value is reused we don't mistakenly refer to new processes.
40 */
41
13struct pid 42struct pid
14{ 43{
44 atomic_t count;
15 /* Try to keep pid_chain in the same cacheline as nr for find_pid */ 45 /* Try to keep pid_chain in the same cacheline as nr for find_pid */
16 int nr; 46 int nr;
17 struct hlist_node pid_chain; 47 struct hlist_node pid_chain;
18 /* list of pids with the same nr, only one of them is in the hash */ 48 /* lists of tasks that use this pid */
19 struct list_head pid_list; 49 struct hlist_head tasks[PIDTYPE_MAX];
50 struct rcu_head rcu;
20}; 51};
21 52
22#define pid_task(elem, type) \ 53struct pid_link
23 list_entry(elem, struct task_struct, pids[type].pid_list) 54{
55 struct hlist_node node;
56 struct pid *pid;
57};
58
59static inline struct pid *get_pid(struct pid *pid)
60{
61 if (pid)
62 atomic_inc(&pid->count);
63 return pid;
64}
65
66extern void FASTCALL(put_pid(struct pid *pid));
67extern struct task_struct *FASTCALL(pid_task(struct pid *pid, enum pid_type));
68extern struct task_struct *FASTCALL(get_pid_task(struct pid *pid,
69 enum pid_type));
24 70
25/* 71/*
26 * attach_pid() and detach_pid() must be called with the tasklist_lock 72 * attach_pid() and detach_pid() must be called with the tasklist_lock
27 * write-held. 73 * write-held.
28 */ 74 */
29extern int FASTCALL(attach_pid(struct task_struct *task, enum pid_type type, int nr)); 75extern int FASTCALL(attach_pid(struct task_struct *task,
76 enum pid_type type, int nr));
30 77
31extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type)); 78extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type));
32 79
33/* 80/*
34 * look up a PID in the hash table. Must be called with the tasklist_lock 81 * look up a PID in the hash table. Must be called with the tasklist_lock
35 * held. 82 * or rcu_read_lock() held.
83 */
84extern struct pid *FASTCALL(find_pid(int nr));
85
86/*
87 * Lookup a PID in the hash table, and return with it's count elevated.
36 */ 88 */
37extern struct pid *FASTCALL(find_pid(enum pid_type, int)); 89extern struct pid *find_get_pid(int nr);
38 90
39extern int alloc_pidmap(void); 91extern struct pid *alloc_pid(void);
40extern void FASTCALL(free_pidmap(int)); 92extern void FASTCALL(free_pid(struct pid *pid));
41extern void switch_exec_pids(struct task_struct *leader, struct task_struct *thread);
42 93
94#define pid_next(task, type) \
95 ((task)->pids[(type)].node.next)
96
97#define pid_next_task(task, type) \
98 hlist_entry(pid_next(task, type), struct task_struct, \
99 pids[(type)].node)
100
101
102/* We could use hlist_for_each_entry_rcu here but it takes more arguments
103 * than the do_each_task_pid/while_each_task_pid. So we roll our own
104 * to preserve the existing interface.
105 */
43#define do_each_task_pid(who, type, task) \ 106#define do_each_task_pid(who, type, task) \
44 if ((task = find_task_by_pid_type(type, who))) { \ 107 if ((task = find_task_by_pid_type(type, who))) { \
45 prefetch((task)->pids[type].pid_list.next); \ 108 prefetch(pid_next(task, type)); \
46 do { 109 do {
47 110
48#define while_each_task_pid(who, type, task) \ 111#define while_each_task_pid(who, type, task) \
49 } while (task = pid_task((task)->pids[type].pid_list.next,\ 112 } while (pid_next(task, type) && ({ \
50 type), \ 113 task = pid_next_task(task, type); \
51 prefetch((task)->pids[type].pid_list.next), \ 114 rcu_dereference(task); \
52 hlist_unhashed(&(task)->pids[type].pid_chain)); \ 115 prefetch(pid_next(task, type)); \
53 } \ 116 1; }) ); \
117 }
54 118
55#endif /* _LINUX_PID_H */ 119#endif /* _LINUX_PID_H */
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index b12e59c75752..75c7f55023ab 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -9,6 +9,7 @@ struct pipe_buffer {
9 struct page *page; 9 struct page *page;
10 unsigned int offset, len; 10 unsigned int offset, len;
11 struct pipe_buf_operations *ops; 11 struct pipe_buf_operations *ops;
12 unsigned int stolen;
12}; 13};
13 14
14struct pipe_buf_operations { 15struct pipe_buf_operations {
@@ -16,6 +17,7 @@ struct pipe_buf_operations {
16 void * (*map)(struct file *, struct pipe_inode_info *, struct pipe_buffer *); 17 void * (*map)(struct file *, struct pipe_inode_info *, struct pipe_buffer *);
17 void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *); 18 void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *);
18 void (*release)(struct pipe_inode_info *, struct pipe_buffer *); 19 void (*release)(struct pipe_inode_info *, struct pipe_buffer *);
20 int (*steal)(struct pipe_inode_info *, struct pipe_buffer *);
19}; 21};
20 22
21struct pipe_inode_info { 23struct pipe_inode_info {
@@ -53,4 +55,10 @@ void pipe_wait(struct inode * inode);
53struct inode* pipe_new(struct inode* inode); 55struct inode* pipe_new(struct inode* inode);
54void free_pipe_info(struct inode* inode); 56void free_pipe_info(struct inode* inode);
55 57
58/*
59 * splice is tied to pipes as a transport (at least for now), so we'll just
60 * add the splice flags here.
61 */
62#define SPLICE_F_MOVE (0x01) /* move pages instead of copying */
63
56#endif 64#endif
diff --git a/include/linux/platform.h b/include/linux/platform.h
deleted file mode 100644
index 3c33084a6ec2..000000000000
--- a/include/linux/platform.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * include/linux/platform.h - platform driver definitions
3 *
4 * Because of the prolific consumerism of the average American,
5 * and the dominant marketing budgets of PC OEMs, we have been
6 * blessed with frequent updates of the PC architecture.
7 *
8 * While most of these calls are singular per architecture, they
9 * require an extra layer of abstraction on the x86 so the right
10 * subsystem gets the right call.
11 *
12 * Basically, this consolidates the power off and reboot callbacks
13 * into one structure, as well as adding power management hooks.
14 *
15 * When adding a platform driver, please make sure all callbacks are
16 * filled. There are defaults defined below that do nothing; use those
17 * if you do not support that callback.
18 */
19
20#ifndef _PLATFORM_H_
21#define _PLATFORM_H_
22#ifdef __KERNEL__
23
24#include <linux/types.h>
25
26struct platform_t {
27 char * name;
28 u32 suspend_states;
29 void (*reboot)(char * cmd);
30 void (*halt)(void);
31 void (*power_off)(void);
32 int (*suspend)(int state, int flags);
33 void (*idle)(void);
34};
35
36extern struct platform_t * platform;
37extern void default_reboot(char * cmd);
38extern void default_halt(void);
39extern int default_suspend(int state, int flags);
40extern void default_idle(void);
41
42#endif /* __KERNEL__ */
43#endif /* _PLATFORM_H */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 5be87ba3b7ac..6df2585c0169 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -188,6 +188,8 @@ extern void device_power_up(void);
188extern void device_resume(void); 188extern void device_resume(void);
189 189
190#ifdef CONFIG_PM 190#ifdef CONFIG_PM
191extern suspend_disk_method_t pm_disk_mode;
192
191extern int device_suspend(pm_message_t state); 193extern int device_suspend(pm_message_t state);
192 194
193#define device_set_wakeup_enable(dev,val) \ 195#define device_set_wakeup_enable(dev,val) \
@@ -215,7 +217,6 @@ static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state)
215 217
216static inline void dpm_runtime_resume(struct device * dev) 218static inline void dpm_runtime_resume(struct device * dev)
217{ 219{
218
219} 220}
220 221
221#endif 222#endif
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 8e8f6098508a..51e1b56741fb 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -11,6 +11,15 @@
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13 13
14/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
15 additional memory. */
16#define MAX_STACK_ALLOC 832
17#define FRONTEND_STACK_ALLOC 256
18#define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC
19#define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC
20#define WQUEUES_STACK_ALLOC (MAX_STACK_ALLOC - FRONTEND_STACK_ALLOC)
21#define N_INLINE_POLL_ENTRIES (WQUEUES_STACK_ALLOC / sizeof(struct poll_table_entry))
22
14struct poll_table_struct; 23struct poll_table_struct;
15 24
16/* 25/*
@@ -33,6 +42,12 @@ static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
33 pt->qproc = qproc; 42 pt->qproc = qproc;
34} 43}
35 44
45struct poll_table_entry {
46 struct file * filp;
47 wait_queue_t wait;
48 wait_queue_head_t * wait_address;
49};
50
36/* 51/*
37 * Structures and helpers for sys_poll/sys_poll 52 * Structures and helpers for sys_poll/sys_poll
38 */ 53 */
@@ -40,6 +55,8 @@ struct poll_wqueues {
40 poll_table pt; 55 poll_table pt;
41 struct poll_table_page * table; 56 struct poll_table_page * table;
42 int error; 57 int error;
58 int inline_index;
59 struct poll_table_entry inline_entries[N_INLINE_POLL_ENTRIES];
43}; 60};
44 61
45extern void poll_initwait(struct poll_wqueues *pwq); 62extern void poll_initwait(struct poll_wqueues *pwq);
diff --git a/include/linux/ppdev.h b/include/linux/ppdev.h
index 141c96586824..f376a7598a78 100644
--- a/include/linux/ppdev.h
+++ b/include/linux/ppdev.h
@@ -14,8 +14,6 @@
14 * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001 14 * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001
15 */ 15 */
16 16
17#define PP_MAJOR 99
18
19#define PP_IOCTL 'p' 17#define PP_IOCTL 'p'
20 18
21/* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ 19/* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index aa6322d45198..135871df9911 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -4,6 +4,7 @@
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/slab.h> 5#include <linux/slab.h>
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <linux/spinlock.h>
7#include <asm/atomic.h> 8#include <asm/atomic.h>
8 9
9/* 10/*
@@ -55,9 +56,9 @@ struct proc_dir_entry {
55 nlink_t nlink; 56 nlink_t nlink;
56 uid_t uid; 57 uid_t uid;
57 gid_t gid; 58 gid_t gid;
58 unsigned long size; 59 loff_t size;
59 struct inode_operations * proc_iops; 60 struct inode_operations * proc_iops;
60 struct file_operations * proc_fops; 61 const struct file_operations * proc_fops;
61 get_info_t *get_info; 62 get_info_t *get_info;
62 struct module *owner; 63 struct module *owner;
63 struct proc_dir_entry *next, *parent, *subdir; 64 struct proc_dir_entry *next, *parent, *subdir;
@@ -92,6 +93,8 @@ extern struct proc_dir_entry *proc_bus;
92extern struct proc_dir_entry *proc_root_driver; 93extern struct proc_dir_entry *proc_root_driver;
93extern struct proc_dir_entry *proc_root_kcore; 94extern struct proc_dir_entry *proc_root_kcore;
94 95
96extern spinlock_t proc_subdir_lock;
97
95extern void proc_root_init(void); 98extern void proc_root_init(void);
96extern void proc_misc_init(void); 99extern void proc_misc_init(void);
97 100
@@ -125,9 +128,9 @@ extern int proc_match(int, const char *,struct proc_dir_entry *);
125extern int proc_readdir(struct file *, void *, filldir_t); 128extern int proc_readdir(struct file *, void *, filldir_t);
126extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); 129extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *);
127 130
128extern struct file_operations proc_kcore_operations; 131extern const struct file_operations proc_kcore_operations;
129extern struct file_operations proc_kmsg_operations; 132extern const struct file_operations proc_kmsg_operations;
130extern struct file_operations ppc_htab_operations; 133extern const struct file_operations ppc_htab_operations;
131 134
132/* 135/*
133 * proc_tty.c 136 * proc_tty.c
@@ -186,7 +189,7 @@ static inline struct proc_dir_entry *proc_net_create(const char *name,
186} 189}
187 190
188static inline struct proc_dir_entry *proc_net_fops_create(const char *name, 191static inline struct proc_dir_entry *proc_net_fops_create(const char *name,
189 mode_t mode, struct file_operations *fops) 192 mode_t mode, const struct file_operations *fops)
190{ 193{
191 struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net); 194 struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net);
192 if (res) 195 if (res)
diff --git a/include/linux/profile.h b/include/linux/profile.h
index 026969a5595c..1f2fea6640a4 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -14,6 +14,7 @@
14 14
15struct proc_dir_entry; 15struct proc_dir_entry;
16struct pt_regs; 16struct pt_regs;
17struct notifier_block;
17 18
18/* init basic kernel profiler */ 19/* init basic kernel profiler */
19void __init profile_init(void); 20void __init profile_init(void);
@@ -32,7 +33,6 @@ enum profile_type {
32 33
33#ifdef CONFIG_PROFILING 34#ifdef CONFIG_PROFILING
34 35
35struct notifier_block;
36struct task_struct; 36struct task_struct;
37struct mm_struct; 37struct mm_struct;
38 38
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index fc610bb0f733..27f49c85d5d6 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -118,8 +118,8 @@ extern struct buffer_head *qnx4_bread(struct inode *, int, int);
118 118
119extern struct inode_operations qnx4_file_inode_operations; 119extern struct inode_operations qnx4_file_inode_operations;
120extern struct inode_operations qnx4_dir_inode_operations; 120extern struct inode_operations qnx4_dir_inode_operations;
121extern struct file_operations qnx4_file_operations; 121extern const struct file_operations qnx4_file_operations;
122extern struct file_operations qnx4_dir_operations; 122extern const struct file_operations qnx4_dir_operations;
123extern int qnx4_is_free(struct super_block *sb, long block); 123extern int qnx4_is_free(struct super_block *sb, long block);
124extern int qnx4_set_bitmap(struct super_block *sb, long block, int busy); 124extern int qnx4_set_bitmap(struct super_block *sb, long block, int busy);
125extern int qnx4_create(struct inode *inode, struct dentry *dentry, int mode, struct nameidata *nd); 125extern int qnx4_create(struct inode *inode, struct dentry *dentry, int mode, struct nameidata *nd);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index f33aeb22c26a..2dab71e1c3d1 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -38,6 +38,7 @@
38#include <linux/errno.h> 38#include <linux/errno.h>
39#include <linux/types.h> 39#include <linux/types.h>
40#include <linux/spinlock.h> 40#include <linux/spinlock.h>
41#include <linux/mutex.h>
41 42
42#define __DQUOT_VERSION__ "dquot_6.5.1" 43#define __DQUOT_VERSION__ "dquot_6.5.1"
43#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1 44#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1
@@ -208,14 +209,13 @@ extern struct dqstats dqstats;
208#define DQ_FAKE_B 3 /* no limits only usage */ 209#define DQ_FAKE_B 3 /* no limits only usage */
209#define DQ_READ_B 4 /* dquot was read into memory */ 210#define DQ_READ_B 4 /* dquot was read into memory */
210#define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */ 211#define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */
211#define DQ_WAITFREE_B 6 /* dquot being waited (by invalidate_dquots) */
212 212
213struct dquot { 213struct dquot {
214 struct hlist_node dq_hash; /* Hash list in memory */ 214 struct hlist_node dq_hash; /* Hash list in memory */
215 struct list_head dq_inuse; /* List of all quotas */ 215 struct list_head dq_inuse; /* List of all quotas */
216 struct list_head dq_free; /* Free list element */ 216 struct list_head dq_free; /* Free list element */
217 struct list_head dq_dirty; /* List of dirty dquots */ 217 struct list_head dq_dirty; /* List of dirty dquots */
218 struct semaphore dq_lock; /* dquot IO lock */ 218 struct mutex dq_lock; /* dquot IO lock */
219 atomic_t dq_count; /* Use count */ 219 atomic_t dq_count; /* Use count */
220 wait_queue_head_t dq_wait_unused; /* Wait queue for dquot to become unused */ 220 wait_queue_head_t dq_wait_unused; /* Wait queue for dquot to become unused */
221 struct super_block *dq_sb; /* superblock this applies to */ 221 struct super_block *dq_sb; /* superblock this applies to */
@@ -285,8 +285,8 @@ struct quota_format_type {
285 285
286struct quota_info { 286struct quota_info {
287 unsigned int flags; /* Flags for diskquotas on this device */ 287 unsigned int flags; /* Flags for diskquotas on this device */
288 struct semaphore dqio_sem; /* lock device while I/O in progress */ 288 struct mutex dqio_mutex; /* lock device while I/O in progress */
289 struct semaphore dqonoff_sem; /* Serialize quotaon & quotaoff */ 289 struct mutex dqonoff_mutex; /* Serialize quotaon & quotaoff */
290 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ 290 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */
291 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ 291 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
292 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ 292 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index c57ff2fcb30a..dd83cca28001 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -45,6 +45,8 @@ do { \
45 (root)->rnode = NULL; \ 45 (root)->rnode = NULL; \
46} while (0) 46} while (0)
47 47
48#define RADIX_TREE_MAX_TAGS 2
49
48int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); 50int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
49void *radix_tree_lookup(struct radix_tree_root *, unsigned long); 51void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
50void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); 52void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long);
@@ -55,15 +57,16 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
55int radix_tree_preload(gfp_t gfp_mask); 57int radix_tree_preload(gfp_t gfp_mask);
56void radix_tree_init(void); 58void radix_tree_init(void);
57void *radix_tree_tag_set(struct radix_tree_root *root, 59void *radix_tree_tag_set(struct radix_tree_root *root,
58 unsigned long index, int tag); 60 unsigned long index, unsigned int tag);
59void *radix_tree_tag_clear(struct radix_tree_root *root, 61void *radix_tree_tag_clear(struct radix_tree_root *root,
60 unsigned long index, int tag); 62 unsigned long index, unsigned int tag);
61int radix_tree_tag_get(struct radix_tree_root *root, 63int radix_tree_tag_get(struct radix_tree_root *root,
62 unsigned long index, int tag); 64 unsigned long index, unsigned int tag);
63unsigned int 65unsigned int
64radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, 66radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
65 unsigned long first_index, unsigned int max_items, int tag); 67 unsigned long first_index, unsigned int max_items,
66int radix_tree_tagged(struct radix_tree_root *root, int tag); 68 unsigned int tag);
69int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag);
67 70
68static inline void radix_tree_preload_end(void) 71static inline void radix_tree_preload_end(void)
69{ 72{
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index b6e0bcad84e1..66b44e5e0d6e 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -92,7 +92,10 @@ extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
92extern void md_super_wait(mddev_t *mddev); 92extern void md_super_wait(mddev_t *mddev);
93extern int sync_page_io(struct block_device *bdev, sector_t sector, int size, 93extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
94 struct page *page, int rw); 94 struct page *page, int rw);
95extern void md_do_sync(mddev_t *mddev);
96extern void md_new_event(mddev_t *mddev);
95 97
98extern void md_update_sb(mddev_t * mddev);
96 99
97#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } 100#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }
98 101
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 617b9506c760..e2df61f5b09a 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -132,6 +132,14 @@ struct mddev_s
132 132
133 char uuid[16]; 133 char uuid[16];
134 134
135 /* If the array is being reshaped, we need to record the
136 * new shape and an indication of where we are up to.
137 * This is written to the superblock.
138 * If reshape_position is MaxSector, then no reshape is happening (yet).
139 */
140 sector_t reshape_position;
141 int delta_disks, new_level, new_layout, new_chunk;
142
135 struct mdk_thread_s *thread; /* management thread */ 143 struct mdk_thread_s *thread; /* management thread */
136 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ 144 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */
137 sector_t curr_resync; /* blocks scheduled */ 145 sector_t curr_resync; /* blocks scheduled */
@@ -143,6 +151,10 @@ struct mddev_s
143 sector_t resync_mismatches; /* count of sectors where 151 sector_t resync_mismatches; /* count of sectors where
144 * parity/replica mismatch found 152 * parity/replica mismatch found
145 */ 153 */
154
155 /* allow user-space to request suspension of IO to regions of the array */
156 sector_t suspend_lo;
157 sector_t suspend_hi;
146 /* if zero, use the system-wide default */ 158 /* if zero, use the system-wide default */
147 int sync_speed_min; 159 int sync_speed_min;
148 int sync_speed_max; 160 int sync_speed_max;
@@ -157,6 +169,9 @@ struct mddev_s
157 * DONE: thread is done and is waiting to be reaped 169 * DONE: thread is done and is waiting to be reaped
158 * REQUEST: user-space has requested a sync (used with SYNC) 170 * REQUEST: user-space has requested a sync (used with SYNC)
159 * CHECK: user-space request for for check-only, no repair 171 * CHECK: user-space request for for check-only, no repair
172 * RESHAPE: A reshape is happening
173 *
174 * If neither SYNC or RESHAPE are set, then it is a recovery.
160 */ 175 */
161#define MD_RECOVERY_RUNNING 0 176#define MD_RECOVERY_RUNNING 0
162#define MD_RECOVERY_SYNC 1 177#define MD_RECOVERY_SYNC 1
@@ -166,10 +181,11 @@ struct mddev_s
166#define MD_RECOVERY_NEEDED 5 181#define MD_RECOVERY_NEEDED 5
167#define MD_RECOVERY_REQUESTED 6 182#define MD_RECOVERY_REQUESTED 6
168#define MD_RECOVERY_CHECK 7 183#define MD_RECOVERY_CHECK 7
184#define MD_RECOVERY_RESHAPE 8
169 unsigned long recovery; 185 unsigned long recovery;
170 186
171 int in_sync; /* know to not need resync */ 187 int in_sync; /* know to not need resync */
172 struct semaphore reconfig_sem; 188 struct mutex reconfig_mutex;
173 atomic_t active; 189 atomic_t active;
174 190
175 int changed; /* true if we might need to reread partition info */ 191 int changed; /* true if we might need to reread partition info */
@@ -249,7 +265,8 @@ struct mdk_personality
249 int (*spare_active) (mddev_t *mddev); 265 int (*spare_active) (mddev_t *mddev);
250 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster); 266 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster);
251 int (*resize) (mddev_t *mddev, sector_t sectors); 267 int (*resize) (mddev_t *mddev, sector_t sectors);
252 int (*reshape) (mddev_t *mddev, int raid_disks); 268 int (*check_reshape) (mddev_t *mddev);
269 int (*start_reshape) (mddev_t *mddev);
253 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); 270 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size);
254 /* quiesce moves between quiescence states 271 /* quiesce moves between quiescence states
255 * 0 - fully active 272 * 0 - fully active
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index c100fa5d4bfa..774e1acfb8c4 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -102,6 +102,18 @@ typedef struct mdp_device_descriptor_s {
102#define MD_SB_ERRORS 1 102#define MD_SB_ERRORS 1
103 103
104#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */ 104#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */
105
106/*
107 * Notes:
108 * - if an array is being reshaped (restriped) in order to change the
109 * the number of active devices in the array, 'raid_disks' will be
110 * the larger of the old and new numbers. 'delta_disks' will
111 * be the "new - old". So if +ve, raid_disks is the new value, and
112 * "raid_disks-delta_disks" is the old. If -ve, raid_disks is the
113 * old value and "raid_disks+delta_disks" is the new (smaller) value.
114 */
115
116
105typedef struct mdp_superblock_s { 117typedef struct mdp_superblock_s {
106 /* 118 /*
107 * Constant generic information 119 * Constant generic information
@@ -146,7 +158,13 @@ typedef struct mdp_superblock_s {
146 __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ 158 __u32 cp_events_hi; /* 10 high-order of checkpoint update count */
147#endif 159#endif
148 __u32 recovery_cp; /* 11 recovery checkpoint sector count */ 160 __u32 recovery_cp; /* 11 recovery checkpoint sector count */
149 __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 12]; 161 /* There are only valid for minor_version > 90 */
162 __u64 reshape_position; /* 12,13 next address in array-space for reshape */
163 __u32 new_level; /* 14 new level we are reshaping to */
164 __u32 delta_disks; /* 15 change in number of raid_disks */
165 __u32 new_layout; /* 16 new layout */
166 __u32 new_chunk; /* 17 new chunk size (bytes) */
167 __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18];
150 168
151 /* 169 /*
152 * Personality information 170 * Personality information
@@ -207,7 +225,14 @@ struct mdp_superblock_1 {
207 * NOTE: signed, so bitmap can be before superblock 225 * NOTE: signed, so bitmap can be before superblock
208 * only meaningful of feature_map[0] is set. 226 * only meaningful of feature_map[0] is set.
209 */ 227 */
210 __u8 pad1[128-100]; /* set to 0 when written */ 228
229 /* These are only valid with feature bit '4' */
230 __u64 reshape_position; /* next address in array-space for reshape */
231 __u32 new_level; /* new level we are reshaping to */
232 __u32 delta_disks; /* change in number of raid_disks */
233 __u32 new_layout; /* new layout */
234 __u32 new_chunk; /* new chunk size (bytes) */
235 __u8 pad1[128-124]; /* set to 0 when written */
211 236
212 /* constant this-device information - 64 bytes */ 237 /* constant this-device information - 64 bytes */
213 __u64 data_offset; /* sector start of data, often 0 */ 238 __u64 data_offset; /* sector start of data, often 0 */
@@ -240,8 +265,9 @@ struct mdp_superblock_1 {
240 265
241/* feature_map bits */ 266/* feature_map bits */
242#define MD_FEATURE_BITMAP_OFFSET 1 267#define MD_FEATURE_BITMAP_OFFSET 1
268#define MD_FEATURE_RESHAPE_ACTIVE 4
243 269
244#define MD_FEATURE_ALL 1 270#define MD_FEATURE_ALL 5
245 271
246#endif 272#endif
247 273
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 9d5494aaac0f..3009c813d83d 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -130,6 +130,6 @@ struct r1bio_s {
130 * with failure when last write completes (and all failed). 130 * with failure when last write completes (and all failed).
131 * Record that bi_end_io was called with this flag... 131 * Record that bi_end_io was called with this flag...
132 */ 132 */
133#define R1BIO_Returned 4 133#define R1BIO_Returned 6
134 134
135#endif 135#endif
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 394da8207b34..914af667044f 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -135,6 +135,7 @@ struct stripe_head {
135 atomic_t count; /* nr of active thread/requests */ 135 atomic_t count; /* nr of active thread/requests */
136 spinlock_t lock; 136 spinlock_t lock;
137 int bm_seq; /* sequence number for bitmap flushes */ 137 int bm_seq; /* sequence number for bitmap flushes */
138 int disks; /* disks in stripe */
138 struct r5dev { 139 struct r5dev {
139 struct bio req; 140 struct bio req;
140 struct bio_vec vec; 141 struct bio_vec vec;
@@ -156,6 +157,7 @@ struct stripe_head {
156#define R5_ReadError 8 /* seen a read error here recently */ 157#define R5_ReadError 8 /* seen a read error here recently */
157#define R5_ReWrite 9 /* have tried to over-write the readerror */ 158#define R5_ReWrite 9 /* have tried to over-write the readerror */
158 159
160#define R5_Expanded 10 /* This block now has post-expand data */
159/* 161/*
160 * Write method 162 * Write method
161 */ 163 */
@@ -174,7 +176,9 @@ struct stripe_head {
174#define STRIPE_DELAYED 6 176#define STRIPE_DELAYED 6
175#define STRIPE_DEGRADED 7 177#define STRIPE_DEGRADED 7
176#define STRIPE_BIT_DELAY 8 178#define STRIPE_BIT_DELAY 8
177 179#define STRIPE_EXPANDING 9
180#define STRIPE_EXPAND_SOURCE 10
181#define STRIPE_EXPAND_READY 11
178/* 182/*
179 * Plugging: 183 * Plugging:
180 * 184 *
@@ -211,12 +215,24 @@ struct raid5_private_data {
211 int raid_disks, working_disks, failed_disks; 215 int raid_disks, working_disks, failed_disks;
212 int max_nr_stripes; 216 int max_nr_stripes;
213 217
218 /* used during an expand */
219 sector_t expand_progress; /* MaxSector when no expand happening */
220 sector_t expand_lo; /* from here up to expand_progress it out-of-bounds
221 * as we haven't flushed the metadata yet
222 */
223 int previous_raid_disks;
224
214 struct list_head handle_list; /* stripes needing handling */ 225 struct list_head handle_list; /* stripes needing handling */
215 struct list_head delayed_list; /* stripes that have plugged requests */ 226 struct list_head delayed_list; /* stripes that have plugged requests */
216 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ 227 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */
217 atomic_t preread_active_stripes; /* stripes with scheduled io */ 228 atomic_t preread_active_stripes; /* stripes with scheduled io */
218 229
219 char cache_name[20]; 230 atomic_t reshape_stripes; /* stripes with pending writes for reshape */
231 /* unfortunately we need two cache names as we temporarily have
232 * two caches.
233 */
234 int active_name;
235 char cache_name[2][20];
220 kmem_cache_t *slab_cache; /* for allocating stripes */ 236 kmem_cache_t *slab_cache; /* for allocating stripes */
221 237
222 int seq_flush, seq_write; 238 int seq_flush, seq_write;
@@ -238,9 +254,10 @@ struct raid5_private_data {
238 wait_queue_head_t wait_for_overlap; 254 wait_queue_head_t wait_for_overlap;
239 int inactive_blocked; /* release of inactive stripes blocked, 255 int inactive_blocked; /* release of inactive stripes blocked,
240 * waiting for 25% to be free 256 * waiting for 25% to be free
241 */ 257 */
258 int pool_size; /* number of disks in stripeheads in pool */
242 spinlock_t device_lock; 259 spinlock_t device_lock;
243 struct disk_info disks[0]; 260 struct disk_info *disks;
244}; 261};
245 262
246typedef struct raid5_private_data raid5_conf_t; 263typedef struct raid5_private_data raid5_conf_t;
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 953b6df5d037..78ecfa28b1c2 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -15,7 +15,7 @@ extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
15extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma); 15extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
16#endif 16#endif
17 17
18extern struct file_operations ramfs_file_operations; 18extern const struct file_operations ramfs_file_operations;
19extern struct vm_operations_struct generic_file_vm_ops; 19extern struct vm_operations_struct generic_file_vm_ops;
20 20
21#endif 21#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index c2ec6c77874e..5673008b61e1 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -113,8 +113,6 @@ struct rcu_data {
113 113
114DECLARE_PER_CPU(struct rcu_data, rcu_data); 114DECLARE_PER_CPU(struct rcu_data, rcu_data);
115DECLARE_PER_CPU(struct rcu_data, rcu_bh_data); 115DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
116extern struct rcu_ctrlblk rcu_ctrlblk;
117extern struct rcu_ctrlblk rcu_bh_ctrlblk;
118 116
119/* 117/*
120 * Increment the quiescent state counter. 118 * Increment the quiescent state counter.
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index dad78cecfd20..5676c4210e2c 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1704,6 +1704,11 @@ static inline int reiserfs_transaction_running(struct super_block *s)
1704 return 0; 1704 return 0;
1705} 1705}
1706 1706
1707static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_handle *th)
1708{
1709 return th->t_blocks_allocated - th->t_blocks_logged;
1710}
1711
1707int reiserfs_async_progress_wait(struct super_block *s); 1712int reiserfs_async_progress_wait(struct super_block *s);
1708 1713
1709struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct 1714struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct
@@ -1955,7 +1960,7 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
1955extern struct inode_operations reiserfs_dir_inode_operations; 1960extern struct inode_operations reiserfs_dir_inode_operations;
1956extern struct inode_operations reiserfs_symlink_inode_operations; 1961extern struct inode_operations reiserfs_symlink_inode_operations;
1957extern struct inode_operations reiserfs_special_inode_operations; 1962extern struct inode_operations reiserfs_special_inode_operations;
1958extern struct file_operations reiserfs_dir_operations; 1963extern const struct file_operations reiserfs_dir_operations;
1959 1964
1960/* tail_conversion.c */ 1965/* tail_conversion.c */
1961int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, 1966int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
@@ -1967,7 +1972,7 @@ void reiserfs_unmap_buffer(struct buffer_head *);
1967 1972
1968/* file.c */ 1973/* file.c */
1969extern struct inode_operations reiserfs_file_inode_operations; 1974extern struct inode_operations reiserfs_file_inode_operations;
1970extern struct file_operations reiserfs_file_operations; 1975extern const struct file_operations reiserfs_file_operations;
1971extern struct address_space_operations reiserfs_address_space_operations; 1976extern struct address_space_operations reiserfs_address_space_operations;
1972 1977
1973/* fix_nodes.c */ 1978/* fix_nodes.c */
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 87280eb6083d..5353afb11db3 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -101,13 +101,13 @@ static inline void reiserfs_mark_inode_private(struct inode *inode)
101#else 101#else
102 102
103#define is_reiserfs_priv_object(inode) 0 103#define is_reiserfs_priv_object(inode) 0
104#define reiserfs_mark_inode_private(inode) 104#define reiserfs_mark_inode_private(inode) do {;} while(0)
105#define reiserfs_getxattr NULL 105#define reiserfs_getxattr NULL
106#define reiserfs_setxattr NULL 106#define reiserfs_setxattr NULL
107#define reiserfs_listxattr NULL 107#define reiserfs_listxattr NULL
108#define reiserfs_removexattr NULL 108#define reiserfs_removexattr NULL
109#define reiserfs_write_lock_xattrs(sb) 109#define reiserfs_write_lock_xattrs(sb) do {;} while(0)
110#define reiserfs_write_unlock_xattrs(sb) 110#define reiserfs_write_unlock_xattrs(sb) do {;} while(0)
111#define reiserfs_read_lock_xattrs(sb) 111#define reiserfs_read_lock_xattrs(sb)
112#define reiserfs_read_unlock_xattrs(sb) 112#define reiserfs_read_unlock_xattrs(sb)
113 113
diff --git a/include/linux/relayfs_fs.h b/include/linux/relay.h
index 7342e66247fb..4bcc1531d6a9 100644
--- a/include/linux/relayfs_fs.h
+++ b/include/linux/relay.h
@@ -1,14 +1,14 @@
1/* 1/*
2 * linux/include/linux/relayfs_fs.h 2 * linux/include/linux/relay.h
3 * 3 *
4 * Copyright (C) 2002, 2003 - Tom Zanussi (zanussi@us.ibm.com), IBM Corp 4 * Copyright (C) 2002, 2003 - Tom Zanussi (zanussi@us.ibm.com), IBM Corp
5 * Copyright (C) 1999, 2000, 2001, 2002 - Karim Yaghmour (karim@opersys.com) 5 * Copyright (C) 1999, 2000, 2001, 2002 - Karim Yaghmour (karim@opersys.com)
6 * 6 *
7 * RelayFS definitions and declarations 7 * CONFIG_RELAY definitions and declarations
8 */ 8 */
9 9
10#ifndef _LINUX_RELAYFS_FS_H 10#ifndef _LINUX_RELAY_H
11#define _LINUX_RELAYFS_FS_H 11#define _LINUX_RELAY_H
12 12
13#include <linux/config.h> 13#include <linux/config.h>
14#include <linux/types.h> 14#include <linux/types.h>
@@ -19,6 +19,9 @@
19#include <linux/poll.h> 19#include <linux/poll.h>
20#include <linux/kref.h> 20#include <linux/kref.h>
21 21
22/* Needs a _much_ better name... */
23#define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE)
24
22/* 25/*
23 * Tracks changes to rchan/rchan_buf structs 26 * Tracks changes to rchan/rchan_buf structs
24 */ 27 */
@@ -92,26 +95,26 @@ struct rchan_callbacks
92 size_t prev_padding); 95 size_t prev_padding);
93 96
94 /* 97 /*
95 * buf_mapped - relayfs buffer mmap notification 98 * buf_mapped - relay buffer mmap notification
96 * @buf: the channel buffer 99 * @buf: the channel buffer
97 * @filp: relayfs file pointer 100 * @filp: relay file pointer
98 * 101 *
99 * Called when a relayfs file is successfully mmapped 102 * Called when a relay file is successfully mmapped
100 */ 103 */
101 void (*buf_mapped)(struct rchan_buf *buf, 104 void (*buf_mapped)(struct rchan_buf *buf,
102 struct file *filp); 105 struct file *filp);
103 106
104 /* 107 /*
105 * buf_unmapped - relayfs buffer unmap notification 108 * buf_unmapped - relay buffer unmap notification
106 * @buf: the channel buffer 109 * @buf: the channel buffer
107 * @filp: relayfs file pointer 110 * @filp: relay file pointer
108 * 111 *
109 * Called when a relayfs file is successfully unmapped 112 * Called when a relay file is successfully unmapped
110 */ 113 */
111 void (*buf_unmapped)(struct rchan_buf *buf, 114 void (*buf_unmapped)(struct rchan_buf *buf,
112 struct file *filp); 115 struct file *filp);
113 /* 116 /*
114 * create_buf_file - create file to represent a relayfs channel buffer 117 * create_buf_file - create file to represent a relay channel buffer
115 * @filename: the name of the file to create 118 * @filename: the name of the file to create
116 * @parent: the parent of the file to create 119 * @parent: the parent of the file to create
117 * @mode: the mode of the file to create 120 * @mode: the mode of the file to create
@@ -121,7 +124,7 @@ struct rchan_callbacks
121 * Called during relay_open(), once for each per-cpu buffer, 124 * Called during relay_open(), once for each per-cpu buffer,
122 * to allow the client to create a file to be used to 125 * to allow the client to create a file to be used to
123 * represent the corresponding channel buffer. If the file is 126 * represent the corresponding channel buffer. If the file is
124 * created outside of relayfs, the parent must also exist in 127 * created outside of relay, the parent must also exist in
125 * that filesystem. 128 * that filesystem.
126 * 129 *
127 * The callback should return the dentry of the file created 130 * The callback should return the dentry of the file created
@@ -140,7 +143,7 @@ struct rchan_callbacks
140 int *is_global); 143 int *is_global);
141 144
142 /* 145 /*
143 * remove_buf_file - remove file representing a relayfs channel buffer 146 * remove_buf_file - remove file representing a relay channel buffer
144 * @dentry: the dentry of the file to remove 147 * @dentry: the dentry of the file to remove
145 * 148 *
146 * Called during relay_close(), once for each per-cpu buffer, 149 * Called during relay_close(), once for each per-cpu buffer,
@@ -153,7 +156,7 @@ struct rchan_callbacks
153}; 156};
154 157
155/* 158/*
156 * relayfs kernel API, fs/relayfs/relay.c 159 * CONFIG_RELAY kernel API, kernel/relay.c
157 */ 160 */
158 161
159struct rchan *relay_open(const char *base_filename, 162struct rchan *relay_open(const char *base_filename,
@@ -171,15 +174,6 @@ extern int relay_buf_full(struct rchan_buf *buf);
171 174
172extern size_t relay_switch_subbuf(struct rchan_buf *buf, 175extern size_t relay_switch_subbuf(struct rchan_buf *buf,
173 size_t length); 176 size_t length);
174extern struct dentry *relayfs_create_dir(const char *name,
175 struct dentry *parent);
176extern int relayfs_remove_dir(struct dentry *dentry);
177extern struct dentry *relayfs_create_file(const char *name,
178 struct dentry *parent,
179 int mode,
180 struct file_operations *fops,
181 void *data);
182extern int relayfs_remove_file(struct dentry *dentry);
183 177
184/** 178/**
185 * relay_write - write data into the channel 179 * relay_write - write data into the channel
@@ -279,9 +273,9 @@ static inline void subbuf_start_reserve(struct rchan_buf *buf,
279} 273}
280 274
281/* 275/*
282 * exported relay file operations, fs/relayfs/inode.c 276 * exported relay file operations, kernel/relay.c
283 */ 277 */
284extern struct file_operations relay_file_operations; 278extern struct file_operations relay_file_operations;
285 279
286#endif /* _LINUX_RELAYFS_FS_H */ 280#endif /* _LINUX_RELAY_H */
287 281
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 0b2ba67ff13c..ab61cd1199f2 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -11,8 +11,6 @@
11#ifndef _LINUX_RTC_H_ 11#ifndef _LINUX_RTC_H_
12#define _LINUX_RTC_H_ 12#define _LINUX_RTC_H_
13 13
14#include <linux/interrupt.h>
15
16/* 14/*
17 * The struct used to pass data via the following ioctl. Similar to the 15 * The struct used to pass data via the following ioctl. Similar to the
18 * struct tm in <time.h>, but it needs to be here so that the kernel 16 * struct tm in <time.h>, but it needs to be here so that the kernel
@@ -93,8 +91,102 @@ struct rtc_pll_info {
93#define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */ 91#define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */
94#define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */ 92#define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */
95 93
94/* interrupt flags */
95#define RTC_IRQF 0x80 /* any of the following is active */
96#define RTC_PF 0x40
97#define RTC_AF 0x20
98#define RTC_UF 0x10
99
96#ifdef __KERNEL__ 100#ifdef __KERNEL__
97 101
102#include <linux/interrupt.h>
103
104extern int rtc_month_days(unsigned int month, unsigned int year);
105extern int rtc_valid_tm(struct rtc_time *tm);
106extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time);
107extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm);
108
109#include <linux/device.h>
110#include <linux/seq_file.h>
111#include <linux/cdev.h>
112#include <linux/poll.h>
113#include <linux/mutex.h>
114
115extern struct class *rtc_class;
116
117struct rtc_class_ops {
118 int (*open)(struct device *);
119 void (*release)(struct device *);
120 int (*ioctl)(struct device *, unsigned int, unsigned long);
121 int (*read_time)(struct device *, struct rtc_time *);
122 int (*set_time)(struct device *, struct rtc_time *);
123 int (*read_alarm)(struct device *, struct rtc_wkalrm *);
124 int (*set_alarm)(struct device *, struct rtc_wkalrm *);
125 int (*proc)(struct device *, struct seq_file *);
126 int (*set_mmss)(struct device *, unsigned long secs);
127 int (*irq_set_state)(struct device *, int enabled);
128 int (*irq_set_freq)(struct device *, int freq);
129 int (*read_callback)(struct device *, int data);
130};
131
132#define RTC_DEVICE_NAME_SIZE 20
133struct rtc_task;
134
135struct rtc_device
136{
137 struct class_device class_dev;
138 struct module *owner;
139
140 int id;
141 char name[RTC_DEVICE_NAME_SIZE];
142
143 struct rtc_class_ops *ops;
144 struct mutex ops_lock;
145
146 struct class_device *rtc_dev;
147 struct cdev char_dev;
148 struct mutex char_lock;
149
150 unsigned long irq_data;
151 spinlock_t irq_lock;
152 wait_queue_head_t irq_queue;
153 struct fasync_struct *async_queue;
154
155 struct rtc_task *irq_task;
156 spinlock_t irq_task_lock;
157 int irq_freq;
158};
159#define to_rtc_device(d) container_of(d, struct rtc_device, class_dev)
160
161extern struct rtc_device *rtc_device_register(const char *name,
162 struct device *dev,
163 struct rtc_class_ops *ops,
164 struct module *owner);
165extern void rtc_device_unregister(struct rtc_device *rdev);
166extern int rtc_interface_register(struct class_interface *intf);
167
168extern int rtc_read_time(struct class_device *class_dev, struct rtc_time *tm);
169extern int rtc_set_time(struct class_device *class_dev, struct rtc_time *tm);
170extern int rtc_set_mmss(struct class_device *class_dev, unsigned long secs);
171extern int rtc_read_alarm(struct class_device *class_dev,
172 struct rtc_wkalrm *alrm);
173extern int rtc_set_alarm(struct class_device *class_dev,
174 struct rtc_wkalrm *alrm);
175extern void rtc_update_irq(struct class_device *class_dev,
176 unsigned long num, unsigned long events);
177
178extern struct class_device *rtc_class_open(char *name);
179extern void rtc_class_close(struct class_device *class_dev);
180
181extern int rtc_irq_register(struct class_device *class_dev,
182 struct rtc_task *task);
183extern void rtc_irq_unregister(struct class_device *class_dev,
184 struct rtc_task *task);
185extern int rtc_irq_set_state(struct class_device *class_dev,
186 struct rtc_task *task, int enabled);
187extern int rtc_irq_set_freq(struct class_device *class_dev,
188 struct rtc_task *task, int freq);
189
98typedef struct rtc_task { 190typedef struct rtc_task {
99 void (*func)(void *private_data); 191 void (*func)(void *private_data);
100 void *private_data; 192 void *private_data;
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index d50482ba27fe..df0cdd41085c 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -199,6 +199,7 @@ enum
199#define RTPROT_BIRD 12 /* BIRD */ 199#define RTPROT_BIRD 12 /* BIRD */
200#define RTPROT_DNROUTED 13 /* DECnet routing daemon */ 200#define RTPROT_DNROUTED 13 /* DECnet routing daemon */
201#define RTPROT_XORP 14 /* XORP */ 201#define RTPROT_XORP 14 /* XORP */
202#define RTPROT_NTK 15 /* Netsukuku */
202 203
203/* rtm_scope 204/* rtm_scope
204 205
@@ -733,6 +734,8 @@ enum
733#define IFLA_MAP IFLA_MAP 734#define IFLA_MAP IFLA_MAP
734 IFLA_WEIGHT, 735 IFLA_WEIGHT,
735#define IFLA_WEIGHT IFLA_WEIGHT 736#define IFLA_WEIGHT IFLA_WEIGHT
737 IFLA_OPERSTATE,
738 IFLA_LINKMODE,
736 __IFLA_MAX 739 __IFLA_MAX
737}; 740};
738 741
@@ -836,6 +839,7 @@ enum
836#define RTMGRP_IPV4_IFADDR 0x10 839#define RTMGRP_IPV4_IFADDR 0x10
837#define RTMGRP_IPV4_MROUTE 0x20 840#define RTMGRP_IPV4_MROUTE 0x20
838#define RTMGRP_IPV4_ROUTE 0x40 841#define RTMGRP_IPV4_ROUTE 0x40
842#define RTMGRP_IPV4_RULE 0x80
839 843
840#define RTMGRP_IPV6_IFADDR 0x100 844#define RTMGRP_IPV6_IFADDR 0x100
841#define RTMGRP_IPV6_MROUTE 0x200 845#define RTMGRP_IPV6_MROUTE 0x200
@@ -866,7 +870,8 @@ enum rtnetlink_groups {
866#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE 870#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE
867 RTNLGRP_IPV4_ROUTE, 871 RTNLGRP_IPV4_ROUTE,
868#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE 872#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE
869 RTNLGRP_NOP1, 873 RTNLGRP_IPV4_RULE,
874#define RTNLGRP_IPV4_RULE RTNLGRP_IPV4_RULE
870 RTNLGRP_IPV6_IFADDR, 875 RTNLGRP_IPV6_IFADDR,
871#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR 876#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR
872 RTNLGRP_IPV6_MROUTE, 877 RTNLGRP_IPV6_MROUTE,
@@ -905,6 +910,7 @@ struct tcamsg
905#ifdef __KERNEL__ 910#ifdef __KERNEL__
906 911
907#include <linux/config.h> 912#include <linux/config.h>
913#include <linux/mutex.h>
908 914
909extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size); 915extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size);
910static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str) 916static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
@@ -1036,24 +1042,17 @@ __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen)
1036 1042
1037extern void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change); 1043extern void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change);
1038 1044
1039extern struct semaphore rtnl_sem; 1045/* RTNL is used as a global lock for all changes to network configuration */
1040
1041#define rtnl_shlock() down(&rtnl_sem)
1042#define rtnl_shlock_nowait() down_trylock(&rtnl_sem)
1043
1044#define rtnl_shunlock() do { up(&rtnl_sem); \
1045 if (rtnl && rtnl->sk_receive_queue.qlen) \
1046 rtnl->sk_data_ready(rtnl, 0); \
1047 } while(0)
1048
1049extern void rtnl_lock(void); 1046extern void rtnl_lock(void);
1050extern int rtnl_lock_interruptible(void);
1051extern void rtnl_unlock(void); 1047extern void rtnl_unlock(void);
1048extern int rtnl_trylock(void);
1049
1052extern void rtnetlink_init(void); 1050extern void rtnetlink_init(void);
1051extern void __rtnl_unlock(void);
1053 1052
1054#define ASSERT_RTNL() do { \ 1053#define ASSERT_RTNL() do { \
1055 if (unlikely(down_trylock(&rtnl_sem) == 0)) { \ 1054 if (unlikely(rtnl_trylock())) { \
1056 up(&rtnl_sem); \ 1055 rtnl_unlock(); \
1057 printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \ 1056 printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \
1058 __FILE__, __LINE__); \ 1057 __FILE__, __LINE__); \
1059 dump_stack(); \ 1058 dump_stack(); \
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 62e6314382f0..541f4828f5e7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -35,6 +35,7 @@
35#include <linux/topology.h> 35#include <linux/topology.h>
36#include <linux/seccomp.h> 36#include <linux/seccomp.h>
37#include <linux/rcupdate.h> 37#include <linux/rcupdate.h>
38#include <linux/futex.h>
38 39
39#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ 40#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */
40 41
@@ -99,6 +100,7 @@ DECLARE_PER_CPU(unsigned long, process_counts);
99extern int nr_processes(void); 100extern int nr_processes(void);
100extern unsigned long nr_running(void); 101extern unsigned long nr_running(void);
101extern unsigned long nr_uninterruptible(void); 102extern unsigned long nr_uninterruptible(void);
103extern unsigned long nr_active(void);
102extern unsigned long nr_iowait(void); 104extern unsigned long nr_iowait(void);
103 105
104#include <linux/time.h> 106#include <linux/time.h>
@@ -206,11 +208,11 @@ extern void update_process_times(int user);
206extern void scheduler_tick(void); 208extern void scheduler_tick(void);
207 209
208#ifdef CONFIG_DETECT_SOFTLOCKUP 210#ifdef CONFIG_DETECT_SOFTLOCKUP
209extern void softlockup_tick(struct pt_regs *regs); 211extern void softlockup_tick(void);
210extern void spawn_softlockup_task(void); 212extern void spawn_softlockup_task(void);
211extern void touch_softlockup_watchdog(void); 213extern void touch_softlockup_watchdog(void);
212#else 214#else
213static inline void softlockup_tick(struct pt_regs *regs) 215static inline void softlockup_tick(void)
214{ 216{
215} 217}
216static inline void spawn_softlockup_task(void) 218static inline void spawn_softlockup_task(void)
@@ -354,16 +356,8 @@ struct sighand_struct {
354 atomic_t count; 356 atomic_t count;
355 struct k_sigaction action[_NSIG]; 357 struct k_sigaction action[_NSIG];
356 spinlock_t siglock; 358 spinlock_t siglock;
357 struct rcu_head rcu;
358}; 359};
359 360
360extern void sighand_free_cb(struct rcu_head *rhp);
361
362static inline void sighand_free(struct sighand_struct *sp)
363{
364 call_rcu(&sp->rcu, sighand_free_cb);
365}
366
367/* 361/*
368 * NOTE! "signal_struct" does not have it's own 362 * NOTE! "signal_struct" does not have it's own
369 * locking, because a shared signal_struct always 363 * locking, because a shared signal_struct always
@@ -402,6 +396,7 @@ struct signal_struct {
402 396
403 /* ITIMER_REAL timer for the process */ 397 /* ITIMER_REAL timer for the process */
404 struct hrtimer real_timer; 398 struct hrtimer real_timer;
399 struct task_struct *tsk;
405 ktime_t it_real_incr; 400 ktime_t it_real_incr;
406 401
407 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 402 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
@@ -489,6 +484,7 @@ struct signal_struct {
489#define MAX_PRIO (MAX_RT_PRIO + 40) 484#define MAX_PRIO (MAX_RT_PRIO + 40)
490 485
491#define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO)) 486#define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO))
487#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH))
492 488
493/* 489/*
494 * Some day this will be a full-fledged user tracking system.. 490 * Some day this will be a full-fledged user tracking system..
@@ -689,6 +685,13 @@ static inline void prefetch_stack(struct task_struct *t) { }
689struct audit_context; /* See audit.c */ 685struct audit_context; /* See audit.c */
690struct mempolicy; 686struct mempolicy;
691 687
688enum sleep_type {
689 SLEEP_NORMAL,
690 SLEEP_NONINTERACTIVE,
691 SLEEP_INTERACTIVE,
692 SLEEP_INTERRUPTED,
693};
694
692struct task_struct { 695struct task_struct {
693 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 696 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
694 struct thread_info *thread_info; 697 struct thread_info *thread_info;
@@ -706,11 +709,12 @@ struct task_struct {
706 prio_array_t *array; 709 prio_array_t *array;
707 710
708 unsigned short ioprio; 711 unsigned short ioprio;
712 unsigned int btrace_seq;
709 713
710 unsigned long sleep_avg; 714 unsigned long sleep_avg;
711 unsigned long long timestamp, last_ran; 715 unsigned long long timestamp, last_ran;
712 unsigned long long sched_time; /* sched_clock time spent running */ 716 unsigned long long sched_time; /* sched_clock time spent running */
713 int activated; 717 enum sleep_type sleep_type;
714 718
715 unsigned long policy; 719 unsigned long policy;
716 cpumask_t cpus_allowed; 720 cpumask_t cpus_allowed;
@@ -756,7 +760,8 @@ struct task_struct {
756 struct task_struct *group_leader; /* threadgroup leader */ 760 struct task_struct *group_leader; /* threadgroup leader */
757 761
758 /* PID/PID hash table linkage. */ 762 /* PID/PID hash table linkage. */
759 struct pid pids[PIDTYPE_MAX]; 763 struct pid_link pids[PIDTYPE_MAX];
764 struct list_head thread_group;
760 765
761 struct completion *vfork_done; /* for vfork() */ 766 struct completion *vfork_done; /* for vfork() */
762 int __user *set_child_tid; /* CLONE_CHILD_SETTID */ 767 int __user *set_child_tid; /* CLONE_CHILD_SETTID */
@@ -868,7 +873,13 @@ struct task_struct {
868 struct cpuset *cpuset; 873 struct cpuset *cpuset;
869 nodemask_t mems_allowed; 874 nodemask_t mems_allowed;
870 int cpuset_mems_generation; 875 int cpuset_mems_generation;
876 int cpuset_mem_spread_rotor;
877#endif
878 struct robust_list_head __user *robust_list;
879#ifdef CONFIG_COMPAT
880 struct compat_robust_list_head __user *compat_robust_list;
871#endif 881#endif
882
872 atomic_t fs_excl; /* holding fs exclusive resources */ 883 atomic_t fs_excl; /* holding fs exclusive resources */
873 struct rcu_head rcu; 884 struct rcu_head rcu;
874}; 885};
@@ -888,18 +899,19 @@ static inline pid_t process_group(struct task_struct *tsk)
888 */ 899 */
889static inline int pid_alive(struct task_struct *p) 900static inline int pid_alive(struct task_struct *p)
890{ 901{
891 return p->pids[PIDTYPE_PID].nr != 0; 902 return p->pids[PIDTYPE_PID].pid != NULL;
892} 903}
893 904
894extern void free_task(struct task_struct *tsk); 905extern void free_task(struct task_struct *tsk);
895#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) 906#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
896 907
897extern void __put_task_struct_cb(struct rcu_head *rhp); 908extern void __put_task_struct_cb(struct rcu_head *rhp);
909extern void __put_task_struct(struct task_struct *t);
898 910
899static inline void put_task_struct(struct task_struct *t) 911static inline void put_task_struct(struct task_struct *t)
900{ 912{
901 if (atomic_dec_and_test(&t->usage)) 913 if (atomic_dec_and_test(&t->usage))
902 call_rcu(&t->rcu, __put_task_struct_cb); 914 __put_task_struct(t);
903} 915}
904 916
905/* 917/*
@@ -928,6 +940,9 @@ static inline void put_task_struct(struct task_struct *t)
928#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ 940#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */
929#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ 941#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */
930#define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */ 942#define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */
943#define PF_SPREAD_PAGE 0x04000000 /* Spread page cache over cpuset */
944#define PF_SPREAD_SLAB 0x08000000 /* Spread some slab caches over cpuset */
945#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
931 946
932/* 947/*
933 * Only the _current_ task can read/write to tsk->flags, but other 948 * Only the _current_ task can read/write to tsk->flags, but other
@@ -1089,7 +1104,6 @@ extern void force_sig_specific(int, struct task_struct *);
1089extern int send_sig(int, struct task_struct *, int); 1104extern int send_sig(int, struct task_struct *, int);
1090extern void zap_other_threads(struct task_struct *p); 1105extern void zap_other_threads(struct task_struct *p);
1091extern int kill_pg(pid_t, int, int); 1106extern int kill_pg(pid_t, int, int);
1092extern int kill_sl(pid_t, int, int);
1093extern int kill_proc(pid_t, int, int); 1107extern int kill_proc(pid_t, int, int);
1094extern struct sigqueue *sigqueue_alloc(void); 1108extern struct sigqueue *sigqueue_alloc(void);
1095extern void sigqueue_free(struct sigqueue *); 1109extern void sigqueue_free(struct sigqueue *);
@@ -1146,10 +1160,8 @@ extern void flush_thread(void);
1146extern void exit_thread(void); 1160extern void exit_thread(void);
1147 1161
1148extern void exit_files(struct task_struct *); 1162extern void exit_files(struct task_struct *);
1149extern void exit_signal(struct task_struct *); 1163extern void __cleanup_signal(struct signal_struct *);
1150extern void __exit_signal(struct task_struct *); 1164extern void __cleanup_sighand(struct sighand_struct *);
1151extern void exit_sighand(struct task_struct *);
1152extern void __exit_sighand(struct task_struct *);
1153extern void exit_itimers(struct signal_struct *); 1165extern void exit_itimers(struct signal_struct *);
1154 1166
1155extern NORET_TYPE void do_group_exit(int); 1167extern NORET_TYPE void do_group_exit(int);
@@ -1173,19 +1185,7 @@ extern void wait_task_inactive(task_t * p);
1173#endif 1185#endif
1174 1186
1175#define remove_parent(p) list_del_init(&(p)->sibling) 1187#define remove_parent(p) list_del_init(&(p)->sibling)
1176#define add_parent(p, parent) list_add_tail(&(p)->sibling,&(parent)->children) 1188#define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children)
1177
1178#define REMOVE_LINKS(p) do { \
1179 if (thread_group_leader(p)) \
1180 list_del_init(&(p)->tasks); \
1181 remove_parent(p); \
1182 } while (0)
1183
1184#define SET_LINKS(p) do { \
1185 if (thread_group_leader(p)) \
1186 list_add_tail(&(p)->tasks,&init_task.tasks); \
1187 add_parent(p, (p)->parent); \
1188 } while (0)
1189 1189
1190#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) 1190#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks)
1191#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) 1191#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks)
@@ -1203,20 +1203,22 @@ extern void wait_task_inactive(task_t * p);
1203#define while_each_thread(g, t) \ 1203#define while_each_thread(g, t) \
1204 while ((t = next_thread(t)) != g) 1204 while ((t = next_thread(t)) != g)
1205 1205
1206extern task_t * FASTCALL(next_thread(const task_t *p));
1207
1208#define thread_group_leader(p) (p->pid == p->tgid) 1206#define thread_group_leader(p) (p->pid == p->tgid)
1209 1207
1208static inline task_t *next_thread(task_t *p)
1209{
1210 return list_entry(rcu_dereference(p->thread_group.next),
1211 task_t, thread_group);
1212}
1213
1210static inline int thread_group_empty(task_t *p) 1214static inline int thread_group_empty(task_t *p)
1211{ 1215{
1212 return list_empty(&p->pids[PIDTYPE_TGID].pid_list); 1216 return list_empty(&p->thread_group);
1213} 1217}
1214 1218
1215#define delay_group_leader(p) \ 1219#define delay_group_leader(p) \
1216 (thread_group_leader(p) && !thread_group_empty(p)) 1220 (thread_group_leader(p) && !thread_group_empty(p))
1217 1221
1218extern void unhash_process(struct task_struct *p);
1219
1220/* 1222/*
1221 * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring 1223 * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring
1222 * subscriptions and synchronises with wait4(). Also used in procfs. Also 1224 * subscriptions and synchronises with wait4(). Also used in procfs. Also
@@ -1236,6 +1238,15 @@ static inline void task_unlock(struct task_struct *p)
1236 spin_unlock(&p->alloc_lock); 1238 spin_unlock(&p->alloc_lock);
1237} 1239}
1238 1240
1241extern struct sighand_struct *lock_task_sighand(struct task_struct *tsk,
1242 unsigned long *flags);
1243
1244static inline void unlock_task_sighand(struct task_struct *tsk,
1245 unsigned long *flags)
1246{
1247 spin_unlock_irqrestore(&tsk->sighand->siglock, *flags);
1248}
1249
1239#ifndef __HAVE_THREAD_FUNCTIONS 1250#ifndef __HAVE_THREAD_FUNCTIONS
1240 1251
1241#define task_thread_info(task) (task)->thread_info 1252#define task_thread_info(task) (task)->thread_info
diff --git a/include/linux/security.h b/include/linux/security.h
index 7cbef482e13a..aaa0a5cdbf75 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -869,6 +869,11 @@ struct swap_info_struct;
869 * @ipcp contains the kernel IPC permission structure 869 * @ipcp contains the kernel IPC permission structure
870 * @flag contains the desired (requested) permission set 870 * @flag contains the desired (requested) permission set
871 * Return 0 if permission is granted. 871 * Return 0 if permission is granted.
872 * @ipc_getsecurity:
873 * Copy the security label associated with the ipc object into
874 * @buffer. @buffer may be NULL to request the size of the buffer
875 * required. @size indicates the size of @buffer in bytes. Return
876 * number of bytes used/required on success.
872 * 877 *
873 * Security hooks for individual messages held in System V IPC message queues 878 * Security hooks for individual messages held in System V IPC message queues
874 * @msg_msg_alloc_security: 879 * @msg_msg_alloc_security:
@@ -1040,6 +1045,11 @@ struct swap_info_struct;
1040 * @effective contains the effective capability set. 1045 * @effective contains the effective capability set.
1041 * @inheritable contains the inheritable capability set. 1046 * @inheritable contains the inheritable capability set.
1042 * @permitted contains the permitted capability set. 1047 * @permitted contains the permitted capability set.
1048 * @capable:
1049 * Check whether the @tsk process has the @cap capability.
1050 * @tsk contains the task_struct for the process.
1051 * @cap contains the capability <include/linux/capability.h>.
1052 * Return 0 if the capability is granted for @tsk.
1043 * @acct: 1053 * @acct:
1044 * Check permission before enabling or disabling process accounting. If 1054 * Check permission before enabling or disabling process accounting. If
1045 * accounting is being enabled, then @file refers to the open file used to 1055 * accounting is being enabled, then @file refers to the open file used to
@@ -1053,11 +1063,6 @@ struct swap_info_struct;
1053 * @table contains the ctl_table structure for the sysctl variable. 1063 * @table contains the ctl_table structure for the sysctl variable.
1054 * @op contains the operation (001 = search, 002 = write, 004 = read). 1064 * @op contains the operation (001 = search, 002 = write, 004 = read).
1055 * Return 0 if permission is granted. 1065 * Return 0 if permission is granted.
1056 * @capable:
1057 * Check whether the @tsk process has the @cap capability.
1058 * @tsk contains the task_struct for the process.
1059 * @cap contains the capability <include/linux/capability.h>.
1060 * Return 0 if the capability is granted for @tsk.
1061 * @syslog: 1066 * @syslog:
1062 * Check permission before accessing the kernel message ring or changing 1067 * Check permission before accessing the kernel message ring or changing
1063 * logging to the console. 1068 * logging to the console.
@@ -1099,9 +1104,9 @@ struct security_operations {
1099 kernel_cap_t * effective, 1104 kernel_cap_t * effective,
1100 kernel_cap_t * inheritable, 1105 kernel_cap_t * inheritable,
1101 kernel_cap_t * permitted); 1106 kernel_cap_t * permitted);
1107 int (*capable) (struct task_struct * tsk, int cap);
1102 int (*acct) (struct file * file); 1108 int (*acct) (struct file * file);
1103 int (*sysctl) (struct ctl_table * table, int op); 1109 int (*sysctl) (struct ctl_table * table, int op);
1104 int (*capable) (struct task_struct * tsk, int cap);
1105 int (*quotactl) (int cmds, int type, int id, struct super_block * sb); 1110 int (*quotactl) (int cmds, int type, int id, struct super_block * sb);
1106 int (*quota_on) (struct dentry * dentry); 1111 int (*quota_on) (struct dentry * dentry);
1107 int (*syslog) (int type); 1112 int (*syslog) (int type);
@@ -1168,7 +1173,8 @@ struct security_operations {
1168 int (*inode_getxattr) (struct dentry *dentry, char *name); 1173 int (*inode_getxattr) (struct dentry *dentry, char *name);
1169 int (*inode_listxattr) (struct dentry *dentry); 1174 int (*inode_listxattr) (struct dentry *dentry);
1170 int (*inode_removexattr) (struct dentry *dentry, char *name); 1175 int (*inode_removexattr) (struct dentry *dentry, char *name);
1171 int (*inode_getsecurity)(struct inode *inode, const char *name, void *buffer, size_t size, int err); 1176 const char *(*inode_xattr_getsuffix) (void);
1177 int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
1172 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1178 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags);
1173 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size); 1179 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size);
1174 1180
@@ -1217,6 +1223,7 @@ struct security_operations {
1217 void (*task_to_inode)(struct task_struct *p, struct inode *inode); 1223 void (*task_to_inode)(struct task_struct *p, struct inode *inode);
1218 1224
1219 int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag); 1225 int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag);
1226 int (*ipc_getsecurity)(struct kern_ipc_perm *ipcp, void *buffer, size_t size);
1220 1227
1221 int (*msg_msg_alloc_security) (struct msg_msg * msg); 1228 int (*msg_msg_alloc_security) (struct msg_msg * msg);
1222 void (*msg_msg_free_security) (struct msg_msg * msg); 1229 void (*msg_msg_free_security) (struct msg_msg * msg);
@@ -1286,7 +1293,8 @@ struct security_operations {
1286 int (*socket_setsockopt) (struct socket * sock, int level, int optname); 1293 int (*socket_setsockopt) (struct socket * sock, int level, int optname);
1287 int (*socket_shutdown) (struct socket * sock, int how); 1294 int (*socket_shutdown) (struct socket * sock, int how);
1288 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb); 1295 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb);
1289 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); 1296 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1297 int (*socket_getpeersec_dgram) (struct sk_buff *skb, char **secdata, u32 *seclen);
1290 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); 1298 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
1291 void (*sk_free_security) (struct sock *sk); 1299 void (*sk_free_security) (struct sock *sk);
1292 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir); 1300 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir);
@@ -1346,6 +1354,11 @@ static inline void security_capset_set (struct task_struct *target,
1346 security_ops->capset_set (target, effective, inheritable, permitted); 1354 security_ops->capset_set (target, effective, inheritable, permitted);
1347} 1355}
1348 1356
1357static inline int security_capable(struct task_struct *tsk, int cap)
1358{
1359 return security_ops->capable(tsk, cap);
1360}
1361
1349static inline int security_acct (struct file *file) 1362static inline int security_acct (struct file *file)
1350{ 1363{
1351 return security_ops->acct (file); 1364 return security_ops->acct (file);
@@ -1674,7 +1687,12 @@ static inline int security_inode_removexattr (struct dentry *dentry, char *name)
1674 return security_ops->inode_removexattr (dentry, name); 1687 return security_ops->inode_removexattr (dentry, name);
1675} 1688}
1676 1689
1677static inline int security_inode_getsecurity(struct inode *inode, const char *name, void *buffer, size_t size, int err) 1690static inline const char *security_inode_xattr_getsuffix(void)
1691{
1692 return security_ops->inode_xattr_getsuffix();
1693}
1694
1695static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
1678{ 1696{
1679 if (unlikely (IS_PRIVATE (inode))) 1697 if (unlikely (IS_PRIVATE (inode)))
1680 return 0; 1698 return 0;
@@ -1869,6 +1887,11 @@ static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
1869 return security_ops->ipc_permission (ipcp, flag); 1887 return security_ops->ipc_permission (ipcp, flag);
1870} 1888}
1871 1889
1890static inline int security_ipc_getsecurity(struct kern_ipc_perm *ipcp, void *buffer, size_t size)
1891{
1892 return security_ops->ipc_getsecurity(ipcp, buffer, size);
1893}
1894
1872static inline int security_msg_msg_alloc (struct msg_msg * msg) 1895static inline int security_msg_msg_alloc (struct msg_msg * msg)
1873{ 1896{
1874 return security_ops->msg_msg_alloc_security (msg); 1897 return security_ops->msg_msg_alloc_security (msg);
@@ -2049,6 +2072,11 @@ static inline void security_capset_set (struct task_struct *target,
2049 cap_capset_set (target, effective, inheritable, permitted); 2072 cap_capset_set (target, effective, inheritable, permitted);
2050} 2073}
2051 2074
2075static inline int security_capable(struct task_struct *tsk, int cap)
2076{
2077 return cap_capable(tsk, cap);
2078}
2079
2052static inline int security_acct (struct file *file) 2080static inline int security_acct (struct file *file)
2053{ 2081{
2054 return 0; 2082 return 0;
@@ -2316,7 +2344,12 @@ static inline int security_inode_removexattr (struct dentry *dentry, char *name)
2316 return cap_inode_removexattr(dentry, name); 2344 return cap_inode_removexattr(dentry, name);
2317} 2345}
2318 2346
2319static inline int security_inode_getsecurity(struct inode *inode, const char *name, void *buffer, size_t size, int err) 2347static inline const char *security_inode_xattr_getsuffix (void)
2348{
2349 return NULL ;
2350}
2351
2352static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
2320{ 2353{
2321 return -EOPNOTSUPP; 2354 return -EOPNOTSUPP;
2322} 2355}
@@ -2499,6 +2532,11 @@ static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
2499 return 0; 2532 return 0;
2500} 2533}
2501 2534
2535static inline int security_ipc_getsecurity(struct kern_ipc_perm *ipcp, void *buffer, size_t size)
2536{
2537 return -EOPNOTSUPP;
2538}
2539
2502static inline int security_msg_msg_alloc (struct msg_msg * msg) 2540static inline int security_msg_msg_alloc (struct msg_msg * msg)
2503{ 2541{
2504 return 0; 2542 return 0;
@@ -2741,10 +2779,16 @@ static inline int security_sock_rcv_skb (struct sock * sk,
2741 return security_ops->socket_sock_rcv_skb (sk, skb); 2779 return security_ops->socket_sock_rcv_skb (sk, skb);
2742} 2780}
2743 2781
2744static inline int security_socket_getpeersec(struct socket *sock, char __user *optval, 2782static inline int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
2745 int __user *optlen, unsigned len) 2783 int __user *optlen, unsigned len)
2784{
2785 return security_ops->socket_getpeersec_stream(sock, optval, optlen, len);
2786}
2787
2788static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata,
2789 u32 *seclen)
2746{ 2790{
2747 return security_ops->socket_getpeersec(sock, optval, optlen, len); 2791 return security_ops->socket_getpeersec_dgram(skb, secdata, seclen);
2748} 2792}
2749 2793
2750static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) 2794static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
@@ -2863,8 +2907,14 @@ static inline int security_sock_rcv_skb (struct sock * sk,
2863 return 0; 2907 return 0;
2864} 2908}
2865 2909
2866static inline int security_socket_getpeersec(struct socket *sock, char __user *optval, 2910static inline int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
2867 int __user *optlen, unsigned len) 2911 int __user *optlen, unsigned len)
2912{
2913 return -ENOPROTOOPT;
2914}
2915
2916static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata,
2917 u32 *seclen)
2868{ 2918{
2869 return -ENOPROTOOPT; 2919 return -ENOPROTOOPT;
2870} 2920}
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 850a974ee505..b95f6eb7254c 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -4,7 +4,7 @@
4 4
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/string.h> 6#include <linux/string.h>
7#include <asm/semaphore.h> 7#include <linux/mutex.h>
8 8
9struct seq_operations; 9struct seq_operations;
10struct file; 10struct file;
@@ -19,7 +19,7 @@ struct seq_file {
19 size_t count; 19 size_t count;
20 loff_t index; 20 loff_t index;
21 loff_t version; 21 loff_t version;
22 struct semaphore sem; 22 struct mutex lock;
23 struct seq_operations *op; 23 struct seq_operations *op;
24 void *private; 24 void *private;
25}; 25};
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 73b464f0926a..8e9681413726 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -37,6 +37,7 @@ enum {
37 PLAT8250_DEV_LEGACY = -1, 37 PLAT8250_DEV_LEGACY = -1,
38 PLAT8250_DEV_PLATFORM, 38 PLAT8250_DEV_PLATFORM,
39 PLAT8250_DEV_PLATFORM1, 39 PLAT8250_DEV_PLATFORM1,
40 PLAT8250_DEV_PLATFORM2,
40 PLAT8250_DEV_FOURPORT, 41 PLAT8250_DEV_FOURPORT,
41 PLAT8250_DEV_ACCENT, 42 PLAT8250_DEV_ACCENT,
42 PLAT8250_DEV_BOCA, 43 PLAT8250_DEV_BOCA,
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 4041122dabfc..c32e60e79dea 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -127,6 +127,9 @@
127/* Hilscher netx */ 127/* Hilscher netx */
128#define PORT_NETX 71 128#define PORT_NETX 71
129 129
130/* SUN4V Hypervisor Console */
131#define PORT_SUNHV 72
132
130#ifdef __KERNEL__ 133#ifdef __KERNEL__
131 134
132#include <linux/config.h> 135#include <linux/config.h>
@@ -366,6 +369,9 @@ void uart_parse_options(char *options, int *baud, int *parity, int *bits,
366int uart_set_options(struct uart_port *port, struct console *co, int baud, 369int uart_set_options(struct uart_port *port, struct console *co, int baud,
367 int parity, int bits, int flow); 370 int parity, int bits, int flow);
368struct tty_driver *uart_console_device(struct console *co, int *index); 371struct tty_driver *uart_console_device(struct console *co, int *index);
372void uart_console_write(struct uart_port *port, const char *s,
373 unsigned int count,
374 void (*putchar)(struct uart_port *, int));
369 375
370/* 376/*
371 * Port/driver registration/removal 377 * Port/driver registration/removal
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 582db2392d94..6348e8330897 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -120,7 +120,7 @@ static inline void serio_cleanup(struct serio *serio)
120} 120}
121 121
122/* 122/*
123 * Use the following fucntions to manipulate serio's per-port 123 * Use the following functions to manipulate serio's per-port
124 * driver-specific data. 124 * driver-specific data.
125 */ 125 */
126static inline void *serio_get_drvdata(struct serio *serio) 126static inline void *serio_get_drvdata(struct serio *serio)
@@ -134,7 +134,7 @@ static inline void serio_set_drvdata(struct serio *serio, void *data)
134} 134}
135 135
136/* 136/*
137 * Use the following fucntions to protect critical sections in 137 * Use the following functions to protect critical sections in
138 * driver code from port's interrupt handler 138 * driver code from port's interrupt handler
139 */ 139 */
140static inline void serio_pause_rx(struct serio *serio) 140static inline void serio_pause_rx(struct serio *serio)
@@ -148,7 +148,7 @@ static inline void serio_continue_rx(struct serio *serio)
148} 148}
149 149
150/* 150/*
151 * Use the following fucntions to pin serio's driver in process context 151 * Use the following functions to pin serio's driver in process context
152 */ 152 */
153static inline int serio_pin_driver(struct serio *serio) 153static inline int serio_pin_driver(struct serio *serio)
154{ 154{
diff --git a/include/linux/signal.h b/include/linux/signal.h
index b7d093520bb6..162a8fd10b29 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -249,6 +249,8 @@ static inline void init_sigpending(struct sigpending *sig)
249 INIT_LIST_HEAD(&sig->list); 249 INIT_LIST_HEAD(&sig->list);
250} 250}
251 251
252extern void flush_sigqueue(struct sigpending *queue);
253
252/* Test if 'sig' is valid signal. Use this instead of testing _NSIG directly */ 254/* Test if 'sig' is valid signal. Use this instead of testing _NSIG directly */
253static inline int valid_signal(unsigned long sig) 255static inline int valid_signal(unsigned long sig)
254{ 256{
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ad7cc22bd424..c4619a428d9b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -270,7 +270,6 @@ struct sk_buff {
270 270
271 void (*destructor)(struct sk_buff *skb); 271 void (*destructor)(struct sk_buff *skb);
272#ifdef CONFIG_NETFILTER 272#ifdef CONFIG_NETFILTER
273 __u32 nfmark;
274 struct nf_conntrack *nfct; 273 struct nf_conntrack *nfct;
275#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 274#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
276 struct sk_buff *nfct_reasm; 275 struct sk_buff *nfct_reasm;
@@ -278,6 +277,7 @@ struct sk_buff {
278#ifdef CONFIG_BRIDGE_NETFILTER 277#ifdef CONFIG_BRIDGE_NETFILTER
279 struct nf_bridge_info *nf_bridge; 278 struct nf_bridge_info *nf_bridge;
280#endif 279#endif
280 __u32 nfmark;
281#endif /* CONFIG_NETFILTER */ 281#endif /* CONFIG_NETFILTER */
282#ifdef CONFIG_NET_SCHED 282#ifdef CONFIG_NET_SCHED
283 __u16 tc_index; /* traffic control index */ 283 __u16 tc_index; /* traffic control index */
@@ -304,6 +304,7 @@ struct sk_buff {
304 304
305#include <asm/system.h> 305#include <asm/system.h>
306 306
307extern void kfree_skb(struct sk_buff *skb);
307extern void __kfree_skb(struct sk_buff *skb); 308extern void __kfree_skb(struct sk_buff *skb);
308extern struct sk_buff *__alloc_skb(unsigned int size, 309extern struct sk_buff *__alloc_skb(unsigned int size,
309 gfp_t priority, int fclone); 310 gfp_t priority, int fclone);
@@ -404,22 +405,6 @@ static inline struct sk_buff *skb_get(struct sk_buff *skb)
404 */ 405 */
405 406
406/** 407/**
407 * kfree_skb - free an sk_buff
408 * @skb: buffer to free
409 *
410 * Drop a reference to the buffer and free it if the usage count has
411 * hit zero.
412 */
413static inline void kfree_skb(struct sk_buff *skb)
414{
415 if (likely(atomic_read(&skb->users) == 1))
416 smp_rmb();
417 else if (likely(!atomic_dec_and_test(&skb->users)))
418 return;
419 __kfree_skb(skb);
420}
421
422/**
423 * skb_cloned - is the buffer a clone 408 * skb_cloned - is the buffer a clone
424 * @skb: buffer to check 409 * @skb: buffer to check
425 * 410 *
@@ -956,6 +941,25 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
956#define NET_IP_ALIGN 2 941#define NET_IP_ALIGN 2
957#endif 942#endif
958 943
944/*
945 * The networking layer reserves some headroom in skb data (via
946 * dev_alloc_skb). This is used to avoid having to reallocate skb data when
947 * the header has to grow. In the default case, if the header has to grow
948 * 16 bytes or less we avoid the reallocation.
949 *
950 * Unfortunately this headroom changes the DMA alignment of the resulting
951 * network packet. As for NET_IP_ALIGN, this unaligned DMA is expensive
952 * on some architectures. An architecture can override this value,
953 * perhaps setting it to a cacheline in size (since that will maintain
954 * cacheline alignment of the DMA). It must be a power of 2.
955 *
956 * Various parts of the networking layer expect at least 16 bytes of
957 * headroom, you should not reduce this.
958 */
959#ifndef NET_SKB_PAD
960#define NET_SKB_PAD 16
961#endif
962
959extern int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc); 963extern int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc);
960 964
961static inline void __skb_trim(struct sk_buff *skb, unsigned int len) 965static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
@@ -1045,9 +1049,9 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1045static inline struct sk_buff *__dev_alloc_skb(unsigned int length, 1049static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1046 gfp_t gfp_mask) 1050 gfp_t gfp_mask)
1047{ 1051{
1048 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); 1052 struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
1049 if (likely(skb)) 1053 if (likely(skb))
1050 skb_reserve(skb, 16); 1054 skb_reserve(skb, NET_SKB_PAD);
1051 return skb; 1055 return skb;
1052} 1056}
1053#else 1057#else
@@ -1085,13 +1089,15 @@ static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1085 */ 1089 */
1086static inline int skb_cow(struct sk_buff *skb, unsigned int headroom) 1090static inline int skb_cow(struct sk_buff *skb, unsigned int headroom)
1087{ 1091{
1088 int delta = (headroom > 16 ? headroom : 16) - skb_headroom(skb); 1092 int delta = (headroom > NET_SKB_PAD ? headroom : NET_SKB_PAD) -
1093 skb_headroom(skb);
1089 1094
1090 if (delta < 0) 1095 if (delta < 0)
1091 delta = 0; 1096 delta = 0;
1092 1097
1093 if (delta || skb_cloned(skb)) 1098 if (delta || skb_cloned(skb))
1094 return pskb_expand_head(skb, (delta + 15) & ~15, 0, GFP_ATOMIC); 1099 return pskb_expand_head(skb, (delta + (NET_SKB_PAD-1)) &
1100 ~(NET_SKB_PAD-1), 0, GFP_ATOMIC);
1095 return 0; 1101 return 0;
1096} 1102}
1097 1103
@@ -1174,12 +1180,14 @@ static inline int skb_linearize(struct sk_buff *skb, gfp_t gfp)
1174 */ 1180 */
1175 1181
1176static inline void skb_postpull_rcsum(struct sk_buff *skb, 1182static inline void skb_postpull_rcsum(struct sk_buff *skb,
1177 const void *start, int len) 1183 const void *start, unsigned int len)
1178{ 1184{
1179 if (skb->ip_summed == CHECKSUM_HW) 1185 if (skb->ip_summed == CHECKSUM_HW)
1180 skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); 1186 skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0));
1181} 1187}
1182 1188
1189unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
1190
1183/** 1191/**
1184 * pskb_trim_rcsum - trim received skb and update checksum 1192 * pskb_trim_rcsum - trim received skb and update checksum
1185 * @skb: buffer to trim 1193 * @skb: buffer to trim
@@ -1351,16 +1359,6 @@ static inline void nf_conntrack_put_reasm(struct sk_buff *skb)
1351 kfree_skb(skb); 1359 kfree_skb(skb);
1352} 1360}
1353#endif 1361#endif
1354static inline void nf_reset(struct sk_buff *skb)
1355{
1356 nf_conntrack_put(skb->nfct);
1357 skb->nfct = NULL;
1358#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1359 nf_conntrack_put_reasm(skb->nfct_reasm);
1360 skb->nfct_reasm = NULL;
1361#endif
1362}
1363
1364#ifdef CONFIG_BRIDGE_NETFILTER 1362#ifdef CONFIG_BRIDGE_NETFILTER
1365static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) 1363static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
1366{ 1364{
@@ -1373,6 +1371,20 @@ static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
1373 atomic_inc(&nf_bridge->use); 1371 atomic_inc(&nf_bridge->use);
1374} 1372}
1375#endif /* CONFIG_BRIDGE_NETFILTER */ 1373#endif /* CONFIG_BRIDGE_NETFILTER */
1374static inline void nf_reset(struct sk_buff *skb)
1375{
1376 nf_conntrack_put(skb->nfct);
1377 skb->nfct = NULL;
1378#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1379 nf_conntrack_put_reasm(skb->nfct_reasm);
1380 skb->nfct_reasm = NULL;
1381#endif
1382#ifdef CONFIG_BRIDGE_NETFILTER
1383 nf_bridge_put(skb->nf_bridge);
1384 skb->nf_bridge = NULL;
1385#endif
1386}
1387
1376#else /* CONFIG_NETFILTER */ 1388#else /* CONFIG_NETFILTER */
1377static inline void nf_reset(struct sk_buff *skb) {} 1389static inline void nf_reset(struct sk_buff *skb) {}
1378#endif /* CONFIG_NETFILTER */ 1390#endif /* CONFIG_NETFILTER */
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 8cf52939d0ab..3af03b19c983 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -38,7 +38,6 @@ typedef struct kmem_cache kmem_cache_t;
38#define SLAB_DEBUG_INITIAL 0x00000200UL /* Call constructor (as verifier) */ 38#define SLAB_DEBUG_INITIAL 0x00000200UL /* Call constructor (as verifier) */
39#define SLAB_RED_ZONE 0x00000400UL /* Red zone objs in a cache */ 39#define SLAB_RED_ZONE 0x00000400UL /* Red zone objs in a cache */
40#define SLAB_POISON 0x00000800UL /* Poison objects */ 40#define SLAB_POISON 0x00000800UL /* Poison objects */
41#define SLAB_NO_REAP 0x00001000UL /* never reap from the cache */
42#define SLAB_HWCACHE_ALIGN 0x00002000UL /* align objs on a h/w cache lines */ 41#define SLAB_HWCACHE_ALIGN 0x00002000UL /* align objs on a h/w cache lines */
43#define SLAB_CACHE_DMA 0x00004000UL /* use GFP_DMA memory */ 42#define SLAB_CACHE_DMA 0x00004000UL /* use GFP_DMA memory */
44#define SLAB_MUST_HWCACHE_ALIGN 0x00008000UL /* force alignment */ 43#define SLAB_MUST_HWCACHE_ALIGN 0x00008000UL /* force alignment */
@@ -47,6 +46,7 @@ typedef struct kmem_cache kmem_cache_t;
47 what is reclaimable later*/ 46 what is reclaimable later*/
48#define SLAB_PANIC 0x00040000UL /* panic if kmem_cache_create() fails */ 47#define SLAB_PANIC 0x00040000UL /* panic if kmem_cache_create() fails */
49#define SLAB_DESTROY_BY_RCU 0x00080000UL /* defer freeing pages to RCU */ 48#define SLAB_DESTROY_BY_RCU 0x00080000UL /* defer freeing pages to RCU */
49#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */
50 50
51/* flags passed to a constructor func */ 51/* flags passed to a constructor func */
52#define SLAB_CTOR_CONSTRUCTOR 0x001UL /* if not set, then deconstructor */ 52#define SLAB_CTOR_CONSTRUCTOR 0x001UL /* if not set, then deconstructor */
@@ -64,6 +64,7 @@ extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned lo
64extern int kmem_cache_destroy(kmem_cache_t *); 64extern int kmem_cache_destroy(kmem_cache_t *);
65extern int kmem_cache_shrink(kmem_cache_t *); 65extern int kmem_cache_shrink(kmem_cache_t *);
66extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); 66extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t);
67extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
67extern void kmem_cache_free(kmem_cache_t *, void *); 68extern void kmem_cache_free(kmem_cache_t *, void *);
68extern unsigned int kmem_cache_size(kmem_cache_t *); 69extern unsigned int kmem_cache_size(kmem_cache_t *);
69extern const char *kmem_cache_name(kmem_cache_t *); 70extern const char *kmem_cache_name(kmem_cache_t *);
@@ -77,11 +78,12 @@ struct cache_sizes {
77}; 78};
78extern struct cache_sizes malloc_sizes[]; 79extern struct cache_sizes malloc_sizes[];
79 80
80#ifndef CONFIG_DEBUG_SLAB
81extern void *__kmalloc(size_t, gfp_t); 81extern void *__kmalloc(size_t, gfp_t);
82#ifndef CONFIG_DEBUG_SLAB
83#define ____kmalloc(size, flags) __kmalloc(size, flags)
82#else 84#else
83extern void *__kmalloc_track_caller(size_t, gfp_t, void*); 85extern void *__kmalloc_track_caller(size_t, gfp_t, void*);
84#define __kmalloc(size, flags) \ 86#define ____kmalloc(size, flags) \
85 __kmalloc_track_caller(size, flags, __builtin_return_address(0)) 87 __kmalloc_track_caller(size, flags, __builtin_return_address(0))
86#endif 88#endif
87 89
@@ -108,7 +110,30 @@ found:
108 return __kmalloc(size, flags); 110 return __kmalloc(size, flags);
109} 111}
110 112
111extern void *kzalloc(size_t, gfp_t); 113extern void *__kzalloc(size_t, gfp_t);
114
115static inline void *kzalloc(size_t size, gfp_t flags)
116{
117 if (__builtin_constant_p(size)) {
118 int i = 0;
119#define CACHE(x) \
120 if (size <= x) \
121 goto found; \
122 else \
123 i++;
124#include "kmalloc_sizes.h"
125#undef CACHE
126 {
127 extern void __you_cannot_kzalloc_that_much(void);
128 __you_cannot_kzalloc_that_much();
129 }
130found:
131 return kmem_cache_zalloc((flags & GFP_DMA) ?
132 malloc_sizes[i].cs_dmacachep :
133 malloc_sizes[i].cs_cachep, flags);
134 }
135 return __kzalloc(size, flags);
136}
112 137
113/** 138/**
114 * kcalloc - allocate memory for an array. The memory is set to zero. 139 * kcalloc - allocate memory for an array. The memory is set to zero.
@@ -118,7 +143,7 @@ extern void *kzalloc(size_t, gfp_t);
118 */ 143 */
119static inline void *kcalloc(size_t n, size_t size, gfp_t flags) 144static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
120{ 145{
121 if (n != 0 && size > INT_MAX / n) 146 if (n != 0 && size > ULONG_MAX / n)
122 return NULL; 147 return NULL;
123 return kzalloc(n * size, flags); 148 return kzalloc(n * size, flags);
124} 149}
@@ -155,17 +180,18 @@ struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t,
155 void (*)(void *, struct kmem_cache *, unsigned long)); 180 void (*)(void *, struct kmem_cache *, unsigned long));
156int kmem_cache_destroy(struct kmem_cache *c); 181int kmem_cache_destroy(struct kmem_cache *c);
157void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); 182void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags);
183void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
158void kmem_cache_free(struct kmem_cache *c, void *b); 184void kmem_cache_free(struct kmem_cache *c, void *b);
159const char *kmem_cache_name(struct kmem_cache *); 185const char *kmem_cache_name(struct kmem_cache *);
160void *kmalloc(size_t size, gfp_t flags); 186void *kmalloc(size_t size, gfp_t flags);
161void *kzalloc(size_t size, gfp_t flags); 187void *__kzalloc(size_t size, gfp_t flags);
162void kfree(const void *m); 188void kfree(const void *m);
163unsigned int ksize(const void *m); 189unsigned int ksize(const void *m);
164unsigned int kmem_cache_size(struct kmem_cache *c); 190unsigned int kmem_cache_size(struct kmem_cache *c);
165 191
166static inline void *kcalloc(size_t n, size_t size, gfp_t flags) 192static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
167{ 193{
168 return kzalloc(n * size, flags); 194 return __kzalloc(n * size, flags);
169} 195}
170 196
171#define kmem_cache_shrink(d) (0) 197#define kmem_cache_shrink(d) (0)
@@ -173,6 +199,8 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
173#define kmem_ptr_validate(a, b) (0) 199#define kmem_ptr_validate(a, b) (0)
174#define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f) 200#define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f)
175#define kmalloc_node(s, f, n) kmalloc(s, f) 201#define kmalloc_node(s, f, n) kmalloc(s, f)
202#define kzalloc(s, f) __kzalloc(s, f)
203#define ____kmalloc kmalloc
176 204
177#endif /* CONFIG_SLOB */ 205#endif /* CONFIG_SLOB */
178 206
@@ -182,7 +210,6 @@ extern kmem_cache_t *names_cachep;
182extern kmem_cache_t *files_cachep; 210extern kmem_cache_t *files_cachep;
183extern kmem_cache_t *filp_cachep; 211extern kmem_cache_t *filp_cachep;
184extern kmem_cache_t *fs_cachep; 212extern kmem_cache_t *fs_cachep;
185extern kmem_cache_t *signal_cachep;
186extern kmem_cache_t *sighand_cachep; 213extern kmem_cache_t *sighand_cachep;
187extern kmem_cache_t *bio_cachep; 214extern kmem_cache_t *bio_cachep;
188 215
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 44153fdf73fc..e2fa3ab4afc5 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -52,23 +52,12 @@ extern void smp_cpus_done(unsigned int max_cpus);
52/* 52/*
53 * Call a function on all other processors 53 * Call a function on all other processors
54 */ 54 */
55extern int smp_call_function (void (*func) (void *info), void *info, 55int smp_call_function(void(*func)(void *info), void *info, int retry, int wait);
56 int retry, int wait);
57 56
58/* 57/*
59 * Call a function on all processors 58 * Call a function on all processors
60 */ 59 */
61static inline int on_each_cpu(void (*func) (void *info), void *info, 60int on_each_cpu(void (*func) (void *info), void *info, int retry, int wait);
62 int retry, int wait)
63{
64 int ret = 0;
65
66 preempt_disable();
67 ret = smp_call_function(func, info, retry, wait);
68 func(info);
69 preempt_enable();
70 return ret;
71}
72 61
73#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */ 62#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */
74#define MSG_ALL 0x8001 63#define MSG_ALL 0x8001
@@ -93,8 +82,18 @@ void smp_prepare_boot_cpu(void);
93 */ 82 */
94#define raw_smp_processor_id() 0 83#define raw_smp_processor_id() 0
95#define hard_smp_processor_id() 0 84#define hard_smp_processor_id() 0
96#define smp_call_function(func,info,retry,wait) ({ 0; }) 85static inline int up_smp_call_function(void)
97#define on_each_cpu(func,info,retry,wait) ({ func(info); 0; }) 86{
87 return 0;
88}
89#define smp_call_function(func,info,retry,wait) (up_smp_call_function())
90#define on_each_cpu(func,info,retry,wait) \
91 ({ \
92 local_irq_disable(); \
93 func(info); \
94 local_irq_enable(); \
95 0; \
96 })
98static inline void smp_send_reschedule(int cpu) { } 97static inline void smp_send_reschedule(int cpu) { }
99#define num_booting_cpus() 1 98#define num_booting_cpus() 1
100#define smp_prepare_boot_cpu() do {} while (0) 99#define smp_prepare_boot_cpu() do {} while (0)
diff --git a/include/linux/socket.h b/include/linux/socket.h
index b02dda4ee83d..9ab2ddd80221 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -150,6 +150,7 @@ __KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__
150 150
151#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */ 151#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */
152#define SCM_CREDENTIALS 0x02 /* rw: struct ucred */ 152#define SCM_CREDENTIALS 0x02 /* rw: struct ucred */
153#define SCM_SECURITY 0x03 /* rw: security label */
153 154
154struct ucred { 155struct ucred {
155 __u32 pid; 156 __u32 pid;
diff --git a/include/linux/sound.h b/include/linux/sound.h
index 72b9af4c3fd4..f63d8342ffa3 100644
--- a/include/linux/sound.h
+++ b/include/linux/sound.h
@@ -30,12 +30,12 @@
30 */ 30 */
31 31
32struct device; 32struct device;
33extern int register_sound_special(struct file_operations *fops, int unit); 33extern int register_sound_special(const struct file_operations *fops, int unit);
34extern int register_sound_special_device(struct file_operations *fops, int unit, struct device *dev); 34extern int register_sound_special_device(const struct file_operations *fops, int unit, struct device *dev);
35extern int register_sound_mixer(struct file_operations *fops, int dev); 35extern int register_sound_mixer(const struct file_operations *fops, int dev);
36extern int register_sound_midi(struct file_operations *fops, int dev); 36extern int register_sound_midi(const struct file_operations *fops, int dev);
37extern int register_sound_dsp(struct file_operations *fops, int dev); 37extern int register_sound_dsp(const struct file_operations *fops, int dev);
38extern int register_sound_synth(struct file_operations *fops, int dev); 38extern int register_sound_synth(const struct file_operations *fops, int dev);
39 39
40extern void unregister_sound_special(int unit); 40extern void unregister_sound_special(int unit);
41extern void unregister_sound_mixer(int unit); 41extern void unregister_sound_mixer(int unit);
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 8ff2a122dfef..8669291352db 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -69,7 +69,7 @@ struct kstat {
69 struct timespec mtime; 69 struct timespec mtime;
70 struct timespec ctime; 70 struct timespec ctime;
71 unsigned long blksize; 71 unsigned long blksize;
72 unsigned long blocks; 72 unsigned long long blocks;
73}; 73};
74 74
75#endif 75#endif
diff --git a/include/linux/statfs.h b/include/linux/statfs.h
index ad83a2bdb821..b34cc829f98d 100644
--- a/include/linux/statfs.h
+++ b/include/linux/statfs.h
@@ -8,11 +8,11 @@
8struct kstatfs { 8struct kstatfs {
9 long f_type; 9 long f_type;
10 long f_bsize; 10 long f_bsize;
11 sector_t f_blocks; 11 u64 f_blocks;
12 sector_t f_bfree; 12 u64 f_bfree;
13 sector_t f_bavail; 13 u64 f_bavail;
14 sector_t f_files; 14 u64 f_files;
15 sector_t f_ffree; 15 u64 f_ffree;
16 __kernel_fsid_t f_fsid; 16 __kernel_fsid_t f_fsid;
17 long f_namelen; 17 long f_namelen;
18 long f_frsize; 18 long f_frsize;
diff --git a/include/linux/string.h b/include/linux/string.h
index 369be3264a55..dee221429ad0 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -18,6 +18,8 @@ extern char * strsep(char **,const char *);
18extern __kernel_size_t strspn(const char *,const char *); 18extern __kernel_size_t strspn(const char *,const char *);
19extern __kernel_size_t strcspn(const char *,const char *); 19extern __kernel_size_t strcspn(const char *,const char *);
20 20
21extern char *strndup_user(const char __user *, long);
22
21/* 23/*
22 * Include machine specific inline routines 24 * Include machine specific inline routines
23 */ 25 */
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index c4e3ea7cf154..b5612c958cce 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -50,7 +50,7 @@ struct cache_head {
50 time_t last_refresh; /* If CACHE_PENDING, this is when upcall 50 time_t last_refresh; /* If CACHE_PENDING, this is when upcall
51 * was sent, else this is when update was received 51 * was sent, else this is when update was received
52 */ 52 */
53 atomic_t refcnt; 53 struct kref ref;
54 unsigned long flags; 54 unsigned long flags;
55}; 55};
56#define CACHE_VALID 0 /* Entry contains valid data */ 56#define CACHE_VALID 0 /* Entry contains valid data */
@@ -68,8 +68,7 @@ struct cache_detail {
68 atomic_t inuse; /* active user-space update or lookup */ 68 atomic_t inuse; /* active user-space update or lookup */
69 69
70 char *name; 70 char *name;
71 void (*cache_put)(struct cache_head *, 71 void (*cache_put)(struct kref *);
72 struct cache_detail*);
73 72
74 void (*cache_request)(struct cache_detail *cd, 73 void (*cache_request)(struct cache_detail *cd,
75 struct cache_head *h, 74 struct cache_head *h,
@@ -81,6 +80,11 @@ struct cache_detail {
81 struct cache_detail *cd, 80 struct cache_detail *cd,
82 struct cache_head *h); 81 struct cache_head *h);
83 82
83 struct cache_head * (*alloc)(void);
84 int (*match)(struct cache_head *orig, struct cache_head *new);
85 void (*init)(struct cache_head *orig, struct cache_head *new);
86 void (*update)(struct cache_head *orig, struct cache_head *new);
87
84 /* fields below this comment are for internal use 88 /* fields below this comment are for internal use
85 * and should not be touched by cache owners 89 * and should not be touched by cache owners
86 */ 90 */
@@ -123,126 +127,14 @@ struct cache_deferred_req {
123 int too_many); 127 int too_many);
124}; 128};
125 129
126/*
127 * just like a template in C++, this macro does cache lookup
128 * for us.
129 * The function is passed some sort of HANDLE from which a cache_detail
130 * structure can be determined (via SETUP, DETAIL), a template
131 * cache entry (type RTN*), and a "set" flag. Using the HASHFN and the
132 * TEST, the function will try to find a matching cache entry in the cache.
133 * If "set" == 0 :
134 * If an entry is found, it is returned
135 * If no entry is found, a new non-VALID entry is created.
136 * If "set" == 1 and INPLACE == 0 :
137 * If no entry is found a new one is inserted with data from "template"
138 * If a non-CACHE_VALID entry is found, it is updated from template using UPDATE
139 * If a CACHE_VALID entry is found, a new entry is swapped in with data
140 * from "template"
141 * If set == 1, and INPLACE == 1 :
142 * As above, except that if a CACHE_VALID entry is found, we UPDATE in place
143 * instead of swapping in a new entry.
144 *
145 * If the passed handle has the CACHE_NEGATIVE flag set, then UPDATE is not
146 * run but insteead CACHE_NEGATIVE is set in any new item.
147 130
148 * In any case, the new entry is returned with a reference count. 131extern struct cache_head *
149 * 132sunrpc_cache_lookup(struct cache_detail *detail,
150 * 133 struct cache_head *key, int hash);
151 * RTN is a struct type for a cache entry 134extern struct cache_head *
152 * MEMBER is the member of the cache which is cache_head, which must be first 135sunrpc_cache_update(struct cache_detail *detail,
153 * FNAME is the name for the function 136 struct cache_head *new, struct cache_head *old, int hash);
154 * ARGS are arguments to function and must contain RTN *item, int set. May
155 * also contain something to be usedby SETUP or DETAIL to find cache_detail.
156 * SETUP locates the cache detail and makes it available as...
157 * DETAIL identifies the cache detail, possibly set up by SETUP
158 * HASHFN returns a hash value of the cache entry "item"
159 * TEST tests if "tmp" matches "item"
160 * INIT copies key information from "item" to "new"
161 * UPDATE copies content information from "item" to "tmp"
162 * INPLACE is true if updates can happen inplace rather than allocating a new structure
163 *
164 * WARNING: any substantial changes to this must be reflected in
165 * net/sunrpc/svcauth.c(auth_domain_lookup)
166 * which is a similar routine that is open-coded.
167 */
168#define DefineCacheLookup(RTN,MEMBER,FNAME,ARGS,SETUP,DETAIL,HASHFN,TEST,INIT,UPDATE,INPLACE) \
169RTN *FNAME ARGS \
170{ \
171 RTN *tmp, *new=NULL; \
172 struct cache_head **hp, **head; \
173 SETUP; \
174 head = &(DETAIL)->hash_table[HASHFN]; \
175 retry: \
176 if (set||new) write_lock(&(DETAIL)->hash_lock); \
177 else read_lock(&(DETAIL)->hash_lock); \
178 for(hp=head; *hp != NULL; hp = &tmp->MEMBER.next) { \
179 tmp = container_of(*hp, RTN, MEMBER); \
180 if (TEST) { /* found a match */ \
181 \
182 if (set && !INPLACE && test_bit(CACHE_VALID, &tmp->MEMBER.flags) && !new) \
183 break; \
184 \
185 if (new) \
186 {INIT;} \
187 if (set) { \
188 if (!INPLACE && test_bit(CACHE_VALID, &tmp->MEMBER.flags))\
189 { /* need to swap in new */ \
190 RTN *t2; \
191 \
192 new->MEMBER.next = tmp->MEMBER.next; \
193 *hp = &new->MEMBER; \
194 tmp->MEMBER.next = NULL; \
195 t2 = tmp; tmp = new; new = t2; \
196 } \
197 if (test_bit(CACHE_NEGATIVE, &item->MEMBER.flags)) \
198 set_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags); \
199 else { \
200 UPDATE; \
201 clear_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags); \
202 } \
203 } \
204 cache_get(&tmp->MEMBER); \
205 if (set||new) write_unlock(&(DETAIL)->hash_lock); \
206 else read_unlock(&(DETAIL)->hash_lock); \
207 if (set) \
208 cache_fresh(DETAIL, &tmp->MEMBER, item->MEMBER.expiry_time); \
209 if (set && !INPLACE && new) cache_fresh(DETAIL, &new->MEMBER, 0); \
210 if (new) (DETAIL)->cache_put(&new->MEMBER, DETAIL); \
211 return tmp; \
212 } \
213 } \
214 /* Didn't find anything */ \
215 if (new) { \
216 INIT; \
217 new->MEMBER.next = *head; \
218 *head = &new->MEMBER; \
219 (DETAIL)->entries ++; \
220 cache_get(&new->MEMBER); \
221 if (set) { \
222 tmp = new; \
223 if (test_bit(CACHE_NEGATIVE, &item->MEMBER.flags)) \
224 set_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags); \
225 else {UPDATE;} \
226 } \
227 } \
228 if (set||new) write_unlock(&(DETAIL)->hash_lock); \
229 else read_unlock(&(DETAIL)->hash_lock); \
230 if (new && set) \
231 cache_fresh(DETAIL, &new->MEMBER, item->MEMBER.expiry_time); \
232 if (new) \
233 return new; \
234 new = kmalloc(sizeof(*new), GFP_KERNEL); \
235 if (new) { \
236 cache_init(&new->MEMBER); \
237 goto retry; \
238 } \
239 return NULL; \
240}
241 137
242#define DefineSimpleCacheLookup(STRUCT,INPLACE) \
243 DefineCacheLookup(struct STRUCT, h, STRUCT##_lookup, (struct STRUCT *item, int set), /*no setup */, \
244 & STRUCT##_cache, STRUCT##_hash(item), STRUCT##_match(item, tmp),\
245 STRUCT##_init(new, item), STRUCT##_update(tmp, item),INPLACE)
246 138
247#define cache_for_each(pos, detail, index, member) \ 139#define cache_for_each(pos, detail, index, member) \
248 for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) ; \ 140 for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) ; \
@@ -258,22 +150,19 @@ extern void cache_clean_deferred(void *owner);
258 150
259static inline struct cache_head *cache_get(struct cache_head *h) 151static inline struct cache_head *cache_get(struct cache_head *h)
260{ 152{
261 atomic_inc(&h->refcnt); 153 kref_get(&h->ref);
262 return h; 154 return h;
263} 155}
264 156
265 157
266static inline int cache_put(struct cache_head *h, struct cache_detail *cd) 158static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
267{ 159{
268 if (atomic_read(&h->refcnt) <= 2 && 160 if (atomic_read(&h->ref.refcount) <= 2 &&
269 h->expiry_time < cd->nextcheck) 161 h->expiry_time < cd->nextcheck)
270 cd->nextcheck = h->expiry_time; 162 cd->nextcheck = h->expiry_time;
271 return atomic_dec_and_test(&h->refcnt); 163 kref_put(&h->ref, cd->cache_put);
272} 164}
273 165
274extern void cache_init(struct cache_head *h);
275extern void cache_fresh(struct cache_detail *detail,
276 struct cache_head *head, time_t expiry);
277extern int cache_check(struct cache_detail *detail, 166extern int cache_check(struct cache_detail *detail,
278 struct cache_head *h, struct cache_req *rqstp); 167 struct cache_head *h, struct cache_req *rqstp);
279extern void cache_flush(void); 168extern void cache_flush(void);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index f147e6b84332..8fe9f35eba31 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -45,7 +45,8 @@ struct rpc_clnt {
45 char * cl_server; /* server machine name */ 45 char * cl_server; /* server machine name */
46 char * cl_protname; /* protocol name */ 46 char * cl_protname; /* protocol name */
47 struct rpc_auth * cl_auth; /* authenticator */ 47 struct rpc_auth * cl_auth; /* authenticator */
48 struct rpc_stat * cl_stats; /* statistics */ 48 struct rpc_stat * cl_stats; /* per-program statistics */
49 struct rpc_iostats * cl_metrics; /* per-client statistics */
49 50
50 unsigned int cl_softrtry : 1,/* soft timeouts */ 51 unsigned int cl_softrtry : 1,/* soft timeouts */
51 cl_intr : 1,/* interruptible */ 52 cl_intr : 1,/* interruptible */
@@ -59,6 +60,7 @@ struct rpc_clnt {
59 int cl_nodelen; /* nodename length */ 60 int cl_nodelen; /* nodename length */
60 char cl_nodename[UNX_MAXNODENAME]; 61 char cl_nodename[UNX_MAXNODENAME];
61 char cl_pathname[30];/* Path in rpc_pipe_fs */ 62 char cl_pathname[30];/* Path in rpc_pipe_fs */
63 struct vfsmount * cl_vfsmnt;
62 struct dentry * cl_dentry; /* inode */ 64 struct dentry * cl_dentry; /* inode */
63 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 65 struct rpc_clnt * cl_parent; /* Points to parent of clones */
64 struct rpc_rtt cl_rtt_default; 66 struct rpc_rtt cl_rtt_default;
@@ -100,6 +102,8 @@ struct rpc_procinfo {
100 unsigned int p_bufsiz; /* req. buffer size */ 102 unsigned int p_bufsiz; /* req. buffer size */
101 unsigned int p_count; /* call count */ 103 unsigned int p_count; /* call count */
102 unsigned int p_timer; /* Which RTT timer to use */ 104 unsigned int p_timer; /* Which RTT timer to use */
105 u32 p_statidx; /* Which procedure to account */
106 char * p_name; /* name of procedure */
103}; 107};
104 108
105#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt)) 109#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt))
@@ -137,20 +141,6 @@ size_t rpc_max_payload(struct rpc_clnt *);
137void rpc_force_rebind(struct rpc_clnt *); 141void rpc_force_rebind(struct rpc_clnt *);
138int rpc_ping(struct rpc_clnt *clnt, int flags); 142int rpc_ping(struct rpc_clnt *clnt, int flags);
139 143
140static __inline__
141int rpc_call(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, int flags)
142{
143 struct rpc_message msg = {
144 .rpc_proc = &clnt->cl_procinfo[proc],
145 .rpc_argp = argp,
146 .rpc_resp = resp,
147 .rpc_cred = NULL
148 };
149 return rpc_call_sync(clnt, &msg, flags);
150}
151
152extern void rpciod_wake_up(void);
153
154/* 144/*
155 * Helper function for NFSroot support 145 * Helper function for NFSroot support
156 */ 146 */
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index 2c3601d31045..1279280d7196 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -53,6 +53,8 @@ struct krb5_ctx {
53 struct xdr_netobj mech_used; 53 struct xdr_netobj mech_used;
54}; 54};
55 55
56extern spinlock_t krb5_seq_lock;
57
56#define KG_TOK_MIC_MSG 0x0101 58#define KG_TOK_MIC_MSG 0x0101
57#define KG_TOK_WRAP_MSG 0x0201 59#define KG_TOK_WRAP_MSG 0x0201
58 60
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
new file mode 100644
index 000000000000..8f96e9dc369a
--- /dev/null
+++ b/include/linux/sunrpc/metrics.h
@@ -0,0 +1,77 @@
1/*
2 * linux/include/linux/sunrpc/metrics.h
3 *
4 * Declarations for RPC client per-operation metrics
5 *
6 * Copyright (C) 2005 Chuck Lever <cel@netapp.com>
7 *
8 * RPC client per-operation statistics provide latency and retry
9 * information about each type of RPC procedure in a given RPC program.
10 * These statistics are not for detailed problem diagnosis, but simply
11 * to indicate whether the problem is local or remote.
12 *
13 * These counters are not meant to be human-readable, but are meant to be
14 * integrated into system monitoring tools such as "sar" and "iostat". As
15 * such, the counters are sampled by the tools over time, and are never
16 * zeroed after a file system is mounted. Moving averages can be computed
17 * by the tools by taking the difference between two instantaneous samples
18 * and dividing that by the time between the samples.
19 *
20 * The counters are maintained in a single array per RPC client, indexed
21 * by procedure number. There is no need to maintain separate counter
22 * arrays per-CPU because these counters are always modified behind locks.
23 */
24
25#ifndef _LINUX_SUNRPC_METRICS_H
26#define _LINUX_SUNRPC_METRICS_H
27
28#include <linux/seq_file.h>
29
30#define RPC_IOSTATS_VERS "1.0"
31
32struct rpc_iostats {
33 /*
34 * These counters give an idea about how many request
35 * transmissions are required, on average, to complete that
36 * particular procedure. Some procedures may require more
37 * than one transmission because the server is unresponsive,
38 * the client is retransmitting too aggressively, or the
39 * requests are large and the network is congested.
40 */
41 unsigned long om_ops, /* count of operations */
42 om_ntrans, /* count of RPC transmissions */
43 om_timeouts; /* count of major timeouts */
44
45 /*
46 * These count how many bytes are sent and received for a
47 * given RPC procedure type. This indicates how much load a
48 * particular procedure is putting on the network. These
49 * counts include the RPC and ULP headers, and the request
50 * payload.
51 */
52 unsigned long long om_bytes_sent, /* count of bytes out */
53 om_bytes_recv; /* count of bytes in */
54
55 /*
56 * The length of time an RPC request waits in queue before
57 * transmission, the network + server latency of the request,
58 * and the total time the request spent from init to release
59 * are measured.
60 */
61 unsigned long long om_queue, /* jiffies queued for xmit */
62 om_rtt, /* jiffies for RPC RTT */
63 om_execute; /* jiffies for RPC execution */
64} ____cacheline_aligned;
65
66struct rpc_task;
67struct rpc_clnt;
68
69/*
70 * EXPORTed functions for managing rpc_iostats structures
71 */
72struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *);
73void rpc_count_iostats(struct rpc_task *);
74void rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
75void rpc_free_iostats(struct rpc_iostats *);
76
77#endif /* _LINUX_SUNRPC_METRICS_H */
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 63929349571f..2c2189cb30aa 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -45,6 +45,8 @@ extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *);
45extern int rpc_rmdir(char *); 45extern int rpc_rmdir(char *);
46extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags); 46extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags);
47extern int rpc_unlink(char *); 47extern int rpc_unlink(char *);
48extern struct vfsmount *rpc_get_mount(void);
49extern void rpc_put_mount(void);
48 50
49#endif 51#endif
50#endif 52#endif
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 8b25629accd8..82a91bb22362 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -86,6 +86,12 @@ struct rpc_task {
86 struct work_struct tk_work; /* Async task work queue */ 86 struct work_struct tk_work; /* Async task work queue */
87 struct rpc_wait tk_wait; /* RPC wait */ 87 struct rpc_wait tk_wait; /* RPC wait */
88 } u; 88 } u;
89
90 unsigned short tk_timeouts; /* maj timeouts */
91 size_t tk_bytes_sent; /* total bytes sent */
92 unsigned long tk_start; /* RPC task init timestamp */
93 long tk_rtt; /* round-trip time (jiffies) */
94
89#ifdef RPC_DEBUG 95#ifdef RPC_DEBUG
90 unsigned short tk_pid; /* debugging aid */ 96 unsigned short tk_pid; /* debugging aid */
91#endif 97#endif
@@ -203,6 +209,7 @@ struct rpc_wait_queue {
203 unsigned char priority; /* current priority */ 209 unsigned char priority; /* current priority */
204 unsigned char count; /* # task groups remaining serviced so far */ 210 unsigned char count; /* # task groups remaining serviced so far */
205 unsigned char nr; /* # tasks remaining for cookie */ 211 unsigned char nr; /* # tasks remaining for cookie */
212 unsigned short qlen; /* total # tasks waiting in queue */
206#ifdef RPC_DEBUG 213#ifdef RPC_DEBUG
207 const char * name; 214 const char * name;
208#endif 215#endif
@@ -269,13 +276,13 @@ void * rpc_malloc(struct rpc_task *, size_t);
269void rpc_free(struct rpc_task *); 276void rpc_free(struct rpc_task *);
270int rpciod_up(void); 277int rpciod_up(void);
271void rpciod_down(void); 278void rpciod_down(void);
272void rpciod_wake_up(void);
273int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); 279int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *));
274#ifdef RPC_DEBUG 280#ifdef RPC_DEBUG
275void rpc_show_tasks(void); 281void rpc_show_tasks(void);
276#endif 282#endif
277int rpc_init_mempool(void); 283int rpc_init_mempool(void);
278void rpc_destroy_mempool(void); 284void rpc_destroy_mempool(void);
285extern struct workqueue_struct *rpciod_workqueue;
279 286
280static inline void rpc_exit(struct rpc_task *task, int status) 287static inline void rpc_exit(struct rpc_task *task, int status)
281{ 288{
diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h
index 0d6ed3c8bdc4..d93c24b47f3f 100644
--- a/include/linux/sunrpc/stats.h
+++ b/include/linux/sunrpc/stats.h
@@ -50,7 +50,7 @@ struct proc_dir_entry * rpc_proc_register(struct rpc_stat *);
50void rpc_proc_unregister(const char *); 50void rpc_proc_unregister(const char *);
51void rpc_proc_zero(struct rpc_program *); 51void rpc_proc_zero(struct rpc_program *);
52struct proc_dir_entry * svc_proc_register(struct svc_stat *, 52struct proc_dir_entry * svc_proc_register(struct svc_stat *,
53 struct file_operations *); 53 const struct file_operations *);
54void svc_proc_unregister(const char *); 54void svc_proc_unregister(const char *);
55 55
56void svc_seq_show(struct seq_file *, 56void svc_seq_show(struct seq_file *,
@@ -65,7 +65,7 @@ static inline void rpc_proc_unregister(const char *p) {}
65static inline void rpc_proc_zero(struct rpc_program *p) {} 65static inline void rpc_proc_zero(struct rpc_program *p) {}
66 66
67static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s, 67static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s,
68 struct file_operations *f) { return NULL; } 68 const struct file_operations *f) { return NULL; }
69static inline void svc_proc_unregister(const char *p) {} 69static inline void svc_proc_unregister(const char *p) {}
70 70
71static inline void svc_seq_show(struct seq_file *seq, 71static inline void svc_seq_show(struct seq_file *seq,
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index c119ce7cbd22..2fe2087edd66 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -45,9 +45,10 @@ struct svc_rqst; /* forward decl */
45 * of ip addresses to the given client. 45 * of ip addresses to the given client.
46 */ 46 */
47struct auth_domain { 47struct auth_domain {
48 struct cache_head h; 48 struct kref ref;
49 struct hlist_node hash;
49 char *name; 50 char *name;
50 int flavour; 51 struct auth_ops *flavour;
51}; 52};
52 53
53/* 54/*
@@ -86,6 +87,9 @@ struct auth_domain {
86 * 87 *
87 * domain_release() 88 * domain_release()
88 * This call releases a domain. 89 * This call releases a domain.
90 * set_client()
91 * Givens a pending request (struct svc_rqst), finds and assigns
92 * an appropriate 'auth_domain' as the client.
89 */ 93 */
90struct auth_ops { 94struct auth_ops {
91 char * name; 95 char * name;
@@ -117,7 +121,7 @@ extern void svc_auth_unregister(rpc_authflavor_t flavor);
117extern struct auth_domain *unix_domain_find(char *name); 121extern struct auth_domain *unix_domain_find(char *name);
118extern void auth_domain_put(struct auth_domain *item); 122extern void auth_domain_put(struct auth_domain *item);
119extern int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom); 123extern int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom);
120extern struct auth_domain *auth_domain_lookup(struct auth_domain *item, int set); 124extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new);
121extern struct auth_domain *auth_domain_find(char *name); 125extern struct auth_domain *auth_domain_find(char *name);
122extern struct auth_domain *auth_unix_lookup(struct in_addr addr); 126extern struct auth_domain *auth_unix_lookup(struct in_addr addr);
123extern int auth_unix_forget_old(struct auth_domain *dom); 127extern int auth_unix_forget_old(struct auth_domain *dom);
@@ -160,8 +164,6 @@ static inline unsigned long hash_mem(char *buf, int length, int bits)
160 return hash >> (BITS_PER_LONG - bits); 164 return hash >> (BITS_PER_LONG - bits);
161} 165}
162 166
163extern struct cache_detail auth_domain_cache, ip_map_cache;
164
165#endif /* __KERNEL__ */ 167#endif /* __KERNEL__ */
166 168
167#endif /* _LINUX_SUNRPC_SVCAUTH_H_ */ 169#endif /* _LINUX_SUNRPC_SVCAUTH_H_ */
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index d33c6face032..b4acb3d37c3f 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -36,7 +36,7 @@ struct svc_sock {
36 36
37 struct list_head sk_deferred; /* deferred requests that need to 37 struct list_head sk_deferred; /* deferred requests that need to
38 * be revisted */ 38 * be revisted */
39 struct semaphore sk_sem; /* to serialize sending data */ 39 struct mutex sk_mutex; /* to serialize sending data */
40 40
41 int (*sk_recvfrom)(struct svc_rqst *rqstp); 41 int (*sk_recvfrom)(struct svc_rqst *rqstp);
42 int (*sk_sendto)(struct svc_rqst *rqstp); 42 int (*sk_sendto)(struct svc_rqst *rqstp);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 6ef99b14ff09..7eebbab7160b 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -114,6 +114,7 @@ struct rpc_xprt_ops {
114 void (*release_request)(struct rpc_task *task); 114 void (*release_request)(struct rpc_task *task);
115 void (*close)(struct rpc_xprt *xprt); 115 void (*close)(struct rpc_xprt *xprt);
116 void (*destroy)(struct rpc_xprt *xprt); 116 void (*destroy)(struct rpc_xprt *xprt);
117 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq);
117}; 118};
118 119
119struct rpc_xprt { 120struct rpc_xprt {
@@ -187,6 +188,18 @@ struct rpc_xprt {
187 188
188 struct list_head recv; 189 struct list_head recv;
189 190
191 struct {
192 unsigned long bind_count, /* total number of binds */
193 connect_count, /* total number of connects */
194 connect_start, /* connect start timestamp */
195 connect_time, /* jiffies waiting for connect */
196 sends, /* how many complete requests */
197 recvs, /* how many complete requests */
198 bad_xids; /* lookup_rqst didn't find XID */
199
200 unsigned long long req_u, /* average requests on the wire */
201 bklog_u; /* backlog queue utilization */
202 } stat;
190 203
191 void (*old_data_ready)(struct sock *, int); 204 void (*old_data_ready)(struct sock *, int);
192 void (*old_state_change)(struct sock *); 205 void (*old_state_change)(struct sock *);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index d572b19afb7d..54eac8a39a4c 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -172,9 +172,24 @@ extern int rotate_reclaimable_page(struct page *page);
172extern void swap_setup(void); 172extern void swap_setup(void);
173 173
174/* linux/mm/vmscan.c */ 174/* linux/mm/vmscan.c */
175extern int try_to_free_pages(struct zone **, gfp_t); 175extern unsigned long try_to_free_pages(struct zone **, gfp_t);
176extern int shrink_all_memory(int); 176extern unsigned long shrink_all_memory(unsigned long nr_pages);
177extern int vm_swappiness; 177extern int vm_swappiness;
178extern int remove_mapping(struct address_space *mapping, struct page *page);
179
180/* possible outcome of pageout() */
181typedef enum {
182 /* failed to write page out, page is locked */
183 PAGE_KEEP,
184 /* move page to the active list, page is locked */
185 PAGE_ACTIVATE,
186 /* page has been sent to the disk successfully, page is unlocked */
187 PAGE_SUCCESS,
188 /* page is clean and locked */
189 PAGE_CLEAN,
190} pageout_t;
191
192extern pageout_t pageout(struct page *page, struct address_space *mapping);
178 193
179#ifdef CONFIG_NUMA 194#ifdef CONFIG_NUMA
180extern int zone_reclaim_mode; 195extern int zone_reclaim_mode;
@@ -188,25 +203,6 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
188} 203}
189#endif 204#endif
190 205
191#ifdef CONFIG_MIGRATION
192extern int isolate_lru_page(struct page *p);
193extern int putback_lru_pages(struct list_head *l);
194extern int migrate_page(struct page *, struct page *);
195extern void migrate_page_copy(struct page *, struct page *);
196extern int migrate_page_remove_references(struct page *, struct page *, int);
197extern int migrate_pages(struct list_head *l, struct list_head *t,
198 struct list_head *moved, struct list_head *failed);
199extern int fail_migrate_page(struct page *, struct page *);
200#else
201static inline int isolate_lru_page(struct page *p) { return -ENOSYS; }
202static inline int putback_lru_pages(struct list_head *l) { return 0; }
203static inline int migrate_pages(struct list_head *l, struct list_head *t,
204 struct list_head *moved, struct list_head *failed) { return -ENOSYS; }
205/* Possible settings for the migrate_page() method in address_operations */
206#define migrate_page NULL
207#define fail_migrate_page NULL
208#endif
209
210#ifdef CONFIG_MMU 206#ifdef CONFIG_MMU
211/* linux/mm/shmem.c */ 207/* linux/mm/shmem.c */
212extern int shmem_unuse(swp_entry_t entry, struct page *page); 208extern int shmem_unuse(swp_entry_t entry, struct page *page);
@@ -238,14 +234,15 @@ extern struct page * read_swap_cache_async(swp_entry_t, struct vm_area_struct *v
238/* linux/mm/swapfile.c */ 234/* linux/mm/swapfile.c */
239extern long total_swap_pages; 235extern long total_swap_pages;
240extern unsigned int nr_swapfiles; 236extern unsigned int nr_swapfiles;
241extern struct swap_info_struct swap_info[];
242extern void si_swapinfo(struct sysinfo *); 237extern void si_swapinfo(struct sysinfo *);
243extern swp_entry_t get_swap_page(void); 238extern swp_entry_t get_swap_page(void);
244extern swp_entry_t get_swap_page_of_type(int type); 239extern swp_entry_t get_swap_page_of_type(int);
245extern int swap_duplicate(swp_entry_t); 240extern int swap_duplicate(swp_entry_t);
246extern int valid_swaphandles(swp_entry_t, unsigned long *); 241extern int valid_swaphandles(swp_entry_t, unsigned long *);
247extern void swap_free(swp_entry_t); 242extern void swap_free(swp_entry_t);
248extern void free_swap_and_cache(swp_entry_t); 243extern void free_swap_and_cache(swp_entry_t);
244extern int swap_type_of(dev_t);
245extern unsigned int count_swap_pages(int, int);
249extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); 246extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t);
250extern struct swap_info_struct *get_swap_info_struct(unsigned); 247extern struct swap_info_struct *get_swap_info_struct(unsigned);
251extern int can_share_swap_page(struct page *); 248extern int can_share_swap_page(struct page *);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 1b7cd8d1a71b..2993302f7923 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * SyncLink Multiprotocol Serial Adapter Driver 2 * SyncLink Multiprotocol Serial Adapter Driver
3 * 3 *
4 * $Id: synclink.h,v 3.10 2005/11/08 19:50:54 paulkf Exp $ 4 * $Id: synclink.h,v 3.11 2006/02/06 21:20:29 paulkf Exp $
5 * 5 *
6 * Copyright (C) 1998-2000 by Microgate Corporation 6 * Copyright (C) 1998-2000 by Microgate Corporation
7 * 7 *
@@ -221,6 +221,12 @@ struct mgsl_icount {
221 __u32 rxidle; 221 __u32 rxidle;
222}; 222};
223 223
224struct gpio_desc {
225 __u32 state;
226 __u32 smask;
227 __u32 dir;
228 __u32 dmask;
229};
224 230
225#define DEBUG_LEVEL_DATA 1 231#define DEBUG_LEVEL_DATA 1
226#define DEBUG_LEVEL_ERROR 2 232#define DEBUG_LEVEL_ERROR 2
@@ -276,5 +282,8 @@ struct mgsl_icount {
276#define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9) 282#define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9)
277#define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10) 283#define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10)
278#define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11) 284#define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11)
285#define MGSL_IOCSGPIO _IOW(MGSL_MAGIC_IOC,16,struct gpio_desc)
286#define MGSL_IOCGGPIO _IOR(MGSL_MAGIC_IOC,17,struct gpio_desc)
287#define MGSL_IOCWAITGPIO _IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc)
279 288
280#endif /* _SYNCLINK_H_ */ 289#endif /* _SYNCLINK_H_ */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index b9ea44ac0ddb..5717147596b6 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -568,5 +568,10 @@ asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
568 int flag); 568 int flag);
569asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 569asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
570 int flags, int mode); 570 int flags, int mode);
571asmlinkage long sys_unshare(unsigned long unshare_flags);
572asmlinkage long sys_splice(int fdin, int fdout, size_t len,
573 unsigned int flags);
574asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
575 int flags);
571 576
572#endif 577#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index bac61db26456..76eaeff76f82 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -211,6 +211,7 @@ enum
211 NET_SCTP=17, 211 NET_SCTP=17,
212 NET_LLC=18, 212 NET_LLC=18,
213 NET_NETFILTER=19, 213 NET_NETFILTER=19,
214 NET_DCCP=20,
214}; 215};
215 216
216/* /proc/sys/kernel/random */ 217/* /proc/sys/kernel/random */
@@ -261,6 +262,8 @@ enum
261 NET_CORE_DEV_WEIGHT=17, 262 NET_CORE_DEV_WEIGHT=17,
262 NET_CORE_SOMAXCONN=18, 263 NET_CORE_SOMAXCONN=18,
263 NET_CORE_BUDGET=19, 264 NET_CORE_BUDGET=19,
265 NET_CORE_AEVENT_ETIME=20,
266 NET_CORE_AEVENT_RSEQTH=21,
264}; 267};
265 268
266/* /proc/sys/net/ethernet */ 269/* /proc/sys/net/ethernet */
@@ -397,6 +400,9 @@ enum
397 NET_TCP_CONG_CONTROL=110, 400 NET_TCP_CONG_CONTROL=110,
398 NET_TCP_ABC=111, 401 NET_TCP_ABC=111,
399 NET_IPV4_IPFRAG_MAX_DIST=112, 402 NET_IPV4_IPFRAG_MAX_DIST=112,
403 NET_TCP_MTU_PROBING=113,
404 NET_TCP_BASE_MSS=114,
405 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115,
400}; 406};
401 407
402enum { 408enum {
@@ -451,6 +457,7 @@ enum
451 NET_IPV4_CONF_ARP_ANNOUNCE=18, 457 NET_IPV4_CONF_ARP_ANNOUNCE=18,
452 NET_IPV4_CONF_ARP_IGNORE=19, 458 NET_IPV4_CONF_ARP_IGNORE=19,
453 NET_IPV4_CONF_PROMOTE_SECONDARIES=20, 459 NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
460 NET_IPV4_CONF_ARP_ACCEPT=21,
454 __NET_IPV4_CONF_MAX 461 __NET_IPV4_CONF_MAX
455}; 462};
456 463
@@ -531,6 +538,11 @@ enum {
531 NET_IPV6_MAX_DESYNC_FACTOR=15, 538 NET_IPV6_MAX_DESYNC_FACTOR=15,
532 NET_IPV6_MAX_ADDRESSES=16, 539 NET_IPV6_MAX_ADDRESSES=16,
533 NET_IPV6_FORCE_MLD_VERSION=17, 540 NET_IPV6_FORCE_MLD_VERSION=17,
541 NET_IPV6_ACCEPT_RA_DEFRTR=18,
542 NET_IPV6_ACCEPT_RA_PINFO=19,
543 NET_IPV6_ACCEPT_RA_RTR_PREF=20,
544 NET_IPV6_RTR_PROBE_INTERVAL=21,
545 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
534 __NET_IPV6_MAX 546 __NET_IPV6_MAX
535}; 547};
536 548
@@ -562,6 +574,21 @@ enum {
562 __NET_NEIGH_MAX 574 __NET_NEIGH_MAX
563}; 575};
564 576
577/* /proc/sys/net/dccp */
578enum {
579 NET_DCCP_DEFAULT=1,
580};
581
582/* /proc/sys/net/dccp/default */
583enum {
584 NET_DCCP_DEFAULT_SEQ_WINDOW = 1,
585 NET_DCCP_DEFAULT_RX_CCID = 2,
586 NET_DCCP_DEFAULT_TX_CCID = 3,
587 NET_DCCP_DEFAULT_ACK_RATIO = 4,
588 NET_DCCP_DEFAULT_SEND_ACKVEC = 5,
589 NET_DCCP_DEFAULT_SEND_NDP = 6,
590};
591
565/* /proc/sys/net/ipx */ 592/* /proc/sys/net/ipx */
566enum { 593enum {
567 NET_IPX_PPROP_BROADCASTING=1, 594 NET_IPX_PPROP_BROADCASTING=1,
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index f2bb2396853f..542d39596bd8 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -343,6 +343,12 @@ struct tcp_sock {
343 __u32 seq; 343 __u32 seq;
344 __u32 time; 344 __u32 time;
345 } rcvq_space; 345 } rcvq_space;
346
347/* TCP-specific MTU probe information. */
348 struct {
349 __u32 probe_seq_start;
350 __u32 probe_seq_end;
351 } mtu_probe;
346}; 352};
347 353
348static inline struct tcp_sock *tcp_sk(const struct sock *sk) 354static inline struct tcp_sock *tcp_sk(const struct sock *sk)
diff --git a/include/linux/threads.h b/include/linux/threads.h
index b59738ac6197..e646bcdf2614 100644
--- a/include/linux/threads.h
+++ b/include/linux/threads.h
@@ -28,7 +28,8 @@
28#define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000) 28#define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000)
29 29
30/* 30/*
31 * A maximum of 4 million PIDs should be enough for a while: 31 * A maximum of 4 million PIDs should be enough for a while.
32 * [NOTE: PID/TIDs are limited to 2^29 ~= 500+ million, see futex.h.]
32 */ 33 */
33#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \ 34#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
34 (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT)) 35 (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
diff --git a/include/linux/time.h b/include/linux/time.h
index d9cdba54b789..0cd696cee998 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -73,12 +73,6 @@ extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
73#define timespec_valid(ts) \ 73#define timespec_valid(ts) \
74 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) 74 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC))
75 75
76/*
77 * 64-bit nanosec type. Large enough to span 292+ years in nanosecond
78 * resolution. Ought to be enough for a while.
79 */
80typedef s64 nsec_t;
81
82extern struct timespec xtime; 76extern struct timespec xtime;
83extern struct timespec wall_to_monotonic; 77extern struct timespec wall_to_monotonic;
84extern seqlock_t xtime_lock; 78extern seqlock_t xtime_lock;
@@ -101,6 +95,7 @@ extern long do_utimes(int dfd, char __user *filename, struct timeval *times);
101struct itimerval; 95struct itimerval;
102extern int do_setitimer(int which, struct itimerval *value, 96extern int do_setitimer(int which, struct itimerval *value,
103 struct itimerval *ovalue); 97 struct itimerval *ovalue);
98extern unsigned int alarm_setitimer(unsigned int seconds);
104extern int do_getitimer(int which, struct itimerval *value); 99extern int do_getitimer(int which, struct itimerval *value);
105extern void getnstimeofday(struct timespec *tv); 100extern void getnstimeofday(struct timespec *tv);
106 101
@@ -113,9 +108,9 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
113 * Returns the scalar nanosecond representation of the timespec 108 * Returns the scalar nanosecond representation of the timespec
114 * parameter. 109 * parameter.
115 */ 110 */
116static inline nsec_t timespec_to_ns(const struct timespec *ts) 111static inline s64 timespec_to_ns(const struct timespec *ts)
117{ 112{
118 return ((nsec_t) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; 113 return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
119} 114}
120 115
121/** 116/**
@@ -125,9 +120,9 @@ static inline nsec_t timespec_to_ns(const struct timespec *ts)
125 * Returns the scalar nanosecond representation of the timeval 120 * Returns the scalar nanosecond representation of the timeval
126 * parameter. 121 * parameter.
127 */ 122 */
128static inline nsec_t timeval_to_ns(const struct timeval *tv) 123static inline s64 timeval_to_ns(const struct timeval *tv)
129{ 124{
130 return ((nsec_t) tv->tv_sec * NSEC_PER_SEC) + 125 return ((s64) tv->tv_sec * NSEC_PER_SEC) +
131 tv->tv_usec * NSEC_PER_USEC; 126 tv->tv_usec * NSEC_PER_USEC;
132} 127}
133 128
@@ -137,7 +132,7 @@ static inline nsec_t timeval_to_ns(const struct timeval *tv)
137 * 132 *
138 * Returns the timespec representation of the nsec parameter. 133 * Returns the timespec representation of the nsec parameter.
139 */ 134 */
140extern struct timespec ns_to_timespec(const nsec_t nsec); 135extern struct timespec ns_to_timespec(const s64 nsec);
141 136
142/** 137/**
143 * ns_to_timeval - Convert nanoseconds to timeval 138 * ns_to_timeval - Convert nanoseconds to timeval
@@ -145,7 +140,7 @@ extern struct timespec ns_to_timespec(const nsec_t nsec);
145 * 140 *
146 * Returns the timeval representation of the nsec parameter. 141 * Returns the timeval representation of the nsec parameter.
147 */ 142 */
148extern struct timeval ns_to_timeval(const nsec_t nsec); 143extern struct timeval ns_to_timeval(const s64 nsec);
149 144
150#endif /* __KERNEL__ */ 145#endif /* __KERNEL__ */
151 146
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 9b9877fd2505..0a485beba9f5 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -6,7 +6,7 @@
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/stddef.h> 7#include <linux/stddef.h>
8 8
9struct timer_base_s; 9struct tvec_t_base_s;
10 10
11struct timer_list { 11struct timer_list {
12 struct list_head entry; 12 struct list_head entry;
@@ -15,16 +15,16 @@ struct timer_list {
15 void (*function)(unsigned long); 15 void (*function)(unsigned long);
16 unsigned long data; 16 unsigned long data;
17 17
18 struct timer_base_s *base; 18 struct tvec_t_base_s *base;
19}; 19};
20 20
21extern struct timer_base_s __init_timer_base; 21extern struct tvec_t_base_s boot_tvec_bases;
22 22
23#define TIMER_INITIALIZER(_function, _expires, _data) { \ 23#define TIMER_INITIALIZER(_function, _expires, _data) { \
24 .function = (_function), \ 24 .function = (_function), \
25 .expires = (_expires), \ 25 .expires = (_expires), \
26 .data = (_data), \ 26 .data = (_data), \
27 .base = &__init_timer_base, \ 27 .base = &boot_tvec_bases, \
28 } 28 }
29 29
30#define DEFINE_TIMER(_name, _function, _expires, _data) \ 30#define DEFINE_TIMER(_name, _function, _expires, _data) \
@@ -69,13 +69,13 @@ extern unsigned long next_timer_interrupt(void);
69 * @timer: the timer to be added 69 * @timer: the timer to be added
70 * 70 *
71 * The kernel will do a ->function(->data) callback from the 71 * The kernel will do a ->function(->data) callback from the
72 * timer interrupt at the ->expired point in the future. The 72 * timer interrupt at the ->expires point in the future. The
73 * current time is 'jiffies'. 73 * current time is 'jiffies'.
74 * 74 *
75 * The timer's ->expired, ->function (and if the handler uses it, ->data) 75 * The timer's ->expires, ->function (and if the handler uses it, ->data)
76 * fields must be set prior calling this function. 76 * fields must be set prior calling this function.
77 * 77 *
78 * Timers with an ->expired field in the past will be executed in the next 78 * Timers with an ->expires field in the past will be executed in the next
79 * timer tick. 79 * timer tick.
80 */ 80 */
81static inline void add_timer(struct timer_list *timer) 81static inline void add_timer(struct timer_list *timer)
@@ -96,6 +96,7 @@ static inline void add_timer(struct timer_list *timer)
96 96
97extern void init_timers(void); 97extern void init_timers(void);
98extern void run_local_timers(void); 98extern void run_local_timers(void);
99extern int it_real_fn(void *); 99struct hrtimer;
100extern int it_real_fn(struct hrtimer *);
100 101
101#endif 102#endif
diff --git a/include/linux/timex.h b/include/linux/timex.h
index b7ca1204e42a..03914b7e41b1 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -97,38 +97,11 @@
97 97
98#define MAXPHASE 512000L /* max phase error (us) */ 98#define MAXPHASE 512000L /* max phase error (us) */
99#define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ 99#define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */
100#define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */
101#define MINSEC 16L /* min interval between updates (s) */ 100#define MINSEC 16L /* min interval between updates (s) */
102#define MAXSEC 1200L /* max interval between updates (s) */ 101#define MAXSEC 1200L /* max interval between updates (s) */
103#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ 102#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */
104 103
105/* 104/*
106 * The following defines are used only if a pulse-per-second (PPS)
107 * signal is available and connected via a modem control lead, such as
108 * produced by the optional ppsclock feature incorporated in the Sun
109 * asynch driver. They establish the design parameters of the frequency-
110 * lock loop used to discipline the CPU clock oscillator to the PPS
111 * signal.
112 *
113 * PPS_AVG is the averaging factor for the frequency loop, as well as
114 * the time and frequency dispersion.
115 *
116 * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum
117 * calibration intervals, respectively, in seconds as a power of two.
118 *
119 * PPS_VALID is the maximum interval before the PPS signal is considered
120 * invalid and protocol updates used directly instead.
121 *
122 * MAXGLITCH is the maximum interval before a time offset of more than
123 * MAXTIME is believed.
124 */
125#define PPS_AVG 2 /* pps averaging constant (shift) */
126#define PPS_SHIFT 2 /* min interval duration (s) (shift) */
127#define PPS_SHIFTMAX 8 /* max interval duration (s) (shift) */
128#define PPS_VALID 120 /* pps signal watchdog max (s) */
129#define MAXGLITCH 30 /* pps signal glitch max (s) */
130
131/*
132 * syscall interface - used (mainly by NTP daemon) 105 * syscall interface - used (mainly by NTP daemon)
133 * to discipline kernel clock oscillator 106 * to discipline kernel clock oscillator
134 */ 107 */
@@ -246,20 +219,6 @@ extern long time_reftime; /* time at last adjustment (s) */
246extern long time_adjust; /* The amount of adjtime left */ 219extern long time_adjust; /* The amount of adjtime left */
247extern long time_next_adjust; /* Value for time_adjust at next tick */ 220extern long time_next_adjust; /* Value for time_adjust at next tick */
248 221
249/* interface variables pps->timer interrupt */
250extern long pps_offset; /* pps time offset (us) */
251extern long pps_jitter; /* time dispersion (jitter) (us) */
252extern long pps_freq; /* frequency offset (scaled ppm) */
253extern long pps_stabil; /* frequency dispersion (scaled ppm) */
254extern long pps_valid; /* pps signal watchdog counter */
255
256/* interface variables pps->adjtimex */
257extern int pps_shift; /* interval duration (s) (shift) */
258extern long pps_jitcnt; /* jitter limit exceeded */
259extern long pps_calcnt; /* calibration intervals */
260extern long pps_errcnt; /* calibration errors */
261extern long pps_stbcnt; /* stability limit exceeded */
262
263/** 222/**
264 * ntp_clear - Clears the NTP state variables 223 * ntp_clear - Clears the NTP state variables
265 * 224 *
@@ -348,6 +307,8 @@ time_interpolator_reset(void)
348/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 307/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
349extern u64 current_tick_length(void); 308extern u64 current_tick_length(void);
350 309
310extern int do_adjtimex(struct timex *);
311
351#endif /* KERNEL */ 312#endif /* KERNEL */
352 313
353#endif /* LINUX_TIMEX_H */ 314#endif /* LINUX_TIMEX_H */
diff --git a/include/linux/tiocl.h b/include/linux/tiocl.h
index 2c9e847f6ed1..4756862c4ed4 100644
--- a/include/linux/tiocl.h
+++ b/include/linux/tiocl.h
@@ -34,5 +34,6 @@ struct tiocl_selection {
34#define TIOCL_SCROLLCONSOLE 13 /* scroll console */ 34#define TIOCL_SCROLLCONSOLE 13 /* scroll console */
35#define TIOCL_BLANKSCREEN 14 /* keep screen blank even if a key is pressed */ 35#define TIOCL_BLANKSCREEN 14 /* keep screen blank even if a key is pressed */
36#define TIOCL_BLANKEDSCREEN 15 /* return which vt was blanked */ 36#define TIOCL_BLANKEDSCREEN 15 /* return which vt was blanked */
37#define TIOCL_GETKMSGREDIRECT 17 /* get the vt the kernel messages are restricted to */
37 38
38#endif /* _LINUX_TIOCL_H */ 39#endif /* _LINUX_TIOCL_H */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index e8eb0040ce3a..a305ae2e44b6 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -164,6 +164,15 @@
164 .nr_balance_failed = 0, \ 164 .nr_balance_failed = 0, \
165} 165}
166 166
167#ifdef CONFIG_SCHED_MC
168#ifndef SD_MC_INIT
169/* for now its same as SD_CPU_INIT.
170 * TBD: Tune Domain parameters!
171 */
172#define SD_MC_INIT SD_CPU_INIT
173#endif
174#endif
175
167#ifdef CONFIG_NUMA 176#ifdef CONFIG_NUMA
168#ifndef SD_NODE_INIT 177#ifndef SD_NODE_INIT
169#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!! 178#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!!
diff --git a/include/linux/tty.h b/include/linux/tty.h
index f45cd74e6f24..f13f49afe198 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -24,6 +24,7 @@
24#include <linux/tty_driver.h> 24#include <linux/tty_driver.h>
25#include <linux/tty_ldisc.h> 25#include <linux/tty_ldisc.h>
26#include <linux/screen_info.h> 26#include <linux/screen_info.h>
27#include <linux/mutex.h>
27 28
28#include <asm/system.h> 29#include <asm/system.h>
29 30
@@ -231,8 +232,8 @@ struct tty_struct {
231 int canon_data; 232 int canon_data;
232 unsigned long canon_head; 233 unsigned long canon_head;
233 unsigned int canon_column; 234 unsigned int canon_column;
234 struct semaphore atomic_read; 235 struct mutex atomic_read_lock;
235 struct semaphore atomic_write; 236 struct mutex atomic_write_lock;
236 unsigned char *write_buf; 237 unsigned char *write_buf;
237 int write_cnt; 238 int write_cnt;
238 spinlock_t read_lock; 239 spinlock_t read_lock;
@@ -319,8 +320,7 @@ extern void tty_ldisc_put(int);
319extern void tty_wakeup(struct tty_struct *tty); 320extern void tty_wakeup(struct tty_struct *tty);
320extern void tty_ldisc_flush(struct tty_struct *tty); 321extern void tty_ldisc_flush(struct tty_struct *tty);
321 322
322struct semaphore; 323extern struct mutex tty_mutex;
323extern struct semaphore tty_sem;
324 324
325/* n_tty.c */ 325/* n_tty.c */
326extern struct tty_ldisc tty_ldisc_N_TTY; 326extern struct tty_ldisc tty_ldisc_N_TTY;
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 222faf97d5f9..0976a163b459 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -2,19 +2,13 @@
2#define _LINUX_TTY_FLIP_H 2#define _LINUX_TTY_FLIP_H
3 3
4extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); 4extern int tty_buffer_request_room(struct tty_struct *tty, size_t size);
5extern int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size); 5extern int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size);
6extern int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size); 6extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size);
7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); 7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size);
8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); 8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size);
9 9
10#ifdef INCLUDE_INLINE_FUNCS 10static inline int tty_insert_flip_char(struct tty_struct *tty,
11#define _INLINE_ extern 11 unsigned char ch, char flag)
12#else
13#define _INLINE_ static __inline__
14#endif
15
16_INLINE_ int tty_insert_flip_char(struct tty_struct *tty,
17 unsigned char ch, char flag)
18{ 12{
19 struct tty_buffer *tb = tty->buf.tail; 13 struct tty_buffer *tb = tty->buf.tail;
20 if (tb && tb->active && tb->used < tb->size) { 14 if (tb && tb->active && tb->used < tb->size) {
@@ -25,7 +19,7 @@ _INLINE_ int tty_insert_flip_char(struct tty_struct *tty,
25 return tty_insert_flip_string_flags(tty, &ch, &flag, 1); 19 return tty_insert_flip_string_flags(tty, &ch, &flag, 1);
26} 20}
27 21
28_INLINE_ void tty_schedule_flip(struct tty_struct *tty) 22static inline void tty_schedule_flip(struct tty_struct *tty)
29{ 23{
30 unsigned long flags; 24 unsigned long flags;
31 spin_lock_irqsave(&tty->buf.lock, flags); 25 spin_lock_irqsave(&tty->buf.lock, flags);
diff --git a/include/linux/types.h b/include/linux/types.h
index 54ae2d59e71b..1046c7ad86d9 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -137,6 +137,10 @@ typedef __s64 int64_t;
137typedef unsigned long sector_t; 137typedef unsigned long sector_t;
138#endif 138#endif
139 139
140#ifndef HAVE_BLKCNT_T
141typedef unsigned long blkcnt_t;
142#endif
143
140/* 144/*
141 * The type of an index into the pagecache. Use a #define so asm/types.h 145 * The type of an index into the pagecache. Use a #define so asm/types.h
142 * can override it. 146 * can override it.
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
index 1e7508420fcf..ffaf05679ffb 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/linux/udf_fs_i.h
@@ -15,27 +15,6 @@
15 15
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18#ifndef _ECMA_167_H
19typedef struct
20{
21 __u32 logicalBlockNum;
22 __u16 partitionReferenceNum;
23} __attribute__ ((packed)) lb_addr;
24
25typedef struct
26{
27 __u32 extLength;
28 __u32 extPosition;
29} __attribute__ ((packed)) short_ad;
30
31typedef struct
32{
33 __u32 extLength;
34 lb_addr extLocation;
35 __u8 impUse[6];
36} __attribute__ ((packed)) long_ad;
37#endif
38
39struct udf_inode_info 18struct udf_inode_info
40{ 19{
41 struct timespec i_crtime; 20 struct timespec i_crtime;
diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
index b15ff2e99c91..80ae9ef940dc 100644
--- a/include/linux/udf_fs_sb.h
+++ b/include/linux/udf_fs_sb.h
@@ -13,7 +13,7 @@
13#ifndef _UDF_FS_SB_H 13#ifndef _UDF_FS_SB_H
14#define _UDF_FS_SB_H 1 14#define _UDF_FS_SB_H 1
15 15
16#include <asm/semaphore.h> 16#include <linux/mutex.h>
17 17
18#pragma pack(1) 18#pragma pack(1)
19 19
@@ -111,7 +111,7 @@ struct udf_sb_info
111 /* VAT inode */ 111 /* VAT inode */
112 struct inode *s_vat; 112 struct inode *s_vat;
113 113
114 struct semaphore s_alloc_sem; 114 struct mutex s_alloc_mutex;
115}; 115};
116 116
117#endif /* _UDF_FS_SB_H */ 117#endif /* _UDF_FS_SB_H */
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index b0ffe4356e5a..843aeaaa79d4 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -895,7 +895,7 @@ extern void ufs_set_link(struct inode *, struct ufs_dir_entry *, struct buffer_h
895 895
896/* file.c */ 896/* file.c */
897extern struct inode_operations ufs_file_inode_operations; 897extern struct inode_operations ufs_file_inode_operations;
898extern struct file_operations ufs_file_operations; 898extern const struct file_operations ufs_file_operations;
899 899
900extern struct address_space_operations ufs_aops; 900extern struct address_space_operations ufs_aops;
901 901
@@ -915,7 +915,7 @@ extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
915extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create); 915extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
916 916
917/* namei.c */ 917/* namei.c */
918extern struct file_operations ufs_dir_operations; 918extern const struct file_operations ufs_dir_operations;
919 919
920/* super.c */ 920/* super.c */
921extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); 921extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 827cc6de5f5c..e34e5e3dce52 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -615,7 +615,7 @@ extern struct bus_type usb_bus_type;
615 */ 615 */
616struct usb_class_driver { 616struct usb_class_driver {
617 char *name; 617 char *name;
618 struct file_operations *fops; 618 const struct file_operations *fops;
619 int minor_base; 619 int minor_base;
620}; 620};
621 621
@@ -1018,8 +1018,6 @@ extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype,
1018 unsigned char descindex, void *buf, int size); 1018 unsigned char descindex, void *buf, int size);
1019extern int usb_get_status(struct usb_device *dev, 1019extern int usb_get_status(struct usb_device *dev,
1020 int type, int target, void *data); 1020 int type, int target, void *data);
1021extern int usb_get_string(struct usb_device *dev,
1022 unsigned short langid, unsigned char index, void *buf, int size);
1023extern int usb_string(struct usb_device *dev, int index, 1021extern int usb_string(struct usb_device *dev, int index,
1024 char *buf, size_t size); 1022 char *buf, size_t size);
1025 1023
diff --git a/include/linux/usb_gadget.h b/include/linux/usb_gadget.h
index ff81117eb733..1d78870ed8af 100644
--- a/include/linux/usb_gadget.h
+++ b/include/linux/usb_gadget.h
@@ -801,7 +801,9 @@ struct usb_gadget_driver {
801 * Call this in your gadget driver's module initialization function, 801 * Call this in your gadget driver's module initialization function,
802 * to tell the underlying usb controller driver about your driver. 802 * to tell the underlying usb controller driver about your driver.
803 * The driver's bind() function will be called to bind it to a 803 * The driver's bind() function will be called to bind it to a
804 * gadget. This function must be called in a context that can sleep. 804 * gadget before this registration call returns. It's expected that
805 * the bind() functions will be in init sections.
806 * This function must be called in a context that can sleep.
805 */ 807 */
806int usb_gadget_register_driver (struct usb_gadget_driver *driver); 808int usb_gadget_register_driver (struct usb_gadget_driver *driver);
807 809
@@ -814,7 +816,8 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver);
814 * going away. If the controller is connected to a USB host, 816 * going away. If the controller is connected to a USB host,
815 * it will first disconnect(). The driver is also requested 817 * it will first disconnect(). The driver is also requested
816 * to unbind() and clean up any device state, before this procedure 818 * to unbind() and clean up any device state, before this procedure
817 * finally returns. 819 * finally returns. It's expected that the unbind() functions
820 * will in in exit sections, so may not be linked in some kernels.
818 * This function must be called in a context that can sleep. 821 * This function must be called in a context that can sleep.
819 */ 822 */
820int usb_gadget_unregister_driver (struct usb_gadget_driver *driver); 823int usb_gadget_unregister_driver (struct usb_gadget_driver *driver);
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 5208b12d5550..af2d6155d3fe 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -17,11 +17,12 @@
17#include <linux/time.h> /* need struct timeval */ 17#include <linux/time.h> /* need struct timeval */
18#include <linux/poll.h> 18#include <linux/poll.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/mutex.h>
20#endif 21#endif
21#include <linux/compiler.h> /* need __user */ 22#include <linux/compiler.h> /* need __user */
22 23
23 24
24#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.15 */ 25#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.17 */
25#define HAVE_V4L2 1 26#define HAVE_V4L2 1
26 27
27/* 28/*
@@ -48,6 +49,16 @@
48 49
49#ifdef __KERNEL__ 50#ifdef __KERNEL__
50 51
52/* Minor device allocation */
53#define MINOR_VFL_TYPE_GRABBER_MIN 0
54#define MINOR_VFL_TYPE_GRABBER_MAX 63
55#define MINOR_VFL_TYPE_RADIO_MIN 64
56#define MINOR_VFL_TYPE_RADIO_MAX 127
57#define MINOR_VFL_TYPE_VTX_MIN 192
58#define MINOR_VFL_TYPE_VTX_MAX 223
59#define MINOR_VFL_TYPE_VBI_MIN 224
60#define MINOR_VFL_TYPE_VBI_MAX 255
61
51#define VFL_TYPE_GRABBER 0 62#define VFL_TYPE_GRABBER 0
52#define VFL_TYPE_VBI 1 63#define VFL_TYPE_VBI 1
53#define VFL_TYPE_RADIO 2 64#define VFL_TYPE_RADIO 2
@@ -64,7 +75,7 @@ struct video_device
64 int minor; 75 int minor;
65 76
66 /* device ops + callbacks */ 77 /* device ops + callbacks */
67 struct file_operations *fops; 78 const struct file_operations *fops;
68 void (*release)(struct video_device *vfd); 79 void (*release)(struct video_device *vfd);
69 80
70 81
@@ -80,7 +91,7 @@ struct video_device
80 91
81 /* for videodev.c intenal usage -- please don't touch */ 92 /* for videodev.c intenal usage -- please don't touch */
82 int users; /* video_exclusive_{open|close} ... */ 93 int users; /* video_exclusive_{open|close} ... */
83 struct semaphore lock; /* ... helper function uses these */ 94 struct mutex lock; /* ... helper function uses these */
84 char devfs_name[64]; /* devfs */ 95 char devfs_name[64]; /* devfs */
85 struct class_device class_dev; /* sysfs */ 96 struct class_device class_dev; /* sysfs */
86}; 97};
@@ -872,6 +883,7 @@ struct v4l2_modulator
872#define V4L2_TUNER_MODE_LANG2 0x0002 883#define V4L2_TUNER_MODE_LANG2 0x0002
873#define V4L2_TUNER_MODE_SAP 0x0002 884#define V4L2_TUNER_MODE_SAP 0x0002
874#define V4L2_TUNER_MODE_LANG1 0x0003 885#define V4L2_TUNER_MODE_LANG1 0x0003
886#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004
875 887
876struct v4l2_frequency 888struct v4l2_frequency
877{ 889{
@@ -952,13 +964,68 @@ struct v4l2_sliced_vbi_format
952 __u32 reserved[2]; /* must be zero */ 964 __u32 reserved[2]; /* must be zero */
953}; 965};
954 966
955#define V4L2_SLICED_TELETEXT_B (0x0001) 967/* Teletext World System Teletext
956#define V4L2_SLICED_VPS (0x0400) 968 (WST), defined on ITU-R BT.653-2 */
957#define V4L2_SLICED_CAPTION_525 (0x1000) 969#define V4L2_SLICED_TELETEXT_PAL_B (0x000001)
958#define V4L2_SLICED_WSS_625 (0x4000) 970#define V4L2_SLICED_TELETEXT_PAL_C (0x000002)
959 971#define V4L2_SLICED_TELETEXT_NTSC_B (0x000010)
960#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) 972#define V4L2_SLICED_TELETEXT_SECAM (0x000020)
961#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) 973
974/* Teletext North American Broadcast Teletext Specification
975 (NABTS), defined on ITU-R BT.653-2 */
976#define V4L2_SLICED_TELETEXT_NTSC_C (0x000040)
977#define V4L2_SLICED_TELETEXT_NTSC_D (0x000080)
978
979/* Video Program System, defined on ETS 300 231*/
980#define V4L2_SLICED_VPS (0x000400)
981
982/* Closed Caption, defined on EIA-608 */
983#define V4L2_SLICED_CAPTION_525 (0x001000)
984#define V4L2_SLICED_CAPTION_625 (0x002000)
985
986/* Wide Screen System, defined on ITU-R BT1119.1 */
987#define V4L2_SLICED_WSS_625 (0x004000)
988
989/* Wide Screen System, defined on IEC 61880 */
990#define V4L2_SLICED_WSS_525 (0x008000)
991
992/* Vertical Interval Timecode (VITC), defined on SMPTE 12M */
993#define V4l2_SLICED_VITC_625 (0x010000)
994#define V4l2_SLICED_VITC_525 (0x020000)
995
996#define V4L2_SLICED_TELETEXT_B (V4L2_SLICED_TELETEXT_PAL_B |\
997 V4L2_SLICED_TELETEXT_NTSC_B)
998
999#define V4L2_SLICED_TELETEXT (V4L2_SLICED_TELETEXT_PAL_B |\
1000 V4L2_SLICED_TELETEXT_PAL_C |\
1001 V4L2_SLICED_TELETEXT_SECAM |\
1002 V4L2_SLICED_TELETEXT_NTSC_B |\
1003 V4L2_SLICED_TELETEXT_NTSC_C |\
1004 V4L2_SLICED_TELETEXT_NTSC_D)
1005
1006#define V4L2_SLICED_CAPTION (V4L2_SLICED_CAPTION_525 |\
1007 V4L2_SLICED_CAPTION_625)
1008
1009#define V4L2_SLICED_WSS (V4L2_SLICED_WSS_525 |\
1010 V4L2_SLICED_WSS_625)
1011
1012#define V4L2_SLICED_VITC (V4L2_SLICED_VITC_525 |\
1013 V4L2_SLICED_VITC_625)
1014
1015#define V4L2_SLICED_VBI_525 (V4L2_SLICED_TELETEXT_NTSC_B |\
1016 V4L2_SLICED_TELETEXT_NTSC_C |\
1017 V4L2_SLICED_TELETEXT_NTSC_D |\
1018 V4L2_SLICED_CAPTION_525 |\
1019 V4L2_SLICED_WSS_525 |\
1020 V4l2_SLICED_VITC_525)
1021
1022#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_PAL_B |\
1023 V4L2_SLICED_TELETEXT_PAL_C |\
1024 V4L2_SLICED_TELETEXT_SECAM |\
1025 V4L2_SLICED_VPS |\
1026 V4L2_SLICED_CAPTION_625 |\
1027 V4L2_SLICED_WSS_625 |\
1028 V4l2_SLICED_VITC_625)
962 1029
963struct v4l2_sliced_vbi_cap 1030struct v4l2_sliced_vbi_cap
964{ 1031{
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index fab5aed8ca31..530ae3f4248c 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -73,6 +73,11 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
73int vt_waitactive(int vt); 73int vt_waitactive(int vt);
74void change_console(struct vc_data *new_vc); 74void change_console(struct vc_data *new_vc);
75void reset_vc(struct vc_data *vc); 75void reset_vc(struct vc_data *vc);
76#ifdef CONFIG_VT
77int is_console_suspend_safe(void);
78#else
79static inline int is_console_suspend_safe(void) { return 1; }
80#endif
76 81
77/* 82/*
78 * vc_screen.c shares this temporary buffer with the console write code so that 83 * vc_screen.c shares this temporary buffer with the console write code so that
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index a555a0f7a7b4..13588564b42b 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * This file define a set of standard wireless extensions 2 * This file define a set of standard wireless extensions
3 * 3 *
4 * Version : 19 18.3.05 4 * Version : 20 17.2.06
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 1997-2005 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9 9
10#ifndef _LINUX_WIRELESS_H 10#ifndef _LINUX_WIRELESS_H
@@ -80,7 +80,7 @@
80 * (there is some stuff that will be added in the future...) 80 * (there is some stuff that will be added in the future...)
81 * I just plan to increment with each new version. 81 * I just plan to increment with each new version.
82 */ 82 */
83#define WIRELESS_EXT 19 83#define WIRELESS_EXT 20
84 84
85/* 85/*
86 * Changes : 86 * Changes :
@@ -204,6 +204,10 @@
204 * - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros 204 * - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros
205 * - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM 205 * - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM
206 * - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros 206 * - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros
207 *
208 * V19 to V20
209 * ----------
210 * - RtNetlink requests support (SET/GET)
207 */ 211 */
208 212
209/**************************** CONSTANTS ****************************/ 213/**************************** CONSTANTS ****************************/
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 86b111300231..957c21c16d62 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -20,6 +20,10 @@ struct work_struct {
20 struct timer_list timer; 20 struct timer_list timer;
21}; 21};
22 22
23struct execute_work {
24 struct work_struct work;
25};
26
23#define __WORK_INITIALIZER(n, f, d) { \ 27#define __WORK_INITIALIZER(n, f, d) { \
24 .entry = { &(n).entry, &(n).entry }, \ 28 .entry = { &(n).entry, &(n).entry }, \
25 .func = (f), \ 29 .func = (f), \
@@ -74,6 +78,8 @@ extern void init_workqueues(void);
74void cancel_rearming_delayed_work(struct work_struct *work); 78void cancel_rearming_delayed_work(struct work_struct *work);
75void cancel_rearming_delayed_workqueue(struct workqueue_struct *, 79void cancel_rearming_delayed_workqueue(struct workqueue_struct *,
76 struct work_struct *); 80 struct work_struct *);
81int execute_in_process_context(void (*fn)(void *), void *,
82 struct execute_work *);
77 83
78/* 84/*
79 * Kill off a pending schedule_delayed_work(). Note that the work callback 85 * Kill off a pending schedule_delayed_work(). Note that the work callback
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index beaef5c7a0ea..56f92fcbe94a 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -88,8 +88,8 @@ void throttle_vm_writeout(void);
88/* These are exported to sysctl. */ 88/* These are exported to sysctl. */
89extern int dirty_background_ratio; 89extern int dirty_background_ratio;
90extern int vm_dirty_ratio; 90extern int vm_dirty_ratio;
91extern int dirty_writeback_centisecs; 91extern int dirty_writeback_interval;
92extern int dirty_expire_centisecs; 92extern int dirty_expire_interval;
93extern int block_dump; 93extern int block_dump;
94extern int laptop_mode; 94extern int laptop_mode;
95 95
@@ -99,7 +99,15 @@ int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
99 void __user *, size_t *, loff_t *); 99 void __user *, size_t *, loff_t *);
100 100
101void page_writeback_init(void); 101void page_writeback_init(void);
102void balance_dirty_pages_ratelimited(struct address_space *mapping); 102void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
103 unsigned long nr_pages_dirtied);
104
105static inline void
106balance_dirty_pages_ratelimited(struct address_space *mapping)
107{
108 balance_dirty_pages_ratelimited_nr(mapping, 1);
109}
110
103int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); 111int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
104int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 112int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
105int sync_page_range(struct inode *inode, struct address_space *mapping, 113int sync_page_range(struct inode *inode, struct address_space *mapping,
diff --git a/include/linux/x1205.h b/include/linux/x1205.h
deleted file mode 100644
index 64fd3af894a5..000000000000
--- a/include/linux/x1205.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * x1205.h - defines for drivers/i2c/chips/x1205.c
3 * Copyright 2004 Karen Spearel
4 * Copyright 2005 Alessandro Zummo
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
12#ifndef __LINUX_X1205_H__
13#define __LINUX_X1205_H__
14
15/* commands */
16
17#define X1205_CMD_GETDATETIME 0
18#define X1205_CMD_SETTIME 1
19#define X1205_CMD_SETDATETIME 2
20#define X1205_CMD_GETALARM 3
21#define X1205_CMD_SETALARM 4
22#define X1205_CMD_GETDTRIM 5
23#define X1205_CMD_SETDTRIM 6
24#define X1205_CMD_GETATRIM 7
25#define X1205_CMD_SETATRIM 8
26
27extern int x1205_do_command(unsigned int cmd, void *arg);
28extern int x1205_direct_attach(int adapter_id,
29 struct i2c_client_address_data *address_data);
30
31#endif /* __LINUX_X1205_H__ */
diff --git a/include/linux/x25.h b/include/linux/x25.h
index 16d44931afa0..d035e4e87d07 100644
--- a/include/linux/x25.h
+++ b/include/linux/x25.h
@@ -11,6 +11,8 @@
11#ifndef X25_KERNEL_H 11#ifndef X25_KERNEL_H
12#define X25_KERNEL_H 12#define X25_KERNEL_H
13 13
14#include <linux/types.h>
15
14#define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0) 16#define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0)
15#define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1) 17#define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1)
16#define SIOCX25GFACILITIES (SIOCPROTOPRIVATE + 2) 18#define SIOCX25GFACILITIES (SIOCPROTOPRIVATE + 2)
@@ -21,6 +23,8 @@
21#define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7) 23#define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7)
22#define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8) 24#define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8)
23#define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) 25#define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9)
26#define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10)
27#define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11)
24 28
25/* 29/*
26 * Values for {get,set}sockopt. 30 * Values for {get,set}sockopt.
@@ -77,6 +81,8 @@ struct x25_subscrip_struct {
77#define X25_MASK_PACKET_SIZE 0x04 81#define X25_MASK_PACKET_SIZE 0x04
78#define X25_MASK_WINDOW_SIZE 0x08 82#define X25_MASK_WINDOW_SIZE 0x08
79 83
84#define X25_MASK_CALLING_AE 0x10
85#define X25_MASK_CALLED_AE 0x20
80 86
81 87
82/* 88/*
@@ -99,6 +105,26 @@ struct x25_facilities {
99}; 105};
100 106
101/* 107/*
108* ITU DTE facilities
109* Only the called and calling address
110* extension are currently implemented.
111* The rest are in place to avoid the struct
112* changing size if someone needs them later
113*/
114
115struct x25_dte_facilities {
116 __u16 delay_cumul;
117 __u16 delay_target;
118 __u16 delay_max;
119 __u8 min_throughput;
120 __u8 expedited;
121 __u8 calling_len;
122 __u8 called_len;
123 __u8 calling_ae[20];
124 __u8 called_ae[20];
125};
126
127/*
102 * Call User Data structure. 128 * Call User Data structure.
103 */ 129 */
104struct x25_calluserdata { 130struct x25_calluserdata {
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 82fbb758e28f..6b42cc474c01 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -156,6 +156,10 @@ enum {
156 XFRM_MSG_FLUSHPOLICY, 156 XFRM_MSG_FLUSHPOLICY,
157#define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY 157#define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY
158 158
159 XFRM_MSG_NEWAE,
160#define XFRM_MSG_NEWAE XFRM_MSG_NEWAE
161 XFRM_MSG_GETAE,
162#define XFRM_MSG_GETAE XFRM_MSG_GETAE
159 __XFRM_MSG_MAX 163 __XFRM_MSG_MAX
160}; 164};
161#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 165#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -194,6 +198,21 @@ struct xfrm_encap_tmpl {
194 xfrm_address_t encap_oa; 198 xfrm_address_t encap_oa;
195}; 199};
196 200
201/* AEVENT flags */
202enum xfrm_ae_ftype_t {
203 XFRM_AE_UNSPEC,
204 XFRM_AE_RTHR=1, /* replay threshold*/
205 XFRM_AE_RVAL=2, /* replay value */
206 XFRM_AE_LVAL=4, /* lifetime value */
207 XFRM_AE_ETHR=8, /* expiry timer threshold */
208 XFRM_AE_CR=16, /* Event cause is replay update */
209 XFRM_AE_CE=32, /* Event cause is timer expiry */
210 XFRM_AE_CU=64, /* Event cause is policy update */
211 __XFRM_AE_MAX
212
213#define XFRM_AE_MAX (__XFRM_AE_MAX - 1)
214};
215
197/* Netlink message attributes. */ 216/* Netlink message attributes. */
198enum xfrm_attr_type_t { 217enum xfrm_attr_type_t {
199 XFRMA_UNSPEC, 218 XFRMA_UNSPEC,
@@ -205,6 +224,10 @@ enum xfrm_attr_type_t {
205 XFRMA_SA, 224 XFRMA_SA,
206 XFRMA_POLICY, 225 XFRMA_POLICY,
207 XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ 226 XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */
227 XFRMA_LTIME_VAL,
228 XFRMA_REPLAY_VAL,
229 XFRMA_REPLAY_THRESH,
230 XFRMA_ETIMER_THRESH,
208 __XFRMA_MAX 231 __XFRMA_MAX
209 232
210#define XFRMA_MAX (__XFRMA_MAX - 1) 233#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -235,6 +258,11 @@ struct xfrm_usersa_id {
235 __u8 proto; 258 __u8 proto;
236}; 259};
237 260
261struct xfrm_aevent_id {
262 struct xfrm_usersa_id sa_id;
263 __u32 flags;
264};
265
238struct xfrm_userspi_info { 266struct xfrm_userspi_info {
239 struct xfrm_usersa_info info; 267 struct xfrm_usersa_info info;
240 __u32 min; 268 __u32 min;
@@ -306,6 +334,8 @@ enum xfrm_nlgroups {
306#define XFRMNLGRP_SA XFRMNLGRP_SA 334#define XFRMNLGRP_SA XFRMNLGRP_SA
307 XFRMNLGRP_POLICY, 335 XFRMNLGRP_POLICY,
308#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY 336#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY
337 XFRMNLGRP_AEVENTS,
338#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS
309 __XFRMNLGRP_MAX 339 __XFRMNLGRP_MAX
310}; 340};
311#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) 341#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)
diff --git a/include/linux/zorro.h b/include/linux/zorro.h
index ba5b72768bbe..2f135cf6eef1 100644
--- a/include/linux/zorro.h
+++ b/include/linux/zorro.h
@@ -271,39 +271,6 @@ static inline void zorro_set_drvdata (struct zorro_dev *z, void *data)
271} 271}
272 272
273 273
274/*
275 * A helper function which helps ensure correct zorro_driver
276 * setup and cleanup for commonly-encountered hotplug/modular cases
277 *
278 * This MUST stay in a header, as it checks for -DMODULE
279 */
280static inline int zorro_module_init(struct zorro_driver *drv)
281{
282 int rc = zorro_register_driver(drv);
283
284 if (rc > 0)
285 return 0;
286
287 /* iff CONFIG_HOTPLUG and built into kernel, we should
288 * leave the driver around for future hotplug events.
289 * For the module case, a hotplug daemon of some sort
290 * should load a module in response to an insert event. */
291#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
292 if (rc == 0)
293 return 0;
294#else
295 if (rc == 0)
296 rc = -ENODEV;
297#endif
298
299 /* if we get here, we need to clean up Zorro driver instance
300 * and return some sort of error */
301 zorro_unregister_driver(drv);
302
303 return rc;
304}
305
306
307 /* 274 /*
308 * Bitmask indicating portions of available Zorro II RAM that are unused 275 * Bitmask indicating portions of available Zorro II RAM that are unused
309 * by the system. Every bit represents a 64K chunk, for a maximum of 8MB 276 * by the system. Every bit represents a 64K chunk, for a maximum of 8MB