aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-01-30 19:25:51 -0500
committerPaul Mackerras <paulus@samba.org>2008-01-30 19:25:51 -0500
commitbd45ac0c5daae35e7c71138172e63df5cf644cf6 (patch)
tree5eb5a599bf6a9d7a8a34e802db932aa9e9555de4 /include/linux
parent4eece4ccf997c0e6d8fdad3d842e37b16b8d705f (diff)
parent5bdeae46be6dfe9efa44a548bd622af325f4bdb4 (diff)
Merge branch 'linux-2.6'
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild14
-rw-r--r--include/linux/acpi.h7
-rw-r--r--include/linux/acpi_pmtmr.h2
-rw-r--r--include/linux/ata.h110
-rw-r--r--include/linux/atmbr2684.h51
-rw-r--r--include/linux/atmdev.h4
-rw-r--r--include/linux/attribute_container.h1
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/blkdev.h129
-rw-r--r--include/linux/blktrace_api.h12
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/can.h111
-rw-r--r--include/linux/can/Kbuild3
-rw-r--r--include/linux/can/bcm.h65
-rw-r--r--include/linux/can/core.h64
-rw-r--r--include/linux/can/error.h93
-rw-r--r--include/linux/can/raw.h31
-rw-r--r--include/linux/cdrom.h3
-rw-r--r--include/linux/clocksource.h3
-rw-r--r--include/linux/compat.h15
-rw-r--r--include/linux/compiler-gcc3.h2
-rw-r--r--include/linux/compiler-gcc4.h1
-rw-r--r--include/linux/compiler.h9
-rw-r--r--include/linux/connector.h5
-rw-r--r--include/linux/const.h5
-rw-r--r--include/linux/cpu.h17
-rw-r--r--include/linux/cpumask.h4
-rw-r--r--include/linux/crypto.h103
-rw-r--r--include/linux/dccp.h91
-rw-r--r--include/linux/debug_locks.h5
-rw-r--r--include/linux/device.h363
-rw-r--r--include/linux/dlm.h140
-rw-r--r--include/linux/dlmconstants.h159
-rw-r--r--include/linux/dmaengine.h3
-rw-r--r--include/linux/dmi.h4
-rw-r--r--include/linux/elf.h1
-rw-r--r--include/linux/elfnote.h2
-rw-r--r--include/linux/ext4_fs.h198
-rw-r--r--include/linux/ext4_fs_extents.h25
-rw-r--r--include/linux/ext4_fs_i.h25
-rw-r--r--include/linux/ext4_fs_sb.h55
-rw-r--r--include/linux/fs.h21
-rw-r--r--include/linux/futex.h6
-rw-r--r--include/linux/genhd.h37
-rw-r--r--include/linux/hardirq.h6
-rw-r--r--include/linux/hdreg.h64
-rw-r--r--include/linux/hid.h18
-rw-r--r--include/linux/hpet.h5
-rw-r--r--include/linux/hrtimer.h14
-rw-r--r--include/linux/hw_random.h2
-rw-r--r--include/linux/i2c-id.h65
-rw-r--r--include/linux/i2c.h126
-rw-r--r--include/linux/i2c/tps65010.h156
-rw-r--r--include/linux/ide.h379
-rw-r--r--include/linux/ieee80211.h155
-rw-r--r--include/linux/if.h5
-rw-r--r--include/linux/if_addrlabel.h32
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_ether.h8
-rw-r--r--include/linux/if_frad.h2
-rw-r--r--include/linux/if_shaper.h51
-rw-r--r--include/linux/if_tr.h3
-rw-r--r--include/linux/if_tun.h4
-rw-r--r--include/linux/if_tunnel.h3
-rw-r--r--include/linux/if_vlan.h67
-rw-r--r--include/linux/in.h68
-rw-r--r--include/linux/inetdevice.h23
-rw-r--r--include/linux/init.h130
-rw-r--r--include/linux/init_ohci1394_dma.h4
-rw-r--r--include/linux/init_task.h8
-rw-r--r--include/linux/interrupt.h1
-rw-r--r--include/linux/iocontext.h95
-rw-r--r--include/linux/ioport.h2
-rw-r--r--include/linux/ioprio.h13
-rw-r--r--include/linux/jbd2.h135
-rw-r--r--include/linux/jiffies.h6
-rw-r--r--include/linux/kernel.h7
-rw-r--r--include/linux/kobject.h184
-rw-r--r--include/linux/kprobes.h10
-rw-r--r--include/linux/kref.h1
-rw-r--r--include/linux/kvm.h203
-rw-r--r--include/linux/kvm_host.h299
-rw-r--r--include/linux/kvm_para.h82
-rw-r--r--include/linux/kvm_types.h54
-rw-r--r--include/linux/latencytop.h44
-rw-r--r--include/linux/libata.h184
-rw-r--r--include/linux/linkage.h8
-rw-r--r--include/linux/lockd/bind.h19
-rw-r--r--include/linux/m41t00.h50
-rw-r--r--include/linux/mm.h18
-rw-r--r--include/linux/module.h45
-rw-r--r--include/linux/moduleparam.h4
-rw-r--r--include/linux/mv643xx.h10
-rw-r--r--include/linux/mv643xx_i2c.h22
-rw-r--r--include/linux/net.h11
-rw-r--r--include/linux/netfilter.h165
-rw-r--r--include/linux/netfilter/Kbuild4
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h8
-rw-r--r--include/linux/netfilter/nf_conntrack_h323.h6
-rw-r--r--include/linux/netfilter/nf_conntrack_sctp.h1
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h11
-rw-r--r--include/linux/netfilter/nfnetlink_log.h1
-rw-r--r--include/linux/netfilter/x_tables.h60
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h5
-rw-r--r--include/linux/netfilter/xt_DSCP.h5
-rw-r--r--include/linux/netfilter/xt_MARK.h4
-rw-r--r--include/linux/netfilter/xt_RATEEST.h13
-rw-r--r--include/linux/netfilter/xt_TCPOPTSTRIP.h13
-rw-r--r--include/linux/netfilter/xt_connlimit.h11
-rw-r--r--include/linux/netfilter/xt_connmark.h5
-rw-r--r--include/linux/netfilter/xt_conntrack.h16
-rw-r--r--include/linux/netfilter/xt_dscp.h6
-rw-r--r--include/linux/netfilter/xt_hashlimit.h2
-rw-r--r--include/linux/netfilter/xt_iprange.h17
-rw-r--r--include/linux/netfilter/xt_mark.h5
-rw-r--r--include/linux/netfilter/xt_owner.h16
-rw-r--r--include/linux/netfilter/xt_policy.h23
-rw-r--r--include/linux/netfilter/xt_quota.h2
-rw-r--r--include/linux/netfilter/xt_rateest.h35
-rw-r--r--include/linux/netfilter/xt_statistic.h1
-rw-r--r--include/linux/netfilter/xt_string.h2
-rw-r--r--include/linux/netfilter_arp/arp_tables.h50
-rw-r--r--include/linux/netfilter_ipv4.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h84
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLUSTERIP.h1
-rw-r--r--include/linux/netfilter_ipv4/ipt_addrtype.h14
-rw-r--r--include/linux/netfilter_ipv4/ipt_iprange.h6
-rw-r--r--include/linux/netfilter_ipv6.h3
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h81
-rw-r--r--include/linux/netlink.h3
-rw-r--r--include/linux/netpoll.h9
-rw-r--r--include/linux/nfs_fs.h74
-rw-r--r--include/linux/nfs_fs_sb.h17
-rw-r--r--include/linux/nfs_page.h13
-rw-r--r--include/linux/nfs_xdr.h21
-rw-r--r--include/linux/nl80211.h154
-rw-r--r--include/linux/notifier.h4
-rw-r--r--include/linux/pci.h2
-rw-r--r--include/linux/pci_hotplug.h2
-rw-r--r--include/linux/pci_ids.h16
-rw-r--r--include/linux/pcounter.h74
-rw-r--r--include/linux/percpu.h24
-rw-r--r--include/linux/pkt_sched.h2
-rw-r--r--include/linux/pktcdvd.h2
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/ptrace.h75
-rw-r--r--include/linux/rcuclassic.h164
-rw-r--r--include/linux/rcupdate.h173
-rw-r--r--include/linux/rcupreempt.h86
-rw-r--r--include/linux/rcupreempt_trace.h99
-rw-r--r--include/linux/regset.h368
-rw-r--r--include/linux/rtnetlink.h15
-rw-r--r--include/linux/scatterlist.h126
-rw-r--r--include/linux/sched.h115
-rw-r--r--include/linux/security.h59
-rw-r--r--include/linux/selinux.h45
-rw-r--r--include/linux/seq_file.h13
-rw-r--r--include/linux/skbuff.h11
-rw-r--r--include/linux/smp.h2
-rw-r--r--include/linux/smp_lock.h14
-rw-r--r--include/linux/snmp.h31
-rw-r--r--include/linux/socket.h3
-rw-r--r--include/linux/spinlock.h6
-rw-r--r--include/linux/spinlock_types.h4
-rw-r--r--include/linux/spinlock_up.h2
-rw-r--r--include/linux/splice.h1
-rw-r--r--include/linux/ssb/ssb.h97
-rw-r--r--include/linux/ssb/ssb_regs.h83
-rw-r--r--include/linux/stacktrace.h3
-rw-r--r--include/linux/sunrpc/clnt.h11
-rw-r--r--include/linux/sunrpc/msg_prot.h39
-rw-r--r--include/linux/sunrpc/sched.h57
-rw-r--r--include/linux/sunrpc/xprt.h14
-rw-r--r--include/linux/suspend.h3
-rw-r--r--include/linux/swap.h1
-rw-r--r--include/linux/sysctl.h26
-rw-r--r--include/linux/sysdev.h1
-rw-r--r--include/linux/sysfs.h2
-rw-r--r--include/linux/tcp.h11
-rw-r--r--include/linux/thread_info.h10
-rw-r--r--include/linux/tick.h6
-rw-r--r--include/linux/tifm.h2
-rw-r--r--include/linux/timer.h6
-rw-r--r--include/linux/topology.h5
-rw-r--r--include/linux/tty.h3
-rw-r--r--include/linux/uio_driver.h6
-rw-r--r--include/linux/wireless.h13
-rw-r--r--include/linux/xfrm.h10
189 files changed, 5351 insertions, 2478 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index f30fa92a44a1..85b2482cc736 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -1,4 +1,5 @@
1header-y += byteorder/ 1header-y += byteorder/
2header-y += can/
2header-y += dvb/ 3header-y += dvb/
3header-y += hdlc/ 4header-y += hdlc/
4header-y += isdn/ 5header-y += isdn/
@@ -34,13 +35,13 @@ header-y += atmsap.h
34header-y += atmsvc.h 35header-y += atmsvc.h
35header-y += atm_zatm.h 36header-y += atm_zatm.h
36header-y += auto_fs4.h 37header-y += auto_fs4.h
37header-y += auxvec.h
38header-y += ax25.h 38header-y += ax25.h
39header-y += b1lli.h 39header-y += b1lli.h
40header-y += baycom.h 40header-y += baycom.h
41header-y += bfs_fs.h 41header-y += bfs_fs.h
42header-y += blkpg.h 42header-y += blkpg.h
43header-y += bpqether.h 43header-y += bpqether.h
44header-y += can.h
44header-y += cdk.h 45header-y += cdk.h
45header-y += chio.h 46header-y += chio.h
46header-y += coda_psdev.h 47header-y += coda_psdev.h
@@ -49,6 +50,7 @@ header-y += comstats.h
49header-y += const.h 50header-y += const.h
50header-y += cgroupstats.h 51header-y += cgroupstats.h
51header-y += cycx_cfm.h 52header-y += cycx_cfm.h
53header-y += dlmconstants.h
52header-y += dlm_device.h 54header-y += dlm_device.h
53header-y += dlm_netlink.h 55header-y += dlm_netlink.h
54header-y += dm-ioctl.h 56header-y += dm-ioctl.h
@@ -72,7 +74,7 @@ header-y += gen_stats.h
72header-y += gigaset_dev.h 74header-y += gigaset_dev.h
73header-y += hdsmart.h 75header-y += hdsmart.h
74header-y += hysdn_if.h 76header-y += hysdn_if.h
75header-y += i2c-dev.h 77header-y += i2o-dev.h
76header-y += i8k.h 78header-y += i8k.h
77header-y += if_arcnet.h 79header-y += if_arcnet.h
78header-y += if_bonding.h 80header-y += if_bonding.h
@@ -98,7 +100,6 @@ header-y += iso_fs.h
98header-y += ixjuser.h 100header-y += ixjuser.h
99header-y += jffs2.h 101header-y += jffs2.h
100header-y += keyctl.h 102header-y += keyctl.h
101header-y += kvm.h
102header-y += limits.h 103header-y += limits.h
103header-y += lock_dlm_plock.h 104header-y += lock_dlm_plock.h
104header-y += magic.h 105header-y += magic.h
@@ -157,7 +158,6 @@ header-y += veth.h
157header-y += video_decoder.h 158header-y += video_decoder.h
158header-y += video_encoder.h 159header-y += video_encoder.h
159header-y += videotext.h 160header-y += videotext.h
160header-y += vt.h
161header-y += x25.h 161header-y += x25.h
162 162
163unifdef-y += acct.h 163unifdef-y += acct.h
@@ -172,6 +172,7 @@ unifdef-y += atm.h
172unifdef-y += atm_tcp.h 172unifdef-y += atm_tcp.h
173unifdef-y += audit.h 173unifdef-y += audit.h
174unifdef-y += auto_fs.h 174unifdef-y += auto_fs.h
175unifdef-y += auxvec.h
175unifdef-y += binfmts.h 176unifdef-y += binfmts.h
176unifdef-y += capability.h 177unifdef-y += capability.h
177unifdef-y += capi.h 178unifdef-y += capi.h
@@ -213,7 +214,7 @@ unifdef-y += hdreg.h
213unifdef-y += hiddev.h 214unifdef-y += hiddev.h
214unifdef-y += hpet.h 215unifdef-y += hpet.h
215unifdef-y += i2c.h 216unifdef-y += i2c.h
216unifdef-y += i2o-dev.h 217unifdef-y += i2c-dev.h
217unifdef-y += icmp.h 218unifdef-y += icmp.h
218unifdef-y += icmpv6.h 219unifdef-y += icmpv6.h
219unifdef-y += if_addr.h 220unifdef-y += if_addr.h
@@ -228,7 +229,6 @@ unifdef-y += if_ltalk.h
228unifdef-y += if_link.h 229unifdef-y += if_link.h
229unifdef-y += if_pppol2tp.h 230unifdef-y += if_pppol2tp.h
230unifdef-y += if_pppox.h 231unifdef-y += if_pppox.h
231unifdef-y += if_shaper.h
232unifdef-y += if_tr.h 232unifdef-y += if_tr.h
233unifdef-y += if_tun.h 233unifdef-y += if_tun.h
234unifdef-y += if_vlan.h 234unifdef-y += if_vlan.h
@@ -255,6 +255,7 @@ unifdef-y += kd.h
255unifdef-y += kernelcapi.h 255unifdef-y += kernelcapi.h
256unifdef-y += kernel.h 256unifdef-y += kernel.h
257unifdef-y += keyboard.h 257unifdef-y += keyboard.h
258unifdef-$(CONFIG_HAVE_KVM) += kvm.h
258unifdef-y += llc.h 259unifdef-y += llc.h
259unifdef-y += loop.h 260unifdef-y += loop.h
260unifdef-y += lp.h 261unifdef-y += lp.h
@@ -348,6 +349,7 @@ unifdef-y += videodev.h
348unifdef-y += virtio_config.h 349unifdef-y += virtio_config.h
349unifdef-y += virtio_blk.h 350unifdef-y += virtio_blk.h
350unifdef-y += virtio_net.h 351unifdef-y += virtio_net.h
352unifdef-y += vt.h
351unifdef-y += wait.h 353unifdef-y += wait.h
352unifdef-y += wanrouter.h 354unifdef-y += wanrouter.h
353unifdef-y += watchdog.h 355unifdef-y += watchdog.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index e3c16c981e46..63f2e6ed698f 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -40,6 +40,7 @@
40#include <acpi/acpi_drivers.h> 40#include <acpi/acpi_drivers.h>
41#include <acpi/acpi_numa.h> 41#include <acpi/acpi_numa.h>
42#include <asm/acpi.h> 42#include <asm/acpi.h>
43#include <linux/dmi.h>
43 44
44 45
45#ifdef CONFIG_ACPI 46#ifdef CONFIG_ACPI
@@ -192,7 +193,9 @@ extern int ec_transaction(u8 command,
192#endif /*CONFIG_ACPI_EC*/ 193#endif /*CONFIG_ACPI_EC*/
193 194
194extern int acpi_blacklisted(void); 195extern int acpi_blacklisted(void);
195extern void acpi_bios_year(char *s); 196#ifdef CONFIG_DMI
197extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
198#endif
196 199
197#ifdef CONFIG_ACPI_NUMA 200#ifdef CONFIG_ACPI_NUMA
198int acpi_get_pxm(acpi_handle handle); 201int acpi_get_pxm(acpi_handle handle);
@@ -226,5 +229,5 @@ static inline int acpi_boot_table_init(void)
226 return 0; 229 return 0;
227} 230}
228 231
229#endif /* CONFIG_ACPI */ 232#endif /* !CONFIG_ACPI */
230#endif /*_LINUX_ACPI_H*/ 233#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/acpi_pmtmr.h b/include/linux/acpi_pmtmr.h
index 1d0ef1ae8036..7e3d2859be50 100644
--- a/include/linux/acpi_pmtmr.h
+++ b/include/linux/acpi_pmtmr.h
@@ -25,6 +25,8 @@ static inline u32 acpi_pm_read_early(void)
25 return acpi_pm_read_verified() & ACPI_PM_MASK; 25 return acpi_pm_read_verified() & ACPI_PM_MASK;
26} 26}
27 27
28extern void pmtimer_wait(unsigned);
29
28#else 30#else
29 31
30static inline u32 acpi_pm_read_early(void) 32static inline u32 acpi_pm_read_early(void)
diff --git a/include/linux/ata.h b/include/linux/ata.h
index e672e80202a8..78bbacaed8c4 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -286,9 +286,10 @@ enum {
286 ATA_CBL_NONE = 0, 286 ATA_CBL_NONE = 0,
287 ATA_CBL_PATA40 = 1, 287 ATA_CBL_PATA40 = 1,
288 ATA_CBL_PATA80 = 2, 288 ATA_CBL_PATA80 = 2,
289 ATA_CBL_PATA40_SHORT = 3, /* 40 wire cable to high UDMA spec */ 289 ATA_CBL_PATA40_SHORT = 3, /* 40 wire cable to high UDMA spec */
290 ATA_CBL_PATA_UNK = 4, 290 ATA_CBL_PATA_UNK = 4, /* don't know, maybe 80c? */
291 ATA_CBL_SATA = 5, 291 ATA_CBL_PATA_IGN = 5, /* don't know, ignore cable handling */
292 ATA_CBL_SATA = 6,
292 293
293 /* SATA Status and Control Registers */ 294 /* SATA Status and Control Registers */
294 SCR_STATUS = 0, 295 SCR_STATUS = 0,
@@ -324,6 +325,13 @@ enum {
324 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ 325 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
325 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ 326 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
326 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */ 327 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
328
329 /* protocol flags */
330 ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */
331 ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */
332 ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA,
333 ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */
334 ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
327}; 335};
328 336
329enum ata_tf_protocols { 337enum ata_tf_protocols {
@@ -333,9 +341,9 @@ enum ata_tf_protocols {
333 ATA_PROT_PIO, /* PIO data xfer */ 341 ATA_PROT_PIO, /* PIO data xfer */
334 ATA_PROT_DMA, /* DMA */ 342 ATA_PROT_DMA, /* DMA */
335 ATA_PROT_NCQ, /* NCQ */ 343 ATA_PROT_NCQ, /* NCQ */
336 ATA_PROT_ATAPI, /* packet command, PIO data xfer*/ 344 ATAPI_PROT_NODATA, /* packet command, no data */
337 ATA_PROT_ATAPI_NODATA, /* packet command, no data */ 345 ATAPI_PROT_PIO, /* packet command, PIO data xfer*/
338 ATA_PROT_ATAPI_DMA, /* packet command with special DMA sauce */ 346 ATAPI_PROT_DMA, /* packet command with special DMA sauce */
339}; 347};
340 348
341enum ata_ioctls { 349enum ata_ioctls {
@@ -346,8 +354,8 @@ enum ata_ioctls {
346/* core structures */ 354/* core structures */
347 355
348struct ata_prd { 356struct ata_prd {
349 u32 addr; 357 __le32 addr;
350 u32 flags_len; 358 __le32 flags_len;
351}; 359};
352 360
353struct ata_taskfile { 361struct ata_taskfile {
@@ -373,13 +381,69 @@ struct ata_taskfile {
373 u8 command; /* IO operation */ 381 u8 command; /* IO operation */
374}; 382};
375 383
384/*
385 * protocol tests
386 */
387static inline unsigned int ata_prot_flags(u8 prot)
388{
389 switch (prot) {
390 case ATA_PROT_NODATA:
391 return 0;
392 case ATA_PROT_PIO:
393 return ATA_PROT_FLAG_PIO;
394 case ATA_PROT_DMA:
395 return ATA_PROT_FLAG_DMA;
396 case ATA_PROT_NCQ:
397 return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ;
398 case ATAPI_PROT_NODATA:
399 return ATA_PROT_FLAG_ATAPI;
400 case ATAPI_PROT_PIO:
401 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO;
402 case ATAPI_PROT_DMA:
403 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA;
404 }
405 return 0;
406}
407
408static inline int ata_is_atapi(u8 prot)
409{
410 return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI;
411}
412
413static inline int ata_is_nodata(u8 prot)
414{
415 return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA);
416}
417
418static inline int ata_is_pio(u8 prot)
419{
420 return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO;
421}
422
423static inline int ata_is_dma(u8 prot)
424{
425 return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA;
426}
427
428static inline int ata_is_ncq(u8 prot)
429{
430 return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ;
431}
432
433static inline int ata_is_data(u8 prot)
434{
435 return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA;
436}
437
438/*
439 * id tests
440 */
376#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 441#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
377#define ata_id_has_lba(id) ((id)[49] & (1 << 9)) 442#define ata_id_has_lba(id) ((id)[49] & (1 << 9))
378#define ata_id_has_dma(id) ((id)[49] & (1 << 8)) 443#define ata_id_has_dma(id) ((id)[49] & (1 << 8))
379#define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) 444#define ata_id_has_ncq(id) ((id)[76] & (1 << 8))
380#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) 445#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1)
381#define ata_id_removeable(id) ((id)[0] & (1 << 7)) 446#define ata_id_removeable(id) ((id)[0] & (1 << 7))
382#define ata_id_has_dword_io(id) ((id)[48] & (1 << 0))
383#define ata_id_has_atapi_AN(id) \ 447#define ata_id_has_atapi_AN(id) \
384 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ 448 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
385 ((id)[78] & (1 << 5)) ) 449 ((id)[78] & (1 << 5)) )
@@ -415,6 +479,7 @@ static inline bool ata_id_has_dipm(const u16 *id)
415 return val & (1 << 3); 479 return val & (1 << 3);
416} 480}
417 481
482
418static inline int ata_id_has_fua(const u16 *id) 483static inline int ata_id_has_fua(const u16 *id)
419{ 484{
420 if ((id[84] & 0xC000) != 0x4000) 485 if ((id[84] & 0xC000) != 0x4000)
@@ -519,6 +584,26 @@ static inline int ata_id_is_sata(const u16 *id)
519 return ata_id_major_version(id) >= 5 && id[93] == 0; 584 return ata_id_major_version(id) >= 5 && id[93] == 0;
520} 585}
521 586
587static inline int ata_id_has_tpm(const u16 *id)
588{
589 /* The TPM bits are only valid on ATA8 */
590 if (ata_id_major_version(id) < 8)
591 return 0;
592 if ((id[48] & 0xC000) != 0x4000)
593 return 0;
594 return id[48] & (1 << 0);
595}
596
597static inline int ata_id_has_dword_io(const u16 *id)
598{
599 /* ATA 8 reuses this flag for "trusted" computing */
600 if (ata_id_major_version(id) > 7)
601 return 0;
602 if (id[48] & (1 << 0))
603 return 1;
604 return 0;
605}
606
522static inline int ata_id_current_chs_valid(const u16 *id) 607static inline int ata_id_current_chs_valid(const u16 *id)
523{ 608{
524 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 609 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -574,13 +659,6 @@ static inline int atapi_command_packet_set(const u16 *dev_id)
574 return (dev_id[0] >> 8) & 0x1f; 659 return (dev_id[0] >> 8) & 0x1f;
575} 660}
576 661
577static inline int is_atapi_taskfile(const struct ata_taskfile *tf)
578{
579 return (tf->protocol == ATA_PROT_ATAPI) ||
580 (tf->protocol == ATA_PROT_ATAPI_NODATA) ||
581 (tf->protocol == ATA_PROT_ATAPI_DMA);
582}
583
584static inline int is_multi_taskfile(struct ata_taskfile *tf) 662static inline int is_multi_taskfile(struct ata_taskfile *tf)
585{ 663{
586 return (tf->command == ATA_CMD_READ_MULTI) || 664 return (tf->command == ATA_CMD_READ_MULTI) ||
diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h
index 969fb6c9e1cc..52bf72affbba 100644
--- a/include/linux/atmbr2684.h
+++ b/include/linux/atmbr2684.h
@@ -14,6 +14,9 @@
14#define BR2684_MEDIA_FDDI (3) 14#define BR2684_MEDIA_FDDI (3)
15#define BR2684_MEDIA_802_6 (4) /* 802.6 */ 15#define BR2684_MEDIA_802_6 (4) /* 802.6 */
16 16
17 /* used only at device creation: */
18#define BR2684_FLAG_ROUTED (1<<16) /* payload is routed, not bridged */
19
17/* 20/*
18 * Is there FCS inbound on this VC? This currently isn't supported. 21 * Is there FCS inbound on this VC? This currently isn't supported.
19 */ 22 */
@@ -36,15 +39,22 @@
36#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */ 39#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */
37 40
38/* 41/*
42 * Is this VC bridged or routed?
43 */
44
45#define BR2684_PAYLOAD_ROUTED (0)
46#define BR2684_PAYLOAD_BRIDGED (1)
47
48/*
39 * This is for the ATM_NEWBACKENDIF call - these are like socket families: 49 * This is for the ATM_NEWBACKENDIF call - these are like socket families:
40 * the first element of the structure is the backend number and the rest 50 * the first element of the structure is the backend number and the rest
41 * is per-backend specific 51 * is per-backend specific
42 */ 52 */
43struct atm_newif_br2684 { 53struct atm_newif_br2684 {
44 atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ 54 atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
45 int media; /* BR2684_MEDIA_* */ 55 int media; /* BR2684_MEDIA_*, flags in upper bits */
46 char ifname[IFNAMSIZ]; 56 char ifname[IFNAMSIZ];
47 int mtu; 57 int mtu;
48}; 58};
49 59
50/* 60/*
@@ -55,10 +65,10 @@ struct atm_newif_br2684 {
55#define BR2684_FIND_BYNUM (1) 65#define BR2684_FIND_BYNUM (1)
56#define BR2684_FIND_BYIFNAME (2) 66#define BR2684_FIND_BYIFNAME (2)
57struct br2684_if_spec { 67struct br2684_if_spec {
58 int method; /* BR2684_FIND_* */ 68 int method; /* BR2684_FIND_* */
59 union { 69 union {
60 char ifname[IFNAMSIZ]; 70 char ifname[IFNAMSIZ];
61 int devnum; 71 int devnum;
62 } spec; 72 } spec;
63}; 73};
64 74
@@ -68,16 +78,16 @@ struct br2684_if_spec {
68 * is per-backend specific 78 * is per-backend specific
69 */ 79 */
70struct atm_backend_br2684 { 80struct atm_backend_br2684 {
71 atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ 81 atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
72 struct br2684_if_spec ifspec; 82 struct br2684_if_spec ifspec;
73 int fcs_in; /* BR2684_FCSIN_* */ 83 int fcs_in; /* BR2684_FCSIN_* */
74 int fcs_out; /* BR2684_FCSOUT_* */ 84 int fcs_out; /* BR2684_FCSOUT_* */
75 int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */ 85 int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */
76 int encaps; /* BR2684_ENCAPS_* */ 86 int encaps; /* BR2684_ENCAPS_* */
77 int has_vpiid; /* 1: use vpn_id - Unsupported */ 87 int has_vpiid; /* 1: use vpn_id - Unsupported */
78 __u8 vpn_id[7]; 88 __u8 vpn_id[7];
79 int send_padding; /* unsupported */ 89 int send_padding; /* unsupported */
80 int min_size; /* we will pad smaller packets than this */ 90 int min_size; /* we will pad smaller packets than this */
81}; 91};
82 92
83/* 93/*
@@ -86,8 +96,8 @@ struct atm_backend_br2684 {
86 * efficient per-if in/out filters, this support will be removed 96 * efficient per-if in/out filters, this support will be removed
87 */ 97 */
88struct br2684_filter { 98struct br2684_filter {
89 __be32 prefix; /* network byte order */ 99 __be32 prefix; /* network byte order */
90 __be32 netmask; /* 0 = disable filter */ 100 __be32 netmask; /* 0 = disable filter */
91}; 101};
92 102
93struct br2684_filter_set { 103struct br2684_filter_set {
@@ -95,6 +105,11 @@ struct br2684_filter_set {
95 struct br2684_filter filter; 105 struct br2684_filter filter;
96}; 106};
97 107
108enum br2684_payload {
109 p_routed = BR2684_PAYLOAD_ROUTED,
110 p_bridged = BR2684_PAYLOAD_BRIDGED,
111};
112
98#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \ 113#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
99 struct br2684_filter_set) 114 struct br2684_filter_set)
100 115
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 2096e5c72827..a3d07c29d16c 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -359,7 +359,7 @@ struct atm_dev {
359 struct proc_dir_entry *proc_entry; /* proc entry */ 359 struct proc_dir_entry *proc_entry; /* proc entry */
360 char *proc_name; /* proc entry name */ 360 char *proc_name; /* proc entry name */
361#endif 361#endif
362 struct class_device class_dev; /* sysfs class device */ 362 struct device class_dev; /* sysfs device */
363 struct list_head dev_list; /* linkage */ 363 struct list_head dev_list; /* linkage */
364}; 364};
365 365
@@ -461,7 +461,7 @@ static inline void atm_dev_put(struct atm_dev *dev)
461 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags)); 461 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));
462 if (dev->ops->dev_close) 462 if (dev->ops->dev_close)
463 dev->ops->dev_close(dev); 463 dev->ops->dev_close(dev);
464 class_device_put(&dev->class_dev); 464 put_device(&dev->class_dev);
465 } 465 }
466} 466}
467 467
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index 8ff274933948..f5582332af04 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -17,6 +17,7 @@ struct attribute_container {
17 struct list_head node; 17 struct list_head node;
18 struct klist containers; 18 struct klist containers;
19 struct class *class; 19 struct class *class;
20 struct attribute_group *grp;
20 struct class_device_attribute **attrs; 21 struct class_device_attribute **attrs;
21 int (*match)(struct attribute_container *, struct device *); 22 int (*match)(struct attribute_container *, struct device *);
22#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01 23#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
diff --git a/include/linux/audit.h b/include/linux/audit.h
index c68781692838..bdd6f5de5fc4 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -115,6 +115,8 @@
115#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */ 115#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */
116#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */ 116#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */
117#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */ 117#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */
118#define AUDIT_MAC_UNLBL_STCADD 1416 /* NetLabel: add a static label */
119#define AUDIT_MAC_UNLBL_STCDEL 1417 /* NetLabel: del a static label */
118 120
119#define AUDIT_FIRST_KERN_ANOM_MSG 1700 121#define AUDIT_FIRST_KERN_ANOM_MSG 1700
120#define AUDIT_LAST_KERN_ANOM_MSG 1799 122#define AUDIT_LAST_KERN_ANOM_MSG 1799
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d18ee67b40f8..e18d4192f6e8 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -34,83 +34,10 @@ struct sg_io_hdr;
34#define BLKDEV_MIN_RQ 4 34#define BLKDEV_MIN_RQ 4
35#define BLKDEV_MAX_RQ 128 /* Default maximum */ 35#define BLKDEV_MAX_RQ 128 /* Default maximum */
36 36
37/* 37int put_io_context(struct io_context *ioc);
38 * This is the per-process anticipatory I/O scheduler state.
39 */
40struct as_io_context {
41 spinlock_t lock;
42
43 void (*dtor)(struct as_io_context *aic); /* destructor */
44 void (*exit)(struct as_io_context *aic); /* called on task exit */
45
46 unsigned long state;
47 atomic_t nr_queued; /* queued reads & sync writes */
48 atomic_t nr_dispatched; /* number of requests gone to the drivers */
49
50 /* IO History tracking */
51 /* Thinktime */
52 unsigned long last_end_request;
53 unsigned long ttime_total;
54 unsigned long ttime_samples;
55 unsigned long ttime_mean;
56 /* Layout pattern */
57 unsigned int seek_samples;
58 sector_t last_request_pos;
59 u64 seek_total;
60 sector_t seek_mean;
61};
62
63struct cfq_queue;
64struct cfq_io_context {
65 struct rb_node rb_node;
66 void *key;
67
68 struct cfq_queue *cfqq[2];
69
70 struct io_context *ioc;
71
72 unsigned long last_end_request;
73 sector_t last_request_pos;
74
75 unsigned long ttime_total;
76 unsigned long ttime_samples;
77 unsigned long ttime_mean;
78
79 unsigned int seek_samples;
80 u64 seek_total;
81 sector_t seek_mean;
82
83 struct list_head queue_list;
84
85 void (*dtor)(struct io_context *); /* destructor */
86 void (*exit)(struct io_context *); /* called on task exit */
87};
88
89/*
90 * This is the per-process I/O subsystem state. It is refcounted and
91 * kmalloc'ed. Currently all fields are modified in process io context
92 * (apart from the atomic refcount), so require no locking.
93 */
94struct io_context {
95 atomic_t refcount;
96 struct task_struct *task;
97
98 unsigned int ioprio_changed;
99
100 /*
101 * For request batching
102 */
103 unsigned long last_waited; /* Time last woken after wait for request */
104 int nr_batch_requests; /* Number of requests left in the batch */
105
106 struct as_io_context *aic;
107 struct rb_root cic_root;
108 void *ioc_data;
109};
110
111void put_io_context(struct io_context *ioc);
112void exit_io_context(void); 38void exit_io_context(void);
113struct io_context *get_io_context(gfp_t gfp_flags, int node); 39struct io_context *get_io_context(gfp_t gfp_flags, int node);
40struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
114void copy_io_context(struct io_context **pdst, struct io_context **psrc); 41void copy_io_context(struct io_context **pdst, struct io_context **psrc);
115void swap_io_context(struct io_context **ioc1, struct io_context **ioc2); 42void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
116 43
@@ -143,8 +70,6 @@ enum rq_cmd_type_bits {
143 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver 70 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver
144 * private REQ_LB opcodes to differentiate what type of request this is 71 * private REQ_LB opcodes to differentiate what type of request this is
145 */ 72 */
146 REQ_TYPE_ATA_CMD,
147 REQ_TYPE_ATA_TASK,
148 REQ_TYPE_ATA_TASKFILE, 73 REQ_TYPE_ATA_TASKFILE,
149 REQ_TYPE_ATA_PC, 74 REQ_TYPE_ATA_PC,
150}; 75};
@@ -431,6 +356,8 @@ struct request_queue
431 unsigned int max_segment_size; 356 unsigned int max_segment_size;
432 357
433 unsigned long seg_boundary_mask; 358 unsigned long seg_boundary_mask;
359 void *dma_drain_buffer;
360 unsigned int dma_drain_size;
434 unsigned int dma_alignment; 361 unsigned int dma_alignment;
435 362
436 struct blk_queue_tag *queue_tags; 363 struct blk_queue_tag *queue_tags;
@@ -539,6 +466,8 @@ enum {
539#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) 466#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
540#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 467#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
541#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors) 468#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors)
469/* rq->queuelist of dequeued request must be list_empty() */
470#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
542 471
543#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) 472#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
544 473
@@ -718,29 +647,32 @@ static inline void blk_run_address_space(struct address_space *mapping)
718} 647}
719 648
720/* 649/*
721 * end_request() and friends. Must be called with the request queue spinlock 650 * blk_end_request() and friends.
722 * acquired. All functions called within end_request() _must_be_ atomic. 651 * __blk_end_request() and end_request() must be called with
652 * the request queue spinlock acquired.
723 * 653 *
724 * Several drivers define their own end_request and call 654 * Several drivers define their own end_request and call
725 * end_that_request_first() and end_that_request_last() 655 * blk_end_request() for parts of the original function.
726 * for parts of the original function. This prevents 656 * This prevents code duplication in drivers.
727 * code duplication in drivers.
728 */ 657 */
729extern int end_that_request_first(struct request *, int, int); 658extern int blk_end_request(struct request *rq, int error, int nr_bytes);
730extern int end_that_request_chunk(struct request *, int, int); 659extern int __blk_end_request(struct request *rq, int error, int nr_bytes);
731extern void end_that_request_last(struct request *, int); 660extern int blk_end_bidi_request(struct request *rq, int error, int nr_bytes,
661 int bidi_bytes);
732extern void end_request(struct request *, int); 662extern void end_request(struct request *, int);
733extern void end_queued_request(struct request *, int); 663extern void end_queued_request(struct request *, int);
734extern void end_dequeued_request(struct request *, int); 664extern void end_dequeued_request(struct request *, int);
665extern int blk_end_request_callback(struct request *rq, int error, int nr_bytes,
666 int (drv_callback)(struct request *));
735extern void blk_complete_request(struct request *); 667extern void blk_complete_request(struct request *);
736 668
737/* 669/*
738 * end_that_request_first/chunk() takes an uptodate argument. we account 670 * blk_end_request() takes bytes instead of sectors as a complete size.
739 * any value <= as an io error. 0 means -EIO for compatability reasons, 671 * blk_rq_bytes() returns bytes left to complete in the entire request.
740 * any other < 0 value is the direct error type. An uptodate value of 672 * blk_rq_cur_bytes() returns bytes left to complete in the current segment.
741 * 1 indicates successful io completion
742 */ 673 */
743#define end_io_error(uptodate) (unlikely((uptodate) <= 0)) 674extern unsigned int blk_rq_bytes(struct request *rq);
675extern unsigned int blk_rq_cur_bytes(struct request *rq);
744 676
745static inline void blkdev_dequeue_request(struct request *req) 677static inline void blkdev_dequeue_request(struct request *req)
746{ 678{
@@ -762,10 +694,13 @@ extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short);
762extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 694extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
763extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); 695extern void blk_queue_hardsect_size(struct request_queue *, unsigned short);
764extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); 696extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
697extern int blk_queue_dma_drain(struct request_queue *q, void *buf,
698 unsigned int size);
765extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); 699extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
766extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); 700extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
767extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); 701extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
768extern void blk_queue_dma_alignment(struct request_queue *, int); 702extern void blk_queue_dma_alignment(struct request_queue *, int);
703extern void blk_queue_update_dma_alignment(struct request_queue *, int);
769extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); 704extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
770extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 705extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
771extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); 706extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *);
@@ -837,12 +772,7 @@ static inline int bdev_hardsect_size(struct block_device *bdev)
837 772
838static inline int queue_dma_alignment(struct request_queue *q) 773static inline int queue_dma_alignment(struct request_queue *q)
839{ 774{
840 int retval = 511; 775 return q ? q->dma_alignment : 511;
841
842 if (q && q->dma_alignment)
843 retval = q->dma_alignment;
844
845 return retval;
846} 776}
847 777
848/* assumes size > 256 */ 778/* assumes size > 256 */
@@ -895,6 +825,13 @@ static inline void exit_io_context(void)
895{ 825{
896} 826}
897 827
828struct io_context;
829static inline int put_io_context(struct io_context *ioc)
830{
831 return 1;
832}
833
834
898#endif /* CONFIG_BLOCK */ 835#endif /* CONFIG_BLOCK */
899 836
900#endif 837#endif
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7e11d23ac36a..cfc3147e5cf9 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -148,7 +148,7 @@ extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
148extern void blk_trace_shutdown(struct request_queue *); 148extern void blk_trace_shutdown(struct request_queue *);
149extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); 149extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
150extern int do_blk_trace_setup(struct request_queue *q, 150extern int do_blk_trace_setup(struct request_queue *q,
151 struct block_device *bdev, struct blk_user_trace_setup *buts); 151 char *name, dev_t dev, struct blk_user_trace_setup *buts);
152 152
153 153
154/** 154/**
@@ -282,6 +282,11 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
282 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); 282 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
283} 283}
284 284
285extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
286 char __user *arg);
287extern int blk_trace_startstop(struct request_queue *q, int start);
288extern int blk_trace_remove(struct request_queue *q);
289
285#else /* !CONFIG_BLK_DEV_IO_TRACE */ 290#else /* !CONFIG_BLK_DEV_IO_TRACE */
286#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) 291#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY)
287#define blk_trace_shutdown(q) do { } while (0) 292#define blk_trace_shutdown(q) do { } while (0)
@@ -290,7 +295,10 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
290#define blk_add_trace_generic(q, rq, rw, what) do { } while (0) 295#define blk_add_trace_generic(q, rq, rw, what) do { } while (0)
291#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0) 296#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0)
292#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0) 297#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0)
293#define do_blk_trace_setup(q, bdev, buts) (-ENOTTY) 298#define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY)
299#define blk_trace_setup(q, name, dev, arg) (-ENOTTY)
300#define blk_trace_startstop(q, start) (-ENOTTY)
301#define blk_trace_remove(q) (-ENOTTY)
294#endif /* CONFIG_BLK_DEV_IO_TRACE */ 302#endif /* CONFIG_BLK_DEV_IO_TRACE */
295#endif /* __KERNEL__ */ 303#endif /* __KERNEL__ */
296#endif 304#endif
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index da0d83fbadc0..e98801f06dcc 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -192,6 +192,8 @@ int sync_dirty_buffer(struct buffer_head *bh);
192int submit_bh(int, struct buffer_head *); 192int submit_bh(int, struct buffer_head *);
193void write_boundary_block(struct block_device *bdev, 193void write_boundary_block(struct block_device *bdev,
194 sector_t bblock, unsigned blocksize); 194 sector_t bblock, unsigned blocksize);
195int bh_uptodate_or_lock(struct buffer_head *bh);
196int bh_submit_read(struct buffer_head *bh);
195 197
196extern int buffer_heads_over_limit; 198extern int buffer_heads_over_limit;
197 199
diff --git a/include/linux/can.h b/include/linux/can.h
new file mode 100644
index 000000000000..d18333302cbd
--- /dev/null
+++ b/include/linux/can.h
@@ -0,0 +1,111 @@
1/*
2 * linux/can.h
3 *
4 * Definitions for CAN network layer (socket addr / CAN frame / CAN filter)
5 *
6 * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Urs Thuermann <urs.thuermann@volkswagen.de>
8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
9 * All rights reserved.
10 *
11 * Send feedback to <socketcan-users@lists.berlios.de>
12 *
13 */
14
15#ifndef CAN_H
16#define CAN_H
17
18#include <linux/types.h>
19#include <linux/socket.h>
20
21/* controller area network (CAN) kernel definitions */
22
23/* special address description flags for the CAN_ID */
24#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */
25#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */
26#define CAN_ERR_FLAG 0x20000000U /* error frame */
27
28/* valid bits in CAN ID for frame formats */
29#define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */
30#define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */
31#define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */
32
33/*
34 * Controller Area Network Identifier structure
35 *
36 * bit 0-28 : CAN identifier (11/29 bit)
37 * bit 29 : error frame flag (0 = data frame, 1 = error frame)
38 * bit 30 : remote transmission request flag (1 = rtr frame)
39 * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit)
40 */
41typedef __u32 canid_t;
42
43/*
44 * Controller Area Network Error Frame Mask structure
45 *
46 * bit 0-28 : error class mask (see include/linux/can/error.h)
47 * bit 29-31 : set to zero
48 */
49typedef __u32 can_err_mask_t;
50
51/**
52 * struct can_frame - basic CAN frame structure
53 * @can_id: the CAN ID of the frame and CAN_*_FLAG flags, see above.
54 * @can_dlc: the data length field of the CAN frame
55 * @data: the CAN frame payload.
56 */
57struct can_frame {
58 canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
59 __u8 can_dlc; /* data length code: 0 .. 8 */
60 __u8 data[8] __attribute__((aligned(8)));
61};
62
63/* particular protocols of the protocol family PF_CAN */
64#define CAN_RAW 1 /* RAW sockets */
65#define CAN_BCM 2 /* Broadcast Manager */
66#define CAN_TP16 3 /* VAG Transport Protocol v1.6 */
67#define CAN_TP20 4 /* VAG Transport Protocol v2.0 */
68#define CAN_MCNET 5 /* Bosch MCNet */
69#define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */
70#define CAN_NPROTO 7
71
72#define SOL_CAN_BASE 100
73
74/**
75 * struct sockaddr_can - the sockaddr structure for CAN sockets
76 * @can_family: address family number AF_CAN.
77 * @can_ifindex: CAN network interface index.
78 * @can_addr: protocol specific address information
79 */
80struct sockaddr_can {
81 sa_family_t can_family;
82 int can_ifindex;
83 union {
84 /* transport protocol class address information (e.g. ISOTP) */
85 struct { canid_t rx_id, tx_id; } tp;
86
87 /* reserved for future CAN protocols address information */
88 } can_addr;
89};
90
91/**
92 * struct can_filter - CAN ID based filter in can_register().
93 * @can_id: relevant bits of CAN ID which are not masked out.
94 * @can_mask: CAN mask (see description)
95 *
96 * Description:
97 * A filter matches, when
98 *
99 * <received_can_id> & mask == can_id & mask
100 *
101 * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can
102 * filter for error frames (CAN_ERR_FLAG bit set in mask).
103 */
104struct can_filter {
105 canid_t can_id;
106 canid_t can_mask;
107};
108
109#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */
110
111#endif /* CAN_H */
diff --git a/include/linux/can/Kbuild b/include/linux/can/Kbuild
new file mode 100644
index 000000000000..eff898aac02b
--- /dev/null
+++ b/include/linux/can/Kbuild
@@ -0,0 +1,3 @@
1header-y += raw.h
2header-y += bcm.h
3header-y += error.h
diff --git a/include/linux/can/bcm.h b/include/linux/can/bcm.h
new file mode 100644
index 000000000000..7f293273c444
--- /dev/null
+++ b/include/linux/can/bcm.h
@@ -0,0 +1,65 @@
1/*
2 * linux/can/bcm.h
3 *
4 * Definitions for CAN Broadcast Manager (BCM)
5 *
6 * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
8 * All rights reserved.
9 *
10 * Send feedback to <socketcan-users@lists.berlios.de>
11 *
12 */
13
14#ifndef CAN_BCM_H
15#define CAN_BCM_H
16
17/**
18 * struct bcm_msg_head - head of messages to/from the broadcast manager
19 * @opcode: opcode, see enum below.
20 * @flags: special flags, see below.
21 * @count: number of frames to send before changing interval.
22 * @ival1: interval for the first @count frames.
23 * @ival2: interval for the following frames.
24 * @can_id: CAN ID of frames to be sent or received.
25 * @nframes: number of frames appended to the message head.
26 * @frames: array of CAN frames.
27 */
28struct bcm_msg_head {
29 __u32 opcode;
30 __u32 flags;
31 __u32 count;
32 struct timeval ival1, ival2;
33 canid_t can_id;
34 __u32 nframes;
35 struct can_frame frames[0];
36};
37
38enum {
39 TX_SETUP = 1, /* create (cyclic) transmission task */
40 TX_DELETE, /* remove (cyclic) transmission task */
41 TX_READ, /* read properties of (cyclic) transmission task */
42 TX_SEND, /* send one CAN frame */
43 RX_SETUP, /* create RX content filter subscription */
44 RX_DELETE, /* remove RX content filter subscription */
45 RX_READ, /* read properties of RX content filter subscription */
46 TX_STATUS, /* reply to TX_READ request */
47 TX_EXPIRED, /* notification on performed transmissions (count=0) */
48 RX_STATUS, /* reply to RX_READ request */
49 RX_TIMEOUT, /* cyclic message is absent */
50 RX_CHANGED /* updated CAN frame (detected content change) */
51};
52
53#define SETTIMER 0x0001
54#define STARTTIMER 0x0002
55#define TX_COUNTEVT 0x0004
56#define TX_ANNOUNCE 0x0008
57#define TX_CP_CAN_ID 0x0010
58#define RX_FILTER_ID 0x0020
59#define RX_CHECK_DLC 0x0040
60#define RX_NO_AUTOTIMER 0x0080
61#define RX_ANNOUNCE_RESUME 0x0100
62#define TX_RESET_MULTI_IDX 0x0200
63#define RX_RTR_FRAME 0x0400
64
65#endif /* CAN_BCM_H */
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
new file mode 100644
index 000000000000..e9ca210ffa5b
--- /dev/null
+++ b/include/linux/can/core.h
@@ -0,0 +1,64 @@
1/*
2 * linux/can/core.h
3 *
4 * Protoypes and definitions for CAN protocol modules using the PF_CAN core
5 *
6 * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Urs Thuermann <urs.thuermann@volkswagen.de>
8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
9 * All rights reserved.
10 *
11 * Send feedback to <socketcan-users@lists.berlios.de>
12 *
13 */
14
15#ifndef CAN_CORE_H
16#define CAN_CORE_H
17
18#include <linux/can.h>
19#include <linux/skbuff.h>
20#include <linux/netdevice.h>
21
22#define CAN_VERSION "20071116"
23
24/* increment this number each time you change some user-space interface */
25#define CAN_ABI_VERSION "8"
26
27#define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION
28
29#define DNAME(dev) ((dev) ? (dev)->name : "any")
30
31/**
32 * struct can_proto - CAN protocol structure
33 * @type: type argument in socket() syscall, e.g. SOCK_DGRAM.
34 * @protocol: protocol number in socket() syscall.
35 * @capability: capability needed to open the socket, or -1 for no restriction.
36 * @ops: pointer to struct proto_ops for sock->ops.
37 * @prot: pointer to struct proto structure.
38 */
39struct can_proto {
40 int type;
41 int protocol;
42 int capability;
43 struct proto_ops *ops;
44 struct proto *prot;
45};
46
47/* function prototypes for the CAN networklayer core (af_can.c) */
48
49extern int can_proto_register(struct can_proto *cp);
50extern void can_proto_unregister(struct can_proto *cp);
51
52extern int can_rx_register(struct net_device *dev, canid_t can_id,
53 canid_t mask,
54 void (*func)(struct sk_buff *, void *),
55 void *data, char *ident);
56
57extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
58 canid_t mask,
59 void (*func)(struct sk_buff *, void *),
60 void *data);
61
62extern int can_send(struct sk_buff *skb, int loop);
63
64#endif /* CAN_CORE_H */
diff --git a/include/linux/can/error.h b/include/linux/can/error.h
new file mode 100644
index 000000000000..d4127fd9e681
--- /dev/null
+++ b/include/linux/can/error.h
@@ -0,0 +1,93 @@
1/*
2 * linux/can/error.h
3 *
4 * Definitions of the CAN error frame to be filtered and passed to the user.
5 *
6 * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
8 * All rights reserved.
9 *
10 * Send feedback to <socketcan-users@lists.berlios.de>
11 *
12 */
13
14#ifndef CAN_ERROR_H
15#define CAN_ERROR_H
16
17#define CAN_ERR_DLC 8 /* dlc for error frames */
18
19/* error class (mask) in can_id */
20#define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */
21#define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */
22#define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */
23#define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */
24#define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */
25#define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */
26#define CAN_ERR_BUSOFF 0x00000040U /* bus off */
27#define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */
28#define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */
29
30/* arbitration lost in bit ... / data[0] */
31#define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */
32 /* else bit number in bitstream */
33
34/* error status of CAN-controller / data[1] */
35#define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */
36#define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */
37#define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */
38#define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */
39#define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */
40#define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */
41#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */
42 /* (at least one error counter exceeds */
43 /* the protocol-defined level of 127) */
44
45/* error in CAN protocol (type) / data[2] */
46#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */
47#define CAN_ERR_PROT_BIT 0x01 /* single bit error */
48#define CAN_ERR_PROT_FORM 0x02 /* frame format error */
49#define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */
50#define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */
51#define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */
52#define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */
53#define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */
54#define CAN_ERR_PROT_TX 0x80 /* error occured on transmission */
55
56/* error in CAN protocol (location) / data[3] */
57#define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */
58#define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */
59#define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */
60#define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/
61#define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */
62#define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */
63#define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */
64#define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */
65#define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */
66#define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */
67#define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */
68#define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */
69#define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */
70#define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */
71#define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */
72#define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */
73#define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */
74#define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */
75#define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */
76#define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */
77
78/* error status of CAN-transceiver / data[4] */
79/* CANH CANL */
80#define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */
81#define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */
82#define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */
83#define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */
84#define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */
85#define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */
86#define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */
87#define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */
88#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */
89#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */
90
91/* controller specific additional information / data[5..7] */
92
93#endif /* CAN_ERROR_H */
diff --git a/include/linux/can/raw.h b/include/linux/can/raw.h
new file mode 100644
index 000000000000..b2a0f87492c5
--- /dev/null
+++ b/include/linux/can/raw.h
@@ -0,0 +1,31 @@
1/*
2 * linux/can/raw.h
3 *
4 * Definitions for raw CAN sockets
5 *
6 * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Urs Thuermann <urs.thuermann@volkswagen.de>
8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
9 * All rights reserved.
10 *
11 * Send feedback to <socketcan-users@lists.berlios.de>
12 *
13 */
14
15#ifndef CAN_RAW_H
16#define CAN_RAW_H
17
18#include <linux/can.h>
19
20#define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)
21
22/* for socket options affecting the socket (not the global system) */
23
24enum {
25 CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */
26 CAN_RAW_ERR_FILTER, /* set filter for error frames */
27 CAN_RAW_LOOPBACK, /* local loopback (default:on) */
28 CAN_RAW_RECV_OWN_MSGS /* receive my own msgs (default:off) */
29};
30
31#endif
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index c6d3e22c0624..fcdc11b9609b 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -451,6 +451,7 @@ struct cdrom_generic_command
451#define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e 451#define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
452#define GPCMD_READ_10 0x28 452#define GPCMD_READ_10 0x28
453#define GPCMD_READ_12 0xa8 453#define GPCMD_READ_12 0xa8
454#define GPCMD_READ_BUFFER 0x3c
454#define GPCMD_READ_BUFFER_CAPACITY 0x5c 455#define GPCMD_READ_BUFFER_CAPACITY 0x5c
455#define GPCMD_READ_CDVD_CAPACITY 0x25 456#define GPCMD_READ_CDVD_CAPACITY 0x25
456#define GPCMD_READ_CD 0xbe 457#define GPCMD_READ_CD 0xbe
@@ -480,7 +481,9 @@ struct cdrom_generic_command
480#define GPCMD_TEST_UNIT_READY 0x00 481#define GPCMD_TEST_UNIT_READY 0x00
481#define GPCMD_VERIFY_10 0x2f 482#define GPCMD_VERIFY_10 0x2f
482#define GPCMD_WRITE_10 0x2a 483#define GPCMD_WRITE_10 0x2a
484#define GPCMD_WRITE_12 0xaa
483#define GPCMD_WRITE_AND_VERIFY_10 0x2e 485#define GPCMD_WRITE_AND_VERIFY_10 0x2e
486#define GPCMD_WRITE_BUFFER 0x3b
484/* This is listed as optional in ATAPI 2.6, but is (curiously) 487/* This is listed as optional in ATAPI 2.6, but is (curiously)
485 * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji 488 * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji
486 * Table 377 as an MMC command for SCSi devices though... Most ATAPI 489 * Table 377 as an MMC command for SCSi devices though... Most ATAPI
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 107787aacb64..85778a4b1209 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -103,7 +103,7 @@ struct clocksource {
103#define CLOCK_SOURCE_VALID_FOR_HRES 0x20 103#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
104 104
105/* simplify initialization of mask field */ 105/* simplify initialization of mask field */
106#define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1) 106#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
107 107
108/** 108/**
109 * clocksource_khz2mult - calculates mult from khz and shift 109 * clocksource_khz2mult - calculates mult from khz and shift
@@ -215,6 +215,7 @@ static inline void clocksource_calculate_interval(struct clocksource *c,
215 215
216/* used to install a new clocksource */ 216/* used to install a new clocksource */
217extern int clocksource_register(struct clocksource*); 217extern int clocksource_register(struct clocksource*);
218extern void clocksource_unregister(struct clocksource*);
218extern struct clocksource* clocksource_get_next(void); 219extern struct clocksource* clocksource_get_next(void);
219extern void clocksource_change_rating(struct clocksource *cs, int rating); 220extern void clocksource_change_rating(struct clocksource *cs, int rating);
220extern void clocksource_resume(void); 221extern void clocksource_resume(void);
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 0e69d2cf14aa..d38655f2be70 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -191,6 +191,10 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
191 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 191 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
192 struct compat_timeval __user *tvp); 192 struct compat_timeval __user *tvp);
193 193
194asmlinkage long compat_sys_wait4(compat_pid_t pid,
195 compat_uint_t *stat_addr, int options,
196 struct compat_rusage *ru);
197
194#define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t)) 198#define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t))
195 199
196#define BITS_TO_COMPAT_LONGS(bits) \ 200#define BITS_TO_COMPAT_LONGS(bits) \
@@ -239,6 +243,17 @@ asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
239 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, 243 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
240 const compat_ulong_t __user *new_nodes); 244 const compat_ulong_t __user *new_nodes);
241 245
246extern int compat_ptrace_request(struct task_struct *child,
247 compat_long_t request,
248 compat_ulong_t addr, compat_ulong_t data);
249
250#ifdef __ARCH_WANT_COMPAT_SYS_PTRACE
251extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
252 compat_ulong_t addr, compat_ulong_t data);
253asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
254 compat_long_t addr, compat_long_t data);
255#endif /* __ARCH_WANT_COMPAT_SYS_PTRACE */
256
242/* 257/*
243 * epoll (fs/eventpoll.c) compat bits follow ... 258 * epoll (fs/eventpoll.c) compat bits follow ...
244 */ 259 */
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index 2d8c0f48f55e..e5eb795f78a1 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -7,10 +7,8 @@
7 7
8#if __GNUC_MINOR__ >= 3 8#if __GNUC_MINOR__ >= 3
9# define __used __attribute__((__used__)) 9# define __used __attribute__((__used__))
10# define __attribute_used__ __used /* deprecated */
11#else 10#else
12# define __used __attribute__((__unused__)) 11# define __used __attribute__((__unused__))
13# define __attribute_used__ __used /* deprecated */
14#endif 12#endif
15 13
16#if __GNUC_MINOR__ >= 4 14#if __GNUC_MINOR__ >= 4
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index ee7ca5de970c..0ab3a3232330 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -15,7 +15,6 @@
15#endif 15#endif
16 16
17#define __used __attribute__((__used__)) 17#define __used __attribute__((__used__))
18#define __attribute_used__ __used /* deprecated */
19#define __must_check __attribute__((warn_unused_result)) 18#define __must_check __attribute__((warn_unused_result))
20#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 19#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
21#define __always_inline inline __attribute__((always_inline)) 20#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index c68b67b86ef1..d0e17e1657dc 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -126,10 +126,6 @@ extern void __chk_io_ptr(const volatile void __iomem *);
126 * Mark functions that are referenced only in inline assembly as __used so 126 * Mark functions that are referenced only in inline assembly as __used so
127 * the code is emitted even though it appears to be unreferenced. 127 * the code is emitted even though it appears to be unreferenced.
128 */ 128 */
129#ifndef __attribute_used__
130# define __attribute_used__ /* deprecated */
131#endif
132
133#ifndef __used 129#ifndef __used
134# define __used /* unimplemented */ 130# define __used /* unimplemented */
135#endif 131#endif
@@ -175,4 +171,9 @@ extern void __chk_io_ptr(const volatile void __iomem *);
175#define __cold 171#define __cold
176#endif 172#endif
177 173
174/* Simple shorthand for a section definition */
175#ifndef __section
176# define __section(S) __attribute__ ((__section__(#S)))
177#endif
178
178#endif /* __LINUX_COMPILER_H */ 179#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 13fc4541bf23..da6dd957f908 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -112,7 +112,6 @@ struct cn_queue_dev {
112 struct list_head queue_list; 112 struct list_head queue_list;
113 spinlock_t queue_lock; 113 spinlock_t queue_lock;
114 114
115 int netlink_groups;
116 struct sock *nls; 115 struct sock *nls;
117}; 116};
118 117
@@ -133,15 +132,13 @@ struct cn_callback_data {
133 132
134struct cn_callback_entry { 133struct cn_callback_entry {
135 struct list_head callback_entry; 134 struct list_head callback_entry;
136 struct cn_callback *cb;
137 struct work_struct work; 135 struct work_struct work;
138 struct cn_queue_dev *pdev; 136 struct cn_queue_dev *pdev;
139 137
140 struct cn_callback_id id; 138 struct cn_callback_id id;
141 struct cn_callback_data data; 139 struct cn_callback_data data;
142 140
143 int seq, group; 141 u32 seq, group;
144 struct sock *nls;
145}; 142};
146 143
147struct cn_ctl_entry { 144struct cn_ctl_entry {
diff --git a/include/linux/const.h b/include/linux/const.h
index 07b300bfe34b..c22c707c455d 100644
--- a/include/linux/const.h
+++ b/include/linux/const.h
@@ -7,13 +7,18 @@
7 * C code. Therefore we cannot annotate them always with 7 * C code. Therefore we cannot annotate them always with
8 * 'UL' and other type specifiers unilaterally. We 8 * 'UL' and other type specifiers unilaterally. We
9 * use the following macros to deal with this. 9 * use the following macros to deal with this.
10 *
11 * Similarly, _AT() will cast an expression with a type in C, but
12 * leave it unchanged in asm.
10 */ 13 */
11 14
12#ifdef __ASSEMBLY__ 15#ifdef __ASSEMBLY__
13#define _AC(X,Y) X 16#define _AC(X,Y) X
17#define _AT(T,X) X
14#else 18#else
15#define __AC(X,Y) (X##Y) 19#define __AC(X,Y) (X##Y)
16#define _AC(X,Y) __AC(X,Y) 20#define _AC(X,Y) __AC(X,Y)
21#define _AT(T,X) ((T)(X))
17#endif 22#endif
18 23
19#endif /* !(_LINUX_CONST_H) */ 24#endif /* !(_LINUX_CONST_H) */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 92f2029a34f3..0be8d65bc3c8 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -71,18 +71,27 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
71 71
72int cpu_up(unsigned int cpu); 72int cpu_up(unsigned int cpu);
73 73
74extern void cpu_hotplug_init(void);
75
74#else 76#else
75 77
76static inline int register_cpu_notifier(struct notifier_block *nb) 78static inline int register_cpu_notifier(struct notifier_block *nb)
77{ 79{
78 return 0; 80 return 0;
79} 81}
82
80static inline void unregister_cpu_notifier(struct notifier_block *nb) 83static inline void unregister_cpu_notifier(struct notifier_block *nb)
81{ 84{
82} 85}
83 86
87static inline void cpu_hotplug_init(void)
88{
89}
90
84#endif /* CONFIG_SMP */ 91#endif /* CONFIG_SMP */
85extern struct sysdev_class cpu_sysdev_class; 92extern struct sysdev_class cpu_sysdev_class;
93extern void cpu_maps_update_begin(void);
94extern void cpu_maps_update_done(void);
86 95
87#ifdef CONFIG_HOTPLUG_CPU 96#ifdef CONFIG_HOTPLUG_CPU
88/* Stop CPUs going up and down. */ 97/* Stop CPUs going up and down. */
@@ -97,8 +106,8 @@ static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
97 mutex_unlock(cpu_hp_mutex); 106 mutex_unlock(cpu_hp_mutex);
98} 107}
99 108
100extern void lock_cpu_hotplug(void); 109extern void get_online_cpus(void);
101extern void unlock_cpu_hotplug(void); 110extern void put_online_cpus(void);
102#define hotcpu_notifier(fn, pri) { \ 111#define hotcpu_notifier(fn, pri) { \
103 static struct notifier_block fn##_nb = \ 112 static struct notifier_block fn##_nb = \
104 { .notifier_call = fn, .priority = pri }; \ 113 { .notifier_call = fn, .priority = pri }; \
@@ -115,8 +124,8 @@ static inline void cpuhotplug_mutex_lock(struct mutex *cpu_hp_mutex)
115static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex) 124static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
116{ } 125{ }
117 126
118#define lock_cpu_hotplug() do { } while (0) 127#define get_online_cpus() do { } while (0)
119#define unlock_cpu_hotplug() do { } while (0) 128#define put_online_cpus() do { } while (0)
120#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0) 129#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
121/* These aren't inline functions due to a GCC bug. */ 130/* These aren't inline functions due to a GCC bug. */
122#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; }) 131#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 85bd790c201e..7047f58306a7 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -218,8 +218,8 @@ int __first_cpu(const cpumask_t *srcp);
218int __next_cpu(int n, const cpumask_t *srcp); 218int __next_cpu(int n, const cpumask_t *srcp);
219#define next_cpu(n, src) __next_cpu((n), &(src)) 219#define next_cpu(n, src) __next_cpu((n), &(src))
220#else 220#else
221#define first_cpu(src) 0 221#define first_cpu(src) ({ (void)(src); 0; })
222#define next_cpu(n, src) 1 222#define next_cpu(n, src) ({ (void)(src); 1; })
223#endif 223#endif
224 224
225#define cpumask_of_cpu(cpu) \ 225#define cpumask_of_cpu(cpu) \
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index f3110ebe894a..5e02d1b46370 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -33,10 +33,13 @@
33#define CRYPTO_ALG_TYPE_DIGEST 0x00000002 33#define CRYPTO_ALG_TYPE_DIGEST 0x00000002
34#define CRYPTO_ALG_TYPE_HASH 0x00000003 34#define CRYPTO_ALG_TYPE_HASH 0x00000003
35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
36#define CRYPTO_ALG_TYPE_COMPRESS 0x00000005 36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005
37#define CRYPTO_ALG_TYPE_AEAD 0x00000006 37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006
38#define CRYPTO_ALG_TYPE_COMPRESS 0x00000008
39#define CRYPTO_ALG_TYPE_AEAD 0x00000009
38 40
39#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e 41#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
42#define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c
40 43
41#define CRYPTO_ALG_LARVAL 0x00000010 44#define CRYPTO_ALG_LARVAL 0x00000010
42#define CRYPTO_ALG_DEAD 0x00000020 45#define CRYPTO_ALG_DEAD 0x00000020
@@ -50,6 +53,12 @@
50#define CRYPTO_ALG_NEED_FALLBACK 0x00000100 53#define CRYPTO_ALG_NEED_FALLBACK 0x00000100
51 54
52/* 55/*
56 * This bit is set for symmetric key ciphers that have already been wrapped
57 * with a generic IV generator to prevent them from being wrapped again.
58 */
59#define CRYPTO_ALG_GENIV 0x00000200
60
61/*
53 * Transform masks and values (for crt_flags). 62 * Transform masks and values (for crt_flags).
54 */ 63 */
55#define CRYPTO_TFM_REQ_MASK 0x000fff00 64#define CRYPTO_TFM_REQ_MASK 0x000fff00
@@ -81,13 +90,11 @@
81#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN 90#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
82#elif defined(ARCH_SLAB_MINALIGN) 91#elif defined(ARCH_SLAB_MINALIGN)
83#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN 92#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
93#else
94#define CRYPTO_MINALIGN __alignof__(unsigned long long)
84#endif 95#endif
85 96
86#ifdef CRYPTO_MINALIGN
87#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN))) 97#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
88#else
89#define CRYPTO_MINALIGN_ATTR
90#endif
91 98
92struct scatterlist; 99struct scatterlist;
93struct crypto_ablkcipher; 100struct crypto_ablkcipher;
@@ -97,6 +104,8 @@ struct crypto_blkcipher;
97struct crypto_hash; 104struct crypto_hash;
98struct crypto_tfm; 105struct crypto_tfm;
99struct crypto_type; 106struct crypto_type;
107struct aead_givcrypt_request;
108struct skcipher_givcrypt_request;
100 109
101typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err); 110typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
102 111
@@ -176,6 +185,10 @@ struct ablkcipher_alg {
176 unsigned int keylen); 185 unsigned int keylen);
177 int (*encrypt)(struct ablkcipher_request *req); 186 int (*encrypt)(struct ablkcipher_request *req);
178 int (*decrypt)(struct ablkcipher_request *req); 187 int (*decrypt)(struct ablkcipher_request *req);
188 int (*givencrypt)(struct skcipher_givcrypt_request *req);
189 int (*givdecrypt)(struct skcipher_givcrypt_request *req);
190
191 const char *geniv;
179 192
180 unsigned int min_keysize; 193 unsigned int min_keysize;
181 unsigned int max_keysize; 194 unsigned int max_keysize;
@@ -185,11 +198,16 @@ struct ablkcipher_alg {
185struct aead_alg { 198struct aead_alg {
186 int (*setkey)(struct crypto_aead *tfm, const u8 *key, 199 int (*setkey)(struct crypto_aead *tfm, const u8 *key,
187 unsigned int keylen); 200 unsigned int keylen);
201 int (*setauthsize)(struct crypto_aead *tfm, unsigned int authsize);
188 int (*encrypt)(struct aead_request *req); 202 int (*encrypt)(struct aead_request *req);
189 int (*decrypt)(struct aead_request *req); 203 int (*decrypt)(struct aead_request *req);
204 int (*givencrypt)(struct aead_givcrypt_request *req);
205 int (*givdecrypt)(struct aead_givcrypt_request *req);
206
207 const char *geniv;
190 208
191 unsigned int ivsize; 209 unsigned int ivsize;
192 unsigned int authsize; 210 unsigned int maxauthsize;
193}; 211};
194 212
195struct blkcipher_alg { 213struct blkcipher_alg {
@@ -202,6 +220,8 @@ struct blkcipher_alg {
202 struct scatterlist *dst, struct scatterlist *src, 220 struct scatterlist *dst, struct scatterlist *src,
203 unsigned int nbytes); 221 unsigned int nbytes);
204 222
223 const char *geniv;
224
205 unsigned int min_keysize; 225 unsigned int min_keysize;
206 unsigned int max_keysize; 226 unsigned int max_keysize;
207 unsigned int ivsize; 227 unsigned int ivsize;
@@ -317,6 +337,11 @@ struct ablkcipher_tfm {
317 unsigned int keylen); 337 unsigned int keylen);
318 int (*encrypt)(struct ablkcipher_request *req); 338 int (*encrypt)(struct ablkcipher_request *req);
319 int (*decrypt)(struct ablkcipher_request *req); 339 int (*decrypt)(struct ablkcipher_request *req);
340 int (*givencrypt)(struct skcipher_givcrypt_request *req);
341 int (*givdecrypt)(struct skcipher_givcrypt_request *req);
342
343 struct crypto_ablkcipher *base;
344
320 unsigned int ivsize; 345 unsigned int ivsize;
321 unsigned int reqsize; 346 unsigned int reqsize;
322}; 347};
@@ -326,6 +351,11 @@ struct aead_tfm {
326 unsigned int keylen); 351 unsigned int keylen);
327 int (*encrypt)(struct aead_request *req); 352 int (*encrypt)(struct aead_request *req);
328 int (*decrypt)(struct aead_request *req); 353 int (*decrypt)(struct aead_request *req);
354 int (*givencrypt)(struct aead_givcrypt_request *req);
355 int (*givdecrypt)(struct aead_givcrypt_request *req);
356
357 struct crypto_aead *base;
358
329 unsigned int ivsize; 359 unsigned int ivsize;
330 unsigned int authsize; 360 unsigned int authsize;
331 unsigned int reqsize; 361 unsigned int reqsize;
@@ -525,17 +555,23 @@ static inline struct crypto_ablkcipher *__crypto_ablkcipher_cast(
525 return (struct crypto_ablkcipher *)tfm; 555 return (struct crypto_ablkcipher *)tfm;
526} 556}
527 557
528static inline struct crypto_ablkcipher *crypto_alloc_ablkcipher( 558static inline u32 crypto_skcipher_type(u32 type)
529 const char *alg_name, u32 type, u32 mask)
530{ 559{
531 type &= ~CRYPTO_ALG_TYPE_MASK; 560 type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV);
532 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 561 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
533 mask |= CRYPTO_ALG_TYPE_MASK; 562 return type;
563}
534 564
535 return __crypto_ablkcipher_cast( 565static inline u32 crypto_skcipher_mask(u32 mask)
536 crypto_alloc_base(alg_name, type, mask)); 566{
567 mask &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV);
568 mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
569 return mask;
537} 570}
538 571
572struct crypto_ablkcipher *crypto_alloc_ablkcipher(const char *alg_name,
573 u32 type, u32 mask);
574
539static inline struct crypto_tfm *crypto_ablkcipher_tfm( 575static inline struct crypto_tfm *crypto_ablkcipher_tfm(
540 struct crypto_ablkcipher *tfm) 576 struct crypto_ablkcipher *tfm)
541{ 577{
@@ -550,11 +586,8 @@ static inline void crypto_free_ablkcipher(struct crypto_ablkcipher *tfm)
550static inline int crypto_has_ablkcipher(const char *alg_name, u32 type, 586static inline int crypto_has_ablkcipher(const char *alg_name, u32 type,
551 u32 mask) 587 u32 mask)
552{ 588{
553 type &= ~CRYPTO_ALG_TYPE_MASK; 589 return crypto_has_alg(alg_name, crypto_skcipher_type(type),
554 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 590 crypto_skcipher_mask(mask));
555 mask |= CRYPTO_ALG_TYPE_MASK;
556
557 return crypto_has_alg(alg_name, type, mask);
558} 591}
559 592
560static inline struct ablkcipher_tfm *crypto_ablkcipher_crt( 593static inline struct ablkcipher_tfm *crypto_ablkcipher_crt(
@@ -601,7 +634,9 @@ static inline void crypto_ablkcipher_clear_flags(struct crypto_ablkcipher *tfm,
601static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm, 634static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
602 const u8 *key, unsigned int keylen) 635 const u8 *key, unsigned int keylen)
603{ 636{
604 return crypto_ablkcipher_crt(tfm)->setkey(tfm, key, keylen); 637 struct ablkcipher_tfm *crt = crypto_ablkcipher_crt(tfm);
638
639 return crt->setkey(crt->base, key, keylen);
605} 640}
606 641
607static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm( 642static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm(
@@ -633,7 +668,7 @@ static inline unsigned int crypto_ablkcipher_reqsize(
633static inline void ablkcipher_request_set_tfm( 668static inline void ablkcipher_request_set_tfm(
634 struct ablkcipher_request *req, struct crypto_ablkcipher *tfm) 669 struct ablkcipher_request *req, struct crypto_ablkcipher *tfm)
635{ 670{
636 req->base.tfm = crypto_ablkcipher_tfm(tfm); 671 req->base.tfm = crypto_ablkcipher_tfm(crypto_ablkcipher_crt(tfm)->base);
637} 672}
638 673
639static inline struct ablkcipher_request *ablkcipher_request_cast( 674static inline struct ablkcipher_request *ablkcipher_request_cast(
@@ -686,15 +721,7 @@ static inline struct crypto_aead *__crypto_aead_cast(struct crypto_tfm *tfm)
686 return (struct crypto_aead *)tfm; 721 return (struct crypto_aead *)tfm;
687} 722}
688 723
689static inline struct crypto_aead *crypto_alloc_aead(const char *alg_name, 724struct crypto_aead *crypto_alloc_aead(const char *alg_name, u32 type, u32 mask);
690 u32 type, u32 mask)
691{
692 type &= ~CRYPTO_ALG_TYPE_MASK;
693 type |= CRYPTO_ALG_TYPE_AEAD;
694 mask |= CRYPTO_ALG_TYPE_MASK;
695
696 return __crypto_aead_cast(crypto_alloc_base(alg_name, type, mask));
697}
698 725
699static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm) 726static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm)
700{ 727{
@@ -749,9 +776,13 @@ static inline void crypto_aead_clear_flags(struct crypto_aead *tfm, u32 flags)
749static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key, 776static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key,
750 unsigned int keylen) 777 unsigned int keylen)
751{ 778{
752 return crypto_aead_crt(tfm)->setkey(tfm, key, keylen); 779 struct aead_tfm *crt = crypto_aead_crt(tfm);
780
781 return crt->setkey(crt->base, key, keylen);
753} 782}
754 783
784int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize);
785
755static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req) 786static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req)
756{ 787{
757 return __crypto_aead_cast(req->base.tfm); 788 return __crypto_aead_cast(req->base.tfm);
@@ -775,7 +806,7 @@ static inline unsigned int crypto_aead_reqsize(struct crypto_aead *tfm)
775static inline void aead_request_set_tfm(struct aead_request *req, 806static inline void aead_request_set_tfm(struct aead_request *req,
776 struct crypto_aead *tfm) 807 struct crypto_aead *tfm)
777{ 808{
778 req->base.tfm = crypto_aead_tfm(tfm); 809 req->base.tfm = crypto_aead_tfm(crypto_aead_crt(tfm)->base);
779} 810}
780 811
781static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm, 812static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
@@ -841,9 +872,9 @@ static inline struct crypto_blkcipher *crypto_blkcipher_cast(
841static inline struct crypto_blkcipher *crypto_alloc_blkcipher( 872static inline struct crypto_blkcipher *crypto_alloc_blkcipher(
842 const char *alg_name, u32 type, u32 mask) 873 const char *alg_name, u32 type, u32 mask)
843{ 874{
844 type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC); 875 type &= ~CRYPTO_ALG_TYPE_MASK;
845 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 876 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
846 mask |= CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC; 877 mask |= CRYPTO_ALG_TYPE_MASK;
847 878
848 return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask)); 879 return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask));
849} 880}
@@ -861,9 +892,9 @@ static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm)
861 892
862static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask) 893static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask)
863{ 894{
864 type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC); 895 type &= ~CRYPTO_ALG_TYPE_MASK;
865 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 896 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
866 mask |= CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC; 897 mask |= CRYPTO_ALG_TYPE_MASK;
867 898
868 return crypto_has_alg(alg_name, type, mask); 899 return crypto_has_alg(alg_name, type, mask);
869} 900}
@@ -1081,6 +1112,7 @@ static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name,
1081 u32 type, u32 mask) 1112 u32 type, u32 mask)
1082{ 1113{
1083 type &= ~CRYPTO_ALG_TYPE_MASK; 1114 type &= ~CRYPTO_ALG_TYPE_MASK;
1115 mask &= ~CRYPTO_ALG_TYPE_MASK;
1084 type |= CRYPTO_ALG_TYPE_HASH; 1116 type |= CRYPTO_ALG_TYPE_HASH;
1085 mask |= CRYPTO_ALG_TYPE_HASH_MASK; 1117 mask |= CRYPTO_ALG_TYPE_HASH_MASK;
1086 1118
@@ -1100,6 +1132,7 @@ static inline void crypto_free_hash(struct crypto_hash *tfm)
1100static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask) 1132static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask)
1101{ 1133{
1102 type &= ~CRYPTO_ALG_TYPE_MASK; 1134 type &= ~CRYPTO_ALG_TYPE_MASK;
1135 mask &= ~CRYPTO_ALG_TYPE_MASK;
1103 type |= CRYPTO_ALG_TYPE_HASH; 1136 type |= CRYPTO_ALG_TYPE_HASH;
1104 mask |= CRYPTO_ALG_TYPE_HASH_MASK; 1137 mask |= CRYPTO_ALG_TYPE_HASH_MASK;
1105 1138
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 333c3ea82a5d..484e45c7c89a 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -205,6 +205,7 @@ struct dccp_so_feat {
205#define DCCP_SOCKOPT_CHANGE_L 3 205#define DCCP_SOCKOPT_CHANGE_L 3
206#define DCCP_SOCKOPT_CHANGE_R 4 206#define DCCP_SOCKOPT_CHANGE_R 4
207#define DCCP_SOCKOPT_GET_CUR_MPS 5 207#define DCCP_SOCKOPT_GET_CUR_MPS 5
208#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
208#define DCCP_SOCKOPT_SEND_CSCOV 10 209#define DCCP_SOCKOPT_SEND_CSCOV 10
209#define DCCP_SOCKOPT_RECV_CSCOV 11 210#define DCCP_SOCKOPT_RECV_CSCOV 11
210#define DCCP_SOCKOPT_CCID_RX_INFO 128 211#define DCCP_SOCKOPT_CCID_RX_INFO 128
@@ -227,37 +228,50 @@ struct dccp_so_feat {
227#include <net/tcp_states.h> 228#include <net/tcp_states.h>
228 229
229enum dccp_state { 230enum dccp_state {
230 DCCP_OPEN = TCP_ESTABLISHED, 231 DCCP_OPEN = TCP_ESTABLISHED,
231 DCCP_REQUESTING = TCP_SYN_SENT, 232 DCCP_REQUESTING = TCP_SYN_SENT,
232 DCCP_PARTOPEN = TCP_FIN_WAIT1, /* FIXME: 233 DCCP_LISTEN = TCP_LISTEN,
233 This mapping is horrible, but TCP has 234 DCCP_RESPOND = TCP_SYN_RECV,
234 no matching state for DCCP_PARTOPEN, 235 /*
235 as TCP_SYN_RECV is already used by 236 * States involved in closing a DCCP connection:
236 DCCP_RESPOND, why don't stop using TCP 237 * 1) ACTIVE_CLOSEREQ is entered by a server sending a CloseReq.
237 mapping of states? OK, now we don't use 238 *
238 sk_stream_sendmsg anymore, so doesn't 239 * 2) CLOSING can have three different meanings (RFC 4340, 8.3):
239 seem to exist any reason for us to 240 * a. Client has performed active-close, has sent a Close to the server
240 do the TCP mapping here */ 241 * from state OPEN or PARTOPEN, and is waiting for the final Reset
241 DCCP_LISTEN = TCP_LISTEN, 242 * (in this case, SOCK_DONE == 1).
242 DCCP_RESPOND = TCP_SYN_RECV, 243 * b. Client is asked to perform passive-close, by receiving a CloseReq
243 DCCP_CLOSING = TCP_CLOSING, 244 * in (PART)OPEN state. It sends a Close and waits for final Reset
244 DCCP_TIME_WAIT = TCP_TIME_WAIT, 245 * (in this case, SOCK_DONE == 0).
245 DCCP_CLOSED = TCP_CLOSE, 246 * c. Server performs an active-close as in (a), keeps TIMEWAIT state.
246 DCCP_MAX_STATES = TCP_MAX_STATES, 247 *
248 * 3) The following intermediate states are employed to give passively
249 * closing nodes a chance to process their unread data:
250 * - PASSIVE_CLOSE (from OPEN => CLOSED) and
251 * - PASSIVE_CLOSEREQ (from (PART)OPEN to CLOSING; case (b) above).
252 */
253 DCCP_ACTIVE_CLOSEREQ = TCP_FIN_WAIT1,
254 DCCP_PASSIVE_CLOSE = TCP_CLOSE_WAIT, /* any node receiving a Close */
255 DCCP_CLOSING = TCP_CLOSING,
256 DCCP_TIME_WAIT = TCP_TIME_WAIT,
257 DCCP_CLOSED = TCP_CLOSE,
258 DCCP_PARTOPEN = TCP_MAX_STATES,
259 DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */
260 DCCP_MAX_STATES
247}; 261};
248 262
249#define DCCP_STATE_MASK 0xf 263#define DCCP_STATE_MASK 0x1f
250#define DCCP_ACTION_FIN (1<<7)
251 264
252enum { 265enum {
253 DCCPF_OPEN = TCPF_ESTABLISHED, 266 DCCPF_OPEN = TCPF_ESTABLISHED,
254 DCCPF_REQUESTING = TCPF_SYN_SENT, 267 DCCPF_REQUESTING = TCPF_SYN_SENT,
255 DCCPF_PARTOPEN = TCPF_FIN_WAIT1, 268 DCCPF_LISTEN = TCPF_LISTEN,
256 DCCPF_LISTEN = TCPF_LISTEN, 269 DCCPF_RESPOND = TCPF_SYN_RECV,
257 DCCPF_RESPOND = TCPF_SYN_RECV, 270 DCCPF_ACTIVE_CLOSEREQ = TCPF_FIN_WAIT1,
258 DCCPF_CLOSING = TCPF_CLOSING, 271 DCCPF_CLOSING = TCPF_CLOSING,
259 DCCPF_TIME_WAIT = TCPF_TIME_WAIT, 272 DCCPF_TIME_WAIT = TCPF_TIME_WAIT,
260 DCCPF_CLOSED = TCPF_CLOSE, 273 DCCPF_CLOSED = TCPF_CLOSE,
274 DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN),
261}; 275};
262 276
263static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) 277static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
@@ -393,13 +407,23 @@ struct dccp_opt_pend {
393 407
394extern void dccp_minisock_init(struct dccp_minisock *dmsk); 408extern void dccp_minisock_init(struct dccp_minisock *dmsk);
395 409
396extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb); 410/**
397 411 * struct dccp_request_sock - represent DCCP-specific connection request
412 * @dreq_inet_rsk: structure inherited from
413 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1)
414 * @dreq_isr: initial sequence number received on the Request
415 * @dreq_service: service code present on the Request (there is just one)
416 * The following two fields are analogous to the ones in dccp_sock:
417 * @dreq_timestamp_echo: last received timestamp to echo (13.1)
418 * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo
419 */
398struct dccp_request_sock { 420struct dccp_request_sock {
399 struct inet_request_sock dreq_inet_rsk; 421 struct inet_request_sock dreq_inet_rsk;
400 __u64 dreq_iss; 422 __u64 dreq_iss;
401 __u64 dreq_isr; 423 __u64 dreq_isr;
402 __be32 dreq_service; 424 __be32 dreq_service;
425 __u32 dreq_timestamp_echo;
426 __u32 dreq_timestamp_time;
403}; 427};
404 428
405static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) 429static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req)
@@ -409,6 +433,9 @@ static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req)
409 433
410extern struct inet_timewait_death_row dccp_death_row; 434extern struct inet_timewait_death_row dccp_death_row;
411 435
436extern int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
437 struct sk_buff *skb);
438
412struct dccp_options_received { 439struct dccp_options_received {
413 u32 dccpor_ndp; /* only 24 bits */ 440 u32 dccpor_ndp; /* only 24 bits */
414 u32 dccpor_timestamp; 441 u32 dccpor_timestamp;
@@ -462,8 +489,8 @@ struct dccp_ackvec;
462 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss 489 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
463 * @dccps_service - first (passive sock) or unique (active sock) service code 490 * @dccps_service - first (passive sock) or unique (active sock) service code
464 * @dccps_service_list - second .. last service code on passive socket 491 * @dccps_service_list - second .. last service code on passive socket
465 * @dccps_timestamp_time - time of latest TIMESTAMP option
466 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 492 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
493 * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo
467 * @dccps_l_ack_ratio - feature-local Ack Ratio 494 * @dccps_l_ack_ratio - feature-local Ack Ratio
468 * @dccps_r_ack_ratio - feature-remote Ack Ratio 495 * @dccps_r_ack_ratio - feature-remote Ack Ratio
469 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 496 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
@@ -479,6 +506,7 @@ struct dccp_ackvec;
479 * @dccps_role - role of this sock, one of %dccp_role 506 * @dccps_role - role of this sock, one of %dccp_role
480 * @dccps_hc_rx_insert_options - receiver wants to add options when acking 507 * @dccps_hc_rx_insert_options - receiver wants to add options when acking
481 * @dccps_hc_tx_insert_options - sender wants to add options when sending 508 * @dccps_hc_tx_insert_options - sender wants to add options when sending
509 * @dccps_server_timewait - server holds timewait state on close (RFC 4340, 8.3)
482 * @dccps_xmit_timer - timer for when CCID is not ready to send 510 * @dccps_xmit_timer - timer for when CCID is not ready to send
483 * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs) 511 * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs)
484 */ 512 */
@@ -498,8 +526,8 @@ struct dccp_sock {
498 __u64 dccps_gar; 526 __u64 dccps_gar;
499 __be32 dccps_service; 527 __be32 dccps_service;
500 struct dccp_service_list *dccps_service_list; 528 struct dccp_service_list *dccps_service_list;
501 ktime_t dccps_timestamp_time;
502 __u32 dccps_timestamp_echo; 529 __u32 dccps_timestamp_echo;
530 __u32 dccps_timestamp_time;
503 __u16 dccps_l_ack_ratio; 531 __u16 dccps_l_ack_ratio;
504 __u16 dccps_r_ack_ratio; 532 __u16 dccps_r_ack_ratio;
505 __u16 dccps_pcslen; 533 __u16 dccps_pcslen;
@@ -515,6 +543,7 @@ struct dccp_sock {
515 enum dccp_role dccps_role:2; 543 enum dccp_role dccps_role:2;
516 __u8 dccps_hc_rx_insert_options:1; 544 __u8 dccps_hc_rx_insert_options:1;
517 __u8 dccps_hc_tx_insert_options:1; 545 __u8 dccps_hc_tx_insert_options:1;
546 __u8 dccps_server_timewait:1;
518 struct timer_list dccps_xmit_timer; 547 struct timer_list dccps_xmit_timer;
519}; 548};
520 549
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 1678a5de7013..f4a5871767f5 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -47,6 +47,7 @@ struct task_struct;
47 47
48#ifdef CONFIG_LOCKDEP 48#ifdef CONFIG_LOCKDEP
49extern void debug_show_all_locks(void); 49extern void debug_show_all_locks(void);
50extern void __debug_show_held_locks(struct task_struct *task);
50extern void debug_show_held_locks(struct task_struct *task); 51extern void debug_show_held_locks(struct task_struct *task);
51extern void debug_check_no_locks_freed(const void *from, unsigned long len); 52extern void debug_check_no_locks_freed(const void *from, unsigned long len);
52extern void debug_check_no_locks_held(struct task_struct *task); 53extern void debug_check_no_locks_held(struct task_struct *task);
@@ -55,6 +56,10 @@ static inline void debug_show_all_locks(void)
55{ 56{
56} 57}
57 58
59static inline void __debug_show_held_locks(struct task_struct *task)
60{
61}
62
58static inline void debug_show_held_locks(struct task_struct *task) 63static inline void debug_show_held_locks(struct task_struct *task)
59{ 64{
60} 65}
diff --git a/include/linux/device.h b/include/linux/device.h
index 2e15822fe409..db375be333c7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -25,75 +25,72 @@
25#include <asm/device.h> 25#include <asm/device.h>
26 26
27#define DEVICE_NAME_SIZE 50 27#define DEVICE_NAME_SIZE 50
28#define DEVICE_NAME_HALF __stringify(20) /* Less than half to accommodate slop */ 28/* DEVICE_NAME_HALF is really less than half to accommodate slop */
29#define DEVICE_NAME_HALF __stringify(20)
29#define DEVICE_ID_SIZE 32 30#define DEVICE_ID_SIZE 32
30#define BUS_ID_SIZE KOBJ_NAME_LEN 31#define BUS_ID_SIZE KOBJ_NAME_LEN
31 32
32 33
33struct device; 34struct device;
34struct device_driver; 35struct device_driver;
36struct driver_private;
35struct class; 37struct class;
36struct class_device; 38struct class_device;
37struct bus_type; 39struct bus_type;
40struct bus_type_private;
38 41
39struct bus_attribute { 42struct bus_attribute {
40 struct attribute attr; 43 struct attribute attr;
41 ssize_t (*show)(struct bus_type *, char * buf); 44 ssize_t (*show)(struct bus_type *bus, char *buf);
42 ssize_t (*store)(struct bus_type *, const char * buf, size_t count); 45 ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count);
43}; 46};
44 47
45#define BUS_ATTR(_name,_mode,_show,_store) \ 48#define BUS_ATTR(_name, _mode, _show, _store) \
46struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) 49struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
47 50
48extern int __must_check bus_create_file(struct bus_type *, 51extern int __must_check bus_create_file(struct bus_type *,
49 struct bus_attribute *); 52 struct bus_attribute *);
50extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 53extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
51 54
52struct bus_type { 55struct bus_type {
53 const char * name; 56 const char *name;
54 struct module * owner; 57 struct bus_attribute *bus_attrs;
58 struct device_attribute *dev_attrs;
59 struct driver_attribute *drv_attrs;
55 60
56 struct kset subsys; 61 int (*match)(struct device *dev, struct device_driver *drv);
57 struct kset drivers; 62 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
58 struct kset devices; 63 int (*probe)(struct device *dev);
59 struct klist klist_devices; 64 int (*remove)(struct device *dev);
60 struct klist klist_drivers; 65 void (*shutdown)(struct device *dev);
61
62 struct blocking_notifier_head bus_notifier;
63
64 struct bus_attribute * bus_attrs;
65 struct device_attribute * dev_attrs;
66 struct driver_attribute * drv_attrs;
67
68 int (*match)(struct device * dev, struct device_driver * drv);
69 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
70 int (*probe)(struct device * dev);
71 int (*remove)(struct device * dev);
72 void (*shutdown)(struct device * dev);
73 66
74 int (*suspend)(struct device * dev, pm_message_t state); 67 int (*suspend)(struct device *dev, pm_message_t state);
75 int (*suspend_late)(struct device * dev, pm_message_t state); 68 int (*suspend_late)(struct device *dev, pm_message_t state);
76 int (*resume_early)(struct device * dev); 69 int (*resume_early)(struct device *dev);
77 int (*resume)(struct device * dev); 70 int (*resume)(struct device *dev);
78 71
79 unsigned int drivers_autoprobe:1; 72 struct bus_type_private *p;
80}; 73};
81 74
82extern int __must_check bus_register(struct bus_type * bus); 75extern int __must_check bus_register(struct bus_type *bus);
83extern void bus_unregister(struct bus_type * bus); 76extern void bus_unregister(struct bus_type *bus);
84 77
85extern int __must_check bus_rescan_devices(struct bus_type * bus); 78extern int __must_check bus_rescan_devices(struct bus_type *bus);
86 79
87/* iterator helpers for buses */ 80/* iterator helpers for buses */
88 81
89int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, 82int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
90 int (*fn)(struct device *, void *)); 83 int (*fn)(struct device *dev, void *data));
91struct device * bus_find_device(struct bus_type *bus, struct device *start, 84struct device *bus_find_device(struct bus_type *bus, struct device *start,
92 void *data, int (*match)(struct device *, void *)); 85 void *data,
86 int (*match)(struct device *dev, void *data));
87struct device *bus_find_device_by_name(struct bus_type *bus,
88 struct device *start,
89 const char *name);
93 90
94int __must_check bus_for_each_drv(struct bus_type *bus, 91int __must_check bus_for_each_drv(struct bus_type *bus,
95 struct device_driver *start, void *data, 92 struct device_driver *start, void *data,
96 int (*fn)(struct device_driver *, void *)); 93 int (*fn)(struct device_driver *, void *));
97 94
98/* 95/*
99 * Bus notifiers: Get notified of addition/removal of devices 96 * Bus notifiers: Get notified of addition/removal of devices
@@ -118,111 +115,128 @@ extern int bus_unregister_notifier(struct bus_type *bus,
118#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be 115#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
119 unbound */ 116 unbound */
120 117
118extern struct kset *bus_get_kset(struct bus_type *bus);
119extern struct klist *bus_get_device_klist(struct bus_type *bus);
120
121struct device_driver { 121struct device_driver {
122 const char * name; 122 const char *name;
123 struct bus_type * bus; 123 struct bus_type *bus;
124 124
125 struct kobject kobj; 125 struct module *owner;
126 struct klist klist_devices; 126 const char *mod_name; /* used for built-in modules */
127 struct klist_node knode_bus;
128 127
129 struct module * owner; 128 int (*probe) (struct device *dev);
130 const char * mod_name; /* used for built-in modules */ 129 int (*remove) (struct device *dev);
131 struct module_kobject * mkobj; 130 void (*shutdown) (struct device *dev);
131 int (*suspend) (struct device *dev, pm_message_t state);
132 int (*resume) (struct device *dev);
133 struct attribute_group **groups;
132 134
133 int (*probe) (struct device * dev); 135 struct driver_private *p;
134 int (*remove) (struct device * dev);
135 void (*shutdown) (struct device * dev);
136 int (*suspend) (struct device * dev, pm_message_t state);
137 int (*resume) (struct device * dev);
138}; 136};
139 137
140 138
141extern int __must_check driver_register(struct device_driver * drv); 139extern int __must_check driver_register(struct device_driver *drv);
142extern void driver_unregister(struct device_driver * drv); 140extern void driver_unregister(struct device_driver *drv);
143 141
144extern struct device_driver * get_driver(struct device_driver * drv); 142extern struct device_driver *get_driver(struct device_driver *drv);
145extern void put_driver(struct device_driver * drv); 143extern void put_driver(struct device_driver *drv);
146extern struct device_driver *driver_find(const char *name, struct bus_type *bus); 144extern struct device_driver *driver_find(const char *name,
145 struct bus_type *bus);
147extern int driver_probe_done(void); 146extern int driver_probe_done(void);
148 147
149/* sysfs interface for exporting driver attributes */ 148/* sysfs interface for exporting driver attributes */
150 149
151struct driver_attribute { 150struct driver_attribute {
152 struct attribute attr; 151 struct attribute attr;
153 ssize_t (*show)(struct device_driver *, char * buf); 152 ssize_t (*show)(struct device_driver *driver, char *buf);
154 ssize_t (*store)(struct device_driver *, const char * buf, size_t count); 153 ssize_t (*store)(struct device_driver *driver, const char *buf,
154 size_t count);
155}; 155};
156 156
157#define DRIVER_ATTR(_name,_mode,_show,_store) \ 157#define DRIVER_ATTR(_name, _mode, _show, _store) \
158struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) 158struct driver_attribute driver_attr_##_name = \
159 __ATTR(_name, _mode, _show, _store)
159 160
160extern int __must_check driver_create_file(struct device_driver *, 161extern int __must_check driver_create_file(struct device_driver *driver,
161 struct driver_attribute *); 162 struct driver_attribute *attr);
162extern void driver_remove_file(struct device_driver *, struct driver_attribute *); 163extern void driver_remove_file(struct device_driver *driver,
164 struct driver_attribute *attr);
163 165
164extern int __must_check driver_for_each_device(struct device_driver * drv, 166extern int __must_check driver_add_kobj(struct device_driver *drv,
165 struct device *start, void *data, 167 struct kobject *kobj,
166 int (*fn)(struct device *, void *)); 168 const char *fmt, ...);
167struct device * driver_find_device(struct device_driver *drv, 169
168 struct device *start, void *data, 170extern int __must_check driver_for_each_device(struct device_driver *drv,
169 int (*match)(struct device *, void *)); 171 struct device *start,
172 void *data,
173 int (*fn)(struct device *dev,
174 void *));
175struct device *driver_find_device(struct device_driver *drv,
176 struct device *start, void *data,
177 int (*match)(struct device *dev, void *data));
170 178
171/* 179/*
172 * device classes 180 * device classes
173 */ 181 */
174struct class { 182struct class {
175 const char * name; 183 const char *name;
176 struct module * owner; 184 struct module *owner;
177 185
178 struct kset subsys; 186 struct kset subsys;
179 struct list_head children; 187 struct list_head children;
180 struct list_head devices; 188 struct list_head devices;
181 struct list_head interfaces; 189 struct list_head interfaces;
182 struct kset class_dirs; 190 struct kset class_dirs;
183 struct semaphore sem; /* locks both the children and interfaces lists */ 191 struct semaphore sem; /* locks children, devices, interfaces */
184 192 struct class_attribute *class_attrs;
185 struct class_attribute * class_attrs; 193 struct class_device_attribute *class_dev_attrs;
186 struct class_device_attribute * class_dev_attrs; 194 struct device_attribute *dev_attrs;
187 struct device_attribute * dev_attrs;
188 195
189 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); 196 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
190 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 197 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
191 198
192 void (*release)(struct class_device *dev); 199 void (*release)(struct class_device *dev);
193 void (*class_release)(struct class *class); 200 void (*class_release)(struct class *class);
194 void (*dev_release)(struct device *dev); 201 void (*dev_release)(struct device *dev);
195 202
196 int (*suspend)(struct device *, pm_message_t state); 203 int (*suspend)(struct device *dev, pm_message_t state);
197 int (*resume)(struct device *); 204 int (*resume)(struct device *dev);
198}; 205};
199 206
200extern int __must_check class_register(struct class *); 207extern int __must_check class_register(struct class *class);
201extern void class_unregister(struct class *); 208extern void class_unregister(struct class *class);
209extern int class_for_each_device(struct class *class, void *data,
210 int (*fn)(struct device *dev, void *data));
211extern struct device *class_find_device(struct class *class, void *data,
212 int (*match)(struct device *, void *));
213extern struct class_device *class_find_child(struct class *class, void *data,
214 int (*match)(struct class_device *, void *));
202 215
203 216
204struct class_attribute { 217struct class_attribute {
205 struct attribute attr; 218 struct attribute attr;
206 ssize_t (*show)(struct class *, char * buf); 219 ssize_t (*show)(struct class *class, char *buf);
207 ssize_t (*store)(struct class *, const char * buf, size_t count); 220 ssize_t (*store)(struct class *class, const char *buf, size_t count);
208}; 221};
209 222
210#define CLASS_ATTR(_name,_mode,_show,_store) \ 223#define CLASS_ATTR(_name, _mode, _show, _store) \
211struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) 224struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
212 225
213extern int __must_check class_create_file(struct class *, 226extern int __must_check class_create_file(struct class *class,
214 const struct class_attribute *); 227 const struct class_attribute *attr);
215extern void class_remove_file(struct class *, const struct class_attribute *); 228extern void class_remove_file(struct class *class,
229 const struct class_attribute *attr);
216 230
217struct class_device_attribute { 231struct class_device_attribute {
218 struct attribute attr; 232 struct attribute attr;
219 ssize_t (*show)(struct class_device *, char * buf); 233 ssize_t (*show)(struct class_device *, char *buf);
220 ssize_t (*store)(struct class_device *, const char * buf, size_t count); 234 ssize_t (*store)(struct class_device *, const char *buf, size_t count);
221}; 235};
222 236
223#define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) \ 237#define CLASS_DEVICE_ATTR(_name, _mode, _show, _store) \
224struct class_device_attribute class_device_attr_##_name = \ 238struct class_device_attribute class_device_attr_##_name = \
225 __ATTR(_name,_mode,_show,_store) 239 __ATTR(_name, _mode, _show, _store)
226 240
227extern int __must_check class_device_create_file(struct class_device *, 241extern int __must_check class_device_create_file(struct class_device *,
228 const struct class_device_attribute *); 242 const struct class_device_attribute *);
@@ -255,26 +269,24 @@ struct class_device {
255 struct list_head node; 269 struct list_head node;
256 270
257 struct kobject kobj; 271 struct kobject kobj;
258 struct class * class; /* required */ 272 struct class *class;
259 dev_t devt; /* dev_t, creates the sysfs "dev" */ 273 dev_t devt;
260 struct device * dev; /* not necessary, but nice to have */ 274 struct device *dev;
261 void * class_data; /* class-specific data */ 275 void *class_data;
262 struct class_device *parent; /* parent of this child device, if there is one */ 276 struct class_device *parent;
263 struct attribute_group ** groups; /* optional groups */ 277 struct attribute_group **groups;
264 278
265 void (*release)(struct class_device *dev); 279 void (*release)(struct class_device *dev);
266 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); 280 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
267 char class_id[BUS_ID_SIZE]; /* unique to this class */ 281 char class_id[BUS_ID_SIZE];
268}; 282};
269 283
270static inline void * 284static inline void *class_get_devdata(struct class_device *dev)
271class_get_devdata (struct class_device *dev)
272{ 285{
273 return dev->class_data; 286 return dev->class_data;
274} 287}
275 288
276static inline void 289static inline void class_set_devdata(struct class_device *dev, void *data)
277class_set_devdata (struct class_device *dev, void *data)
278{ 290{
279 dev->class_data = data; 291 dev->class_data = data;
280} 292}
@@ -286,10 +298,10 @@ extern void class_device_initialize(struct class_device *);
286extern int __must_check class_device_add(struct class_device *); 298extern int __must_check class_device_add(struct class_device *);
287extern void class_device_del(struct class_device *); 299extern void class_device_del(struct class_device *);
288 300
289extern struct class_device * class_device_get(struct class_device *); 301extern struct class_device *class_device_get(struct class_device *);
290extern void class_device_put(struct class_device *); 302extern void class_device_put(struct class_device *);
291 303
292extern void class_device_remove_file(struct class_device *, 304extern void class_device_remove_file(struct class_device *,
293 const struct class_device_attribute *); 305 const struct class_device_attribute *);
294extern int __must_check class_device_create_bin_file(struct class_device *, 306extern int __must_check class_device_create_bin_file(struct class_device *,
295 struct bin_attribute *); 307 struct bin_attribute *);
@@ -316,7 +328,7 @@ extern struct class_device *class_device_create(struct class *cls,
316 dev_t devt, 328 dev_t devt,
317 struct device *device, 329 struct device *device,
318 const char *fmt, ...) 330 const char *fmt, ...)
319 __attribute__((format(printf,5,6))); 331 __attribute__((format(printf, 5, 6)));
320extern void class_device_destroy(struct class *cls, dev_t devt); 332extern void class_device_destroy(struct class *cls, dev_t devt);
321 333
322/* 334/*
@@ -333,8 +345,8 @@ struct device_type {
333 struct attribute_group **groups; 345 struct attribute_group **groups;
334 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 346 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
335 void (*release)(struct device *dev); 347 void (*release)(struct device *dev);
336 int (*suspend)(struct device * dev, pm_message_t state); 348 int (*suspend)(struct device *dev, pm_message_t state);
337 int (*resume)(struct device * dev); 349 int (*resume)(struct device *dev);
338}; 350};
339 351
340/* interface for exporting device attributes */ 352/* interface for exporting device attributes */
@@ -346,18 +358,19 @@ struct device_attribute {
346 const char *buf, size_t count); 358 const char *buf, size_t count);
347}; 359};
348 360
349#define DEVICE_ATTR(_name,_mode,_show,_store) \ 361#define DEVICE_ATTR(_name, _mode, _show, _store) \
350struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) 362struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
351 363
352extern int __must_check device_create_file(struct device *device, 364extern int __must_check device_create_file(struct device *device,
353 struct device_attribute * entry); 365 struct device_attribute *entry);
354extern void device_remove_file(struct device * dev, struct device_attribute * attr); 366extern void device_remove_file(struct device *dev,
367 struct device_attribute *attr);
355extern int __must_check device_create_bin_file(struct device *dev, 368extern int __must_check device_create_bin_file(struct device *dev,
356 struct bin_attribute *attr); 369 struct bin_attribute *attr);
357extern void device_remove_bin_file(struct device *dev, 370extern void device_remove_bin_file(struct device *dev,
358 struct bin_attribute *attr); 371 struct bin_attribute *attr);
359extern int device_schedule_callback_owner(struct device *dev, 372extern int device_schedule_callback_owner(struct device *dev,
360 void (*func)(struct device *), struct module *owner); 373 void (*func)(struct device *dev), struct module *owner);
361 374
362/* This is a macro to avoid include problems with THIS_MODULE */ 375/* This is a macro to avoid include problems with THIS_MODULE */
363#define device_schedule_callback(dev, func) \ 376#define device_schedule_callback(dev, func) \
@@ -368,21 +381,21 @@ typedef void (*dr_release_t)(struct device *dev, void *res);
368typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); 381typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data);
369 382
370#ifdef CONFIG_DEBUG_DEVRES 383#ifdef CONFIG_DEBUG_DEVRES
371extern void * __devres_alloc(dr_release_t release, size_t size, gfp_t gfp, 384extern void *__devres_alloc(dr_release_t release, size_t size, gfp_t gfp,
372 const char *name); 385 const char *name);
373#define devres_alloc(release, size, gfp) \ 386#define devres_alloc(release, size, gfp) \
374 __devres_alloc(release, size, gfp, #release) 387 __devres_alloc(release, size, gfp, #release)
375#else 388#else
376extern void * devres_alloc(dr_release_t release, size_t size, gfp_t gfp); 389extern void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp);
377#endif 390#endif
378extern void devres_free(void *res); 391extern void devres_free(void *res);
379extern void devres_add(struct device *dev, void *res); 392extern void devres_add(struct device *dev, void *res);
380extern void * devres_find(struct device *dev, dr_release_t release, 393extern void *devres_find(struct device *dev, dr_release_t release,
381 dr_match_t match, void *match_data);
382extern void * devres_get(struct device *dev, void *new_res,
383 dr_match_t match, void *match_data); 394 dr_match_t match, void *match_data);
384extern void * devres_remove(struct device *dev, dr_release_t release, 395extern void *devres_get(struct device *dev, void *new_res,
385 dr_match_t match, void *match_data); 396 dr_match_t match, void *match_data);
397extern void *devres_remove(struct device *dev, dr_release_t release,
398 dr_match_t match, void *match_data);
386extern int devres_destroy(struct device *dev, dr_release_t release, 399extern int devres_destroy(struct device *dev, dr_release_t release,
387 dr_match_t match, void *match_data); 400 dr_match_t match, void *match_data);
388 401
@@ -399,7 +412,7 @@ extern void devm_kfree(struct device *dev, void *p);
399 412
400struct device { 413struct device {
401 struct klist klist_children; 414 struct klist klist_children;
402 struct klist_node knode_parent; /* node in sibling list */ 415 struct klist_node knode_parent; /* node in sibling list */
403 struct klist_node knode_driver; 416 struct klist_node knode_driver;
404 struct klist_node knode_bus; 417 struct klist_node knode_bus;
405 struct device *parent; 418 struct device *parent;
@@ -414,7 +427,7 @@ struct device {
414 * its driver. 427 * its driver.
415 */ 428 */
416 429
417 struct bus_type * bus; /* type of bus device is on */ 430 struct bus_type *bus; /* type of bus device is on */
418 struct device_driver *driver; /* which driver has allocated this 431 struct device_driver *driver; /* which driver has allocated this
419 device */ 432 device */
420 void *driver_data; /* data private to the driver */ 433 void *driver_data; /* data private to the driver */
@@ -445,10 +458,10 @@ struct device {
445 /* class_device migration path */ 458 /* class_device migration path */
446 struct list_head node; 459 struct list_head node;
447 struct class *class; 460 struct class *class;
448 dev_t devt; /* dev_t, creates the sysfs "dev" */ 461 dev_t devt; /* dev_t, creates the sysfs "dev" */
449 struct attribute_group **groups; /* optional groups */ 462 struct attribute_group **groups; /* optional groups */
450 463
451 void (*release)(struct device * dev); 464 void (*release)(struct device *dev);
452}; 465};
453 466
454#ifdef CONFIG_NUMA 467#ifdef CONFIG_NUMA
@@ -470,14 +483,12 @@ static inline void set_dev_node(struct device *dev, int node)
470} 483}
471#endif 484#endif
472 485
473static inline void * 486static inline void *dev_get_drvdata(struct device *dev)
474dev_get_drvdata (struct device *dev)
475{ 487{
476 return dev->driver_data; 488 return dev->driver_data;
477} 489}
478 490
479static inline void 491static inline void dev_set_drvdata(struct device *dev, void *data)
480dev_set_drvdata (struct device *dev, void *data)
481{ 492{
482 dev->driver_data = data; 493 dev->driver_data = data;
483} 494}
@@ -492,15 +503,15 @@ void driver_init(void);
492/* 503/*
493 * High level routines for use by the bus drivers 504 * High level routines for use by the bus drivers
494 */ 505 */
495extern int __must_check device_register(struct device * dev); 506extern int __must_check device_register(struct device *dev);
496extern void device_unregister(struct device * dev); 507extern void device_unregister(struct device *dev);
497extern void device_initialize(struct device * dev); 508extern void device_initialize(struct device *dev);
498extern int __must_check device_add(struct device * dev); 509extern int __must_check device_add(struct device *dev);
499extern void device_del(struct device * dev); 510extern void device_del(struct device *dev);
500extern int device_for_each_child(struct device *, void *, 511extern int device_for_each_child(struct device *dev, void *data,
501 int (*fn)(struct device *, void *)); 512 int (*fn)(struct device *dev, void *data));
502extern struct device *device_find_child(struct device *, void *data, 513extern struct device *device_find_child(struct device *dev, void *data,
503 int (*match)(struct device *, void *)); 514 int (*match)(struct device *dev, void *data));
504extern int device_rename(struct device *dev, char *new_name); 515extern int device_rename(struct device *dev, char *new_name);
505extern int device_move(struct device *dev, struct device *new_parent); 516extern int device_move(struct device *dev, struct device *new_parent);
506 517
@@ -509,8 +520,8 @@ extern int device_move(struct device *dev, struct device *new_parent);
509 * for information on use. 520 * for information on use.
510 */ 521 */
511extern int __must_check device_bind_driver(struct device *dev); 522extern int __must_check device_bind_driver(struct device *dev);
512extern void device_release_driver(struct device * dev); 523extern void device_release_driver(struct device *dev);
513extern int __must_check device_attach(struct device * dev); 524extern int __must_check device_attach(struct device *dev);
514extern int __must_check driver_attach(struct device_driver *drv); 525extern int __must_check driver_attach(struct device_driver *drv);
515extern int __must_check device_reprobe(struct device *dev); 526extern int __must_check device_reprobe(struct device *dev);
516 527
@@ -519,8 +530,16 @@ extern int __must_check device_reprobe(struct device *dev);
519 */ 530 */
520extern struct device *device_create(struct class *cls, struct device *parent, 531extern struct device *device_create(struct class *cls, struct device *parent,
521 dev_t devt, const char *fmt, ...) 532 dev_t devt, const char *fmt, ...)
522 __attribute__((format(printf,4,5))); 533 __attribute__((format(printf, 4, 5)));
523extern void device_destroy(struct class *cls, dev_t devt); 534extern void device_destroy(struct class *cls, dev_t devt);
535#ifdef CONFIG_PM_SLEEP
536extern void destroy_suspended_device(struct class *cls, dev_t devt);
537#else /* !CONFIG_PM_SLEEP */
538static inline void destroy_suspended_device(struct class *cls, dev_t devt)
539{
540 device_destroy(cls, devt);
541}
542#endif /* !CONFIG_PM_SLEEP */
524 543
525/* 544/*
526 * Platform "fixup" functions - allow the platform to have their say 545 * Platform "fixup" functions - allow the platform to have their say
@@ -528,17 +547,17 @@ extern void device_destroy(struct class *cls, dev_t devt);
528 * know about. 547 * know about.
529 */ 548 */
530/* Notify platform of device discovery */ 549/* Notify platform of device discovery */
531extern int (*platform_notify)(struct device * dev); 550extern int (*platform_notify)(struct device *dev);
532 551
533extern int (*platform_notify_remove)(struct device * dev); 552extern int (*platform_notify_remove)(struct device *dev);
534 553
535 554
536/** 555/**
537 * get_device - atomically increment the reference count for the device. 556 * get_device - atomically increment the reference count for the device.
538 * 557 *
539 */ 558 */
540extern struct device * get_device(struct device * dev); 559extern struct device *get_device(struct device *dev);
541extern void put_device(struct device * dev); 560extern void put_device(struct device *dev);
542 561
543 562
544/* drivers/base/power/shutdown.c */ 563/* drivers/base/power/shutdown.c */
@@ -547,22 +566,33 @@ extern void device_shutdown(void);
547/* drivers/base/sys.c */ 566/* drivers/base/sys.c */
548extern void sysdev_shutdown(void); 567extern void sysdev_shutdown(void);
549 568
550
551/* drivers/base/firmware.c */
552extern int __must_check firmware_register(struct kset *);
553extern void firmware_unregister(struct kset *);
554
555/* debugging and troubleshooting/diagnostic helpers. */ 569/* debugging and troubleshooting/diagnostic helpers. */
556extern const char *dev_driver_string(struct device *dev); 570extern const char *dev_driver_string(struct device *dev);
557#define dev_printk(level, dev, format, arg...) \ 571#define dev_printk(level, dev, format, arg...) \
558 printk(level "%s %s: " format , dev_driver_string(dev) , (dev)->bus_id , ## arg) 572 printk(level "%s %s: " format , dev_driver_string(dev) , \
573 (dev)->bus_id , ## arg)
574
575#define dev_emerg(dev, format, arg...) \
576 dev_printk(KERN_EMERG , dev , format , ## arg)
577#define dev_alert(dev, format, arg...) \
578 dev_printk(KERN_ALERT , dev , format , ## arg)
579#define dev_crit(dev, format, arg...) \
580 dev_printk(KERN_CRIT , dev , format , ## arg)
581#define dev_err(dev, format, arg...) \
582 dev_printk(KERN_ERR , dev , format , ## arg)
583#define dev_warn(dev, format, arg...) \
584 dev_printk(KERN_WARNING , dev , format , ## arg)
585#define dev_notice(dev, format, arg...) \
586 dev_printk(KERN_NOTICE , dev , format , ## arg)
587#define dev_info(dev, format, arg...) \
588 dev_printk(KERN_INFO , dev , format , ## arg)
559 589
560#ifdef DEBUG 590#ifdef DEBUG
561#define dev_dbg(dev, format, arg...) \ 591#define dev_dbg(dev, format, arg...) \
562 dev_printk(KERN_DEBUG , dev , format , ## arg) 592 dev_printk(KERN_DEBUG , dev , format , ## arg)
563#else 593#else
564static inline int __attribute__ ((format (printf, 2, 3))) 594static inline int __attribute__ ((format (printf, 2, 3)))
565dev_dbg(struct device * dev, const char * fmt, ...) 595dev_dbg(struct device *dev, const char *fmt, ...)
566{ 596{
567 return 0; 597 return 0;
568} 598}
@@ -572,21 +602,12 @@ dev_dbg(struct device * dev, const char * fmt, ...)
572#define dev_vdbg dev_dbg 602#define dev_vdbg dev_dbg
573#else 603#else
574static inline int __attribute__ ((format (printf, 2, 3))) 604static inline int __attribute__ ((format (printf, 2, 3)))
575dev_vdbg(struct device * dev, const char * fmt, ...) 605dev_vdbg(struct device *dev, const char *fmt, ...)
576{ 606{
577 return 0; 607 return 0;
578} 608}
579#endif 609#endif
580 610
581#define dev_err(dev, format, arg...) \
582 dev_printk(KERN_ERR , dev , format , ## arg)
583#define dev_info(dev, format, arg...) \
584 dev_printk(KERN_INFO , dev , format , ## arg)
585#define dev_warn(dev, format, arg...) \
586 dev_printk(KERN_WARNING , dev , format , ## arg)
587#define dev_notice(dev, format, arg...) \
588 dev_printk(KERN_NOTICE , dev , format , ## arg)
589
590/* Create alias, so I can be autoloaded. */ 611/* Create alias, so I can be autoloaded. */
591#define MODULE_ALIAS_CHARDEV(major,minor) \ 612#define MODULE_ALIAS_CHARDEV(major,minor) \
592 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) 613 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index be9d278761e0..c743fbc769db 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -19,148 +19,12 @@
19 * routines and structures to use DLM lockspaces 19 * routines and structures to use DLM lockspaces
20 */ 20 */
21 21
22/* 22/* Lock levels and flags are here */
23 * Lock Modes 23#include <linux/dlmconstants.h>
24 */
25 24
26#define DLM_LOCK_IV -1 /* invalid */
27#define DLM_LOCK_NL 0 /* null */
28#define DLM_LOCK_CR 1 /* concurrent read */
29#define DLM_LOCK_CW 2 /* concurrent write */
30#define DLM_LOCK_PR 3 /* protected read */
31#define DLM_LOCK_PW 4 /* protected write */
32#define DLM_LOCK_EX 5 /* exclusive */
33
34/*
35 * Maximum size in bytes of a dlm_lock name
36 */
37 25
38#define DLM_RESNAME_MAXLEN 64 26#define DLM_RESNAME_MAXLEN 64
39 27
40/*
41 * Flags to dlm_lock
42 *
43 * DLM_LKF_NOQUEUE
44 *
45 * Do not queue the lock request on the wait queue if it cannot be granted
46 * immediately. If the lock cannot be granted because of this flag, DLM will
47 * either return -EAGAIN from the dlm_lock call or will return 0 from
48 * dlm_lock and -EAGAIN in the lock status block when the AST is executed.
49 *
50 * DLM_LKF_CANCEL
51 *
52 * Used to cancel a pending lock request or conversion. A converting lock is
53 * returned to its previously granted mode.
54 *
55 * DLM_LKF_CONVERT
56 *
57 * Indicates a lock conversion request. For conversions the name and namelen
58 * are ignored and the lock ID in the LKSB is used to identify the lock.
59 *
60 * DLM_LKF_VALBLK
61 *
62 * Requests DLM to return the current contents of the lock value block in the
63 * lock status block. When this flag is set in a lock conversion from PW or EX
64 * modes, DLM assigns the value specified in the lock status block to the lock
65 * value block of the lock resource. The LVB is a DLM_LVB_LEN size array
66 * containing application-specific information.
67 *
68 * DLM_LKF_QUECVT
69 *
70 * Force a conversion request to be queued, even if it is compatible with
71 * the granted modes of other locks on the same resource.
72 *
73 * DLM_LKF_IVVALBLK
74 *
75 * Invalidate the lock value block.
76 *
77 * DLM_LKF_CONVDEADLK
78 *
79 * Allows the dlm to resolve conversion deadlocks internally by demoting the
80 * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is
81 * returned for a conversion that's been effected by this.
82 *
83 * DLM_LKF_PERSISTENT
84 *
85 * Only relevant to locks originating in userspace. A persistent lock will not
86 * be removed if the process holding the lock exits.
87 *
88 * DLM_LKF_NODLCKWT
89 *
90 * Do not cancel the lock if it gets into conversion deadlock.
91 * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN.
92 *
93 * DLM_LKF_NODLCKBLK
94 *
95 * net yet implemented
96 *
97 * DLM_LKF_EXPEDITE
98 *
99 * Used only with new requests for NL mode locks. Tells the lock manager
100 * to grant the lock, ignoring other locks in convert and wait queues.
101 *
102 * DLM_LKF_NOQUEUEBAST
103 *
104 * Send blocking AST's before returning -EAGAIN to the caller. It is only
105 * used along with the NOQUEUE flag. Blocking AST's are not sent for failed
106 * NOQUEUE requests otherwise.
107 *
108 * DLM_LKF_HEADQUE
109 *
110 * Add a lock to the head of the convert or wait queue rather than the tail.
111 *
112 * DLM_LKF_NOORDER
113 *
114 * Disregard the standard grant order rules and grant a lock as soon as it
115 * is compatible with other granted locks.
116 *
117 * DLM_LKF_ORPHAN
118 *
119 * not yet implemented
120 *
121 * DLM_LKF_ALTPR
122 *
123 * If the requested mode cannot be granted immediately, try to grant the lock
124 * in PR mode instead. If this alternate mode is granted instead of the
125 * requested mode, DLM_SBF_ALTMODE is returned in the lksb.
126 *
127 * DLM_LKF_ALTCW
128 *
129 * The same as ALTPR, but the alternate mode is CW.
130 *
131 * DLM_LKF_FORCEUNLOCK
132 *
133 * Unlock the lock even if it is converting or waiting or has sublocks.
134 * Only really for use by the userland device.c code.
135 *
136 */
137
138#define DLM_LKF_NOQUEUE 0x00000001
139#define DLM_LKF_CANCEL 0x00000002
140#define DLM_LKF_CONVERT 0x00000004
141#define DLM_LKF_VALBLK 0x00000008
142#define DLM_LKF_QUECVT 0x00000010
143#define DLM_LKF_IVVALBLK 0x00000020
144#define DLM_LKF_CONVDEADLK 0x00000040
145#define DLM_LKF_PERSISTENT 0x00000080
146#define DLM_LKF_NODLCKWT 0x00000100
147#define DLM_LKF_NODLCKBLK 0x00000200
148#define DLM_LKF_EXPEDITE 0x00000400
149#define DLM_LKF_NOQUEUEBAST 0x00000800
150#define DLM_LKF_HEADQUE 0x00001000
151#define DLM_LKF_NOORDER 0x00002000
152#define DLM_LKF_ORPHAN 0x00004000
153#define DLM_LKF_ALTPR 0x00008000
154#define DLM_LKF_ALTCW 0x00010000
155#define DLM_LKF_FORCEUNLOCK 0x00020000
156#define DLM_LKF_TIMEOUT 0x00040000
157
158/*
159 * Some return codes that are not in errno.h
160 */
161
162#define DLM_ECANCEL 0x10001
163#define DLM_EUNLOCK 0x10002
164 28
165typedef void dlm_lockspace_t; 29typedef void dlm_lockspace_t;
166 30
diff --git a/include/linux/dlmconstants.h b/include/linux/dlmconstants.h
new file mode 100644
index 000000000000..fddb3d3ff321
--- /dev/null
+++ b/include/linux/dlmconstants.h
@@ -0,0 +1,159 @@
1/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
6**
7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions
9** of the GNU General Public License v.2.
10**
11*******************************************************************************
12******************************************************************************/
13
14#ifndef __DLMCONSTANTS_DOT_H__
15#define __DLMCONSTANTS_DOT_H__
16
17/*
18 * Constants used by DLM interface.
19 */
20
21/*
22 * Lock Modes
23 */
24
25#define DLM_LOCK_IV (-1) /* invalid */
26#define DLM_LOCK_NL 0 /* null */
27#define DLM_LOCK_CR 1 /* concurrent read */
28#define DLM_LOCK_CW 2 /* concurrent write */
29#define DLM_LOCK_PR 3 /* protected read */
30#define DLM_LOCK_PW 4 /* protected write */
31#define DLM_LOCK_EX 5 /* exclusive */
32
33
34/*
35 * Flags to dlm_lock
36 *
37 * DLM_LKF_NOQUEUE
38 *
39 * Do not queue the lock request on the wait queue if it cannot be granted
40 * immediately. If the lock cannot be granted because of this flag, DLM will
41 * either return -EAGAIN from the dlm_lock call or will return 0 from
42 * dlm_lock and -EAGAIN in the lock status block when the AST is executed.
43 *
44 * DLM_LKF_CANCEL
45 *
46 * Used to cancel a pending lock request or conversion. A converting lock is
47 * returned to its previously granted mode.
48 *
49 * DLM_LKF_CONVERT
50 *
51 * Indicates a lock conversion request. For conversions the name and namelen
52 * are ignored and the lock ID in the LKSB is used to identify the lock.
53 *
54 * DLM_LKF_VALBLK
55 *
56 * Requests DLM to return the current contents of the lock value block in the
57 * lock status block. When this flag is set in a lock conversion from PW or EX
58 * modes, DLM assigns the value specified in the lock status block to the lock
59 * value block of the lock resource. The LVB is a DLM_LVB_LEN size array
60 * containing application-specific information.
61 *
62 * DLM_LKF_QUECVT
63 *
64 * Force a conversion request to be queued, even if it is compatible with
65 * the granted modes of other locks on the same resource.
66 *
67 * DLM_LKF_IVVALBLK
68 *
69 * Invalidate the lock value block.
70 *
71 * DLM_LKF_CONVDEADLK
72 *
73 * Allows the dlm to resolve conversion deadlocks internally by demoting the
74 * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is
75 * returned for a conversion that's been effected by this.
76 *
77 * DLM_LKF_PERSISTENT
78 *
79 * Only relevant to locks originating in userspace. A persistent lock will not
80 * be removed if the process holding the lock exits.
81 *
82 * DLM_LKF_NODLCKWT
83 *
84 * Do not cancel the lock if it gets into conversion deadlock.
85 * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN.
86 *
87 * DLM_LKF_NODLCKBLK
88 *
89 * net yet implemented
90 *
91 * DLM_LKF_EXPEDITE
92 *
93 * Used only with new requests for NL mode locks. Tells the lock manager
94 * to grant the lock, ignoring other locks in convert and wait queues.
95 *
96 * DLM_LKF_NOQUEUEBAST
97 *
98 * Send blocking AST's before returning -EAGAIN to the caller. It is only
99 * used along with the NOQUEUE flag. Blocking AST's are not sent for failed
100 * NOQUEUE requests otherwise.
101 *
102 * DLM_LKF_HEADQUE
103 *
104 * Add a lock to the head of the convert or wait queue rather than the tail.
105 *
106 * DLM_LKF_NOORDER
107 *
108 * Disregard the standard grant order rules and grant a lock as soon as it
109 * is compatible with other granted locks.
110 *
111 * DLM_LKF_ORPHAN
112 *
113 * not yet implemented
114 *
115 * DLM_LKF_ALTPR
116 *
117 * If the requested mode cannot be granted immediately, try to grant the lock
118 * in PR mode instead. If this alternate mode is granted instead of the
119 * requested mode, DLM_SBF_ALTMODE is returned in the lksb.
120 *
121 * DLM_LKF_ALTCW
122 *
123 * The same as ALTPR, but the alternate mode is CW.
124 *
125 * DLM_LKF_FORCEUNLOCK
126 *
127 * Unlock the lock even if it is converting or waiting or has sublocks.
128 * Only really for use by the userland device.c code.
129 *
130 */
131
132#define DLM_LKF_NOQUEUE 0x00000001
133#define DLM_LKF_CANCEL 0x00000002
134#define DLM_LKF_CONVERT 0x00000004
135#define DLM_LKF_VALBLK 0x00000008
136#define DLM_LKF_QUECVT 0x00000010
137#define DLM_LKF_IVVALBLK 0x00000020
138#define DLM_LKF_CONVDEADLK 0x00000040
139#define DLM_LKF_PERSISTENT 0x00000080
140#define DLM_LKF_NODLCKWT 0x00000100
141#define DLM_LKF_NODLCKBLK 0x00000200
142#define DLM_LKF_EXPEDITE 0x00000400
143#define DLM_LKF_NOQUEUEBAST 0x00000800
144#define DLM_LKF_HEADQUE 0x00001000
145#define DLM_LKF_NOORDER 0x00002000
146#define DLM_LKF_ORPHAN 0x00004000
147#define DLM_LKF_ALTPR 0x00008000
148#define DLM_LKF_ALTCW 0x00010000
149#define DLM_LKF_FORCEUNLOCK 0x00020000
150#define DLM_LKF_TIMEOUT 0x00040000
151
152/*
153 * Some return codes that are not in errno.h
154 */
155
156#define DLM_ECANCEL 0x10001
157#define DLM_EUNLOCK 0x10002
158
159#endif /* __DLMCONSTANTS_DOT_H__ */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index a3b6035b6c86..55c9a6952f44 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -132,7 +132,7 @@ struct dma_chan {
132 132
133 /* sysfs */ 133 /* sysfs */
134 int chan_id; 134 int chan_id;
135 struct class_device class_dev; 135 struct device dev;
136 136
137 struct kref refcount; 137 struct kref refcount;
138 int slow_ref; 138 int slow_ref;
@@ -142,6 +142,7 @@ struct dma_chan {
142 struct dma_chan_percpu *local; 142 struct dma_chan_percpu *local;
143}; 143};
144 144
145#define to_dma_chan(p) container_of(p, struct dma_chan, dev)
145 146
146void dma_chan_cleanup(struct kref *kref); 147void dma_chan_cleanup(struct kref *kref);
147 148
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 00fc7a9c35ec..5b42a659a308 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -78,6 +78,8 @@ extern const struct dmi_device * dmi_find_device(int type, const char *name,
78extern void dmi_scan_machine(void); 78extern void dmi_scan_machine(void);
79extern int dmi_get_year(int field); 79extern int dmi_get_year(int field);
80extern int dmi_name_in_vendors(const char *str); 80extern int dmi_name_in_vendors(const char *str);
81extern int dmi_available;
82extern char *dmi_get_slot(int slot);
81 83
82#else 84#else
83 85
@@ -87,6 +89,8 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na
87 const struct dmi_device *from) { return NULL; } 89 const struct dmi_device *from) { return NULL; }
88static inline int dmi_get_year(int year) { return 0; } 90static inline int dmi_get_year(int year) { return 0; }
89static inline int dmi_name_in_vendors(const char *s) { return 0; } 91static inline int dmi_name_in_vendors(const char *s) { return 0; }
92#define dmi_available 0
93static inline char *dmi_get_slot(int slot) { return NULL; }
90 94
91#endif 95#endif
92 96
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 576e83bd6d88..7ceb24d87c1a 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -355,6 +355,7 @@ typedef struct elf64_shdr {
355#define NT_AUXV 6 355#define NT_AUXV 6
356#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ 356#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
357#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ 357#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
358#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
358 359
359 360
360/* Note header in a PT_NOTE section */ 361/* Note header in a PT_NOTE section */
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
index e831759b2fb5..278e3ef05336 100644
--- a/include/linux/elfnote.h
+++ b/include/linux/elfnote.h
@@ -76,7 +76,7 @@
76 typeof(desc) _desc \ 76 typeof(desc) _desc \
77 __attribute__((aligned(sizeof(Elf##size##_Word)))); \ 77 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
78 } _ELFNOTE_PASTE(_note_, unique) \ 78 } _ELFNOTE_PASTE(_note_, unique) \
79 __attribute_used__ \ 79 __used \
80 __attribute__((section(".note." name), \ 80 __attribute__((section(".note." name), \
81 aligned(sizeof(Elf##size##_Word)), \ 81 aligned(sizeof(Elf##size##_Word)), \
82 unused)) = { \ 82 unused)) = { \
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index 97dd409d5f4a..1852313fc7c7 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -20,6 +20,8 @@
20#include <linux/blkdev.h> 20#include <linux/blkdev.h>
21#include <linux/magic.h> 21#include <linux/magic.h>
22 22
23#include <linux/ext4_fs_i.h>
24
23/* 25/*
24 * The second extended filesystem constants/structures 26 * The second extended filesystem constants/structures
25 */ 27 */
@@ -51,6 +53,50 @@
51#define ext4_debug(f, a...) do {} while (0) 53#define ext4_debug(f, a...) do {} while (0)
52#endif 54#endif
53 55
56#define EXT4_MULTIBLOCK_ALLOCATOR 1
57
58/* prefer goal again. length */
59#define EXT4_MB_HINT_MERGE 1
60/* blocks already reserved */
61#define EXT4_MB_HINT_RESERVED 2
62/* metadata is being allocated */
63#define EXT4_MB_HINT_METADATA 4
64/* first blocks in the file */
65#define EXT4_MB_HINT_FIRST 8
66/* search for the best chunk */
67#define EXT4_MB_HINT_BEST 16
68/* data is being allocated */
69#define EXT4_MB_HINT_DATA 32
70/* don't preallocate (for tails) */
71#define EXT4_MB_HINT_NOPREALLOC 64
72/* allocate for locality group */
73#define EXT4_MB_HINT_GROUP_ALLOC 128
74/* allocate goal blocks or none */
75#define EXT4_MB_HINT_GOAL_ONLY 256
76/* goal is meaningful */
77#define EXT4_MB_HINT_TRY_GOAL 512
78
79struct ext4_allocation_request {
80 /* target inode for block we're allocating */
81 struct inode *inode;
82 /* logical block in target inode */
83 ext4_lblk_t logical;
84 /* phys. target (a hint) */
85 ext4_fsblk_t goal;
86 /* the closest logical allocated block to the left */
87 ext4_lblk_t lleft;
88 /* phys. block for ^^^ */
89 ext4_fsblk_t pleft;
90 /* the closest logical allocated block to the right */
91 ext4_lblk_t lright;
92 /* phys. block for ^^^ */
93 ext4_fsblk_t pright;
94 /* how many blocks we want to allocate */
95 unsigned long len;
96 /* flags. see above EXT4_MB_HINT_* */
97 unsigned long flags;
98};
99
54/* 100/*
55 * Special inodes numbers 101 * Special inodes numbers
56 */ 102 */
@@ -73,8 +119,8 @@
73 * Macro-instructions used to manage several block sizes 119 * Macro-instructions used to manage several block sizes
74 */ 120 */
75#define EXT4_MIN_BLOCK_SIZE 1024 121#define EXT4_MIN_BLOCK_SIZE 1024
76#define EXT4_MAX_BLOCK_SIZE 4096 122#define EXT4_MAX_BLOCK_SIZE 65536
77#define EXT4_MIN_BLOCK_LOG_SIZE 10 123#define EXT4_MIN_BLOCK_LOG_SIZE 10
78#ifdef __KERNEL__ 124#ifdef __KERNEL__
79# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize) 125# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize)
80#else 126#else
@@ -118,6 +164,11 @@ struct ext4_group_desc
118 __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ 164 __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
119 __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */ 165 __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
120 __le32 bg_inode_table_hi; /* Inodes table block MSB */ 166 __le32 bg_inode_table_hi; /* Inodes table block MSB */
167 __le16 bg_free_blocks_count_hi;/* Free blocks count MSB */
168 __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */
169 __le16 bg_used_dirs_count_hi; /* Directories count MSB */
170 __le16 bg_itable_unused_hi; /* Unused inodes count MSB */
171 __u32 bg_reserved2[3];
121}; 172};
122 173
123#define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ 174#define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */
@@ -178,8 +229,9 @@ struct ext4_group_desc
178#define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */ 229#define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */
179#define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ 230#define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
180#define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 231#define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
181#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */ 232#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
182#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ 233#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
234#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
183 235
184#define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */ 236#define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */
185#define EXT4_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ 237#define EXT4_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
@@ -237,6 +289,7 @@ struct ext4_new_group_data {
237#endif 289#endif
238#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) 290#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long)
239#define EXT4_IOC_SETRSVSZ _IOW('f', 6, long) 291#define EXT4_IOC_SETRSVSZ _IOW('f', 6, long)
292#define EXT4_IOC_MIGRATE _IO('f', 7)
240 293
241/* 294/*
242 * ioctl commands in 32 bit emulation 295 * ioctl commands in 32 bit emulation
@@ -275,18 +328,18 @@ struct ext4_mount_options {
275struct ext4_inode { 328struct ext4_inode {
276 __le16 i_mode; /* File mode */ 329 __le16 i_mode; /* File mode */
277 __le16 i_uid; /* Low 16 bits of Owner Uid */ 330 __le16 i_uid; /* Low 16 bits of Owner Uid */
278 __le32 i_size; /* Size in bytes */ 331 __le32 i_size_lo; /* Size in bytes */
279 __le32 i_atime; /* Access time */ 332 __le32 i_atime; /* Access time */
280 __le32 i_ctime; /* Inode Change time */ 333 __le32 i_ctime; /* Inode Change time */
281 __le32 i_mtime; /* Modification time */ 334 __le32 i_mtime; /* Modification time */
282 __le32 i_dtime; /* Deletion Time */ 335 __le32 i_dtime; /* Deletion Time */
283 __le16 i_gid; /* Low 16 bits of Group Id */ 336 __le16 i_gid; /* Low 16 bits of Group Id */
284 __le16 i_links_count; /* Links count */ 337 __le16 i_links_count; /* Links count */
285 __le32 i_blocks; /* Blocks count */ 338 __le32 i_blocks_lo; /* Blocks count */
286 __le32 i_flags; /* File flags */ 339 __le32 i_flags; /* File flags */
287 union { 340 union {
288 struct { 341 struct {
289 __u32 l_i_reserved1; 342 __le32 l_i_version;
290 } linux1; 343 } linux1;
291 struct { 344 struct {
292 __u32 h_i_translator; 345 __u32 h_i_translator;
@@ -297,12 +350,12 @@ struct ext4_inode {
297 } osd1; /* OS dependent 1 */ 350 } osd1; /* OS dependent 1 */
298 __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */ 351 __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */
299 __le32 i_generation; /* File version (for NFS) */ 352 __le32 i_generation; /* File version (for NFS) */
300 __le32 i_file_acl; /* File ACL */ 353 __le32 i_file_acl_lo; /* File ACL */
301 __le32 i_dir_acl; /* Directory ACL */ 354 __le32 i_size_high;
302 __le32 i_obso_faddr; /* Obsoleted fragment address */ 355 __le32 i_obso_faddr; /* Obsoleted fragment address */
303 union { 356 union {
304 struct { 357 struct {
305 __le16 l_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */ 358 __le16 l_i_blocks_high; /* were l_i_reserved1 */
306 __le16 l_i_file_acl_high; 359 __le16 l_i_file_acl_high;
307 __le16 l_i_uid_high; /* these 2 fields */ 360 __le16 l_i_uid_high; /* these 2 fields */
308 __le16 l_i_gid_high; /* were reserved2[0] */ 361 __le16 l_i_gid_high; /* were reserved2[0] */
@@ -328,9 +381,9 @@ struct ext4_inode {
328 __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ 381 __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
329 __le32 i_crtime; /* File Creation time */ 382 __le32 i_crtime; /* File Creation time */
330 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */ 383 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
384 __le32 i_version_hi; /* high 32 bits for 64-bit version */
331}; 385};
332 386
333#define i_size_high i_dir_acl
334 387
335#define EXT4_EPOCH_BITS 2 388#define EXT4_EPOCH_BITS 2
336#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1) 389#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
@@ -402,9 +455,12 @@ do { \
402 raw_inode->xtime ## _extra); \ 455 raw_inode->xtime ## _extra); \
403} while (0) 456} while (0)
404 457
458#define i_disk_version osd1.linux1.l_i_version
459
405#if defined(__KERNEL__) || defined(__linux__) 460#if defined(__KERNEL__) || defined(__linux__)
406#define i_reserved1 osd1.linux1.l_i_reserved1 461#define i_reserved1 osd1.linux1.l_i_reserved1
407#define i_file_acl_high osd2.linux2.l_i_file_acl_high 462#define i_file_acl_high osd2.linux2.l_i_file_acl_high
463#define i_blocks_high osd2.linux2.l_i_blocks_high
408#define i_uid_low i_uid 464#define i_uid_low i_uid
409#define i_gid_low i_gid 465#define i_gid_low i_gid
410#define i_uid_high osd2.linux2.l_i_uid_high 466#define i_uid_high osd2.linux2.l_i_uid_high
@@ -461,7 +517,10 @@ do { \
461#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ 517#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
462#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ 518#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
463#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */ 519#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */
464 520#define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
521#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
522#define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
523#define EXT4_MOUNT_MBALLOC 0x4000000 /* Buddy allocation support */
465/* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ 524/* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */
466#ifndef _LINUX_EXT2_FS_H 525#ifndef _LINUX_EXT2_FS_H
467#define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt 526#define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt
@@ -481,6 +540,7 @@ do { \
481#define ext4_test_bit ext2_test_bit 540#define ext4_test_bit ext2_test_bit
482#define ext4_find_first_zero_bit ext2_find_first_zero_bit 541#define ext4_find_first_zero_bit ext2_find_first_zero_bit
483#define ext4_find_next_zero_bit ext2_find_next_zero_bit 542#define ext4_find_next_zero_bit ext2_find_next_zero_bit
543#define ext4_find_next_bit ext2_find_next_bit
484 544
485/* 545/*
486 * Maximal mount counts between two filesystem checks 546 * Maximal mount counts between two filesystem checks
@@ -671,6 +731,7 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
671#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 731#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
672#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 732#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
673#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 733#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
734#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
674#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 735#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
675#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 736#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
676#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 737#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
@@ -682,6 +743,7 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
682#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010 743#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010
683#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */ 744#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
684#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 745#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
746#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
685#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 747#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
686 748
687#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR 749#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
@@ -696,7 +758,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
696 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \ 758 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
697 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \ 759 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
698 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \ 760 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
699 EXT4_FEATURE_RO_COMPAT_BTREE_DIR) 761 EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\
762 EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
700 763
701/* 764/*
702 * Default values for user and/or group using reserved blocks 765 * Default values for user and/or group using reserved blocks
@@ -767,6 +830,26 @@ struct ext4_dir_entry_2 {
767#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1) 830#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1)
768#define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \ 831#define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \
769 ~EXT4_DIR_ROUND) 832 ~EXT4_DIR_ROUND)
833#define EXT4_MAX_REC_LEN ((1<<16)-1)
834
835static inline unsigned ext4_rec_len_from_disk(__le16 dlen)
836{
837 unsigned len = le16_to_cpu(dlen);
838
839 if (len == EXT4_MAX_REC_LEN)
840 return 1 << 16;
841 return len;
842}
843
844static inline __le16 ext4_rec_len_to_disk(unsigned len)
845{
846 if (len == (1 << 16))
847 return cpu_to_le16(EXT4_MAX_REC_LEN);
848 else if (len > (1 << 16))
849 BUG();
850 return cpu_to_le16(len);
851}
852
770/* 853/*
771 * Hash Tree Directory indexing 854 * Hash Tree Directory indexing
772 * (c) Daniel Phillips, 2001 855 * (c) Daniel Phillips, 2001
@@ -810,7 +893,7 @@ struct ext4_iloc
810{ 893{
811 struct buffer_head *bh; 894 struct buffer_head *bh;
812 unsigned long offset; 895 unsigned long offset;
813 unsigned long block_group; 896 ext4_group_t block_group;
814}; 897};
815 898
816static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc) 899static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc)
@@ -835,7 +918,7 @@ struct dir_private_info {
835 918
836/* calculate the first block number of the group */ 919/* calculate the first block number of the group */
837static inline ext4_fsblk_t 920static inline ext4_fsblk_t
838ext4_group_first_block_no(struct super_block *sb, unsigned long group_no) 921ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no)
839{ 922{
840 return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) + 923 return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) +
841 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block); 924 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
@@ -866,21 +949,24 @@ extern unsigned int ext4_block_group(struct super_block *sb,
866 ext4_fsblk_t blocknr); 949 ext4_fsblk_t blocknr);
867extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, 950extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb,
868 ext4_fsblk_t blocknr); 951 ext4_fsblk_t blocknr);
869extern int ext4_bg_has_super(struct super_block *sb, int group); 952extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group);
870extern unsigned long ext4_bg_num_gdb(struct super_block *sb, int group); 953extern unsigned long ext4_bg_num_gdb(struct super_block *sb,
954 ext4_group_t group);
871extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode, 955extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode,
872 ext4_fsblk_t goal, int *errp); 956 ext4_fsblk_t goal, int *errp);
873extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode, 957extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode,
874 ext4_fsblk_t goal, unsigned long *count, int *errp); 958 ext4_fsblk_t goal, unsigned long *count, int *errp);
959extern ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode,
960 ext4_fsblk_t goal, unsigned long *count, int *errp);
875extern void ext4_free_blocks (handle_t *handle, struct inode *inode, 961extern void ext4_free_blocks (handle_t *handle, struct inode *inode,
876 ext4_fsblk_t block, unsigned long count); 962 ext4_fsblk_t block, unsigned long count, int metadata);
877extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb, 963extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb,
878 ext4_fsblk_t block, unsigned long count, 964 ext4_fsblk_t block, unsigned long count,
879 unsigned long *pdquot_freed_blocks); 965 unsigned long *pdquot_freed_blocks);
880extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *); 966extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *);
881extern void ext4_check_blocks_bitmap (struct super_block *); 967extern void ext4_check_blocks_bitmap (struct super_block *);
882extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, 968extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
883 unsigned int block_group, 969 ext4_group_t block_group,
884 struct buffer_head ** bh); 970 struct buffer_head ** bh);
885extern int ext4_should_retry_alloc(struct super_block *sb, int *retries); 971extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
886extern void ext4_init_block_alloc_info(struct inode *); 972extern void ext4_init_block_alloc_info(struct inode *);
@@ -911,15 +997,32 @@ extern unsigned long ext4_count_dirs (struct super_block *);
911extern void ext4_check_inodes_bitmap (struct super_block *); 997extern void ext4_check_inodes_bitmap (struct super_block *);
912extern unsigned long ext4_count_free (struct buffer_head *, unsigned); 998extern unsigned long ext4_count_free (struct buffer_head *, unsigned);
913 999
1000/* mballoc.c */
1001extern long ext4_mb_stats;
1002extern long ext4_mb_max_to_scan;
1003extern int ext4_mb_init(struct super_block *, int);
1004extern int ext4_mb_release(struct super_block *);
1005extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
1006 struct ext4_allocation_request *, int *);
1007extern int ext4_mb_reserve_blocks(struct super_block *, int);
1008extern void ext4_mb_discard_inode_preallocations(struct inode *);
1009extern int __init init_ext4_mballoc(void);
1010extern void exit_ext4_mballoc(void);
1011extern void ext4_mb_free_blocks(handle_t *, struct inode *,
1012 unsigned long, unsigned long, int, unsigned long *);
1013
914 1014
915/* inode.c */ 1015/* inode.c */
916int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, 1016int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
917 struct buffer_head *bh, ext4_fsblk_t blocknr); 1017 struct buffer_head *bh, ext4_fsblk_t blocknr);
918struct buffer_head * ext4_getblk (handle_t *, struct inode *, long, int, int *); 1018struct buffer_head *ext4_getblk(handle_t *, struct inode *,
919struct buffer_head * ext4_bread (handle_t *, struct inode *, int, int, int *); 1019 ext4_lblk_t, int, int *);
1020struct buffer_head *ext4_bread(handle_t *, struct inode *,
1021 ext4_lblk_t, int, int *);
920int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, 1022int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
921 sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result, 1023 ext4_lblk_t iblock, unsigned long maxblocks,
922 int create, int extend_disksize); 1024 struct buffer_head *bh_result,
1025 int create, int extend_disksize);
923 1026
924extern void ext4_read_inode (struct inode *); 1027extern void ext4_read_inode (struct inode *);
925extern int ext4_write_inode (struct inode *, int); 1028extern int ext4_write_inode (struct inode *, int);
@@ -943,6 +1046,9 @@ extern int ext4_ioctl (struct inode *, struct file *, unsigned int,
943 unsigned long); 1046 unsigned long);
944extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long); 1047extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long);
945 1048
1049/* migrate.c */
1050extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int,
1051 unsigned long);
946/* namei.c */ 1052/* namei.c */
947extern int ext4_orphan_add(handle_t *, struct inode *); 1053extern int ext4_orphan_add(handle_t *, struct inode *);
948extern int ext4_orphan_del(handle_t *, struct inode *); 1054extern int ext4_orphan_del(handle_t *, struct inode *);
@@ -965,6 +1071,12 @@ extern void ext4_abort (struct super_block *, const char *, const char *, ...)
965extern void ext4_warning (struct super_block *, const char *, const char *, ...) 1071extern void ext4_warning (struct super_block *, const char *, const char *, ...)
966 __attribute__ ((format (printf, 3, 4))); 1072 __attribute__ ((format (printf, 3, 4)));
967extern void ext4_update_dynamic_rev (struct super_block *sb); 1073extern void ext4_update_dynamic_rev (struct super_block *sb);
1074extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb,
1075 __u32 compat);
1076extern int ext4_update_rocompat_feature(handle_t *handle,
1077 struct super_block *sb, __u32 rocompat);
1078extern int ext4_update_incompat_feature(handle_t *handle,
1079 struct super_block *sb, __u32 incompat);
968extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, 1080extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
969 struct ext4_group_desc *bg); 1081 struct ext4_group_desc *bg);
970extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, 1082extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,
@@ -1017,6 +1129,29 @@ static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
1017 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32); 1129 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
1018} 1130}
1019 1131
1132static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
1133{
1134 return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
1135 le32_to_cpu(raw_inode->i_size_lo);
1136}
1137
1138static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
1139{
1140 raw_inode->i_size_lo = cpu_to_le32(i_size);
1141 raw_inode->i_size_high = cpu_to_le32(i_size >> 32);
1142}
1143
1144static inline
1145struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
1146 ext4_group_t group)
1147{
1148 struct ext4_group_info ***grp_info;
1149 long indexv, indexh;
1150 grp_info = EXT4_SB(sb)->s_group_info;
1151 indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
1152 indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
1153 return grp_info[indexv][indexh];
1154}
1020 1155
1021 1156
1022#define ext4_std_error(sb, errno) \ 1157#define ext4_std_error(sb, errno) \
@@ -1048,7 +1183,7 @@ extern const struct inode_operations ext4_fast_symlink_inode_operations;
1048extern int ext4_ext_tree_init(handle_t *handle, struct inode *); 1183extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
1049extern int ext4_ext_writepage_trans_blocks(struct inode *, int); 1184extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
1050extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, 1185extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
1051 ext4_fsblk_t iblock, 1186 ext4_lblk_t iblock,
1052 unsigned long max_blocks, struct buffer_head *bh_result, 1187 unsigned long max_blocks, struct buffer_head *bh_result,
1053 int create, int extend_disksize); 1188 int create, int extend_disksize);
1054extern void ext4_ext_truncate(struct inode *, struct page *); 1189extern void ext4_ext_truncate(struct inode *, struct page *);
@@ -1056,19 +1191,10 @@ extern void ext4_ext_init(struct super_block *);
1056extern void ext4_ext_release(struct super_block *); 1191extern void ext4_ext_release(struct super_block *);
1057extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, 1192extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset,
1058 loff_t len); 1193 loff_t len);
1059static inline int 1194extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode,
1060ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, 1195 sector_t block, unsigned long max_blocks,
1061 unsigned long max_blocks, struct buffer_head *bh, 1196 struct buffer_head *bh, int create,
1062 int create, int extend_disksize) 1197 int extend_disksize);
1063{
1064 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
1065 return ext4_ext_get_blocks(handle, inode, block, max_blocks,
1066 bh, create, extend_disksize);
1067 return ext4_get_blocks_handle(handle, inode, block, max_blocks, bh,
1068 create, extend_disksize);
1069}
1070
1071
1072#endif /* __KERNEL__ */ 1198#endif /* __KERNEL__ */
1073 1199
1074#endif /* _LINUX_EXT4_FS_H */ 1200#endif /* _LINUX_EXT4_FS_H */
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
index d2045a26195d..697da4bce6c5 100644
--- a/include/linux/ext4_fs_extents.h
+++ b/include/linux/ext4_fs_extents.h
@@ -124,20 +124,6 @@ struct ext4_ext_path {
124#define EXT4_EXT_CACHE_GAP 1 124#define EXT4_EXT_CACHE_GAP 1
125#define EXT4_EXT_CACHE_EXTENT 2 125#define EXT4_EXT_CACHE_EXTENT 2
126 126
127/*
128 * to be called by ext4_ext_walk_space()
129 * negative retcode - error
130 * positive retcode - signal for ext4_ext_walk_space(), see below
131 * callback must return valid extent (passed or newly created)
132 */
133typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
134 struct ext4_ext_cache *,
135 void *);
136
137#define EXT_CONTINUE 0
138#define EXT_BREAK 1
139#define EXT_REPEAT 2
140
141 127
142#define EXT_MAX_BLOCK 0xffffffff 128#define EXT_MAX_BLOCK 0xffffffff
143 129
@@ -226,6 +212,8 @@ static inline int ext4_ext_get_actual_len(struct ext4_extent *ext)
226 (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN)); 212 (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
227} 213}
228 214
215extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
216extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
229extern int ext4_extent_tree_init(handle_t *, struct inode *); 217extern int ext4_extent_tree_init(handle_t *, struct inode *);
230extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); 218extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *);
231extern int ext4_ext_try_to_merge(struct inode *inode, 219extern int ext4_ext_try_to_merge(struct inode *inode,
@@ -233,8 +221,11 @@ extern int ext4_ext_try_to_merge(struct inode *inode,
233 struct ext4_extent *); 221 struct ext4_extent *);
234extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *); 222extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
235extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); 223extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
236extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *); 224extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t,
237extern struct ext4_ext_path * ext4_ext_find_extent(struct inode *, int, struct ext4_ext_path *); 225 struct ext4_ext_path *);
238 226extern int ext4_ext_search_left(struct inode *, struct ext4_ext_path *,
227 ext4_lblk_t *, ext4_fsblk_t *);
228extern int ext4_ext_search_right(struct inode *, struct ext4_ext_path *,
229 ext4_lblk_t *, ext4_fsblk_t *);
239#endif /* _LINUX_EXT4_EXTENTS */ 230#endif /* _LINUX_EXT4_EXTENTS */
240 231
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h
index 86ddfe2089f3..d5508d3cf290 100644
--- a/include/linux/ext4_fs_i.h
+++ b/include/linux/ext4_fs_i.h
@@ -27,6 +27,12 @@ typedef int ext4_grpblk_t;
27/* data type for filesystem-wide blocks number */ 27/* data type for filesystem-wide blocks number */
28typedef unsigned long long ext4_fsblk_t; 28typedef unsigned long long ext4_fsblk_t;
29 29
30/* data type for file logical block number */
31typedef __u32 ext4_lblk_t;
32
33/* data type for block group number */
34typedef unsigned long ext4_group_t;
35
30struct ext4_reserve_window { 36struct ext4_reserve_window {
31 ext4_fsblk_t _rsv_start; /* First byte reserved */ 37 ext4_fsblk_t _rsv_start; /* First byte reserved */
32 ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */ 38 ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */
@@ -48,7 +54,7 @@ struct ext4_block_alloc_info {
48 * most-recently-allocated block in this file. 54 * most-recently-allocated block in this file.
49 * We use this for detecting linearly ascending allocation requests. 55 * We use this for detecting linearly ascending allocation requests.
50 */ 56 */
51 __u32 last_alloc_logical_block; 57 ext4_lblk_t last_alloc_logical_block;
52 /* 58 /*
53 * Was i_next_alloc_goal in ext4_inode_info 59 * Was i_next_alloc_goal in ext4_inode_info
54 * is the *physical* companion to i_next_alloc_block. 60 * is the *physical* companion to i_next_alloc_block.
@@ -67,7 +73,7 @@ struct ext4_block_alloc_info {
67 */ 73 */
68struct ext4_ext_cache { 74struct ext4_ext_cache {
69 ext4_fsblk_t ec_start; 75 ext4_fsblk_t ec_start;
70 __u32 ec_block; 76 ext4_lblk_t ec_block;
71 __u32 ec_len; /* must be 32bit to return holes */ 77 __u32 ec_len; /* must be 32bit to return holes */
72 __u32 ec_type; 78 __u32 ec_type;
73}; 79};
@@ -79,7 +85,6 @@ struct ext4_inode_info {
79 __le32 i_data[15]; /* unconverted */ 85 __le32 i_data[15]; /* unconverted */
80 __u32 i_flags; 86 __u32 i_flags;
81 ext4_fsblk_t i_file_acl; 87 ext4_fsblk_t i_file_acl;
82 __u32 i_dir_acl;
83 __u32 i_dtime; 88 __u32 i_dtime;
84 89
85 /* 90 /*
@@ -89,13 +94,13 @@ struct ext4_inode_info {
89 * place a file's data blocks near its inode block, and new inodes 94 * place a file's data blocks near its inode block, and new inodes
90 * near to their parent directory's inode. 95 * near to their parent directory's inode.
91 */ 96 */
92 __u32 i_block_group; 97 ext4_group_t i_block_group;
93 __u32 i_state; /* Dynamic state flags for ext4 */ 98 __u32 i_state; /* Dynamic state flags for ext4 */
94 99
95 /* block reservation info */ 100 /* block reservation info */
96 struct ext4_block_alloc_info *i_block_alloc_info; 101 struct ext4_block_alloc_info *i_block_alloc_info;
97 102
98 __u32 i_dir_start_lookup; 103 ext4_lblk_t i_dir_start_lookup;
99#ifdef CONFIG_EXT4DEV_FS_XATTR 104#ifdef CONFIG_EXT4DEV_FS_XATTR
100 /* 105 /*
101 * Extended attributes can be read independently of the main file 106 * Extended attributes can be read independently of the main file
@@ -134,16 +139,16 @@ struct ext4_inode_info {
134 __u16 i_extra_isize; 139 __u16 i_extra_isize;
135 140
136 /* 141 /*
137 * truncate_mutex is for serialising ext4_truncate() against 142 * i_data_sem is for serialising ext4_truncate() against
138 * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's 143 * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's
139 * data tree are chopped off during truncate. We can't do that in 144 * data tree are chopped off during truncate. We can't do that in
140 * ext4 because whenever we perform intermediate commits during 145 * ext4 because whenever we perform intermediate commits during
141 * truncate, the inode and all the metadata blocks *must* be in a 146 * truncate, the inode and all the metadata blocks *must* be in a
142 * consistent state which allows truncation of the orphans to restart 147 * consistent state which allows truncation of the orphans to restart
143 * during recovery. Hence we must fix the get_block-vs-truncate race 148 * during recovery. Hence we must fix the get_block-vs-truncate race
144 * by other means, so we have truncate_mutex. 149 * by other means, so we have i_data_sem.
145 */ 150 */
146 struct mutex truncate_mutex; 151 struct rw_semaphore i_data_sem;
147 struct inode vfs_inode; 152 struct inode vfs_inode;
148 153
149 unsigned long i_ext_generation; 154 unsigned long i_ext_generation;
@@ -153,6 +158,10 @@ struct ext4_inode_info {
153 * struct timespec i_{a,c,m}time in the generic inode. 158 * struct timespec i_{a,c,m}time in the generic inode.
154 */ 159 */
155 struct timespec i_crtime; 160 struct timespec i_crtime;
161
162 /* mballoc */
163 struct list_head i_prealloc_list;
164 spinlock_t i_prealloc_lock;
156}; 165};
157 166
158#endif /* _LINUX_EXT4_FS_I */ 167#endif /* _LINUX_EXT4_FS_I */
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h
index b40e827cd495..abaae2c8cccf 100644
--- a/include/linux/ext4_fs_sb.h
+++ b/include/linux/ext4_fs_sb.h
@@ -35,9 +35,10 @@ struct ext4_sb_info {
35 unsigned long s_itb_per_group; /* Number of inode table blocks per group */ 35 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
36 unsigned long s_gdb_count; /* Number of group descriptor blocks */ 36 unsigned long s_gdb_count; /* Number of group descriptor blocks */
37 unsigned long s_desc_per_block; /* Number of group descriptors per block */ 37 unsigned long s_desc_per_block; /* Number of group descriptors per block */
38 unsigned long s_groups_count; /* Number of groups in the fs */ 38 ext4_group_t s_groups_count; /* Number of groups in the fs */
39 unsigned long s_overhead_last; /* Last calculated overhead */ 39 unsigned long s_overhead_last; /* Last calculated overhead */
40 unsigned long s_blocks_last; /* Last seen block count */ 40 unsigned long s_blocks_last; /* Last seen block count */
41 loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
41 struct buffer_head * s_sbh; /* Buffer containing the super block */ 42 struct buffer_head * s_sbh; /* Buffer containing the super block */
42 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */ 43 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */
43 struct buffer_head ** s_group_desc; 44 struct buffer_head ** s_group_desc;
@@ -90,6 +91,58 @@ struct ext4_sb_info {
90 unsigned long s_ext_blocks; 91 unsigned long s_ext_blocks;
91 unsigned long s_ext_extents; 92 unsigned long s_ext_extents;
92#endif 93#endif
94
95 /* for buddy allocator */
96 struct ext4_group_info ***s_group_info;
97 struct inode *s_buddy_cache;
98 long s_blocks_reserved;
99 spinlock_t s_reserve_lock;
100 struct list_head s_active_transaction;
101 struct list_head s_closed_transaction;
102 struct list_head s_committed_transaction;
103 spinlock_t s_md_lock;
104 tid_t s_last_transaction;
105 unsigned short *s_mb_offsets, *s_mb_maxs;
106
107 /* tunables */
108 unsigned long s_stripe;
109 unsigned long s_mb_stream_request;
110 unsigned long s_mb_max_to_scan;
111 unsigned long s_mb_min_to_scan;
112 unsigned long s_mb_stats;
113 unsigned long s_mb_order2_reqs;
114 unsigned long s_mb_group_prealloc;
115 /* where last allocation was done - for stream allocation */
116 unsigned long s_mb_last_group;
117 unsigned long s_mb_last_start;
118
119 /* history to debug policy */
120 struct ext4_mb_history *s_mb_history;
121 int s_mb_history_cur;
122 int s_mb_history_max;
123 int s_mb_history_num;
124 struct proc_dir_entry *s_mb_proc;
125 spinlock_t s_mb_history_lock;
126 int s_mb_history_filter;
127
128 /* stats for buddy allocator */
129 spinlock_t s_mb_pa_lock;
130 atomic_t s_bal_reqs; /* number of reqs with len > 1 */
131 atomic_t s_bal_success; /* we found long enough chunks */
132 atomic_t s_bal_allocated; /* in blocks */
133 atomic_t s_bal_ex_scanned; /* total extents scanned */
134 atomic_t s_bal_goals; /* goal hits */
135 atomic_t s_bal_breaks; /* too long searches */
136 atomic_t s_bal_2orders; /* 2^order hits */
137 spinlock_t s_bal_lock;
138 unsigned long s_mb_buddies_generated;
139 unsigned long long s_mb_generation_time;
140 atomic_t s_mb_lost_chunks;
141 atomic_t s_mb_preallocated;
142 atomic_t s_mb_discarded;
143
144 /* locality groups */
145 struct ext4_locality_group *s_locality_groups;
93}; 146};
94 147
95#endif /* _LINUX_EXT4_FS_SB */ 148#endif /* _LINUX_EXT4_FS_SB */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b3ec4a496d64..a516b6716870 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -124,6 +124,7 @@ extern int dir_notify_enable;
124#define MS_SHARED (1<<20) /* change to shared */ 124#define MS_SHARED (1<<20) /* change to shared */
125#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ 125#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
126#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 126#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
127#define MS_I_VERSION (1<<23) /* Update inode I_version field */
127#define MS_ACTIVE (1<<30) 128#define MS_ACTIVE (1<<30)
128#define MS_NOUSER (1<<31) 129#define MS_NOUSER (1<<31)
129 130
@@ -173,6 +174,7 @@ extern int dir_notify_enable;
173 ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) 174 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
174#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) 175#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
175#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) 176#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
177#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
176 178
177#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) 179#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
178#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) 180#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
@@ -599,7 +601,7 @@ struct inode {
599 uid_t i_uid; 601 uid_t i_uid;
600 gid_t i_gid; 602 gid_t i_gid;
601 dev_t i_rdev; 603 dev_t i_rdev;
602 unsigned long i_version; 604 u64 i_version;
603 loff_t i_size; 605 loff_t i_size;
604#ifdef __NEED_I_SIZE_ORDERED 606#ifdef __NEED_I_SIZE_ORDERED
605 seqcount_t i_size_seqcount; 607 seqcount_t i_size_seqcount;
@@ -1394,6 +1396,21 @@ static inline void inode_dec_link_count(struct inode *inode)
1394 mark_inode_dirty(inode); 1396 mark_inode_dirty(inode);
1395} 1397}
1396 1398
1399/**
1400 * inode_inc_iversion - increments i_version
1401 * @inode: inode that need to be updated
1402 *
1403 * Every time the inode is modified, the i_version field will be incremented.
1404 * The filesystem has to be mounted with i_version flag
1405 */
1406
1407static inline void inode_inc_iversion(struct inode *inode)
1408{
1409 spin_lock(&inode->i_lock);
1410 inode->i_version++;
1411 spin_unlock(&inode->i_lock);
1412}
1413
1397extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); 1414extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
1398static inline void file_accessed(struct file *file) 1415static inline void file_accessed(struct file *file)
1399{ 1416{
@@ -1476,7 +1493,7 @@ extern void drop_collected_mounts(struct vfsmount *);
1476extern int vfs_statfs(struct dentry *, struct kstatfs *); 1493extern int vfs_statfs(struct dentry *, struct kstatfs *);
1477 1494
1478/* /sys/fs */ 1495/* /sys/fs */
1479extern struct kset fs_subsys; 1496extern struct kobject *fs_kobj;
1480 1497
1481#define FLOCK_VERIFY_READ 1 1498#define FLOCK_VERIFY_READ 1
1482#define FLOCK_VERIFY_WRITE 2 1499#define FLOCK_VERIFY_WRITE 2
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 92d420fe03f8..1a15f8e237a7 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -1,8 +1,12 @@
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> 4#include <linux/compiler.h>
5#include <linux/types.h>
5 6
7struct inode;
8struct mm_struct;
9struct task_struct;
6union ktime; 10union ktime;
7 11
8/* Second argument to futex syscall */ 12/* Second argument to futex syscall */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index a47b8025d399..1dbea0ac5693 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -10,9 +10,19 @@
10 */ 10 */
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/kdev_t.h>
13 14
14#ifdef CONFIG_BLOCK 15#ifdef CONFIG_BLOCK
15 16
17#define kobj_to_dev(k) container_of(k, struct device, kobj)
18#define dev_to_disk(device) container_of(device, struct gendisk, dev)
19#define dev_to_part(device) container_of(device, struct hd_struct, dev)
20
21extern struct device_type disk_type;
22extern struct device_type part_type;
23extern struct kobject *block_depr;
24extern struct class block_class;
25
16enum { 26enum {
17/* These three have identical behaviour; use the second one if DOS FDISK gets 27/* These three have identical behaviour; use the second one if DOS FDISK gets
18 confused about extended/logical partitions starting past cylinder 1023. */ 28 confused about extended/logical partitions starting past cylinder 1023. */
@@ -84,7 +94,7 @@ struct partition {
84struct hd_struct { 94struct hd_struct {
85 sector_t start_sect; 95 sector_t start_sect;
86 sector_t nr_sects; 96 sector_t nr_sects;
87 struct kobject kobj; 97 struct device dev;
88 struct kobject *holder_dir; 98 struct kobject *holder_dir;
89 unsigned ios[2], sectors[2]; /* READs and WRITEs */ 99 unsigned ios[2], sectors[2]; /* READs and WRITEs */
90 int policy, partno; 100 int policy, partno;
@@ -117,15 +127,14 @@ struct gendisk {
117 * disks that can't be partitioned. */ 127 * disks that can't be partitioned. */
118 char disk_name[32]; /* name of major driver */ 128 char disk_name[32]; /* name of major driver */
119 struct hd_struct **part; /* [indexed by minor] */ 129 struct hd_struct **part; /* [indexed by minor] */
120 int part_uevent_suppress;
121 struct block_device_operations *fops; 130 struct block_device_operations *fops;
122 struct request_queue *queue; 131 struct request_queue *queue;
123 void *private_data; 132 void *private_data;
124 sector_t capacity; 133 sector_t capacity;
125 134
126 int flags; 135 int flags;
127 struct device *driverfs_dev; 136 struct device *driverfs_dev; // FIXME: remove
128 struct kobject kobj; 137 struct device dev;
129 struct kobject *holder_dir; 138 struct kobject *holder_dir;
130 struct kobject *slave_dir; 139 struct kobject *slave_dir;
131 140
@@ -143,13 +152,6 @@ struct gendisk {
143 struct work_struct async_notify; 152 struct work_struct async_notify;
144}; 153};
145 154
146/* Structure for sysfs attributes on block devices */
147struct disk_attribute {
148 struct attribute attr;
149 ssize_t (*show)(struct gendisk *, char *);
150 ssize_t (*store)(struct gendisk *, const char *, size_t);
151};
152
153/* 155/*
154 * Macros to operate on percpu disk statistics: 156 * Macros to operate on percpu disk statistics:
155 * 157 *
@@ -411,7 +413,8 @@ struct unixware_disklabel {
411#define ADDPART_FLAG_RAID 1 413#define ADDPART_FLAG_RAID 1
412#define ADDPART_FLAG_WHOLEDISK 2 414#define ADDPART_FLAG_WHOLEDISK 2
413 415
414char *disk_name (struct gendisk *hd, int part, char *buf); 416extern dev_t blk_lookup_devt(const char *name);
417extern char *disk_name (struct gendisk *hd, int part, char *buf);
415 418
416extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 419extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
417extern void add_partition(struct gendisk *, int, sector_t, sector_t, int); 420extern void add_partition(struct gendisk *, int, sector_t, sector_t, int);
@@ -423,12 +426,12 @@ extern struct gendisk *alloc_disk(int minors);
423extern struct kobject *get_disk(struct gendisk *disk); 426extern struct kobject *get_disk(struct gendisk *disk);
424extern void put_disk(struct gendisk *disk); 427extern void put_disk(struct gendisk *disk);
425extern void genhd_media_change_notify(struct gendisk *disk); 428extern void genhd_media_change_notify(struct gendisk *disk);
426extern void blk_register_region(dev_t dev, unsigned long range, 429extern void blk_register_region(dev_t devt, unsigned long range,
427 struct module *module, 430 struct module *module,
428 struct kobject *(*probe)(dev_t, int *, void *), 431 struct kobject *(*probe)(dev_t, int *, void *),
429 int (*lock)(dev_t, void *), 432 int (*lock)(dev_t, void *),
430 void *data); 433 void *data);
431extern void blk_unregister_region(dev_t dev, unsigned long range); 434extern void blk_unregister_region(dev_t devt, unsigned long range);
432 435
433static inline struct block_device *bdget_disk(struct gendisk *disk, int index) 436static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
434{ 437{
@@ -441,6 +444,12 @@ static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
441 444
442static inline void printk_all_partitions(void) { } 445static inline void printk_all_partitions(void) { }
443 446
447static inline dev_t blk_lookup_devt(const char *name)
448{
449 dev_t devt = MKDEV(0, 0);
450 return devt;
451}
452
444#endif /* CONFIG_BLOCK */ 453#endif /* CONFIG_BLOCK */
445 454
446#endif 455#endif
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 8d302298a161..2961ec788046 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -72,11 +72,7 @@
72#define in_softirq() (softirq_count()) 72#define in_softirq() (softirq_count())
73#define in_interrupt() (irq_count()) 73#define in_interrupt() (irq_count())
74 74
75#if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL) 75#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
76# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
77#else
78# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
79#endif
80 76
81#ifdef CONFIG_PREEMPT 77#ifdef CONFIG_PREEMPT
82# define PREEMPT_CHECK_OFFSET 1 78# define PREEMPT_CHECK_OFFSET 1
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index 818c6afc1091..ff43f8d6b5b3 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -44,7 +44,9 @@
44 44
45/* Bits for HD_ERROR */ 45/* Bits for HD_ERROR */
46#define MARK_ERR 0x01 /* Bad address mark */ 46#define MARK_ERR 0x01 /* Bad address mark */
47#define ILI_ERR 0x01 /* Illegal Length Indication (ATAPI) */
47#define TRK0_ERR 0x02 /* couldn't find track 0 */ 48#define TRK0_ERR 0x02 /* couldn't find track 0 */
49#define EOM_ERR 0x02 /* End Of Media (ATAPI) */
48#define ABRT_ERR 0x04 /* Command aborted */ 50#define ABRT_ERR 0x04 /* Command aborted */
49#define MCR_ERR 0x08 /* media change request */ 51#define MCR_ERR 0x08 /* media change request */
50#define ID_ERR 0x10 /* ID field not found */ 52#define ID_ERR 0x10 /* ID field not found */
@@ -52,6 +54,7 @@
52#define ECC_ERR 0x40 /* Uncorrectable ECC error */ 54#define ECC_ERR 0x40 /* Uncorrectable ECC error */
53#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */ 55#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
54#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */ 56#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
57#define LFS_ERR 0xf0 /* Last Failed Sense (ATAPI) */
55 58
56/* Bits of HD_NSECTOR */ 59/* Bits of HD_NSECTOR */
57#define CD 0x01 60#define CD 0x01
@@ -70,13 +73,13 @@
70#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8)) 73#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8))
71#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8)) 74#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8))
72 75
73#define IDE_DRIVE_TASK_INVALID -1
74#define IDE_DRIVE_TASK_NO_DATA 0 76#define IDE_DRIVE_TASK_NO_DATA 0
77#ifndef __KERNEL__
78#define IDE_DRIVE_TASK_INVALID -1
75#define IDE_DRIVE_TASK_SET_XFER 1 79#define IDE_DRIVE_TASK_SET_XFER 1
76
77#define IDE_DRIVE_TASK_IN 2 80#define IDE_DRIVE_TASK_IN 2
78
79#define IDE_DRIVE_TASK_OUT 3 81#define IDE_DRIVE_TASK_OUT 3
82#endif
80#define IDE_DRIVE_TASK_RAW_WRITE 4 83#define IDE_DRIVE_TASK_RAW_WRITE 4
81 84
82/* 85/*
@@ -87,10 +90,10 @@
87#ifndef __KERNEL__ 90#ifndef __KERNEL__
88#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE 91#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
89#define IDE_HOB_STD_OUT_FLAGS 0x3C 92#define IDE_HOB_STD_OUT_FLAGS 0x3C
90#endif
91 93
92typedef unsigned char task_ioreg_t; 94typedef unsigned char task_ioreg_t;
93typedef unsigned long sata_ioreg_t; 95typedef unsigned long sata_ioreg_t;
96#endif
94 97
95typedef union ide_reg_valid_s { 98typedef union ide_reg_valid_s {
96 unsigned all : 16; 99 unsigned all : 16;
@@ -116,8 +119,8 @@ typedef union ide_reg_valid_s {
116} ide_reg_valid_t; 119} ide_reg_valid_t;
117 120
118typedef struct ide_task_request_s { 121typedef struct ide_task_request_s {
119 task_ioreg_t io_ports[8]; 122 __u8 io_ports[8];
120 task_ioreg_t hob_ports[8]; 123 __u8 hob_ports[8]; /* bytes 6 and 7 are unused */
121 ide_reg_valid_t out_flags; 124 ide_reg_valid_t out_flags;
122 ide_reg_valid_t in_flags; 125 ide_reg_valid_t in_flags;
123 int data_phase; 126 int data_phase;
@@ -133,36 +136,35 @@ typedef struct ide_ioctl_request_s {
133} ide_ioctl_request_t; 136} ide_ioctl_request_t;
134 137
135struct hd_drive_cmd_hdr { 138struct hd_drive_cmd_hdr {
136 task_ioreg_t command; 139 __u8 command;
137 task_ioreg_t sector_number; 140 __u8 sector_number;
138 task_ioreg_t feature; 141 __u8 feature;
139 task_ioreg_t sector_count; 142 __u8 sector_count;
140}; 143};
141 144
145#ifndef __KERNEL__
142typedef struct hd_drive_task_hdr { 146typedef struct hd_drive_task_hdr {
143 task_ioreg_t data; 147 __u8 data;
144 task_ioreg_t feature; 148 __u8 feature;
145 task_ioreg_t sector_count; 149 __u8 sector_count;
146 task_ioreg_t sector_number; 150 __u8 sector_number;
147 task_ioreg_t low_cylinder; 151 __u8 low_cylinder;
148 task_ioreg_t high_cylinder; 152 __u8 high_cylinder;
149 task_ioreg_t device_head; 153 __u8 device_head;
150 task_ioreg_t command; 154 __u8 command;
151} task_struct_t; 155} task_struct_t;
152 156
153typedef struct hd_drive_hob_hdr { 157typedef struct hd_drive_hob_hdr {
154 task_ioreg_t data; 158 __u8 data;
155 task_ioreg_t feature; 159 __u8 feature;
156 task_ioreg_t sector_count; 160 __u8 sector_count;
157 task_ioreg_t sector_number; 161 __u8 sector_number;
158 task_ioreg_t low_cylinder; 162 __u8 low_cylinder;
159 task_ioreg_t high_cylinder; 163 __u8 high_cylinder;
160 task_ioreg_t device_head; 164 __u8 device_head;
161 task_ioreg_t control; 165 __u8 control;
162} hob_struct_t; 166} hob_struct_t;
163 167#endif
164#define TASKFILE_INVALID 0x7fff
165#define TASKFILE_48 0x8000
166 168
167#define TASKFILE_NO_DATA 0x0000 169#define TASKFILE_NO_DATA 0x0000
168 170
@@ -178,12 +180,16 @@ typedef struct hd_drive_hob_hdr {
178#define TASKFILE_IN_DMAQ 0x0080 180#define TASKFILE_IN_DMAQ 0x0080
179#define TASKFILE_OUT_DMAQ 0x0100 181#define TASKFILE_OUT_DMAQ 0x0100
180 182
183#ifndef __KERNEL__
181#define TASKFILE_P_IN 0x0200 184#define TASKFILE_P_IN 0x0200
182#define TASKFILE_P_OUT 0x0400 185#define TASKFILE_P_OUT 0x0400
183#define TASKFILE_P_IN_DMA 0x0800 186#define TASKFILE_P_IN_DMA 0x0800
184#define TASKFILE_P_OUT_DMA 0x1000 187#define TASKFILE_P_OUT_DMA 0x1000
185#define TASKFILE_P_IN_DMAQ 0x2000 188#define TASKFILE_P_IN_DMAQ 0x2000
186#define TASKFILE_P_OUT_DMAQ 0x4000 189#define TASKFILE_P_OUT_DMAQ 0x4000
190#define TASKFILE_48 0x8000
191#define TASKFILE_INVALID 0x7fff
192#endif
187 193
188/* ATA/ATAPI Commands pre T13 Spec */ 194/* ATA/ATAPI Commands pre T13 Spec */
189#define WIN_NOP 0x00 195#define WIN_NOP 0x00
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 6e35b92b1d2c..3902690647b0 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -267,10 +267,10 @@ struct hid_item {
267#define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100 267#define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100
268#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200 268#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200
269#define HID_QUIRK_MIGHTYMOUSE 0x00000400 269#define HID_QUIRK_MIGHTYMOUSE 0x00000400
270#define HID_QUIRK_POWERBOOK_HAS_FN 0x00000800 270#define HID_QUIRK_APPLE_HAS_FN 0x00000800
271#define HID_QUIRK_POWERBOOK_FN_ON 0x00001000 271#define HID_QUIRK_APPLE_FN_ON 0x00001000
272#define HID_QUIRK_INVERT_HWHEEL 0x00002000 272#define HID_QUIRK_INVERT_HWHEEL 0x00002000
273#define HID_QUIRK_POWERBOOK_ISO_KEYBOARD 0x00004000 273#define HID_QUIRK_APPLE_ISO_KEYBOARD 0x00004000
274#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000 274#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000
275#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 275#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
276#define HID_QUIRK_IGNORE_MOUSE 0x00020000 276#define HID_QUIRK_IGNORE_MOUSE 0x00020000
@@ -281,6 +281,9 @@ struct hid_item {
281#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000 281#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000
282#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000 282#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000
283#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000 283#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000
284#define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000
285#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000
286#define HID_QUIRK_MICROSOFT_KEYS 0x08000000
284 287
285/* 288/*
286 * Separate quirks for runtime report descriptor fixup 289 * Separate quirks for runtime report descriptor fixup
@@ -291,6 +294,8 @@ struct hid_item {
291#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004 294#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004
292#define HID_QUIRK_RDESC_PETALYNX 0x00000008 295#define HID_QUIRK_RDESC_PETALYNX 0x00000008
293#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010 296#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010
297#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020
298#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040
294 299
295/* 300/*
296 * This is the global environment of the parser. This information is 301 * This is the global environment of the parser. This information is
@@ -456,6 +461,8 @@ struct hid_device { /* device report descriptor */
456 461
457 void *driver_data; 462 void *driver_data;
458 463
464 __s32 delayed_value; /* For A4 Tech mice hwheel quirk */
465
459 /* device-specific function pointers */ 466 /* device-specific function pointers */
460 int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int); 467 int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int);
461 int (*hid_open) (struct hid_device *); 468 int (*hid_open) (struct hid_device *);
@@ -469,7 +476,7 @@ struct hid_device { /* device report descriptor */
469 /* handler for raw output data, used by hidraw */ 476 /* handler for raw output data, used by hidraw */
470 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); 477 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
471#ifdef CONFIG_USB_HIDINPUT_POWERBOOK 478#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
472 unsigned long pb_pressed_fn[BITS_TO_LONGS(KEY_CNT)]; 479 unsigned long apple_pressed_fn[BITS_TO_LONGS(KEY_CNT)];
473 unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)]; 480 unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)];
474#endif 481#endif
475}; 482};
@@ -520,6 +527,9 @@ extern void hidinput_disconnect(struct hid_device *);
520int hid_set_field(struct hid_field *, unsigned, __s32); 527int hid_set_field(struct hid_field *, unsigned, __s32);
521int hid_input_report(struct hid_device *, int type, u8 *, int, int); 528int hid_input_report(struct hid_device *, int type, u8 *, int, int);
522int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 529int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
530int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *);
531void hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
532int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32);
523void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt); 533void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt);
524void hid_output_report(struct hid_report *report, __u8 *data); 534void hid_output_report(struct hid_report *report, __u8 *data);
525void hid_free_device(struct hid_device *device); 535void hid_free_device(struct hid_device *device);
diff --git a/include/linux/hpet.h b/include/linux/hpet.h
index 707f7cb9e795..9cd94bfd07e5 100644
--- a/include/linux/hpet.h
+++ b/include/linux/hpet.h
@@ -64,7 +64,7 @@ struct hpet {
64 */ 64 */
65 65
66#define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL) 66#define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL)
67#define Tn_INI_ROUTE_CAP_SHIFT (32UL) 67#define Tn_INT_ROUTE_CAP_SHIFT (32UL)
68#define Tn_FSB_INT_DELCAP_MASK (0x8000UL) 68#define Tn_FSB_INT_DELCAP_MASK (0x8000UL)
69#define Tn_FSB_INT_DELCAP_SHIFT (15) 69#define Tn_FSB_INT_DELCAP_SHIFT (15)
70#define Tn_FSB_EN_CNF_MASK (0x4000UL) 70#define Tn_FSB_EN_CNF_MASK (0x4000UL)
@@ -115,9 +115,6 @@ static inline void hpet_reserve_timer(struct hpet_data *hd, int timer)
115} 115}
116 116
117int hpet_alloc(struct hpet_data *); 117int hpet_alloc(struct hpet_data *);
118int hpet_register(struct hpet_task *, int);
119int hpet_unregister(struct hpet_task *);
120int hpet_control(struct hpet_task *, unsigned int, unsigned long);
121 118
122#endif /* __KERNEL__ */ 119#endif /* __KERNEL__ */
123 120
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 7a9398e19704..49067f14fac1 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -115,10 +115,8 @@ struct hrtimer {
115 enum hrtimer_restart (*function)(struct hrtimer *); 115 enum hrtimer_restart (*function)(struct hrtimer *);
116 struct hrtimer_clock_base *base; 116 struct hrtimer_clock_base *base;
117 unsigned long state; 117 unsigned long state;
118#ifdef CONFIG_HIGH_RES_TIMERS
119 enum hrtimer_cb_mode cb_mode; 118 enum hrtimer_cb_mode cb_mode;
120 struct list_head cb_entry; 119 struct list_head cb_entry;
121#endif
122#ifdef CONFIG_TIMER_STATS 120#ifdef CONFIG_TIMER_STATS
123 void *start_site; 121 void *start_site;
124 char start_comm[16]; 122 char start_comm[16];
@@ -194,10 +192,10 @@ struct hrtimer_cpu_base {
194 spinlock_t lock; 192 spinlock_t lock;
195 struct lock_class_key lock_key; 193 struct lock_class_key lock_key;
196 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; 194 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
195 struct list_head cb_pending;
197#ifdef CONFIG_HIGH_RES_TIMERS 196#ifdef CONFIG_HIGH_RES_TIMERS
198 ktime_t expires_next; 197 ktime_t expires_next;
199 int hres_active; 198 int hres_active;
200 struct list_head cb_pending;
201 unsigned long nr_events; 199 unsigned long nr_events;
202#endif 200#endif
203}; 201};
@@ -217,6 +215,11 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
217 return timer->base->get_time(); 215 return timer->base->get_time();
218} 216}
219 217
218static inline int hrtimer_is_hres_active(struct hrtimer *timer)
219{
220 return timer->base->cpu_base->hres_active;
221}
222
220/* 223/*
221 * The resolution of the clocks. The resolution value is returned in 224 * The resolution of the clocks. The resolution value is returned in
222 * the clock_getres() system call to give application programmers an 225 * the clock_getres() system call to give application programmers an
@@ -248,6 +251,10 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
248 return timer->base->softirq_time; 251 return timer->base->softirq_time;
249} 252}
250 253
254static inline int hrtimer_is_hres_active(struct hrtimer *timer)
255{
256 return 0;
257}
251#endif 258#endif
252 259
253extern ktime_t ktime_get(void); 260extern ktime_t ktime_get(void);
@@ -310,6 +317,7 @@ extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
310 317
311/* Soft interrupt function to run the hrtimer queues: */ 318/* Soft interrupt function to run the hrtimer queues: */
312extern void hrtimer_run_queues(void); 319extern void hrtimer_run_queues(void);
320extern void hrtimer_run_pending(void);
313 321
314/* Bootup initialization: */ 322/* Bootup initialization: */
315extern void __init hrtimers_init(void); 323extern void __init hrtimers_init(void);
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 21ea7610e177..85d11916e9ea 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -33,7 +33,7 @@ struct hwrng {
33 const char *name; 33 const char *name;
34 int (*init)(struct hwrng *rng); 34 int (*init)(struct hwrng *rng);
35 void (*cleanup)(struct hwrng *rng); 35 void (*cleanup)(struct hwrng *rng);
36 int (*data_present)(struct hwrng *rng); 36 int (*data_present)(struct hwrng *rng, int wait);
37 int (*data_read)(struct hwrng *rng, u32 *data); 37 int (*data_read)(struct hwrng *rng, u32 *data);
38 unsigned long priv; 38 unsigned long priv;
39 39
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index e18017d45758..f922b060158b 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -33,23 +33,13 @@
33 33
34#define I2C_DRIVERID_MSP3400 1 34#define I2C_DRIVERID_MSP3400 1
35#define I2C_DRIVERID_TUNER 2 35#define I2C_DRIVERID_TUNER 2
36#define I2C_DRIVERID_VIDEOTEX 3 /* please rename */
37#define I2C_DRIVERID_TDA8425 4 /* stereo sound processor */ 36#define I2C_DRIVERID_TDA8425 4 /* stereo sound processor */
38#define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */ 37#define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */
39#define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */ 38#define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */
40#define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */ 39#define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */
41#define I2C_DRIVERID_SAA7111A 8 /* video input processor */ 40#define I2C_DRIVERID_SAA7111A 8 /* video input processor */
42#define I2C_DRIVERID_SAA5281 9 /* videotext decoder */
43#define I2C_DRIVERID_SAA7112 10 /* video decoder, image scaler */
44#define I2C_DRIVERID_SAA7120 11 /* video encoder */
45#define I2C_DRIVERID_SAA7121 12 /* video encoder */
46#define I2C_DRIVERID_SAA7185B 13 /* video encoder */ 41#define I2C_DRIVERID_SAA7185B 13 /* video encoder */
47#define I2C_DRIVERID_CH7003 14 /* digital pc to tv encoder */
48#define I2C_DRIVERID_PCF8574A 15 /* i2c expander - 8 bit in/out */
49#define I2C_DRIVERID_PCF8582C 16 /* eeprom */
50#define I2C_DRIVERID_AT24Cxx 17 /* eeprom 1/2/4/8/16 K */
51#define I2C_DRIVERID_TEA6300 18 /* audio mixer */ 42#define I2C_DRIVERID_TEA6300 18 /* audio mixer */
52#define I2C_DRIVERID_BT829 19 /* pc to tv encoder */
53#define I2C_DRIVERID_TDA9850 20 /* audio mixer */ 43#define I2C_DRIVERID_TDA9850 20 /* audio mixer */
54#define I2C_DRIVERID_TDA9855 21 /* audio mixer */ 44#define I2C_DRIVERID_TDA9855 21 /* audio mixer */
55#define I2C_DRIVERID_SAA7110 22 /* video decoder */ 45#define I2C_DRIVERID_SAA7110 22 /* video decoder */
@@ -60,42 +50,19 @@
60#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ 50#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
61#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */ 51#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */
62#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ 52#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
63#define I2C_DRIVERID_DPL3518 30 /* Dolby decoder chip */
64#define I2C_DRIVERID_TDA9873 31 /* TV sound decoder chip */ 53#define I2C_DRIVERID_TDA9873 31 /* TV sound decoder chip */
65#define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */ 54#define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */
66#define I2C_DRIVERID_PIC16C54_PV9 33 /* Audio mux/ir receiver */ 55#define I2C_DRIVERID_PIC16C54_PV9 33 /* Audio mux/ir receiver */
67
68#define I2C_DRIVERID_SBATT 34 /* Smart Battery Device */
69#define I2C_DRIVERID_SBS 35 /* SB System Manager */
70#define I2C_DRIVERID_VES1893 36 /* VLSI DVB-S decoder */
71#define I2C_DRIVERID_VES1820 37 /* VLSI DVB-C decoder */
72#define I2C_DRIVERID_SAA7113 38 /* video decoder */
73#define I2C_DRIVERID_TDA8444 39 /* octuple 6-bit DAC */
74#define I2C_DRIVERID_BT819 40 /* video decoder */ 56#define I2C_DRIVERID_BT819 40 /* video decoder */
75#define I2C_DRIVERID_BT856 41 /* video encoder */ 57#define I2C_DRIVERID_BT856 41 /* video encoder */
76#define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */ 58#define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */
77#define I2C_DRIVERID_DRP3510 43 /* ADR decoder (Astra Radio) */
78#define I2C_DRIVERID_SP5055 44 /* Satellite tuner */
79#define I2C_DRIVERID_STV0030 45 /* Multipurpose switch */
80#define I2C_DRIVERID_SAA7108 46 /* video decoder, image scaler */
81#define I2C_DRIVERID_DS1307 47 /* DS1307 real time clock */
82#define I2C_DRIVERID_ADV7175 48 /* ADV 7175/7176 video encoder */ 59#define I2C_DRIVERID_ADV7175 48 /* ADV 7175/7176 video encoder */
83#define I2C_DRIVERID_SAA7114 49 /* video decoder */ 60#define I2C_DRIVERID_SAA7114 49 /* video decoder */
84#define I2C_DRIVERID_ZR36120 50 /* Zoran 36120 video encoder */
85#define I2C_DRIVERID_24LC32A 51 /* Microchip 24LC32A 32k EEPROM */
86#define I2C_DRIVERID_STM41T00 52 /* real time clock */
87#define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */
88#define I2C_DRIVERID_ADV7170 54 /* video encoder */ 61#define I2C_DRIVERID_ADV7170 54 /* video encoder */
89#define I2C_DRIVERID_MAX1617 56 /* temp sensor */
90#define I2C_DRIVERID_SAA7191 57 /* video decoder */ 62#define I2C_DRIVERID_SAA7191 57 /* video decoder */
91#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ 63#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */
92#define I2C_DRIVERID_BT832 59 /* CMOS camera video processor */
93#define I2C_DRIVERID_TDA9887 60 /* TDA988x IF-PLL demodulator */
94#define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */ 64#define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */
95#define I2C_DRIVERID_TDA7313 62 /* TDA7313 audio processor */
96#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ 65#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */
97#define I2C_DRIVERID_SAA7114H 64 /* video decoder */
98#define I2C_DRIVERID_DS1374 65 /* DS1374 real time clock */
99#define I2C_DRIVERID_TDA9874 66 /* TV sound decoder */ 66#define I2C_DRIVERID_TDA9874 66 /* TV sound decoder */
100#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */ 67#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */
101#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */ 68#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */
@@ -114,7 +81,6 @@
114#define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */ 81#define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */
115#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */ 82#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */
116#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */ 83#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */
117#define I2C_DRIVERID_RS5C372 84 /* Ricoh RS5C372 RTC */
118#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */ 84#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */
119#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ 85#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
120#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ 86#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
@@ -125,10 +91,10 @@
125#define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */ 91#define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */
126#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */ 92#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */
127#define I2C_DRIVERID_CS4270 94 /* Cirrus Logic 4270 audio codec */ 93#define I2C_DRIVERID_CS4270 94 /* Cirrus Logic 4270 audio codec */
94#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */
95#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */
128 96
129#define I2C_DRIVERID_I2CDEV 900 97#define I2C_DRIVERID_I2CDEV 900
130#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
131#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */
132 98
133/* IDs -- Use DRIVERIDs 1000-1999 for sensors. 99/* IDs -- Use DRIVERIDs 1000-1999 for sensors.
134 These were originally in sensors.h in the lm_sensors package */ 100 These were originally in sensors.h in the lm_sensors package */
@@ -174,24 +140,16 @@
174 140
175/* --- Bit algorithm adapters */ 141/* --- Bit algorithm adapters */
176#define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */ 142#define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */
177#define I2C_HW_B_SER 0x010002 /* Serial line interface */
178#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ 143#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */
179#define I2C_HW_B_WNV 0x010006 /* Winnov Videums */
180#define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */ 144#define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */
181#define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */ 145#define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */
182#define I2C_HW_B_G400 0x010009 /* Matrox G400 */ 146#define I2C_HW_B_G400 0x010009 /* Matrox G400 */
183#define I2C_HW_B_I810 0x01000a /* Intel I810 */ 147#define I2C_HW_B_I810 0x01000a /* Intel I810 */
184#define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */ 148#define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */
185#define I2C_HW_B_PPORT 0x01000c /* Primitive parallel port adapter */
186#define I2C_HW_B_SAVG 0x01000d /* Savage 4 */
187#define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */ 149#define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */
188#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */ 150#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */
189#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */ 151#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */
190#define I2C_HW_B_TSUNA 0x010012 /* DEC Tsunami chipset */
191#define I2C_HW_B_OMAHA 0x010014 /* Omaha I2C interface (ARM) */
192#define I2C_HW_B_GUIDE 0x010015 /* Guide bit-basher */
193#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */ 152#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */
194#define I2C_HW_B_IXP4XX 0x010017 /* GPIO on IXP4XX systems */
195#define I2C_HW_B_S3VIA 0x010018 /* S3Via ProSavage adapter */ 153#define I2C_HW_B_S3VIA 0x010018 /* S3Via ProSavage adapter */
196#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */ 154#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */
197#define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */ 155#define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */
@@ -205,22 +163,11 @@
205#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */ 163#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */
206 164
207/* --- PCF 8584 based algorithms */ 165/* --- PCF 8584 based algorithms */
208#define I2C_HW_P_LP 0x020000 /* Parallel port interface */
209#define I2C_HW_P_ISA 0x020001 /* generic ISA Bus inteface card */
210#define I2C_HW_P_ELEK 0x020002 /* Elektor ISA Bus inteface card */ 166#define I2C_HW_P_ELEK 0x020002 /* Elektor ISA Bus inteface card */
211 167
212/* --- PCA 9564 based algorithms */ 168/* --- PCA 9564 based algorithms */
213#define I2C_HW_A_ISA 0x1a0000 /* generic ISA Bus interface card */ 169#define I2C_HW_A_ISA 0x1a0000 /* generic ISA Bus interface card */
214 170
215/* --- ACPI Embedded controller algorithms */
216#define I2C_HW_ACPI_EC 0x1f0000
217
218/* --- MPC824x PowerPC adapters */
219#define I2C_HW_MPC824X 0x100001 /* Motorola 8240 / 8245 */
220
221/* --- MPC8xx PowerPC adapters */
222#define I2C_HW_MPC8XX_EPON 0x110000 /* Eponymous MPC8xx I2C adapter */
223
224/* --- PowerPC on-chip adapters */ 171/* --- PowerPC on-chip adapters */
225#define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */ 172#define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */
226 173
@@ -229,7 +176,6 @@
229 176
230/* --- SGI adapters */ 177/* --- SGI adapters */
231#define I2C_HW_SGI_VINO 0x160000 178#define I2C_HW_SGI_VINO 0x160000
232#define I2C_HW_SGI_MACE 0x160001
233 179
234/* --- XSCALE on-chip adapters */ 180/* --- XSCALE on-chip adapters */
235#define I2C_HW_IOP3XX 0x140000 181#define I2C_HW_IOP3XX 0x140000
@@ -253,17 +199,10 @@
253#define I2C_HW_SMBUS_W9968CF 0x04000d 199#define I2C_HW_SMBUS_W9968CF 0x04000d
254#define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */ 200#define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */
255#define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */ 201#define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */
256#define I2C_HW_SMBUS_OV519 0x040010 /* OV519 USB 1.1 webcam IC */
257#define I2C_HW_SMBUS_OVFX2 0x040011 /* Cypress/OmniVision FX2 webcam */ 202#define I2C_HW_SMBUS_OVFX2 0x040011 /* Cypress/OmniVision FX2 webcam */
258#define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */ 203#define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */
259#define I2C_HW_SMBUS_ALI1563 0x040013 204#define I2C_HW_SMBUS_ALI1563 0x040013
260 205
261/* --- ISA pseudo-adapter */
262#define I2C_HW_ISA 0x050000
263
264/* --- IPMB adapter */
265#define I2C_HW_IPMB 0x0c0000
266
267/* --- MCP107 adapter */ 206/* --- MCP107 adapter */
268#define I2C_HW_MPC107 0x0d0000 207#define I2C_HW_MPC107 0x0d0000
269 208
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index a100c9f8eb7c..76014f8f3c60 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -140,7 +140,6 @@ struct i2c_driver {
140 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); 140 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg);
141 141
142 struct device_driver driver; 142 struct device_driver driver;
143 struct list_head list;
144}; 143};
145#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 144#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
146 145
@@ -155,12 +154,11 @@ struct i2c_driver {
155 * generic enough to hide second-sourcing and compatible revisions. 154 * generic enough to hide second-sourcing and compatible revisions.
156 * @adapter: manages the bus segment hosting this I2C device 155 * @adapter: manages the bus segment hosting this I2C device
157 * @driver: device's driver, hence pointer to access routines 156 * @driver: device's driver, hence pointer to access routines
158 * @usage_count: counts current number of users of this client
159 * @dev: Driver model device node for the slave. 157 * @dev: Driver model device node for the slave.
160 * @irq: indicates the IRQ generated by this device (if any) 158 * @irq: indicates the IRQ generated by this device (if any)
161 * @driver_name: Identifies new-style driver used with this device; also 159 * @driver_name: Identifies new-style driver used with this device; also
162 * used as the module name for hotplug/coldplug modprobe support. 160 * used as the module name for hotplug/coldplug modprobe support.
163 * @list: list of active/busy clients 161 * @list: list of active/busy clients (DEPRECATED)
164 * @released: used to synchronize client releases & detaches and references 162 * @released: used to synchronize client releases & detaches and references
165 * 163 *
166 * An i2c_client identifies a single device (i.e. chip) connected to an 164 * An i2c_client identifies a single device (i.e. chip) connected to an
@@ -175,16 +173,16 @@ struct i2c_client {
175 char name[I2C_NAME_SIZE]; 173 char name[I2C_NAME_SIZE];
176 struct i2c_adapter *adapter; /* the adapter we sit on */ 174 struct i2c_adapter *adapter; /* the adapter we sit on */
177 struct i2c_driver *driver; /* and our access routines */ 175 struct i2c_driver *driver; /* and our access routines */
178 int usage_count; /* How many accesses currently */
179 /* to the client */
180 struct device dev; /* the device structure */ 176 struct device dev; /* the device structure */
181 int irq; /* irq issued by device (or -1) */ 177 int irq; /* irq issued by device (or -1) */
182 char driver_name[KOBJ_NAME_LEN]; 178 char driver_name[KOBJ_NAME_LEN];
183 struct list_head list; 179 struct list_head list; /* DEPRECATED */
184 struct completion released; 180 struct completion released;
185}; 181};
186#define to_i2c_client(d) container_of(d, struct i2c_client, dev) 182#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
187 183
184extern struct i2c_client *i2c_verify_client(struct device *dev);
185
188static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj) 186static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
189{ 187{
190 struct device * const dev = container_of(kobj, struct device, kobj); 188 struct device * const dev = container_of(kobj, struct device, kobj);
@@ -261,6 +259,12 @@ i2c_new_probed_device(struct i2c_adapter *adap,
261 struct i2c_board_info *info, 259 struct i2c_board_info *info,
262 unsigned short const *addr_list); 260 unsigned short const *addr_list);
263 261
262/* For devices that use several addresses, use i2c_new_dummy() to make
263 * client handles for the extra addresses.
264 */
265extern struct i2c_client *
266i2c_new_dummy(struct i2c_adapter *adap, u16 address, const char *type);
267
264extern void i2c_unregister_device(struct i2c_client *); 268extern void i2c_unregister_device(struct i2c_client *);
265 269
266/* Mainboard arch_initcall() code should register all its I2C devices. 270/* Mainboard arch_initcall() code should register all its I2C devices.
@@ -319,8 +323,7 @@ struct i2c_adapter {
319 struct device dev; /* the adapter device */ 323 struct device dev; /* the adapter device */
320 324
321 int nr; 325 int nr;
322 struct list_head clients; 326 struct list_head clients; /* DEPRECATED */
323 struct list_head list;
324 char name[48]; 327 char name[48];
325 struct completion dev_released; 328 struct completion dev_released;
326}; 329};
@@ -357,10 +360,10 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
357 * command line 360 * command line
358 */ 361 */
359struct i2c_client_address_data { 362struct i2c_client_address_data {
360 unsigned short *normal_i2c; 363 const unsigned short *normal_i2c;
361 unsigned short *probe; 364 const unsigned short *probe;
362 unsigned short *ignore; 365 const unsigned short *ignore;
363 unsigned short **forces; 366 const unsigned short * const *forces;
364}; 367};
365 368
366/* Internal numbers to terminate lists */ 369/* Internal numbers to terminate lists */
@@ -389,11 +392,8 @@ static inline int i2c_add_driver(struct i2c_driver *driver)
389extern int i2c_attach_client(struct i2c_client *); 392extern int i2c_attach_client(struct i2c_client *);
390extern int i2c_detach_client(struct i2c_client *); 393extern int i2c_detach_client(struct i2c_client *);
391 394
392/* Should be used to make sure that client-struct is valid and that it 395extern struct i2c_client *i2c_use_client(struct i2c_client *client);
393 is okay to access the i2c-client. 396extern void i2c_release_client(struct i2c_client *client);
394 returns -ENODEV if client has gone in the meantime */
395extern int i2c_use_client(struct i2c_client *);
396extern int i2c_release_client(struct i2c_client *);
397 397
398/* call the i2c_client->command() of all attached clients with 398/* call the i2c_client->command() of all attached clients with
399 * the given arguments */ 399 * the given arguments */
@@ -405,7 +405,7 @@ extern void i2c_clients_command(struct i2c_adapter *adap,
405 * specific address (unless a 'force' matched); 405 * specific address (unless a 'force' matched);
406 */ 406 */
407extern int i2c_probe(struct i2c_adapter *adapter, 407extern int i2c_probe(struct i2c_adapter *adapter,
408 struct i2c_client_address_data *address_data, 408 const struct i2c_client_address_data *address_data,
409 int (*found_proc) (struct i2c_adapter *, int, int)); 409 int (*found_proc) (struct i2c_adapter *, int, int));
410 410
411extern struct i2c_adapter* i2c_get_adapter(int id); 411extern struct i2c_adapter* i2c_get_adapter(int id);
@@ -598,104 +598,93 @@ I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \
598 "additionally"); \ 598 "additionally"); \
599I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \ 599I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \
600 "scan"); \ 600 "scan"); \
601static struct i2c_client_address_data addr_data = { \ 601const static struct i2c_client_address_data addr_data = { \
602 .normal_i2c = normal_i2c, \ 602 .normal_i2c = normal_i2c, \
603 .probe = probe, \ 603 .probe = probe, \
604 .ignore = ignore, \ 604 .ignore = ignore, \
605 .forces = forces, \ 605 .forces = forces, \
606} 606}
607 607
608#define I2C_CLIENT_FORCE_TEXT \
609 "List of adapter,address pairs to boldly assume to be present"
610
608/* These are the ones you want to use in your own drivers. Pick the one 611/* These are the ones you want to use in your own drivers. Pick the one
609 which matches the number of devices the driver differenciates between. */ 612 which matches the number of devices the driver differenciates between. */
610#define I2C_CLIENT_INSMOD \ 613#define I2C_CLIENT_INSMOD \
611 I2C_CLIENT_MODULE_PARM(force, \ 614I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
612 "List of adapter,address pairs to boldly assume " \ 615static const unsigned short * const forces[] = { force, NULL }; \
613 "to be present"); \
614 static unsigned short *forces[] = { \
615 force, \
616 NULL \
617 }; \
618I2C_CLIENT_INSMOD_COMMON 616I2C_CLIENT_INSMOD_COMMON
619 617
620#define I2C_CLIENT_INSMOD_1(chip1) \ 618#define I2C_CLIENT_INSMOD_1(chip1) \
621enum chips { any_chip, chip1 }; \ 619enum chips { any_chip, chip1 }; \
622I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 620I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
623 "boldly assume to be present"); \
624I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 621I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
625static unsigned short *forces[] = { force, force_##chip1, NULL }; \ 622static const unsigned short * const forces[] = { force, \
623 force_##chip1, NULL }; \
626I2C_CLIENT_INSMOD_COMMON 624I2C_CLIENT_INSMOD_COMMON
627 625
628#define I2C_CLIENT_INSMOD_2(chip1, chip2) \ 626#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
629enum chips { any_chip, chip1, chip2 }; \ 627enum chips { any_chip, chip1, chip2 }; \
630I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 628I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
631 "boldly assume to be present"); \
632I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 629I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
633I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 630I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
634static unsigned short *forces[] = { force, force_##chip1, \ 631static const unsigned short * const forces[] = { force, \
635 force_##chip2, NULL }; \ 632 force_##chip1, force_##chip2, NULL }; \
636I2C_CLIENT_INSMOD_COMMON 633I2C_CLIENT_INSMOD_COMMON
637 634
638#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ 635#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
639enum chips { any_chip, chip1, chip2, chip3 }; \ 636enum chips { any_chip, chip1, chip2, chip3 }; \
640I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 637I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
641 "boldly assume to be present"); \
642I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 638I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
643I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 639I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
644I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 640I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
645static unsigned short *forces[] = { force, force_##chip1, \ 641static const unsigned short * const forces[] = { force, \
646 force_##chip2, force_##chip3, \ 642 force_##chip1, force_##chip2, force_##chip3, NULL }; \
647 NULL }; \
648I2C_CLIENT_INSMOD_COMMON 643I2C_CLIENT_INSMOD_COMMON
649 644
650#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \ 645#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
651enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ 646enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
652I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 647I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
653 "boldly assume to be present"); \
654I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 648I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
655I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 649I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
656I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 650I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
657I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ 651I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
658static unsigned short *forces[] = { force, force_##chip1, \ 652static const unsigned short * const forces[] = { force, \
659 force_##chip2, force_##chip3, \ 653 force_##chip1, force_##chip2, force_##chip3, \
660 force_##chip4, NULL}; \ 654 force_##chip4, NULL}; \
661I2C_CLIENT_INSMOD_COMMON 655I2C_CLIENT_INSMOD_COMMON
662 656
663#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \ 657#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
664enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ 658enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
665I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 659I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
666 "boldly assume to be present"); \
667I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 660I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
668I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 661I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
669I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 662I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
670I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ 663I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
671I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ 664I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
672static unsigned short *forces[] = { force, force_##chip1, \ 665static const unsigned short * const forces[] = { force, \
673 force_##chip2, force_##chip3, \ 666 force_##chip1, force_##chip2, force_##chip3, \
674 force_##chip4, force_##chip5, \ 667 force_##chip4, force_##chip5, NULL }; \
675 NULL }; \
676I2C_CLIENT_INSMOD_COMMON 668I2C_CLIENT_INSMOD_COMMON
677 669
678#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \ 670#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
679enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ 671enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
680I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 672I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
681 "boldly assume to be present"); \
682I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 673I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
683I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 674I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
684I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 675I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
685I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ 676I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
686I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ 677I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
687I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ 678I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
688static unsigned short *forces[] = { force, force_##chip1, \ 679static const unsigned short * const forces[] = { force, \
689 force_##chip2, force_##chip3, \ 680 force_##chip1, force_##chip2, force_##chip3, \
690 force_##chip4, force_##chip5, \ 681 force_##chip4, force_##chip5, force_##chip6, NULL }; \
691 force_##chip6, NULL }; \
692I2C_CLIENT_INSMOD_COMMON 682I2C_CLIENT_INSMOD_COMMON
693 683
694#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \ 684#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
695enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ 685enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
696 chip7 }; \ 686 chip7 }; \
697I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 687I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
698 "boldly assume to be present"); \
699I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 688I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
700I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 689I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
701I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 690I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
@@ -703,18 +692,16 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
703I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ 692I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
704I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ 693I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
705I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ 694I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
706static unsigned short *forces[] = { force, force_##chip1, \ 695static const unsigned short * const forces[] = { force, \
707 force_##chip2, force_##chip3, \ 696 force_##chip1, force_##chip2, force_##chip3, \
708 force_##chip4, force_##chip5, \ 697 force_##chip4, force_##chip5, force_##chip6, \
709 force_##chip6, force_##chip7, \ 698 force_##chip7, NULL }; \
710 NULL }; \
711I2C_CLIENT_INSMOD_COMMON 699I2C_CLIENT_INSMOD_COMMON
712 700
713#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \ 701#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
714enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ 702enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
715 chip7, chip8 }; \ 703 chip7, chip8 }; \
716I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 704I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
717 "boldly assume to be present"); \
718I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 705I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
719I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 706I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
720I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 707I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
@@ -723,11 +710,10 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
723I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ 710I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
724I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ 711I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
725I2C_CLIENT_MODULE_PARM_FORCE(chip8); \ 712I2C_CLIENT_MODULE_PARM_FORCE(chip8); \
726static unsigned short *forces[] = { force, force_##chip1, \ 713static const unsigned short * const forces[] = { force, \
727 force_##chip2, force_##chip3, \ 714 force_##chip1, force_##chip2, force_##chip3, \
728 force_##chip4, force_##chip5, \ 715 force_##chip4, force_##chip5, force_##chip6, \
729 force_##chip6, force_##chip7, \ 716 force_##chip7, force_##chip8, NULL }; \
730 force_##chip8, NULL }; \
731I2C_CLIENT_INSMOD_COMMON 717I2C_CLIENT_INSMOD_COMMON
732#endif /* __KERNEL__ */ 718#endif /* __KERNEL__ */
733#endif /* _LINUX_I2C_H */ 719#endif /* _LINUX_I2C_H */
diff --git a/include/linux/i2c/tps65010.h b/include/linux/i2c/tps65010.h
new file mode 100644
index 000000000000..7021635ed6a0
--- /dev/null
+++ b/include/linux/i2c/tps65010.h
@@ -0,0 +1,156 @@
1/* linux/i2c/tps65010.h
2 *
3 * Functions to access TPS65010 power management device.
4 *
5 * Copyright (C) 2004 Dirk Behme <dirk.behme@de.bosch.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#ifndef __LINUX_I2C_TPS65010_H
29#define __LINUX_I2C_TPS65010_H
30
31/*
32 * ----------------------------------------------------------------------------
33 * Registers, all 8 bits
34 * ----------------------------------------------------------------------------
35 */
36
37#define TPS_CHGSTATUS 0x01
38# define TPS_CHG_USB (1 << 7)
39# define TPS_CHG_AC (1 << 6)
40# define TPS_CHG_THERM (1 << 5)
41# define TPS_CHG_TERM (1 << 4)
42# define TPS_CHG_TAPER_TMO (1 << 3)
43# define TPS_CHG_CHG_TMO (1 << 2)
44# define TPS_CHG_PRECHG_TMO (1 << 1)
45# define TPS_CHG_TEMP_ERR (1 << 0)
46#define TPS_REGSTATUS 0x02
47# define TPS_REG_ONOFF (1 << 7)
48# define TPS_REG_COVER (1 << 6)
49# define TPS_REG_UVLO (1 << 5)
50# define TPS_REG_NO_CHG (1 << 4) /* tps65013 */
51# define TPS_REG_PG_LD02 (1 << 3)
52# define TPS_REG_PG_LD01 (1 << 2)
53# define TPS_REG_PG_MAIN (1 << 1)
54# define TPS_REG_PG_CORE (1 << 0)
55#define TPS_MASK1 0x03
56#define TPS_MASK2 0x04
57#define TPS_ACKINT1 0x05
58#define TPS_ACKINT2 0x06
59#define TPS_CHGCONFIG 0x07
60# define TPS_CHARGE_POR (1 << 7) /* 65010/65012 */
61# define TPS65013_AUA (1 << 7) /* 65011/65013 */
62# define TPS_CHARGE_RESET (1 << 6)
63# define TPS_CHARGE_FAST (1 << 5)
64# define TPS_CHARGE_CURRENT (3 << 3)
65# define TPS_VBUS_500MA (1 << 2)
66# define TPS_VBUS_CHARGING (1 << 1)
67# define TPS_CHARGE_ENABLE (1 << 0)
68#define TPS_LED1_ON 0x08
69#define TPS_LED1_PER 0x09
70#define TPS_LED2_ON 0x0a
71#define TPS_LED2_PER 0x0b
72#define TPS_VDCDC1 0x0c
73# define TPS_ENABLE_LP (1 << 3)
74#define TPS_VDCDC2 0x0d
75#define TPS_VREGS1 0x0e
76# define TPS_LDO2_ENABLE (1 << 7)
77# define TPS_LDO2_OFF (1 << 6)
78# define TPS_VLDO2_3_0V (3 << 4)
79# define TPS_VLDO2_2_75V (2 << 4)
80# define TPS_VLDO2_2_5V (1 << 4)
81# define TPS_VLDO2_1_8V (0 << 4)
82# define TPS_LDO1_ENABLE (1 << 3)
83# define TPS_LDO1_OFF (1 << 2)
84# define TPS_VLDO1_3_0V (3 << 0)
85# define TPS_VLDO1_2_75V (2 << 0)
86# define TPS_VLDO1_2_5V (1 << 0)
87# define TPS_VLDO1_ADJ (0 << 0)
88#define TPS_MASK3 0x0f
89#define TPS_DEFGPIO 0x10
90
91/*
92 * ----------------------------------------------------------------------------
93 * Macros used by exported functions
94 * ----------------------------------------------------------------------------
95 */
96
97#define LED1 1
98#define LED2 2
99#define OFF 0
100#define ON 1
101#define BLINK 2
102#define GPIO1 1
103#define GPIO2 2
104#define GPIO3 3
105#define GPIO4 4
106#define LOW 0
107#define HIGH 1
108
109/*
110 * ----------------------------------------------------------------------------
111 * Exported functions
112 * ----------------------------------------------------------------------------
113 */
114
115/* Draw from VBUS:
116 * 0 mA -- DON'T DRAW (might supply power instead)
117 * 100 mA -- usb unit load (slowest charge rate)
118 * 500 mA -- usb high power (fast battery charge)
119 */
120extern int tps65010_set_vbus_draw(unsigned mA);
121
122/* tps65010_set_gpio_out_value parameter:
123 * gpio: GPIO1, GPIO2, GPIO3 or GPIO4
124 * value: LOW or HIGH
125 */
126extern int tps65010_set_gpio_out_value(unsigned gpio, unsigned value);
127
128/* tps65010_set_led parameter:
129 * led: LED1 or LED2
130 * mode: ON, OFF or BLINK
131 */
132extern int tps65010_set_led(unsigned led, unsigned mode);
133
134/* tps65010_set_vib parameter:
135 * value: ON or OFF
136 */
137extern int tps65010_set_vib(unsigned value);
138
139/* tps65010_set_low_pwr parameter:
140 * mode: ON or OFF
141 */
142extern int tps65010_set_low_pwr(unsigned mode);
143
144/* tps65010_config_vregs1 parameter:
145 * value to be written to VREGS1 register
146 * Note: The complete register is written, set all bits you need
147 */
148extern int tps65010_config_vregs1(unsigned value);
149
150/* tps65013_set_low_pwr parameter:
151 * mode: ON or OFF
152 */
153extern int tps65013_set_low_pwr(unsigned mode);
154
155#endif /* __LINUX_I2C_TPS65010_H */
156
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 9a6a41e7079f..27cb39de2ae2 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -27,25 +27,10 @@
27#include <asm/semaphore.h> 27#include <asm/semaphore.h>
28#include <asm/mutex.h> 28#include <asm/mutex.h>
29 29
30/****************************************************************************** 30#if defined(CRIS) || defined(FRV)
31 * IDE driver configuration options (play with these as desired): 31# define SUPPORT_VLB_SYNC 0
32 * 32#else
33 * REALLY_SLOW_IO can be defined in ide.c and ide-cd.c, if necessary 33# define SUPPORT_VLB_SYNC 1
34 */
35#define INITIAL_MULT_COUNT 0 /* off=0; on=2,4,8,16,32, etc.. */
36
37#ifndef SUPPORT_SLOW_DATA_PORTS /* 1 to support slow data ports */
38#define SUPPORT_SLOW_DATA_PORTS 1 /* 0 to reduce kernel size */
39#endif
40#ifndef SUPPORT_VLB_SYNC /* 1 to support weird 32-bit chips */
41#define SUPPORT_VLB_SYNC 1 /* 0 to reduce kernel size */
42#endif
43#ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */
44#define OK_TO_RESET_CONTROLLER 1 /* 0 for use with AH2372A/B interface */
45#endif
46
47#ifndef DISABLE_IRQ_NOSYNC
48#define DISABLE_IRQ_NOSYNC 0
49#endif 34#endif
50 35
51/* 36/*
@@ -55,10 +40,6 @@
55 40
56#define IDE_NO_IRQ (-1) 41#define IDE_NO_IRQ (-1)
57 42
58/*
59 * "No user-serviceable parts" beyond this point :)
60 *****************************************************************************/
61
62typedef unsigned char byte; /* used everywhere */ 43typedef unsigned char byte; /* used everywhere */
63 44
64/* 45/*
@@ -103,8 +84,6 @@ typedef unsigned char byte; /* used everywhere */
103#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET 84#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET
104#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET 85#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET
105 86
106#define IDE_CONTROL_OFFSET_HOB (7)
107
108#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) 87#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET])
109#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) 88#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET])
110#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) 89#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET])
@@ -128,7 +107,6 @@ typedef unsigned char byte; /* used everywhere */
128#define BAD_W_STAT (BAD_R_STAT | WRERR_STAT) 107#define BAD_W_STAT (BAD_R_STAT | WRERR_STAT)
129#define BAD_STAT (BAD_R_STAT | DRQ_STAT) 108#define BAD_STAT (BAD_R_STAT | DRQ_STAT)
130#define DRIVE_READY (READY_STAT | SEEK_STAT) 109#define DRIVE_READY (READY_STAT | SEEK_STAT)
131#define DATA_READY (DRQ_STAT)
132 110
133#define BAD_CRC (ABRT_ERR | ICRC_ERR) 111#define BAD_CRC (ABRT_ERR | ICRC_ERR)
134 112
@@ -219,8 +197,11 @@ typedef struct hw_regs_s {
219} hw_regs_t; 197} hw_regs_t;
220 198
221struct hwif_s * ide_find_port(unsigned long); 199struct hwif_s * ide_find_port(unsigned long);
200void ide_init_port_data(struct hwif_s *, unsigned int);
201void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
222 202
223int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int, 203struct ide_drive_s;
204int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *),
224 struct hwif_s **); 205 struct hwif_s **);
225 206
226void ide_setup_ports( hw_regs_t *hw, 207void ide_setup_ports( hw_regs_t *hw,
@@ -327,47 +308,16 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw,
327typedef union { 308typedef union {
328 unsigned all : 8; 309 unsigned all : 8;
329 struct { 310 struct {
330#if defined(__LITTLE_ENDIAN_BITFIELD)
331 unsigned set_geometry : 1; 311 unsigned set_geometry : 1;
332 unsigned recalibrate : 1; 312 unsigned recalibrate : 1;
333 unsigned set_multmode : 1; 313 unsigned set_multmode : 1;
334 unsigned set_tune : 1; 314 unsigned set_tune : 1;
335 unsigned serviced : 1; 315 unsigned serviced : 1;
336 unsigned reserved : 3; 316 unsigned reserved : 3;
337#elif defined(__BIG_ENDIAN_BITFIELD)
338 unsigned reserved : 3;
339 unsigned serviced : 1;
340 unsigned set_tune : 1;
341 unsigned set_multmode : 1;
342 unsigned recalibrate : 1;
343 unsigned set_geometry : 1;
344#else
345#error "Please fix <asm/byteorder.h>"
346#endif
347 } b; 317 } b;
348} special_t; 318} special_t;
349 319
350/* 320/*
351 * ATA DATA Register Special.
352 * ATA NSECTOR Count Register().
353 * ATAPI Byte Count Register.
354 */
355typedef union {
356 unsigned all :16;
357 struct {
358#if defined(__LITTLE_ENDIAN_BITFIELD)
359 unsigned low :8; /* LSB */
360 unsigned high :8; /* MSB */
361#elif defined(__BIG_ENDIAN_BITFIELD)
362 unsigned high :8; /* MSB */
363 unsigned low :8; /* LSB */
364#else
365#error "Please fix <asm/byteorder.h>"
366#endif
367 } b;
368} ata_nsector_t, ata_data_t, atapi_bcount_t;
369
370/*
371 * ATA-IDE Select Register, aka Device-Head 321 * ATA-IDE Select Register, aka Device-Head
372 * 322 *
373 * head : always zeros here 323 * head : always zeros here
@@ -398,131 +348,6 @@ typedef union {
398} select_t, ata_select_t; 348} select_t, ata_select_t;
399 349
400/* 350/*
401 * The ATA-IDE Status Register.
402 * The ATAPI Status Register.
403 *
404 * check : Error occurred
405 * idx : Index Error
406 * corr : Correctable error occurred
407 * drq : Data is request by the device
408 * dsc : Disk Seek Complete : ata
409 * : Media access command finished : atapi
410 * df : Device Fault : ata
411 * : Reserved : atapi
412 * drdy : Ready, Command Mode Capable : ata
413 * : Ignored for ATAPI commands : atapi
414 * bsy : Disk is Busy
415 * : The device has access to the command block
416 */
417typedef union {
418 unsigned all :8;
419 struct {
420#if defined(__LITTLE_ENDIAN_BITFIELD)
421 unsigned check :1;
422 unsigned idx :1;
423 unsigned corr :1;
424 unsigned drq :1;
425 unsigned dsc :1;
426 unsigned df :1;
427 unsigned drdy :1;
428 unsigned bsy :1;
429#elif defined(__BIG_ENDIAN_BITFIELD)
430 unsigned bsy :1;
431 unsigned drdy :1;
432 unsigned df :1;
433 unsigned dsc :1;
434 unsigned drq :1;
435 unsigned corr :1;
436 unsigned idx :1;
437 unsigned check :1;
438#else
439#error "Please fix <asm/byteorder.h>"
440#endif
441 } b;
442} ata_status_t, atapi_status_t;
443
444/*
445 * ATAPI Feature Register
446 *
447 * dma : Using DMA or PIO
448 * reserved321 : Reserved
449 * reserved654 : Reserved (Tag Type)
450 * reserved7 : Reserved
451 */
452typedef union {
453 unsigned all :8;
454 struct {
455#if defined(__LITTLE_ENDIAN_BITFIELD)
456 unsigned dma :1;
457 unsigned reserved321 :3;
458 unsigned reserved654 :3;
459 unsigned reserved7 :1;
460#elif defined(__BIG_ENDIAN_BITFIELD)
461 unsigned reserved7 :1;
462 unsigned reserved654 :3;
463 unsigned reserved321 :3;
464 unsigned dma :1;
465#else
466#error "Please fix <asm/byteorder.h>"
467#endif
468 } b;
469} atapi_feature_t;
470
471/*
472 * ATAPI Interrupt Reason Register.
473 *
474 * cod : Information transferred is command (1) or data (0)
475 * io : The device requests us to read (1) or write (0)
476 * reserved : Reserved
477 */
478typedef union {
479 unsigned all :8;
480 struct {
481#if defined(__LITTLE_ENDIAN_BITFIELD)
482 unsigned cod :1;
483 unsigned io :1;
484 unsigned reserved :6;
485#elif defined(__BIG_ENDIAN_BITFIELD)
486 unsigned reserved :6;
487 unsigned io :1;
488 unsigned cod :1;
489#else
490#error "Please fix <asm/byteorder.h>"
491#endif
492 } b;
493} atapi_ireason_t;
494
495/*
496 * The ATAPI error register.
497 *
498 * ili : Illegal Length Indication
499 * eom : End Of Media Detected
500 * abrt : Aborted command - As defined by ATA
501 * mcr : Media Change Requested - As defined by ATA
502 * sense_key : Sense key of the last failed packet command
503 */
504typedef union {
505 unsigned all :8;
506 struct {
507#if defined(__LITTLE_ENDIAN_BITFIELD)
508 unsigned ili :1;
509 unsigned eom :1;
510 unsigned abrt :1;
511 unsigned mcr :1;
512 unsigned sense_key :4;
513#elif defined(__BIG_ENDIAN_BITFIELD)
514 unsigned sense_key :4;
515 unsigned mcr :1;
516 unsigned abrt :1;
517 unsigned eom :1;
518 unsigned ili :1;
519#else
520#error "Please fix <asm/byteorder.h>"
521#endif
522 } b;
523} atapi_error_t;
524
525/*
526 * Status returned from various ide_ functions 351 * Status returned from various ide_ functions
527 */ 352 */
528typedef enum { 353typedef enum {
@@ -568,7 +393,6 @@ typedef struct ide_drive_s {
568 u8 state; /* retry state */ 393 u8 state; /* retry state */
569 u8 waiting_for_dma; /* dma currently in progress */ 394 u8 waiting_for_dma; /* dma currently in progress */
570 u8 unmask; /* okay to unmask other irqs */ 395 u8 unmask; /* okay to unmask other irqs */
571 u8 bswap; /* byte swap data */
572 u8 noflush; /* don't attempt flushes */ 396 u8 noflush; /* don't attempt flushes */
573 u8 dsc_overlap; /* DSC overlap */ 397 u8 dsc_overlap; /* DSC overlap */
574 u8 nice1; /* give potential excess bandwidth */ 398 u8 nice1; /* give potential excess bandwidth */
@@ -701,36 +525,29 @@ typedef struct hwif_s {
701 void (*pre_reset)(ide_drive_t *); 525 void (*pre_reset)(ide_drive_t *);
702 /* routine to reset controller after a disk reset */ 526 /* routine to reset controller after a disk reset */
703 void (*resetproc)(ide_drive_t *); 527 void (*resetproc)(ide_drive_t *);
704 /* special interrupt handling for shared pci interrupts */
705 void (*intrproc)(ide_drive_t *);
706 /* special host masking for drive selection */ 528 /* special host masking for drive selection */
707 void (*maskproc)(ide_drive_t *, int); 529 void (*maskproc)(ide_drive_t *, int);
708 /* check host's drive quirk list */ 530 /* check host's drive quirk list */
709 int (*quirkproc)(ide_drive_t *); 531 void (*quirkproc)(ide_drive_t *);
710 /* driver soft-power interface */ 532 /* driver soft-power interface */
711 int (*busproc)(ide_drive_t *, int); 533 int (*busproc)(ide_drive_t *, int);
712#endif 534#endif
713 u8 (*mdma_filter)(ide_drive_t *); 535 u8 (*mdma_filter)(ide_drive_t *);
714 u8 (*udma_filter)(ide_drive_t *); 536 u8 (*udma_filter)(ide_drive_t *);
715 537
716 void (*fixup)(struct hwif_s *);
717
718 void (*ata_input_data)(ide_drive_t *, void *, u32); 538 void (*ata_input_data)(ide_drive_t *, void *, u32);
719 void (*ata_output_data)(ide_drive_t *, void *, u32); 539 void (*ata_output_data)(ide_drive_t *, void *, u32);
720 540
721 void (*atapi_input_bytes)(ide_drive_t *, void *, u32); 541 void (*atapi_input_bytes)(ide_drive_t *, void *, u32);
722 void (*atapi_output_bytes)(ide_drive_t *, void *, u32); 542 void (*atapi_output_bytes)(ide_drive_t *, void *, u32);
723 543
544 void (*dma_host_set)(ide_drive_t *, int);
724 int (*dma_setup)(ide_drive_t *); 545 int (*dma_setup)(ide_drive_t *);
725 void (*dma_exec_cmd)(ide_drive_t *, u8); 546 void (*dma_exec_cmd)(ide_drive_t *, u8);
726 void (*dma_start)(ide_drive_t *); 547 void (*dma_start)(ide_drive_t *);
727 int (*ide_dma_end)(ide_drive_t *drive); 548 int (*ide_dma_end)(ide_drive_t *drive);
728 int (*ide_dma_on)(ide_drive_t *drive);
729 void (*dma_off_quietly)(ide_drive_t *drive);
730 int (*ide_dma_test_irq)(ide_drive_t *drive); 549 int (*ide_dma_test_irq)(ide_drive_t *drive);
731 void (*ide_dma_clear_irq)(ide_drive_t *drive); 550 void (*ide_dma_clear_irq)(ide_drive_t *drive);
732 void (*dma_host_on)(ide_drive_t *drive);
733 void (*dma_host_off)(ide_drive_t *drive);
734 void (*dma_lost_irq)(ide_drive_t *drive); 551 void (*dma_lost_irq)(ide_drive_t *drive);
735 void (*dma_timeout)(ide_drive_t *drive); 552 void (*dma_timeout)(ide_drive_t *drive);
736 553
@@ -766,7 +583,6 @@ typedef struct hwif_s {
766 int rqsize; /* max sectors per request */ 583 int rqsize; /* max sectors per request */
767 int irq; /* our irq number */ 584 int irq; /* our irq number */
768 585
769 unsigned long dma_master; /* reference base addr dmabase */
770 unsigned long dma_base; /* base addr for dma ports */ 586 unsigned long dma_base; /* base addr for dma ports */
771 unsigned long dma_command; /* dma command register */ 587 unsigned long dma_command; /* dma command register */
772 unsigned long dma_vendor1; /* dma vendor 1 register */ 588 unsigned long dma_vendor1; /* dma vendor 1 register */
@@ -806,7 +622,6 @@ typedef struct hwif_s {
806/* 622/*
807 * internal ide interrupt handler type 623 * internal ide interrupt handler type
808 */ 624 */
809typedef ide_startstop_t (ide_pre_handler_t)(ide_drive_t *, struct request *);
810typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); 625typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
811typedef int (ide_expiry_t)(ide_drive_t *); 626typedef int (ide_expiry_t)(ide_drive_t *);
812 627
@@ -1020,7 +835,8 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
1020 835
1021extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); 836extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry);
1022 837
1023extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *); 838void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
839 ide_expiry_t *);
1024 840
1025ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 841ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
1026 842
@@ -1054,60 +870,126 @@ extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t);
1054 870
1055extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 871extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
1056 872
1057/* 873enum {
1058 * Issue ATA command and wait for completion. 874 IDE_TFLAG_LBA48 = (1 << 0),
1059 * Use for implementing commands in kernel 875 IDE_TFLAG_NO_SELECT_MASK = (1 << 1),
1060 * 876 IDE_TFLAG_FLAGGED = (1 << 2),
1061 * (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) 877 IDE_TFLAG_OUT_DATA = (1 << 3),
1062 */ 878 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4),
1063extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *); 879 IDE_TFLAG_OUT_HOB_NSECT = (1 << 5),
880 IDE_TFLAG_OUT_HOB_LBAL = (1 << 6),
881 IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
882 IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
883 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
884 IDE_TFLAG_OUT_HOB_NSECT |
885 IDE_TFLAG_OUT_HOB_LBAL |
886 IDE_TFLAG_OUT_HOB_LBAM |
887 IDE_TFLAG_OUT_HOB_LBAH,
888 IDE_TFLAG_OUT_FEATURE = (1 << 9),
889 IDE_TFLAG_OUT_NSECT = (1 << 10),
890 IDE_TFLAG_OUT_LBAL = (1 << 11),
891 IDE_TFLAG_OUT_LBAM = (1 << 12),
892 IDE_TFLAG_OUT_LBAH = (1 << 13),
893 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
894 IDE_TFLAG_OUT_NSECT |
895 IDE_TFLAG_OUT_LBAL |
896 IDE_TFLAG_OUT_LBAM |
897 IDE_TFLAG_OUT_LBAH,
898 IDE_TFLAG_OUT_DEVICE = (1 << 14),
899 IDE_TFLAG_WRITE = (1 << 15),
900 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16),
901 IDE_TFLAG_IN_DATA = (1 << 17),
902 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18),
903 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19),
904 IDE_TFLAG_IN_HOB_FEATURE = (1 << 20),
905 IDE_TFLAG_IN_HOB_NSECT = (1 << 21),
906 IDE_TFLAG_IN_HOB_LBAL = (1 << 22),
907 IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
908 IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
909 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
910 IDE_TFLAG_IN_HOB_LBAM |
911 IDE_TFLAG_IN_HOB_LBAH,
912 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
913 IDE_TFLAG_IN_HOB_NSECT |
914 IDE_TFLAG_IN_HOB_LBA,
915 IDE_TFLAG_IN_NSECT = (1 << 25),
916 IDE_TFLAG_IN_LBAL = (1 << 26),
917 IDE_TFLAG_IN_LBAM = (1 << 27),
918 IDE_TFLAG_IN_LBAH = (1 << 28),
919 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
920 IDE_TFLAG_IN_LBAM |
921 IDE_TFLAG_IN_LBAH,
922 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
923 IDE_TFLAG_IN_LBA,
924 IDE_TFLAG_IN_DEVICE = (1 << 29),
925 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
926 IDE_TFLAG_IN_HOB,
927 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
928 IDE_TFLAG_IN_TF,
929 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
930 IDE_TFLAG_IN_DEVICE,
931 /* force 16-bit I/O operations */
932 IDE_TFLAG_IO_16BIT = (1 << 30),
933};
934
935struct ide_taskfile {
936 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */
937
938 u8 hob_feature; /* 1-5: additional data to support LBA48 */
939 u8 hob_nsect;
940 u8 hob_lbal;
941 u8 hob_lbam;
942 u8 hob_lbah;
943
944 u8 data; /* 6: low data byte (for TASKFILE IOCTL) */
945
946 union { /*  7: */
947 u8 error; /* read: error */
948 u8 feature; /* write: feature */
949 };
950
951 u8 nsect; /* 8: number of sectors */
952 u8 lbal; /* 9: LBA low */
953 u8 lbam; /* 10: LBA mid */
954 u8 lbah; /* 11: LBA high */
955
956 u8 device; /* 12: device select */
957
958 union { /* 13: */
959 u8 status; /*  read: status  */
960 u8 command; /* write: command */
961 };
962};
1064 963
1065typedef struct ide_task_s { 964typedef struct ide_task_s {
1066/* 965 union {
1067 * struct hd_drive_task_hdr tf; 966 struct ide_taskfile tf;
1068 * task_struct_t tf; 967 u8 tf_array[14];
1069 * struct hd_drive_hob_hdr hobf; 968 };
1070 * hob_struct_t hobf; 969 u32 tf_flags;
1071 */
1072 task_ioreg_t tfRegister[8];
1073 task_ioreg_t hobRegister[8];
1074 ide_reg_valid_t tf_out_flags;
1075 ide_reg_valid_t tf_in_flags;
1076 int data_phase; 970 int data_phase;
1077 int command_type;
1078 ide_pre_handler_t *prehandler;
1079 ide_handler_t *handler;
1080 struct request *rq; /* copy of request */ 971 struct request *rq; /* copy of request */
1081 void *special; /* valid_t generally */ 972 void *special; /* valid_t generally */
1082} ide_task_t; 973} ide_task_t;
1083 974
1084extern u32 ide_read_24(ide_drive_t *); 975void ide_tf_load(ide_drive_t *, ide_task_t *);
976void ide_tf_read(ide_drive_t *, ide_task_t *);
1085 977
1086extern void SELECT_DRIVE(ide_drive_t *); 978extern void SELECT_DRIVE(ide_drive_t *);
1087extern void SELECT_INTERRUPT(ide_drive_t *);
1088extern void SELECT_MASK(ide_drive_t *, int); 979extern void SELECT_MASK(ide_drive_t *, int);
1089extern void QUIRK_LIST(ide_drive_t *);
1090 980
1091extern int drive_is_ready(ide_drive_t *); 981extern int drive_is_ready(ide_drive_t *);
1092 982
1093/* 983void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
1094 * taskfile io for disks for now...and builds request from ide_ioctl
1095 */
1096extern ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
1097 984
1098/* 985ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
1099 * Special Flagged Register Validation Caller 986
1100 */ 987void task_end_request(ide_drive_t *, struct request *, u8);
1101extern ide_startstop_t flagged_taskfile(ide_drive_t *, ide_task_t *);
1102 988
1103extern ide_startstop_t set_multmode_intr(ide_drive_t *); 989u8 wait_drive_not_busy(ide_drive_t *);
1104extern ide_startstop_t set_geometry_intr(ide_drive_t *);
1105extern ide_startstop_t recal_intr(ide_drive_t *);
1106extern ide_startstop_t task_no_data_intr(ide_drive_t *);
1107extern ide_startstop_t task_in_intr(ide_drive_t *);
1108extern ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *);
1109 990
1110extern int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *); 991int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16);
992int ide_no_data_taskfile(ide_drive_t *, ide_task_t *);
1111 993
1112int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); 994int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
1113int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); 995int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long);
@@ -1133,10 +1015,9 @@ extern void do_ide_request(struct request_queue *);
1133 1015
1134void ide_init_disk(struct gendisk *, ide_drive_t *); 1016void ide_init_disk(struct gendisk *, ide_drive_t *);
1135 1017
1136extern int ideprobe_init(void);
1137
1138#ifdef CONFIG_IDEPCI_PCIBUS_ORDER 1018#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
1139extern void ide_scan_pcibus(int scan_direction) __init; 1019extern int ide_scan_direction;
1020int __init ide_scan_pcibus(void);
1140extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); 1021extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
1141#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) 1022#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
1142#else 1023#else
@@ -1212,6 +1093,9 @@ enum {
1212 IDE_HFLAG_IO_32BIT = (1 << 24), 1093 IDE_HFLAG_IO_32BIT = (1 << 24),
1213 /* unmask IRQs */ 1094 /* unmask IRQs */
1214 IDE_HFLAG_UNMASK_IRQS = (1 << 25), 1095 IDE_HFLAG_UNMASK_IRQS = (1 << 25),
1096 IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26),
1097 /* host is CY82C693 */
1098 IDE_HFLAG_CY82C693 = (1 << 27),
1215}; 1099};
1216 1100
1217#ifdef CONFIG_BLK_DEV_OFFBOARD 1101#ifdef CONFIG_BLK_DEV_OFFBOARD
@@ -1226,10 +1110,9 @@ struct ide_port_info {
1226 void (*init_iops)(ide_hwif_t *); 1110 void (*init_iops)(ide_hwif_t *);
1227 void (*init_hwif)(ide_hwif_t *); 1111 void (*init_hwif)(ide_hwif_t *);
1228 void (*init_dma)(ide_hwif_t *, unsigned long); 1112 void (*init_dma)(ide_hwif_t *, unsigned long);
1229 void (*fixup)(ide_hwif_t *);
1230 ide_pci_enablebit_t enablebits[2]; 1113 ide_pci_enablebit_t enablebits[2];
1231 hwif_chipset_t chipset; 1114 hwif_chipset_t chipset;
1232 unsigned int extra; 1115 u8 extra;
1233 u32 host_flags; 1116 u32 host_flags;
1234 u8 pio_mask; 1117 u8 pio_mask;
1235 u8 swdma_mask; 1118 u8 swdma_mask;
@@ -1264,7 +1147,9 @@ static inline u8 ide_max_dma_mode(ide_drive_t *drive)
1264 return ide_find_dma_mode(drive, XFER_UDMA_6); 1147 return ide_find_dma_mode(drive, XFER_UDMA_6);
1265} 1148}
1266 1149
1150void ide_dma_off_quietly(ide_drive_t *);
1267void ide_dma_off(ide_drive_t *); 1151void ide_dma_off(ide_drive_t *);
1152void ide_dma_on(ide_drive_t *);
1268int ide_set_dma(ide_drive_t *); 1153int ide_set_dma(ide_drive_t *);
1269ide_startstop_t ide_dma_intr(ide_drive_t *); 1154ide_startstop_t ide_dma_intr(ide_drive_t *);
1270 1155
@@ -1275,10 +1160,7 @@ extern void ide_destroy_dmatable(ide_drive_t *);
1275extern int ide_release_dma(ide_hwif_t *); 1160extern int ide_release_dma(ide_hwif_t *);
1276extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int); 1161extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int);
1277 1162
1278void ide_dma_host_off(ide_drive_t *); 1163void ide_dma_host_set(ide_drive_t *, int);
1279void ide_dma_off_quietly(ide_drive_t *);
1280void ide_dma_host_on(ide_drive_t *);
1281extern int __ide_dma_on(ide_drive_t *);
1282extern int ide_dma_setup(ide_drive_t *); 1164extern int ide_dma_setup(ide_drive_t *);
1283extern void ide_dma_start(ide_drive_t *); 1165extern void ide_dma_start(ide_drive_t *);
1284extern int __ide_dma_end(ide_drive_t *); 1166extern int __ide_dma_end(ide_drive_t *);
@@ -1290,7 +1172,9 @@ extern void ide_dma_timeout(ide_drive_t *);
1290static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } 1172static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
1291static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } 1173static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
1292static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } 1174static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
1175static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; }
1293static inline void ide_dma_off(ide_drive_t *drive) { ; } 1176static inline void ide_dma_off(ide_drive_t *drive) { ; }
1177static inline void ide_dma_on(ide_drive_t *drive) { ; }
1294static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1178static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1295static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1179static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1296#endif /* CONFIG_BLK_DEV_IDEDMA */ 1180#endif /* CONFIG_BLK_DEV_IDEDMA */
@@ -1320,8 +1204,9 @@ extern void ide_unregister (unsigned int index);
1320void ide_register_region(struct gendisk *); 1204void ide_register_region(struct gendisk *);
1321void ide_unregister_region(struct gendisk *); 1205void ide_unregister_region(struct gendisk *);
1322 1206
1323void ide_undecoded_slave(ide_hwif_t *); 1207void ide_undecoded_slave(ide_drive_t *);
1324 1208
1209int ide_device_add_all(u8 *idx);
1325int ide_device_add(u8 idx[4]); 1210int ide_device_add(u8 idx[4]);
1326 1211
1327static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1212static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
@@ -1356,6 +1241,7 @@ static inline int ide_dev_is_sata(struct hd_driveid *id)
1356 return 0; 1241 return 0;
1357} 1242}
1358 1243
1244u64 ide_get_lba_addr(struct ide_taskfile *, int);
1359u8 ide_dump_status(ide_drive_t *, const char *, u8); 1245u8 ide_dump_status(ide_drive_t *, const char *, u8);
1360 1246
1361typedef struct ide_pio_timings_s { 1247typedef struct ide_pio_timings_s {
@@ -1418,4 +1304,9 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
1418 return &hwif->drives[(drive->dn ^ 1) & 1]; 1304 return &hwif->drives[(drive->dn ^ 1) & 1];
1419} 1305}
1420 1306
1307static inline void ide_set_irq(ide_drive_t *drive, int on)
1308{
1309 drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG);
1310}
1311
1421#endif /* _IDE_H */ 1312#endif /* _IDE_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 30621c27159f..5de6d911cdf7 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -54,6 +54,8 @@
54#define IEEE80211_STYPE_ACTION 0x00D0 54#define IEEE80211_STYPE_ACTION 0x00D0
55 55
56/* control */ 56/* control */
57#define IEEE80211_STYPE_BACK_REQ 0x0080
58#define IEEE80211_STYPE_BACK 0x0090
57#define IEEE80211_STYPE_PSPOLL 0x00A0 59#define IEEE80211_STYPE_PSPOLL 0x00A0
58#define IEEE80211_STYPE_RTS 0x00B0 60#define IEEE80211_STYPE_RTS 0x00B0
59#define IEEE80211_STYPE_CTS 0x00C0 61#define IEEE80211_STYPE_CTS 0x00C0
@@ -81,18 +83,18 @@
81 83
82 84
83/* miscellaneous IEEE 802.11 constants */ 85/* miscellaneous IEEE 802.11 constants */
84#define IEEE80211_MAX_FRAG_THRESHOLD 2346 86#define IEEE80211_MAX_FRAG_THRESHOLD 2352
85#define IEEE80211_MAX_RTS_THRESHOLD 2347 87#define IEEE80211_MAX_RTS_THRESHOLD 2353
86#define IEEE80211_MAX_AID 2007 88#define IEEE80211_MAX_AID 2007
87#define IEEE80211_MAX_TIM_LEN 251 89#define IEEE80211_MAX_TIM_LEN 251
88#define IEEE80211_MAX_DATA_LEN 2304
89/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 90/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
90 6.2.1.1.2. 91 6.2.1.1.2.
91 92
92 The figure in section 7.1.2 suggests a body size of up to 2312 93 802.11e clarifies the figure in section 7.1.2. The frame body is
93 bytes is allowed, which is a bit confusing, I suspect this 94 up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
94 represents the 2304 bytes of real data, plus a possible 8 bytes of 95#define IEEE80211_MAX_DATA_LEN 2304
95 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ 96/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
97#define IEEE80211_MAX_FRAME_LEN 2352
96 98
97#define IEEE80211_MAX_SSID_LEN 32 99#define IEEE80211_MAX_SSID_LEN 32
98 100
@@ -185,6 +187,25 @@ struct ieee80211_mgmt {
185 u8 new_chan; 187 u8 new_chan;
186 u8 switch_count; 188 u8 switch_count;
187 } __attribute__((packed)) chan_switch; 189 } __attribute__((packed)) chan_switch;
190 struct{
191 u8 action_code;
192 u8 dialog_token;
193 __le16 capab;
194 __le16 timeout;
195 __le16 start_seq_num;
196 } __attribute__((packed)) addba_req;
197 struct{
198 u8 action_code;
199 u8 dialog_token;
200 __le16 status;
201 __le16 capab;
202 __le16 timeout;
203 } __attribute__((packed)) addba_resp;
204 struct{
205 u8 action_code;
206 __le16 params;
207 __le16 reason_code;
208 } __attribute__((packed)) delba;
188 } u; 209 } u;
189 } __attribute__ ((packed)) action; 210 } __attribute__ ((packed)) action;
190 } u; 211 } u;
@@ -205,6 +226,66 @@ struct ieee80211_cts {
205 u8 ra[6]; 226 u8 ra[6];
206} __attribute__ ((packed)); 227} __attribute__ ((packed));
207 228
229/**
230 * struct ieee80211_bar - HT Block Ack Request
231 *
232 * This structure refers to "HT BlockAckReq" as
233 * described in 802.11n draft section 7.2.1.7.1
234 */
235struct ieee80211_bar {
236 __le16 frame_control;
237 __le16 duration;
238 __u8 ra[6];
239 __u8 ta[6];
240 __le16 control;
241 __le16 start_seq_num;
242} __attribute__((packed));
243
244/**
245 * struct ieee80211_ht_cap - HT capabilities
246 *
247 * This structure refers to "HT capabilities element" as
248 * described in 802.11n draft section 7.3.2.52
249 */
250struct ieee80211_ht_cap {
251 __le16 cap_info;
252 u8 ampdu_params_info;
253 u8 supp_mcs_set[16];
254 __le16 extended_ht_cap_info;
255 __le32 tx_BF_cap_info;
256 u8 antenna_selection_info;
257} __attribute__ ((packed));
258
259/**
260 * struct ieee80211_ht_cap - HT additional information
261 *
262 * This structure refers to "HT information element" as
263 * described in 802.11n draft section 7.3.2.53
264 */
265struct ieee80211_ht_addt_info {
266 u8 control_chan;
267 u8 ht_param;
268 __le16 operation_mode;
269 __le16 stbc_param;
270 u8 basic_set[16];
271} __attribute__ ((packed));
272
273/* 802.11n HT capabilities masks */
274#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
275#define IEEE80211_HT_CAP_MIMO_PS 0x000C
276#define IEEE80211_HT_CAP_GRN_FLD 0x0010
277#define IEEE80211_HT_CAP_SGI_20 0x0020
278#define IEEE80211_HT_CAP_SGI_40 0x0040
279#define IEEE80211_HT_CAP_DELAY_BA 0x0400
280#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
281#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
282#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
283/* 802.11n HT IE masks */
284#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
285#define IEEE80211_HT_IE_CHA_WIDTH 0x04
286#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
287#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
288#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
208 289
209/* Authentication algorithms */ 290/* Authentication algorithms */
210#define WLAN_AUTH_OPEN 0 291#define WLAN_AUTH_OPEN 0
@@ -271,6 +352,18 @@ enum ieee80211_statuscode {
271 WLAN_STATUS_UNSUPP_RSN_VERSION = 44, 352 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
272 WLAN_STATUS_INVALID_RSN_IE_CAP = 45, 353 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
273 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, 354 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
355 /* 802.11e */
356 WLAN_STATUS_UNSPECIFIED_QOS = 32,
357 WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33,
358 WLAN_STATUS_ASSOC_DENIED_LOWACK = 34,
359 WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35,
360 WLAN_STATUS_REQUEST_DECLINED = 37,
361 WLAN_STATUS_INVALID_QOS_PARAM = 38,
362 WLAN_STATUS_CHANGE_TSPEC = 39,
363 WLAN_STATUS_WAIT_TS_DELAY = 47,
364 WLAN_STATUS_NO_DIRECT_LINK = 48,
365 WLAN_STATUS_STA_NOT_PRESENT = 49,
366 WLAN_STATUS_STA_NOT_QSTA = 50,
274}; 367};
275 368
276 369
@@ -301,6 +394,16 @@ enum ieee80211_reasoncode {
301 WLAN_REASON_INVALID_RSN_IE_CAP = 22, 394 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
302 WLAN_REASON_IEEE8021X_FAILED = 23, 395 WLAN_REASON_IEEE8021X_FAILED = 23,
303 WLAN_REASON_CIPHER_SUITE_REJECTED = 24, 396 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
397 /* 802.11e */
398 WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
399 WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
400 WLAN_REASON_DISASSOC_LOW_ACK = 34,
401 WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35,
402 WLAN_REASON_QSTA_LEAVE_QBSS = 36,
403 WLAN_REASON_QSTA_NOT_USE = 37,
404 WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
405 WLAN_REASON_QSTA_TIMEOUT = 39,
406 WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
304}; 407};
305 408
306 409
@@ -319,6 +422,15 @@ enum ieee80211_eid {
319 WLAN_EID_HP_PARAMS = 8, 422 WLAN_EID_HP_PARAMS = 8,
320 WLAN_EID_HP_TABLE = 9, 423 WLAN_EID_HP_TABLE = 9,
321 WLAN_EID_REQUEST = 10, 424 WLAN_EID_REQUEST = 10,
425 /* 802.11e */
426 WLAN_EID_QBSS_LOAD = 11,
427 WLAN_EID_EDCA_PARAM_SET = 12,
428 WLAN_EID_TSPEC = 13,
429 WLAN_EID_TCLAS = 14,
430 WLAN_EID_SCHEDULE = 15,
431 WLAN_EID_TS_DELAY = 43,
432 WLAN_EID_TCLAS_PROCESSING = 44,
433 WLAN_EID_QOS_CAPA = 46,
322 /* 802.11h */ 434 /* 802.11h */
323 WLAN_EID_PWR_CONSTRAINT = 32, 435 WLAN_EID_PWR_CONSTRAINT = 32,
324 WLAN_EID_PWR_CAPABILITY = 33, 436 WLAN_EID_PWR_CAPABILITY = 33,
@@ -333,6 +445,9 @@ enum ieee80211_eid {
333 /* 802.11g */ 445 /* 802.11g */
334 WLAN_EID_ERP_INFO = 42, 446 WLAN_EID_ERP_INFO = 42,
335 WLAN_EID_EXT_SUPP_RATES = 50, 447 WLAN_EID_EXT_SUPP_RATES = 50,
448 /* 802.11n */
449 WLAN_EID_HT_CAPABILITY = 45,
450 WLAN_EID_HT_EXTRA_INFO = 61,
336 /* 802.11i */ 451 /* 802.11i */
337 WLAN_EID_RSN = 48, 452 WLAN_EID_RSN = 48,
338 WLAN_EID_WPA = 221, 453 WLAN_EID_WPA = 221,
@@ -341,6 +456,32 @@ enum ieee80211_eid {
341 WLAN_EID_QOS_PARAMETER = 222 456 WLAN_EID_QOS_PARAMETER = 222
342}; 457};
343 458
459/* Action category code */
460enum ieee80211_category {
461 WLAN_CATEGORY_SPECTRUM_MGMT = 0,
462 WLAN_CATEGORY_QOS = 1,
463 WLAN_CATEGORY_DLS = 2,
464 WLAN_CATEGORY_BACK = 3,
465 WLAN_CATEGORY_WMM = 17,
466};
467
468/* BACK action code */
469enum ieee80211_back_actioncode {
470 WLAN_ACTION_ADDBA_REQ = 0,
471 WLAN_ACTION_ADDBA_RESP = 1,
472 WLAN_ACTION_DELBA = 2,
473};
474
475/* BACK (block-ack) parties */
476enum ieee80211_back_parties {
477 WLAN_BACK_RECIPIENT = 0,
478 WLAN_BACK_INITIATOR = 1,
479 WLAN_BACK_TIMER = 2,
480};
481
482/* A-MSDU 802.11n */
483#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
484
344/* cipher suite selectors */ 485/* cipher suite selectors */
345#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00 486#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
346#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01 487#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
diff --git a/include/linux/if.h b/include/linux/if.h
index 32bf419351f1..5c9d1fa93fef 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -50,7 +50,9 @@
50#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ 50#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */
51#define IFF_DORMANT 0x20000 /* driver signals dormant */ 51#define IFF_DORMANT 0x20000 /* driver signals dormant */
52 52
53#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|\ 53#define IFF_ECHO 0x40000 /* echo sent packets */
54
55#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
54 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) 56 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
55 57
56/* Private (from user) interface flags (netdevice->priv_flags). */ 58/* Private (from user) interface flags (netdevice->priv_flags). */
@@ -61,6 +63,7 @@
61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ 63#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
62#define IFF_BONDING 0x20 /* bonding master or slave */ 64#define IFF_BONDING 0x20 /* bonding master or slave */
63#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ 65#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
66#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
64 67
65#define IF_GET_IFACE 0x0001 /* for querying only */ 68#define IF_GET_IFACE 0x0001 /* for querying only */
66#define IF_GET_PROTO 0x0002 69#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_addrlabel.h b/include/linux/if_addrlabel.h
new file mode 100644
index 000000000000..9fe79c95dd28
--- /dev/null
+++ b/include/linux/if_addrlabel.h
@@ -0,0 +1,32 @@
1/*
2 * if_addrlabel.h - netlink interface for address labels
3 *
4 * Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved.
5 *
6 * Authors:
7 * YOSHIFUJI Hideaki @ USAGI/WIDE <yoshfuji@linux-ipv6.org>
8 */
9
10#ifndef __LINUX_IF_ADDRLABEL_H
11#define __LINUX_IF_ADDRLABEL_H
12
13struct ifaddrlblmsg
14{
15 __u8 ifal_family; /* Address family */
16 __u8 __ifal_reserved; /* Reserved */
17 __u8 ifal_prefixlen; /* Prefix length */
18 __u8 ifal_flags; /* Flags */
19 __u32 ifal_index; /* Link index */
20 __u32 ifal_seq; /* sequence number */
21};
22
23enum
24{
25 IFAL_ADDRESS = 1,
26 IFAL_LABEL = 2,
27 __IFAL_MAX
28};
29
30#define IFAL_MAX (__IFAL_MAX - 1)
31
32#endif
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index ed7b93c3083a..296e8e86e91d 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -52,6 +52,7 @@
52#define ARPHRD_ROSE 270 52#define ARPHRD_ROSE 270
53#define ARPHRD_X25 271 /* CCITT X.25 */ 53#define ARPHRD_X25 271 /* CCITT X.25 */
54#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */ 54#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */
55#define ARPHRD_CAN 280 /* Controller Area Network */
55#define ARPHRD_PPP 512 56#define ARPHRD_PPP 512
56#define ARPHRD_CISCO 513 /* Cisco HDLC */ 57#define ARPHRD_CISCO 513 /* Cisco HDLC */
57#define ARPHRD_HDLC ARPHRD_CISCO 58#define ARPHRD_HDLC ARPHRD_CISCO
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 5f9297793661..e157c1399b61 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -90,6 +90,7 @@
90#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ 90#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/
91#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ 91#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */
92#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ 92#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */
93#define ETH_P_CAN 0x000C /* Controller Area Network */
93#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ 94#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/
94#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ 95#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */
95#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ 96#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */
@@ -123,12 +124,15 @@ int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
123extern struct ctl_table ether_table[]; 124extern struct ctl_table ether_table[];
124#endif 125#endif
125 126
127extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
128
126/* 129/*
127 * Display a 6 byte device address (MAC) in a readable format. 130 * Display a 6 byte device address (MAC) in a readable format.
128 */ 131 */
132extern char *print_mac(char *buf, const unsigned char *addr);
129#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" 133#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
130extern char *print_mac(char *buf, const u8 *addr); 134#define MAC_BUF_SIZE 18
131#define DECLARE_MAC_BUF(var) char var[18] __maybe_unused 135#define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused
132 136
133#endif 137#endif
134 138
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index f272a80caa3e..5c34240de746 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -137,7 +137,7 @@ struct frhdr
137 137
138 unsigned char NLPID; 138 unsigned char NLPID;
139 unsigned char OUI[3]; 139 unsigned char OUI[3];
140 unsigned short PID; 140 __be16 PID;
141 141
142#define IP_NLPID pad 142#define IP_NLPID pad
143} __attribute__((packed)); 143} __attribute__((packed));
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h
deleted file mode 100644
index 3b1b7ba19825..000000000000
--- a/include/linux/if_shaper.h
+++ /dev/null
@@ -1,51 +0,0 @@
1#ifndef __LINUX_SHAPER_H
2#define __LINUX_SHAPER_H
3
4#ifdef __KERNEL__
5
6#define SHAPER_QLEN 10
7/*
8 * This is a bit speed dependent (read it shouldn't be a constant!)
9 *
10 * 5 is about right for 28.8 upwards. Below that double for every
11 * halving of speed or so. - ie about 20 for 9600 baud.
12 */
13#define SHAPER_LATENCY (5*HZ)
14#define SHAPER_MAXSLIP 2
15#define SHAPER_BURST (HZ/50) /* Good for >128K then */
16
17struct shaper
18{
19 struct sk_buff_head sendq;
20 __u32 bytespertick;
21 __u32 bitspersec;
22 __u32 shapelatency;
23 __u32 shapeclock;
24 unsigned long recovery; /* Time we can next clock a packet out on
25 an empty queue */
26 spinlock_t lock;
27 struct net_device *dev;
28 struct net_device_stats* (*get_stats)(struct net_device *dev);
29 struct timer_list timer;
30};
31
32#endif
33
34#define SHAPER_SET_DEV 0x0001
35#define SHAPER_SET_SPEED 0x0002
36#define SHAPER_GET_DEV 0x0003
37#define SHAPER_GET_SPEED 0x0004
38
39struct shaperconf
40{
41 __u16 ss_cmd;
42 union
43 {
44 char ssu_name[14];
45 __u32 ssu_speed;
46 } ss_u;
47#define ss_speed ss_u.ssu_speed
48#define ss_name ss_u.ssu_name
49};
50
51#endif
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h
index 046e9d95ba9a..5bcec8b2c5e2 100644
--- a/include/linux/if_tr.h
+++ b/include/linux/if_tr.h
@@ -49,9 +49,6 @@ static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
49{ 49{
50 return (struct trh_hdr *)skb_mac_header(skb); 50 return (struct trh_hdr *)skb_mac_header(skb);
51} 51}
52#ifdef CONFIG_SYSCTL
53extern struct ctl_table tr_table[];
54#endif
55#endif 52#endif
56 53
57/* This is an Token-Ring LLC structure */ 54/* This is an Token-Ring LLC structure */
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 33e489d5bb33..72f1c5f47be3 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -21,6 +21,8 @@
21/* Uncomment to enable debugging */ 21/* Uncomment to enable debugging */
22/* #define TUN_DEBUG 1 */ 22/* #define TUN_DEBUG 1 */
23 23
24#include <linux/types.h>
25
24#ifdef __KERNEL__ 26#ifdef __KERNEL__
25 27
26#ifdef TUN_DEBUG 28#ifdef TUN_DEBUG
@@ -88,7 +90,7 @@ struct tun_struct {
88 90
89struct tun_pi { 91struct tun_pi {
90 unsigned short flags; 92 unsigned short flags;
91 unsigned short proto; 93 __be16 proto;
92}; 94};
93#define TUN_PKT_STRIP 0x0001 95#define TUN_PKT_STRIP 0x0001
94 96
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 660b5010c2d9..228eb4eb3129 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -17,6 +17,9 @@
17#define GRE_FLAGS __constant_htons(0x00F8) 17#define GRE_FLAGS __constant_htons(0x00F8)
18#define GRE_VERSION __constant_htons(0x0007) 18#define GRE_VERSION __constant_htons(0x0007)
19 19
20/* i_flags values for SIT mode */
21#define SIT_ISATAP 0x0001
22
20struct ip_tunnel_parm 23struct ip_tunnel_parm
21{ 24{
22 char name[IFNAMSIZ]; 25 char name[IFNAMSIZ];
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 976d4b1067d1..34f40efc7607 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -16,11 +16,6 @@
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18/* externally defined structs */ 18/* externally defined structs */
19struct vlan_group;
20struct net_device;
21struct packet_type;
22struct vlan_collection;
23struct vlan_dev_info;
24struct hlist_node; 19struct hlist_node;
25 20
26#include <linux/netdevice.h> 21#include <linux/netdevice.h>
@@ -39,12 +34,30 @@ struct hlist_node;
39#define VLAN_ETH_DATA_LEN 1500 /* Max. octets in payload */ 34#define VLAN_ETH_DATA_LEN 1500 /* Max. octets in payload */
40#define VLAN_ETH_FRAME_LEN 1518 /* Max. octets in frame sans FCS */ 35#define VLAN_ETH_FRAME_LEN 1518 /* Max. octets in frame sans FCS */
41 36
37/*
38 * struct vlan_hdr - vlan header
39 * @h_vlan_TCI: priority and VLAN ID
40 * @h_vlan_encapsulated_proto: packet type ID or len
41 */
42struct vlan_hdr {
43 __be16 h_vlan_TCI;
44 __be16 h_vlan_encapsulated_proto;
45};
46
47/**
48 * struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr)
49 * @h_dest: destination ethernet address
50 * @h_source: source ethernet address
51 * @h_vlan_proto: ethernet protocol (always 0x8100)
52 * @h_vlan_TCI: priority and VLAN ID
53 * @h_vlan_encapsulated_proto: packet type ID or len
54 */
42struct vlan_ethhdr { 55struct vlan_ethhdr {
43 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ 56 unsigned char h_dest[ETH_ALEN];
44 unsigned char h_source[ETH_ALEN]; /* source ether addr */ 57 unsigned char h_source[ETH_ALEN];
45 __be16 h_vlan_proto; /* Should always be 0x8100 */ 58 __be16 h_vlan_proto;
46 __be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */ 59 __be16 h_vlan_TCI;
47 __be16 h_vlan_encapsulated_proto; /* packet type ID field (or len) */ 60 __be16 h_vlan_encapsulated_proto;
48}; 61};
49 62
50#include <linux/skbuff.h> 63#include <linux/skbuff.h>
@@ -54,18 +67,11 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
54 return (struct vlan_ethhdr *)skb_mac_header(skb); 67 return (struct vlan_ethhdr *)skb_mac_header(skb);
55} 68}
56 69
57struct vlan_hdr {
58 __be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */
59 __be16 h_vlan_encapsulated_proto; /* packet type ID field (or len) */
60};
61
62#define VLAN_VID_MASK 0xfff 70#define VLAN_VID_MASK 0xfff
63 71
64/* found in socket.c */ 72/* found in socket.c */
65extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); 73extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
66 74
67#define VLAN_NAME "vlan"
68
69/* if this changes, algorithm will have to be reworked because this 75/* if this changes, algorithm will have to be reworked because this
70 * depends on completely exhausting the VLAN identifier space. Thus 76 * depends on completely exhausting the VLAN identifier space. Thus
71 * it gives constant time look-up, but in many cases it wastes memory. 77 * it gives constant time look-up, but in many cases it wastes memory.
@@ -76,19 +82,22 @@ extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
76 82
77struct vlan_group { 83struct vlan_group {
78 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ 84 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */
85 unsigned int nr_vlans;
79 struct hlist_node hlist; /* linked list */ 86 struct hlist_node hlist; /* linked list */
80 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; 87 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
81 struct rcu_head rcu; 88 struct rcu_head rcu;
82}; 89};
83 90
84static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, int vlan_id) 91static inline struct net_device *vlan_group_get_device(struct vlan_group *vg,
92 unsigned int vlan_id)
85{ 93{
86 struct net_device **array; 94 struct net_device **array;
87 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; 95 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
88 return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN]; 96 return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN];
89} 97}
90 98
91static inline void vlan_group_set_device(struct vlan_group *vg, int vlan_id, 99static inline void vlan_group_set_device(struct vlan_group *vg,
100 unsigned int vlan_id,
92 struct net_device *dev) 101 struct net_device *dev)
93{ 102{
94 struct net_device **array; 103 struct net_device **array;
@@ -132,22 +141,18 @@ struct vlan_dev_info {
132 struct proc_dir_entry *dent; /* Holds the proc data */ 141 struct proc_dir_entry *dent; /* Holds the proc data */
133 unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */ 142 unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */
134 unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */ 143 unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */
135 struct net_device_stats dev_stats; /* Device stats (rx-bytes, tx-pkts, etc...) */
136}; 144};
137 145
138#define VLAN_DEV_INFO(x) ((struct vlan_dev_info *)(x->priv)) 146static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev)
139
140/* inline functions */
141
142static inline struct net_device_stats *vlan_dev_get_stats(struct net_device *dev)
143{ 147{
144 return &(VLAN_DEV_INFO(dev)->dev_stats); 148 return netdev_priv(dev);
145} 149}
146 150
151/* inline functions */
147static inline __u32 vlan_get_ingress_priority(struct net_device *dev, 152static inline __u32 vlan_get_ingress_priority(struct net_device *dev,
148 unsigned short vlan_tag) 153 unsigned short vlan_tag)
149{ 154{
150 struct vlan_dev_info *vip = VLAN_DEV_INFO(dev); 155 struct vlan_dev_info *vip = vlan_dev_info(dev);
151 156
152 return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7]; 157 return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7];
153} 158}
@@ -188,7 +193,7 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
188 193
189 skb->dev->last_rx = jiffies; 194 skb->dev->last_rx = jiffies;
190 195
191 stats = vlan_dev_get_stats(skb->dev); 196 stats = &skb->dev->stats;
192 stats->rx_packets++; 197 stats->rx_packets++;
193 stats->rx_bytes += skb->len; 198 stats->rx_bytes += skb->len;
194 199
@@ -266,12 +271,12 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
266 memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN); 271 memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN);
267 272
268 /* first, the ethernet type */ 273 /* first, the ethernet type */
269 veth->h_vlan_proto = __constant_htons(ETH_P_8021Q); 274 veth->h_vlan_proto = htons(ETH_P_8021Q);
270 275
271 /* now, the tag */ 276 /* now, the tag */
272 veth->h_vlan_TCI = htons(tag); 277 veth->h_vlan_TCI = htons(tag);
273 278
274 skb->protocol = __constant_htons(ETH_P_8021Q); 279 skb->protocol = htons(ETH_P_8021Q);
275 skb->mac_header -= VLAN_HLEN; 280 skb->mac_header -= VLAN_HLEN;
276 skb->network_header -= VLAN_HLEN; 281 skb->network_header -= VLAN_HLEN;
277 282
@@ -326,7 +331,7 @@ static inline int __vlan_get_tag(struct sk_buff *skb, unsigned short *tag)
326{ 331{
327 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; 332 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data;
328 333
329 if (veth->h_vlan_proto != __constant_htons(ETH_P_8021Q)) { 334 if (veth->h_vlan_proto != htons(ETH_P_8021Q)) {
330 return -EINVAL; 335 return -EINVAL;
331 } 336 }
332 337
diff --git a/include/linux/in.h b/include/linux/in.h
index 3975cbf52f20..70c6df882694 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -246,13 +246,69 @@ struct sockaddr_in {
246#include <asm/byteorder.h> 246#include <asm/byteorder.h>
247 247
248#ifdef __KERNEL__ 248#ifdef __KERNEL__
249/* Some random defines to make it easier in the kernel.. */
250#define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000))
251#define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000))
252#define BADCLASS(x) (((x) & htonl(0xf0000000)) == htonl(0xf0000000))
253#define ZERONET(x) (((x) & htonl(0xff000000)) == htonl(0x00000000))
254#define LOCAL_MCAST(x) (((x) & htonl(0xFFFFFF00)) == htonl(0xE0000000))
255 249
250static inline bool ipv4_is_loopback(__be32 addr)
251{
252 return (addr & htonl(0xff000000)) == htonl(0x7f000000);
253}
254
255static inline bool ipv4_is_multicast(__be32 addr)
256{
257 return (addr & htonl(0xf0000000)) == htonl(0xe0000000);
258}
259
260static inline bool ipv4_is_local_multicast(__be32 addr)
261{
262 return (addr & htonl(0xffffff00)) == htonl(0xe0000000);
263}
264
265static inline bool ipv4_is_lbcast(__be32 addr)
266{
267 /* limited broadcast */
268 return addr == INADDR_BROADCAST;
269}
270
271static inline bool ipv4_is_zeronet(__be32 addr)
272{
273 return (addr & htonl(0xff000000)) == htonl(0x00000000);
274}
275
276/* Special-Use IPv4 Addresses (RFC3330) */
277
278static inline bool ipv4_is_private_10(__be32 addr)
279{
280 return (addr & htonl(0xff000000)) == htonl(0x0a000000);
281}
282
283static inline bool ipv4_is_private_172(__be32 addr)
284{
285 return (addr & htonl(0xfff00000)) == htonl(0xac100000);
286}
287
288static inline bool ipv4_is_private_192(__be32 addr)
289{
290 return (addr & htonl(0xffff0000)) == htonl(0xc0a80000);
291}
292
293static inline bool ipv4_is_linklocal_169(__be32 addr)
294{
295 return (addr & htonl(0xffff0000)) == htonl(0xa9fe0000);
296}
297
298static inline bool ipv4_is_anycast_6to4(__be32 addr)
299{
300 return (addr & htonl(0xffffff00)) == htonl(0xc0586300);
301}
302
303static inline bool ipv4_is_test_192(__be32 addr)
304{
305 return (addr & htonl(0xffffff00)) == htonl(0xc0000200);
306}
307
308static inline bool ipv4_is_test_198(__be32 addr)
309{
310 return (addr & htonl(0xfffe0000)) == htonl(0xc6120000);
311}
256#endif 312#endif
257 313
258#endif /* _LINUX_IN_H */ 314#endif /* _LINUX_IN_H */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index d83fee2dc643..8d9eaaebded7 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -44,7 +44,8 @@ struct in_device
44}; 44};
45 45
46#define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1]) 46#define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1])
47#define IPV4_DEVCONF_ALL(attr) IPV4_DEVCONF(ipv4_devconf, attr) 47#define IPV4_DEVCONF_ALL(net, attr) \
48 IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr)
48 49
49static inline int ipv4_devconf_get(struct in_device *in_dev, int index) 50static inline int ipv4_devconf_get(struct in_device *in_dev, int index)
50{ 51{
@@ -71,16 +72,17 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
71 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) 72 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))
72 73
73#define IN_DEV_ANDCONF(in_dev, attr) \ 74#define IN_DEV_ANDCONF(in_dev, attr) \
74 (IPV4_DEVCONF_ALL(attr) && IN_DEV_CONF_GET((in_dev), attr)) 75 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \
76 IN_DEV_CONF_GET((in_dev), attr))
75#define IN_DEV_ORCONF(in_dev, attr) \ 77#define IN_DEV_ORCONF(in_dev, attr) \
76 (IPV4_DEVCONF_ALL(attr) || IN_DEV_CONF_GET((in_dev), attr)) 78 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \
79 IN_DEV_CONF_GET((in_dev), attr))
77#define IN_DEV_MAXCONF(in_dev, attr) \ 80#define IN_DEV_MAXCONF(in_dev, attr) \
78 (max(IPV4_DEVCONF_ALL(attr), IN_DEV_CONF_GET((in_dev), attr))) 81 (max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \
82 IN_DEV_CONF_GET((in_dev), attr)))
79 83
80#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) 84#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
81#define IN_DEV_MFORWARD(in_dev) (IPV4_DEVCONF_ALL(MC_FORWARDING) && \ 85#define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING)
82 IPV4_DEVCONF((in_dev)->cnf, \
83 MC_FORWARDING))
84#define IN_DEV_RPFILTER(in_dev) IN_DEV_ANDCONF((in_dev), RP_FILTER) 86#define IN_DEV_RPFILTER(in_dev) IN_DEV_ANDCONF((in_dev), RP_FILTER)
85#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ 87#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \
86 ACCEPT_SOURCE_ROUTE) 88 ACCEPT_SOURCE_ROUTE)
@@ -127,15 +129,14 @@ struct in_ifaddr
127extern int register_inetaddr_notifier(struct notifier_block *nb); 129extern int register_inetaddr_notifier(struct notifier_block *nb);
128extern int unregister_inetaddr_notifier(struct notifier_block *nb); 130extern int unregister_inetaddr_notifier(struct notifier_block *nb);
129 131
130extern struct net_device *ip_dev_find(__be32 addr); 132extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
131extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 133extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
132extern int devinet_ioctl(unsigned int cmd, void __user *); 134extern int devinet_ioctl(unsigned int cmd, void __user *);
133extern void devinet_init(void); 135extern void devinet_init(void);
134extern struct in_device *inetdev_by_index(int); 136extern struct in_device *inetdev_by_index(struct net *, int);
135extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); 137extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
136extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope); 138extern __be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope);
137extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask); 139extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask);
138extern void inet_forward_change(void);
139 140
140static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa) 141static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
141{ 142{
diff --git a/include/linux/init.h b/include/linux/init.h
index 5141381a7527..2efbda016741 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -40,10 +40,10 @@
40 40
41/* These are for everybody (although not all archs will actually 41/* These are for everybody (although not all archs will actually
42 discard it in modules) */ 42 discard it in modules) */
43#define __init __attribute__ ((__section__ (".init.text"))) __cold 43#define __init __section(.init.text) __cold
44#define __initdata __attribute__ ((__section__ (".init.data"))) 44#define __initdata __section(.init.data)
45#define __exitdata __attribute__ ((__section__(".exit.data"))) 45#define __exitdata __section(.exit.data)
46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) 46#define __exit_call __used __section(.exitcall.exit)
47 47
48/* modpost check for section mismatches during the kernel build. 48/* modpost check for section mismatches during the kernel build.
49 * A section mismatch happens when there are references from a 49 * A section mismatch happens when there are references from a
@@ -52,25 +52,81 @@
52 * when early init has completed so all such references are potential bugs. 52 * when early init has completed so all such references are potential bugs.
53 * For exit sections the same issue exists. 53 * For exit sections the same issue exists.
54 * The following markers are used for the cases where the reference to 54 * The following markers are used for the cases where the reference to
55 * the init/exit section (code or data) is valid and will teach modpost 55 * the *init / *exit section (code or data) is valid and will teach
56 * not to issue a warning. 56 * modpost not to issue a warning.
57 * The markers follow same syntax rules as __init / __initdata. */ 57 * The markers follow same syntax rules as __init / __initdata. */
58#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok"))) 58#define __ref __section(.ref.text) noinline
59#define __initdata_refok __attribute__ ((__section__ (".data.init.refok"))) 59#define __refdata __section(.ref.data)
60#define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok"))) 60#define __refconst __section(.ref.rodata)
61
62/* backward compatibility note
63 * A few places hardcode the old section names:
64 * .text.init.refok
65 * .data.init.refok
66 * .exit.text.refok
67 * They should be converted to use the defines from this file
68 */
69
70/* compatibility defines */
71#define __init_refok __ref
72#define __initdata_refok __refdata
73#define __exit_refok __ref
74
61 75
62#ifdef MODULE 76#ifdef MODULE
63#define __exit __attribute__ ((__section__(".exit.text"))) __cold 77#define __exitused
64#else 78#else
65#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) __cold 79#define __exitused __used
66#endif 80#endif
67 81
82#define __exit __section(.exit.text) __exitused __cold
83
84/* Used for HOTPLUG */
85#define __devinit __section(.devinit.text) __cold
86#define __devinitdata __section(.devinit.data)
87#define __devinitconst __section(.devinit.rodata)
88#define __devexit __section(.devexit.text) __exitused __cold
89#define __devexitdata __section(.devexit.data)
90#define __devexitconst __section(.devexit.rodata)
91
92/* Used for HOTPLUG_CPU */
93#define __cpuinit __section(.cpuinit.text) __cold
94#define __cpuinitdata __section(.cpuinit.data)
95#define __cpuinitconst __section(.cpuinit.rodata)
96#define __cpuexit __section(.cpuexit.text) __exitused __cold
97#define __cpuexitdata __section(.cpuexit.data)
98#define __cpuexitconst __section(.cpuexit.rodata)
99
100/* Used for MEMORY_HOTPLUG */
101#define __meminit __section(.meminit.text) __cold
102#define __meminitdata __section(.meminit.data)
103#define __meminitconst __section(.meminit.rodata)
104#define __memexit __section(.memexit.text) __exitused __cold
105#define __memexitdata __section(.memexit.data)
106#define __memexitconst __section(.memexit.rodata)
107
68/* For assembly routines */ 108/* For assembly routines */
69#define __INIT .section ".init.text","ax" 109#define __INIT .section ".init.text","ax"
70#define __INIT_REFOK .section ".text.init.refok","ax"
71#define __FINIT .previous 110#define __FINIT .previous
111
72#define __INITDATA .section ".init.data","aw" 112#define __INITDATA .section ".init.data","aw"
73#define __INITDATA_REFOK .section ".data.init.refok","aw" 113
114#define __DEVINIT .section ".devinit.text", "ax"
115#define __DEVINITDATA .section ".devinit.data", "aw"
116
117#define __CPUINIT .section ".cpuinit.text", "ax"
118#define __CPUINITDATA .section ".cpuinit.data", "aw"
119
120#define __MEMINIT .section ".meminit.text", "ax"
121#define __MEMINITDATA .section ".meminit.data", "aw"
122
123/* silence warnings when references are OK */
124#define __REF .section ".ref.text", "ax"
125#define __REFDATA .section ".ref.data", "aw"
126#define __REFCONST .section ".ref.rodata", "aw"
127/* backward compatibility */
128#define __INIT_REFOK .section __REF
129#define __INITDATA_REFOK .section __REFDATA
74 130
75#ifndef __ASSEMBLY__ 131#ifndef __ASSEMBLY__
76/* 132/*
@@ -108,7 +164,7 @@ void prepare_namespace(void);
108 */ 164 */
109 165
110#define __define_initcall(level,fn,id) \ 166#define __define_initcall(level,fn,id) \
111 static initcall_t __initcall_##fn##id __attribute_used__ \ 167 static initcall_t __initcall_##fn##id __used \
112 __attribute__((__section__(".initcall" level ".init"))) = fn 168 __attribute__((__section__(".initcall" level ".init"))) = fn
113 169
114/* 170/*
@@ -142,11 +198,11 @@ void prepare_namespace(void);
142 198
143#define console_initcall(fn) \ 199#define console_initcall(fn) \
144 static initcall_t __initcall_##fn \ 200 static initcall_t __initcall_##fn \
145 __attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn 201 __used __section(.con_initcall.init) = fn
146 202
147#define security_initcall(fn) \ 203#define security_initcall(fn) \
148 static initcall_t __initcall_##fn \ 204 static initcall_t __initcall_##fn \
149 __attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn 205 __used __section(.security_initcall.init) = fn
150 206
151struct obs_kernel_param { 207struct obs_kernel_param {
152 const char *str; 208 const char *str;
@@ -163,8 +219,7 @@ struct obs_kernel_param {
163#define __setup_param(str, unique_id, fn, early) \ 219#define __setup_param(str, unique_id, fn, early) \
164 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ 220 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
165 static struct obs_kernel_param __setup_##unique_id \ 221 static struct obs_kernel_param __setup_##unique_id \
166 __attribute_used__ \ 222 __used __section(.init.setup) \
167 __attribute__((__section__(".init.setup"))) \
168 __attribute__((aligned((sizeof(long))))) \ 223 __attribute__((aligned((sizeof(long))))) \
169 = { __setup_str_##unique_id, fn, early } 224 = { __setup_str_##unique_id, fn, early }
170 225
@@ -242,7 +297,7 @@ void __init parse_early_param(void);
242#endif 297#endif
243 298
244/* Data marked not to be saved by software suspend */ 299/* Data marked not to be saved by software suspend */
245#define __nosavedata __attribute__ ((__section__ (".data.nosave"))) 300#define __nosavedata __section(.data.nosave)
246 301
247/* This means "can be init if no module support, otherwise module load 302/* This means "can be init if no module support, otherwise module load
248 may call it." */ 303 may call it." */
@@ -254,43 +309,6 @@ void __init parse_early_param(void);
254#define __initdata_or_module __initdata 309#define __initdata_or_module __initdata
255#endif /*CONFIG_MODULES*/ 310#endif /*CONFIG_MODULES*/
256 311
257#ifdef CONFIG_HOTPLUG
258#define __devinit
259#define __devinitdata
260#define __devexit
261#define __devexitdata
262#else
263#define __devinit __init
264#define __devinitdata __initdata
265#define __devexit __exit
266#define __devexitdata __exitdata
267#endif
268
269#ifdef CONFIG_HOTPLUG_CPU
270#define __cpuinit
271#define __cpuinitdata
272#define __cpuexit
273#define __cpuexitdata
274#else
275#define __cpuinit __init
276#define __cpuinitdata __initdata
277#define __cpuexit __exit
278#define __cpuexitdata __exitdata
279#endif
280
281#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
282 || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
283#define __meminit
284#define __meminitdata
285#define __memexit
286#define __memexitdata
287#else
288#define __meminit __init
289#define __meminitdata __initdata
290#define __memexit __exit
291#define __memexitdata __exitdata
292#endif
293
294/* Functions marked as __devexit may be discarded at kernel link time, depending 312/* Functions marked as __devexit may be discarded at kernel link time, depending
295 on config options. Newer versions of binutils detect references from 313 on config options. Newer versions of binutils detect references from
296 retained sections to discarded sections and flag an error. Pointers to 314 retained sections to discarded sections and flag an error. Pointers to
diff --git a/include/linux/init_ohci1394_dma.h b/include/linux/init_ohci1394_dma.h
new file mode 100644
index 000000000000..3c03a4bba5e4
--- /dev/null
+++ b/include/linux/init_ohci1394_dma.h
@@ -0,0 +1,4 @@
1#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
2extern int __initdata init_ohci1394_dma_early;
3extern void __init init_ohci1394_dma_on_all_controllers(void);
4#endif
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index cae35b6b9aec..e6b3f7080679 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -132,9 +132,11 @@ extern struct group_info init_groups;
132 .cpus_allowed = CPU_MASK_ALL, \ 132 .cpus_allowed = CPU_MASK_ALL, \
133 .mm = NULL, \ 133 .mm = NULL, \
134 .active_mm = &init_mm, \ 134 .active_mm = &init_mm, \
135 .run_list = LIST_HEAD_INIT(tsk.run_list), \ 135 .rt = { \
136 .ioprio = 0, \ 136 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
137 .time_slice = HZ, \ 137 .time_slice = HZ, \
138 .nr_cpus_allowed = NR_CPUS, \
139 }, \
138 .tasks = LIST_HEAD_INIT(tsk.tasks), \ 140 .tasks = LIST_HEAD_INIT(tsk.tasks), \
139 .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children), \ 141 .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children), \
140 .ptrace_list = LIST_HEAD_INIT(tsk.ptrace_list), \ 142 .ptrace_list = LIST_HEAD_INIT(tsk.ptrace_list), \
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 2306920fa388..c3db4a00f1fa 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -256,6 +256,7 @@ enum
256#ifdef CONFIG_HIGH_RES_TIMERS 256#ifdef CONFIG_HIGH_RES_TIMERS
257 HRTIMER_SOFTIRQ, 257 HRTIMER_SOFTIRQ,
258#endif 258#endif
259 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
259}; 260};
260 261
261/* softirq mask and active fields moved to irq_cpustat_t in 262/* softirq mask and active fields moved to irq_cpustat_t in
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
new file mode 100644
index 000000000000..593b222d9dcc
--- /dev/null
+++ b/include/linux/iocontext.h
@@ -0,0 +1,95 @@
1#ifndef IOCONTEXT_H
2#define IOCONTEXT_H
3
4#include <linux/radix-tree.h>
5
6/*
7 * This is the per-process anticipatory I/O scheduler state.
8 */
9struct as_io_context {
10 spinlock_t lock;
11
12 void (*dtor)(struct as_io_context *aic); /* destructor */
13 void (*exit)(struct as_io_context *aic); /* called on task exit */
14
15 unsigned long state;
16 atomic_t nr_queued; /* queued reads & sync writes */
17 atomic_t nr_dispatched; /* number of requests gone to the drivers */
18
19 /* IO History tracking */
20 /* Thinktime */
21 unsigned long last_end_request;
22 unsigned long ttime_total;
23 unsigned long ttime_samples;
24 unsigned long ttime_mean;
25 /* Layout pattern */
26 unsigned int seek_samples;
27 sector_t last_request_pos;
28 u64 seek_total;
29 sector_t seek_mean;
30};
31
32struct cfq_queue;
33struct cfq_io_context {
34 void *key;
35 unsigned long dead_key;
36
37 struct cfq_queue *cfqq[2];
38
39 struct io_context *ioc;
40
41 unsigned long last_end_request;
42 sector_t last_request_pos;
43
44 unsigned long ttime_total;
45 unsigned long ttime_samples;
46 unsigned long ttime_mean;
47
48 unsigned int seek_samples;
49 u64 seek_total;
50 sector_t seek_mean;
51
52 struct list_head queue_list;
53
54 void (*dtor)(struct io_context *); /* destructor */
55 void (*exit)(struct io_context *); /* called on task exit */
56};
57
58/*
59 * I/O subsystem state of the associated processes. It is refcounted
60 * and kmalloc'ed. These could be shared between processes.
61 */
62struct io_context {
63 atomic_t refcount;
64 atomic_t nr_tasks;
65
66 /* all the fields below are protected by this lock */
67 spinlock_t lock;
68
69 unsigned short ioprio;
70 unsigned short ioprio_changed;
71
72 /*
73 * For request batching
74 */
75 unsigned long last_waited; /* Time last woken after wait for request */
76 int nr_batch_requests; /* Number of requests left in the batch */
77
78 struct as_io_context *aic;
79 struct radix_tree_root radix_root;
80 void *ioc_data;
81};
82
83static inline struct io_context *ioc_task_link(struct io_context *ioc)
84{
85 /*
86 * if ref count is zero, don't allow sharing (ioc is going away, it's
87 * a race).
88 */
89 if (ioc && atomic_inc_not_zero(&ioc->refcount))
90 return ioc;
91
92 return NULL;
93}
94
95#endif
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 6187a8567bc7..605d237364d2 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -8,6 +8,7 @@
8#ifndef _LINUX_IOPORT_H 8#ifndef _LINUX_IOPORT_H
9#define _LINUX_IOPORT_H 9#define _LINUX_IOPORT_H
10 10
11#ifndef __ASSEMBLY__
11#include <linux/compiler.h> 12#include <linux/compiler.h>
12#include <linux/types.h> 13#include <linux/types.h>
13/* 14/*
@@ -153,4 +154,5 @@ extern struct resource * __devm_request_region(struct device *dev,
153extern void __devm_release_region(struct device *dev, struct resource *parent, 154extern void __devm_release_region(struct device *dev, struct resource *parent,
154 resource_size_t start, resource_size_t n); 155 resource_size_t start, resource_size_t n);
155 156
157#endif /* __ASSEMBLY__ */
156#endif /* _LINUX_IOPORT_H */ 158#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index baf29387cab4..2a3bb1bb7433 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -2,6 +2,7 @@
2#define IOPRIO_H 2#define IOPRIO_H
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/iocontext.h>
5 6
6/* 7/*
7 * Gives us 8 prio classes with 13-bits of data for each class 8 * Gives us 8 prio classes with 13-bits of data for each class
@@ -45,18 +46,18 @@ enum {
45 * the cpu scheduler nice value to an io priority 46 * the cpu scheduler nice value to an io priority
46 */ 47 */
47#define IOPRIO_NORM (4) 48#define IOPRIO_NORM (4)
48static inline int task_ioprio(struct task_struct *task) 49static inline int task_ioprio(struct io_context *ioc)
49{ 50{
50 if (ioprio_valid(task->ioprio)) 51 if (ioprio_valid(ioc->ioprio))
51 return IOPRIO_PRIO_DATA(task->ioprio); 52 return IOPRIO_PRIO_DATA(ioc->ioprio);
52 53
53 return IOPRIO_NORM; 54 return IOPRIO_NORM;
54} 55}
55 56
56static inline int task_ioprio_class(struct task_struct *task) 57static inline int task_ioprio_class(struct io_context *ioc)
57{ 58{
58 if (ioprio_valid(task->ioprio)) 59 if (ioprio_valid(ioc->ioprio))
59 return IOPRIO_PRIO_CLASS(task->ioprio); 60 return IOPRIO_PRIO_CLASS(ioc->ioprio);
60 61
61 return IOPRIO_CLASS_BE; 62 return IOPRIO_CLASS_BE;
62} 63}
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 06ef11457051..2cbf6fdb1799 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -149,6 +149,28 @@ typedef struct journal_header_s
149 __be32 h_sequence; 149 __be32 h_sequence;
150} journal_header_t; 150} journal_header_t;
151 151
152/*
153 * Checksum types.
154 */
155#define JBD2_CRC32_CHKSUM 1
156#define JBD2_MD5_CHKSUM 2
157#define JBD2_SHA1_CHKSUM 3
158
159#define JBD2_CRC32_CHKSUM_SIZE 4
160
161#define JBD2_CHECKSUM_BYTES (32 / sizeof(u32))
162/*
163 * Commit block header for storing transactional checksums:
164 */
165struct commit_header {
166 __be32 h_magic;
167 __be32 h_blocktype;
168 __be32 h_sequence;
169 unsigned char h_chksum_type;
170 unsigned char h_chksum_size;
171 unsigned char h_padding[2];
172 __be32 h_chksum[JBD2_CHECKSUM_BYTES];
173};
152 174
153/* 175/*
154 * The block tag: used to describe a single buffer in the journal. 176 * The block tag: used to describe a single buffer in the journal.
@@ -242,31 +264,25 @@ typedef struct journal_superblock_s
242 ((j)->j_format_version >= 2 && \ 264 ((j)->j_format_version >= 2 && \
243 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask)))) 265 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
244 266
245#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001 267#define JBD2_FEATURE_COMPAT_CHECKSUM 0x00000001
246#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 268
269#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001
270#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
271#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
247 272
248/* Features known to this kernel version: */ 273/* Features known to this kernel version: */
249#define JBD2_KNOWN_COMPAT_FEATURES 0 274#define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM
250#define JBD2_KNOWN_ROCOMPAT_FEATURES 0 275#define JBD2_KNOWN_ROCOMPAT_FEATURES 0
251#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ 276#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \
252 JBD2_FEATURE_INCOMPAT_64BIT) 277 JBD2_FEATURE_INCOMPAT_64BIT | \
278 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)
253 279
254#ifdef __KERNEL__ 280#ifdef __KERNEL__
255 281
256#include <linux/fs.h> 282#include <linux/fs.h>
257#include <linux/sched.h> 283#include <linux/sched.h>
258 284
259#define JBD2_ASSERTIONS 285#define J_ASSERT(assert) BUG_ON(!(assert))
260#ifdef JBD2_ASSERTIONS
261#define J_ASSERT(assert) \
262do { \
263 if (!(assert)) { \
264 printk (KERN_EMERG \
265 "Assertion failure in %s() at %s:%d: \"%s\"\n", \
266 __FUNCTION__, __FILE__, __LINE__, # assert); \
267 BUG(); \
268 } \
269} while (0)
270 286
271#if defined(CONFIG_BUFFER_DEBUG) 287#if defined(CONFIG_BUFFER_DEBUG)
272void buffer_assertion_failure(struct buffer_head *bh); 288void buffer_assertion_failure(struct buffer_head *bh);
@@ -282,10 +298,6 @@ void buffer_assertion_failure(struct buffer_head *bh);
282#define J_ASSERT_JH(jh, expr) J_ASSERT(expr) 298#define J_ASSERT_JH(jh, expr) J_ASSERT(expr)
283#endif 299#endif
284 300
285#else
286#define J_ASSERT(assert) do { } while (0)
287#endif /* JBD2_ASSERTIONS */
288
289#if defined(JBD2_PARANOID_IOFAIL) 301#if defined(JBD2_PARANOID_IOFAIL)
290#define J_EXPECT(expr, why...) J_ASSERT(expr) 302#define J_EXPECT(expr, why...) J_ASSERT(expr)
291#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr) 303#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr)
@@ -406,9 +418,23 @@ struct handle_s
406 unsigned int h_sync: 1; /* sync-on-close */ 418 unsigned int h_sync: 1; /* sync-on-close */
407 unsigned int h_jdata: 1; /* force data journaling */ 419 unsigned int h_jdata: 1; /* force data journaling */
408 unsigned int h_aborted: 1; /* fatal error on handle */ 420 unsigned int h_aborted: 1; /* fatal error on handle */
421
422#ifdef CONFIG_DEBUG_LOCK_ALLOC
423 struct lockdep_map h_lockdep_map;
424#endif
409}; 425};
410 426
411 427
428/*
429 * Some stats for checkpoint phase
430 */
431struct transaction_chp_stats_s {
432 unsigned long cs_chp_time;
433 unsigned long cs_forced_to_close;
434 unsigned long cs_written;
435 unsigned long cs_dropped;
436};
437
412/* The transaction_t type is the guts of the journaling mechanism. It 438/* The transaction_t type is the guts of the journaling mechanism. It
413 * tracks a compound transaction through its various states: 439 * tracks a compound transaction through its various states:
414 * 440 *
@@ -456,6 +482,8 @@ struct transaction_s
456 /* 482 /*
457 * Transaction's current state 483 * Transaction's current state
458 * [no locking - only kjournald2 alters this] 484 * [no locking - only kjournald2 alters this]
485 * [j_list_lock] guards transition of a transaction into T_FINISHED
486 * state and subsequent call of __jbd2_journal_drop_transaction()
459 * FIXME: needs barriers 487 * FIXME: needs barriers
460 * KLUDGE: [use j_state_lock] 488 * KLUDGE: [use j_state_lock]
461 */ 489 */
@@ -544,6 +572,21 @@ struct transaction_s
544 spinlock_t t_handle_lock; 572 spinlock_t t_handle_lock;
545 573
546 /* 574 /*
575 * Longest time some handle had to wait for running transaction
576 */
577 unsigned long t_max_wait;
578
579 /*
580 * When transaction started
581 */
582 unsigned long t_start;
583
584 /*
585 * Checkpointing stats [j_checkpoint_sem]
586 */
587 struct transaction_chp_stats_s t_chp_stats;
588
589 /*
547 * Number of outstanding updates running on this transaction 590 * Number of outstanding updates running on this transaction
548 * [t_handle_lock] 591 * [t_handle_lock]
549 */ 592 */
@@ -574,6 +617,39 @@ struct transaction_s
574 617
575}; 618};
576 619
620struct transaction_run_stats_s {
621 unsigned long rs_wait;
622 unsigned long rs_running;
623 unsigned long rs_locked;
624 unsigned long rs_flushing;
625 unsigned long rs_logging;
626
627 unsigned long rs_handle_count;
628 unsigned long rs_blocks;
629 unsigned long rs_blocks_logged;
630};
631
632struct transaction_stats_s {
633 int ts_type;
634 unsigned long ts_tid;
635 union {
636 struct transaction_run_stats_s run;
637 struct transaction_chp_stats_s chp;
638 } u;
639};
640
641#define JBD2_STATS_RUN 1
642#define JBD2_STATS_CHECKPOINT 2
643
644static inline unsigned long
645jbd2_time_diff(unsigned long start, unsigned long end)
646{
647 if (end >= start)
648 return end - start;
649
650 return end + (MAX_JIFFY_OFFSET - start);
651}
652
577/** 653/**
578 * struct journal_s - The journal_s type is the concrete type associated with 654 * struct journal_s - The journal_s type is the concrete type associated with
579 * journal_t. 655 * journal_t.
@@ -635,6 +711,12 @@ struct transaction_s
635 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the 711 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
636 * number that will fit in j_blocksize 712 * number that will fit in j_blocksize
637 * @j_last_sync_writer: most recent pid which did a synchronous write 713 * @j_last_sync_writer: most recent pid which did a synchronous write
714 * @j_history: Buffer storing the transactions statistics history
715 * @j_history_max: Maximum number of transactions in the statistics history
716 * @j_history_cur: Current number of transactions in the statistics history
717 * @j_history_lock: Protect the transactions statistics history
718 * @j_proc_entry: procfs entry for the jbd statistics directory
719 * @j_stats: Overall statistics
638 * @j_private: An opaque pointer to fs-private information. 720 * @j_private: An opaque pointer to fs-private information.
639 */ 721 */
640 722
@@ -827,6 +909,19 @@ struct journal_s
827 pid_t j_last_sync_writer; 909 pid_t j_last_sync_writer;
828 910
829 /* 911 /*
912 * Journal statistics
913 */
914 struct transaction_stats_s *j_history;
915 int j_history_max;
916 int j_history_cur;
917 /*
918 * Protect the transactions statistics history
919 */
920 spinlock_t j_history_lock;
921 struct proc_dir_entry *j_proc_entry;
922 struct transaction_stats_s j_stats;
923
924 /*
830 * An opaque pointer to fs-private information. ext3 puts its 925 * An opaque pointer to fs-private information. ext3 puts its
831 * superblock pointer here 926 * superblock pointer here
832 */ 927 */
@@ -932,6 +1027,8 @@ extern int jbd2_journal_check_available_features
932 (journal_t *, unsigned long, unsigned long, unsigned long); 1027 (journal_t *, unsigned long, unsigned long, unsigned long);
933extern int jbd2_journal_set_features 1028extern int jbd2_journal_set_features
934 (journal_t *, unsigned long, unsigned long, unsigned long); 1029 (journal_t *, unsigned long, unsigned long, unsigned long);
1030extern void jbd2_journal_clear_features
1031 (journal_t *, unsigned long, unsigned long, unsigned long);
935extern int jbd2_journal_create (journal_t *); 1032extern int jbd2_journal_create (journal_t *);
936extern int jbd2_journal_load (journal_t *journal); 1033extern int jbd2_journal_load (journal_t *journal);
937extern void jbd2_journal_destroy (journal_t *); 1034extern void jbd2_journal_destroy (journal_t *);
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 8b080024bbc1..7ba9e47bf061 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -29,6 +29,12 @@
29# define SHIFT_HZ 9 29# define SHIFT_HZ 9
30#elif HZ >= 768 && HZ < 1536 30#elif HZ >= 768 && HZ < 1536
31# define SHIFT_HZ 10 31# define SHIFT_HZ 10
32#elif HZ >= 1536 && HZ < 3072
33# define SHIFT_HZ 11
34#elif HZ >= 3072 && HZ < 6144
35# define SHIFT_HZ 12
36#elif HZ >= 6144 && HZ < 12288
37# define SHIFT_HZ 13
32#else 38#else
33# error You lose. 39# error You lose.
34#endif 40#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 94bc99656963..ff356b2ee478 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -105,8 +105,8 @@ struct user;
105 * supposed to. 105 * supposed to.
106 */ 106 */
107#ifdef CONFIG_PREEMPT_VOLUNTARY 107#ifdef CONFIG_PREEMPT_VOLUNTARY
108extern int cond_resched(void); 108extern int _cond_resched(void);
109# define might_resched() cond_resched() 109# define might_resched() _cond_resched()
110#else 110#else
111# define might_resched() do { } while (0) 111# define might_resched() do { } while (0)
112#endif 112#endif
@@ -194,6 +194,9 @@ static inline int log_buf_read(int idx) { return 0; }
194static inline int log_buf_copy(char *dest, int idx, int len) { return 0; } 194static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
195#endif 195#endif
196 196
197extern void __attribute__((format(printf, 1, 2)))
198 early_printk(const char *fmt, ...);
199
197unsigned long int_sqrt(unsigned long); 200unsigned long int_sqrt(unsigned long);
198 201
199extern int printk_ratelimit(void); 202extern int printk_ratelimit(void);
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 4a0d27f475d7..caa3f411f15d 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -3,15 +3,14 @@
3 * 3 *
4 * Copyright (c) 2002-2003 Patrick Mochel 4 * Copyright (c) 2002-2003 Patrick Mochel
5 * Copyright (c) 2002-2003 Open Source Development Labs 5 * Copyright (c) 2002-2003 Open Source Development Labs
6 * Copyright (c) 2006-2007 Greg Kroah-Hartman <greg@kroah.com> 6 * Copyright (c) 2006-2008 Greg Kroah-Hartman <greg@kroah.com>
7 * Copyright (c) 2006-2007 Novell Inc. 7 * Copyright (c) 2006-2008 Novell Inc.
8 * 8 *
9 * This file is released under the GPLv2. 9 * This file is released under the GPLv2.
10 * 10 *
11 *
12 * Please read Documentation/kobject.txt before using the kobject 11 * Please read Documentation/kobject.txt before using the kobject
13 * interface, ESPECIALLY the parts about reference counts and object 12 * interface, ESPECIALLY the parts about reference counts and object
14 * destructors. 13 * destructors.
15 */ 14 */
16 15
17#ifndef _KOBJECT_H_ 16#ifndef _KOBJECT_H_
@@ -61,48 +60,54 @@ enum kobject_action {
61}; 60};
62 61
63struct kobject { 62struct kobject {
64 const char * k_name; 63 const char *name;
65 struct kref kref; 64 struct kref kref;
66 struct list_head entry; 65 struct list_head entry;
67 struct kobject * parent; 66 struct kobject *parent;
68 struct kset * kset; 67 struct kset *kset;
69 struct kobj_type * ktype; 68 struct kobj_type *ktype;
70 struct sysfs_dirent * sd; 69 struct sysfs_dirent *sd;
70 unsigned int state_initialized:1;
71 unsigned int state_in_sysfs:1;
72 unsigned int state_add_uevent_sent:1;
73 unsigned int state_remove_uevent_sent:1;
71}; 74};
72 75
73extern int kobject_set_name(struct kobject *, const char *, ...) 76extern int kobject_set_name(struct kobject *kobj, const char *name, ...)
74 __attribute__((format(printf,2,3))); 77 __attribute__((format(printf, 2, 3)));
75 78
76static inline const char * kobject_name(const struct kobject * kobj) 79static inline const char *kobject_name(const struct kobject *kobj)
77{ 80{
78 return kobj->k_name; 81 return kobj->name;
79} 82}
80 83
81extern void kobject_init(struct kobject *); 84extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype);
82extern void kobject_cleanup(struct kobject *); 85extern int __must_check kobject_add(struct kobject *kobj,
86 struct kobject *parent,
87 const char *fmt, ...);
88extern int __must_check kobject_init_and_add(struct kobject *kobj,
89 struct kobj_type *ktype,
90 struct kobject *parent,
91 const char *fmt, ...);
92
93extern void kobject_del(struct kobject *kobj);
83 94
84extern int __must_check kobject_add(struct kobject *); 95extern struct kobject * __must_check kobject_create(void);
85extern void kobject_del(struct kobject *); 96extern struct kobject * __must_check kobject_create_and_add(const char *name,
97 struct kobject *parent);
86 98
87extern int __must_check kobject_rename(struct kobject *, const char *new_name); 99extern int __must_check kobject_rename(struct kobject *, const char *new_name);
88extern int __must_check kobject_move(struct kobject *, struct kobject *); 100extern int __must_check kobject_move(struct kobject *, struct kobject *);
89 101
90extern int __must_check kobject_register(struct kobject *); 102extern struct kobject *kobject_get(struct kobject *kobj);
91extern void kobject_unregister(struct kobject *); 103extern void kobject_put(struct kobject *kobj);
92
93extern struct kobject * kobject_get(struct kobject *);
94extern void kobject_put(struct kobject *);
95
96extern struct kobject *kobject_kset_add_dir(struct kset *kset,
97 struct kobject *, const char *);
98extern struct kobject *kobject_add_dir(struct kobject *, const char *);
99 104
100extern char * kobject_get_path(struct kobject *, gfp_t); 105extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
101 106
102struct kobj_type { 107struct kobj_type {
103 void (*release)(struct kobject *); 108 void (*release)(struct kobject *kobj);
104 struct sysfs_ops * sysfs_ops; 109 struct sysfs_ops *sysfs_ops;
105 struct attribute ** default_attrs; 110 struct attribute **default_attrs;
106}; 111};
107 112
108struct kobj_uevent_env { 113struct kobj_uevent_env {
@@ -119,6 +124,16 @@ struct kset_uevent_ops {
119 struct kobj_uevent_env *env); 124 struct kobj_uevent_env *env);
120}; 125};
121 126
127struct kobj_attribute {
128 struct attribute attr;
129 ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr,
130 char *buf);
131 ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr,
132 const char *buf, size_t count);
133};
134
135extern struct sysfs_ops kobj_sysfs_ops;
136
122/** 137/**
123 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. 138 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
124 * 139 *
@@ -128,7 +143,6 @@ struct kset_uevent_ops {
128 * define the attribute callbacks and other common events that happen to 143 * define the attribute callbacks and other common events that happen to
129 * a kobject. 144 * a kobject.
130 * 145 *
131 * @ktype: the struct kobj_type for this specific kset
132 * @list: the list of all kobjects for this kset 146 * @list: the list of all kobjects for this kset
133 * @list_lock: a lock for iterating over the kobjects 147 * @list_lock: a lock for iterating over the kobjects
134 * @kobj: the embedded kobject for this kset (recursion, isn't it fun...) 148 * @kobj: the embedded kobject for this kset (recursion, isn't it fun...)
@@ -138,99 +152,49 @@ struct kset_uevent_ops {
138 * desired. 152 * desired.
139 */ 153 */
140struct kset { 154struct kset {
141 struct kobj_type *ktype; 155 struct list_head list;
142 struct list_head list; 156 spinlock_t list_lock;
143 spinlock_t list_lock; 157 struct kobject kobj;
144 struct kobject kobj; 158 struct kset_uevent_ops *uevent_ops;
145 struct kset_uevent_ops *uevent_ops;
146}; 159};
147 160
161extern void kset_init(struct kset *kset);
162extern int __must_check kset_register(struct kset *kset);
163extern void kset_unregister(struct kset *kset);
164extern struct kset * __must_check kset_create_and_add(const char *name,
165 struct kset_uevent_ops *u,
166 struct kobject *parent_kobj);
148 167
149extern void kset_init(struct kset * k); 168static inline struct kset *to_kset(struct kobject *kobj)
150extern int __must_check kset_add(struct kset * k);
151extern int __must_check kset_register(struct kset * k);
152extern void kset_unregister(struct kset * k);
153
154static inline struct kset * to_kset(struct kobject * kobj)
155{ 169{
156 return kobj ? container_of(kobj,struct kset,kobj) : NULL; 170 return kobj ? container_of(kobj, struct kset, kobj) : NULL;
157} 171}
158 172
159static inline struct kset * kset_get(struct kset * k) 173static inline struct kset *kset_get(struct kset *k)
160{ 174{
161 return k ? to_kset(kobject_get(&k->kobj)) : NULL; 175 return k ? to_kset(kobject_get(&k->kobj)) : NULL;
162} 176}
163 177
164static inline void kset_put(struct kset * k) 178static inline void kset_put(struct kset *k)
165{ 179{
166 kobject_put(&k->kobj); 180 kobject_put(&k->kobj);
167} 181}
168 182
169static inline struct kobj_type * get_ktype(struct kobject * k) 183static inline struct kobj_type *get_ktype(struct kobject *kobj)
170{ 184{
171 if (k->kset && k->kset->ktype) 185 return kobj->ktype;
172 return k->kset->ktype;
173 else
174 return k->ktype;
175} 186}
176 187
177extern struct kobject * kset_find_obj(struct kset *, const char *); 188extern struct kobject *kset_find_obj(struct kset *, const char *);
178
179
180/*
181 * Use this when initializing an embedded kset with no other
182 * fields to initialize.
183 */
184#define set_kset_name(str) .kset = { .kobj = { .k_name = str } }
185
186
187#define decl_subsys(_name,_type,_uevent_ops) \
188struct kset _name##_subsys = { \
189 .kobj = { .k_name = __stringify(_name) }, \
190 .ktype = _type, \
191 .uevent_ops =_uevent_ops, \
192}
193#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
194struct kset _varname##_subsys = { \
195 .kobj = { .k_name = __stringify(_name) }, \
196 .ktype = _type, \
197 .uevent_ops =_uevent_ops, \
198}
199
200/* The global /sys/kernel/ subsystem for people to chain off of */
201extern struct kset kernel_subsys;
202/* The global /sys/hypervisor/ subsystem */
203extern struct kset hypervisor_subsys;
204
205/*
206 * Helpers for setting the kset of registered objects.
207 * Often, a registered object belongs to a kset embedded in a
208 * subsystem. These do no magic, just make the resulting code
209 * easier to follow.
210 */
211
212/**
213 * kobj_set_kset_s(obj,subsys) - set kset for embedded kobject.
214 * @obj: ptr to some object type.
215 * @subsys: a subsystem object (not a ptr).
216 *
217 * Can be used for any object type with an embedded ->kobj.
218 */
219
220#define kobj_set_kset_s(obj,subsys) \
221 (obj)->kobj.kset = &(subsys)
222
223extern int __must_check subsystem_register(struct kset *);
224extern void subsystem_unregister(struct kset *);
225
226struct subsys_attribute {
227 struct attribute attr;
228 ssize_t (*show)(struct kset *, char *);
229 ssize_t (*store)(struct kset *, const char *, size_t);
230};
231 189
232extern int __must_check subsys_create_file(struct kset *, 190/* The global /sys/kernel/ kobject for people to chain off of */
233 struct subsys_attribute *); 191extern struct kobject *kernel_kobj;
192/* The global /sys/hypervisor/ kobject for people to chain off of */
193extern struct kobject *hypervisor_kobj;
194/* The global /sys/power/ kobject for people to chain off of */
195extern struct kobject *power_kobj;
196/* The global /sys/firmware/ kobject for people to chain off of */
197extern struct kobject *firmware_kobj;
234 198
235#if defined(CONFIG_HOTPLUG) 199#if defined(CONFIG_HOTPLUG)
236int kobject_uevent(struct kobject *kobj, enum kobject_action action); 200int kobject_uevent(struct kobject *kobj, enum kobject_action action);
@@ -243,18 +207,20 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
243int kobject_action_type(const char *buf, size_t count, 207int kobject_action_type(const char *buf, size_t count,
244 enum kobject_action *type); 208 enum kobject_action *type);
245#else 209#else
246static inline int kobject_uevent(struct kobject *kobj, enum kobject_action action) 210static inline int kobject_uevent(struct kobject *kobj,
211 enum kobject_action action)
247{ return 0; } 212{ return 0; }
248static inline int kobject_uevent_env(struct kobject *kobj, 213static inline int kobject_uevent_env(struct kobject *kobj,
249 enum kobject_action action, 214 enum kobject_action action,
250 char *envp[]) 215 char *envp[])
251{ return 0; } 216{ return 0; }
252 217
253static inline int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) 218static inline int add_uevent_var(struct kobj_uevent_env *env,
219 const char *format, ...)
254{ return 0; } 220{ return 0; }
255 221
256static inline int kobject_action_type(const char *buf, size_t count, 222static inline int kobject_action_type(const char *buf, size_t count,
257 enum kobject_action *type) 223 enum kobject_action *type)
258{ return -EINVAL; } 224{ return -EINVAL; }
259#endif 225#endif
260 226
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 81891581e89b..6168c0a44172 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -182,6 +182,15 @@ static inline void kretprobe_assert(struct kretprobe_instance *ri,
182 } 182 }
183} 183}
184 184
185#ifdef CONFIG_KPROBES_SANITY_TEST
186extern int init_test_probes(void);
187#else
188static inline int init_test_probes(void)
189{
190 return 0;
191}
192#endif /* CONFIG_KPROBES_SANITY_TEST */
193
185extern spinlock_t kretprobe_lock; 194extern spinlock_t kretprobe_lock;
186extern struct mutex kprobe_mutex; 195extern struct mutex kprobe_mutex;
187extern int arch_prepare_kprobe(struct kprobe *p); 196extern int arch_prepare_kprobe(struct kprobe *p);
@@ -227,6 +236,7 @@ void unregister_kretprobe(struct kretprobe *rp);
227 236
228void kprobe_flush_task(struct task_struct *tk); 237void kprobe_flush_task(struct task_struct *tk);
229void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); 238void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
239
230#else /* CONFIG_KPROBES */ 240#else /* CONFIG_KPROBES */
231 241
232#define __kprobes /**/ 242#define __kprobes /**/
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 6fee3539893f..5d185635786e 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -24,6 +24,7 @@ struct kref {
24 atomic_t refcount; 24 atomic_t refcount;
25}; 25};
26 26
27void kref_set(struct kref *kref, int num);
27void kref_init(struct kref *kref); 28void kref_init(struct kref *kref);
28void kref_get(struct kref *kref); 29void kref_get(struct kref *kref);
29int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 30int kref_put(struct kref *kref, void (*release) (struct kref *kref));
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 057a7f34ee36..4de4fd2d8607 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -9,12 +9,10 @@
9 9
10#include <asm/types.h> 10#include <asm/types.h>
11#include <linux/ioctl.h> 11#include <linux/ioctl.h>
12#include <asm/kvm.h>
12 13
13#define KVM_API_VERSION 12 14#define KVM_API_VERSION 12
14 15
15/* Architectural interrupt line count. */
16#define KVM_NR_INTERRUPTS 256
17
18/* for KVM_CREATE_MEMORY_REGION */ 16/* for KVM_CREATE_MEMORY_REGION */
19struct kvm_memory_region { 17struct kvm_memory_region {
20 __u32 slot; 18 __u32 slot;
@@ -23,17 +21,19 @@ struct kvm_memory_region {
23 __u64 memory_size; /* bytes */ 21 __u64 memory_size; /* bytes */
24}; 22};
25 23
26/* for kvm_memory_region::flags */ 24/* for KVM_SET_USER_MEMORY_REGION */
27#define KVM_MEM_LOG_DIRTY_PAGES 1UL 25struct kvm_userspace_memory_region {
28 26 __u32 slot;
29struct kvm_memory_alias {
30 __u32 slot; /* this has a different namespace than memory slots */
31 __u32 flags; 27 __u32 flags;
32 __u64 guest_phys_addr; 28 __u64 guest_phys_addr;
33 __u64 memory_size; 29 __u64 memory_size; /* bytes */
34 __u64 target_phys_addr; 30 __u64 userspace_addr; /* start of the userspace allocated memory */
35}; 31};
36 32
33/* for kvm_memory_region::flags */
34#define KVM_MEM_LOG_DIRTY_PAGES 1UL
35
36
37/* for KVM_IRQ_LINE */ 37/* for KVM_IRQ_LINE */
38struct kvm_irq_level { 38struct kvm_irq_level {
39 /* 39 /*
@@ -45,62 +45,18 @@ struct kvm_irq_level {
45 __u32 level; 45 __u32 level;
46}; 46};
47 47
48/* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */
49struct kvm_pic_state {
50 __u8 last_irr; /* edge detection */
51 __u8 irr; /* interrupt request register */
52 __u8 imr; /* interrupt mask register */
53 __u8 isr; /* interrupt service register */
54 __u8 priority_add; /* highest irq priority */
55 __u8 irq_base;
56 __u8 read_reg_select;
57 __u8 poll;
58 __u8 special_mask;
59 __u8 init_state;
60 __u8 auto_eoi;
61 __u8 rotate_on_auto_eoi;
62 __u8 special_fully_nested_mode;
63 __u8 init4; /* true if 4 byte init */
64 __u8 elcr; /* PIIX edge/trigger selection */
65 __u8 elcr_mask;
66};
67
68#define KVM_IOAPIC_NUM_PINS 24
69struct kvm_ioapic_state {
70 __u64 base_address;
71 __u32 ioregsel;
72 __u32 id;
73 __u32 irr;
74 __u32 pad;
75 union {
76 __u64 bits;
77 struct {
78 __u8 vector;
79 __u8 delivery_mode:3;
80 __u8 dest_mode:1;
81 __u8 delivery_status:1;
82 __u8 polarity:1;
83 __u8 remote_irr:1;
84 __u8 trig_mode:1;
85 __u8 mask:1;
86 __u8 reserve:7;
87 __u8 reserved[4];
88 __u8 dest_id;
89 } fields;
90 } redirtbl[KVM_IOAPIC_NUM_PINS];
91};
92
93#define KVM_IRQCHIP_PIC_MASTER 0
94#define KVM_IRQCHIP_PIC_SLAVE 1
95#define KVM_IRQCHIP_IOAPIC 2
96 48
97struct kvm_irqchip { 49struct kvm_irqchip {
98 __u32 chip_id; 50 __u32 chip_id;
99 __u32 pad; 51 __u32 pad;
100 union { 52 union {
101 char dummy[512]; /* reserving space */ 53 char dummy[512]; /* reserving space */
54#ifdef CONFIG_X86
102 struct kvm_pic_state pic; 55 struct kvm_pic_state pic;
56#endif
57#if defined(CONFIG_X86) || defined(CONFIG_IA64)
103 struct kvm_ioapic_state ioapic; 58 struct kvm_ioapic_state ioapic;
59#endif
104 } chip; 60 } chip;
105}; 61};
106 62
@@ -116,6 +72,7 @@ struct kvm_irqchip {
116#define KVM_EXIT_FAIL_ENTRY 9 72#define KVM_EXIT_FAIL_ENTRY 9
117#define KVM_EXIT_INTR 10 73#define KVM_EXIT_INTR 10
118#define KVM_EXIT_SET_TPR 11 74#define KVM_EXIT_SET_TPR 11
75#define KVM_EXIT_TPR_ACCESS 12
119 76
120/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 77/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
121struct kvm_run { 78struct kvm_run {
@@ -174,90 +131,17 @@ struct kvm_run {
174 __u32 longmode; 131 __u32 longmode;
175 __u32 pad; 132 __u32 pad;
176 } hypercall; 133 } hypercall;
134 /* KVM_EXIT_TPR_ACCESS */
135 struct {
136 __u64 rip;
137 __u32 is_write;
138 __u32 pad;
139 } tpr_access;
177 /* Fix the size of the union. */ 140 /* Fix the size of the union. */
178 char padding[256]; 141 char padding[256];
179 }; 142 };
180}; 143};
181 144
182/* for KVM_GET_REGS and KVM_SET_REGS */
183struct kvm_regs {
184 /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */
185 __u64 rax, rbx, rcx, rdx;
186 __u64 rsi, rdi, rsp, rbp;
187 __u64 r8, r9, r10, r11;
188 __u64 r12, r13, r14, r15;
189 __u64 rip, rflags;
190};
191
192/* for KVM_GET_FPU and KVM_SET_FPU */
193struct kvm_fpu {
194 __u8 fpr[8][16];
195 __u16 fcw;
196 __u16 fsw;
197 __u8 ftwx; /* in fxsave format */
198 __u8 pad1;
199 __u16 last_opcode;
200 __u64 last_ip;
201 __u64 last_dp;
202 __u8 xmm[16][16];
203 __u32 mxcsr;
204 __u32 pad2;
205};
206
207/* for KVM_GET_LAPIC and KVM_SET_LAPIC */
208#define KVM_APIC_REG_SIZE 0x400
209struct kvm_lapic_state {
210 char regs[KVM_APIC_REG_SIZE];
211};
212
213struct kvm_segment {
214 __u64 base;
215 __u32 limit;
216 __u16 selector;
217 __u8 type;
218 __u8 present, dpl, db, s, l, g, avl;
219 __u8 unusable;
220 __u8 padding;
221};
222
223struct kvm_dtable {
224 __u64 base;
225 __u16 limit;
226 __u16 padding[3];
227};
228
229/* for KVM_GET_SREGS and KVM_SET_SREGS */
230struct kvm_sregs {
231 /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */
232 struct kvm_segment cs, ds, es, fs, gs, ss;
233 struct kvm_segment tr, ldt;
234 struct kvm_dtable gdt, idt;
235 __u64 cr0, cr2, cr3, cr4, cr8;
236 __u64 efer;
237 __u64 apic_base;
238 __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64];
239};
240
241struct kvm_msr_entry {
242 __u32 index;
243 __u32 reserved;
244 __u64 data;
245};
246
247/* for KVM_GET_MSRS and KVM_SET_MSRS */
248struct kvm_msrs {
249 __u32 nmsrs; /* number of msrs in entries */
250 __u32 pad;
251
252 struct kvm_msr_entry entries[0];
253};
254
255/* for KVM_GET_MSR_INDEX_LIST */
256struct kvm_msr_list {
257 __u32 nmsrs; /* number of msrs in entries */
258 __u32 indices[0];
259};
260
261/* for KVM_TRANSLATE */ 145/* for KVM_TRANSLATE */
262struct kvm_translation { 146struct kvm_translation {
263 /* in */ 147 /* in */
@@ -302,28 +186,24 @@ struct kvm_dirty_log {
302 }; 186 };
303}; 187};
304 188
305struct kvm_cpuid_entry {
306 __u32 function;
307 __u32 eax;
308 __u32 ebx;
309 __u32 ecx;
310 __u32 edx;
311 __u32 padding;
312};
313
314/* for KVM_SET_CPUID */
315struct kvm_cpuid {
316 __u32 nent;
317 __u32 padding;
318 struct kvm_cpuid_entry entries[0];
319};
320
321/* for KVM_SET_SIGNAL_MASK */ 189/* for KVM_SET_SIGNAL_MASK */
322struct kvm_signal_mask { 190struct kvm_signal_mask {
323 __u32 len; 191 __u32 len;
324 __u8 sigset[0]; 192 __u8 sigset[0];
325}; 193};
326 194
195/* for KVM_TPR_ACCESS_REPORTING */
196struct kvm_tpr_access_ctl {
197 __u32 enabled;
198 __u32 flags;
199 __u32 reserved[8];
200};
201
202/* for KVM_SET_VAPIC_ADDR */
203struct kvm_vapic_addr {
204 __u64 vapic_addr;
205};
206
327#define KVMIO 0xAE 207#define KVMIO 0xAE
328 208
329/* 209/*
@@ -347,11 +227,21 @@ struct kvm_signal_mask {
347 */ 227 */
348#define KVM_CAP_IRQCHIP 0 228#define KVM_CAP_IRQCHIP 0
349#define KVM_CAP_HLT 1 229#define KVM_CAP_HLT 1
230#define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2
231#define KVM_CAP_USER_MEMORY 3
232#define KVM_CAP_SET_TSS_ADDR 4
233#define KVM_CAP_EXT_CPUID 5
234#define KVM_CAP_VAPIC 6
350 235
351/* 236/*
352 * ioctls for VM fds 237 * ioctls for VM fds
353 */ 238 */
354#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) 239#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
240#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
241#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
242#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\
243 struct kvm_userspace_memory_region)
244#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
355/* 245/*
356 * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns 246 * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
357 * a vcpu fd. 247 * a vcpu fd.
@@ -359,6 +249,7 @@ struct kvm_signal_mask {
359#define KVM_CREATE_VCPU _IO(KVMIO, 0x41) 249#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
360#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) 250#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
361#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) 251#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias)
252#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x48, struct kvm_cpuid2)
362/* Device model IOC */ 253/* Device model IOC */
363#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) 254#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
364#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) 255#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
@@ -384,5 +275,11 @@ struct kvm_signal_mask {
384#define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu) 275#define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu)
385#define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state) 276#define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state)
386#define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state) 277#define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state)
278#define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2)
279#define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2)
280/* Available with KVM_CAP_VAPIC */
281#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl)
282/* Available with KVM_CAP_VAPIC */
283#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr)
387 284
388#endif 285#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
new file mode 100644
index 000000000000..ea4764b0a2f4
--- /dev/null
+++ b/include/linux/kvm_host.h
@@ -0,0 +1,299 @@
1#ifndef __KVM_HOST_H
2#define __KVM_HOST_H
3
4/*
5 * This work is licensed under the terms of the GNU GPL, version 2. See
6 * the COPYING file in the top-level directory.
7 */
8
9#include <linux/types.h>
10#include <linux/hardirq.h>
11#include <linux/list.h>
12#include <linux/mutex.h>
13#include <linux/spinlock.h>
14#include <linux/signal.h>
15#include <linux/sched.h>
16#include <linux/mm.h>
17#include <linux/preempt.h>
18#include <asm/signal.h>
19
20#include <linux/kvm.h>
21#include <linux/kvm_para.h>
22
23#include <linux/kvm_types.h>
24
25#include <asm/kvm_host.h>
26
27#define KVM_MAX_VCPUS 4
28#define KVM_MEMORY_SLOTS 8
29/* memory slots that does not exposed to userspace */
30#define KVM_PRIVATE_MEM_SLOTS 4
31
32#define KVM_PIO_PAGE_OFFSET 1
33
34/*
35 * vcpu->requests bit members
36 */
37#define KVM_REQ_TLB_FLUSH 0
38#define KVM_REQ_MIGRATE_TIMER 1
39#define KVM_REQ_REPORT_TPR_ACCESS 2
40
41struct kvm_vcpu;
42extern struct kmem_cache *kvm_vcpu_cache;
43
44struct kvm_guest_debug {
45 int enabled;
46 unsigned long bp[4];
47 int singlestep;
48};
49
50/*
51 * It would be nice to use something smarter than a linear search, TBD...
52 * Thankfully we dont expect many devices to register (famous last words :),
53 * so until then it will suffice. At least its abstracted so we can change
54 * in one place.
55 */
56struct kvm_io_bus {
57 int dev_count;
58#define NR_IOBUS_DEVS 6
59 struct kvm_io_device *devs[NR_IOBUS_DEVS];
60};
61
62void kvm_io_bus_init(struct kvm_io_bus *bus);
63void kvm_io_bus_destroy(struct kvm_io_bus *bus);
64struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus, gpa_t addr);
65void kvm_io_bus_register_dev(struct kvm_io_bus *bus,
66 struct kvm_io_device *dev);
67
68struct kvm_vcpu {
69 struct kvm *kvm;
70 struct preempt_notifier preempt_notifier;
71 int vcpu_id;
72 struct mutex mutex;
73 int cpu;
74 struct kvm_run *run;
75 int guest_mode;
76 unsigned long requests;
77 struct kvm_guest_debug guest_debug;
78 int fpu_active;
79 int guest_fpu_loaded;
80 wait_queue_head_t wq;
81 int sigset_active;
82 sigset_t sigset;
83 struct kvm_vcpu_stat stat;
84
85#ifdef CONFIG_HAS_IOMEM
86 int mmio_needed;
87 int mmio_read_completed;
88 int mmio_is_write;
89 int mmio_size;
90 unsigned char mmio_data[8];
91 gpa_t mmio_phys_addr;
92#endif
93
94 struct kvm_vcpu_arch arch;
95};
96
97struct kvm_memory_slot {
98 gfn_t base_gfn;
99 unsigned long npages;
100 unsigned long flags;
101 unsigned long *rmap;
102 unsigned long *dirty_bitmap;
103 unsigned long userspace_addr;
104 int user_alloc;
105};
106
107struct kvm {
108 struct mutex lock; /* protects the vcpus array and APIC accesses */
109 spinlock_t mmu_lock;
110 struct mm_struct *mm; /* userspace tied to this vm */
111 int nmemslots;
112 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +
113 KVM_PRIVATE_MEM_SLOTS];
114 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
115 struct list_head vm_list;
116 struct file *filp;
117 struct kvm_io_bus mmio_bus;
118 struct kvm_io_bus pio_bus;
119 struct kvm_vm_stat stat;
120 struct kvm_arch arch;
121};
122
123/* The guest did something we don't support. */
124#define pr_unimpl(vcpu, fmt, ...) \
125 do { \
126 if (printk_ratelimit()) \
127 printk(KERN_ERR "kvm: %i: cpu%i " fmt, \
128 current->tgid, (vcpu)->vcpu_id , ## __VA_ARGS__); \
129 } while (0)
130
131#define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt)
132#define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt)
133
134int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
135void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
136
137void vcpu_load(struct kvm_vcpu *vcpu);
138void vcpu_put(struct kvm_vcpu *vcpu);
139
140void decache_vcpus_on_cpu(int cpu);
141
142
143int kvm_init(void *opaque, unsigned int vcpu_size,
144 struct module *module);
145void kvm_exit(void);
146
147#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
148#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
149static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
150struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
151
152extern struct page *bad_page;
153
154int is_error_page(struct page *page);
155int kvm_is_error_hva(unsigned long addr);
156int kvm_set_memory_region(struct kvm *kvm,
157 struct kvm_userspace_memory_region *mem,
158 int user_alloc);
159int __kvm_set_memory_region(struct kvm *kvm,
160 struct kvm_userspace_memory_region *mem,
161 int user_alloc);
162int kvm_arch_set_memory_region(struct kvm *kvm,
163 struct kvm_userspace_memory_region *mem,
164 struct kvm_memory_slot old,
165 int user_alloc);
166gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
167struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
168void kvm_release_page_clean(struct page *page);
169void kvm_release_page_dirty(struct page *page);
170int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset,
171 int len);
172int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data,
173 unsigned long len);
174int kvm_read_guest(struct kvm *kvm, gpa_t gpa, void *data, unsigned long len);
175int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
176 int offset, int len);
177int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
178 unsigned long len);
179int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
180int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
181struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
182int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn);
183void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
184
185void kvm_vcpu_block(struct kvm_vcpu *vcpu);
186void kvm_resched(struct kvm_vcpu *vcpu);
187void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
188void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
189void kvm_flush_remote_tlbs(struct kvm *kvm);
190
191long kvm_arch_dev_ioctl(struct file *filp,
192 unsigned int ioctl, unsigned long arg);
193long kvm_arch_vcpu_ioctl(struct file *filp,
194 unsigned int ioctl, unsigned long arg);
195void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
196void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
197
198int kvm_dev_ioctl_check_extension(long ext);
199
200int kvm_get_dirty_log(struct kvm *kvm,
201 struct kvm_dirty_log *log, int *is_dirty);
202int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
203 struct kvm_dirty_log *log);
204
205int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
206 struct
207 kvm_userspace_memory_region *mem,
208 int user_alloc);
209long kvm_arch_vm_ioctl(struct file *filp,
210 unsigned int ioctl, unsigned long arg);
211void kvm_arch_destroy_vm(struct kvm *kvm);
212
213int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
214int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
215
216int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
217 struct kvm_translation *tr);
218
219int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs);
220int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs);
221int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
222 struct kvm_sregs *sregs);
223int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
224 struct kvm_sregs *sregs);
225int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
226 struct kvm_debug_guest *dbg);
227int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
228
229int kvm_arch_init(void *opaque);
230void kvm_arch_exit(void);
231
232int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu);
233void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu);
234
235void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
236void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
237void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
238struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id);
239int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu);
240void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
241
242int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu);
243void kvm_arch_hardware_enable(void *garbage);
244void kvm_arch_hardware_disable(void *garbage);
245int kvm_arch_hardware_setup(void);
246void kvm_arch_hardware_unsetup(void);
247void kvm_arch_check_processor_compat(void *rtn);
248int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
249
250void kvm_free_physmem(struct kvm *kvm);
251
252struct kvm *kvm_arch_create_vm(void);
253void kvm_arch_destroy_vm(struct kvm *kvm);
254
255int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
256int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
257void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
258
259static inline void kvm_guest_enter(void)
260{
261 account_system_vtime(current);
262 current->flags |= PF_VCPU;
263}
264
265static inline void kvm_guest_exit(void)
266{
267 account_system_vtime(current);
268 current->flags &= ~PF_VCPU;
269}
270
271static inline int memslot_id(struct kvm *kvm, struct kvm_memory_slot *slot)
272{
273 return slot - kvm->memslots;
274}
275
276static inline gpa_t gfn_to_gpa(gfn_t gfn)
277{
278 return (gpa_t)gfn << PAGE_SHIFT;
279}
280
281static inline void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu)
282{
283 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
284}
285
286enum kvm_stat_kind {
287 KVM_STAT_VM,
288 KVM_STAT_VCPU,
289};
290
291struct kvm_stats_debugfs_item {
292 const char *name;
293 int offset;
294 enum kvm_stat_kind kind;
295 struct dentry *dentry;
296};
297extern struct kvm_stats_debugfs_item debugfs_entries[];
298
299#endif
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index 3b292565a693..5497aac0d2f8 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -2,72 +2,30 @@
2#define __LINUX_KVM_PARA_H 2#define __LINUX_KVM_PARA_H
3 3
4/* 4/*
5 * Guest OS interface for KVM paravirtualization 5 * This header file provides a method for making a hypercall to the host
6 * 6 * Architectures should define:
7 * Note: this interface is totally experimental, and is certain to change 7 * - kvm_hypercall0, kvm_hypercall1...
8 * as we make progress. 8 * - kvm_arch_para_features
9 * - kvm_para_available
9 */ 10 */
10 11
11/* 12/* Return values for hypercalls */
12 * Per-VCPU descriptor area shared between guest and host. Writable to 13#define KVM_ENOSYS 1000
13 * both guest and host. Registered with the host by the guest when
14 * a guest acknowledges paravirtual mode.
15 *
16 * NOTE: all addresses are guest-physical addresses (gpa), to make it
17 * easier for the hypervisor to map between the various addresses.
18 */
19struct kvm_vcpu_para_state {
20 /*
21 * API version information for compatibility. If there's any support
22 * mismatch (too old host trying to execute too new guest) then
23 * the host will deny entry into paravirtual mode. Any other
24 * combination (new host + old guest and new host + new guest)
25 * is supposed to work - new host versions will support all old
26 * guest API versions.
27 */
28 u32 guest_version;
29 u32 host_version;
30 u32 size;
31 u32 ret;
32
33 /*
34 * The address of the vm exit instruction (VMCALL or VMMCALL),
35 * which the host will patch according to the CPU model the
36 * VM runs on:
37 */
38 u64 hypercall_gpa;
39
40} __attribute__ ((aligned(PAGE_SIZE)));
41
42#define KVM_PARA_API_VERSION 1
43
44/*
45 * This is used for an RDMSR's ECX parameter to probe for a KVM host.
46 * Hopefully no CPU vendor will use up this number. This is placed well
47 * out of way of the typical space occupied by CPU vendors' MSR indices,
48 * and we think (or at least hope) it wont be occupied in the future
49 * either.
50 */
51#define MSR_KVM_API_MAGIC 0x87655678
52 14
53#define KVM_EINVAL 1 15#define KVM_HC_VAPIC_POLL_IRQ 1
54 16
55/* 17/*
56 * Hypercall calling convention: 18 * hypercalls use architecture specific
57 *
58 * Each hypercall may have 0-6 parameters.
59 *
60 * 64-bit hypercall index is in RAX, goes from 0 to __NR_hypercalls-1
61 *
62 * 64-bit parameters 1-6 are in the standard gcc x86_64 calling convention
63 * order: RDI, RSI, RDX, RCX, R8, R9.
64 *
65 * 32-bit index is EBX, parameters are: EAX, ECX, EDX, ESI, EDI, EBP.
66 * (the first 3 are according to the gcc regparm calling convention)
67 *
68 * No registers are clobbered by the hypercall, except that the
69 * return value is in RAX.
70 */ 19 */
71#define __NR_hypercalls 0 20#include <asm/kvm_para.h>
21
22#ifdef __KERNEL__
23static inline int kvm_para_has_feature(unsigned int feature)
24{
25 if (kvm_arch_para_features() & (1UL << feature))
26 return 1;
27 return 0;
28}
29#endif /* __KERNEL__ */
30#endif /* __LINUX_KVM_PARA_H */
72 31
73#endif
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
new file mode 100644
index 000000000000..1c4e46decb22
--- /dev/null
+++ b/include/linux/kvm_types.h
@@ -0,0 +1,54 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 */
16
17#ifndef __KVM_TYPES_H__
18#define __KVM_TYPES_H__
19
20#include <asm/types.h>
21
22/*
23 * Address types:
24 *
25 * gva - guest virtual address
26 * gpa - guest physical address
27 * gfn - guest frame number
28 * hva - host virtual address
29 * hpa - host physical address
30 * hfn - host frame number
31 */
32
33typedef unsigned long gva_t;
34typedef u64 gpa_t;
35typedef unsigned long gfn_t;
36
37typedef unsigned long hva_t;
38typedef u64 hpa_t;
39typedef unsigned long hfn_t;
40
41struct kvm_pio_request {
42 unsigned long count;
43 int cur_count;
44 struct page *guest_pages[2];
45 unsigned guest_page_offset;
46 int in;
47 int port;
48 int size;
49 int string;
50 int down;
51 int rep;
52};
53
54#endif /* __KVM_TYPES_H__ */
diff --git a/include/linux/latencytop.h b/include/linux/latencytop.h
new file mode 100644
index 000000000000..901c2d6377a8
--- /dev/null
+++ b/include/linux/latencytop.h
@@ -0,0 +1,44 @@
1/*
2 * latencytop.h: Infrastructure for displaying latency
3 *
4 * (C) Copyright 2008 Intel Corporation
5 * Author: Arjan van de Ven <arjan@linux.intel.com>
6 *
7 */
8
9#ifndef _INCLUDE_GUARD_LATENCYTOP_H_
10#define _INCLUDE_GUARD_LATENCYTOP_H_
11
12#ifdef CONFIG_LATENCYTOP
13
14#define LT_SAVECOUNT 32
15#define LT_BACKTRACEDEPTH 12
16
17struct latency_record {
18 unsigned long backtrace[LT_BACKTRACEDEPTH];
19 unsigned int count;
20 unsigned long time;
21 unsigned long max;
22};
23
24
25struct task_struct;
26
27void account_scheduler_latency(struct task_struct *task, int usecs, int inter);
28
29void clear_all_latency_tracing(struct task_struct *p);
30
31#else
32
33static inline void
34account_scheduler_latency(struct task_struct *task, int usecs, int inter)
35{
36}
37
38static inline void clear_all_latency_tracing(struct task_struct *p)
39{
40}
41
42#endif
43
44#endif
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 124033cb5e9b..4374c4277780 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -35,6 +35,7 @@
35#include <linux/workqueue.h> 35#include <linux/workqueue.h>
36#include <scsi/scsi_host.h> 36#include <scsi/scsi_host.h>
37#include <linux/acpi.h> 37#include <linux/acpi.h>
38#include <linux/cdrom.h>
38 39
39/* 40/*
40 * Define if arch has non-standard setup. This is a _PCI_ standard 41 * Define if arch has non-standard setup. This is a _PCI_ standard
@@ -143,10 +144,11 @@ enum {
143 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */ 144 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */
144 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ 145 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */
145 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ 146 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
146 ATA_DFLAG_INIT_MASK = (1 << 16) - 1, 147 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
148 ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
147 149
148 ATA_DFLAG_DETACH = (1 << 16), 150 ATA_DFLAG_DETACH = (1 << 24),
149 ATA_DFLAG_DETACHED = (1 << 17), 151 ATA_DFLAG_DETACHED = (1 << 25),
150 152
151 ATA_DEV_UNKNOWN = 0, /* unknown device */ 153 ATA_DEV_UNKNOWN = 0, /* unknown device */
152 ATA_DEV_ATA = 1, /* ATA device */ 154 ATA_DEV_ATA = 1, /* ATA device */
@@ -217,9 +219,7 @@ enum {
217 219
218 /* struct ata_queued_cmd flags */ 220 /* struct ata_queued_cmd flags */
219 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ 221 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
220 ATA_QCFLAG_SG = (1 << 1), /* have s/g table? */ 222 ATA_QCFLAG_DMAMAP = (1 << 1), /* SG table is DMA mapped */
221 ATA_QCFLAG_SINGLE = (1 << 2), /* no s/g, just a single buffer */
222 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
223 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */ 223 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */
224 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ 224 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */
225 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */ 225 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */
@@ -266,19 +266,15 @@ enum {
266 PORT_DISABLED = 2, 266 PORT_DISABLED = 2,
267 267
268 /* encoding various smaller bitmaps into a single 268 /* encoding various smaller bitmaps into a single
269 * unsigned int bitmap 269 * unsigned long bitmap
270 */ 270 */
271 ATA_BITS_PIO = 7, 271 ATA_NR_PIO_MODES = 7,
272 ATA_BITS_MWDMA = 5, 272 ATA_NR_MWDMA_MODES = 5,
273 ATA_BITS_UDMA = 8, 273 ATA_NR_UDMA_MODES = 8,
274 274
275 ATA_SHIFT_PIO = 0, 275 ATA_SHIFT_PIO = 0,
276 ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_BITS_PIO, 276 ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_NR_PIO_MODES,
277 ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_BITS_MWDMA, 277 ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_NR_MWDMA_MODES,
278
279 ATA_MASK_PIO = ((1 << ATA_BITS_PIO) - 1) << ATA_SHIFT_PIO,
280 ATA_MASK_MWDMA = ((1 << ATA_BITS_MWDMA) - 1) << ATA_SHIFT_MWDMA,
281 ATA_MASK_UDMA = ((1 << ATA_BITS_UDMA) - 1) << ATA_SHIFT_UDMA,
282 278
283 /* size of buffer to pad xfers ending on unaligned boundaries */ 279 /* size of buffer to pad xfers ending on unaligned boundaries */
284 ATA_DMA_PAD_SZ = 4, 280 ATA_DMA_PAD_SZ = 4,
@@ -349,6 +345,21 @@ enum {
349 ATA_DMA_MASK_ATA = (1 << 0), /* DMA on ATA Disk */ 345 ATA_DMA_MASK_ATA = (1 << 0), /* DMA on ATA Disk */
350 ATA_DMA_MASK_ATAPI = (1 << 1), /* DMA on ATAPI */ 346 ATA_DMA_MASK_ATAPI = (1 << 1), /* DMA on ATAPI */
351 ATA_DMA_MASK_CFA = (1 << 2), /* DMA on CF Card */ 347 ATA_DMA_MASK_CFA = (1 << 2), /* DMA on CF Card */
348
349 /* ATAPI command types */
350 ATAPI_READ = 0, /* READs */
351 ATAPI_WRITE = 1, /* WRITEs */
352 ATAPI_READ_CD = 2, /* READ CD [MSF] */
353 ATAPI_MISC = 3, /* the rest */
354};
355
356enum ata_xfer_mask {
357 ATA_MASK_PIO = ((1LU << ATA_NR_PIO_MODES) - 1)
358 << ATA_SHIFT_PIO,
359 ATA_MASK_MWDMA = ((1LU << ATA_NR_MWDMA_MODES) - 1)
360 << ATA_SHIFT_MWDMA,
361 ATA_MASK_UDMA = ((1LU << ATA_NR_UDMA_MODES) - 1)
362 << ATA_SHIFT_UDMA,
352}; 363};
353 364
354enum hsm_task_states { 365enum hsm_task_states {
@@ -447,7 +458,7 @@ struct ata_queued_cmd {
447 unsigned int tag; 458 unsigned int tag;
448 unsigned int n_elem; 459 unsigned int n_elem;
449 unsigned int n_iter; 460 unsigned int n_iter;
450 unsigned int orig_n_elem; 461 unsigned int mapped_n_elem;
451 462
452 int dma_dir; 463 int dma_dir;
453 464
@@ -455,17 +466,18 @@ struct ata_queued_cmd {
455 unsigned int sect_size; 466 unsigned int sect_size;
456 467
457 unsigned int nbytes; 468 unsigned int nbytes;
469 unsigned int raw_nbytes;
458 unsigned int curbytes; 470 unsigned int curbytes;
459 471
460 struct scatterlist *cursg; 472 struct scatterlist *cursg;
461 unsigned int cursg_ofs; 473 unsigned int cursg_ofs;
462 474
475 struct scatterlist *last_sg;
476 struct scatterlist saved_last_sg;
463 struct scatterlist sgent; 477 struct scatterlist sgent;
464 struct scatterlist pad_sgent; 478 struct scatterlist extra_sg[2];
465 void *buf_virt;
466 479
467 /* DO NOT iterate over __sg manually, use ata_for_each_sg() */ 480 struct scatterlist *sg;
468 struct scatterlist *__sg;
469 481
470 unsigned int err_mask; 482 unsigned int err_mask;
471 struct ata_taskfile result_tf; 483 struct ata_taskfile result_tf;
@@ -482,7 +494,7 @@ struct ata_port_stats {
482}; 494};
483 495
484struct ata_ering_entry { 496struct ata_ering_entry {
485 int is_io; 497 unsigned int eflags;
486 unsigned int err_mask; 498 unsigned int err_mask;
487 u64 timestamp; 499 u64 timestamp;
488}; 500};
@@ -522,9 +534,9 @@ struct ata_device {
522 unsigned int cdb_len; 534 unsigned int cdb_len;
523 535
524 /* per-dev xfer mask */ 536 /* per-dev xfer mask */
525 unsigned int pio_mask; 537 unsigned long pio_mask;
526 unsigned int mwdma_mask; 538 unsigned long mwdma_mask;
527 unsigned int udma_mask; 539 unsigned long udma_mask;
528 540
529 /* for CHS addressing */ 541 /* for CHS addressing */
530 u16 cylinders; /* Number of cylinders */ 542 u16 cylinders; /* Number of cylinders */
@@ -560,6 +572,8 @@ struct ata_eh_context {
560 int tries[ATA_MAX_DEVICES]; 572 int tries[ATA_MAX_DEVICES];
561 unsigned int classes[ATA_MAX_DEVICES]; 573 unsigned int classes[ATA_MAX_DEVICES];
562 unsigned int did_probe_mask; 574 unsigned int did_probe_mask;
575 unsigned int saved_ncq_enabled;
576 u8 saved_xfer_mode[ATA_MAX_DEVICES];
563}; 577};
564 578
565struct ata_acpi_drive 579struct ata_acpi_drive
@@ -686,7 +700,8 @@ struct ata_port_operations {
686 void (*bmdma_setup) (struct ata_queued_cmd *qc); 700 void (*bmdma_setup) (struct ata_queued_cmd *qc);
687 void (*bmdma_start) (struct ata_queued_cmd *qc); 701 void (*bmdma_start) (struct ata_queued_cmd *qc);
688 702
689 void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int); 703 unsigned int (*data_xfer) (struct ata_device *dev, unsigned char *buf,
704 unsigned int buflen, int rw);
690 705
691 int (*qc_defer) (struct ata_queued_cmd *qc); 706 int (*qc_defer) (struct ata_queued_cmd *qc);
692 void (*qc_prep) (struct ata_queued_cmd *qc); 707 void (*qc_prep) (struct ata_queued_cmd *qc);
@@ -832,8 +847,6 @@ extern int ata_busy_sleep(struct ata_port *ap,
832 unsigned long timeout_pat, unsigned long timeout); 847 unsigned long timeout_pat, unsigned long timeout);
833extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline); 848extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline);
834extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline); 849extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline);
835extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
836 void *data, unsigned long delay);
837extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 850extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
838 unsigned long interval_msec, 851 unsigned long interval_msec,
839 unsigned long timeout_msec); 852 unsigned long timeout_msec);
@@ -848,6 +861,16 @@ extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
848extern void ata_tf_to_fis(const struct ata_taskfile *tf, 861extern void ata_tf_to_fis(const struct ata_taskfile *tf,
849 u8 pmp, int is_cmd, u8 *fis); 862 u8 pmp, int is_cmd, u8 *fis);
850extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); 863extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
864extern unsigned long ata_pack_xfermask(unsigned long pio_mask,
865 unsigned long mwdma_mask, unsigned long udma_mask);
866extern void ata_unpack_xfermask(unsigned long xfer_mask,
867 unsigned long *pio_mask, unsigned long *mwdma_mask,
868 unsigned long *udma_mask);
869extern u8 ata_xfer_mask2mode(unsigned long xfer_mask);
870extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
871extern int ata_xfer_mode2shift(unsigned long xfer_mode);
872extern const char *ata_mode_string(unsigned long xfer_mask);
873extern unsigned long ata_id_xfermask(const u16 *id);
851extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device); 874extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device);
852extern void ata_std_dev_select(struct ata_port *ap, unsigned int device); 875extern void ata_std_dev_select(struct ata_port *ap, unsigned int device);
853extern u8 ata_check_status(struct ata_port *ap); 876extern u8 ata_check_status(struct ata_port *ap);
@@ -856,17 +879,15 @@ extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
856extern int ata_port_start(struct ata_port *ap); 879extern int ata_port_start(struct ata_port *ap);
857extern int ata_sff_port_start(struct ata_port *ap); 880extern int ata_sff_port_start(struct ata_port *ap);
858extern irqreturn_t ata_interrupt(int irq, void *dev_instance); 881extern irqreturn_t ata_interrupt(int irq, void *dev_instance);
859extern void ata_data_xfer(struct ata_device *adev, unsigned char *buf, 882extern unsigned int ata_data_xfer(struct ata_device *dev,
860 unsigned int buflen, int write_data); 883 unsigned char *buf, unsigned int buflen, int rw);
861extern void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf, 884extern unsigned int ata_data_xfer_noirq(struct ata_device *dev,
862 unsigned int buflen, int write_data); 885 unsigned char *buf, unsigned int buflen, int rw);
863extern int ata_std_qc_defer(struct ata_queued_cmd *qc); 886extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
864extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc); 887extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc);
865extern void ata_qc_prep(struct ata_queued_cmd *qc); 888extern void ata_qc_prep(struct ata_queued_cmd *qc);
866extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 889extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
867extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); 890extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
868extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
869 unsigned int buflen);
870extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 891extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
871 unsigned int n_elem); 892 unsigned int n_elem);
872extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); 893extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
@@ -875,7 +896,6 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
875 unsigned int ofs, unsigned int len); 896 unsigned int ofs, unsigned int len);
876extern void ata_id_c_string(const u16 *id, unsigned char *s, 897extern void ata_id_c_string(const u16 *id, unsigned char *s,
877 unsigned int ofs, unsigned int len); 898 unsigned int ofs, unsigned int len);
878extern void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown);
879extern void ata_bmdma_setup(struct ata_queued_cmd *qc); 899extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
880extern void ata_bmdma_start(struct ata_queued_cmd *qc); 900extern void ata_bmdma_start(struct ata_queued_cmd *qc);
881extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 901extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
@@ -910,6 +930,7 @@ extern u8 ata_irq_on(struct ata_port *ap);
910extern int ata_cable_40wire(struct ata_port *ap); 930extern int ata_cable_40wire(struct ata_port *ap);
911extern int ata_cable_80wire(struct ata_port *ap); 931extern int ata_cable_80wire(struct ata_port *ap);
912extern int ata_cable_sata(struct ata_port *ap); 932extern int ata_cable_sata(struct ata_port *ap);
933extern int ata_cable_ignore(struct ata_port *ap);
913extern int ata_cable_unknown(struct ata_port *ap); 934extern int ata_cable_unknown(struct ata_port *ap);
914 935
915/* 936/*
@@ -917,11 +938,13 @@ extern int ata_cable_unknown(struct ata_port *ap);
917 */ 938 */
918 939
919extern unsigned int ata_pio_need_iordy(const struct ata_device *); 940extern unsigned int ata_pio_need_iordy(const struct ata_device *);
941extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
920extern int ata_timing_compute(struct ata_device *, unsigned short, 942extern int ata_timing_compute(struct ata_device *, unsigned short,
921 struct ata_timing *, int, int); 943 struct ata_timing *, int, int);
922extern void ata_timing_merge(const struct ata_timing *, 944extern void ata_timing_merge(const struct ata_timing *,
923 const struct ata_timing *, struct ata_timing *, 945 const struct ata_timing *, struct ata_timing *,
924 unsigned int); 946 unsigned int);
947extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle);
925 948
926enum { 949enum {
927 ATA_TIMING_SETUP = (1 << 0), 950 ATA_TIMING_SETUP = (1 << 0),
@@ -948,15 +971,40 @@ static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
948 return &ap->__acpi_init_gtm; 971 return &ap->__acpi_init_gtm;
949 return NULL; 972 return NULL;
950} 973}
951extern int ata_acpi_cbl_80wire(struct ata_port *ap);
952int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm); 974int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm);
953int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm); 975int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm);
976unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev,
977 const struct ata_acpi_gtm *gtm);
978int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm);
954#else 979#else
955static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) 980static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
956{ 981{
957 return NULL; 982 return NULL;
958} 983}
959static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; } 984
985static inline int ata_acpi_stm(const struct ata_port *ap,
986 struct ata_acpi_gtm *stm)
987{
988 return -ENOSYS;
989}
990
991static inline int ata_acpi_gtm(const struct ata_port *ap,
992 struct ata_acpi_gtm *stm)
993{
994 return -ENOSYS;
995}
996
997static inline unsigned int ata_acpi_gtm_xfermask(struct ata_device *dev,
998 const struct ata_acpi_gtm *gtm)
999{
1000 return 0;
1001}
1002
1003static inline int ata_acpi_cbl_80wire(struct ata_port *ap,
1004 const struct ata_acpi_gtm *gtm)
1005{
1006 return 0;
1007}
960#endif 1008#endif
961 1009
962#ifdef CONFIG_PCI 1010#ifdef CONFIG_PCI
@@ -985,8 +1033,12 @@ extern int ata_pci_init_bmdma(struct ata_host *host);
985extern int ata_pci_prepare_sff_host(struct pci_dev *pdev, 1033extern int ata_pci_prepare_sff_host(struct pci_dev *pdev,
986 const struct ata_port_info * const * ppi, 1034 const struct ata_port_info * const * ppi,
987 struct ata_host **r_host); 1035 struct ata_host **r_host);
1036extern int ata_pci_activate_sff_host(struct ata_host *host,
1037 irq_handler_t irq_handler,
1038 struct scsi_host_template *sht);
988extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); 1039extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
989extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long); 1040extern unsigned long ata_pci_default_filter(struct ata_device *dev,
1041 unsigned long xfer_mask);
990#endif /* CONFIG_PCI */ 1042#endif /* CONFIG_PCI */
991 1043
992/* 1044/*
@@ -1074,35 +1126,6 @@ extern void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset,
1074 const char *name); 1126 const char *name);
1075#endif 1127#endif
1076 1128
1077/*
1078 * qc helpers
1079 */
1080static inline struct scatterlist *
1081ata_qc_first_sg(struct ata_queued_cmd *qc)
1082{
1083 qc->n_iter = 0;
1084 if (qc->n_elem)
1085 return qc->__sg;
1086 if (qc->pad_len)
1087 return &qc->pad_sgent;
1088 return NULL;
1089}
1090
1091static inline struct scatterlist *
1092ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
1093{
1094 if (sg == &qc->pad_sgent)
1095 return NULL;
1096 if (++qc->n_iter < qc->n_elem)
1097 return sg_next(sg);
1098 if (qc->pad_len)
1099 return &qc->pad_sgent;
1100 return NULL;
1101}
1102
1103#define ata_for_each_sg(sg, qc) \
1104 for (sg = ata_qc_first_sg(qc); sg; sg = ata_qc_next_sg(sg, qc))
1105
1106static inline unsigned int ata_tag_valid(unsigned int tag) 1129static inline unsigned int ata_tag_valid(unsigned int tag)
1107{ 1130{
1108 return (tag < ATA_MAX_QUEUE) ? 1 : 0; 1131 return (tag < ATA_MAX_QUEUE) ? 1 : 0;
@@ -1337,15 +1360,17 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
1337static inline void ata_qc_reinit(struct ata_queued_cmd *qc) 1360static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1338{ 1361{
1339 qc->dma_dir = DMA_NONE; 1362 qc->dma_dir = DMA_NONE;
1340 qc->__sg = NULL; 1363 qc->sg = NULL;
1341 qc->flags = 0; 1364 qc->flags = 0;
1342 qc->cursg = NULL; 1365 qc->cursg = NULL;
1343 qc->cursg_ofs = 0; 1366 qc->cursg_ofs = 0;
1344 qc->nbytes = qc->curbytes = 0; 1367 qc->nbytes = qc->raw_nbytes = qc->curbytes = 0;
1345 qc->n_elem = 0; 1368 qc->n_elem = 0;
1369 qc->mapped_n_elem = 0;
1346 qc->n_iter = 0; 1370 qc->n_iter = 0;
1347 qc->err_mask = 0; 1371 qc->err_mask = 0;
1348 qc->pad_len = 0; 1372 qc->pad_len = 0;
1373 qc->last_sg = NULL;
1349 qc->sect_size = ATA_SECT_SIZE; 1374 qc->sect_size = ATA_SECT_SIZE;
1350 1375
1351 ata_tf_init(qc->dev, &qc->tf); 1376 ata_tf_init(qc->dev, &qc->tf);
@@ -1362,6 +1387,27 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)
1362 ata_id_has_flush_ext(dev->id); 1387 ata_id_has_flush_ext(dev->id);
1363} 1388}
1364 1389
1390static inline int atapi_cmd_type(u8 opcode)
1391{
1392 switch (opcode) {
1393 case GPCMD_READ_10:
1394 case GPCMD_READ_12:
1395 return ATAPI_READ;
1396
1397 case GPCMD_WRITE_10:
1398 case GPCMD_WRITE_12:
1399 case GPCMD_WRITE_AND_VERIFY_10:
1400 return ATAPI_WRITE;
1401
1402 case GPCMD_READ_CD:
1403 case GPCMD_READ_CD_MSF:
1404 return ATAPI_READ_CD;
1405
1406 default:
1407 return ATAPI_MISC;
1408 }
1409}
1410
1365static inline unsigned int ac_err_mask(u8 status) 1411static inline unsigned int ac_err_mask(u8 status)
1366{ 1412{
1367 if (status & (ATA_BUSY | ATA_DRQ)) 1413 if (status & (ATA_BUSY | ATA_DRQ))
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index ff203dd02919..3faf599ea58e 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -13,6 +13,10 @@
13#define asmlinkage CPP_ASMLINKAGE 13#define asmlinkage CPP_ASMLINKAGE
14#endif 14#endif
15 15
16#ifndef asmregparm
17# define asmregparm
18#endif
19
16#ifndef prevent_tail_call 20#ifndef prevent_tail_call
17# define prevent_tail_call(ret) do { } while (0) 21# define prevent_tail_call(ret) do { } while (0)
18#endif 22#endif
@@ -53,6 +57,10 @@
53 .size name, .-name 57 .size name, .-name
54#endif 58#endif
55 59
60/* If symbol 'name' is treated as a subroutine (gets called, and returns)
61 * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
62 * static analysis tools such as stack depth analyzer.
63 */
56#ifndef ENDPROC 64#ifndef ENDPROC
57#define ENDPROC(name) \ 65#define ENDPROC(name) \
58 .type name, @function; \ 66 .type name, @function; \
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 6f1637c61e10..3d25bcd139d1 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -33,9 +33,26 @@ struct nlmsvc_binding {
33extern struct nlmsvc_binding * nlmsvc_ops; 33extern struct nlmsvc_binding * nlmsvc_ops;
34 34
35/* 35/*
36 * Similar to nfs_client_initdata, but without the NFS-specific
37 * rpc_ops field.
38 */
39struct nlmclnt_initdata {
40 const char *hostname;
41 const struct sockaddr *address;
42 size_t addrlen;
43 unsigned short protocol;
44 u32 nfs_version;
45};
46
47/*
36 * Functions exported by the lockd module 48 * Functions exported by the lockd module
37 */ 49 */
38extern int nlmclnt_proc(struct inode *, int, struct file_lock *); 50
51extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
52extern void nlmclnt_done(struct nlm_host *host);
53
54extern int nlmclnt_proc(struct nlm_host *host, int cmd,
55 struct file_lock *fl);
39extern int lockd_up(int proto); 56extern int lockd_up(int proto);
40extern void lockd_down(void); 57extern void lockd_down(void);
41 58
diff --git a/include/linux/m41t00.h b/include/linux/m41t00.h
deleted file mode 100644
index b423360ca38e..000000000000
--- a/include/linux/m41t00.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Definitions for the ST M41T00 family of i2c rtc chips.
3 *
4 * Author: Mark A. Greer <mgreer@mvista.com>
5 *
6 * 2005, 2006 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifndef _M41T00_H
13#define _M41T00_H
14
15#define M41T00_DRV_NAME "m41t00"
16#define M41T00_I2C_ADDR 0x68
17
18#define M41T00_TYPE_M41T00 0
19#define M41T00_TYPE_M41T81 81
20#define M41T00_TYPE_M41T85 85
21
22struct m41t00_platform_data {
23 u8 type;
24 u8 i2c_addr;
25 u8 sqw_freq;
26};
27
28/* SQW output disabled, this is default value by power on */
29#define M41T00_SQW_DISABLE (0)
30
31#define M41T00_SQW_32KHZ (1<<4) /* 32.768 KHz */
32#define M41T00_SQW_8KHZ (2<<4) /* 8.192 KHz */
33#define M41T00_SQW_4KHZ (3<<4) /* 4.096 KHz */
34#define M41T00_SQW_2KHZ (4<<4) /* 2.048 KHz */
35#define M41T00_SQW_1KHZ (5<<4) /* 1.024 KHz */
36#define M41T00_SQW_512HZ (6<<4) /* 512 Hz */
37#define M41T00_SQW_256HZ (7<<4) /* 256 Hz */
38#define M41T00_SQW_128HZ (8<<4) /* 128 Hz */
39#define M41T00_SQW_64HZ (9<<4) /* 64 Hz */
40#define M41T00_SQW_32HZ (10<<4) /* 32 Hz */
41#define M41T00_SQW_16HZ (11<<4) /* 16 Hz */
42#define M41T00_SQW_8HZ (12<<4) /* 8 Hz */
43#define M41T00_SQW_4HZ (13<<4) /* 4 Hz */
44#define M41T00_SQW_2HZ (14<<4) /* 2 Hz */
45#define M41T00_SQW_1HZ (15<<4) /* 1 Hz */
46
47extern ulong m41t00_get_rtc_time(void);
48extern int m41t00_set_rtc_time(ulong nowtime);
49
50#endif /* _M41T00_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 1b7b95c67aca..1bba6789a50a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -12,7 +12,6 @@
12#include <linux/prio_tree.h> 12#include <linux/prio_tree.h>
13#include <linux/debug_locks.h> 13#include <linux/debug_locks.h>
14#include <linux/mm_types.h> 14#include <linux/mm_types.h>
15#include <linux/security.h>
16 15
17struct mempolicy; 16struct mempolicy;
18struct anon_vma; 17struct anon_vma;
@@ -34,6 +33,8 @@ extern int sysctl_legacy_va_layout;
34#define sysctl_legacy_va_layout 0 33#define sysctl_legacy_va_layout 0
35#endif 34#endif
36 35
36extern unsigned long mmap_min_addr;
37
37#include <asm/page.h> 38#include <asm/page.h>
38#include <asm/pgtable.h> 39#include <asm/pgtable.h>
39#include <asm/processor.h> 40#include <asm/processor.h>
@@ -1117,9 +1118,21 @@ static inline void vm_stat_account(struct mm_struct *mm,
1117} 1118}
1118#endif /* CONFIG_PROC_FS */ 1119#endif /* CONFIG_PROC_FS */
1119 1120
1120#ifndef CONFIG_DEBUG_PAGEALLOC 1121#ifdef CONFIG_DEBUG_PAGEALLOC
1122extern int debug_pagealloc_enabled;
1123
1124extern void kernel_map_pages(struct page *page, int numpages, int enable);
1125
1126static inline void enable_debug_pagealloc(void)
1127{
1128 debug_pagealloc_enabled = 1;
1129}
1130#else
1121static inline void 1131static inline void
1122kernel_map_pages(struct page *page, int numpages, int enable) {} 1132kernel_map_pages(struct page *page, int numpages, int enable) {}
1133static inline void enable_debug_pagealloc(void)
1134{
1135}
1123#endif 1136#endif
1124 1137
1125extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); 1138extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk);
@@ -1145,6 +1158,7 @@ extern int randomize_va_space;
1145#endif 1158#endif
1146 1159
1147const char * arch_vma_name(struct vm_area_struct *vma); 1160const char * arch_vma_name(struct vm_area_struct *vma);
1161void print_vma_addr(char *prefix, unsigned long rip);
1148 1162
1149struct page *sparse_mem_map_populate(unsigned long pnum, int nid); 1163struct page *sparse_mem_map_populate(unsigned long pnum, int nid);
1150pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); 1164pgd_t *vmemmap_pgd_populate(unsigned long addr, int node);
diff --git a/include/linux/module.h b/include/linux/module.h
index 2cbc0b87e329..ac481e2094fd 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -178,7 +178,7 @@ void *__symbol_get_gpl(const char *symbol);
178#define __CRC_SYMBOL(sym, sec) \ 178#define __CRC_SYMBOL(sym, sec) \
179 extern void *__crc_##sym __attribute__((weak)); \ 179 extern void *__crc_##sym __attribute__((weak)); \
180 static const unsigned long __kcrctab_##sym \ 180 static const unsigned long __kcrctab_##sym \
181 __attribute_used__ \ 181 __used \
182 __attribute__((section("__kcrctab" sec), unused)) \ 182 __attribute__((section("__kcrctab" sec), unused)) \
183 = (unsigned long) &__crc_##sym; 183 = (unsigned long) &__crc_##sym;
184#else 184#else
@@ -193,7 +193,7 @@ void *__symbol_get_gpl(const char *symbol);
193 __attribute__((section("__ksymtab_strings"))) \ 193 __attribute__((section("__ksymtab_strings"))) \
194 = MODULE_SYMBOL_PREFIX #sym; \ 194 = MODULE_SYMBOL_PREFIX #sym; \
195 static const struct kernel_symbol __ksymtab_##sym \ 195 static const struct kernel_symbol __ksymtab_##sym \
196 __attribute_used__ \ 196 __used \
197 __attribute__((section("__ksymtab" sec), unused)) \ 197 __attribute__((section("__ksymtab" sec), unused)) \
198 = { (unsigned long)&sym, __kstrtab_##sym } 198 = { (unsigned long)&sym, __kstrtab_##sym }
199 199
@@ -446,11 +446,14 @@ static inline void __module_get(struct module *module)
446 __mod ? __mod->name : "kernel"; \ 446 __mod ? __mod->name : "kernel"; \
447}) 447})
448 448
449/* For kallsyms to ask for address resolution. NULL means not found. */ 449/* For kallsyms to ask for address resolution. namebuf should be at
450const char *module_address_lookup(unsigned long addr, 450 * least KSYM_NAME_LEN long: a pointer to namebuf is returned if
451 unsigned long *symbolsize, 451 * found, otherwise NULL. */
452 unsigned long *offset, 452char *module_address_lookup(unsigned long addr,
453 char **modname); 453 unsigned long *symbolsize,
454 unsigned long *offset,
455 char **modname,
456 char *namebuf);
454int lookup_module_symbol_name(unsigned long addr, char *symname); 457int lookup_module_symbol_name(unsigned long addr, char *symname);
455int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name); 458int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
456 459
@@ -516,10 +519,11 @@ static inline void module_put(struct module *module)
516#define module_name(mod) "kernel" 519#define module_name(mod) "kernel"
517 520
518/* For kallsyms to ask for address resolution. NULL means not found. */ 521/* For kallsyms to ask for address resolution. NULL means not found. */
519static inline const char *module_address_lookup(unsigned long addr, 522static inline char *module_address_lookup(unsigned long addr,
520 unsigned long *symbolsize, 523 unsigned long *symbolsize,
521 unsigned long *offset, 524 unsigned long *offset,
522 char **modname) 525 char **modname,
526 char *namebuf)
523{ 527{
524 return NULL; 528 return NULL;
525} 529}
@@ -574,7 +578,9 @@ struct device_driver;
574#ifdef CONFIG_SYSFS 578#ifdef CONFIG_SYSFS
575struct module; 579struct module;
576 580
577extern struct kset module_subsys; 581extern struct kset *module_kset;
582extern struct kobj_type module_ktype;
583extern int module_sysfs_initialized;
578 584
579int mod_sysfs_init(struct module *mod); 585int mod_sysfs_init(struct module *mod);
580int mod_sysfs_setup(struct module *mod, 586int mod_sysfs_setup(struct module *mod,
@@ -607,21 +613,6 @@ static inline void module_remove_modinfo_attrs(struct module *mod)
607 613
608#endif /* CONFIG_SYSFS */ 614#endif /* CONFIG_SYSFS */
609 615
610#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES)
611
612void module_add_driver(struct module *mod, struct device_driver *drv);
613void module_remove_driver(struct device_driver *drv);
614
615#else /* not both CONFIG_SYSFS && CONFIG_MODULES */
616
617static inline void module_add_driver(struct module *mod, struct device_driver *drv)
618{ }
619
620static inline void module_remove_driver(struct device_driver *drv)
621{ }
622
623#endif
624
625#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x) 616#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
626 617
627/* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */ 618/* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 13410b20600f..8126e55c5bdc 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -18,7 +18,7 @@
18#define __module_cat(a,b) ___module_cat(a,b) 18#define __module_cat(a,b) ___module_cat(a,b)
19#define __MODULE_INFO(tag, name, info) \ 19#define __MODULE_INFO(tag, name, info) \
20static const char __module_cat(name,__LINE__)[] \ 20static const char __module_cat(name,__LINE__)[] \
21 __attribute_used__ \ 21 __used \
22 __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info 22 __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
23#else /* !MODULE */ 23#else /* !MODULE */
24#define __MODULE_INFO(tag, name, info) 24#define __MODULE_INFO(tag, name, info)
@@ -72,7 +72,7 @@ struct kparam_array
72 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \ 72 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
73 static const char __param_str_##name[] = prefix #name; \ 73 static const char __param_str_##name[] = prefix #name; \
74 static struct kernel_param const __param_##name \ 74 static struct kernel_param const __param_##name \
75 __attribute_used__ \ 75 __used \
76 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 76 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
77 = { __param_str_##name, perm, set, get, { arg } } 77 = { __param_str_##name, perm, set, get, { arg } }
78 78
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h
index d2ae6185f03b..69327b7b4ce4 100644
--- a/include/linux/mv643xx.h
+++ b/include/linux/mv643xx.h
@@ -15,6 +15,7 @@
15 15
16#include <asm/types.h> 16#include <asm/types.h>
17#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
18#include <linux/mv643xx_i2c.h>
18 19
19/****************************************/ 20/****************************************/
20/* Processor Address Space */ 21/* Processor Address Space */
@@ -863,7 +864,6 @@
863/* I2C Registers */ 864/* I2C Registers */
864/****************************************/ 865/****************************************/
865 866
866#define MV64XXX_I2C_CTLR_NAME "mv64xxx_i2c"
867#define MV64XXX_I2C_OFFSET 0xc000 867#define MV64XXX_I2C_OFFSET 0xc000
868#define MV64XXX_I2C_REG_BLOCK_SIZE 0x0020 868#define MV64XXX_I2C_REG_BLOCK_SIZE 0x0020
869 869
@@ -968,14 +968,6 @@ struct mpsc_pdata {
968 u32 brg_clk_freq; 968 u32 brg_clk_freq;
969}; 969};
970 970
971/* i2c Platform Device, Driver Data */
972struct mv64xxx_i2c_pdata {
973 u32 freq_m;
974 u32 freq_n;
975 u32 timeout; /* In milliseconds */
976 u32 retries;
977};
978
979/* Watchdog Platform Device, Driver Data */ 971/* Watchdog Platform Device, Driver Data */
980#define MV64x60_WDT_NAME "mv64x60_wdt" 972#define MV64x60_WDT_NAME "mv64x60_wdt"
981 973
diff --git a/include/linux/mv643xx_i2c.h b/include/linux/mv643xx_i2c.h
new file mode 100644
index 000000000000..5db5152e9de5
--- /dev/null
+++ b/include/linux/mv643xx_i2c.h
@@ -0,0 +1,22 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 */
7
8#ifndef _MV64XXX_I2C_H_
9#define _MV64XXX_I2C_H_
10
11#include <linux/types.h>
12
13#define MV64XXX_I2C_CTLR_NAME "mv64xxx_i2c"
14
15/* i2c Platform Device, Driver Data */
16struct mv64xxx_i2c_pdata {
17 u32 freq_m;
18 u32 freq_n;
19 u32 timeout; /* In milliseconds */
20};
21
22#endif /*_MV64XXX_I2C_H_*/
diff --git a/include/linux/net.h b/include/linux/net.h
index 596131ea46f4..c414d90e647b 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -22,6 +22,7 @@
22#include <asm/socket.h> 22#include <asm/socket.h>
23 23
24struct poll_table_struct; 24struct poll_table_struct;
25struct pipe_inode_info;
25struct inode; 26struct inode;
26struct net; 27struct net;
27 28
@@ -172,6 +173,8 @@ struct proto_ops {
172 struct vm_area_struct * vma); 173 struct vm_area_struct * vma);
173 ssize_t (*sendpage) (struct socket *sock, struct page *page, 174 ssize_t (*sendpage) (struct socket *sock, struct page *page,
174 int offset, size_t size, int flags); 175 int offset, size_t size, int flags);
176 ssize_t (*splice_read)(struct socket *sock, loff_t *ppos,
177 struct pipe_inode_info *pipe, size_t len, unsigned int flags);
175}; 178};
176 179
177struct net_proto_family { 180struct net_proto_family {
@@ -183,6 +186,13 @@ struct net_proto_family {
183struct iovec; 186struct iovec;
184struct kvec; 187struct kvec;
185 188
189enum {
190 SOCK_WAKE_IO,
191 SOCK_WAKE_WAITD,
192 SOCK_WAKE_SPACE,
193 SOCK_WAKE_URG,
194};
195
186extern int sock_wake_async(struct socket *sk, int how, int band); 196extern int sock_wake_async(struct socket *sk, int how, int band);
187extern int sock_register(const struct net_proto_family *fam); 197extern int sock_register(const struct net_proto_family *fam);
188extern void sock_unregister(int family); 198extern void sock_unregister(int family);
@@ -327,7 +337,6 @@ static const struct proto_ops name##_ops = { \
327 337
328#ifdef CONFIG_SYSCTL 338#ifdef CONFIG_SYSCTL
329#include <linux/sysctl.h> 339#include <linux/sysctl.h>
330extern ctl_table net_table[];
331extern int net_msg_cost; 340extern int net_msg_cost;
332extern int net_msg_burst; 341extern int net_msg_burst;
333#endif 342#endif
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 16adac688af5..d74e79bacd2d 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -7,6 +7,8 @@
7#include <linux/skbuff.h> 7#include <linux/skbuff.h>
8#include <linux/net.h> 8#include <linux/net.h>
9#include <linux/if.h> 9#include <linux/if.h>
10#include <linux/in.h>
11#include <linux/in6.h>
10#include <linux/wait.h> 12#include <linux/wait.h>
11#include <linux/list.h> 13#include <linux/list.h>
12#endif 14#endif
@@ -39,6 +41,23 @@
39#define NFC_ALTERED 0x8000 41#define NFC_ALTERED 0x8000
40#endif 42#endif
41 43
44enum nf_inet_hooks {
45 NF_INET_PRE_ROUTING,
46 NF_INET_LOCAL_IN,
47 NF_INET_FORWARD,
48 NF_INET_LOCAL_OUT,
49 NF_INET_POST_ROUTING,
50 NF_INET_NUMHOOKS
51};
52
53union nf_inet_addr {
54 u_int32_t all[4];
55 __be32 ip;
56 __be32 ip6[4];
57 struct in_addr in;
58 struct in6_addr in6;
59};
60
42#ifdef __KERNEL__ 61#ifdef __KERNEL__
43#ifdef CONFIG_NETFILTER 62#ifdef CONFIG_NETFILTER
44 63
@@ -92,19 +111,6 @@ struct nf_sockopt_ops
92 struct module *owner; 111 struct module *owner;
93}; 112};
94 113
95/* Each queued (to userspace) skbuff has one of these. */
96struct nf_info
97{
98 /* The ops struct which sent us to userspace. */
99 struct nf_hook_ops *elem;
100
101 /* If we're sent to userspace, this keeps housekeeping info */
102 int pf;
103 unsigned int hook;
104 struct net_device *indev, *outdev;
105 int (*okfn)(struct sk_buff *);
106};
107
108/* Function to register/unregister hook points. */ 114/* Function to register/unregister hook points. */
109int nf_register_hook(struct nf_hook_ops *reg); 115int nf_register_hook(struct nf_hook_ops *reg);
110void nf_unregister_hook(struct nf_hook_ops *reg); 116void nf_unregister_hook(struct nf_hook_ops *reg);
@@ -118,71 +124,12 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
118 124
119#ifdef CONFIG_SYSCTL 125#ifdef CONFIG_SYSCTL
120/* Sysctl registration */ 126/* Sysctl registration */
121struct ctl_table_header *nf_register_sysctl_table(struct ctl_table *path, 127extern struct ctl_path nf_net_netfilter_sysctl_path[];
122 struct ctl_table *table); 128extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
123void nf_unregister_sysctl_table(struct ctl_table_header *header,
124 struct ctl_table *table);
125extern struct ctl_table nf_net_netfilter_sysctl_path[];
126extern struct ctl_table nf_net_ipv4_netfilter_sysctl_path[];
127#endif /* CONFIG_SYSCTL */ 129#endif /* CONFIG_SYSCTL */
128 130
129extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; 131extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS];
130 132
131/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will
132 * disappear once iptables is replaced with pkttables. Please DO NOT use them
133 * for any new code! */
134#define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
135#define NF_LOG_TCPOPT 0x02 /* Log TCP options */
136#define NF_LOG_IPOPT 0x04 /* Log IP options */
137#define NF_LOG_UID 0x08 /* Log UID owning local socket */
138#define NF_LOG_MASK 0x0f
139
140#define NF_LOG_TYPE_LOG 0x01
141#define NF_LOG_TYPE_ULOG 0x02
142
143struct nf_loginfo {
144 u_int8_t type;
145 union {
146 struct {
147 u_int32_t copy_len;
148 u_int16_t group;
149 u_int16_t qthreshold;
150 } ulog;
151 struct {
152 u_int8_t level;
153 u_int8_t logflags;
154 } log;
155 } u;
156};
157
158typedef void nf_logfn(unsigned int pf,
159 unsigned int hooknum,
160 const struct sk_buff *skb,
161 const struct net_device *in,
162 const struct net_device *out,
163 const struct nf_loginfo *li,
164 const char *prefix);
165
166struct nf_logger {
167 struct module *me;
168 nf_logfn *logfn;
169 char *name;
170};
171
172/* Function to register/unregister log function. */
173int nf_log_register(int pf, struct nf_logger *logger);
174void nf_log_unregister(struct nf_logger *logger);
175void nf_log_unregister_pf(int pf);
176
177/* Calls the registered backend logging function */
178void nf_log_packet(int pf,
179 unsigned int hooknum,
180 const struct sk_buff *skb,
181 const struct net_device *in,
182 const struct net_device *out,
183 struct nf_loginfo *li,
184 const char *fmt, ...);
185
186int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, 133int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
187 struct net_device *indev, struct net_device *outdev, 134 struct net_device *indev, struct net_device *outdev,
188 int (*okfn)(struct sk_buff *), int thresh); 135 int (*okfn)(struct sk_buff *), int thresh);
@@ -265,65 +212,28 @@ int compat_nf_setsockopt(struct sock *sk, int pf, int optval,
265int compat_nf_getsockopt(struct sock *sk, int pf, int optval, 212int compat_nf_getsockopt(struct sock *sk, int pf, int optval,
266 char __user *opt, int *len); 213 char __user *opt, int *len);
267 214
268/* Packet queuing */
269struct nf_queue_handler {
270 int (*outfn)(struct sk_buff *skb, struct nf_info *info,
271 unsigned int queuenum, void *data);
272 void *data;
273 char *name;
274};
275extern int nf_register_queue_handler(int pf,
276 struct nf_queue_handler *qh);
277extern int nf_unregister_queue_handler(int pf,
278 struct nf_queue_handler *qh);
279extern void nf_unregister_queue_handlers(struct nf_queue_handler *qh);
280extern void nf_reinject(struct sk_buff *skb,
281 struct nf_info *info,
282 unsigned int verdict);
283
284/* FIXME: Before cache is ever used, this must be implemented for real. */
285extern void nf_invalidate_cache(int pf);
286
287/* Call this before modifying an existing packet: ensures it is 215/* Call this before modifying an existing packet: ensures it is
288 modifiable and linear to the point you care about (writable_len). 216 modifiable and linear to the point you care about (writable_len).
289 Returns true or false. */ 217 Returns true or false. */
290extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len); 218extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
291 219
292static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to) 220struct flowi;
293{ 221struct nf_queue_entry;
294 __be32 diff[] = { ~from, to };
295
296 *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
297}
298
299static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
300{
301 nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
302}
303
304extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
305 __be32 from, __be32 to, int pseudohdr);
306
307static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
308 __be16 from, __be16 to, int pseudohdr)
309{
310 nf_proto_csum_replace4(sum, skb, (__force __be32)from,
311 (__force __be32)to, pseudohdr);
312}
313 222
314struct nf_afinfo { 223struct nf_afinfo {
315 unsigned short family; 224 unsigned short family;
316 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, 225 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
317 unsigned int dataoff, u_int8_t protocol); 226 unsigned int dataoff, u_int8_t protocol);
227 int (*route)(struct dst_entry **dst, struct flowi *fl);
318 void (*saveroute)(const struct sk_buff *skb, 228 void (*saveroute)(const struct sk_buff *skb,
319 struct nf_info *info); 229 struct nf_queue_entry *entry);
320 int (*reroute)(struct sk_buff *skb, 230 int (*reroute)(struct sk_buff *skb,
321 const struct nf_info *info); 231 const struct nf_queue_entry *entry);
322 int route_key_size; 232 int route_key_size;
323}; 233};
324 234
325extern struct nf_afinfo *nf_afinfo[]; 235extern const struct nf_afinfo *nf_afinfo[NPROTO];
326static inline struct nf_afinfo *nf_get_afinfo(unsigned short family) 236static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family)
327{ 237{
328 return rcu_dereference(nf_afinfo[family]); 238 return rcu_dereference(nf_afinfo[family]);
329} 239}
@@ -332,7 +242,7 @@ static inline __sum16
332nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, 242nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
333 u_int8_t protocol, unsigned short family) 243 u_int8_t protocol, unsigned short family)
334{ 244{
335 struct nf_afinfo *afinfo; 245 const struct nf_afinfo *afinfo;
336 __sum16 csum = 0; 246 __sum16 csum = 0;
337 247
338 rcu_read_lock(); 248 rcu_read_lock();
@@ -343,10 +253,8 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
343 return csum; 253 return csum;
344} 254}
345 255
346extern int nf_register_afinfo(struct nf_afinfo *afinfo); 256extern int nf_register_afinfo(const struct nf_afinfo *afinfo);
347extern void nf_unregister_afinfo(struct nf_afinfo *afinfo); 257extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
348
349#define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info))
350 258
351#include <net/flow.h> 259#include <net/flow.h>
352extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); 260extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
@@ -354,11 +262,16 @@ extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
354static inline void 262static inline void
355nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) 263nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family)
356{ 264{
357#if defined(CONFIG_IP_NF_NAT_NEEDED) || defined(CONFIG_NF_NAT_NEEDED) 265#ifdef CONFIG_NF_NAT_NEEDED
358 void (*decodefn)(struct sk_buff *, struct flowi *); 266 void (*decodefn)(struct sk_buff *, struct flowi *);
359 267
360 if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL) 268 if (family == AF_INET) {
361 decodefn(skb, fl); 269 rcu_read_lock();
270 decodefn = rcu_dereference(ip_nat_decode_session);
271 if (decodefn)
272 decodefn(skb, fl);
273 rcu_read_unlock();
274 }
362#endif 275#endif
363} 276}
364 277
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index b87e83a5e070..91fef0cae42f 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -10,6 +10,7 @@ header-y += xt_DSCP.h
10header-y += xt_MARK.h 10header-y += xt_MARK.h
11header-y += xt_NFLOG.h 11header-y += xt_NFLOG.h
12header-y += xt_NFQUEUE.h 12header-y += xt_NFQUEUE.h
13header-y += xt_RATEEST.h
13header-y += xt_SECMARK.h 14header-y += xt_SECMARK.h
14header-y += xt_TCPMSS.h 15header-y += xt_TCPMSS.h
15header-y += xt_comment.h 16header-y += xt_comment.h
@@ -20,14 +21,17 @@ header-y += xt_dccp.h
20header-y += xt_dscp.h 21header-y += xt_dscp.h
21header-y += xt_esp.h 22header-y += xt_esp.h
22header-y += xt_hashlimit.h 23header-y += xt_hashlimit.h
24header-y += xt_iprange.h
23header-y += xt_helper.h 25header-y += xt_helper.h
24header-y += xt_length.h 26header-y += xt_length.h
25header-y += xt_limit.h 27header-y += xt_limit.h
26header-y += xt_mac.h 28header-y += xt_mac.h
27header-y += xt_mark.h 29header-y += xt_mark.h
28header-y += xt_multiport.h 30header-y += xt_multiport.h
31header-y += xt_owner.h
29header-y += xt_pkttype.h 32header-y += xt_pkttype.h
30header-y += xt_policy.h 33header-y += xt_policy.h
34header-y += xt_rateest.h
31header-y += xt_realm.h 35header-y += xt_realm.h
32header-y += xt_sctp.h 36header-y += xt_sctp.h
33header-y += xt_state.h 37header-y += xt_state.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 9e0dae07861e..bad1eb760f61 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -129,6 +129,14 @@ enum ip_conntrack_events
129 /* Mark is set */ 129 /* Mark is set */
130 IPCT_MARK_BIT = 12, 130 IPCT_MARK_BIT = 12,
131 IPCT_MARK = (1 << IPCT_MARK_BIT), 131 IPCT_MARK = (1 << IPCT_MARK_BIT),
132
133 /* NAT sequence adjustment */
134 IPCT_NATSEQADJ_BIT = 13,
135 IPCT_NATSEQADJ = (1 << IPCT_NATSEQADJ_BIT),
136
137 /* Secmark is set */
138 IPCT_SECMARK_BIT = 14,
139 IPCT_SECMARK = (1 << IPCT_SECMARK_BIT),
132}; 140};
133 141
134enum ip_conntrack_expect_events { 142enum ip_conntrack_expect_events {
diff --git a/include/linux/netfilter/nf_conntrack_h323.h b/include/linux/netfilter/nf_conntrack_h323.h
index aabd24ac7631..26f9226ea72b 100644
--- a/include/linux/netfilter/nf_conntrack_h323.h
+++ b/include/linux/netfilter/nf_conntrack_h323.h
@@ -31,7 +31,7 @@ struct nf_conn;
31 31
32extern int get_h225_addr(struct nf_conn *ct, unsigned char *data, 32extern int get_h225_addr(struct nf_conn *ct, unsigned char *data,
33 TransportAddress *taddr, 33 TransportAddress *taddr,
34 union nf_conntrack_address *addr, __be16 *port); 34 union nf_inet_addr *addr, __be16 *port);
35extern void nf_conntrack_h245_expect(struct nf_conn *new, 35extern void nf_conntrack_h245_expect(struct nf_conn *new,
36 struct nf_conntrack_expect *this); 36 struct nf_conntrack_expect *this);
37extern void nf_conntrack_q931_expect(struct nf_conn *new, 37extern void nf_conntrack_q931_expect(struct nf_conn *new,
@@ -39,12 +39,12 @@ extern void nf_conntrack_q931_expect(struct nf_conn *new,
39extern int (*set_h245_addr_hook) (struct sk_buff *skb, 39extern int (*set_h245_addr_hook) (struct sk_buff *skb,
40 unsigned char **data, int dataoff, 40 unsigned char **data, int dataoff,
41 H245_TransportAddress *taddr, 41 H245_TransportAddress *taddr,
42 union nf_conntrack_address *addr, 42 union nf_inet_addr *addr,
43 __be16 port); 43 __be16 port);
44extern int (*set_h225_addr_hook) (struct sk_buff *skb, 44extern int (*set_h225_addr_hook) (struct sk_buff *skb,
45 unsigned char **data, int dataoff, 45 unsigned char **data, int dataoff,
46 TransportAddress *taddr, 46 TransportAddress *taddr,
47 union nf_conntrack_address *addr, 47 union nf_inet_addr *addr,
48 __be16 port); 48 __be16 port);
49extern int (*set_sig_addr_hook) (struct sk_buff *skb, 49extern int (*set_sig_addr_hook) (struct sk_buff *skb,
50 struct nf_conn *ct, 50 struct nf_conn *ct,
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h
index 5cf2c115cce4..768f78c4ac53 100644
--- a/include/linux/netfilter/nf_conntrack_sctp.h
+++ b/include/linux/netfilter/nf_conntrack_sctp.h
@@ -21,7 +21,6 @@ struct ip_ct_sctp
21 enum sctp_conntrack state; 21 enum sctp_conntrack state;
22 22
23 __be32 vtag[IP_CT_DIR_MAX]; 23 __be32 vtag[IP_CT_DIR_MAX];
24 u_int32_t ttag[IP_CT_DIR_MAX];
25}; 24};
26 25
27#endif /* _NF_CONNTRACK_SCTP_H */ 26#endif /* _NF_CONNTRACK_SCTP_H */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 4affa3fe78e0..e3e1533aba2d 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -37,6 +37,9 @@ enum ctattr_type {
37 CTA_ID, 37 CTA_ID,
38 CTA_NAT_DST, 38 CTA_NAT_DST,
39 CTA_TUPLE_MASTER, 39 CTA_TUPLE_MASTER,
40 CTA_NAT_SEQ_ADJ_ORIG,
41 CTA_NAT_SEQ_ADJ_REPLY,
42 CTA_SECMARK,
40 __CTA_MAX 43 __CTA_MAX
41}; 44};
42#define CTA_MAX (__CTA_MAX - 1) 45#define CTA_MAX (__CTA_MAX - 1)
@@ -119,6 +122,14 @@ enum ctattr_protonat {
119}; 122};
120#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) 123#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1)
121 124
125enum ctattr_natseq {
126 CTA_NAT_SEQ_CORRECTION_POS,
127 CTA_NAT_SEQ_OFFSET_BEFORE,
128 CTA_NAT_SEQ_OFFSET_AFTER,
129 __CTA_NAT_SEQ_MAX
130};
131#define CTA_NAT_SEQ_MAX (__CTA_NAT_SEQ_MAX - 1)
132
122enum ctattr_expect { 133enum ctattr_expect {
123 CTA_EXPECT_UNSPEC, 134 CTA_EXPECT_UNSPEC,
124 CTA_EXPECT_MASTER, 135 CTA_EXPECT_MASTER,
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index 5966afa026e9..a85721332924 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -47,6 +47,7 @@ enum nfulnl_attr_type {
47 NFULA_UID, /* user id of socket */ 47 NFULA_UID, /* user id of socket */
48 NFULA_SEQ, /* instance-local sequence number */ 48 NFULA_SEQ, /* instance-local sequence number */
49 NFULA_SEQ_GLOBAL, /* global sequence number */ 49 NFULA_SEQ_GLOBAL, /* global sequence number */
50 NFULA_GID, /* group id of socket */
50 51
51 __NFULA_MAX 52 __NFULA_MAX
52}; 53};
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 03e6ce979eaa..b99ede51318a 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -126,6 +126,49 @@ struct xt_counters_info
126 126
127#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ 127#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
128 128
129/* fn returns 0 to continue iteration */
130#define XT_MATCH_ITERATE(type, e, fn, args...) \
131({ \
132 unsigned int __i; \
133 int __ret = 0; \
134 struct xt_entry_match *__m; \
135 \
136 for (__i = sizeof(type); \
137 __i < (e)->target_offset; \
138 __i += __m->u.match_size) { \
139 __m = (void *)e + __i; \
140 \
141 __ret = fn(__m , ## args); \
142 if (__ret != 0) \
143 break; \
144 } \
145 __ret; \
146})
147
148/* fn returns 0 to continue iteration */
149#define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \
150({ \
151 unsigned int __i, __n; \
152 int __ret = 0; \
153 type *__entry; \
154 \
155 for (__i = 0, __n = 0; __i < (size); \
156 __i += __entry->next_offset, __n++) { \
157 __entry = (void *)(entries) + __i; \
158 if (__n < n) \
159 continue; \
160 \
161 __ret = fn(__entry , ## args); \
162 if (__ret != 0) \
163 break; \
164 } \
165 __ret; \
166})
167
168/* fn returns 0 to continue iteration */
169#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \
170 XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args)
171
129#ifdef __KERNEL__ 172#ifdef __KERNEL__
130 173
131#include <linux/netdevice.h> 174#include <linux/netdevice.h>
@@ -265,13 +308,16 @@ struct xt_table_info
265 unsigned int initial_entries; 308 unsigned int initial_entries;
266 309
267 /* Entry points and underflows */ 310 /* Entry points and underflows */
268 unsigned int hook_entry[NF_IP_NUMHOOKS]; 311 unsigned int hook_entry[NF_INET_NUMHOOKS];
269 unsigned int underflow[NF_IP_NUMHOOKS]; 312 unsigned int underflow[NF_INET_NUMHOOKS];
270 313
271 /* ipt_entry tables: one per CPU */ 314 /* ipt_entry tables: one per CPU */
272 char *entries[NR_CPUS]; 315 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */
316 char *entries[1];
273}; 317};
274 318
319#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \
320 + nr_cpu_ids * sizeof(char *))
275extern int xt_register_target(struct xt_target *target); 321extern int xt_register_target(struct xt_target *target);
276extern void xt_unregister_target(struct xt_target *target); 322extern void xt_unregister_target(struct xt_target *target);
277extern int xt_register_targets(struct xt_target *target, unsigned int n); 323extern int xt_register_targets(struct xt_target *target, unsigned int n);
@@ -378,9 +424,13 @@ struct compat_xt_counters_info
378extern void xt_compat_lock(int af); 424extern void xt_compat_lock(int af);
379extern void xt_compat_unlock(int af); 425extern void xt_compat_unlock(int af);
380 426
427extern int xt_compat_add_offset(int af, unsigned int offset, short delta);
428extern void xt_compat_flush_offsets(int af);
429extern short xt_compat_calc_jump(int af, unsigned int offset);
430
381extern int xt_compat_match_offset(struct xt_match *match); 431extern int xt_compat_match_offset(struct xt_match *match);
382extern void xt_compat_match_from_user(struct xt_entry_match *m, 432extern int xt_compat_match_from_user(struct xt_entry_match *m,
383 void **dstptr, int *size); 433 void **dstptr, int *size);
384extern int xt_compat_match_to_user(struct xt_entry_match *m, 434extern int xt_compat_match_to_user(struct xt_entry_match *m,
385 void __user **dstptr, int *size); 435 void __user **dstptr, int *size);
386 436
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
index 9f744689fffc..4e58ba43c289 100644
--- a/include/linux/netfilter/xt_CONNMARK.h
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -22,4 +22,9 @@ struct xt_connmark_target_info {
22 u_int8_t mode; 22 u_int8_t mode;
23}; 23};
24 24
25struct xt_connmark_tginfo1 {
26 u_int32_t ctmark, ctmask, nfmask;
27 u_int8_t mode;
28};
29
25#endif /*_XT_CONNMARK_H_target*/ 30#endif /*_XT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter/xt_DSCP.h b/include/linux/netfilter/xt_DSCP.h
index 3c7c963997bd..14da1968e2c6 100644
--- a/include/linux/netfilter/xt_DSCP.h
+++ b/include/linux/netfilter/xt_DSCP.h
@@ -17,4 +17,9 @@ struct xt_DSCP_info {
17 u_int8_t dscp; 17 u_int8_t dscp;
18}; 18};
19 19
20struct xt_tos_target_info {
21 u_int8_t tos_value;
22 u_int8_t tos_mask;
23};
24
20#endif /* _XT_DSCP_TARGET_H */ 25#endif /* _XT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
index b021e93ee5d6..778b278fd9f2 100644
--- a/include/linux/netfilter/xt_MARK.h
+++ b/include/linux/netfilter/xt_MARK.h
@@ -18,4 +18,8 @@ struct xt_mark_target_info_v1 {
18 u_int8_t mode; 18 u_int8_t mode;
19}; 19};
20 20
21struct xt_mark_tginfo2 {
22 u_int32_t mark, mask;
23};
24
21#endif /*_XT_MARK_H_target */ 25#endif /*_XT_MARK_H_target */
diff --git a/include/linux/netfilter/xt_RATEEST.h b/include/linux/netfilter/xt_RATEEST.h
new file mode 100644
index 000000000000..f79e3133cbea
--- /dev/null
+++ b/include/linux/netfilter/xt_RATEEST.h
@@ -0,0 +1,13 @@
1#ifndef _XT_RATEEST_TARGET_H
2#define _XT_RATEEST_TARGET_H
3
4struct xt_rateest_target_info {
5 char name[IFNAMSIZ];
6 int8_t interval;
7 u_int8_t ewma_log;
8
9 /* Used internally by the kernel */
10 struct xt_rateest *est __attribute__((aligned(8)));
11};
12
13#endif /* _XT_RATEEST_TARGET_H */
diff --git a/include/linux/netfilter/xt_TCPOPTSTRIP.h b/include/linux/netfilter/xt_TCPOPTSTRIP.h
new file mode 100644
index 000000000000..2db543214ff5
--- /dev/null
+++ b/include/linux/netfilter/xt_TCPOPTSTRIP.h
@@ -0,0 +1,13 @@
1#ifndef _XT_TCPOPTSTRIP_H
2#define _XT_TCPOPTSTRIP_H
3
4#define tcpoptstrip_set_bit(bmap, idx) \
5 (bmap[(idx) >> 5] |= 1U << (idx & 31))
6#define tcpoptstrip_test_bit(bmap, idx) \
7 (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0)
8
9struct xt_tcpoptstrip_target_info {
10 u_int32_t strip_bmap[8];
11};
12
13#endif /* _XT_TCPOPTSTRIP_H */
diff --git a/include/linux/netfilter/xt_connlimit.h b/include/linux/netfilter/xt_connlimit.h
index 37e933c9987d..7e3284bcbd2b 100644
--- a/include/linux/netfilter/xt_connlimit.h
+++ b/include/linux/netfilter/xt_connlimit.h
@@ -5,12 +5,17 @@ struct xt_connlimit_data;
5 5
6struct xt_connlimit_info { 6struct xt_connlimit_info {
7 union { 7 union {
8 __be32 v4_mask; 8 union nf_inet_addr mask;
9 __be32 v6_mask[4]; 9#ifndef __KERNEL__
10 union {
11 __be32 v4_mask;
12 __be32 v6_mask[4];
13 };
14#endif
10 }; 15 };
11 unsigned int limit, inverse; 16 unsigned int limit, inverse;
12 17
13 /* this needs to be at the end */ 18 /* Used internally by the kernel */
14 struct xt_connlimit_data *data __attribute__((aligned(8))); 19 struct xt_connlimit_data *data __attribute__((aligned(8)));
15}; 20};
16 21
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
index c592f6ae0883..359ef86918dc 100644
--- a/include/linux/netfilter/xt_connmark.h
+++ b/include/linux/netfilter/xt_connmark.h
@@ -15,4 +15,9 @@ struct xt_connmark_info {
15 u_int8_t invert; 15 u_int8_t invert;
16}; 16};
17 17
18struct xt_connmark_mtinfo1 {
19 u_int32_t mark, mask;
20 u_int8_t invert;
21};
22
18#endif /*_XT_CONNMARK_H*/ 23#endif /*_XT_CONNMARK_H*/
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index 70b6f718cf4c..d2492a3329be 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -6,7 +6,9 @@
6#define _XT_CONNTRACK_H 6#define _XT_CONNTRACK_H
7 7
8#include <linux/netfilter/nf_conntrack_tuple_common.h> 8#include <linux/netfilter/nf_conntrack_tuple_common.h>
9#include <linux/in.h> 9#ifdef __KERNEL__
10# include <linux/in.h>
11#endif
10 12
11#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) 13#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
12#define XT_CONNTRACK_STATE_INVALID (1 << 0) 14#define XT_CONNTRACK_STATE_INVALID (1 << 0)
@@ -60,4 +62,16 @@ struct xt_conntrack_info
60 /* Inverse flags */ 62 /* Inverse flags */
61 u_int8_t invflags; 63 u_int8_t invflags;
62}; 64};
65
66struct xt_conntrack_mtinfo1 {
67 union nf_inet_addr origsrc_addr, origsrc_mask;
68 union nf_inet_addr origdst_addr, origdst_mask;
69 union nf_inet_addr replsrc_addr, replsrc_mask;
70 union nf_inet_addr repldst_addr, repldst_mask;
71 u_int32_t expires_min, expires_max;
72 u_int16_t l4proto;
73 u_int8_t state_mask, status_mask;
74 u_int8_t match_flags, invert_flags;
75};
76
63#endif /*_XT_CONNTRACK_H*/ 77#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_dscp.h b/include/linux/netfilter/xt_dscp.h
index 1da61e6acaf7..f49bc1a648dc 100644
--- a/include/linux/netfilter/xt_dscp.h
+++ b/include/linux/netfilter/xt_dscp.h
@@ -20,4 +20,10 @@ struct xt_dscp_info {
20 u_int8_t invert; 20 u_int8_t invert;
21}; 21};
22 22
23struct xt_tos_match_info {
24 u_int8_t tos_mask;
25 u_int8_t tos_value;
26 u_int8_t invert;
27};
28
23#endif /* _XT_DSCP_H */ 29#endif /* _XT_DSCP_H */
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index b4556b8edbfd..c19972e4564d 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -29,9 +29,9 @@ struct hashlimit_cfg {
29struct xt_hashlimit_info { 29struct xt_hashlimit_info {
30 char name [IFNAMSIZ]; /* name */ 30 char name [IFNAMSIZ]; /* name */
31 struct hashlimit_cfg cfg; 31 struct hashlimit_cfg cfg;
32 struct xt_hashlimit_htable *hinfo;
33 32
34 /* Used internally by the kernel */ 33 /* Used internally by the kernel */
34 struct xt_hashlimit_htable *hinfo;
35 union { 35 union {
36 void *ptr; 36 void *ptr;
37 struct xt_hashlimit_info *master; 37 struct xt_hashlimit_info *master;
diff --git a/include/linux/netfilter/xt_iprange.h b/include/linux/netfilter/xt_iprange.h
new file mode 100644
index 000000000000..a4299c7d3680
--- /dev/null
+++ b/include/linux/netfilter/xt_iprange.h
@@ -0,0 +1,17 @@
1#ifndef _LINUX_NETFILTER_XT_IPRANGE_H
2#define _LINUX_NETFILTER_XT_IPRANGE_H 1
3
4enum {
5 IPRANGE_SRC = 1 << 0, /* match source IP address */
6 IPRANGE_DST = 1 << 1, /* match destination IP address */
7 IPRANGE_SRC_INV = 1 << 4, /* negate the condition */
8 IPRANGE_DST_INV = 1 << 5, /* -"- */
9};
10
11struct xt_iprange_mtinfo {
12 union nf_inet_addr src_min, src_max;
13 union nf_inet_addr dst_min, dst_max;
14 u_int8_t flags;
15};
16
17#endif /* _LINUX_NETFILTER_XT_IPRANGE_H */
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
index 802dd4842caf..fae74bc3f34e 100644
--- a/include/linux/netfilter/xt_mark.h
+++ b/include/linux/netfilter/xt_mark.h
@@ -6,4 +6,9 @@ struct xt_mark_info {
6 u_int8_t invert; 6 u_int8_t invert;
7}; 7};
8 8
9struct xt_mark_mtinfo1 {
10 u_int32_t mark, mask;
11 u_int8_t invert;
12};
13
9#endif /*_XT_MARK_H*/ 14#endif /*_XT_MARK_H*/
diff --git a/include/linux/netfilter/xt_owner.h b/include/linux/netfilter/xt_owner.h
new file mode 100644
index 000000000000..eacd34efebd5
--- /dev/null
+++ b/include/linux/netfilter/xt_owner.h
@@ -0,0 +1,16 @@
1#ifndef _XT_OWNER_MATCH_H
2#define _XT_OWNER_MATCH_H
3
4enum {
5 XT_OWNER_UID = 1 << 0,
6 XT_OWNER_GID = 1 << 1,
7 XT_OWNER_SOCKET = 1 << 2,
8};
9
10struct xt_owner_match_info {
11 u_int32_t uid;
12 u_int32_t gid;
13 u_int8_t match, invert;
14};
15
16#endif /* _XT_OWNER_MATCH_H */
diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h
index 45654d359a68..053d8cc65464 100644
--- a/include/linux/netfilter/xt_policy.h
+++ b/include/linux/netfilter/xt_policy.h
@@ -27,18 +27,33 @@ struct xt_policy_spec
27 reqid:1; 27 reqid:1;
28}; 28};
29 29
30#ifndef __KERNEL__
30union xt_policy_addr 31union xt_policy_addr
31{ 32{
32 struct in_addr a4; 33 struct in_addr a4;
33 struct in6_addr a6; 34 struct in6_addr a6;
34}; 35};
36#endif
35 37
36struct xt_policy_elem 38struct xt_policy_elem
37{ 39{
38 union xt_policy_addr saddr; 40 union {
39 union xt_policy_addr smask; 41#ifdef __KERNEL__
40 union xt_policy_addr daddr; 42 struct {
41 union xt_policy_addr dmask; 43 union nf_inet_addr saddr;
44 union nf_inet_addr smask;
45 union nf_inet_addr daddr;
46 union nf_inet_addr dmask;
47 };
48#else
49 struct {
50 union xt_policy_addr saddr;
51 union xt_policy_addr smask;
52 union xt_policy_addr daddr;
53 union xt_policy_addr dmask;
54 };
55#endif
56 };
42 __be32 spi; 57 __be32 spi;
43 u_int32_t reqid; 58 u_int32_t reqid;
44 u_int8_t proto; 59 u_int8_t proto;
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
index acd7fd77bbee..4c8368d781e5 100644
--- a/include/linux/netfilter/xt_quota.h
+++ b/include/linux/netfilter/xt_quota.h
@@ -9,6 +9,8 @@ enum xt_quota_flags {
9struct xt_quota_info { 9struct xt_quota_info {
10 u_int32_t flags; 10 u_int32_t flags;
11 u_int32_t pad; 11 u_int32_t pad;
12
13 /* Used internally by the kernel */
12 aligned_u64 quota; 14 aligned_u64 quota;
13 struct xt_quota_info *master; 15 struct xt_quota_info *master;
14}; 16};
diff --git a/include/linux/netfilter/xt_rateest.h b/include/linux/netfilter/xt_rateest.h
new file mode 100644
index 000000000000..2010cb74250f
--- /dev/null
+++ b/include/linux/netfilter/xt_rateest.h
@@ -0,0 +1,35 @@
1#ifndef _XT_RATEEST_MATCH_H
2#define _XT_RATEEST_MATCH_H
3
4enum xt_rateest_match_flags {
5 XT_RATEEST_MATCH_INVERT = 1<<0,
6 XT_RATEEST_MATCH_ABS = 1<<1,
7 XT_RATEEST_MATCH_REL = 1<<2,
8 XT_RATEEST_MATCH_DELTA = 1<<3,
9 XT_RATEEST_MATCH_BPS = 1<<4,
10 XT_RATEEST_MATCH_PPS = 1<<5,
11};
12
13enum xt_rateest_match_mode {
14 XT_RATEEST_MATCH_NONE,
15 XT_RATEEST_MATCH_EQ,
16 XT_RATEEST_MATCH_LT,
17 XT_RATEEST_MATCH_GT,
18};
19
20struct xt_rateest_match_info {
21 char name1[IFNAMSIZ];
22 char name2[IFNAMSIZ];
23 u_int16_t flags;
24 u_int16_t mode;
25 u_int32_t bps1;
26 u_int32_t pps1;
27 u_int32_t bps2;
28 u_int32_t pps2;
29
30 /* Used internally by the kernel */
31 struct xt_rateest *est1 __attribute__((aligned(8)));
32 struct xt_rateest *est2 __attribute__((aligned(8)));
33};
34
35#endif /* _XT_RATEEST_MATCH_H */
diff --git a/include/linux/netfilter/xt_statistic.h b/include/linux/netfilter/xt_statistic.h
index c344e9916e23..3d38bc975048 100644
--- a/include/linux/netfilter/xt_statistic.h
+++ b/include/linux/netfilter/xt_statistic.h
@@ -23,6 +23,7 @@ struct xt_statistic_info {
23 struct { 23 struct {
24 u_int32_t every; 24 u_int32_t every;
25 u_int32_t packet; 25 u_int32_t packet;
26 /* Used internally by the kernel */
26 u_int32_t count; 27 u_int32_t count;
27 } nth; 28 } nth;
28 } u; 29 } u;
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
index 3b3419f2637d..bb21dd1aee2d 100644
--- a/include/linux/netfilter/xt_string.h
+++ b/include/linux/netfilter/xt_string.h
@@ -12,6 +12,8 @@ struct xt_string_info
12 char pattern[XT_STRING_MAX_PATTERN_SIZE]; 12 char pattern[XT_STRING_MAX_PATTERN_SIZE];
13 u_int8_t patlen; 13 u_int8_t patlen;
14 u_int8_t invert; 14 u_int8_t invert;
15
16 /* Used internally by the kernel */
15 struct ts_config __attribute__((aligned(8))) *config; 17 struct ts_config __attribute__((aligned(8))) *config;
16}; 18};
17 19
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 2fc73fa8e37f..53dd4df27aa1 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -217,21 +217,8 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e
217} 217}
218 218
219/* fn returns 0 to continue iteration */ 219/* fn returns 0 to continue iteration */
220#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ 220#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
221({ \ 221 XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args)
222 unsigned int __i; \
223 int __ret = 0; \
224 struct arpt_entry *__entry; \
225 \
226 for (__i = 0; __i < (size); __i += __entry->next_offset) { \
227 __entry = (void *)(entries) + __i; \
228 \
229 __ret = fn(__entry , ## args); \
230 if (__ret != 0) \
231 break; \
232 } \
233 __ret; \
234})
235 222
236/* 223/*
237 * Main firewall chains definitions and global var's definitions. 224 * Main firewall chains definitions and global var's definitions.
@@ -293,6 +280,37 @@ extern unsigned int arpt_do_table(struct sk_buff *skb,
293 const struct net_device *out, 280 const struct net_device *out,
294 struct arpt_table *table); 281 struct arpt_table *table);
295 282
296#define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1)) 283#define ARPT_ALIGN(s) XT_ALIGN(s)
284
285#ifdef CONFIG_COMPAT
286#include <net/compat.h>
287
288struct compat_arpt_entry
289{
290 struct arpt_arp arp;
291 u_int16_t target_offset;
292 u_int16_t next_offset;
293 compat_uint_t comefrom;
294 struct compat_xt_counters counters;
295 unsigned char elems[0];
296};
297
298static inline struct arpt_entry_target *
299compat_arpt_get_target(struct compat_arpt_entry *e)
300{
301 return (void *)e + e->target_offset;
302}
303
304#define COMPAT_ARPT_ALIGN(s) COMPAT_XT_ALIGN(s)
305
306/* fn returns 0 to continue iteration */
307#define COMPAT_ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
308 XT_ENTRY_ITERATE(struct compat_arpt_entry, entries, size, fn, ## args)
309
310#define COMPAT_ARPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
311 XT_ENTRY_ITERATE_CONTINUE(struct compat_arpt_entry, entries, size, n, \
312 fn, ## args)
313
314#endif /* CONFIG_COMPAT */
297#endif /*__KERNEL__*/ 315#endif /*__KERNEL__*/
298#endif /* _ARPTABLES_H */ 316#endif /* _ARPTABLES_H */
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 1a63adf5c4c1..9a10092e358c 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -36,7 +36,6 @@
36#define NFC_IP_DST_PT 0x0400 36#define NFC_IP_DST_PT 0x0400
37/* Something else about the proto */ 37/* Something else about the proto */
38#define NFC_IP_PROTO_UNKNOWN 0x2000 38#define NFC_IP_PROTO_UNKNOWN 0x2000
39#endif /* ! __KERNEL__ */
40 39
41/* IP Hooks */ 40/* IP Hooks */
42/* After promisc drops, checksum checks. */ 41/* After promisc drops, checksum checks. */
@@ -50,6 +49,7 @@
50/* Packets about to hit the wire. */ 49/* Packets about to hit the wire. */
51#define NF_IP_POST_ROUTING 4 50#define NF_IP_POST_ROUTING 4
52#define NF_IP_NUMHOOKS 5 51#define NF_IP_NUMHOOKS 5
52#endif /* ! __KERNEL__ */
53 53
54enum nf_ip_hook_priorities { 54enum nf_ip_hook_priorities {
55 NF_IP_PRI_FIRST = INT_MIN, 55 NF_IP_PRI_FIRST = INT_MIN,
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index d79ed69cbc1f..45fcad91e67b 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -156,10 +156,10 @@ struct ipt_getinfo
156 unsigned int valid_hooks; 156 unsigned int valid_hooks;
157 157
158 /* Hook entry points: one per netfilter hook. */ 158 /* Hook entry points: one per netfilter hook. */
159 unsigned int hook_entry[NF_IP_NUMHOOKS]; 159 unsigned int hook_entry[NF_INET_NUMHOOKS];
160 160
161 /* Underflow points. */ 161 /* Underflow points. */
162 unsigned int underflow[NF_IP_NUMHOOKS]; 162 unsigned int underflow[NF_INET_NUMHOOKS];
163 163
164 /* Number of entries */ 164 /* Number of entries */
165 unsigned int num_entries; 165 unsigned int num_entries;
@@ -185,10 +185,10 @@ struct ipt_replace
185 unsigned int size; 185 unsigned int size;
186 186
187 /* Hook entry points. */ 187 /* Hook entry points. */
188 unsigned int hook_entry[NF_IP_NUMHOOKS]; 188 unsigned int hook_entry[NF_INET_NUMHOOKS];
189 189
190 /* Underflow points. */ 190 /* Underflow points. */
191 unsigned int underflow[NF_IP_NUMHOOKS]; 191 unsigned int underflow[NF_INET_NUMHOOKS];
192 192
193 /* Information about old entries: */ 193 /* Information about old entries: */
194 /* Number of counters (must be equal to current number of entries). */ 194 /* Number of counters (must be equal to current number of entries). */
@@ -229,60 +229,12 @@ ipt_get_target(struct ipt_entry *e)
229} 229}
230 230
231/* fn returns 0 to continue iteration */ 231/* fn returns 0 to continue iteration */
232#define IPT_MATCH_ITERATE(e, fn, args...) \ 232#define IPT_MATCH_ITERATE(e, fn, args...) \
233({ \ 233 XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args)
234 unsigned int __i; \
235 int __ret = 0; \
236 struct ipt_entry_match *__match; \
237 \
238 for (__i = sizeof(struct ipt_entry); \
239 __i < (e)->target_offset; \
240 __i += __match->u.match_size) { \
241 __match = (void *)(e) + __i; \
242 \
243 __ret = fn(__match , ## args); \
244 if (__ret != 0) \
245 break; \
246 } \
247 __ret; \
248})
249 234
250/* fn returns 0 to continue iteration */ 235/* fn returns 0 to continue iteration */
251#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ 236#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
252({ \ 237 XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args)
253 unsigned int __i; \
254 int __ret = 0; \
255 struct ipt_entry *__entry; \
256 \
257 for (__i = 0; __i < (size); __i += __entry->next_offset) { \
258 __entry = (void *)(entries) + __i; \
259 \
260 __ret = fn(__entry , ## args); \
261 if (__ret != 0) \
262 break; \
263 } \
264 __ret; \
265})
266
267/* fn returns 0 to continue iteration */
268#define IPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
269({ \
270 unsigned int __i, __n; \
271 int __ret = 0; \
272 struct ipt_entry *__entry; \
273 \
274 for (__i = 0, __n = 0; __i < (size); \
275 __i += __entry->next_offset, __n++) { \
276 __entry = (void *)(entries) + __i; \
277 if (__n < n) \
278 continue; \
279 \
280 __ret = fn(__entry , ## args); \
281 if (__ret != 0) \
282 break; \
283 } \
284 __ret; \
285})
286 238
287/* 239/*
288 * Main firewall chains definitions and global var's definitions. 240 * Main firewall chains definitions and global var's definitions.
@@ -359,8 +311,28 @@ struct compat_ipt_entry
359 unsigned char elems[0]; 311 unsigned char elems[0];
360}; 312};
361 313
314/* Helper functions */
315static inline struct ipt_entry_target *
316compat_ipt_get_target(struct compat_ipt_entry *e)
317{
318 return (void *)e + e->target_offset;
319}
320
362#define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s) 321#define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s)
363 322
323/* fn returns 0 to continue iteration */
324#define COMPAT_IPT_MATCH_ITERATE(e, fn, args...) \
325 XT_MATCH_ITERATE(struct compat_ipt_entry, e, fn, ## args)
326
327/* fn returns 0 to continue iteration */
328#define COMPAT_IPT_ENTRY_ITERATE(entries, size, fn, args...) \
329 XT_ENTRY_ITERATE(struct compat_ipt_entry, entries, size, fn, ## args)
330
331/* fn returns 0 to continue iteration */
332#define COMPAT_IPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
333 XT_ENTRY_ITERATE_CONTINUE(struct compat_ipt_entry, entries, size, n, \
334 fn, ## args)
335
364#endif /* CONFIG_COMPAT */ 336#endif /* CONFIG_COMPAT */
365#endif /*__KERNEL__*/ 337#endif /*__KERNEL__*/
366#endif /* _IPTABLES_H */ 338#endif /* _IPTABLES_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
index daf50be22c9d..e5a3687c8a72 100644
--- a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
+++ b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
@@ -27,6 +27,7 @@ struct ipt_clusterip_tgt_info {
27 u_int32_t hash_mode; 27 u_int32_t hash_mode;
28 u_int32_t hash_initval; 28 u_int32_t hash_initval;
29 29
30 /* Used internally by the kernel */
30 struct clusterip_config *config; 31 struct clusterip_config *config;
31}; 32};
32 33
diff --git a/include/linux/netfilter_ipv4/ipt_addrtype.h b/include/linux/netfilter_ipv4/ipt_addrtype.h
index 166ed01a8122..446de6aef983 100644
--- a/include/linux/netfilter_ipv4/ipt_addrtype.h
+++ b/include/linux/netfilter_ipv4/ipt_addrtype.h
@@ -1,6 +1,20 @@
1#ifndef _IPT_ADDRTYPE_H 1#ifndef _IPT_ADDRTYPE_H
2#define _IPT_ADDRTYPE_H 2#define _IPT_ADDRTYPE_H
3 3
4enum {
5 IPT_ADDRTYPE_INVERT_SOURCE = 0x0001,
6 IPT_ADDRTYPE_INVERT_DEST = 0x0002,
7 IPT_ADDRTYPE_LIMIT_IFACE_IN = 0x0004,
8 IPT_ADDRTYPE_LIMIT_IFACE_OUT = 0x0008,
9};
10
11struct ipt_addrtype_info_v1 {
12 u_int16_t source; /* source-type mask */
13 u_int16_t dest; /* dest-type mask */
14 u_int32_t flags;
15};
16
17/* revision 0 */
4struct ipt_addrtype_info { 18struct ipt_addrtype_info {
5 u_int16_t source; /* source-type mask */ 19 u_int16_t source; /* source-type mask */
6 u_int16_t dest; /* dest-type mask */ 20 u_int16_t dest; /* dest-type mask */
diff --git a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h
index a92fefc3c7ec..5f1aebde4d2f 100644
--- a/include/linux/netfilter_ipv4/ipt_iprange.h
+++ b/include/linux/netfilter_ipv4/ipt_iprange.h
@@ -2,11 +2,7 @@
2#define _IPT_IPRANGE_H 2#define _IPT_IPRANGE_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5#include <linux/netfilter/xt_iprange.h>
6#define IPRANGE_SRC 0x01 /* Match source IP address */
7#define IPRANGE_DST 0x02 /* Match destination IP address */
8#define IPRANGE_SRC_INV 0x10 /* Negate the condition */
9#define IPRANGE_DST_INV 0x20 /* Negate the condition */
10 6
11struct ipt_iprange { 7struct ipt_iprange {
12 /* Inclusive: network order. */ 8 /* Inclusive: network order. */
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 66ca8e3100dc..3475a65dae9b 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -40,8 +40,6 @@
40#define NFC_IP6_DST_PT 0x0400 40#define NFC_IP6_DST_PT 0x0400
41/* Something else about the proto */ 41/* Something else about the proto */
42#define NFC_IP6_PROTO_UNKNOWN 0x2000 42#define NFC_IP6_PROTO_UNKNOWN 0x2000
43#endif /* ! __KERNEL__ */
44
45 43
46/* IP6 Hooks */ 44/* IP6 Hooks */
47/* After promisc drops, checksum checks. */ 45/* After promisc drops, checksum checks. */
@@ -55,6 +53,7 @@
55/* Packets about to hit the wire. */ 53/* Packets about to hit the wire. */
56#define NF_IP6_POST_ROUTING 4 54#define NF_IP6_POST_ROUTING 4
57#define NF_IP6_NUMHOOKS 5 55#define NF_IP6_NUMHOOKS 5
56#endif /* ! __KERNEL__ */
58 57
59 58
60enum nf_ip6_hook_priorities { 59enum nf_ip6_hook_priorities {
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 7dc481ce7cba..110801d699ee 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -216,10 +216,10 @@ struct ip6t_getinfo
216 unsigned int valid_hooks; 216 unsigned int valid_hooks;
217 217
218 /* Hook entry points: one per netfilter hook. */ 218 /* Hook entry points: one per netfilter hook. */
219 unsigned int hook_entry[NF_IP6_NUMHOOKS]; 219 unsigned int hook_entry[NF_INET_NUMHOOKS];
220 220
221 /* Underflow points. */ 221 /* Underflow points. */
222 unsigned int underflow[NF_IP6_NUMHOOKS]; 222 unsigned int underflow[NF_INET_NUMHOOKS];
223 223
224 /* Number of entries */ 224 /* Number of entries */
225 unsigned int num_entries; 225 unsigned int num_entries;
@@ -245,10 +245,10 @@ struct ip6t_replace
245 unsigned int size; 245 unsigned int size;
246 246
247 /* Hook entry points. */ 247 /* Hook entry points. */
248 unsigned int hook_entry[NF_IP6_NUMHOOKS]; 248 unsigned int hook_entry[NF_INET_NUMHOOKS];
249 249
250 /* Underflow points. */ 250 /* Underflow points. */
251 unsigned int underflow[NF_IP6_NUMHOOKS]; 251 unsigned int underflow[NF_INET_NUMHOOKS];
252 252
253 /* Information about old entries: */ 253 /* Information about old entries: */
254 /* Number of counters (must be equal to current number of entries). */ 254 /* Number of counters (must be equal to current number of entries). */
@@ -289,40 +289,12 @@ ip6t_get_target(struct ip6t_entry *e)
289} 289}
290 290
291/* fn returns 0 to continue iteration */ 291/* fn returns 0 to continue iteration */
292#define IP6T_MATCH_ITERATE(e, fn, args...) \ 292#define IP6T_MATCH_ITERATE(e, fn, args...) \
293({ \ 293 XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args)
294 unsigned int __i; \
295 int __ret = 0; \
296 struct ip6t_entry_match *__m; \
297 \
298 for (__i = sizeof(struct ip6t_entry); \
299 __i < (e)->target_offset; \
300 __i += __m->u.match_size) { \
301 __m = (void *)(e) + __i; \
302 \
303 __ret = fn(__m , ## args); \
304 if (__ret != 0) \
305 break; \
306 } \
307 __ret; \
308})
309 294
310/* fn returns 0 to continue iteration */ 295/* fn returns 0 to continue iteration */
311#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ 296#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
312({ \ 297 XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args)
313 unsigned int __i; \
314 int __ret = 0; \
315 struct ip6t_entry *__e; \
316 \
317 for (__i = 0; __i < (size); __i += __e->next_offset) { \
318 __e = (void *)(entries) + __i; \
319 \
320 __ret = fn(__e , ## args); \
321 if (__ret != 0) \
322 break; \
323 } \
324 __ret; \
325})
326 298
327/* 299/*
328 * Main firewall chains definitions and global var's definitions. 300 * Main firewall chains definitions and global var's definitions.
@@ -352,7 +324,42 @@ extern int ip6_masked_addrcmp(const struct in6_addr *addr1,
352 const struct in6_addr *mask, 324 const struct in6_addr *mask,
353 const struct in6_addr *addr2); 325 const struct in6_addr *addr2);
354 326
355#define IP6T_ALIGN(s) (((s) + (__alignof__(struct ip6t_entry)-1)) & ~(__alignof__(struct ip6t_entry)-1)) 327#define IP6T_ALIGN(s) XT_ALIGN(s)
356 328
329#ifdef CONFIG_COMPAT
330#include <net/compat.h>
331
332struct compat_ip6t_entry
333{
334 struct ip6t_ip6 ipv6;
335 compat_uint_t nfcache;
336 u_int16_t target_offset;
337 u_int16_t next_offset;
338 compat_uint_t comefrom;
339 struct compat_xt_counters counters;
340 unsigned char elems[0];
341};
342
343static inline struct ip6t_entry_target *
344compat_ip6t_get_target(struct compat_ip6t_entry *e)
345{
346 return (void *)e + e->target_offset;
347}
348
349#define COMPAT_IP6T_ALIGN(s) COMPAT_XT_ALIGN(s)
350
351/* fn returns 0 to continue iteration */
352#define COMPAT_IP6T_MATCH_ITERATE(e, fn, args...) \
353 XT_MATCH_ITERATE(struct compat_ip6t_entry, e, fn, ## args)
354
355/* fn returns 0 to continue iteration */
356#define COMPAT_IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
357 XT_ENTRY_ITERATE(struct compat_ip6t_entry, entries, size, fn, ## args)
358
359#define COMPAT_IP6T_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
360 XT_ENTRY_ITERATE_CONTINUE(struct compat_ip6t_entry, entries, size, n, \
361 fn, ## args)
362
363#endif /* CONFIG_COMPAT */
357#endif /*__KERNEL__*/ 364#endif /*__KERNEL__*/
358#endif /* _IP6_TABLES_H */ 365#endif /* _IP6_TABLES_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index d5bfaba595c7..bd13b6f4a98e 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -178,6 +178,7 @@ extern struct sock *netlink_kernel_create(struct net *net,
178 void (*input)(struct sk_buff *skb), 178 void (*input)(struct sk_buff *skb),
179 struct mutex *cb_mutex, 179 struct mutex *cb_mutex,
180 struct module *module); 180 struct module *module);
181extern void netlink_kernel_release(struct sock *sk);
181extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 182extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
182extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); 183extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
183extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 184extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
@@ -245,7 +246,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
245} 246}
246 247
247#define NLMSG_NEW(skb, pid, seq, type, len, flags) \ 248#define NLMSG_NEW(skb, pid, seq, type, len, flags) \
248({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \ 249({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \
249 goto nlmsg_failure; \ 250 goto nlmsg_failure; \
250 __nlmsg_put(skb, pid, seq, type, len, flags); }) 251 __nlmsg_put(skb, pid, seq, type, len, flags); })
251 252
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 20250d963d72..a0525a1f4715 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -20,12 +20,11 @@ struct netpoll {
20 20
21 u32 local_ip, remote_ip; 21 u32 local_ip, remote_ip;
22 u16 local_port, remote_port; 22 u16 local_port, remote_port;
23 u8 local_mac[ETH_ALEN], remote_mac[ETH_ALEN]; 23 u8 remote_mac[ETH_ALEN];
24}; 24};
25 25
26struct netpoll_info { 26struct netpoll_info {
27 atomic_t refcnt; 27 atomic_t refcnt;
28 int rx_flags;
29 spinlock_t rx_lock; 28 spinlock_t rx_lock;
30 struct netpoll *rx_np; /* netpoll that registered an rx_hook */ 29 struct netpoll *rx_np; /* netpoll that registered an rx_hook */
31 struct sk_buff_head arp_tx; /* list of arp requests to reply to */ 30 struct sk_buff_head arp_tx; /* list of arp requests to reply to */
@@ -51,12 +50,12 @@ static inline int netpoll_rx(struct sk_buff *skb)
51 unsigned long flags; 50 unsigned long flags;
52 int ret = 0; 51 int ret = 0;
53 52
54 if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags)) 53 if (!npinfo || !npinfo->rx_np)
55 return 0; 54 return 0;
56 55
57 spin_lock_irqsave(&npinfo->rx_lock, flags); 56 spin_lock_irqsave(&npinfo->rx_lock, flags);
58 /* check rx_flags again with the lock held */ 57 /* check rx_np again with the lock held */
59 if (npinfo->rx_flags && __netpoll_rx(skb)) 58 if (npinfo->rx_np && __netpoll_rx(skb))
60 ret = 1; 59 ret = 1;
61 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 60 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
62 61
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 2d15d4aac094..099ddb4481c0 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -196,28 +196,67 @@ struct nfs_inode {
196#define NFS_INO_STALE (2) /* possible stale inode */ 196#define NFS_INO_STALE (2) /* possible stale inode */
197#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */ 197#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */
198 198
199static inline struct nfs_inode *NFS_I(struct inode *inode) 199static inline struct nfs_inode *NFS_I(const struct inode *inode)
200{ 200{
201 return container_of(inode, struct nfs_inode, vfs_inode); 201 return container_of(inode, struct nfs_inode, vfs_inode);
202} 202}
203#define NFS_SB(s) ((struct nfs_server *)(s->s_fs_info))
204 203
205#define NFS_FH(inode) (&NFS_I(inode)->fh) 204static inline struct nfs_server *NFS_SB(const struct super_block *s)
206#define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) 205{
207#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) 206 return (struct nfs_server *)(s->s_fs_info);
208#define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops) 207}
209#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) 208
210#define NFS_MINATTRTIMEO(inode) \ 209static inline struct nfs_fh *NFS_FH(const struct inode *inode)
211 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ 210{
212 : NFS_SERVER(inode)->acregmin) 211 return &NFS_I(inode)->fh;
213#define NFS_MAXATTRTIMEO(inode) \ 212}
214 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ 213
215 : NFS_SERVER(inode)->acregmax) 214static inline struct nfs_server *NFS_SERVER(const struct inode *inode)
215{
216 return NFS_SB(inode->i_sb);
217}
218
219static inline struct rpc_clnt *NFS_CLIENT(const struct inode *inode)
220{
221 return NFS_SERVER(inode)->client;
222}
223
224static inline const struct nfs_rpc_ops *NFS_PROTO(const struct inode *inode)
225{
226 return NFS_SERVER(inode)->nfs_client->rpc_ops;
227}
228
229static inline __be32 *NFS_COOKIEVERF(const struct inode *inode)
230{
231 return NFS_I(inode)->cookieverf;
232}
233
234static inline unsigned NFS_MINATTRTIMEO(const struct inode *inode)
235{
236 struct nfs_server *nfss = NFS_SERVER(inode);
237 return S_ISDIR(inode->i_mode) ? nfss->acdirmin : nfss->acregmin;
238}
216 239
217#define NFS_FLAGS(inode) (NFS_I(inode)->flags) 240static inline unsigned NFS_MAXATTRTIMEO(const struct inode *inode)
218#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode))) 241{
242 struct nfs_server *nfss = NFS_SERVER(inode);
243 return S_ISDIR(inode->i_mode) ? nfss->acdirmax : nfss->acregmax;
244}
219 245
220#define NFS_FILEID(inode) (NFS_I(inode)->fileid) 246static inline int NFS_STALE(const struct inode *inode)
247{
248 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
249}
250
251static inline __u64 NFS_FILEID(const struct inode *inode)
252{
253 return NFS_I(inode)->fileid;
254}
255
256static inline void set_nfs_fileid(struct inode *inode, __u64 fileid)
257{
258 NFS_I(inode)->fileid = fileid;
259}
221 260
222static inline void nfs_mark_for_revalidate(struct inode *inode) 261static inline void nfs_mark_for_revalidate(struct inode *inode)
223{ 262{
@@ -237,7 +276,7 @@ static inline int nfs_server_capable(struct inode *inode, int cap)
237 276
238static inline int NFS_USE_READDIRPLUS(struct inode *inode) 277static inline int NFS_USE_READDIRPLUS(struct inode *inode)
239{ 278{
240 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode)); 279 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
241} 280}
242 281
243static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) 282static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
@@ -366,6 +405,7 @@ extern const struct inode_operations nfs3_dir_inode_operations;
366extern const struct file_operations nfs_dir_operations; 405extern const struct file_operations nfs_dir_operations;
367extern struct dentry_operations nfs_dentry_operations; 406extern struct dentry_operations nfs_dentry_operations;
368 407
408extern void nfs_force_lookup_revalidate(struct inode *dir);
369extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 409extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);
370extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); 410extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags);
371extern void nfs_access_zap_cache(struct inode *inode); 411extern void nfs_access_zap_cache(struct inode *inode);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 0cac49bc0955..3423c6761bf7 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -3,8 +3,12 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/backing-dev.h> 5#include <linux/backing-dev.h>
6#include <linux/wait.h>
7
8#include <asm/atomic.h>
6 9
7struct nfs_iostats; 10struct nfs_iostats;
11struct nlm_host;
8 12
9/* 13/*
10 * The nfs_client identifies our client state to the server. 14 * The nfs_client identifies our client state to the server.
@@ -14,20 +18,19 @@ struct nfs_client {
14 int cl_cons_state; /* current construction state (-ve: init error) */ 18 int cl_cons_state; /* current construction state (-ve: init error) */
15#define NFS_CS_READY 0 /* ready to be used */ 19#define NFS_CS_READY 0 /* ready to be used */
16#define NFS_CS_INITING 1 /* busy initialising */ 20#define NFS_CS_INITING 1 /* busy initialising */
17 int cl_nfsversion; /* NFS protocol version */
18 unsigned long cl_res_state; /* NFS resources state */ 21 unsigned long cl_res_state; /* NFS resources state */
19#define NFS_CS_CALLBACK 1 /* - callback started */ 22#define NFS_CS_CALLBACK 1 /* - callback started */
20#define NFS_CS_IDMAP 2 /* - idmap started */ 23#define NFS_CS_IDMAP 2 /* - idmap started */
21#define NFS_CS_RENEWD 3 /* - renewd started */ 24#define NFS_CS_RENEWD 3 /* - renewd started */
22 struct sockaddr_in cl_addr; /* server identifier */ 25 struct sockaddr_storage cl_addr; /* server identifier */
26 size_t cl_addrlen;
23 char * cl_hostname; /* hostname of server */ 27 char * cl_hostname; /* hostname of server */
24 struct list_head cl_share_link; /* link in global client list */ 28 struct list_head cl_share_link; /* link in global client list */
25 struct list_head cl_superblocks; /* List of nfs_server structs */ 29 struct list_head cl_superblocks; /* List of nfs_server structs */
26 30
27 struct rpc_clnt * cl_rpcclient; 31 struct rpc_clnt * cl_rpcclient;
28 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */ 32 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */
29 unsigned long retrans_timeo; /* retransmit timeout */ 33 int cl_proto; /* Network transport protocol */
30 unsigned int retrans_count; /* number of retransmit tries */
31 34
32#ifdef CONFIG_NFS_V4 35#ifdef CONFIG_NFS_V4
33 u64 cl_clientid; /* constant */ 36 u64 cl_clientid; /* constant */
@@ -62,7 +65,7 @@ struct nfs_client {
62 /* Our own IP address, as a null-terminated string. 65 /* Our own IP address, as a null-terminated string.
63 * This is used to generate the clientid, and the callback address. 66 * This is used to generate the clientid, and the callback address.
64 */ 67 */
65 char cl_ipaddr[16]; 68 char cl_ipaddr[48];
66 unsigned char cl_id_uniquifier; 69 unsigned char cl_id_uniquifier;
67#endif 70#endif
68}; 71};
@@ -78,6 +81,7 @@ struct nfs_server {
78 struct list_head master_link; /* link in master servers list */ 81 struct list_head master_link; /* link in master servers list */
79 struct rpc_clnt * client; /* RPC client handle */ 82 struct rpc_clnt * client; /* RPC client handle */
80 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 83 struct rpc_clnt * client_acl; /* ACL RPC client handle */
84 struct nlm_host *nlm_host; /* NLM client handle */
81 struct nfs_iostats * io_stats; /* I/O statistics */ 85 struct nfs_iostats * io_stats; /* I/O statistics */
82 struct backing_dev_info backing_dev_info; 86 struct backing_dev_info backing_dev_info;
83 atomic_long_t writeback; /* number of writeback pages */ 87 atomic_long_t writeback; /* number of writeback pages */
@@ -110,6 +114,9 @@ struct nfs_server {
110 filesystem */ 114 filesystem */
111#endif 115#endif
112 void (*destroy)(struct nfs_server *); 116 void (*destroy)(struct nfs_server *);
117
118 atomic_t active; /* Keep trace of any activity to this server */
119 wait_queue_head_t active_wq; /* Wait for any activity to stop */
113}; 120};
114 121
115/* Server capabilities */ 122/* Server capabilities */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 30dbcc185e69..a1676e19e491 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -83,6 +83,7 @@ extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc);
83extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); 83extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t);
84extern int nfs_wait_on_request(struct nfs_page *); 84extern int nfs_wait_on_request(struct nfs_page *);
85extern void nfs_unlock_request(struct nfs_page *req); 85extern void nfs_unlock_request(struct nfs_page *req);
86extern int nfs_set_page_tag_locked(struct nfs_page *req);
86extern void nfs_clear_page_tag_locked(struct nfs_page *req); 87extern void nfs_clear_page_tag_locked(struct nfs_page *req);
87 88
88 89
@@ -95,18 +96,6 @@ nfs_lock_request_dontget(struct nfs_page *req)
95 return !test_and_set_bit(PG_BUSY, &req->wb_flags); 96 return !test_and_set_bit(PG_BUSY, &req->wb_flags);
96} 97}
97 98
98/*
99 * Lock the page of an asynchronous request and take a reference
100 */
101static inline int
102nfs_lock_request(struct nfs_page *req)
103{
104 if (test_and_set_bit(PG_BUSY, &req->wb_flags))
105 return 0;
106 kref_get(&req->wb_kref);
107 return 1;
108}
109
110/** 99/**
111 * nfs_list_add_request - Insert a request into a list 100 * nfs_list_add_request - Insert a request into a list
112 * @req: request 101 * @req: request
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index daab252f2e5c..f301d0b8babc 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -666,16 +666,17 @@ struct nfs4_rename_res {
666 struct nfs_fattr * new_fattr; 666 struct nfs_fattr * new_fattr;
667}; 667};
668 668
669#define NFS4_SETCLIENTID_NAMELEN (56)
669struct nfs4_setclientid { 670struct nfs4_setclientid {
670 const nfs4_verifier * sc_verifier; /* request */ 671 const nfs4_verifier * sc_verifier;
671 unsigned int sc_name_len; 672 unsigned int sc_name_len;
672 char sc_name[48]; /* request */ 673 char sc_name[NFS4_SETCLIENTID_NAMELEN];
673 u32 sc_prog; /* request */ 674 u32 sc_prog;
674 unsigned int sc_netid_len; 675 unsigned int sc_netid_len;
675 char sc_netid[4]; /* request */ 676 char sc_netid[RPCBIND_MAXNETIDLEN];
676 unsigned int sc_uaddr_len; 677 unsigned int sc_uaddr_len;
677 char sc_uaddr[24]; /* request */ 678 char sc_uaddr[RPCBIND_MAXUADDRLEN];
678 u32 sc_cb_ident; /* request */ 679 u32 sc_cb_ident;
679}; 680};
680 681
681struct nfs4_statfs_arg { 682struct nfs4_statfs_arg {
@@ -773,7 +774,7 @@ struct nfs_access_entry;
773 * RPC procedure vector for NFSv2/NFSv3 demuxing 774 * RPC procedure vector for NFSv2/NFSv3 demuxing
774 */ 775 */
775struct nfs_rpc_ops { 776struct nfs_rpc_ops {
776 int version; /* Protocol version */ 777 u32 version; /* Protocol version */
777 struct dentry_operations *dentry_ops; 778 struct dentry_operations *dentry_ops;
778 const struct inode_operations *dir_inode_ops; 779 const struct inode_operations *dir_inode_ops;
779 const struct inode_operations *file_inode_ops; 780 const struct inode_operations *file_inode_ops;
@@ -816,11 +817,11 @@ struct nfs_rpc_ops {
816 struct nfs_pathconf *); 817 struct nfs_pathconf *);
817 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 818 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
818 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus); 819 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
819 void (*read_setup) (struct nfs_read_data *); 820 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
820 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 821 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
821 void (*write_setup) (struct nfs_write_data *, int how); 822 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
822 int (*write_done) (struct rpc_task *, struct nfs_write_data *); 823 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
823 void (*commit_setup) (struct nfs_write_data *, int how); 824 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
824 int (*commit_done) (struct rpc_task *, struct nfs_write_data *); 825 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
825 int (*file_open) (struct inode *, struct file *); 826 int (*file_open) (struct inode *, struct file *);
826 int (*file_release) (struct inode *, struct file *); 827 int (*file_release) (struct inode *, struct file *);
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 538ee1dd3d0a..9fecf902419c 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -7,6 +7,18 @@
7 */ 7 */
8 8
9/** 9/**
10 * DOC: Station handling
11 *
12 * Stations are added per interface, but a special case exists with VLAN
13 * interfaces. When a station is bound to an AP interface, it may be moved
14 * into a VLAN identified by a VLAN interface index (%NL80211_ATTR_STA_VLAN).
15 * The station is still assumed to belong to the AP interface it was added
16 * to.
17 *
18 * TODO: need more info?
19 */
20
21/**
10 * enum nl80211_commands - supported nl80211 commands 22 * enum nl80211_commands - supported nl80211 commands
11 * 23 *
12 * @NL80211_CMD_UNSPEC: unspecified command to catch errors 24 * @NL80211_CMD_UNSPEC: unspecified command to catch errors
@@ -37,6 +49,35 @@
37 * userspace to request deletion of a virtual interface, then requires 49 * userspace to request deletion of a virtual interface, then requires
38 * attribute %NL80211_ATTR_IFINDEX. 50 * attribute %NL80211_ATTR_IFINDEX.
39 * 51 *
52 * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified
53 * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC.
54 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT or
55 * %NL80211_ATTR_KEY_THRESHOLD.
56 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
57 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER
58 * attributes.
59 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
60 * or %NL80211_ATTR_MAC.
61 *
62 * @NL80211_CMD_GET_BEACON: retrieve beacon information (returned in a
63 * %NL80222_CMD_NEW_BEACON message)
64 * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface
65 * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD,
66 * %NL80211_BEACON_HEAD and %NL80211_BEACON_TAIL attributes.
67 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface,
68 * parameters are like for %NL80211_CMD_SET_BEACON.
69 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
70 *
71 * @NL80211_CMD_GET_STATION: Get station attributes for station identified by
72 * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
73 * @NL80211_CMD_SET_STATION: Set station attributes for station identified by
74 * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
75 * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the
76 * the interface identified by %NL80211_ATTR_IFINDEX.
77 * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC
78 * or, if no MAC address given, all stations, on the interface identified
79 * by %NL80211_ATTR_IFINDEX.
80 *
40 * @NL80211_CMD_MAX: highest used command number 81 * @NL80211_CMD_MAX: highest used command number
41 * @__NL80211_CMD_AFTER_LAST: internal use 82 * @__NL80211_CMD_AFTER_LAST: internal use
42 */ 83 */
@@ -54,6 +95,21 @@ enum nl80211_commands {
54 NL80211_CMD_NEW_INTERFACE, 95 NL80211_CMD_NEW_INTERFACE,
55 NL80211_CMD_DEL_INTERFACE, 96 NL80211_CMD_DEL_INTERFACE,
56 97
98 NL80211_CMD_GET_KEY,
99 NL80211_CMD_SET_KEY,
100 NL80211_CMD_NEW_KEY,
101 NL80211_CMD_DEL_KEY,
102
103 NL80211_CMD_GET_BEACON,
104 NL80211_CMD_SET_BEACON,
105 NL80211_CMD_NEW_BEACON,
106 NL80211_CMD_DEL_BEACON,
107
108 NL80211_CMD_GET_STATION,
109 NL80211_CMD_SET_STATION,
110 NL80211_CMD_NEW_STATION,
111 NL80211_CMD_DEL_STATION,
112
57 /* add commands here */ 113 /* add commands here */
58 114
59 /* used to define NL80211_CMD_MAX below */ 115 /* used to define NL80211_CMD_MAX below */
@@ -75,6 +131,36 @@ enum nl80211_commands {
75 * @NL80211_ATTR_IFNAME: network interface name 131 * @NL80211_ATTR_IFNAME: network interface name
76 * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype 132 * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype
77 * 133 *
134 * @NL80211_ATTR_MAC: MAC address (various uses)
135 *
136 * @NL80211_ATTR_KEY_DATA: (temporal) key data; for TKIP this consists of
137 * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC
138 * keys
139 * @NL80211_ATTR_KEY_IDX: key ID (u8, 0-3)
140 * @NL80211_ATTR_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11
141 * section 7.3.2.25.1, e.g. 0x000FAC04)
142 * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and
143 * CCMP keys, each six bytes in little endian
144 *
145 * @NL80211_ATTR_BEACON_INTERVAL: beacon interval in TU
146 * @NL80211_ATTR_DTIM_PERIOD: DTIM period for beaconing
147 * @NL80211_ATTR_BEACON_HEAD: portion of the beacon before the TIM IE
148 * @NL80211_ATTR_BEACON_TAIL: portion of the beacon after the TIM IE
149 *
150 * @NL80211_ATTR_STA_AID: Association ID for the station (u16)
151 * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of
152 * &enum nl80211_sta_flags.
153 * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by
154 * IEEE 802.11 7.3.1.6 (u16).
155 * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported
156 * rates as defined by IEEE 802.11 7.3.2.2 but without the length
157 * restriction (at most %NL80211_MAX_SUPP_RATES).
158 * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station
159 * to, or the AP interface the station was originally added to to.
160 * @NL80211_ATTR_STA_STATS: statistics for a station, part of station info
161 * given for %NL80211_CMD_GET_STATION, nested attribute containing
162 * info as possible, see &enum nl80211_sta_stats.
163 *
78 * @NL80211_ATTR_MAX: highest attribute number currently defined 164 * @NL80211_ATTR_MAX: highest attribute number currently defined
79 * @__NL80211_ATTR_AFTER_LAST: internal use 165 * @__NL80211_ATTR_AFTER_LAST: internal use
80 */ 166 */
@@ -89,12 +175,34 @@ enum nl80211_attrs {
89 NL80211_ATTR_IFNAME, 175 NL80211_ATTR_IFNAME,
90 NL80211_ATTR_IFTYPE, 176 NL80211_ATTR_IFTYPE,
91 177
178 NL80211_ATTR_MAC,
179
180 NL80211_ATTR_KEY_DATA,
181 NL80211_ATTR_KEY_IDX,
182 NL80211_ATTR_KEY_CIPHER,
183 NL80211_ATTR_KEY_SEQ,
184 NL80211_ATTR_KEY_DEFAULT,
185
186 NL80211_ATTR_BEACON_INTERVAL,
187 NL80211_ATTR_DTIM_PERIOD,
188 NL80211_ATTR_BEACON_HEAD,
189 NL80211_ATTR_BEACON_TAIL,
190
191 NL80211_ATTR_STA_AID,
192 NL80211_ATTR_STA_FLAGS,
193 NL80211_ATTR_STA_LISTEN_INTERVAL,
194 NL80211_ATTR_STA_SUPPORTED_RATES,
195 NL80211_ATTR_STA_VLAN,
196 NL80211_ATTR_STA_STATS,
197
92 /* add attributes here, update the policy in nl80211.c */ 198 /* add attributes here, update the policy in nl80211.c */
93 199
94 __NL80211_ATTR_AFTER_LAST, 200 __NL80211_ATTR_AFTER_LAST,
95 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 201 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
96}; 202};
97 203
204#define NL80211_MAX_SUPP_RATES 32
205
98/** 206/**
99 * enum nl80211_iftype - (virtual) interface types 207 * enum nl80211_iftype - (virtual) interface types
100 * 208 *
@@ -126,4 +234,50 @@ enum nl80211_iftype {
126 NL80211_IFTYPE_MAX = __NL80211_IFTYPE_AFTER_LAST - 1 234 NL80211_IFTYPE_MAX = __NL80211_IFTYPE_AFTER_LAST - 1
127}; 235};
128 236
237/**
238 * enum nl80211_sta_flags - station flags
239 *
240 * Station flags. When a station is added to an AP interface, it is
241 * assumed to be already associated (and hence authenticated.)
242 *
243 * @NL80211_STA_FLAG_AUTHORIZED: station is authorized (802.1X)
244 * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
245 * with short barker preamble
246 * @NL80211_STA_FLAG_WME: station is WME/QoS capable
247 */
248enum nl80211_sta_flags {
249 __NL80211_STA_FLAG_INVALID,
250 NL80211_STA_FLAG_AUTHORIZED,
251 NL80211_STA_FLAG_SHORT_PREAMBLE,
252 NL80211_STA_FLAG_WME,
253
254 /* keep last */
255 __NL80211_STA_FLAG_AFTER_LAST,
256 NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
257};
258
259/**
260 * enum nl80211_sta_stats - station statistics
261 *
262 * These attribute types are used with %NL80211_ATTR_STA_STATS
263 * when getting information about a station.
264 *
265 * @__NL80211_STA_STAT_INVALID: attribute number 0 is reserved
266 * @NL80211_STA_STAT_INACTIVE_TIME: time since last activity (u32, msecs)
267 * @NL80211_STA_STAT_RX_BYTES: total received bytes (u32, from this station)
268 * @NL80211_STA_STAT_TX_BYTES: total transmitted bytes (u32, to this station)
269 * @__NL80211_STA_STAT_AFTER_LAST: internal
270 * @NL80211_STA_STAT_MAX: highest possible station stats attribute
271 */
272enum nl80211_sta_stats {
273 __NL80211_STA_STAT_INVALID,
274 NL80211_STA_STAT_INACTIVE_TIME,
275 NL80211_STA_STAT_RX_BYTES,
276 NL80211_STA_STAT_TX_BYTES,
277
278 /* keep last */
279 __NL80211_STA_STAT_AFTER_LAST,
280 NL80211_STA_STAT_MAX = __NL80211_STA_STAT_AFTER_LAST - 1
281};
282
129#endif /* __LINUX_NL80211_H */ 283#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 0c40cc0b4a36..5dfbc684ce7d 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -207,9 +207,7 @@ static inline int notifier_to_errno(int ret)
207#define CPU_DOWN_PREPARE 0x0005 /* CPU (unsigned)v going down */ 207#define CPU_DOWN_PREPARE 0x0005 /* CPU (unsigned)v going down */
208#define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */ 208#define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */
209#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ 209#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
210#define CPU_LOCK_ACQUIRE 0x0008 /* Acquire all hotcpu locks */ 210#define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task,
211#define CPU_LOCK_RELEASE 0x0009 /* Release all hotcpu locks */
212#define CPU_DYING 0x000A /* CPU (unsigned)v not running any task,
213 * not handling interrupts, soon dead */ 211 * not handling interrupts, soon dead */
214 212
215/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend 213/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0dd93bb62fbe..ae1006322f80 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -867,7 +867,7 @@ enum pci_fixup_pass {
867 867
868/* Anonymous variables would be nice... */ 868/* Anonymous variables would be nice... */
869#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ 869#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \
870 static const struct pci_fixup __pci_fixup_##name __attribute_used__ \ 870 static const struct pci_fixup __pci_fixup_##name __used \
871 __attribute__((__section__(#section))) = { vendor, device, hook }; 871 __attribute__((__section__(#section))) = { vendor, device, hook };
872#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 872#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
873 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 873 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index ab4cb6ecd47c..8f67e8f2a3cc 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -174,7 +174,7 @@ extern int pci_hp_register (struct hotplug_slot *slot);
174extern int pci_hp_deregister (struct hotplug_slot *slot); 174extern int pci_hp_deregister (struct hotplug_slot *slot);
175extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, 175extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
176 struct hotplug_slot_info *info); 176 struct hotplug_slot_info *info);
177extern struct kset pci_hotplug_slots_subsys; 177extern struct kset *pci_hotplug_slots_kset;
178 178
179/* PCI Setting Record (Type 0) */ 179/* PCI Setting Record (Type 0) */
180struct hpp_type0 { 180struct hpp_type0 {
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7f2215139e9a..41f6f28690f6 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1943,6 +1943,7 @@
1943#define PCI_DEVICE_ID_NX2_5706 0x164a 1943#define PCI_DEVICE_ID_NX2_5706 0x164a
1944#define PCI_DEVICE_ID_NX2_5708 0x164c 1944#define PCI_DEVICE_ID_NX2_5708 0x164c
1945#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d 1945#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d
1946#define PCI_DEVICE_ID_NX2_57710 0x164e
1946#define PCI_DEVICE_ID_TIGON3_5705 0x1653 1947#define PCI_DEVICE_ID_TIGON3_5705 0x1653
1947#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 1948#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
1948#define PCI_DEVICE_ID_TIGON3_5720 0x1658 1949#define PCI_DEVICE_ID_TIGON3_5720 0x1658
@@ -2066,6 +2067,9 @@
2066#define PCI_VENDOR_ID_NETCELL 0x169c 2067#define PCI_VENDOR_ID_NETCELL 0x169c
2067#define PCI_DEVICE_ID_REVOLUTION 0x0044 2068#define PCI_DEVICE_ID_REVOLUTION 0x0044
2068 2069
2070#define PCI_VENDOR_ID_CENATEK 0x16CA
2071#define PCI_DEVICE_ID_CENATEK_IDE 0x0001
2072
2069#define PCI_VENDOR_ID_VITESSE 0x1725 2073#define PCI_VENDOR_ID_VITESSE 0x1725
2070#define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174 2074#define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174
2071 2075
@@ -2078,6 +2082,16 @@
2078#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea 2082#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea
2079#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb 2083#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb
2080 2084
2085#define PCI_VENDOR_ID_BELKIN 0x1799
2086#define PCI_DEVICE_ID_BELKIN_F5D7010V7 0x701f
2087
2088#define PCI_VENDOR_ID_RDC 0x17f3
2089#define PCI_DEVICE_ID_RDC_R6020 0x6020
2090#define PCI_DEVICE_ID_RDC_R6030 0x6030
2091#define PCI_DEVICE_ID_RDC_R6040 0x6040
2092#define PCI_DEVICE_ID_RDC_R6060 0x6060
2093#define PCI_DEVICE_ID_RDC_R6061 0x6061
2094
2081#define PCI_VENDOR_ID_LENOVO 0x17aa 2095#define PCI_VENDOR_ID_LENOVO 0x17aa
2082 2096
2083#define PCI_VENDOR_ID_ARECA 0x17d3 2097#define PCI_VENDOR_ID_ARECA 0x17d3
@@ -2106,6 +2120,8 @@
2106#define PCI_DEVICE_ID_HERC_WIN 0x5732 2120#define PCI_DEVICE_ID_HERC_WIN 0x5732
2107#define PCI_DEVICE_ID_HERC_UNI 0x5832 2121#define PCI_DEVICE_ID_HERC_UNI 0x5832
2108 2122
2123#define PCI_VENDOR_ID_RDC 0x17f3
2124
2109#define PCI_VENDOR_ID_SITECOM 0x182d 2125#define PCI_VENDOR_ID_SITECOM 0x182d
2110#define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 2126#define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069
2111 2127
diff --git a/include/linux/pcounter.h b/include/linux/pcounter.h
new file mode 100644
index 000000000000..a82d9f2628ca
--- /dev/null
+++ b/include/linux/pcounter.h
@@ -0,0 +1,74 @@
1#ifndef __LINUX_PCOUNTER_H
2#define __LINUX_PCOUNTER_H
3/*
4 * Using a dynamic percpu 'int' variable has a cost :
5 * 1) Extra dereference
6 * Current per_cpu_ptr() implementation uses an array per 'percpu variable'.
7 * 2) memory cost of NR_CPUS*(32+sizeof(void *)) instead of num_possible_cpus()*4
8 *
9 * This pcounter implementation is an abstraction to be able to use
10 * either a static or a dynamic per cpu variable.
11 * One dynamic per cpu variable gets a fast & cheap implementation, we can
12 * change pcounter implementation too.
13 */
14struct pcounter {
15#ifdef CONFIG_SMP
16 void (*add)(struct pcounter *self, int inc);
17 int (*getval)(const struct pcounter *self, int cpu);
18 int *per_cpu_values;
19#else
20 int val;
21#endif
22};
23
24#ifdef CONFIG_SMP
25#include <linux/percpu.h>
26
27#define DEFINE_PCOUNTER(NAME) \
28static DEFINE_PER_CPU(int, NAME##_pcounter_values); \
29static void NAME##_pcounter_add(struct pcounter *self, int val) \
30{ \
31 __get_cpu_var(NAME##_pcounter_values) += val; \
32} \
33static int NAME##_pcounter_getval(const struct pcounter *self, int cpu) \
34{ \
35 return per_cpu(NAME##_pcounter_values, cpu); \
36} \
37
38#define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER) \
39 MEMBER = { \
40 .add = NAME##_pcounter_add, \
41 .getval = NAME##_pcounter_getval, \
42 }
43
44
45static inline void pcounter_add(struct pcounter *self, int inc)
46{
47 self->add(self, inc);
48}
49
50extern int pcounter_getval(const struct pcounter *self);
51extern int pcounter_alloc(struct pcounter *self);
52extern void pcounter_free(struct pcounter *self);
53
54
55#else /* CONFIG_SMP */
56
57static inline void pcounter_add(struct pcounter *self, int inc)
58{
59 self->val += inc;
60}
61
62static inline int pcounter_getval(const struct pcounter *self)
63{
64 return self->val;
65}
66
67#define DEFINE_PCOUNTER(NAME)
68#define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER)
69#define pcounter_alloc(self) 0
70#define pcounter_free(self)
71
72#endif /* CONFIG_SMP */
73
74#endif /* __LINUX_PCOUNTER_H */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 926adaae0f96..00412bb494c4 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -9,6 +9,30 @@
9 9
10#include <asm/percpu.h> 10#include <asm/percpu.h>
11 11
12#ifndef PER_CPU_ATTRIBUTES
13#define PER_CPU_ATTRIBUTES
14#endif
15
16#ifdef CONFIG_SMP
17#define DEFINE_PER_CPU(type, name) \
18 __attribute__((__section__(".data.percpu"))) \
19 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
20
21#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
22 __attribute__((__section__(".data.percpu.shared_aligned"))) \
23 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \
24 ____cacheline_aligned_in_smp
25#else
26#define DEFINE_PER_CPU(type, name) \
27 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
28
29#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
30 DEFINE_PER_CPU(type, name)
31#endif
32
33#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
34#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
35
12/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ 36/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
13#ifndef PERCPU_ENOUGH_ROOM 37#ifndef PERCPU_ENOUGH_ROOM
14#ifdef CONFIG_MODULES 38#ifdef CONFIG_MODULES
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 919af93b7059..32761352e858 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -83,6 +83,8 @@ struct tc_ratespec
83 __u32 rate; 83 __u32 rate;
84}; 84};
85 85
86#define TC_RTAB_SIZE 1024
87
86/* FIFO section */ 88/* FIFO section */
87 89
88struct tc_fifo_qopt 90struct tc_fifo_qopt
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h
index 5ea4f05683f6..04b4d7330e6d 100644
--- a/include/linux/pktcdvd.h
+++ b/include/linux/pktcdvd.h
@@ -290,7 +290,7 @@ struct pktcdvd_device
290 int write_congestion_off; 290 int write_congestion_off;
291 int write_congestion_on; 291 int write_congestion_on;
292 292
293 struct class_device *clsdev; /* sysfs pktcdvd[0-7] class dev */ 293 struct device *dev; /* sysfs pktcdvd[0-7] dev */
294 struct pktcdvd_kobj *kobj_stat; /* sysfs pktcdvd[0-7]/stat/ */ 294 struct pktcdvd_kobj *kobj_stat; /* sysfs pktcdvd[0-7]/stat/ */
295 struct pktcdvd_kobj *kobj_wqueue; /* sysfs pktcdvd[0-7]/write_queue/ */ 295 struct pktcdvd_kobj *kobj_wqueue; /* sysfs pktcdvd[0-7]/write_queue/ */
296 296
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index e80804316cdb..3261681c82a4 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -35,7 +35,7 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, u
35extern int platform_get_irq_byname(struct platform_device *, char *); 35extern int platform_get_irq_byname(struct platform_device *, char *);
36extern int platform_add_devices(struct platform_device **, int); 36extern int platform_add_devices(struct platform_device **, int);
37 37
38extern struct platform_device *platform_device_register_simple(char *, int id, 38extern struct platform_device *platform_device_register_simple(const char *, int id,
39 struct resource *, unsigned int); 39 struct resource *, unsigned int);
40 40
41extern struct platform_device *platform_device_alloc(const char *name, int id); 41extern struct platform_device *platform_device_alloc(const char *name, int id);
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index a5316829215b..8f92546b403d 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -201,6 +201,8 @@ static inline struct proc_dir_entry *create_proc_info_entry(const char *name,
201extern struct proc_dir_entry *proc_net_fops_create(struct net *net, 201extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
202 const char *name, mode_t mode, const struct file_operations *fops); 202 const char *name, mode_t mode, const struct file_operations *fops);
203extern void proc_net_remove(struct net *net, const char *name); 203extern void proc_net_remove(struct net *net, const char *name);
204extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
205 struct proc_dir_entry *parent);
204 206
205#else 207#else
206 208
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 3ea5750a0f7e..515bff053de8 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -129,6 +129,81 @@ int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data);
129#define force_successful_syscall_return() do { } while (0) 129#define force_successful_syscall_return() do { } while (0)
130#endif 130#endif
131 131
132/*
133 * <asm/ptrace.h> should define the following things inside #ifdef __KERNEL__.
134 *
135 * These do-nothing inlines are used when the arch does not
136 * implement single-step. The kerneldoc comments are here
137 * to document the interface for all arch definitions.
138 */
139
140#ifndef arch_has_single_step
141/**
142 * arch_has_single_step - does this CPU support user-mode single-step?
143 *
144 * If this is defined, then there must be function declarations or
145 * inlines for user_enable_single_step() and user_disable_single_step().
146 * arch_has_single_step() should evaluate to nonzero iff the machine
147 * supports instruction single-step for user mode.
148 * It can be a constant or it can test a CPU feature bit.
149 */
150#define arch_has_single_step() (0)
151
152/**
153 * user_enable_single_step - single-step in user-mode task
154 * @task: either current or a task stopped in %TASK_TRACED
155 *
156 * This can only be called when arch_has_single_step() has returned nonzero.
157 * Set @task so that when it returns to user mode, it will trap after the
158 * next single instruction executes. If arch_has_block_step() is defined,
159 * this must clear the effects of user_enable_block_step() too.
160 */
161static inline void user_enable_single_step(struct task_struct *task)
162{
163 BUG(); /* This can never be called. */
164}
165
166/**
167 * user_disable_single_step - cancel user-mode single-step
168 * @task: either current or a task stopped in %TASK_TRACED
169 *
170 * Clear @task of the effects of user_enable_single_step() and
171 * user_enable_block_step(). This can be called whether or not either
172 * of those was ever called on @task, and even if arch_has_single_step()
173 * returned zero.
174 */
175static inline void user_disable_single_step(struct task_struct *task)
176{
177}
178#endif /* arch_has_single_step */
179
180#ifndef arch_has_block_step
181/**
182 * arch_has_block_step - does this CPU support user-mode block-step?
183 *
184 * If this is defined, then there must be a function declaration or inline
185 * for user_enable_block_step(), and arch_has_single_step() must be defined
186 * too. arch_has_block_step() should evaluate to nonzero iff the machine
187 * supports step-until-branch for user mode. It can be a constant or it
188 * can test a CPU feature bit.
189 */
190#define arch_has_block_step() (0)
191
192/**
193 * user_enable_block_step - step until branch in user-mode task
194 * @task: either current or a task stopped in %TASK_TRACED
195 *
196 * This can only be called when arch_has_block_step() has returned nonzero,
197 * and will never be called when single-instruction stepping is being used.
198 * Set @task so that when it returns to user mode, it will trap after the
199 * next branch or trap taken.
200 */
201static inline void user_enable_block_step(struct task_struct *task)
202{
203 BUG(); /* This can never be called. */
204}
205#endif /* arch_has_block_step */
206
132#endif 207#endif
133 208
134#endif 209#endif
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
new file mode 100644
index 000000000000..4d6624260b4c
--- /dev/null
+++ b/include/linux/rcuclassic.h
@@ -0,0 +1,164 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (classic version)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright IBM Corporation, 2001
19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paulmck@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of Read-Copy Update mechanism see -
29 * Documentation/RCU
30 *
31 */
32
33#ifndef __LINUX_RCUCLASSIC_H
34#define __LINUX_RCUCLASSIC_H
35
36#ifdef __KERNEL__
37
38#include <linux/cache.h>
39#include <linux/spinlock.h>
40#include <linux/threads.h>
41#include <linux/percpu.h>
42#include <linux/cpumask.h>
43#include <linux/seqlock.h>
44
45
46/* Global control variables for rcupdate callback mechanism. */
47struct rcu_ctrlblk {
48 long cur; /* Current batch number. */
49 long completed; /* Number of the last completed batch */
50 int next_pending; /* Is the next batch already waiting? */
51
52 int signaled;
53
54 spinlock_t lock ____cacheline_internodealigned_in_smp;
55 cpumask_t cpumask; /* CPUs that need to switch in order */
56 /* for current batch to proceed. */
57} ____cacheline_internodealigned_in_smp;
58
59/* Is batch a before batch b ? */
60static inline int rcu_batch_before(long a, long b)
61{
62 return (a - b) < 0;
63}
64
65/* Is batch a after batch b ? */
66static inline int rcu_batch_after(long a, long b)
67{
68 return (a - b) > 0;
69}
70
71/*
72 * Per-CPU data for Read-Copy UPdate.
73 * nxtlist - new callbacks are added here
74 * curlist - current batch for which quiescent cycle started if any
75 */
76struct rcu_data {
77 /* 1) quiescent state handling : */
78 long quiescbatch; /* Batch # for grace period */
79 int passed_quiesc; /* User-mode/idle loop etc. */
80 int qs_pending; /* core waits for quiesc state */
81
82 /* 2) batch handling */
83 long batch; /* Batch # for current RCU batch */
84 struct rcu_head *nxtlist;
85 struct rcu_head **nxttail;
86 long qlen; /* # of queued callbacks */
87 struct rcu_head *curlist;
88 struct rcu_head **curtail;
89 struct rcu_head *donelist;
90 struct rcu_head **donetail;
91 long blimit; /* Upper limit on a processed batch */
92 int cpu;
93 struct rcu_head barrier;
94};
95
96DECLARE_PER_CPU(struct rcu_data, rcu_data);
97DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
98
99/*
100 * Increment the quiescent state counter.
101 * The counter is a bit degenerated: We do not need to know
102 * how many quiescent states passed, just if there was at least
103 * one since the start of the grace period. Thus just a flag.
104 */
105static inline void rcu_qsctr_inc(int cpu)
106{
107 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
108 rdp->passed_quiesc = 1;
109}
110static inline void rcu_bh_qsctr_inc(int cpu)
111{
112 struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
113 rdp->passed_quiesc = 1;
114}
115
116extern int rcu_pending(int cpu);
117extern int rcu_needs_cpu(int cpu);
118
119#ifdef CONFIG_DEBUG_LOCK_ALLOC
120extern struct lockdep_map rcu_lock_map;
121# define rcu_read_acquire() \
122 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, _THIS_IP_)
123# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
124#else
125# define rcu_read_acquire() do { } while (0)
126# define rcu_read_release() do { } while (0)
127#endif
128
129#define __rcu_read_lock() \
130 do { \
131 preempt_disable(); \
132 __acquire(RCU); \
133 rcu_read_acquire(); \
134 } while (0)
135#define __rcu_read_unlock() \
136 do { \
137 rcu_read_release(); \
138 __release(RCU); \
139 preempt_enable(); \
140 } while (0)
141#define __rcu_read_lock_bh() \
142 do { \
143 local_bh_disable(); \
144 __acquire(RCU_BH); \
145 rcu_read_acquire(); \
146 } while (0)
147#define __rcu_read_unlock_bh() \
148 do { \
149 rcu_read_release(); \
150 __release(RCU_BH); \
151 local_bh_enable(); \
152 } while (0)
153
154#define __synchronize_sched() synchronize_rcu()
155
156extern void __rcu_init(void);
157extern void rcu_check_callbacks(int cpu, int user);
158extern void rcu_restart_cpu(int cpu);
159
160extern long rcu_batches_completed(void);
161extern long rcu_batches_completed_bh(void);
162
163#endif /* __KERNEL__ */
164#endif /* __LINUX_RCUCLASSIC_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index cc24a01df940..d32c14de270e 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -15,7 +15,7 @@
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 * 17 *
18 * Copyright (C) IBM Corporation, 2001 18 * Copyright IBM Corporation, 2001
19 * 19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com> 20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 * 21 *
@@ -53,96 +53,18 @@ struct rcu_head {
53 void (*func)(struct rcu_head *head); 53 void (*func)(struct rcu_head *head);
54}; 54};
55 55
56#ifdef CONFIG_CLASSIC_RCU
57#include <linux/rcuclassic.h>
58#else /* #ifdef CONFIG_CLASSIC_RCU */
59#include <linux/rcupreempt.h>
60#endif /* #else #ifdef CONFIG_CLASSIC_RCU */
61
56#define RCU_HEAD_INIT { .next = NULL, .func = NULL } 62#define RCU_HEAD_INIT { .next = NULL, .func = NULL }
57#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT 63#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT
58#define INIT_RCU_HEAD(ptr) do { \ 64#define INIT_RCU_HEAD(ptr) do { \
59 (ptr)->next = NULL; (ptr)->func = NULL; \ 65 (ptr)->next = NULL; (ptr)->func = NULL; \
60} while (0) 66} while (0)
61 67
62
63
64/* Global control variables for rcupdate callback mechanism. */
65struct rcu_ctrlblk {
66 long cur; /* Current batch number. */
67 long completed; /* Number of the last completed batch */
68 int next_pending; /* Is the next batch already waiting? */
69
70 int signaled;
71
72 spinlock_t lock ____cacheline_internodealigned_in_smp;
73 cpumask_t cpumask; /* CPUs that need to switch in order */
74 /* for current batch to proceed. */
75} ____cacheline_internodealigned_in_smp;
76
77/* Is batch a before batch b ? */
78static inline int rcu_batch_before(long a, long b)
79{
80 return (a - b) < 0;
81}
82
83/* Is batch a after batch b ? */
84static inline int rcu_batch_after(long a, long b)
85{
86 return (a - b) > 0;
87}
88
89/*
90 * Per-CPU data for Read-Copy UPdate.
91 * nxtlist - new callbacks are added here
92 * curlist - current batch for which quiescent cycle started if any
93 */
94struct rcu_data {
95 /* 1) quiescent state handling : */
96 long quiescbatch; /* Batch # for grace period */
97 int passed_quiesc; /* User-mode/idle loop etc. */
98 int qs_pending; /* core waits for quiesc state */
99
100 /* 2) batch handling */
101 long batch; /* Batch # for current RCU batch */
102 struct rcu_head *nxtlist;
103 struct rcu_head **nxttail;
104 long qlen; /* # of queued callbacks */
105 struct rcu_head *curlist;
106 struct rcu_head **curtail;
107 struct rcu_head *donelist;
108 struct rcu_head **donetail;
109 long blimit; /* Upper limit on a processed batch */
110 int cpu;
111 struct rcu_head barrier;
112};
113
114DECLARE_PER_CPU(struct rcu_data, rcu_data);
115DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
116
117/*
118 * Increment the quiescent state counter.
119 * The counter is a bit degenerated: We do not need to know
120 * how many quiescent states passed, just if there was at least
121 * one since the start of the grace period. Thus just a flag.
122 */
123static inline void rcu_qsctr_inc(int cpu)
124{
125 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
126 rdp->passed_quiesc = 1;
127}
128static inline void rcu_bh_qsctr_inc(int cpu)
129{
130 struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
131 rdp->passed_quiesc = 1;
132}
133
134extern int rcu_pending(int cpu);
135extern int rcu_needs_cpu(int cpu);
136
137#ifdef CONFIG_DEBUG_LOCK_ALLOC
138extern struct lockdep_map rcu_lock_map;
139# define rcu_read_acquire() lock_acquire(&rcu_lock_map, 0, 0, 2, 1, _THIS_IP_)
140# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
141#else
142# define rcu_read_acquire() do { } while (0)
143# define rcu_read_release() do { } while (0)
144#endif
145
146/** 68/**
147 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 69 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
148 * 70 *
@@ -172,24 +94,13 @@ extern struct lockdep_map rcu_lock_map;
172 * 94 *
173 * It is illegal to block while in an RCU read-side critical section. 95 * It is illegal to block while in an RCU read-side critical section.
174 */ 96 */
175#define rcu_read_lock() \ 97#define rcu_read_lock() __rcu_read_lock()
176 do { \
177 preempt_disable(); \
178 __acquire(RCU); \
179 rcu_read_acquire(); \
180 } while(0)
181 98
182/** 99/**
183 * rcu_read_unlock - marks the end of an RCU read-side critical section. 100 * rcu_read_unlock - marks the end of an RCU read-side critical section.
184 * 101 *
185 * See rcu_read_lock() for more information. 102 * See rcu_read_lock() for more information.
186 */ 103 */
187#define rcu_read_unlock() \
188 do { \
189 rcu_read_release(); \
190 __release(RCU); \
191 preempt_enable(); \
192 } while(0)
193 104
194/* 105/*
195 * So where is rcu_write_lock()? It does not exist, as there is no 106 * So where is rcu_write_lock()? It does not exist, as there is no
@@ -200,6 +111,7 @@ extern struct lockdep_map rcu_lock_map;
200 * used as well. RCU does not care how the writers keep out of each 111 * used as well. RCU does not care how the writers keep out of each
201 * others' way, as long as they do so. 112 * others' way, as long as they do so.
202 */ 113 */
114#define rcu_read_unlock() __rcu_read_unlock()
203 115
204/** 116/**
205 * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section 117 * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section
@@ -212,24 +124,14 @@ extern struct lockdep_map rcu_lock_map;
212 * can use just rcu_read_lock(). 124 * can use just rcu_read_lock().
213 * 125 *
214 */ 126 */
215#define rcu_read_lock_bh() \ 127#define rcu_read_lock_bh() __rcu_read_lock_bh()
216 do { \
217 local_bh_disable(); \
218 __acquire(RCU_BH); \
219 rcu_read_acquire(); \
220 } while(0)
221 128
222/* 129/*
223 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section 130 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section
224 * 131 *
225 * See rcu_read_lock_bh() for more information. 132 * See rcu_read_lock_bh() for more information.
226 */ 133 */
227#define rcu_read_unlock_bh() \ 134#define rcu_read_unlock_bh() __rcu_read_unlock_bh()
228 do { \
229 rcu_read_release(); \
230 __release(RCU_BH); \
231 local_bh_enable(); \
232 } while(0)
233 135
234/* 136/*
235 * Prevent the compiler from merging or refetching accesses. The compiler 137 * Prevent the compiler from merging or refetching accesses. The compiler
@@ -293,21 +195,52 @@ extern struct lockdep_map rcu_lock_map;
293 * In "classic RCU", these two guarantees happen to be one and 195 * In "classic RCU", these two guarantees happen to be one and
294 * the same, but can differ in realtime RCU implementations. 196 * the same, but can differ in realtime RCU implementations.
295 */ 197 */
296#define synchronize_sched() synchronize_rcu() 198#define synchronize_sched() __synchronize_sched()
297 199
298extern void rcu_init(void); 200/**
299extern void rcu_check_callbacks(int cpu, int user); 201 * call_rcu - Queue an RCU callback for invocation after a grace period.
300extern void rcu_restart_cpu(int cpu); 202 * @head: structure to be used for queueing the RCU updates.
301extern long rcu_batches_completed(void); 203 * @func: actual update function to be invoked after the grace period
302extern long rcu_batches_completed_bh(void); 204 *
205 * The update function will be invoked some time after a full grace
206 * period elapses, in other words after all currently executing RCU
207 * read-side critical sections have completed. RCU read-side critical
208 * sections are delimited by rcu_read_lock() and rcu_read_unlock(),
209 * and may be nested.
210 */
211extern void call_rcu(struct rcu_head *head,
212 void (*func)(struct rcu_head *head));
303 213
304/* Exported interfaces */ 214/**
305extern void FASTCALL(call_rcu(struct rcu_head *head, 215 * call_rcu_bh - Queue an RCU for invocation after a quicker grace period.
306 void (*func)(struct rcu_head *head))); 216 * @head: structure to be used for queueing the RCU updates.
307extern void FASTCALL(call_rcu_bh(struct rcu_head *head, 217 * @func: actual update function to be invoked after the grace period
308 void (*func)(struct rcu_head *head))); 218 *
219 * The update function will be invoked some time after a full grace
220 * period elapses, in other words after all currently executing RCU
221 * read-side critical sections have completed. call_rcu_bh() assumes
222 * that the read-side critical sections end on completion of a softirq
223 * handler. This means that read-side critical sections in process
224 * context must not be interrupted by softirqs. This interface is to be
225 * used when most of the read-side critical sections are in softirq context.
226 * RCU read-side critical sections are delimited by :
227 * - rcu_read_lock() and rcu_read_unlock(), if in interrupt context.
228 * OR
229 * - rcu_read_lock_bh() and rcu_read_unlock_bh(), if in process context.
230 * These may be nested.
231 */
232extern void call_rcu_bh(struct rcu_head *head,
233 void (*func)(struct rcu_head *head));
234
235/* Exported common interfaces */
309extern void synchronize_rcu(void); 236extern void synchronize_rcu(void);
310extern void rcu_barrier(void); 237extern void rcu_barrier(void);
238extern long rcu_batches_completed(void);
239extern long rcu_batches_completed_bh(void);
240
241/* Internal to kernel */
242extern void rcu_init(void);
243extern int rcu_needs_cpu(int cpu);
311 244
312#endif /* __KERNEL__ */ 245#endif /* __KERNEL__ */
313#endif /* __LINUX_RCUPDATE_H */ 246#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
new file mode 100644
index 000000000000..ece8eb3e4151
--- /dev/null
+++ b/include/linux/rcupreempt.h
@@ -0,0 +1,86 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (RT implementation)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright (C) IBM Corporation, 2006
19 *
20 * Author: Paul McKenney <paulmck@us.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of Read-Copy Update mechanism see -
29 * Documentation/RCU
30 *
31 */
32
33#ifndef __LINUX_RCUPREEMPT_H
34#define __LINUX_RCUPREEMPT_H
35
36#ifdef __KERNEL__
37
38#include <linux/cache.h>
39#include <linux/spinlock.h>
40#include <linux/threads.h>
41#include <linux/percpu.h>
42#include <linux/cpumask.h>
43#include <linux/seqlock.h>
44
45#define rcu_qsctr_inc(cpu)
46#define rcu_bh_qsctr_inc(cpu)
47#define call_rcu_bh(head, rcu) call_rcu(head, rcu)
48
49extern void __rcu_read_lock(void);
50extern void __rcu_read_unlock(void);
51extern int rcu_pending(int cpu);
52extern int rcu_needs_cpu(int cpu);
53
54#define __rcu_read_lock_bh() { rcu_read_lock(); local_bh_disable(); }
55#define __rcu_read_unlock_bh() { local_bh_enable(); rcu_read_unlock(); }
56
57extern void __synchronize_sched(void);
58
59extern void __rcu_init(void);
60extern void rcu_check_callbacks(int cpu, int user);
61extern void rcu_restart_cpu(int cpu);
62extern long rcu_batches_completed(void);
63
64/*
65 * Return the number of RCU batches processed thus far. Useful for debug
66 * and statistic. The _bh variant is identifcal to straight RCU
67 */
68static inline long rcu_batches_completed_bh(void)
69{
70 return rcu_batches_completed();
71}
72
73#ifdef CONFIG_RCU_TRACE
74struct rcupreempt_trace;
75extern long *rcupreempt_flipctr(int cpu);
76extern long rcupreempt_data_completed(void);
77extern int rcupreempt_flip_flag(int cpu);
78extern int rcupreempt_mb_flag(int cpu);
79extern char *rcupreempt_try_flip_state_name(void);
80extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
81#endif
82
83struct softirq_action;
84
85#endif /* __KERNEL__ */
86#endif /* __LINUX_RCUPREEMPT_H */
diff --git a/include/linux/rcupreempt_trace.h b/include/linux/rcupreempt_trace.h
new file mode 100644
index 000000000000..21cd6b2a5c42
--- /dev/null
+++ b/include/linux/rcupreempt_trace.h
@@ -0,0 +1,99 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (RT implementation)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright (C) IBM Corporation, 2006
19 *
20 * Author: Paul McKenney <paulmck@us.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of the Preemptible Read-Copy Update mechanism see -
29 * http://lwn.net/Articles/253651/
30 */
31
32#ifndef __LINUX_RCUPREEMPT_TRACE_H
33#define __LINUX_RCUPREEMPT_TRACE_H
34
35#ifdef __KERNEL__
36#include <linux/types.h>
37#include <linux/kernel.h>
38
39#include <asm/atomic.h>
40
41/*
42 * PREEMPT_RCU data structures.
43 */
44
45struct rcupreempt_trace {
46 long next_length;
47 long next_add;
48 long wait_length;
49 long wait_add;
50 long done_length;
51 long done_add;
52 long done_remove;
53 atomic_t done_invoked;
54 long rcu_check_callbacks;
55 atomic_t rcu_try_flip_1;
56 atomic_t rcu_try_flip_e1;
57 long rcu_try_flip_i1;
58 long rcu_try_flip_ie1;
59 long rcu_try_flip_g1;
60 long rcu_try_flip_a1;
61 long rcu_try_flip_ae1;
62 long rcu_try_flip_a2;
63 long rcu_try_flip_z1;
64 long rcu_try_flip_ze1;
65 long rcu_try_flip_z2;
66 long rcu_try_flip_m1;
67 long rcu_try_flip_me1;
68 long rcu_try_flip_m2;
69};
70
71#ifdef CONFIG_RCU_TRACE
72#define RCU_TRACE(fn, arg) fn(arg);
73#else
74#define RCU_TRACE(fn, arg)
75#endif
76
77extern void rcupreempt_trace_move2done(struct rcupreempt_trace *trace);
78extern void rcupreempt_trace_move2wait(struct rcupreempt_trace *trace);
79extern void rcupreempt_trace_try_flip_1(struct rcupreempt_trace *trace);
80extern void rcupreempt_trace_try_flip_e1(struct rcupreempt_trace *trace);
81extern void rcupreempt_trace_try_flip_i1(struct rcupreempt_trace *trace);
82extern void rcupreempt_trace_try_flip_ie1(struct rcupreempt_trace *trace);
83extern void rcupreempt_trace_try_flip_g1(struct rcupreempt_trace *trace);
84extern void rcupreempt_trace_try_flip_a1(struct rcupreempt_trace *trace);
85extern void rcupreempt_trace_try_flip_ae1(struct rcupreempt_trace *trace);
86extern void rcupreempt_trace_try_flip_a2(struct rcupreempt_trace *trace);
87extern void rcupreempt_trace_try_flip_z1(struct rcupreempt_trace *trace);
88extern void rcupreempt_trace_try_flip_ze1(struct rcupreempt_trace *trace);
89extern void rcupreempt_trace_try_flip_z2(struct rcupreempt_trace *trace);
90extern void rcupreempt_trace_try_flip_m1(struct rcupreempt_trace *trace);
91extern void rcupreempt_trace_try_flip_me1(struct rcupreempt_trace *trace);
92extern void rcupreempt_trace_try_flip_m2(struct rcupreempt_trace *trace);
93extern void rcupreempt_trace_check_callbacks(struct rcupreempt_trace *trace);
94extern void rcupreempt_trace_done_remove(struct rcupreempt_trace *trace);
95extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace);
96extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace);
97
98#endif /* __KERNEL__ */
99#endif /* __LINUX_RCUPREEMPT_TRACE_H */
diff --git a/include/linux/regset.h b/include/linux/regset.h
new file mode 100644
index 000000000000..8abee6556223
--- /dev/null
+++ b/include/linux/regset.h
@@ -0,0 +1,368 @@
1/*
2 * User-mode machine state access
3 *
4 * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * Red Hat Author: Roland McGrath.
11 */
12
13#ifndef _LINUX_REGSET_H
14#define _LINUX_REGSET_H 1
15
16#include <linux/compiler.h>
17#include <linux/types.h>
18#include <linux/uaccess.h>
19struct task_struct;
20struct user_regset;
21
22
23/**
24 * user_regset_active_fn - type of @active function in &struct user_regset
25 * @target: thread being examined
26 * @regset: regset being examined
27 *
28 * Return -%ENODEV if not available on the hardware found.
29 * Return %0 if no interesting state in this thread.
30 * Return >%0 number of @size units of interesting state.
31 * Any get call fetching state beyond that number will
32 * see the default initialization state for this data,
33 * so a caller that knows what the default state is need
34 * not copy it all out.
35 * This call is optional; the pointer is %NULL if there
36 * is no inexpensive check to yield a value < @n.
37 */
38typedef int user_regset_active_fn(struct task_struct *target,
39 const struct user_regset *regset);
40
41/**
42 * user_regset_get_fn - type of @get function in &struct user_regset
43 * @target: thread being examined
44 * @regset: regset being examined
45 * @pos: offset into the regset data to access, in bytes
46 * @count: amount of data to copy, in bytes
47 * @kbuf: if not %NULL, a kernel-space pointer to copy into
48 * @ubuf: if @kbuf is %NULL, a user-space pointer to copy into
49 *
50 * Fetch register values. Return %0 on success; -%EIO or -%ENODEV
51 * are usual failure returns. The @pos and @count values are in
52 * bytes, but must be properly aligned. If @kbuf is non-null, that
53 * buffer is used and @ubuf is ignored. If @kbuf is %NULL, then
54 * ubuf gives a userland pointer to access directly, and an -%EFAULT
55 * return value is possible.
56 */
57typedef int user_regset_get_fn(struct task_struct *target,
58 const struct user_regset *regset,
59 unsigned int pos, unsigned int count,
60 void *kbuf, void __user *ubuf);
61
62/**
63 * user_regset_set_fn - type of @set function in &struct user_regset
64 * @target: thread being examined
65 * @regset: regset being examined
66 * @pos: offset into the regset data to access, in bytes
67 * @count: amount of data to copy, in bytes
68 * @kbuf: if not %NULL, a kernel-space pointer to copy from
69 * @ubuf: if @kbuf is %NULL, a user-space pointer to copy from
70 *
71 * Store register values. Return %0 on success; -%EIO or -%ENODEV
72 * are usual failure returns. The @pos and @count values are in
73 * bytes, but must be properly aligned. If @kbuf is non-null, that
74 * buffer is used and @ubuf is ignored. If @kbuf is %NULL, then
75 * ubuf gives a userland pointer to access directly, and an -%EFAULT
76 * return value is possible.
77 */
78typedef int user_regset_set_fn(struct task_struct *target,
79 const struct user_regset *regset,
80 unsigned int pos, unsigned int count,
81 const void *kbuf, const void __user *ubuf);
82
83/**
84 * user_regset_writeback_fn - type of @writeback function in &struct user_regset
85 * @target: thread being examined
86 * @regset: regset being examined
87 * @immediate: zero if writeback at completion of next context switch is OK
88 *
89 * This call is optional; usually the pointer is %NULL. When
90 * provided, there is some user memory associated with this regset's
91 * hardware, such as memory backing cached register data on register
92 * window machines; the regset's data controls what user memory is
93 * used (e.g. via the stack pointer value).
94 *
95 * Write register data back to user memory. If the @immediate flag
96 * is nonzero, it must be written to the user memory so uaccess or
97 * access_process_vm() can see it when this call returns; if zero,
98 * then it must be written back by the time the task completes a
99 * context switch (as synchronized with wait_task_inactive()).
100 * Return %0 on success or if there was nothing to do, -%EFAULT for
101 * a memory problem (bad stack pointer or whatever), or -%EIO for a
102 * hardware problem.
103 */
104typedef int user_regset_writeback_fn(struct task_struct *target,
105 const struct user_regset *regset,
106 int immediate);
107
108/**
109 * struct user_regset - accessible thread CPU state
110 * @n: Number of slots (registers).
111 * @size: Size in bytes of a slot (register).
112 * @align: Required alignment, in bytes.
113 * @bias: Bias from natural indexing.
114 * @core_note_type: ELF note @n_type value used in core dumps.
115 * @get: Function to fetch values.
116 * @set: Function to store values.
117 * @active: Function to report if regset is active, or %NULL.
118 * @writeback: Function to write data back to user memory, or %NULL.
119 *
120 * This data structure describes a machine resource we call a register set.
121 * This is part of the state of an individual thread, not necessarily
122 * actual CPU registers per se. A register set consists of a number of
123 * similar slots, given by @n. Each slot is @size bytes, and aligned to
124 * @align bytes (which is at least @size).
125 *
126 * These functions must be called only on the current thread or on a
127 * thread that is in %TASK_STOPPED or %TASK_TRACED state, that we are
128 * guaranteed will not be woken up and return to user mode, and that we
129 * have called wait_task_inactive() on. (The target thread always might
130 * wake up for SIGKILL while these functions are working, in which case
131 * that thread's user_regset state might be scrambled.)
132 *
133 * The @pos argument must be aligned according to @align; the @count
134 * argument must be a multiple of @size. These functions are not
135 * responsible for checking for invalid arguments.
136 *
137 * When there is a natural value to use as an index, @bias gives the
138 * difference between the natural index and the slot index for the
139 * register set. For example, x86 GDT segment descriptors form a regset;
140 * the segment selector produces a natural index, but only a subset of
141 * that index space is available as a regset (the TLS slots); subtracting
142 * @bias from a segment selector index value computes the regset slot.
143 *
144 * If nonzero, @core_note_type gives the n_type field (NT_* value)
145 * of the core file note in which this regset's data appears.
146 * NT_PRSTATUS is a special case in that the regset data starts at
147 * offsetof(struct elf_prstatus, pr_reg) into the note data; that is
148 * part of the per-machine ELF formats userland knows about. In
149 * other cases, the core file note contains exactly the whole regset
150 * (@n * @size) and nothing else. The core file note is normally
151 * omitted when there is an @active function and it returns zero.
152 */
153struct user_regset {
154 user_regset_get_fn *get;
155 user_regset_set_fn *set;
156 user_regset_active_fn *active;
157 user_regset_writeback_fn *writeback;
158 unsigned int n;
159 unsigned int size;
160 unsigned int align;
161 unsigned int bias;
162 unsigned int core_note_type;
163};
164
165/**
166 * struct user_regset_view - available regsets
167 * @name: Identifier, e.g. UTS_MACHINE string.
168 * @regsets: Array of @n regsets available in this view.
169 * @n: Number of elements in @regsets.
170 * @e_machine: ELF header @e_machine %EM_* value written in core dumps.
171 * @e_flags: ELF header @e_flags value written in core dumps.
172 * @ei_osabi: ELF header @e_ident[%EI_OSABI] value written in core dumps.
173 *
174 * A regset view is a collection of regsets (&struct user_regset,
175 * above). This describes all the state of a thread that can be seen
176 * from a given architecture/ABI environment. More than one view might
177 * refer to the same &struct user_regset, or more than one regset
178 * might refer to the same machine-specific state in the thread. For
179 * example, a 32-bit thread's state could be examined from the 32-bit
180 * view or from the 64-bit view. Either method reaches the same thread
181 * register state, doing appropriate widening or truncation.
182 */
183struct user_regset_view {
184 const char *name;
185 const struct user_regset *regsets;
186 unsigned int n;
187 u32 e_flags;
188 u16 e_machine;
189 u8 ei_osabi;
190};
191
192/*
193 * This is documented here rather than at the definition sites because its
194 * implementation is machine-dependent but its interface is universal.
195 */
196/**
197 * task_user_regset_view - Return the process's native regset view.
198 * @tsk: a thread of the process in question
199 *
200 * Return the &struct user_regset_view that is native for the given process.
201 * For example, what it would access when it called ptrace().
202 * Throughout the life of the process, this only changes at exec.
203 */
204const struct user_regset_view *task_user_regset_view(struct task_struct *tsk);
205
206
207/*
208 * These are helpers for writing regset get/set functions in arch code.
209 * Because @start_pos and @end_pos are always compile-time constants,
210 * these are inlined into very little code though they look large.
211 *
212 * Use one or more calls sequentially for each chunk of regset data stored
213 * contiguously in memory. Call with constants for @start_pos and @end_pos,
214 * giving the range of byte positions in the regset that data corresponds
215 * to; @end_pos can be -1 if this chunk is at the end of the regset layout.
216 * Each call updates the arguments to point past its chunk.
217 */
218
219static inline int user_regset_copyout(unsigned int *pos, unsigned int *count,
220 void **kbuf,
221 void __user **ubuf, const void *data,
222 const int start_pos, const int end_pos)
223{
224 if (*count == 0)
225 return 0;
226 BUG_ON(*pos < start_pos);
227 if (end_pos < 0 || *pos < end_pos) {
228 unsigned int copy = (end_pos < 0 ? *count
229 : min(*count, end_pos - *pos));
230 data += *pos - start_pos;
231 if (*kbuf) {
232 memcpy(*kbuf, data, copy);
233 *kbuf += copy;
234 } else if (__copy_to_user(*ubuf, data, copy))
235 return -EFAULT;
236 else
237 *ubuf += copy;
238 *pos += copy;
239 *count -= copy;
240 }
241 return 0;
242}
243
244static inline int user_regset_copyin(unsigned int *pos, unsigned int *count,
245 const void **kbuf,
246 const void __user **ubuf, void *data,
247 const int start_pos, const int end_pos)
248{
249 if (*count == 0)
250 return 0;
251 BUG_ON(*pos < start_pos);
252 if (end_pos < 0 || *pos < end_pos) {
253 unsigned int copy = (end_pos < 0 ? *count
254 : min(*count, end_pos - *pos));
255 data += *pos - start_pos;
256 if (*kbuf) {
257 memcpy(data, *kbuf, copy);
258 *kbuf += copy;
259 } else if (__copy_from_user(data, *ubuf, copy))
260 return -EFAULT;
261 else
262 *ubuf += copy;
263 *pos += copy;
264 *count -= copy;
265 }
266 return 0;
267}
268
269/*
270 * These two parallel the two above, but for portions of a regset layout
271 * that always read as all-zero or for which writes are ignored.
272 */
273static inline int user_regset_copyout_zero(unsigned int *pos,
274 unsigned int *count,
275 void **kbuf, void __user **ubuf,
276 const int start_pos,
277 const int end_pos)
278{
279 if (*count == 0)
280 return 0;
281 BUG_ON(*pos < start_pos);
282 if (end_pos < 0 || *pos < end_pos) {
283 unsigned int copy = (end_pos < 0 ? *count
284 : min(*count, end_pos - *pos));
285 if (*kbuf) {
286 memset(*kbuf, 0, copy);
287 *kbuf += copy;
288 } else if (__clear_user(*ubuf, copy))
289 return -EFAULT;
290 else
291 *ubuf += copy;
292 *pos += copy;
293 *count -= copy;
294 }
295 return 0;
296}
297
298static inline int user_regset_copyin_ignore(unsigned int *pos,
299 unsigned int *count,
300 const void **kbuf,
301 const void __user **ubuf,
302 const int start_pos,
303 const int end_pos)
304{
305 if (*count == 0)
306 return 0;
307 BUG_ON(*pos < start_pos);
308 if (end_pos < 0 || *pos < end_pos) {
309 unsigned int copy = (end_pos < 0 ? *count
310 : min(*count, end_pos - *pos));
311 if (*kbuf)
312 *kbuf += copy;
313 else
314 *ubuf += copy;
315 *pos += copy;
316 *count -= copy;
317 }
318 return 0;
319}
320
321/**
322 * copy_regset_to_user - fetch a thread's user_regset data into user memory
323 * @target: thread to be examined
324 * @view: &struct user_regset_view describing user thread machine state
325 * @setno: index in @view->regsets
326 * @offset: offset into the regset data, in bytes
327 * @size: amount of data to copy, in bytes
328 * @data: user-mode pointer to copy into
329 */
330static inline int copy_regset_to_user(struct task_struct *target,
331 const struct user_regset_view *view,
332 unsigned int setno,
333 unsigned int offset, unsigned int size,
334 void __user *data)
335{
336 const struct user_regset *regset = &view->regsets[setno];
337
338 if (!access_ok(VERIFY_WRITE, data, size))
339 return -EIO;
340
341 return regset->get(target, regset, offset, size, NULL, data);
342}
343
344/**
345 * copy_regset_from_user - store into thread's user_regset data from user memory
346 * @target: thread to be examined
347 * @view: &struct user_regset_view describing user thread machine state
348 * @setno: index in @view->regsets
349 * @offset: offset into the regset data, in bytes
350 * @size: amount of data to copy, in bytes
351 * @data: user-mode pointer to copy from
352 */
353static inline int copy_regset_from_user(struct task_struct *target,
354 const struct user_regset_view *view,
355 unsigned int setno,
356 unsigned int offset, unsigned int size,
357 const void __user *data)
358{
359 const struct user_regset *regset = &view->regsets[setno];
360
361 if (!access_ok(VERIFY_READ, data, size))
362 return -EIO;
363
364 return regset->set(target, regset, offset, size, NULL, data);
365}
366
367
368#endif /* <linux/regset.h> */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 4e81836191df..b014f6b7fe29 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -100,6 +100,13 @@ enum {
100 RTM_NEWNDUSEROPT = 68, 100 RTM_NEWNDUSEROPT = 68,
101#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT 101#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT
102 102
103 RTM_NEWADDRLABEL = 72,
104#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
105 RTM_DELADDRLABEL,
106#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
107 RTM_GETADDRLABEL,
108#define RTM_GETADDRLABEL RTM_GETADDRLABEL
109
103 __RTM_MAX, 110 __RTM_MAX,
104#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) 111#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
105}; 112};
@@ -613,11 +620,11 @@ extern int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr,
613({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \ 620({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \
614 __rtattr_parse_nested_compat(tb, max, rta, len); }) 621 __rtattr_parse_nested_compat(tb, max, rta, len); })
615 622
616extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); 623extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
617extern int rtnl_unicast(struct sk_buff *skb, u32 pid); 624extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
618extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, 625extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
619 struct nlmsghdr *nlh, gfp_t flags); 626 struct nlmsghdr *nlh, gfp_t flags);
620extern void rtnl_set_sk_err(u32 group, int error); 627extern void rtnl_set_sk_err(struct net *net, u32 group, int error);
621extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); 628extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
622extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, 629extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
623 u32 id, u32 ts, u32 tsage, long expires, 630 u32 id, u32 ts, u32 tsage, long expires,
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index e3ff21dbac53..a3d567a974e8 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -7,6 +7,12 @@
7#include <linux/string.h> 7#include <linux/string.h>
8#include <asm/io.h> 8#include <asm/io.h>
9 9
10struct sg_table {
11 struct scatterlist *sgl; /* the list */
12 unsigned int nents; /* number of mapped entries */
13 unsigned int orig_nents; /* original size of list */
14};
15
10/* 16/*
11 * Notes on SG table design. 17 * Notes on SG table design.
12 * 18 *
@@ -106,31 +112,6 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
106 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf)); 112 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
107} 113}
108 114
109/**
110 * sg_next - return the next scatterlist entry in a list
111 * @sg: The current sg entry
112 *
113 * Description:
114 * Usually the next entry will be @sg@ + 1, but if this sg element is part
115 * of a chained scatterlist, it could jump to the start of a new
116 * scatterlist array.
117 *
118 **/
119static inline struct scatterlist *sg_next(struct scatterlist *sg)
120{
121#ifdef CONFIG_DEBUG_SG
122 BUG_ON(sg->sg_magic != SG_MAGIC);
123#endif
124 if (sg_is_last(sg))
125 return NULL;
126
127 sg++;
128 if (unlikely(sg_is_chain(sg)))
129 sg = sg_chain_ptr(sg);
130
131 return sg;
132}
133
134/* 115/*
135 * Loop over each sg element, following the pointer to a new list if necessary 116 * Loop over each sg element, following the pointer to a new list if necessary
136 */ 117 */
@@ -138,40 +119,6 @@ static inline struct scatterlist *sg_next(struct scatterlist *sg)
138 for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg)) 119 for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg))
139 120
140/** 121/**
141 * sg_last - return the last scatterlist entry in a list
142 * @sgl: First entry in the scatterlist
143 * @nents: Number of entries in the scatterlist
144 *
145 * Description:
146 * Should only be used casually, it (currently) scan the entire list
147 * to get the last entry.
148 *
149 * Note that the @sgl@ pointer passed in need not be the first one,
150 * the important bit is that @nents@ denotes the number of entries that
151 * exist from @sgl@.
152 *
153 **/
154static inline struct scatterlist *sg_last(struct scatterlist *sgl,
155 unsigned int nents)
156{
157#ifndef ARCH_HAS_SG_CHAIN
158 struct scatterlist *ret = &sgl[nents - 1];
159#else
160 struct scatterlist *sg, *ret = NULL;
161 unsigned int i;
162
163 for_each_sg(sgl, sg, nents, i)
164 ret = sg;
165
166#endif
167#ifdef CONFIG_DEBUG_SG
168 BUG_ON(sgl[0].sg_magic != SG_MAGIC);
169 BUG_ON(!sg_is_last(ret));
170#endif
171 return ret;
172}
173
174/**
175 * sg_chain - Chain two sglists together 122 * sg_chain - Chain two sglists together
176 * @prv: First scatterlist 123 * @prv: First scatterlist
177 * @prv_nents: Number of entries in prv 124 * @prv_nents: Number of entries in prv
@@ -223,47 +170,6 @@ static inline void sg_mark_end(struct scatterlist *sg)
223} 170}
224 171
225/** 172/**
226 * sg_init_table - Initialize SG table
227 * @sgl: The SG table
228 * @nents: Number of entries in table
229 *
230 * Notes:
231 * If this is part of a chained sg table, sg_mark_end() should be
232 * used only on the last table part.
233 *
234 **/
235static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
236{
237 memset(sgl, 0, sizeof(*sgl) * nents);
238#ifdef CONFIG_DEBUG_SG
239 {
240 unsigned int i;
241 for (i = 0; i < nents; i++)
242 sgl[i].sg_magic = SG_MAGIC;
243 }
244#endif
245 sg_mark_end(&sgl[nents - 1]);
246}
247
248/**
249 * sg_init_one - Initialize a single entry sg list
250 * @sg: SG entry
251 * @buf: Virtual address for IO
252 * @buflen: IO length
253 *
254 * Notes:
255 * This should not be used on a single entry that is part of a larger
256 * table. Use sg_init_table() for that.
257 *
258 **/
259static inline void sg_init_one(struct scatterlist *sg, const void *buf,
260 unsigned int buflen)
261{
262 sg_init_table(sg, 1);
263 sg_set_buf(sg, buf, buflen);
264}
265
266/**
267 * sg_phys - Return physical address of an sg entry 173 * sg_phys - Return physical address of an sg entry
268 * @sg: SG entry 174 * @sg: SG entry
269 * 175 *
@@ -293,4 +199,24 @@ static inline void *sg_virt(struct scatterlist *sg)
293 return page_address(sg_page(sg)) + sg->offset; 199 return page_address(sg_page(sg)) + sg->offset;
294} 200}
295 201
202struct scatterlist *sg_next(struct scatterlist *);
203struct scatterlist *sg_last(struct scatterlist *s, unsigned int);
204void sg_init_table(struct scatterlist *, unsigned int);
205void sg_init_one(struct scatterlist *, const void *, unsigned int);
206
207typedef struct scatterlist *(sg_alloc_fn)(unsigned int, gfp_t);
208typedef void (sg_free_fn)(struct scatterlist *, unsigned int);
209
210void __sg_free_table(struct sg_table *, unsigned int, sg_free_fn *);
211void sg_free_table(struct sg_table *);
212int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, gfp_t,
213 sg_alloc_fn *);
214int sg_alloc_table(struct sg_table *, unsigned int, gfp_t);
215
216/*
217 * Maximum number of entries that will be allocated in one piece, if
218 * a list larger than this is required then chaining will be utilized.
219 */
220#define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist))
221
296#endif /* _LINUX_SCATTERLIST_H */ 222#endif /* _LINUX_SCATTERLIST_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index cc14656f8682..9d4797609aa5 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -27,6 +27,7 @@
27#define CLONE_NEWUSER 0x10000000 /* New user namespace */ 27#define CLONE_NEWUSER 0x10000000 /* New user namespace */
28#define CLONE_NEWPID 0x20000000 /* New pid namespace */ 28#define CLONE_NEWPID 0x20000000 /* New pid namespace */
29#define CLONE_NEWNET 0x40000000 /* New network namespace */ 29#define CLONE_NEWNET 0x40000000 /* New network namespace */
30#define CLONE_IO 0x80000000 /* Clone io context */
30 31
31/* 32/*
32 * Scheduling policies 33 * Scheduling policies
@@ -78,7 +79,6 @@ struct sched_param {
78#include <linux/proportions.h> 79#include <linux/proportions.h>
79#include <linux/seccomp.h> 80#include <linux/seccomp.h>
80#include <linux/rcupdate.h> 81#include <linux/rcupdate.h>
81#include <linux/futex.h>
82#include <linux/rtmutex.h> 82#include <linux/rtmutex.h>
83 83
84#include <linux/time.h> 84#include <linux/time.h>
@@ -88,11 +88,13 @@ struct sched_param {
88#include <linux/hrtimer.h> 88#include <linux/hrtimer.h>
89#include <linux/task_io_accounting.h> 89#include <linux/task_io_accounting.h>
90#include <linux/kobject.h> 90#include <linux/kobject.h>
91#include <linux/latencytop.h>
91 92
92#include <asm/processor.h> 93#include <asm/processor.h>
93 94
94struct exec_domain; 95struct exec_domain;
95struct futex_pi_state; 96struct futex_pi_state;
97struct robust_list_head;
96struct bio; 98struct bio;
97 99
98/* 100/*
@@ -230,6 +232,8 @@ static inline int select_nohz_load_balancer(int cpu)
230} 232}
231#endif 233#endif
232 234
235extern unsigned long rt_needs_cpu(int cpu);
236
233/* 237/*
234 * Only dump TASK_* tasks. (0 for all tasks) 238 * Only dump TASK_* tasks. (0 for all tasks)
235 */ 239 */
@@ -257,13 +261,19 @@ extern void trap_init(void);
257extern void account_process_tick(struct task_struct *task, int user); 261extern void account_process_tick(struct task_struct *task, int user);
258extern void update_process_times(int user); 262extern void update_process_times(int user);
259extern void scheduler_tick(void); 263extern void scheduler_tick(void);
264extern void hrtick_resched(void);
265
266extern void sched_show_task(struct task_struct *p);
260 267
261#ifdef CONFIG_DETECT_SOFTLOCKUP 268#ifdef CONFIG_DETECT_SOFTLOCKUP
262extern void softlockup_tick(void); 269extern void softlockup_tick(void);
263extern void spawn_softlockup_task(void); 270extern void spawn_softlockup_task(void);
264extern void touch_softlockup_watchdog(void); 271extern void touch_softlockup_watchdog(void);
265extern void touch_all_softlockup_watchdogs(void); 272extern void touch_all_softlockup_watchdogs(void);
266extern int softlockup_thresh; 273extern unsigned long softlockup_thresh;
274extern unsigned long sysctl_hung_task_check_count;
275extern unsigned long sysctl_hung_task_timeout_secs;
276extern unsigned long sysctl_hung_task_warnings;
267#else 277#else
268static inline void softlockup_tick(void) 278static inline void softlockup_tick(void)
269{ 279{
@@ -552,18 +562,13 @@ struct user_struct {
552#ifdef CONFIG_FAIR_USER_SCHED 562#ifdef CONFIG_FAIR_USER_SCHED
553 struct task_group *tg; 563 struct task_group *tg;
554#ifdef CONFIG_SYSFS 564#ifdef CONFIG_SYSFS
555 struct kset kset; 565 struct kobject kobj;
556 struct subsys_attribute user_attr;
557 struct work_struct work; 566 struct work_struct work;
558#endif 567#endif
559#endif 568#endif
560}; 569};
561 570
562#ifdef CONFIG_FAIR_USER_SCHED 571extern int uids_sysfs_init(void);
563extern int uids_kobject_init(void);
564#else
565static inline int uids_kobject_init(void) { return 0; }
566#endif
567 572
568extern struct user_struct *find_user(uid_t); 573extern struct user_struct *find_user(uid_t);
569 574
@@ -827,6 +832,7 @@ struct sched_class {
827 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup); 832 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup);
828 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); 833 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
829 void (*yield_task) (struct rq *rq); 834 void (*yield_task) (struct rq *rq);
835 int (*select_task_rq)(struct task_struct *p, int sync);
830 836
831 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p); 837 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p);
832 838
@@ -842,11 +848,25 @@ struct sched_class {
842 int (*move_one_task) (struct rq *this_rq, int this_cpu, 848 int (*move_one_task) (struct rq *this_rq, int this_cpu,
843 struct rq *busiest, struct sched_domain *sd, 849 struct rq *busiest, struct sched_domain *sd,
844 enum cpu_idle_type idle); 850 enum cpu_idle_type idle);
851 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
852 void (*post_schedule) (struct rq *this_rq);
853 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task);
845#endif 854#endif
846 855
847 void (*set_curr_task) (struct rq *rq); 856 void (*set_curr_task) (struct rq *rq);
848 void (*task_tick) (struct rq *rq, struct task_struct *p); 857 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
849 void (*task_new) (struct rq *rq, struct task_struct *p); 858 void (*task_new) (struct rq *rq, struct task_struct *p);
859 void (*set_cpus_allowed)(struct task_struct *p, cpumask_t *newmask);
860
861 void (*join_domain)(struct rq *rq);
862 void (*leave_domain)(struct rq *rq);
863
864 void (*switched_from) (struct rq *this_rq, struct task_struct *task,
865 int running);
866 void (*switched_to) (struct rq *this_rq, struct task_struct *task,
867 int running);
868 void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
869 int oldprio, int running);
850}; 870};
851 871
852struct load_weight { 872struct load_weight {
@@ -876,6 +896,8 @@ struct sched_entity {
876#ifdef CONFIG_SCHEDSTATS 896#ifdef CONFIG_SCHEDSTATS
877 u64 wait_start; 897 u64 wait_start;
878 u64 wait_max; 898 u64 wait_max;
899 u64 wait_count;
900 u64 wait_sum;
879 901
880 u64 sleep_start; 902 u64 sleep_start;
881 u64 sleep_max; 903 u64 sleep_max;
@@ -914,6 +936,21 @@ struct sched_entity {
914#endif 936#endif
915}; 937};
916 938
939struct sched_rt_entity {
940 struct list_head run_list;
941 unsigned int time_slice;
942 unsigned long timeout;
943 int nr_cpus_allowed;
944
945#ifdef CONFIG_FAIR_GROUP_SCHED
946 struct sched_rt_entity *parent;
947 /* rq on which this entity is (to be) queued: */
948 struct rt_rq *rt_rq;
949 /* rq "owned" by this entity/group: */
950 struct rt_rq *my_q;
951#endif
952};
953
917struct task_struct { 954struct task_struct {
918 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 955 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
919 void *stack; 956 void *stack;
@@ -930,16 +967,15 @@ struct task_struct {
930#endif 967#endif
931 968
932 int prio, static_prio, normal_prio; 969 int prio, static_prio, normal_prio;
933 struct list_head run_list;
934 const struct sched_class *sched_class; 970 const struct sched_class *sched_class;
935 struct sched_entity se; 971 struct sched_entity se;
972 struct sched_rt_entity rt;
936 973
937#ifdef CONFIG_PREEMPT_NOTIFIERS 974#ifdef CONFIG_PREEMPT_NOTIFIERS
938 /* list of struct preempt_notifier: */ 975 /* list of struct preempt_notifier: */
939 struct hlist_head preempt_notifiers; 976 struct hlist_head preempt_notifiers;
940#endif 977#endif
941 978
942 unsigned short ioprio;
943 /* 979 /*
944 * fpu_counter contains the number of consecutive context switches 980 * fpu_counter contains the number of consecutive context switches
945 * that the FPU is used. If this is over a threshold, the lazy fpu 981 * that the FPU is used. If this is over a threshold, the lazy fpu
@@ -956,7 +992,11 @@ struct task_struct {
956 992
957 unsigned int policy; 993 unsigned int policy;
958 cpumask_t cpus_allowed; 994 cpumask_t cpus_allowed;
959 unsigned int time_slice; 995
996#ifdef CONFIG_PREEMPT_RCU
997 int rcu_read_lock_nesting;
998 int rcu_flipctr_idx;
999#endif /* #ifdef CONFIG_PREEMPT_RCU */
960 1000
961#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1001#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
962 struct sched_info sched_info; 1002 struct sched_info sched_info;
@@ -1046,6 +1086,11 @@ struct task_struct {
1046/* ipc stuff */ 1086/* ipc stuff */
1047 struct sysv_sem sysvsem; 1087 struct sysv_sem sysvsem;
1048#endif 1088#endif
1089#ifdef CONFIG_DETECT_SOFTLOCKUP
1090/* hung task detection */
1091 unsigned long last_switch_timestamp;
1092 unsigned long last_switch_count;
1093#endif
1049/* CPU-specific state of this task */ 1094/* CPU-specific state of this task */
1050 struct thread_struct thread; 1095 struct thread_struct thread;
1051/* filesystem information */ 1096/* filesystem information */
@@ -1178,6 +1223,10 @@ struct task_struct {
1178 int make_it_fail; 1223 int make_it_fail;
1179#endif 1224#endif
1180 struct prop_local_single dirties; 1225 struct prop_local_single dirties;
1226#ifdef CONFIG_LATENCYTOP
1227 int latency_record_count;
1228 struct latency_record latency_record[LT_SAVECOUNT];
1229#endif
1181}; 1230};
1182 1231
1183/* 1232/*
@@ -1458,6 +1507,12 @@ extern unsigned int sysctl_sched_child_runs_first;
1458extern unsigned int sysctl_sched_features; 1507extern unsigned int sysctl_sched_features;
1459extern unsigned int sysctl_sched_migration_cost; 1508extern unsigned int sysctl_sched_migration_cost;
1460extern unsigned int sysctl_sched_nr_migrate; 1509extern unsigned int sysctl_sched_nr_migrate;
1510extern unsigned int sysctl_sched_rt_period;
1511extern unsigned int sysctl_sched_rt_ratio;
1512#if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP)
1513extern unsigned int sysctl_sched_min_bal_int_shares;
1514extern unsigned int sysctl_sched_max_bal_int_shares;
1515#endif
1461 1516
1462int sched_nr_latency_handler(struct ctl_table *table, int write, 1517int sched_nr_latency_handler(struct ctl_table *table, int write,
1463 struct file *file, void __user *buffer, size_t *length, 1518 struct file *file, void __user *buffer, size_t *length,
@@ -1850,29 +1905,33 @@ static inline int need_resched(void)
1850 * cond_resched_lock() will drop the spinlock before scheduling, 1905 * cond_resched_lock() will drop the spinlock before scheduling,
1851 * cond_resched_softirq() will enable bhs before scheduling. 1906 * cond_resched_softirq() will enable bhs before scheduling.
1852 */ 1907 */
1853extern int cond_resched(void); 1908#ifdef CONFIG_PREEMPT
1854extern int cond_resched_lock(spinlock_t * lock); 1909static inline int cond_resched(void)
1855extern int cond_resched_softirq(void); 1910{
1856 1911 return 0;
1857/* 1912}
1858 * Does a critical section need to be broken due to another
1859 * task waiting?:
1860 */
1861#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
1862# define need_lockbreak(lock) ((lock)->break_lock)
1863#else 1913#else
1864# define need_lockbreak(lock) 0 1914extern int _cond_resched(void);
1915static inline int cond_resched(void)
1916{
1917 return _cond_resched();
1918}
1865#endif 1919#endif
1920extern int cond_resched_lock(spinlock_t * lock);
1921extern int cond_resched_softirq(void);
1866 1922
1867/* 1923/*
1868 * Does a critical section need to be broken due to another 1924 * Does a critical section need to be broken due to another
1869 * task waiting or preemption being signalled: 1925 * task waiting?: (technically does not depend on CONFIG_PREEMPT,
1926 * but a general need for low latency)
1870 */ 1927 */
1871static inline int lock_need_resched(spinlock_t *lock) 1928static inline int spin_needbreak(spinlock_t *lock)
1872{ 1929{
1873 if (need_lockbreak(lock) || need_resched()) 1930#ifdef CONFIG_PREEMPT
1874 return 1; 1931 return spin_is_contended(lock);
1932#else
1875 return 0; 1933 return 0;
1934#endif
1876} 1935}
1877 1936
1878/* 1937/*
diff --git a/include/linux/security.h b/include/linux/security.h
index ac050830a873..d24974262dc6 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -34,6 +34,12 @@
34#include <linux/xfrm.h> 34#include <linux/xfrm.h>
35#include <net/flow.h> 35#include <net/flow.h>
36 36
37/* only a char in selinux superblock security struct flags */
38#define FSCONTEXT_MNT 0x01
39#define CONTEXT_MNT 0x02
40#define ROOTCONTEXT_MNT 0x04
41#define DEFCONTEXT_MNT 0x08
42
37/* 43/*
38 * Bounding set 44 * Bounding set
39 */ 45 */
@@ -243,9 +249,6 @@ struct request_sock;
243 * @mnt contains the mounted file system. 249 * @mnt contains the mounted file system.
244 * @flags contains the new filesystem flags. 250 * @flags contains the new filesystem flags.
245 * @data contains the filesystem-specific data. 251 * @data contains the filesystem-specific data.
246 * @sb_post_mountroot:
247 * Update the security module's state when the root filesystem is mounted.
248 * This hook is only called if the mount was successful.
249 * @sb_post_addmount: 252 * @sb_post_addmount:
250 * Update the security module's state when a filesystem is mounted. 253 * Update the security module's state when a filesystem is mounted.
251 * This hook is called any time a mount is successfully grafetd to 254 * This hook is called any time a mount is successfully grafetd to
@@ -261,6 +264,22 @@ struct request_sock;
261 * Update module state after a successful pivot. 264 * Update module state after a successful pivot.
262 * @old_nd contains the nameidata structure for the old root. 265 * @old_nd contains the nameidata structure for the old root.
263 * @new_nd contains the nameidata structure for the new root. 266 * @new_nd contains the nameidata structure for the new root.
267 * @sb_get_mnt_opts:
268 * Get the security relevant mount options used for a superblock
269 * @sb the superblock to get security mount options from
270 * @mount_options array for pointers to mount options
271 * @mount_flags array of ints specifying what each mount options is
272 * @num_opts number of options in the arrays
273 * @sb_set_mnt_opts:
274 * Set the security relevant mount options used for a superblock
275 * @sb the superblock to set security mount options for
276 * @mount_options array for pointers to mount options
277 * @mount_flags array of ints specifying what each mount options is
278 * @num_opts number of options in the arrays
279 * @sb_clone_mnt_opts:
280 * Copy all security options from a given superblock to another
281 * @oldsb old superblock which contain information to clone
282 * @newsb new superblock which needs filled in
264 * 283 *
265 * Security hooks for inode operations. 284 * Security hooks for inode operations.
266 * 285 *
@@ -1183,6 +1202,10 @@ struct request_sock;
1183 * Convert secid to security context. 1202 * Convert secid to security context.
1184 * @secid contains the security ID. 1203 * @secid contains the security ID.
1185 * @secdata contains the pointer that stores the converted security context. 1204 * @secdata contains the pointer that stores the converted security context.
1205 * @secctx_to_secid:
1206 * Convert security context to secid.
1207 * @secid contains the pointer to the generated security ID.
1208 * @secdata contains the security context.
1186 * 1209 *
1187 * @release_secctx: 1210 * @release_secctx:
1188 * Release the security context. 1211 * Release the security context.
@@ -1235,13 +1258,19 @@ struct security_operations {
1235 void (*sb_umount_busy) (struct vfsmount * mnt); 1258 void (*sb_umount_busy) (struct vfsmount * mnt);
1236 void (*sb_post_remount) (struct vfsmount * mnt, 1259 void (*sb_post_remount) (struct vfsmount * mnt,
1237 unsigned long flags, void *data); 1260 unsigned long flags, void *data);
1238 void (*sb_post_mountroot) (void);
1239 void (*sb_post_addmount) (struct vfsmount * mnt, 1261 void (*sb_post_addmount) (struct vfsmount * mnt,
1240 struct nameidata * mountpoint_nd); 1262 struct nameidata * mountpoint_nd);
1241 int (*sb_pivotroot) (struct nameidata * old_nd, 1263 int (*sb_pivotroot) (struct nameidata * old_nd,
1242 struct nameidata * new_nd); 1264 struct nameidata * new_nd);
1243 void (*sb_post_pivotroot) (struct nameidata * old_nd, 1265 void (*sb_post_pivotroot) (struct nameidata * old_nd,
1244 struct nameidata * new_nd); 1266 struct nameidata * new_nd);
1267 int (*sb_get_mnt_opts) (const struct super_block *sb,
1268 char ***mount_options, int **flags,
1269 int *num_opts);
1270 int (*sb_set_mnt_opts) (struct super_block *sb, char **mount_options,
1271 int *flags, int num_opts);
1272 void (*sb_clone_mnt_opts) (const struct super_block *oldsb,
1273 struct super_block *newsb);
1245 1274
1246 int (*inode_alloc_security) (struct inode *inode); 1275 int (*inode_alloc_security) (struct inode *inode);
1247 void (*inode_free_security) (struct inode *inode); 1276 void (*inode_free_security) (struct inode *inode);
@@ -1371,6 +1400,7 @@ struct security_operations {
1371 int (*getprocattr)(struct task_struct *p, char *name, char **value); 1400 int (*getprocattr)(struct task_struct *p, char *name, char **value);
1372 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1401 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1373 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen); 1402 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen);
1403 int (*secctx_to_secid)(char *secdata, u32 seclen, u32 *secid);
1374 void (*release_secctx)(char *secdata, u32 seclen); 1404 void (*release_secctx)(char *secdata, u32 seclen);
1375 1405
1376#ifdef CONFIG_SECURITY_NETWORK 1406#ifdef CONFIG_SECURITY_NETWORK
@@ -1495,10 +1525,16 @@ int security_sb_umount(struct vfsmount *mnt, int flags);
1495void security_sb_umount_close(struct vfsmount *mnt); 1525void security_sb_umount_close(struct vfsmount *mnt);
1496void security_sb_umount_busy(struct vfsmount *mnt); 1526void security_sb_umount_busy(struct vfsmount *mnt);
1497void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data); 1527void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
1498void security_sb_post_mountroot(void);
1499void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd); 1528void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd);
1500int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd); 1529int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
1501void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd); 1530void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
1531int security_sb_get_mnt_opts(const struct super_block *sb, char ***mount_options,
1532 int **flags, int *num_opts);
1533int security_sb_set_mnt_opts(struct super_block *sb, char **mount_options,
1534 int *flags, int num_opts);
1535void security_sb_clone_mnt_opts(const struct super_block *oldsb,
1536 struct super_block *newsb);
1537
1502int security_inode_alloc(struct inode *inode); 1538int security_inode_alloc(struct inode *inode);
1503void security_inode_free(struct inode *inode); 1539void security_inode_free(struct inode *inode);
1504int security_inode_init_security(struct inode *inode, struct inode *dir, 1540int security_inode_init_security(struct inode *inode, struct inode *dir,
@@ -1603,6 +1639,7 @@ int security_setprocattr(struct task_struct *p, char *name, void *value, size_t
1603int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1639int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1604int security_netlink_recv(struct sk_buff *skb, int cap); 1640int security_netlink_recv(struct sk_buff *skb, int cap);
1605int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1641int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1642int security_secctx_to_secid(char *secdata, u32 seclen, u32 *secid);
1606void security_release_secctx(char *secdata, u32 seclen); 1643void security_release_secctx(char *secdata, u32 seclen);
1607 1644
1608#else /* CONFIG_SECURITY */ 1645#else /* CONFIG_SECURITY */
@@ -1777,9 +1814,6 @@ static inline void security_sb_post_remount (struct vfsmount *mnt,
1777 unsigned long flags, void *data) 1814 unsigned long flags, void *data)
1778{ } 1815{ }
1779 1816
1780static inline void security_sb_post_mountroot (void)
1781{ }
1782
1783static inline void security_sb_post_addmount (struct vfsmount *mnt, 1817static inline void security_sb_post_addmount (struct vfsmount *mnt,
1784 struct nameidata *mountpoint_nd) 1818 struct nameidata *mountpoint_nd)
1785{ } 1819{ }
@@ -2266,7 +2300,7 @@ static inline struct dentry *securityfs_create_file(const char *name,
2266 mode_t mode, 2300 mode_t mode,
2267 struct dentry *parent, 2301 struct dentry *parent,
2268 void *data, 2302 void *data,
2269 struct file_operations *fops) 2303 const struct file_operations *fops)
2270{ 2304{
2271 return ERR_PTR(-ENODEV); 2305 return ERR_PTR(-ENODEV);
2272} 2306}
@@ -2280,6 +2314,13 @@ static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *secle
2280 return -EOPNOTSUPP; 2314 return -EOPNOTSUPP;
2281} 2315}
2282 2316
2317static inline int security_secctx_to_secid(char *secdata,
2318 u32 seclen,
2319 u32 *secid)
2320{
2321 return -EOPNOTSUPP;
2322}
2323
2283static inline void security_release_secctx(char *secdata, u32 seclen) 2324static inline void security_release_secctx(char *secdata, u32 seclen)
2284{ 2325{
2285} 2326}
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index 6080f73fc85f..8c2cc4c02526 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -120,16 +120,35 @@ void selinux_get_task_sid(struct task_struct *tsk, u32 *sid);
120int selinux_string_to_sid(char *str, u32 *sid); 120int selinux_string_to_sid(char *str, u32 *sid);
121 121
122/** 122/**
123 * selinux_relabel_packet_permission - check permission to relabel a packet 123 * selinux_secmark_relabel_packet_permission - secmark permission check
124 * @sid: ID value to be applied to network packet (via SECMARK, most likely) 124 * @sid: SECMARK ID value to be applied to network packet
125 * 125 *
126 * Returns 0 if the current task is allowed to label packets with the 126 * Returns 0 if the current task is allowed to set the SECMARK label of
127 * supplied security ID. Note that it is implicit that the packet is always 127 * packets with the supplied security ID. Note that it is implicit that
128 * being relabeled from the default unlabled value, and that the access 128 * the packet is always being relabeled from the default unlabeled value,
129 * control decision is made in the AVC. 129 * and that the access control decision is made in the AVC.
130 */ 130 */
131int selinux_relabel_packet_permission(u32 sid); 131int selinux_secmark_relabel_packet_permission(u32 sid);
132 132
133/**
134 * selinux_secmark_refcount_inc - increments the secmark use counter
135 *
136 * SELinux keeps track of the current SECMARK targets in use so it knows
137 * when to apply SECMARK label access checks to network packets. This
138 * function incements this reference count to indicate that a new SECMARK
139 * target has been configured.
140 */
141void selinux_secmark_refcount_inc(void);
142
143/**
144 * selinux_secmark_refcount_dec - decrements the secmark use counter
145 *
146 * SELinux keeps track of the current SECMARK targets in use so it knows
147 * when to apply SECMARK label access checks to network packets. This
148 * function decements this reference count to indicate that one of the
149 * existing SECMARK targets has been removed/flushed.
150 */
151void selinux_secmark_refcount_dec(void);
133#else 152#else
134 153
135static inline int selinux_audit_rule_init(u32 field, u32 op, 154static inline int selinux_audit_rule_init(u32 field, u32 op,
@@ -184,11 +203,21 @@ static inline int selinux_string_to_sid(const char *str, u32 *sid)
184 return 0; 203 return 0;
185} 204}
186 205
187static inline int selinux_relabel_packet_permission(u32 sid) 206static inline int selinux_secmark_relabel_packet_permission(u32 sid)
188{ 207{
189 return 0; 208 return 0;
190} 209}
191 210
211static inline void selinux_secmark_refcount_inc(void)
212{
213 return;
214}
215
216static inline void selinux_secmark_refcount_dec(void)
217{
218 return;
219}
220
192#endif /* CONFIG_SECURITY_SELINUX */ 221#endif /* CONFIG_SECURITY_SELINUX */
193 222
194#endif /* _LINUX_SELINUX_H */ 223#endif /* _LINUX_SELINUX_H */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index ebbc02b325fc..648dfeb444db 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -63,5 +63,18 @@ extern struct list_head *seq_list_start_head(struct list_head *head,
63extern struct list_head *seq_list_next(void *v, struct list_head *head, 63extern struct list_head *seq_list_next(void *v, struct list_head *head,
64 loff_t *ppos); 64 loff_t *ppos);
65 65
66struct net;
67struct seq_net_private {
68 struct net *net;
69};
70
71int seq_open_net(struct inode *, struct file *,
72 const struct seq_operations *, int);
73int seq_release_net(struct inode *, struct file *);
74static inline struct net *seq_file_net(struct seq_file *seq)
75{
76 return ((struct seq_net_private *)seq->private)->net;
77}
78
66#endif 79#endif
67#endif 80#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bddd50bd6878..c618fbf7d173 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -95,6 +95,7 @@
95 95
96struct net_device; 96struct net_device;
97struct scatterlist; 97struct scatterlist;
98struct pipe_inode_info;
98 99
99#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 100#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
100struct nf_conntrack { 101struct nf_conntrack {
@@ -287,6 +288,7 @@ struct sk_buff {
287 __u8 pkt_type:3, 288 __u8 pkt_type:3,
288 fclone:2, 289 fclone:2,
289 ipvs_property:1, 290 ipvs_property:1,
291 peeked:1,
290 nf_trace:1; 292 nf_trace:1;
291 __be16 protocol; 293 __be16 protocol;
292 294
@@ -1537,6 +1539,8 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1537 skb = skb->prev) 1539 skb = skb->prev)
1538 1540
1539 1541
1542extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
1543 int *peeked, int *err);
1540extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 1544extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
1541 int noblock, int *err); 1545 int noblock, int *err);
1542extern unsigned int datagram_poll(struct file *file, struct socket *sock, 1546extern unsigned int datagram_poll(struct file *file, struct socket *sock,
@@ -1548,7 +1552,7 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1548 int hlen, 1552 int hlen,
1549 struct iovec *iov); 1553 struct iovec *iov);
1550extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1554extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1551extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1555extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1552 unsigned int flags); 1556 unsigned int flags);
1553extern __wsum skb_checksum(const struct sk_buff *skb, int offset, 1557extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
1554 int len, __wsum csum); 1558 int len, __wsum csum);
@@ -1559,6 +1563,11 @@ extern int skb_store_bits(struct sk_buff *skb, int offset,
1559extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, 1563extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb,
1560 int offset, u8 *to, int len, 1564 int offset, u8 *to, int len,
1561 __wsum csum); 1565 __wsum csum);
1566extern int skb_splice_bits(struct sk_buff *skb,
1567 unsigned int offset,
1568 struct pipe_inode_info *pipe,
1569 unsigned int len,
1570 unsigned int flags);
1562extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 1571extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1563extern void skb_split(struct sk_buff *skb, 1572extern void skb_split(struct sk_buff *skb,
1564 struct sk_buff *skb1, const u32 len); 1573 struct sk_buff *skb1, const u32 len);
diff --git a/include/linux/smp.h b/include/linux/smp.h
index c25e66bcecf3..55232ccf9cfd 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -78,6 +78,8 @@ int on_each_cpu(void (*func) (void *info), void *info, int retry, int wait);
78 */ 78 */
79void smp_prepare_boot_cpu(void); 79void smp_prepare_boot_cpu(void);
80 80
81extern unsigned int setup_max_cpus;
82
81#else /* !SMP */ 83#else /* !SMP */
82 84
83/* 85/*
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h
index 58962c51dee1..aab3a4cff4e1 100644
--- a/include/linux/smp_lock.h
+++ b/include/linux/smp_lock.h
@@ -17,22 +17,10 @@ extern void __lockfunc __release_kernel_lock(void);
17 __release_kernel_lock(); \ 17 __release_kernel_lock(); \
18} while (0) 18} while (0)
19 19
20/*
21 * Non-SMP kernels will never block on the kernel lock,
22 * so we are better off returning a constant zero from
23 * reacquire_kernel_lock() so that the compiler can see
24 * it at compile-time.
25 */
26#if defined(CONFIG_SMP) && !defined(CONFIG_PREEMPT_BKL)
27# define return_value_on_smp return
28#else
29# define return_value_on_smp
30#endif
31
32static inline int reacquire_kernel_lock(struct task_struct *task) 20static inline int reacquire_kernel_lock(struct task_struct *task)
33{ 21{
34 if (unlikely(task->lock_depth >= 0)) 22 if (unlikely(task->lock_depth >= 0))
35 return_value_on_smp __reacquire_kernel_lock(); 23 return __reacquire_kernel_lock();
36 return 0; 24 return 0;
37} 25}
38 26
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 89f0c2b5f405..86d3effb2836 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -217,4 +217,35 @@ enum
217 __LINUX_MIB_MAX 217 __LINUX_MIB_MAX
218}; 218};
219 219
220/* linux Xfrm mib definitions */
221enum
222{
223 LINUX_MIB_XFRMNUM = 0,
224 LINUX_MIB_XFRMINERROR, /* XfrmInError */
225 LINUX_MIB_XFRMINBUFFERERROR, /* XfrmInBufferError */
226 LINUX_MIB_XFRMINHDRERROR, /* XfrmInHdrError */
227 LINUX_MIB_XFRMINNOSTATES, /* XfrmInNoStates */
228 LINUX_MIB_XFRMINSTATEPROTOERROR, /* XfrmInStateProtoError */
229 LINUX_MIB_XFRMINSTATEMODEERROR, /* XfrmInStateModeError */
230 LINUX_MIB_XFRMINSEQOUTOFWINDOW, /* XfrmInSeqOutOfWindow */
231 LINUX_MIB_XFRMINSTATEEXPIRED, /* XfrmInStateExpired */
232 LINUX_MIB_XFRMINSTATEMISMATCH, /* XfrmInStateMismatch */
233 LINUX_MIB_XFRMINSTATEINVALID, /* XfrmInStateInvalid */
234 LINUX_MIB_XFRMINTMPLMISMATCH, /* XfrmInTmplMismatch */
235 LINUX_MIB_XFRMINNOPOLS, /* XfrmInNoPols */
236 LINUX_MIB_XFRMINPOLBLOCK, /* XfrmInPolBlock */
237 LINUX_MIB_XFRMINPOLERROR, /* XfrmInPolError */
238 LINUX_MIB_XFRMOUTERROR, /* XfrmOutError */
239 LINUX_MIB_XFRMOUTBUNDLEGENERROR, /* XfrmOutBundleGenError */
240 LINUX_MIB_XFRMOUTBUNDLECHECKERROR, /* XfrmOutBundleCheckError */
241 LINUX_MIB_XFRMOUTNOSTATES, /* XfrmOutNoStates */
242 LINUX_MIB_XFRMOUTSTATEPROTOERROR, /* XfrmOutStateProtoError */
243 LINUX_MIB_XFRMOUTSTATEMODEERROR, /* XfrmOutStateModeError */
244 LINUX_MIB_XFRMOUTSTATEEXPIRED, /* XfrmOutStateExpired */
245 LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */
246 LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */
247 LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */
248 __LINUX_MIB_XFRMMAX
249};
250
220#endif /* _LINUX_SNMP_H */ 251#endif /* _LINUX_SNMP_H */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index c22ef1c1afb8..bd2b30a74e76 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -24,7 +24,6 @@ struct __kernel_sockaddr_storage {
24#include <linux/types.h> /* pid_t */ 24#include <linux/types.h> /* pid_t */
25#include <linux/compiler.h> /* __user */ 25#include <linux/compiler.h> /* __user */
26 26
27extern int sysctl_somaxconn;
28#ifdef CONFIG_PROC_FS 27#ifdef CONFIG_PROC_FS
29struct seq_file; 28struct seq_file;
30extern void socket_seq_show(struct seq_file *seq); 29extern void socket_seq_show(struct seq_file *seq);
@@ -185,6 +184,7 @@ struct ucred {
185#define AF_PPPOX 24 /* PPPoX sockets */ 184#define AF_PPPOX 24 /* PPPoX sockets */
186#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 185#define AF_WANPIPE 25 /* Wanpipe API Sockets */
187#define AF_LLC 26 /* Linux LLC */ 186#define AF_LLC 26 /* Linux LLC */
187#define AF_CAN 29 /* Controller Area Network */
188#define AF_TIPC 30 /* TIPC sockets */ 188#define AF_TIPC 30 /* TIPC sockets */
189#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 189#define AF_BLUETOOTH 31 /* Bluetooth sockets */
190#define AF_IUCV 32 /* IUCV sockets */ 190#define AF_IUCV 32 /* IUCV sockets */
@@ -220,6 +220,7 @@ struct ucred {
220#define PF_PPPOX AF_PPPOX 220#define PF_PPPOX AF_PPPOX
221#define PF_WANPIPE AF_WANPIPE 221#define PF_WANPIPE AF_WANPIPE
222#define PF_LLC AF_LLC 222#define PF_LLC AF_LLC
223#define PF_CAN AF_CAN
223#define PF_TIPC AF_TIPC 224#define PF_TIPC AF_TIPC
224#define PF_BLUETOOTH AF_BLUETOOTH 225#define PF_BLUETOOTH AF_BLUETOOTH
225#define PF_IUCV AF_IUCV 226#define PF_IUCV AF_IUCV
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index c376f3b36c89..124449733c55 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -120,6 +120,12 @@ do { \
120 120
121#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock) 121#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock)
122 122
123#ifdef CONFIG_GENERIC_LOCKBREAK
124#define spin_is_contended(lock) ((lock)->break_lock)
125#else
126#define spin_is_contended(lock) __raw_spin_is_contended(&(lock)->raw_lock)
127#endif
128
123/** 129/**
124 * spin_unlock_wait - wait until the spinlock gets unlocked 130 * spin_unlock_wait - wait until the spinlock gets unlocked
125 * @lock: the spinlock in question. 131 * @lock: the spinlock in question.
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index f6a3a951b79e..68d88f71f1a2 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -19,7 +19,7 @@
19 19
20typedef struct { 20typedef struct {
21 raw_spinlock_t raw_lock; 21 raw_spinlock_t raw_lock;
22#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) 22#ifdef CONFIG_GENERIC_LOCKBREAK
23 unsigned int break_lock; 23 unsigned int break_lock;
24#endif 24#endif
25#ifdef CONFIG_DEBUG_SPINLOCK 25#ifdef CONFIG_DEBUG_SPINLOCK
@@ -35,7 +35,7 @@ typedef struct {
35 35
36typedef struct { 36typedef struct {
37 raw_rwlock_t raw_lock; 37 raw_rwlock_t raw_lock;
38#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) 38#ifdef CONFIG_GENERIC_LOCKBREAK
39 unsigned int break_lock; 39 unsigned int break_lock;
40#endif 40#endif
41#ifdef CONFIG_DEBUG_SPINLOCK 41#ifdef CONFIG_DEBUG_SPINLOCK
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index ea54c4c9a4ec..938234c4a996 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -64,6 +64,8 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
64# define __raw_spin_trylock(lock) ({ (void)(lock); 1; }) 64# define __raw_spin_trylock(lock) ({ (void)(lock); 1; })
65#endif /* DEBUG_SPINLOCK */ 65#endif /* DEBUG_SPINLOCK */
66 66
67#define __raw_spin_is_contended(lock) (((void)(lock), 0))
68
67#define __raw_read_can_lock(lock) (((void)(lock), 1)) 69#define __raw_read_can_lock(lock) (((void)(lock), 1))
68#define __raw_write_can_lock(lock) (((void)(lock), 1)) 70#define __raw_write_can_lock(lock) (((void)(lock), 1))
69 71
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 33e447f98a54..528dcb93c2f2 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -53,6 +53,7 @@ struct splice_pipe_desc {
53 int nr_pages; /* number of pages in map */ 53 int nr_pages; /* number of pages in map */
54 unsigned int flags; /* splice flags */ 54 unsigned int flags; /* splice flags */
55 const struct pipe_buf_operations *ops;/* ops associated with output pipe */ 55 const struct pipe_buf_operations *ops;/* ops associated with output pipe */
56 void (*spd_release)(struct splice_pipe_desc *, unsigned int);
56}; 57};
57 58
58typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *, 59typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *,
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 2b5c312c4960..e18f5c23b930 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -15,22 +15,19 @@ struct pcmcia_device;
15struct ssb_bus; 15struct ssb_bus;
16struct ssb_driver; 16struct ssb_driver;
17 17
18 18struct ssb_sprom {
19struct ssb_sprom_r1 { 19 u8 revision;
20 u16 pci_spid; /* Subsystem Product ID for PCI */
21 u16 pci_svid; /* Subsystem Vendor ID for PCI */
22 u16 pci_pid; /* Product ID for PCI */
23 u8 il0mac[6]; /* MAC address for 802.11b/g */ 20 u8 il0mac[6]; /* MAC address for 802.11b/g */
24 u8 et0mac[6]; /* MAC address for Ethernet */ 21 u8 et0mac[6]; /* MAC address for Ethernet */
25 u8 et1mac[6]; /* MAC address for 802.11a */ 22 u8 et1mac[6]; /* MAC address for 802.11a */
26 u8 et0phyaddr:5; /* MII address for enet0 */ 23 u8 et0phyaddr; /* MII address for enet0 */
27 u8 et1phyaddr:5; /* MII address for enet1 */ 24 u8 et1phyaddr; /* MII address for enet1 */
28 u8 et0mdcport:1; /* MDIO for enet0 */ 25 u8 et0mdcport; /* MDIO for enet0 */
29 u8 et1mdcport:1; /* MDIO for enet1 */ 26 u8 et1mdcport; /* MDIO for enet1 */
30 u8 board_rev; /* Board revision */ 27 u8 board_rev; /* Board revision number from SPROM. */
31 u8 country_code:4; /* Country Code */ 28 u8 country_code; /* Country Code */
32 u8 antenna_a:2; /* Antenna 0/1 available for A-PHY */ 29 u8 ant_available_a; /* A-PHY antenna available bits (up to 4) */
33 u8 antenna_bg:2; /* Antenna 0/1 available for B-PHY and G-PHY */ 30 u8 ant_available_bg; /* B/G-PHY antenna available bits (up to 4) */
34 u16 pa0b0; 31 u16 pa0b0;
35 u16 pa0b1; 32 u16 pa0b1;
36 u16 pa0b2; 33 u16 pa0b2;
@@ -41,61 +38,26 @@ struct ssb_sprom_r1 {
41 u8 gpio1; /* GPIO pin 1 */ 38 u8 gpio1; /* GPIO pin 1 */
42 u8 gpio2; /* GPIO pin 2 */ 39 u8 gpio2; /* GPIO pin 2 */
43 u8 gpio3; /* GPIO pin 3 */ 40 u8 gpio3; /* GPIO pin 3 */
44 u16 maxpwr_a; /* A-PHY Power Amplifier Max Power (in dBm Q5.2) */ 41 u16 maxpwr_a; /* A-PHY Amplifier Max Power (in dBm Q5.2) */
45 u16 maxpwr_bg; /* B/G-PHY Power Amplifier Max Power (in dBm Q5.2) */ 42 u16 maxpwr_bg; /* B/G-PHY Amplifier Max Power (in dBm Q5.2) */
46 u8 itssi_a; /* Idle TSSI Target for A-PHY */ 43 u8 itssi_a; /* Idle TSSI Target for A-PHY */
47 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ 44 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */
48 u16 boardflags_lo; /* Boardflags (low 16 bits) */ 45 u16 boardflags_lo; /* Boardflags (low 16 bits) */
49 u8 antenna_gain_a; /* A-PHY Antenna gain (in dBm Q5.2) */
50 u8 antenna_gain_bg; /* B/G-PHY Antenna gain (in dBm Q5.2) */
51 u8 oem[8]; /* OEM string (rev 1 only) */
52};
53
54struct ssb_sprom_r2 {
55 u16 boardflags_hi; /* Boardflags (high 16 bits) */ 46 u16 boardflags_hi; /* Boardflags (high 16 bits) */
56 u8 maxpwr_a_lo; /* A-PHY Max Power Low */
57 u8 maxpwr_a_hi; /* A-PHY Max Power High */
58 u16 pa1lob0; /* A-PHY PA Low Settings */
59 u16 pa1lob1; /* A-PHY PA Low Settings */
60 u16 pa1lob2; /* A-PHY PA Low Settings */
61 u16 pa1hib0; /* A-PHY PA High Settings */
62 u16 pa1hib1; /* A-PHY PA High Settings */
63 u16 pa1hib2; /* A-PHY PA High Settings */
64 u8 ofdm_pwr_off; /* OFDM Power Offset from CCK Level */
65 u8 country_str[2]; /* Two char Country Code */
66};
67
68struct ssb_sprom_r3 {
69 u32 ofdmapo; /* A-PHY OFDM Mid Power Offset */
70 u32 ofdmalpo; /* A-PHY OFDM Low Power Offset */
71 u32 ofdmahpo; /* A-PHY OFDM High Power Offset */
72 u8 gpioldc_on_cnt; /* GPIO LED Powersave Duty Cycle ON count */
73 u8 gpioldc_off_cnt; /* GPIO LED Powersave Duty Cycle OFF count */
74 u8 cckpo_1M:4; /* CCK Power Offset for Rate 1M */
75 u8 cckpo_2M:4; /* CCK Power Offset for Rate 2M */
76 u8 cckpo_55M:4; /* CCK Power Offset for Rate 5.5M */
77 u8 cckpo_11M:4; /* CCK Power Offset for Rate 11M */
78 u32 ofdmgpo; /* G-PHY OFDM Power Offset */
79};
80
81struct ssb_sprom_r4 {
82 /* TODO */
83};
84 47
85struct ssb_sprom { 48 /* Antenna gain values for up to 4 antennas
86 u8 revision; 49 * on each band. Values in dBm/4 (Q5.2). Negative gain means the
87 u8 crc; 50 * loss in the connectors is bigger than the gain. */
88 /* The valid r# fields are selected by the "revision". 51 struct {
89 * Revision 3 and lower inherit from lower revisions.
90 */
91 union {
92 struct { 52 struct {
93 struct ssb_sprom_r1 r1; 53 s8 a0, a1, a2, a3;
94 struct ssb_sprom_r2 r2; 54 } ghz24; /* 2.4GHz band */
95 struct ssb_sprom_r3 r3; 55 struct {
96 }; 56 s8 a0, a1, a2, a3;
97 struct ssb_sprom_r4 r4; 57 } ghz5; /* 5GHz band */
98 }; 58 } antenna_gain;
59
60 /* TODO - add any parameters needed from rev 2, 3, or 4 SPROMs */
99}; 61};
100 62
101/* Information about the PCB the circuitry is soldered on. */ 63/* Information about the PCB the circuitry is soldered on. */
@@ -270,7 +232,8 @@ struct ssb_bus {
270 struct ssb_device *mapped_device; 232 struct ssb_device *mapped_device;
271 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ 233 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */
272 u8 mapped_pcmcia_seg; 234 u8 mapped_pcmcia_seg;
273 /* Lock for core and segment switching. */ 235 /* Lock for core and segment switching.
236 * On PCMCIA-host busses this is used to protect the whole MMIO access. */
274 spinlock_t bar_lock; 237 spinlock_t bar_lock;
275 238
276 /* The bus this backplane is running on. */ 239 /* The bus this backplane is running on. */
@@ -288,6 +251,7 @@ struct ssb_bus {
288 /* ID information about the Chip. */ 251 /* ID information about the Chip. */
289 u16 chip_id; 252 u16 chip_id;
290 u16 chip_rev; 253 u16 chip_rev;
254 u16 sprom_size; /* number of words in sprom */
291 u8 chip_package; 255 u8 chip_package;
292 256
293 /* List of devices (cores) on the backplane. */ 257 /* List of devices (cores) on the backplane. */
@@ -402,6 +366,13 @@ static inline void ssb_pcihost_unregister(struct pci_driver *driver)
402{ 366{
403 pci_unregister_driver(driver); 367 pci_unregister_driver(driver);
404} 368}
369
370static inline
371void ssb_pcihost_set_power_state(struct ssb_device *sdev, pci_power_t state)
372{
373 if (sdev->bus->bustype == SSB_BUSTYPE_PCI)
374 pci_set_power_state(sdev->bus->host_pci, state);
375}
405#endif /* CONFIG_SSB_PCIHOST */ 376#endif /* CONFIG_SSB_PCIHOST */
406 377
407 378
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 47c7c71a5acf..ebad0bac9801 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -147,6 +147,10 @@
147#define SSB_IDLOW_SSBREV 0xF0000000 /* Sonics Backplane Revision code */ 147#define SSB_IDLOW_SSBREV 0xF0000000 /* Sonics Backplane Revision code */
148#define SSB_IDLOW_SSBREV_22 0x00000000 /* <= 2.2 */ 148#define SSB_IDLOW_SSBREV_22 0x00000000 /* <= 2.2 */
149#define SSB_IDLOW_SSBREV_23 0x10000000 /* 2.3 */ 149#define SSB_IDLOW_SSBREV_23 0x10000000 /* 2.3 */
150#define SSB_IDLOW_SSBREV_24 0x40000000 /* ?? Found in BCM4328 */
151#define SSB_IDLOW_SSBREV_25 0x50000000 /* ?? Not Found yet */
152#define SSB_IDLOW_SSBREV_26 0x60000000 /* ?? Found in some BCM4311/2 */
153#define SSB_IDLOW_SSBREV_27 0x70000000 /* ?? Found in some BCM4311/2 */
150#define SSB_IDHIGH 0x0FFC /* SB Identification High */ 154#define SSB_IDHIGH 0x0FFC /* SB Identification High */
151#define SSB_IDHIGH_RCLO 0x0000000F /* Revision Code (low part) */ 155#define SSB_IDHIGH_RCLO 0x0000000F /* Revision Code (low part) */
152#define SSB_IDHIGH_CC 0x00008FF0 /* Core Code */ 156#define SSB_IDHIGH_CC 0x00008FF0 /* Core Code */
@@ -162,11 +166,16 @@
162 */ 166 */
163#define SSB_SPROMSIZE_WORDS 64 167#define SSB_SPROMSIZE_WORDS 64
164#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16)) 168#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16))
169#define SSB_SPROMSIZE_WORDS_R123 64
170#define SSB_SPROMSIZE_WORDS_R4 220
171#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
172#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
165#define SSB_SPROM_BASE 0x1000 173#define SSB_SPROM_BASE 0x1000
166#define SSB_SPROM_REVISION 0x107E 174#define SSB_SPROM_REVISION 0x107E
167#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */ 175#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */
168#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */ 176#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */
169#define SSB_SPROM_REVISION_CRC_SHIFT 8 177#define SSB_SPROM_REVISION_CRC_SHIFT 8
178
170/* SPROM Revision 1 */ 179/* SPROM Revision 1 */
171#define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */ 180#define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */
172#define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */ 181#define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */
@@ -184,10 +193,10 @@
184#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */ 193#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */
185#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */ 194#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */
186#define SSB_SPROM1_BINF_CCODE_SHIFT 8 195#define SSB_SPROM1_BINF_CCODE_SHIFT 8
187#define SSB_SPROM1_BINF_ANTA 0x3000 /* Available A-PHY antennas */ 196#define SSB_SPROM1_BINF_ANTBG 0x3000 /* Available B-PHY and G-PHY antennas */
188#define SSB_SPROM1_BINF_ANTA_SHIFT 12 197#define SSB_SPROM1_BINF_ANTBG_SHIFT 12
189#define SSB_SPROM1_BINF_ANTBG 0xC000 /* Available B-PHY antennas */ 198#define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */
190#define SSB_SPROM1_BINF_ANTBG_SHIFT 14 199#define SSB_SPROM1_BINF_ANTA_SHIFT 14
191#define SSB_SPROM1_PA0B0 0x105E 200#define SSB_SPROM1_PA0B0 0x105E
192#define SSB_SPROM1_PA0B1 0x1060 201#define SSB_SPROM1_PA0B1 0x1060
193#define SSB_SPROM1_PA0B2 0x1062 202#define SSB_SPROM1_PA0B2 0x1062
@@ -212,10 +221,11 @@
212#define SSB_SPROM1_ITSSI_A_SHIFT 8 221#define SSB_SPROM1_ITSSI_A_SHIFT 8
213#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */ 222#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */
214#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */ 223#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */
215#define SSB_SPROM1_AGAIN_A 0x00FF /* A-PHY */ 224#define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */
216#define SSB_SPROM1_AGAIN_BG 0xFF00 /* B-PHY and G-PHY */ 225#define SSB_SPROM1_AGAIN_BG_SHIFT 0
217#define SSB_SPROM1_AGAIN_BG_SHIFT 8 226#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */
218#define SSB_SPROM1_OEM 0x1076 /* 8 bytes OEM string (rev 1 only) */ 227#define SSB_SPROM1_AGAIN_A_SHIFT 8
228
219/* SPROM Revision 2 (inherits from rev 1) */ 229/* SPROM Revision 2 (inherits from rev 1) */
220#define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */ 230#define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */
221#define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */ 231#define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */
@@ -232,7 +242,11 @@
232#define SSB_SPROM2_OPO_VALUE 0x00FF 242#define SSB_SPROM2_OPO_VALUE 0x00FF
233#define SSB_SPROM2_OPO_UNUSED 0xFF00 243#define SSB_SPROM2_OPO_UNUSED 0xFF00
234#define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */ 244#define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */
235/* SPROM Revision 3 (inherits from rev 2) */ 245
246/* SPROM Revision 3 (inherits most data from rev 2) */
247#define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */
248#define SSB_SPROM3_ET0MAC 0x1050 /* 6 bytes MAC address for Ethernet ?? */
249#define SSB_SPROM3_ET1MAC 0x1050 /* 6 bytes MAC address for 802.11a ?? */
236#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ 250#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */
237#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ 251#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */
238#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ 252#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */
@@ -251,6 +265,57 @@
251#define SSB_SPROM3_CCKPO_11M_SHIFT 12 265#define SSB_SPROM3_CCKPO_11M_SHIFT 12
252#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ 266#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */
253 267
268/* SPROM Revision 4 */
269#define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */
270#define SSB_SPROM4_ET0MAC 0x1018 /* 6 bytes MAC address for Ethernet ?? */
271#define SSB_SPROM4_ET1MAC 0x1018 /* 6 bytes MAC address for 802.11a ?? */
272#define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */
273#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
274#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
275#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5
276#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
277#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
278#define SSB_SPROM4_CCODE 0x1052 /* Country Code (2 bytes) */
279#define SSB_SPROM4_ANTAVAIL 0x105D /* Antenna available bitfields */
280#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */
281#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0
282#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */
283#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8
284#define SSB_SPROM4_BFLLO 0x1044 /* Boardflags (low 16 bits) */
285#define SSB_SPROM4_AGAIN01 0x105E /* Antenna Gain (in dBm Q5.2) */
286#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */
287#define SSB_SPROM4_AGAIN0_SHIFT 0
288#define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */
289#define SSB_SPROM4_AGAIN1_SHIFT 8
290#define SSB_SPROM4_AGAIN23 0x1060
291#define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */
292#define SSB_SPROM4_AGAIN2_SHIFT 0
293#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */
294#define SSB_SPROM4_AGAIN3_SHIFT 8
295#define SSB_SPROM4_BFLHI 0x1046 /* Board Flags Hi */
296#define SSB_SPROM4_MAXP_BG 0x1080 /* Max Power BG in path 1 */
297#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
298#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
299#define SSB_SPROM4_ITSSI_BG_SHIFT 8
300#define SSB_SPROM4_MAXP_A 0x108A /* Max Power A in path 1 */
301#define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */
302#define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
303#define SSB_SPROM4_ITSSI_A_SHIFT 8
304#define SSB_SPROM4_GPIOA 0x1056 /* Gen. Purpose IO # 0 and 1 */
305#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */
306#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */
307#define SSB_SPROM4_GPIOA_P1_SHIFT 8
308#define SSB_SPROM4_GPIOB 0x1058 /* Gen. Purpose IO # 2 and 3 */
309#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */
310#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */
311#define SSB_SPROM4_GPIOB_P3_SHIFT 8
312#define SSB_SPROM4_PA0B0 0x1082 /* The paXbY locations are */
313#define SSB_SPROM4_PA0B1 0x1084 /* only guesses */
314#define SSB_SPROM4_PA0B2 0x1086
315#define SSB_SPROM4_PA1B0 0x108E
316#define SSB_SPROM4_PA1B1 0x1090
317#define SSB_SPROM4_PA1B2 0x1092
318
254/* Values for SSB_SPROM1_BINF_CCODE */ 319/* Values for SSB_SPROM1_BINF_CCODE */
255enum { 320enum {
256 SSB_SPROM1CCODE_WORLD = 0, 321 SSB_SPROM1CCODE_WORLD = 0,
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index e7fa657d0c49..5da9794b2d78 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -9,10 +9,13 @@ struct stack_trace {
9}; 9};
10 10
11extern void save_stack_trace(struct stack_trace *trace); 11extern void save_stack_trace(struct stack_trace *trace);
12extern void save_stack_trace_tsk(struct task_struct *tsk,
13 struct stack_trace *trace);
12 14
13extern void print_stack_trace(struct stack_trace *trace, int spaces); 15extern void print_stack_trace(struct stack_trace *trace, int spaces);
14#else 16#else
15# define save_stack_trace(trace) do { } while (0) 17# define save_stack_trace(trace) do { } while (0)
18# define save_stack_trace_tsk(tsk, trace) do { } while (0)
16# define print_stack_trace(trace, spaces) do { } while (0) 19# define print_stack_trace(trace, spaces) do { } while (0)
17#endif 20#endif
18 21
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index d9d5c5ad826c..3e9addc741c1 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -46,6 +46,7 @@ struct rpc_clnt {
46 cl_autobind : 1;/* use getport() */ 46 cl_autobind : 1;/* use getport() */
47 47
48 struct rpc_rtt * cl_rtt; /* RTO estimator data */ 48 struct rpc_rtt * cl_rtt; /* RTO estimator data */
49 const struct rpc_timeout *cl_timeout; /* Timeout strategy */
49 50
50 int cl_nodelen; /* nodename length */ 51 int cl_nodelen; /* nodename length */
51 char cl_nodename[UNX_MAXNODENAME]; 52 char cl_nodename[UNX_MAXNODENAME];
@@ -54,6 +55,7 @@ struct rpc_clnt {
54 struct dentry * cl_dentry; /* inode */ 55 struct dentry * cl_dentry; /* inode */
55 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 56 struct rpc_clnt * cl_parent; /* Points to parent of clones */
56 struct rpc_rtt cl_rtt_default; 57 struct rpc_rtt cl_rtt_default;
58 struct rpc_timeout cl_timeout_default;
57 struct rpc_program * cl_program; 59 struct rpc_program * cl_program;
58 char cl_inline_name[32]; 60 char cl_inline_name[32];
59}; 61};
@@ -99,7 +101,7 @@ struct rpc_create_args {
99 struct sockaddr *address; 101 struct sockaddr *address;
100 size_t addrsize; 102 size_t addrsize;
101 struct sockaddr *saddress; 103 struct sockaddr *saddress;
102 struct rpc_timeout *timeout; 104 const struct rpc_timeout *timeout;
103 char *servername; 105 char *servername;
104 struct rpc_program *program; 106 struct rpc_program *program;
105 u32 version; 107 u32 version;
@@ -123,11 +125,10 @@ void rpc_shutdown_client(struct rpc_clnt *);
123void rpc_release_client(struct rpc_clnt *); 125void rpc_release_client(struct rpc_clnt *);
124 126
125int rpcb_register(u32, u32, int, unsigned short, int *); 127int rpcb_register(u32, u32, int, unsigned short, int *);
126int rpcb_getport_sync(struct sockaddr_in *, __u32, __u32, int); 128int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int);
127void rpcb_getport_async(struct rpc_task *); 129void rpcb_getport_async(struct rpc_task *);
128 130
129void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 131void rpc_call_start(struct rpc_task *);
130
131int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 132int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
132 int flags, const struct rpc_call_ops *tk_ops, 133 int flags, const struct rpc_call_ops *tk_ops,
133 void *calldata); 134 void *calldata);
@@ -142,7 +143,7 @@ void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
142size_t rpc_max_payload(struct rpc_clnt *); 143size_t rpc_max_payload(struct rpc_clnt *);
143void rpc_force_rebind(struct rpc_clnt *); 144void rpc_force_rebind(struct rpc_clnt *);
144size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); 145size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
145char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 146const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
146 147
147#endif /* __KERNEL__ */ 148#endif /* __KERNEL__ */
148#endif /* _LINUX_SUNRPC_CLNT_H */ 149#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index c4beb5775111..70df4f1d8847 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -152,5 +152,44 @@ typedef __be32 rpc_fraghdr;
152 */ 152 */
153#define RPCBIND_MAXNETIDLEN (4u) 153#define RPCBIND_MAXNETIDLEN (4u)
154 154
155/*
156 * Universal addresses are introduced in RFC 1833 and further spelled
157 * out in RFC 3530. RPCBIND_MAXUADDRLEN defines a maximum byte length
158 * of a universal address for use in allocating buffers and character
159 * arrays.
160 *
161 * Quoting RFC 3530, section 2.2:
162 *
163 * For TCP over IPv4 and for UDP over IPv4, the format of r_addr is the
164 * US-ASCII string:
165 *
166 * h1.h2.h3.h4.p1.p2
167 *
168 * The prefix, "h1.h2.h3.h4", is the standard textual form for
169 * representing an IPv4 address, which is always four octets long.
170 * Assuming big-endian ordering, h1, h2, h3, and h4, are respectively,
171 * the first through fourth octets each converted to ASCII-decimal.
172 * Assuming big-endian ordering, p1 and p2 are, respectively, the first
173 * and second octets each converted to ASCII-decimal. For example, if a
174 * host, in big-endian order, has an address of 0x0A010307 and there is
175 * a service listening on, in big endian order, port 0x020F (decimal
176 * 527), then the complete universal address is "10.1.3.7.2.15".
177 *
178 * ...
179 *
180 * For TCP over IPv6 and for UDP over IPv6, the format of r_addr is the
181 * US-ASCII string:
182 *
183 * x1:x2:x3:x4:x5:x6:x7:x8.p1.p2
184 *
185 * The suffix "p1.p2" is the service port, and is computed the same way
186 * as with universal addresses for TCP and UDP over IPv4. The prefix,
187 * "x1:x2:x3:x4:x5:x6:x7:x8", is the standard textual form for
188 * representing an IPv6 address as defined in Section 2.2 of [RFC2373].
189 * Additionally, the two alternative forms specified in Section 2.2 of
190 * [RFC2373] are also acceptable.
191 */
192#define RPCBIND_MAXUADDRLEN (56u)
193
155#endif /* __KERNEL__ */ 194#endif /* __KERNEL__ */
156#endif /* _LINUX_SUNRPC_MSGPROT_H_ */ 195#endif /* _LINUX_SUNRPC_MSGPROT_H_ */
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 8ea077db0099..ce3d1b132729 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -56,8 +56,6 @@ struct rpc_task {
56 __u8 tk_garb_retry; 56 __u8 tk_garb_retry;
57 __u8 tk_cred_retry; 57 __u8 tk_cred_retry;
58 58
59 unsigned long tk_cookie; /* Cookie for batching tasks */
60
61 /* 59 /*
62 * timeout_fn to be executed by timer bottom half 60 * timeout_fn to be executed by timer bottom half
63 * callback to be executed after waking up 61 * callback to be executed after waking up
@@ -78,7 +76,6 @@ struct rpc_task {
78 struct timer_list tk_timer; /* kernel timer */ 76 struct timer_list tk_timer; /* kernel timer */
79 unsigned long tk_timeout; /* timeout for rpc_sleep() */ 77 unsigned long tk_timeout; /* timeout for rpc_sleep() */
80 unsigned short tk_flags; /* misc flags */ 78 unsigned short tk_flags; /* misc flags */
81 unsigned char tk_priority : 2;/* Task priority */
82 unsigned long tk_runstate; /* Task run status */ 79 unsigned long tk_runstate; /* Task run status */
83 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could 80 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
84 * be any workqueue 81 * be any workqueue
@@ -94,6 +91,9 @@ struct rpc_task {
94 unsigned long tk_start; /* RPC task init timestamp */ 91 unsigned long tk_start; /* RPC task init timestamp */
95 long tk_rtt; /* round-trip time (jiffies) */ 92 long tk_rtt; /* round-trip time (jiffies) */
96 93
94 pid_t tk_owner; /* Process id for batching tasks */
95 unsigned char tk_priority : 2;/* Task priority */
96
97#ifdef RPC_DEBUG 97#ifdef RPC_DEBUG
98 unsigned short tk_pid; /* debugging aid */ 98 unsigned short tk_pid; /* debugging aid */
99#endif 99#endif
@@ -117,6 +117,15 @@ struct rpc_call_ops {
117 void (*rpc_release)(void *); 117 void (*rpc_release)(void *);
118}; 118};
119 119
120struct rpc_task_setup {
121 struct rpc_task *task;
122 struct rpc_clnt *rpc_client;
123 const struct rpc_message *rpc_message;
124 const struct rpc_call_ops *callback_ops;
125 void *callback_data;
126 unsigned short flags;
127 signed char priority;
128};
120 129
121/* 130/*
122 * RPC task flags 131 * RPC task flags
@@ -180,10 +189,10 @@ struct rpc_call_ops {
180 * Note: if you change these, you must also change 189 * Note: if you change these, you must also change
181 * the task initialization definitions below. 190 * the task initialization definitions below.
182 */ 191 */
183#define RPC_PRIORITY_LOW 0 192#define RPC_PRIORITY_LOW (-1)
184#define RPC_PRIORITY_NORMAL 1 193#define RPC_PRIORITY_NORMAL (0)
185#define RPC_PRIORITY_HIGH 2 194#define RPC_PRIORITY_HIGH (1)
186#define RPC_NR_PRIORITY (RPC_PRIORITY_HIGH+1) 195#define RPC_NR_PRIORITY (1 + RPC_PRIORITY_HIGH - RPC_PRIORITY_LOW)
187 196
188/* 197/*
189 * RPC synchronization objects 198 * RPC synchronization objects
@@ -191,7 +200,7 @@ struct rpc_call_ops {
191struct rpc_wait_queue { 200struct rpc_wait_queue {
192 spinlock_t lock; 201 spinlock_t lock;
193 struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */ 202 struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */
194 unsigned long cookie; /* cookie of last task serviced */ 203 pid_t owner; /* process id of last task serviced */
195 unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */ 204 unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */
196 unsigned char priority; /* current priority */ 205 unsigned char priority; /* current priority */
197 unsigned char count; /* # task groups remaining serviced so far */ 206 unsigned char count; /* # task groups remaining serviced so far */
@@ -208,41 +217,13 @@ struct rpc_wait_queue {
208 * performance of NFS operations such as read/write. 217 * performance of NFS operations such as read/write.
209 */ 218 */
210#define RPC_BATCH_COUNT 16 219#define RPC_BATCH_COUNT 16
211
212#ifndef RPC_DEBUG
213# define RPC_WAITQ_INIT(var,qname) { \
214 .lock = __SPIN_LOCK_UNLOCKED(var.lock), \
215 .tasks = { \
216 [0] = LIST_HEAD_INIT(var.tasks[0]), \
217 [1] = LIST_HEAD_INIT(var.tasks[1]), \
218 [2] = LIST_HEAD_INIT(var.tasks[2]), \
219 }, \
220 }
221#else
222# define RPC_WAITQ_INIT(var,qname) { \
223 .lock = __SPIN_LOCK_UNLOCKED(var.lock), \
224 .tasks = { \
225 [0] = LIST_HEAD_INIT(var.tasks[0]), \
226 [1] = LIST_HEAD_INIT(var.tasks[1]), \
227 [2] = LIST_HEAD_INIT(var.tasks[2]), \
228 }, \
229 .name = qname, \
230 }
231#endif
232# define RPC_WAITQ(var,qname) struct rpc_wait_queue var = RPC_WAITQ_INIT(var,qname)
233
234#define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0) 220#define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0)
235 221
236/* 222/*
237 * Function prototypes 223 * Function prototypes
238 */ 224 */
239struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags, 225struct rpc_task *rpc_new_task(const struct rpc_task_setup *);
240 const struct rpc_call_ops *ops, void *data); 226struct rpc_task *rpc_run_task(const struct rpc_task_setup *);
241struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
242 const struct rpc_call_ops *ops, void *data);
243void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
244 int flags, const struct rpc_call_ops *ops,
245 void *data);
246void rpc_put_task(struct rpc_task *); 227void rpc_put_task(struct rpc_task *);
247void rpc_exit_task(struct rpc_task *); 228void rpc_exit_task(struct rpc_task *);
248void rpc_release_calldata(const struct rpc_call_ops *, void *); 229void rpc_release_calldata(const struct rpc_call_ops *, void *);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 30b17b3bc1a9..b3ff9a815e6f 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -120,7 +120,7 @@ struct rpc_xprt {
120 struct kref kref; /* Reference count */ 120 struct kref kref; /* Reference count */
121 struct rpc_xprt_ops * ops; /* transport methods */ 121 struct rpc_xprt_ops * ops; /* transport methods */
122 122
123 struct rpc_timeout timeout; /* timeout parms */ 123 const struct rpc_timeout *timeout; /* timeout parms */
124 struct sockaddr_storage addr; /* server address */ 124 struct sockaddr_storage addr; /* server address */
125 size_t addrlen; /* size of server address */ 125 size_t addrlen; /* size of server address */
126 int prot; /* IP protocol */ 126 int prot; /* IP protocol */
@@ -183,7 +183,7 @@ struct rpc_xprt {
183 bklog_u; /* backlog queue utilization */ 183 bklog_u; /* backlog queue utilization */
184 } stat; 184 } stat;
185 185
186 char * address_strings[RPC_DISPLAY_MAX]; 186 const char *address_strings[RPC_DISPLAY_MAX];
187}; 187};
188 188
189struct xprt_create { 189struct xprt_create {
@@ -191,7 +191,6 @@ struct xprt_create {
191 struct sockaddr * srcaddr; /* optional local address */ 191 struct sockaddr * srcaddr; /* optional local address */
192 struct sockaddr * dstaddr; /* remote peer address */ 192 struct sockaddr * dstaddr; /* remote peer address */
193 size_t addrlen; 193 size_t addrlen;
194 struct rpc_timeout * timeout; /* optional timeout parameters */
195}; 194};
196 195
197struct xprt_class { 196struct xprt_class {
@@ -203,11 +202,6 @@ struct xprt_class {
203}; 202};
204 203
205/* 204/*
206 * Transport operations used by ULPs
207 */
208void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr);
209
210/*
211 * Generic internal transport functions 205 * Generic internal transport functions
212 */ 206 */
213struct rpc_xprt *xprt_create_transport(struct xprt_create *args); 207struct rpc_xprt *xprt_create_transport(struct xprt_create *args);
@@ -245,7 +239,8 @@ void xprt_adjust_cwnd(struct rpc_task *task, int result);
245struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); 239struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
246void xprt_complete_rqst(struct rpc_task *task, int copied); 240void xprt_complete_rqst(struct rpc_task *task, int copied);
247void xprt_release_rqst_cong(struct rpc_task *task); 241void xprt_release_rqst_cong(struct rpc_task *task);
248void xprt_disconnect(struct rpc_xprt *xprt); 242void xprt_disconnect_done(struct rpc_xprt *xprt);
243void xprt_force_disconnect(struct rpc_xprt *xprt);
249 244
250/* 245/*
251 * Reserved bit positions in xprt->state 246 * Reserved bit positions in xprt->state
@@ -256,6 +251,7 @@ void xprt_disconnect(struct rpc_xprt *xprt);
256#define XPRT_CLOSE_WAIT (3) 251#define XPRT_CLOSE_WAIT (3)
257#define XPRT_BOUND (4) 252#define XPRT_BOUND (4)
258#define XPRT_BINDING (5) 253#define XPRT_BINDING (5)
254#define XPRT_CLOSING (6)
259 255
260static inline void xprt_set_connected(struct rpc_xprt *xprt) 256static inline void xprt_set_connected(struct rpc_xprt *xprt)
261{ 257{
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 4360e0816956..40280df2a3db 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -211,9 +211,6 @@ static inline int hibernate(void) { return -ENOSYS; }
211#ifdef CONFIG_PM_SLEEP 211#ifdef CONFIG_PM_SLEEP
212void save_processor_state(void); 212void save_processor_state(void);
213void restore_processor_state(void); 213void restore_processor_state(void);
214struct saved_context;
215void __save_processor_state(struct saved_context *ctxt);
216void __restore_processor_state(struct saved_context *ctxt);
217 214
218/* kernel/power/main.c */ 215/* kernel/power/main.c */
219extern struct blocking_notifier_head pm_chain_head; 216extern struct blocking_notifier_head pm_chain_head;
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 4f3838adbb30..2c3ce4c69b25 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -6,6 +6,7 @@
6#include <linux/mmzone.h> 6#include <linux/mmzone.h>
7#include <linux/list.h> 7#include <linux/list.h>
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include <linux/pagemap.h>
9 10
10#include <asm/atomic.h> 11#include <asm/atomic.h>
11#include <asm/page.h> 12#include <asm/page.h>
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 4f5047df8a9e..89faebfe48b8 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -945,7 +945,10 @@ enum
945 945
946/* For the /proc/sys support */ 946/* For the /proc/sys support */
947struct ctl_table; 947struct ctl_table;
948struct nsproxy;
948extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); 949extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
950extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
951 struct ctl_table_header *prev);
949extern void sysctl_head_finish(struct ctl_table_header *prev); 952extern void sysctl_head_finish(struct ctl_table_header *prev);
950extern int sysctl_perm(struct ctl_table *table, int op); 953extern int sysctl_perm(struct ctl_table *table, int op);
951 954
@@ -1049,6 +1052,13 @@ struct ctl_table
1049 void *extra2; 1052 void *extra2;
1050}; 1053};
1051 1054
1055struct ctl_table_root {
1056 struct list_head root_list;
1057 struct list_head header_list;
1058 struct list_head *(*lookup)(struct ctl_table_root *root,
1059 struct nsproxy *namespaces);
1060};
1061
1052/* struct ctl_table_header is used to maintain dynamic lists of 1062/* struct ctl_table_header is used to maintain dynamic lists of
1053 struct ctl_table trees. */ 1063 struct ctl_table trees. */
1054struct ctl_table_header 1064struct ctl_table_header
@@ -1057,12 +1067,26 @@ struct ctl_table_header
1057 struct list_head ctl_entry; 1067 struct list_head ctl_entry;
1058 int used; 1068 int used;
1059 struct completion *unregistering; 1069 struct completion *unregistering;
1070 struct ctl_table *ctl_table_arg;
1071 struct ctl_table_root *root;
1072};
1073
1074/* struct ctl_path describes where in the hierarchy a table is added */
1075struct ctl_path {
1076 const char *procname;
1077 int ctl_name;
1060}; 1078};
1061 1079
1080void register_sysctl_root(struct ctl_table_root *root);
1081struct ctl_table_header *__register_sysctl_paths(
1082 struct ctl_table_root *root, struct nsproxy *namespaces,
1083 const struct ctl_path *path, struct ctl_table *table);
1062struct ctl_table_header *register_sysctl_table(struct ctl_table * table); 1084struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
1085struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1086 struct ctl_table *table);
1063 1087
1064void unregister_sysctl_table(struct ctl_table_header * table); 1088void unregister_sysctl_table(struct ctl_table_header * table);
1065int sysctl_check_table(struct ctl_table *table); 1089int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table);
1066 1090
1067#else /* __KERNEL__ */ 1091#else /* __KERNEL__ */
1068 1092
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index e285746588d6..f752e73bf977 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -29,6 +29,7 @@
29struct sys_device; 29struct sys_device;
30 30
31struct sysdev_class { 31struct sysdev_class {
32 const char *name;
32 struct list_head drivers; 33 struct list_head drivers;
33 34
34 /* Default operations for these types of devices */ 35 /* Default operations for these types of devices */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 149ab62329e2..802710438a9e 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -32,6 +32,8 @@ struct attribute {
32 32
33struct attribute_group { 33struct attribute_group {
34 const char *name; 34 const char *name;
35 int (*is_visible)(struct kobject *,
36 struct attribute *, int);
35 struct attribute **attrs; 37 struct attribute **attrs;
36}; 38};
37 39
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index bac17c59b24e..08027f1d7f31 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -330,10 +330,12 @@ struct tcp_sock {
330 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 330 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
331 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ 331 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
332 332
333 struct tcp_sack_block_wire recv_sack_cache[4]; 333 struct tcp_sack_block recv_sack_cache[4];
334 334
335 u32 highest_sack; /* Start seq of globally highest revd SACK 335 struct sk_buff *highest_sack; /* highest skb with SACK received
336 * (validity guaranteed only if sacked_out > 0) */ 336 * (validity guaranteed only if
337 * sacked_out > 0)
338 */
337 339
338 /* from STCP, retrans queue hinting */ 340 /* from STCP, retrans queue hinting */
339 struct sk_buff* lost_skb_hint; 341 struct sk_buff* lost_skb_hint;
@@ -341,10 +343,7 @@ struct tcp_sock {
341 struct sk_buff *scoreboard_skb_hint; 343 struct sk_buff *scoreboard_skb_hint;
342 struct sk_buff *retransmit_skb_hint; 344 struct sk_buff *retransmit_skb_hint;
343 struct sk_buff *forward_skb_hint; 345 struct sk_buff *forward_skb_hint;
344 struct sk_buff *fastpath_skb_hint;
345 346
346 int fastpath_cnt_hint; /* Lags behind by current skb's pcount
347 * compared to respective fackets_out */
348 int lost_cnt_hint; 347 int lost_cnt_hint;
349 int retransmit_cnt_hint; 348 int retransmit_cnt_hint;
350 349
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 9c4ad755d7e5..dfbdfb9836f4 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -42,27 +42,27 @@ extern long do_no_restart_syscall(struct restart_block *parm);
42 42
43static inline void set_ti_thread_flag(struct thread_info *ti, int flag) 43static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
44{ 44{
45 set_bit(flag,&ti->flags); 45 set_bit(flag, (unsigned long *)&ti->flags);
46} 46}
47 47
48static inline void clear_ti_thread_flag(struct thread_info *ti, int flag) 48static inline void clear_ti_thread_flag(struct thread_info *ti, int flag)
49{ 49{
50 clear_bit(flag,&ti->flags); 50 clear_bit(flag, (unsigned long *)&ti->flags);
51} 51}
52 52
53static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag) 53static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag)
54{ 54{
55 return test_and_set_bit(flag,&ti->flags); 55 return test_and_set_bit(flag, (unsigned long *)&ti->flags);
56} 56}
57 57
58static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag) 58static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag)
59{ 59{
60 return test_and_clear_bit(flag,&ti->flags); 60 return test_and_clear_bit(flag, (unsigned long *)&ti->flags);
61} 61}
62 62
63static inline int test_ti_thread_flag(struct thread_info *ti, int flag) 63static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
64{ 64{
65 return test_bit(flag,&ti->flags); 65 return test_bit(flag, (unsigned long *)&ti->flags);
66} 66}
67 67
68#define set_thread_flag(flag) \ 68#define set_thread_flag(flag) \
diff --git a/include/linux/tick.h b/include/linux/tick.h
index f4a1395e05ff..0fadf95debe1 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -51,8 +51,10 @@ struct tick_sched {
51 unsigned long idle_jiffies; 51 unsigned long idle_jiffies;
52 unsigned long idle_calls; 52 unsigned long idle_calls;
53 unsigned long idle_sleeps; 53 unsigned long idle_sleeps;
54 int idle_active;
54 ktime_t idle_entrytime; 55 ktime_t idle_entrytime;
55 ktime_t idle_sleeptime; 56 ktime_t idle_sleeptime;
57 ktime_t idle_lastupdate;
56 ktime_t sleep_length; 58 ktime_t sleep_length;
57 unsigned long last_jiffies; 59 unsigned long last_jiffies;
58 unsigned long next_jiffies; 60 unsigned long next_jiffies;
@@ -103,6 +105,8 @@ extern void tick_nohz_stop_sched_tick(void);
103extern void tick_nohz_restart_sched_tick(void); 105extern void tick_nohz_restart_sched_tick(void);
104extern void tick_nohz_update_jiffies(void); 106extern void tick_nohz_update_jiffies(void);
105extern ktime_t tick_nohz_get_sleep_length(void); 107extern ktime_t tick_nohz_get_sleep_length(void);
108extern void tick_nohz_stop_idle(int cpu);
109extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
106# else 110# else
107static inline void tick_nohz_stop_sched_tick(void) { } 111static inline void tick_nohz_stop_sched_tick(void) { }
108static inline void tick_nohz_restart_sched_tick(void) { } 112static inline void tick_nohz_restart_sched_tick(void) { }
@@ -113,6 +117,8 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
113 117
114 return len; 118 return len;
115} 119}
120static inline void tick_nohz_stop_idle(int cpu) { }
121static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return 0; }
116# endif /* !NO_HZ */ 122# endif /* !NO_HZ */
117 123
118#endif 124#endif
diff --git a/include/linux/tifm.h b/include/linux/tifm.h
index 6b3a31805c72..2096b76d0cee 100644
--- a/include/linux/tifm.h
+++ b/include/linux/tifm.h
@@ -120,7 +120,7 @@ struct tifm_adapter {
120 struct completion *finish_me; 120 struct completion *finish_me;
121 121
122 struct work_struct media_switcher; 122 struct work_struct media_switcher;
123 struct class_device cdev; 123 struct device dev;
124 124
125 void (*eject)(struct tifm_adapter *fm, 125 void (*eject)(struct tifm_adapter *fm,
126 struct tifm_dev *sock); 126 struct tifm_dev *sock);
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 78cf899b4409..de0e71359ede 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -5,7 +5,7 @@
5#include <linux/ktime.h> 5#include <linux/ktime.h>
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7 7
8struct tvec_t_base_s; 8struct tvec_base;
9 9
10struct timer_list { 10struct timer_list {
11 struct list_head entry; 11 struct list_head entry;
@@ -14,7 +14,7 @@ struct timer_list {
14 void (*function)(unsigned long); 14 void (*function)(unsigned long);
15 unsigned long data; 15 unsigned long data;
16 16
17 struct tvec_t_base_s *base; 17 struct tvec_base *base;
18#ifdef CONFIG_TIMER_STATS 18#ifdef CONFIG_TIMER_STATS
19 void *start_site; 19 void *start_site;
20 char start_comm[16]; 20 char start_comm[16];
@@ -22,7 +22,7 @@ struct timer_list {
22#endif 22#endif
23}; 23};
24 24
25extern struct tvec_t_base_s boot_tvec_bases; 25extern struct tvec_base boot_tvec_bases;
26 26
27#define TIMER_INITIALIZER(_function, _expires, _data) { \ 27#define TIMER_INITIALIZER(_function, _expires, _data) { \
28 .function = (_function), \ 28 .function = (_function), \
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 47729f18bfdf..2352f46160d3 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2002, IBM Corp. 6 * Copyright (C) 2002, IBM Corp.
7 * 7 *
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -103,6 +103,7 @@
103 .forkexec_idx = 0, \ 103 .forkexec_idx = 0, \
104 .flags = SD_LOAD_BALANCE \ 104 .flags = SD_LOAD_BALANCE \
105 | SD_BALANCE_NEWIDLE \ 105 | SD_BALANCE_NEWIDLE \
106 | SD_BALANCE_FORK \
106 | SD_BALANCE_EXEC \ 107 | SD_BALANCE_EXEC \
107 | SD_WAKE_AFFINE \ 108 | SD_WAKE_AFFINE \
108 | SD_WAKE_IDLE \ 109 | SD_WAKE_IDLE \
@@ -134,6 +135,7 @@
134 .forkexec_idx = 1, \ 135 .forkexec_idx = 1, \
135 .flags = SD_LOAD_BALANCE \ 136 .flags = SD_LOAD_BALANCE \
136 | SD_BALANCE_NEWIDLE \ 137 | SD_BALANCE_NEWIDLE \
138 | SD_BALANCE_FORK \
137 | SD_BALANCE_EXEC \ 139 | SD_BALANCE_EXEC \
138 | SD_WAKE_AFFINE \ 140 | SD_WAKE_AFFINE \
139 | SD_WAKE_IDLE \ 141 | SD_WAKE_IDLE \
@@ -165,6 +167,7 @@
165 .forkexec_idx = 1, \ 167 .forkexec_idx = 1, \
166 .flags = SD_LOAD_BALANCE \ 168 .flags = SD_LOAD_BALANCE \
167 | SD_BALANCE_NEWIDLE \ 169 | SD_BALANCE_NEWIDLE \
170 | SD_BALANCE_FORK \
168 | SD_BALANCE_EXEC \ 171 | SD_BALANCE_EXEC \
169 | SD_WAKE_AFFINE \ 172 | SD_WAKE_AFFINE \
170 | BALANCE_FOR_PKG_POWER,\ 173 | BALANCE_FOR_PKG_POWER,\
diff --git a/include/linux/tty.h b/include/linux/tty.h
index defd2ab72449..402de892b3ed 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -23,7 +23,7 @@
23 */ 23 */
24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
26#define NR_LDISCS 17 26#define NR_LDISCS 18
27 27
28/* line disciplines */ 28/* line disciplines */
29#define N_TTY 0 29#define N_TTY 0
@@ -44,6 +44,7 @@
44#define N_SYNC_PPP 14 /* synchronous PPP */ 44#define N_SYNC_PPP 14 /* synchronous PPP */
45#define N_HCI 15 /* Bluetooth HCI UART */ 45#define N_HCI 15 /* Bluetooth HCI UART */
46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ 46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */
47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */
47 48
48/* 49/*
49 * This character is the same as _POSIX_VDISABLE: it cannot be used as 50 * This character is the same as _POSIX_VDISABLE: it cannot be used as
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 44c28e94df50..973386d439da 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -18,20 +18,22 @@
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20 20
21struct uio_map;
22
21/** 23/**
22 * struct uio_mem - description of a UIO memory region 24 * struct uio_mem - description of a UIO memory region
23 * @kobj: kobject for this mapping
24 * @addr: address of the device's memory 25 * @addr: address of the device's memory
25 * @size: size of IO 26 * @size: size of IO
26 * @memtype: type of memory addr points to 27 * @memtype: type of memory addr points to
27 * @internal_addr: ioremap-ped version of addr, for driver internal use 28 * @internal_addr: ioremap-ped version of addr, for driver internal use
29 * @map: for use by the UIO core only.
28 */ 30 */
29struct uio_mem { 31struct uio_mem {
30 struct kobject kobj;
31 unsigned long addr; 32 unsigned long addr;
32 unsigned long size; 33 unsigned long size;
33 int memtype; 34 int memtype;
34 void __iomem *internal_addr; 35 void __iomem *internal_addr;
36 struct uio_map *map;
35}; 37};
36 38
37#define MAX_UIO_MAPS 5 39#define MAX_UIO_MAPS 5
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 0987aa7a6cf5..74e84caa1e20 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -541,6 +541,16 @@
541/* Maximum size of returned data */ 541/* Maximum size of returned data */
542#define IW_SCAN_MAX_DATA 4096 /* In bytes */ 542#define IW_SCAN_MAX_DATA 4096 /* In bytes */
543 543
544/* Scan capability flags - in (struct iw_range *)->scan_capa */
545#define IW_SCAN_CAPA_NONE 0x00
546#define IW_SCAN_CAPA_ESSID 0x01
547#define IW_SCAN_CAPA_BSSID 0x02
548#define IW_SCAN_CAPA_CHANNEL 0x04
549#define IW_SCAN_CAPA_MODE 0x08
550#define IW_SCAN_CAPA_RATE 0x10
551#define IW_SCAN_CAPA_TYPE 0x20
552#define IW_SCAN_CAPA_TIME 0x40
553
544/* Max number of char in custom event - use multiple of them if needed */ 554/* Max number of char in custom event - use multiple of them if needed */
545#define IW_CUSTOM_MAX 256 /* In bytes */ 555#define IW_CUSTOM_MAX 256 /* In bytes */
546 556
@@ -963,6 +973,9 @@ struct iw_range
963 __u16 old_num_channels; 973 __u16 old_num_channels;
964 __u8 old_num_frequency; 974 __u8 old_num_frequency;
965 975
976 /* Scan capabilities */
977 __u8 scan_capa; /* IW_SCAN_CAPA_* bit field */
978
966 /* Wireless event capability bitmasks */ 979 /* Wireless event capability bitmasks */
967 __u32 event_capa[6]; 980 __u32 event_capa[6];
968 981
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index b58adc52448d..9b5b00c4ef9d 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -91,9 +91,9 @@ struct xfrm_replay_state
91}; 91};
92 92
93struct xfrm_algo { 93struct xfrm_algo {
94 char alg_name[64]; 94 char alg_name[64];
95 int alg_key_len; /* in bits */ 95 unsigned int alg_key_len; /* in bits */
96 char alg_key[0]; 96 char alg_key[0];
97}; 97};
98 98
99struct xfrm_stats { 99struct xfrm_stats {
@@ -114,6 +114,7 @@ enum
114 XFRM_POLICY_IN = 0, 114 XFRM_POLICY_IN = 0,
115 XFRM_POLICY_OUT = 1, 115 XFRM_POLICY_OUT = 1,
116 XFRM_POLICY_FWD = 2, 116 XFRM_POLICY_FWD = 2,
117 XFRM_POLICY_MASK = 3,
117 XFRM_POLICY_MAX = 3 118 XFRM_POLICY_MAX = 3
118}; 119};
119 120
@@ -328,6 +329,7 @@ struct xfrm_usersa_info {
328#define XFRM_STATE_DECAP_DSCP 2 329#define XFRM_STATE_DECAP_DSCP 2
329#define XFRM_STATE_NOPMTUDISC 4 330#define XFRM_STATE_NOPMTUDISC 4
330#define XFRM_STATE_WILDRECV 8 331#define XFRM_STATE_WILDRECV 8
332#define XFRM_STATE_ICMP 16
331}; 333};
332 334
333struct xfrm_usersa_id { 335struct xfrm_usersa_id {
@@ -362,6 +364,8 @@ struct xfrm_userpolicy_info {
362#define XFRM_POLICY_BLOCK 1 364#define XFRM_POLICY_BLOCK 1
363 __u8 flags; 365 __u8 flags;
364#define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ 366#define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */
367 /* Automatically expand selector to include matching ICMP payloads. */
368#define XFRM_POLICY_ICMP 2
365 __u8 share; 369 __u8 share;
366}; 370};
367 371