aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild344
-rw-r--r--include/linux/ac97_codec.h2
-rw-r--r--include/linux/acct.h8
-rw-r--r--include/linux/acpi.h6
-rw-r--r--include/linux/adfs_fs.h2
-rw-r--r--include/linux/aer.h24
-rw-r--r--include/linux/affs_fs.h7
-rw-r--r--include/linux/ata.h26
-rw-r--r--include/linux/atalk.h40
-rw-r--r--include/linux/atmdev.h4
-rw-r--r--include/linux/atmlec.h119
-rw-r--r--include/linux/audit.h84
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/bitmap.h5
-rw-r--r--include/linux/blkdev.h7
-rw-r--r--include/linux/blktrace_api.h5
-rw-r--r--include/linux/bootmem.h104
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/byteorder/Kbuild7
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/clocksource.h185
-rw-r--r--include/linux/cn_proc.h3
-rw-r--r--include/linux/coda_linux.h4
-rw-r--r--include/linux/coda_psdev.h4
-rw-r--r--include/linux/compat.h2
-rw-r--r--include/linux/compat_ioctl.h11
-rw-r--r--include/linux/compiler.h9
-rw-r--r--include/linux/completion.h15
-rw-r--r--include/linux/console.h10
-rw-r--r--include/linux/console_struct.h1
-rw-r--r--include/linux/cpu.h30
-rw-r--r--include/linux/cpufreq.h9
-rw-r--r--include/linux/cpumask.h4
-rw-r--r--include/linux/cpuset.h4
-rw-r--r--include/linux/cramfs_fs.h2
-rw-r--r--include/linux/crypto.h723
-rw-r--r--include/linux/dcache.h13
-rw-r--r--include/linux/dccp.h16
-rw-r--r--include/linux/debug_locks.h71
-rw-r--r--include/linux/delayacct.h121
-rw-r--r--include/linux/devfs_fs.h41
-rw-r--r--include/linux/devfs_fs_kernel.h57
-rw-r--r--include/linux/device-mapper.h111
-rw-r--r--include/linux/device.h99
-rw-r--r--include/linux/dm-ioctl.h6
-rw-r--r--include/linux/dma-mapping.h7
-rw-r--r--include/linux/dmaengine.h45
-rw-r--r--include/linux/dmi.h3
-rw-r--r--include/linux/dqblk_xfs.h4
-rw-r--r--include/linux/dvb/Kbuild9
-rw-r--r--include/linux/dvb/dmx.h26
-rw-r--r--include/linux/edd.h1
-rw-r--r--include/linux/efs_fs.h2
-rw-r--r--include/linux/efs_fs_sb.h3
-rw-r--r--include/linux/eisa.h8
-rw-r--r--include/linux/elf-em.h6
-rw-r--r--include/linux/elfcore.h10
-rw-r--r--include/linux/elfnote.h90
-rw-r--r--include/linux/err.h8
-rw-r--r--include/linux/errqueue.h2
-rw-r--r--include/linux/eventpoll.h2
-rw-r--r--include/linux/ext2_fs.h6
-rw-r--r--include/linux/ext3_fs.h50
-rw-r--r--include/linux/ext3_fs_i.h18
-rw-r--r--include/linux/ext3_jbd.h10
-rw-r--r--include/linux/fb.h48
-rw-r--r--include/linux/fcntl.h1
-rw-r--r--include/linux/fib_rules.h65
-rw-r--r--include/linux/file.h1
-rw-r--r--include/linux/filter.h13
-rw-r--r--include/linux/fs.h84
-rw-r--r--include/linux/fs_enet_pd.h50
-rw-r--r--include/linux/fsnotify.h6
-rw-r--r--include/linux/fuse.h36
-rw-r--r--include/linux/futex.h15
-rw-r--r--include/linux/generic_acl.h36
-rw-r--r--include/linux/genetlink.h18
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/getcpu.h18
-rw-r--r--include/linux/gfp.h41
-rw-r--r--include/linux/hardirq.h27
-rw-r--r--include/linux/hdlc.h203
-rw-r--r--include/linux/hdlc/Kbuild1
-rw-r--r--include/linux/hdlc/ioctl.h33
-rw-r--r--include/linux/highmem.h5
-rw-r--r--include/linux/hpfs_fs.h8
-rw-r--r--include/linux/hrtimer.h6
-rw-r--r--include/linux/hw_random.h50
-rw-r--r--include/linux/i2c-algo-bit.h1
-rw-r--r--include/linux/i2c-algo-pcf.h1
-rw-r--r--include/linux/i2c-algo-sibyte.h33
-rw-r--r--include/linux/i2c-id.h4
-rw-r--r--include/linux/i2c.h16
-rw-r--r--include/linux/icmp.h12
-rw-r--r--include/linux/ide.h8
-rw-r--r--include/linux/idr.h3
-rw-r--r--include/linux/if.h3
-rw-r--r--include/linux/if_addr.h55
-rw-r--r--include/linux/if_arp.h6
-rw-r--r--include/linux/if_link.h136
-rw-r--r--include/linux/if_vlan.h10
-rw-r--r--include/linux/igmp.h38
-rw-r--r--include/linux/in.h16
-rw-r--r--include/linux/in6.h8
-rw-r--r--include/linux/inet.h2
-rw-r--r--include/linux/inet_diag.h10
-rw-r--r--include/linux/inetdevice.h24
-rw-r--r--include/linux/init.h1
-rw-r--r--include/linux/init_task.h17
-rw-r--r--include/linux/input.h34
-rw-r--r--include/linux/interrupt.h154
-rw-r--r--include/linux/ioport.h33
-rw-r--r--include/linux/ioprio.h23
-rw-r--r--include/linux/ip.h15
-rw-r--r--include/linux/ipmi.h4
-rw-r--r--include/linux/ipv6.h47
-rw-r--r--include/linux/irq.h377
-rw-r--r--include/linux/irqflags.h96
-rw-r--r--include/linux/isdn/Kbuild1
-rw-r--r--include/linux/isdn/tpam.h55
-rw-r--r--include/linux/iso_fs.h6
-rw-r--r--include/linux/jbd.h74
-rw-r--r--include/linux/jffs2.h5
-rw-r--r--include/linux/jiffies.h19
-rw-r--r--include/linux/kallsyms.h23
-rw-r--r--include/linux/kbd_kern.h4
-rw-r--r--include/linux/kernel.h22
-rw-r--r--include/linux/key.h21
-rw-r--r--include/linux/kobject.h16
-rw-r--r--include/linux/kthread.h66
-rw-r--r--include/linux/ktime.h15
-rw-r--r--include/linux/leds.h3
-rw-r--r--include/linux/libata.h192
-rw-r--r--include/linux/license.h14
-rw-r--r--include/linux/linkage.h6
-rw-r--r--include/linux/list.h169
-rw-r--r--include/linux/lockd/lockd.h5
-rw-r--r--include/linux/lockdep.h353
-rw-r--r--include/linux/loop.h5
-rw-r--r--include/linux/magic.h37
-rw-r--r--include/linux/mc146818rtc.h7
-rw-r--r--include/linux/memory_hotplug.h73
-rw-r--r--include/linux/mempolicy.h4
-rw-r--r--include/linux/migrate.h11
-rw-r--r--include/linux/minix_fs.h6
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mm.h263
-rw-r--r--include/linux/mm_types.h67
-rw-r--r--include/linux/mmc/host.h4
-rw-r--r--include/linux/mmc/mmc.h3
-rw-r--r--include/linux/mmzone.h178
-rw-r--r--include/linux/mod_devicetable.h23
-rw-r--r--include/linux/module.h48
-rw-r--r--include/linux/mount.h8
-rw-r--r--include/linux/mroute.h14
-rw-r--r--include/linux/msdos_fs.h7
-rw-r--r--include/linux/mtd/bbm.h35
-rw-r--r--include/linux/mtd/cfi.h13
-rw-r--r--include/linux/mtd/mtd.h4
-rw-r--r--include/linux/mtd/nand.h16
-rw-r--r--include/linux/mtd/onenand.h77
-rw-r--r--include/linux/mutex-debug.h18
-rw-r--r--include/linux/mutex.h37
-rw-r--r--include/linux/namei.h3
-rw-r--r--include/linux/nbd.h12
-rw-r--r--include/linux/ncp_fs.h5
-rw-r--r--include/linux/neighbour.h159
-rw-r--r--include/linux/net.h29
-rw-r--r--include/linux/netdevice.h75
-rw-r--r--include/linux/netfilter.h6
-rw-r--r--include/linux/netfilter/Kbuild40
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h1
-rw-r--r--include/linux/netfilter/nfnetlink.h4
-rw-r--r--include/linux/netfilter/nfnetlink_log.h6
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h8
-rw-r--r--include/linux/netfilter/x_tables.h52
-rw-r--r--include/linux/netfilter/xt_DSCP.h20
-rw-r--r--include/linux/netfilter/xt_dscp.h23
-rw-r--r--include/linux/netfilter_arp/Kbuild3
-rw-r--r--include/linux/netfilter_arp/arp_tables.h9
-rw-r--r--include/linux/netfilter_bridge.h35
-rw-r--r--include/linux/netfilter_bridge/Kbuild17
-rw-r--r--include/linux/netfilter_ipv4/Kbuild63
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_pptp.h45
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h22
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tuple.h16
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_core.h8
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_pptp.h4
-rw-r--r--include/linux/netfilter_ipv4/ip_queue.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h3
-rw-r--r--include/linux/netfilter_ipv4/ipt_DSCP.h6
-rw-r--r--include/linux/netfilter_ipv4/ipt_dscp.h14
-rw-r--r--include/linux/netfilter_ipv4/ipt_iprange.h2
-rw-r--r--include/linux/netfilter_ipv4/listhelp.h123
-rw-r--r--include/linux/netfilter_ipv6.h1
-rw-r--r--include/linux/netfilter_ipv6/Kbuild21
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h3
-rw-r--r--include/linux/netfilter_logging.h33
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/netpoll.h1
-rw-r--r--include/linux/nfs4.h7
-rw-r--r--include/linux/nfs_fs.h67
-rw-r--r--include/linux/nfs_fs_sb.h90
-rw-r--r--include/linux/nfs_idmap.h14
-rw-r--r--include/linux/nfs_page.h5
-rw-r--r--include/linux/nfs_xdr.h94
-rw-r--r--include/linux/nfsd/Kbuild7
-rw-r--r--include/linux/nfsd/nfsfh.h10
-rw-r--r--include/linux/nfsd/stats.h6
-rw-r--r--include/linux/nmi.h3
-rw-r--r--include/linux/node.h25
-rw-r--r--include/linux/notifier.h2
-rw-r--r--include/linux/nsc_gpio.h40
-rw-r--r--include/linux/openprom_fs.h10
-rw-r--r--include/linux/page-flags.h183
-rw-r--r--include/linux/pagemap.h60
-rw-r--r--include/linux/parport.h5
-rw-r--r--include/linux/pci.h49
-rw-r--r--include/linux/pci_ids.h46
-rw-r--r--include/linux/pci_regs.h18
-rw-r--r--include/linux/pcieport_if.h6
-rw-r--r--include/linux/percpu.h89
-rw-r--r--include/linux/phy.h1
-rw-r--r--include/linux/pid.h2
-rw-r--r--include/linux/pkt_cls.h1
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/plist.h248
-rw-r--r--include/linux/pm.h63
-rw-r--r--include/linux/pm_legacy.h7
-rw-r--r--include/linux/pmu.h3
-rw-r--r--include/linux/pnp.h7
-rw-r--r--include/linux/poison.h63
-rw-r--r--include/linux/posix-timers.h4
-rw-r--r--include/linux/proc_fs.h21
-rw-r--r--include/linux/ptrace.h5
-rw-r--r--include/linux/qnx4_fs.h2
-rw-r--r--include/linux/raid/Kbuild2
-rw-r--r--include/linux/raid/bitmap.h11
-rw-r--r--include/linux/raid/linear.h2
-rw-r--r--include/linux/raid/md.h4
-rw-r--r--include/linux/raid/md_k.h13
-rw-r--r--include/linux/raid/md_p.h5
-rw-r--r--include/linux/raid/raid10.h7
-rw-r--r--include/linux/raid/raid5.h1
-rw-r--r--include/linux/rcupdate.h25
-rw-r--r--include/linux/reboot.h4
-rw-r--r--include/linux/reiserfs_acl.h17
-rw-r--r--include/linux/reiserfs_fs.h12
-rw-r--r--include/linux/reiserfs_fs_i.h5
-rw-r--r--include/linux/reiserfs_xattr.h8
-rw-r--r--include/linux/resource.h4
-rw-r--r--include/linux/resume-trace.h34
-rw-r--r--include/linux/rmap.h14
-rw-r--r--include/linux/root_dev.h2
-rw-r--r--include/linux/rtc-v3020.h35
-rw-r--r--include/linux/rtc.h16
-rw-r--r--include/linux/rtmutex.h107
-rw-r--r--include/linux/rtnetlink.h376
-rw-r--r--include/linux/rwsem-spinlock.h27
-rw-r--r--include/linux/rwsem.h96
-rw-r--r--include/linux/scatterlist.h4
-rw-r--r--include/linux/sched.h241
-rw-r--r--include/linux/scx200.h7
-rw-r--r--include/linux/scx200_gpio.h22
-rw-r--r--include/linux/security.h342
-rw-r--r--include/linux/selinux.h29
-rw-r--r--include/linux/seqlock.h12
-rw-r--r--include/linux/serial_core.h8
-rw-r--r--include/linux/shmem_fs.h24
-rw-r--r--include/linux/signal.h26
-rw-r--r--include/linux/skbuff.h92
-rw-r--r--include/linux/slab.h33
-rw-r--r--include/linux/smb.h4
-rw-r--r--include/linux/smp.h5
-rw-r--r--include/linux/snmp.h35
-rw-r--r--include/linux/spi/spi.h6
-rw-r--r--include/linux/spinlock.h77
-rw-r--r--include/linux/spinlock_api_smp.h50
-rw-r--r--include/linux/spinlock_api_up.h1
-rw-r--r--include/linux/spinlock_types.h47
-rw-r--r--include/linux/spinlock_types_up.h9
-rw-r--r--include/linux/spinlock_up.h1
-rw-r--r--include/linux/stacktrace.h21
-rw-r--r--include/linux/stddef.h2
-rw-r--r--include/linux/sunrpc/Kbuild1
-rw-r--r--include/linux/sunrpc/auth.h16
-rw-r--r--include/linux/sunrpc/clnt.h57
-rw-r--r--include/linux/sunrpc/gss_api.h2
-rw-r--r--include/linux/sunrpc/gss_krb5.h19
-rw-r--r--include/linux/sunrpc/gss_spkm3.h4
-rw-r--r--include/linux/sunrpc/msg_prot.h2
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h6
-rw-r--r--include/linux/sunrpc/sched.h5
-rw-r--r--include/linux/sunrpc/svc.h49
-rw-r--r--include/linux/sunrpc/svcauth.h4
-rw-r--r--include/linux/sunrpc/xdr.h39
-rw-r--r--include/linux/sunrpc/xprt.h68
-rw-r--r--include/linux/suspend.h33
-rw-r--r--include/linux/swap.h16
-rw-r--r--include/linux/synclink.h5
-rw-r--r--include/linux/syscalls.h6
-rw-r--r--include/linux/sysctl.h18
-rw-r--r--include/linux/sysfs.h28
-rw-r--r--include/linux/taskstats.h137
-rw-r--r--include/linux/taskstats_kern.h89
-rw-r--r--include/linux/tc_act/Kbuild4
-rw-r--r--include/linux/tc_ematch/Kbuild4
-rw-r--r--include/linux/tcp.h23
-rw-r--r--include/linux/time.h40
-rw-r--r--include/linux/timex.h5
-rw-r--r--include/linux/topology.h3
-rw-r--r--include/linux/trdevice.h2
-rw-r--r--include/linux/tty.h18
-rw-r--r--include/linux/tty_driver.h14
-rw-r--r--include/linux/tty_flip.h2
-rw-r--r--include/linux/types.h7
-rw-r--r--include/linux/uaccess.h22
-rw-r--r--include/linux/udp.h10
-rw-r--r--include/linux/ufs_fs.h108
-rw-r--r--include/linux/ufs_fs_i.h1
-rw-r--r--include/linux/unwind.h127
-rw-r--r--include/linux/usb.h165
-rw-r--r--include/linux/usb/audio.h53
-rw-r--r--include/linux/usb/midi.h112
-rw-r--r--include/linux/usb/otg.h (renamed from include/linux/usb_otg.h)4
-rw-r--r--include/linux/usb/serial.h300
-rw-r--r--include/linux/usb_ch9.h7
-rw-r--r--include/linux/usb_gadget.h4
-rw-r--r--include/linux/usb_usual.h7
-rw-r--r--include/linux/usbdevice_fs.h3
-rw-r--r--include/linux/vermagic.h6
-rw-r--r--include/linux/videodev.h55
-rw-r--r--include/linux/videodev2.h400
-rw-r--r--include/linux/vmalloc.h4
-rw-r--r--include/linux/vmstat.h229
-rw-r--r--include/linux/vt.h11
-rw-r--r--include/linux/vt_kern.h4
-rw-r--r--include/linux/wait.h8
-rw-r--r--include/linux/watchdog.h10
-rw-r--r--include/linux/wireless.h24
-rw-r--r--include/linux/workqueue.h2
-rw-r--r--include/linux/writeback.h3
-rw-r--r--include/linux/xfrm.h52
348 files changed, 9622 insertions, 3564 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
new file mode 100644
index 000000000000..f7a52e19b4be
--- /dev/null
+++ b/include/linux/Kbuild
@@ -0,0 +1,344 @@
1header-y += byteorder/
2header-y += dvb/
3header-y += hdlc/
4header-y += isdn/
5header-y += nfsd/
6header-y += raid/
7header-y += sunrpc/
8header-y += tc_act/
9header-y += netfilter/
10header-y += netfilter_arp/
11header-y += netfilter_bridge/
12header-y += netfilter_ipv4/
13header-y += netfilter_ipv6/
14
15header-y += affs_hardblocks.h
16header-y += aio_abi.h
17header-y += a.out.h
18header-y += arcfb.h
19header-y += atmapi.h
20header-y += atmbr2684.h
21header-y += atmclip.h
22header-y += atm_eni.h
23header-y += atm_he.h
24header-y += atm_idt77105.h
25header-y += atmioc.h
26header-y += atmlec.h
27header-y += atmmpc.h
28header-y += atm_nicstar.h
29header-y += atmppp.h
30header-y += atmsap.h
31header-y += atmsvc.h
32header-y += atm_zatm.h
33header-y += auto_fs4.h
34header-y += auxvec.h
35header-y += awe_voice.h
36header-y += ax25.h
37header-y += b1lli.h
38header-y += baycom.h
39header-y += bfs_fs.h
40header-y += blkpg.h
41header-y += bpqether.h
42header-y += cdk.h
43header-y += chio.h
44header-y += coda_psdev.h
45header-y += coff.h
46header-y += comstats.h
47header-y += consolemap.h
48header-y += cycx_cfm.h
49header-y += dm-ioctl.h
50header-y += dn.h
51header-y += dqblk_v1.h
52header-y += dqblk_v2.h
53header-y += dqblk_xfs.h
54header-y += efs_fs_sb.h
55header-y += elf-fdpic.h
56header-y += elf.h
57header-y += elf-em.h
58header-y += fadvise.h
59header-y += fd.h
60header-y += fdreg.h
61header-y += fib_rules.h
62header-y += ftape-header-segment.h
63header-y += ftape-vendors.h
64header-y += fuse.h
65header-y += futex.h
66header-y += genetlink.h
67header-y += gen_stats.h
68header-y += gigaset_dev.h
69header-y += hdsmart.h
70header-y += hysdn_if.h
71header-y += i2c-dev.h
72header-y += i8k.h
73header-y += icmp.h
74header-y += if_addr.h
75header-y += if_arcnet.h
76header-y += if_arp.h
77header-y += if_bonding.h
78header-y += if_cablemodem.h
79header-y += if_fc.h
80header-y += if_fddi.h
81header-y += if.h
82header-y += if_hippi.h
83header-y += if_infiniband.h
84header-y += if_link.h
85header-y += if_packet.h
86header-y += if_plip.h
87header-y += if_ppp.h
88header-y += if_slip.h
89header-y += if_strip.h
90header-y += if_tunnel.h
91header-y += in6.h
92header-y += in_route.h
93header-y += ioctl.h
94header-y += ip.h
95header-y += ipmi_msgdefs.h
96header-y += ip_mp_alg.h
97header-y += ipsec.h
98header-y += ipx.h
99header-y += irda.h
100header-y += isdn_divertif.h
101header-y += iso_fs.h
102header-y += ite_gpio.h
103header-y += ixjuser.h
104header-y += jffs2.h
105header-y += keyctl.h
106header-y += limits.h
107header-y += magic.h
108header-y += major.h
109header-y += matroxfb.h
110header-y += meye.h
111header-y += minix_fs.h
112header-y += mmtimer.h
113header-y += mqueue.h
114header-y += mtio.h
115header-y += ncp_no.h
116header-y += neighbour.h
117header-y += netfilter_arp.h
118header-y += netrom.h
119header-y += nfs2.h
120header-y += nfs4_mount.h
121header-y += nfs_mount.h
122header-y += param.h
123header-y += pci_ids.h
124header-y += pci_regs.h
125header-y += personality.h
126header-y += pfkeyv2.h
127header-y += pg.h
128header-y += pkt_cls.h
129header-y += pkt_sched.h
130header-y += posix_types.h
131header-y += ppdev.h
132header-y += prctl.h
133header-y += ps2esdi.h
134header-y += qic117.h
135header-y += qnxtypes.h
136header-y += quotaio_v1.h
137header-y += quotaio_v2.h
138header-y += radeonfb.h
139header-y += raw.h
140header-y += resource.h
141header-y += rose.h
142header-y += sctp.h
143header-y += smbno.h
144header-y += snmp.h
145header-y += sockios.h
146header-y += som.h
147header-y += sound.h
148header-y += synclink.h
149header-y += telephony.h
150header-y += termios.h
151header-y += ticable.h
152header-y += times.h
153header-y += tiocl.h
154header-y += tipc.h
155header-y += toshiba.h
156header-y += ultrasound.h
157header-y += un.h
158header-y += utime.h
159header-y += utsname.h
160header-y += video_decoder.h
161header-y += video_encoder.h
162header-y += videotext.h
163header-y += vt.h
164header-y += wavefront.h
165header-y += wireless.h
166header-y += xattr.h
167header-y += x25.h
168header-y += zorro_ids.h
169
170unifdef-y += acct.h
171unifdef-y += adb.h
172unifdef-y += adfs_fs.h
173unifdef-y += agpgart.h
174unifdef-y += apm_bios.h
175unifdef-y += atalk.h
176unifdef-y += atmarp.h
177unifdef-y += atmdev.h
178unifdef-y += atm.h
179unifdef-y += atm_tcp.h
180unifdef-y += audit.h
181unifdef-y += auto_fs.h
182unifdef-y += binfmts.h
183unifdef-y += capability.h
184unifdef-y += capi.h
185unifdef-y += cciss_ioctl.h
186unifdef-y += cdrom.h
187unifdef-y += cm4000_cs.h
188unifdef-y += cn_proc.h
189unifdef-y += coda.h
190unifdef-y += connector.h
191unifdef-y += cramfs_fs.h
192unifdef-y += cuda.h
193unifdef-y += cyclades.h
194unifdef-y += dccp.h
195unifdef-y += dirent.h
196unifdef-y += divert.h
197unifdef-y += elfcore.h
198unifdef-y += errno.h
199unifdef-y += errqueue.h
200unifdef-y += ethtool.h
201unifdef-y += eventpoll.h
202unifdef-y += ext2_fs.h
203unifdef-y += ext3_fs.h
204unifdef-y += fb.h
205unifdef-y += fcntl.h
206unifdef-y += filter.h
207unifdef-y += flat.h
208unifdef-y += fs.h
209unifdef-y += ftape.h
210unifdef-y += gameport.h
211unifdef-y += generic_serial.h
212unifdef-y += genhd.h
213unifdef-y += hayesesp.h
214unifdef-y += hdlcdrv.h
215unifdef-y += hdlc.h
216unifdef-y += hdreg.h
217unifdef-y += hiddev.h
218unifdef-y += hpet.h
219unifdef-y += i2c.h
220unifdef-y += i2o-dev.h
221unifdef-y += icmpv6.h
222unifdef-y += if_bridge.h
223unifdef-y += if_ec.h
224unifdef-y += if_eql.h
225unifdef-y += if_ether.h
226unifdef-y += if_frad.h
227unifdef-y += if_ltalk.h
228unifdef-y += if_pppox.h
229unifdef-y += if_shaper.h
230unifdef-y += if_tr.h
231unifdef-y += if_tun.h
232unifdef-y += if_vlan.h
233unifdef-y += if_wanpipe.h
234unifdef-y += igmp.h
235unifdef-y += inet_diag.h
236unifdef-y += in.h
237unifdef-y += inotify.h
238unifdef-y += input.h
239unifdef-y += ipc.h
240unifdef-y += ipmi.h
241unifdef-y += ipv6.h
242unifdef-y += ipv6_route.h
243unifdef-y += isdn.h
244unifdef-y += isdnif.h
245unifdef-y += isdn_ppp.h
246unifdef-y += isicom.h
247unifdef-y += jbd.h
248unifdef-y += joystick.h
249unifdef-y += kdev_t.h
250unifdef-y += kd.h
251unifdef-y += kernelcapi.h
252unifdef-y += kernel.h
253unifdef-y += keyboard.h
254unifdef-y += llc.h
255unifdef-y += loop.h
256unifdef-y += lp.h
257unifdef-y += mempolicy.h
258unifdef-y += mii.h
259unifdef-y += mman.h
260unifdef-y += mroute.h
261unifdef-y += msdos_fs.h
262unifdef-y += msg.h
263unifdef-y += nbd.h
264unifdef-y += ncp_fs.h
265unifdef-y += ncp.h
266unifdef-y += ncp_mount.h
267unifdef-y += netdevice.h
268unifdef-y += netfilter_bridge.h
269unifdef-y += netfilter_decnet.h
270unifdef-y += netfilter.h
271unifdef-y += netfilter_ipv4.h
272unifdef-y += netfilter_ipv6.h
273unifdef-y += net.h
274unifdef-y += netlink.h
275unifdef-y += nfs3.h
276unifdef-y += nfs4.h
277unifdef-y += nfsacl.h
278unifdef-y += nfs_fs.h
279unifdef-y += nfs.h
280unifdef-y += nfs_idmap.h
281unifdef-y += n_r3964.h
282unifdef-y += nubus.h
283unifdef-y += nvram.h
284unifdef-y += parport.h
285unifdef-y += patchkey.h
286unifdef-y += pci.h
287unifdef-y += pktcdvd.h
288unifdef-y += pmu.h
289unifdef-y += poll.h
290unifdef-y += ppp_defs.h
291unifdef-y += ppp-comp.h
292unifdef-y += ptrace.h
293unifdef-y += qnx4_fs.h
294unifdef-y += quota.h
295unifdef-y += random.h
296unifdef-y += reboot.h
297unifdef-y += reiserfs_fs.h
298unifdef-y += reiserfs_xattr.h
299unifdef-y += romfs_fs.h
300unifdef-y += route.h
301unifdef-y += rtc.h
302unifdef-y += rtnetlink.h
303unifdef-y += scc.h
304unifdef-y += sched.h
305unifdef-y += sdla.h
306unifdef-y += selinux_netlink.h
307unifdef-y += sem.h
308unifdef-y += serial_core.h
309unifdef-y += serial.h
310unifdef-y += serio.h
311unifdef-y += shm.h
312unifdef-y += signal.h
313unifdef-y += smb_fs.h
314unifdef-y += smb.h
315unifdef-y += smb_mount.h
316unifdef-y += socket.h
317unifdef-y += sonet.h
318unifdef-y += sonypi.h
319unifdef-y += soundcard.h
320unifdef-y += stat.h
321unifdef-y += stddef.h
322unifdef-y += sysctl.h
323unifdef-y += tcp.h
324unifdef-y += time.h
325unifdef-y += timex.h
326unifdef-y += tty.h
327unifdef-y += types.h
328unifdef-y += udf_fs_i.h
329unifdef-y += udp.h
330unifdef-y += uinput.h
331unifdef-y += uio.h
332unifdef-y += unistd.h
333unifdef-y += usb_ch9.h
334unifdef-y += usbdevice_fs.h
335unifdef-y += user.h
336unifdef-y += videodev2.h
337unifdef-y += videodev.h
338unifdef-y += wait.h
339unifdef-y += wanrouter.h
340unifdef-y += watchdog.h
341unifdef-y += xfrm.h
342unifdef-y += zftape.h
343
344objhdr-y += version.h
diff --git a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h
index c35833824e11..2ed2fd855133 100644
--- a/include/linux/ac97_codec.h
+++ b/include/linux/ac97_codec.h
@@ -259,7 +259,7 @@ struct ac97_codec {
259 int type; 259 int type;
260 u32 model; 260 u32 model;
261 261
262 int modem:1; 262 unsigned int modem:1;
263 263
264 struct ac97_ops *codec_ops; 264 struct ac97_ops *codec_ops;
265 265
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 3d54fbcf969e..e86bae7324d2 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -121,13 +121,17 @@ struct vfsmount;
121struct super_block; 121struct super_block;
122extern void acct_auto_close_mnt(struct vfsmount *m); 122extern void acct_auto_close_mnt(struct vfsmount *m);
123extern void acct_auto_close(struct super_block *sb); 123extern void acct_auto_close(struct super_block *sb);
124extern void acct_process(long exitcode); 124extern void acct_init_pacct(struct pacct_struct *pacct);
125extern void acct_collect(long exitcode, int group_dead);
126extern void acct_process(void);
125extern void acct_update_integrals(struct task_struct *tsk); 127extern void acct_update_integrals(struct task_struct *tsk);
126extern void acct_clear_integrals(struct task_struct *tsk); 128extern void acct_clear_integrals(struct task_struct *tsk);
127#else 129#else
128#define acct_auto_close_mnt(x) do { } while (0) 130#define acct_auto_close_mnt(x) do { } while (0)
129#define acct_auto_close(x) do { } while (0) 131#define acct_auto_close(x) do { } while (0)
130#define acct_process(x) do { } while (0) 132#define acct_init_pacct(x) do { } while (0)
133#define acct_collect(x,y) do { } while (0)
134#define acct_process() do { } while (0)
131#define acct_update_integrals(x) do { } while (0) 135#define acct_update_integrals(x) do { } while (0)
132#define acct_clear_integrals(task) do { } while (0) 136#define acct_clear_integrals(task) do { } while (0)
133#endif 137#endif
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 90d6df1551ed..88b5dfd8ee12 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -528,12 +528,18 @@ static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
528 528
529#ifdef CONFIG_ACPI_NUMA 529#ifdef CONFIG_ACPI_NUMA
530int acpi_get_pxm(acpi_handle handle); 530int acpi_get_pxm(acpi_handle handle);
531int acpi_get_node(acpi_handle *handle);
531#else 532#else
532static inline int acpi_get_pxm(acpi_handle handle) 533static inline int acpi_get_pxm(acpi_handle handle)
533{ 534{
534 return 0; 535 return 0;
535} 536}
537static inline int acpi_get_node(acpi_handle *handle)
538{
539 return 0;
540}
536#endif 541#endif
542extern int acpi_paddr_to_node(u64 start_addr, u64 size);
537 543
538extern int pnpacpi_disabled; 544extern int pnpacpi_disabled;
539 545
diff --git a/include/linux/adfs_fs.h b/include/linux/adfs_fs.h
index 4a5d50c2bdbf..ef788c2085a1 100644
--- a/include/linux/adfs_fs.h
+++ b/include/linux/adfs_fs.h
@@ -2,6 +2,7 @@
2#define _ADFS_FS_H 2#define _ADFS_FS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/magic.h>
5 6
6/* 7/*
7 * Disc Record at disc address 0xc00 8 * Disc Record at disc address 0xc00
@@ -38,7 +39,6 @@ struct adfs_discrecord {
38#define ADFS_DR_OFFSET (0x1c0) 39#define ADFS_DR_OFFSET (0x1c0)
39#define ADFS_DR_SIZE 60 40#define ADFS_DR_SIZE 60
40#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) 41#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3)
41#define ADFS_SUPER_MAGIC 0xadf5
42 42
43#ifdef __KERNEL__ 43#ifdef __KERNEL__
44#include <linux/adfs_fs_i.h> 44#include <linux/adfs_fs_i.h>
diff --git a/include/linux/aer.h b/include/linux/aer.h
new file mode 100644
index 000000000000..402e178b38eb
--- /dev/null
+++ b/include/linux/aer.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2006 Intel Corp.
3 * Tom Long Nguyen (tom.l.nguyen@intel.com)
4 * Zhang Yanmin (yanmin.zhang@intel.com)
5 */
6
7#ifndef _AER_H_
8#define _AER_H_
9
10#if defined(CONFIG_PCIEAER)
11/* pci-e port driver needs this function to enable aer */
12extern int pci_enable_pcie_error_reporting(struct pci_dev *dev);
13extern int pci_find_aer_capability(struct pci_dev *dev);
14extern int pci_disable_pcie_error_reporting(struct pci_dev *dev);
15extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
16#else
17#define pci_enable_pcie_error_reporting(dev) do { } while (0)
18#define pci_find_aer_capability(dev) do { } while (0)
19#define pci_disable_pcie_error_reporting(dev) do { } while (0)
20#define pci_cleanup_aer_uncorrect_error_status(dev) do { } while (0)
21#endif
22
23#endif //_AER_H_
24
diff --git a/include/linux/affs_fs.h b/include/linux/affs_fs.h
deleted file mode 100644
index c57b5ee87d55..000000000000
--- a/include/linux/affs_fs.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _AFFS_FS_H
2#define _AFFS_FS_H
3/*
4 * The affs filesystem constants/structures
5 */
6#define AFFS_SUPER_MAGIC 0xadff
7#endif
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 3671af869696..d89441907024 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -40,6 +40,8 @@ enum {
40 ATA_MAX_DEVICES = 2, /* per bus/port */ 40 ATA_MAX_DEVICES = 2, /* per bus/port */
41 ATA_MAX_PRD = 256, /* we could make these 256/256 */ 41 ATA_MAX_PRD = 256, /* we could make these 256/256 */
42 ATA_SECT_SIZE = 512, 42 ATA_SECT_SIZE = 512,
43 ATA_MAX_SECTORS = 256,
44 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */
43 45
44 ATA_ID_WORDS = 256, 46 ATA_ID_WORDS = 256,
45 ATA_ID_SERNO_OFS = 10, 47 ATA_ID_SERNO_OFS = 10,
@@ -168,12 +170,16 @@ enum {
168 XFER_UDMA_2 = 0x42, 170 XFER_UDMA_2 = 0x42,
169 XFER_UDMA_1 = 0x41, 171 XFER_UDMA_1 = 0x41,
170 XFER_UDMA_0 = 0x40, 172 XFER_UDMA_0 = 0x40,
173 XFER_MW_DMA_4 = 0x24, /* CFA only */
174 XFER_MW_DMA_3 = 0x23, /* CFA only */
171 XFER_MW_DMA_2 = 0x22, 175 XFER_MW_DMA_2 = 0x22,
172 XFER_MW_DMA_1 = 0x21, 176 XFER_MW_DMA_1 = 0x21,
173 XFER_MW_DMA_0 = 0x20, 177 XFER_MW_DMA_0 = 0x20,
174 XFER_SW_DMA_2 = 0x12, 178 XFER_SW_DMA_2 = 0x12,
175 XFER_SW_DMA_1 = 0x11, 179 XFER_SW_DMA_1 = 0x11,
176 XFER_SW_DMA_0 = 0x10, 180 XFER_SW_DMA_0 = 0x10,
181 XFER_PIO_6 = 0x0E, /* CFA only */
182 XFER_PIO_5 = 0x0D, /* CFA only */
177 XFER_PIO_4 = 0x0C, 183 XFER_PIO_4 = 0x0C,
178 XFER_PIO_3 = 0x0B, 184 XFER_PIO_3 = 0x0B,
179 XFER_PIO_2 = 0x0A, 185 XFER_PIO_2 = 0x0A,
@@ -272,7 +278,6 @@ struct ata_taskfile {
272}; 278};
273 279
274#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 280#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
275#define ata_id_is_cfa(id) ((id)[0] == 0x848A)
276#define ata_id_is_sata(id) ((id)[93] == 0) 281#define ata_id_is_sata(id) ((id)[93] == 0)
277#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) 282#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
278#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) 283#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
@@ -304,6 +309,9 @@ static inline unsigned int ata_id_major_version(const u16 *id)
304{ 309{
305 unsigned int mver; 310 unsigned int mver;
306 311
312 if (id[ATA_ID_MAJOR_VER] == 0xFFFF)
313 return 0;
314
307 for (mver = 14; mver >= 1; mver--) 315 for (mver = 14; mver >= 1; mver--)
308 if (id[ATA_ID_MAJOR_VER] & (1 << mver)) 316 if (id[ATA_ID_MAJOR_VER] & (1 << mver))
309 break; 317 break;
@@ -312,8 +320,8 @@ static inline unsigned int ata_id_major_version(const u16 *id)
312 320
313static inline int ata_id_current_chs_valid(const u16 *id) 321static inline int ata_id_current_chs_valid(const u16 *id)
314{ 322{
315 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 323 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
316 has not been issued to the device then the values of 324 has not been issued to the device then the values of
317 id[54] to id[56] are vendor specific. */ 325 id[54] to id[56] are vendor specific. */
318 return (id[53] & 0x01) && /* Current translation valid */ 326 return (id[53] & 0x01) && /* Current translation valid */
319 id[54] && /* cylinders in current translation */ 327 id[54] && /* cylinders in current translation */
@@ -322,6 +330,18 @@ static inline int ata_id_current_chs_valid(const u16 *id)
322 id[56]; /* sectors in current translation */ 330 id[56]; /* sectors in current translation */
323} 331}
324 332
333static inline int ata_id_is_cfa(const u16 *id)
334{
335 u16 v = id[0];
336 if (v == 0x848A) /* Standard CF */
337 return 1;
338 /* Could be CF hiding as standard ATA */
339 if (ata_id_major_version(id) >= 3 && id[82] != 0xFFFF &&
340 (id[82] & ( 1 << 2)))
341 return 1;
342 return 0;
343}
344
325static inline int atapi_cdb_len(const u16 *dev_id) 345static inline int atapi_cdb_len(const u16 *dev_id)
326{ 346{
327 u16 tmp = dev_id[0] & 0x3; 347 u16 tmp = dev_id[0] & 0x3;
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index 6ba3aa8a81f4..75b8baca08f3 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -88,15 +88,7 @@ static inline struct atalk_sock *at_sk(struct sock *sk)
88#include <asm/byteorder.h> 88#include <asm/byteorder.h>
89 89
90struct ddpehdr { 90struct ddpehdr {
91#ifdef __LITTLE_ENDIAN_BITFIELD 91 __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */
92 __u16 deh_len:10,
93 deh_hops:4,
94 deh_pad:2;
95#else
96 __u16 deh_pad:2,
97 deh_hops:4,
98 deh_len:10;
99#endif
100 __be16 deh_sum; 92 __be16 deh_sum;
101 __be16 deh_dnet; 93 __be16 deh_dnet;
102 __be16 deh_snet; 94 __be16 deh_snet;
@@ -112,36 +104,6 @@ static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
112 return (struct ddpehdr *)skb->h.raw; 104 return (struct ddpehdr *)skb->h.raw;
113} 105}
114 106
115/*
116 * Don't drop the struct into the struct above. You'll get some
117 * surprise padding.
118 */
119struct ddpebits {
120#ifdef __LITTLE_ENDIAN_BITFIELD
121 __u16 deh_len:10,
122 deh_hops:4,
123 deh_pad:2;
124#else
125 __u16 deh_pad:2,
126 deh_hops:4,
127 deh_len:10;
128#endif
129};
130
131/* Short form header */
132struct ddpshdr {
133#ifdef __LITTLE_ENDIAN_BITFIELD
134 __u16 dsh_len:10,
135 dsh_pad:6;
136#else
137 __u16 dsh_pad:6,
138 dsh_len:10;
139#endif
140 __u8 dsh_dport;
141 __u8 dsh_sport;
142 /* And netatalk apps expect to stick the type in themselves */
143};
144
145/* AppleTalk AARP headers */ 107/* AppleTalk AARP headers */
146struct elapaarp { 108struct elapaarp {
147 __be16 hw_type; 109 __be16 hw_type;
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 1eb238affb12..2096e5c72827 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -209,6 +209,7 @@ struct atm_cirange {
209 209
210#ifdef __KERNEL__ 210#ifdef __KERNEL__
211 211
212#include <linux/device.h>
212#include <linux/wait.h> /* wait_queue_head_t */ 213#include <linux/wait.h> /* wait_queue_head_t */
213#include <linux/time.h> /* struct timeval */ 214#include <linux/time.h> /* struct timeval */
214#include <linux/net.h> 215#include <linux/net.h>
@@ -358,6 +359,7 @@ struct atm_dev {
358 struct proc_dir_entry *proc_entry; /* proc entry */ 359 struct proc_dir_entry *proc_entry; /* proc entry */
359 char *proc_name; /* proc entry name */ 360 char *proc_name; /* proc entry name */
360#endif 361#endif
362 struct class_device class_dev; /* sysfs class device */
361 struct list_head dev_list; /* linkage */ 363 struct list_head dev_list; /* linkage */
362}; 364};
363 365
@@ -459,7 +461,7 @@ static inline void atm_dev_put(struct atm_dev *dev)
459 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags)); 461 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));
460 if (dev->ops->dev_close) 462 if (dev->ops->dev_close)
461 dev->ops->dev_close(dev); 463 dev->ops->dev_close(dev);
462 kfree(dev); 464 class_device_put(&dev->class_dev);
463 } 465 }
464} 466}
465 467
diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h
index f267f2442766..6f5a1bab8f50 100644
--- a/include/linux/atmlec.h
+++ b/include/linux/atmlec.h
@@ -1,9 +1,7 @@
1/* 1/*
2 * 2 * ATM Lan Emulation Daemon driver interface
3 * ATM Lan Emulation Daemon vs. driver interface
4 *
5 * mkiiskila@yahoo.com
6 * 3 *
4 * Marko Kiiskila <mkiiskila@yahoo.com>
7 */ 5 */
8 6
9#ifndef _ATMLEC_H_ 7#ifndef _ATMLEC_H_
@@ -13,76 +11,87 @@
13#include <linux/atmioc.h> 11#include <linux/atmioc.h>
14#include <linux/atm.h> 12#include <linux/atm.h>
15#include <linux/if_ether.h> 13#include <linux/if_ether.h>
14
16/* ATM lec daemon control socket */ 15/* ATM lec daemon control socket */
17#define ATMLEC_CTRL _IO('a',ATMIOC_LANE) 16#define ATMLEC_CTRL _IO('a', ATMIOC_LANE)
18#define ATMLEC_DATA _IO('a',ATMIOC_LANE+1) 17#define ATMLEC_DATA _IO('a', ATMIOC_LANE+1)
19#define ATMLEC_MCAST _IO('a',ATMIOC_LANE+2) 18#define ATMLEC_MCAST _IO('a', ATMIOC_LANE+2)
20 19
21/* Maximum number of LEC interfaces (tweakable) */ 20/* Maximum number of LEC interfaces (tweakable) */
22#define MAX_LEC_ITF 48 21#define MAX_LEC_ITF 48
23 22
24/* From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring. 23/*
24 * From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
25 * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for 25 * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for
26 * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS. 26 * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS.
27 */ 27 */
28#define NUM_TR_DEVS 8 28#define NUM_TR_DEVS 8
29 29
30typedef enum { 30typedef enum {
31 l_set_mac_addr, l_del_mac_addr, 31 l_set_mac_addr,
32 l_svc_setup, 32 l_del_mac_addr,
33 l_addr_delete, l_topology_change, 33 l_svc_setup,
34 l_flush_complete, l_arp_update, 34 l_addr_delete,
35 l_narp_req, /* LANE2 mandates the use of this */ 35 l_topology_change,
36 l_config, l_flush_tran_id, 36 l_flush_complete,
37 l_set_lecid, l_arp_xmt, 37 l_arp_update,
38 l_rdesc_arp_xmt, 38 l_narp_req, /* LANE2 mandates the use of this */
39 l_associate_req, 39 l_config,
40 l_should_bridge /* should we bridge this MAC? */ 40 l_flush_tran_id,
41 l_set_lecid,
42 l_arp_xmt,
43 l_rdesc_arp_xmt,
44 l_associate_req,
45 l_should_bridge /* should we bridge this MAC? */
41} atmlec_msg_type; 46} atmlec_msg_type;
42 47
43#define ATMLEC_MSG_TYPE_MAX l_should_bridge 48#define ATMLEC_MSG_TYPE_MAX l_should_bridge
44 49
45struct atmlec_config_msg { 50struct atmlec_config_msg {
46 unsigned int maximum_unknown_frame_count; 51 unsigned int maximum_unknown_frame_count;
47 unsigned int max_unknown_frame_time; 52 unsigned int max_unknown_frame_time;
48 unsigned short max_retry_count; 53 unsigned short max_retry_count;
49 unsigned int aging_time; 54 unsigned int aging_time;
50 unsigned int forward_delay_time; 55 unsigned int forward_delay_time;
51 unsigned int arp_response_time; 56 unsigned int arp_response_time;
52 unsigned int flush_timeout; 57 unsigned int flush_timeout;
53 unsigned int path_switching_delay; 58 unsigned int path_switching_delay;
54 unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */ 59 unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */
55 int mtu; 60 int mtu;
56 int is_proxy; 61 int is_proxy;
57}; 62};
58 63
59struct atmlec_msg { 64struct atmlec_msg {
60 atmlec_msg_type type; 65 atmlec_msg_type type;
61 int sizeoftlvs; /* LANE2: if != 0, tlvs follow */ 66 int sizeoftlvs; /* LANE2: if != 0, tlvs follow */
62 union { 67 union {
63 struct { 68 struct {
64 unsigned char mac_addr[ETH_ALEN]; 69 unsigned char mac_addr[ETH_ALEN];
65 unsigned char atm_addr[ATM_ESA_LEN]; 70 unsigned char atm_addr[ATM_ESA_LEN];
66 unsigned int flag;/* Topology_change flag, 71 unsigned int flag; /*
67 remoteflag, permanent flag, 72 * Topology_change flag,
68 lecid, transaction id */ 73 * remoteflag, permanent flag,
69 unsigned int targetless_le_arp; /* LANE2 */ 74 * lecid, transaction id
70 unsigned int no_source_le_narp; /* LANE2 */ 75 */
71 } normal; 76 unsigned int targetless_le_arp; /* LANE2 */
72 struct atmlec_config_msg config; 77 unsigned int no_source_le_narp; /* LANE2 */
73 struct { 78 } normal;
74 uint16_t lec_id; /* requestor lec_id */ 79 struct atmlec_config_msg config;
75 uint32_t tran_id; /* transaction id */ 80 struct {
76 unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */ 81 uint16_t lec_id; /* requestor lec_id */
77 unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */ 82 uint32_t tran_id; /* transaction id */
78 } proxy; 83 unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */
79 /* For mapping LE_ARP requests to responses. Filled by */ 84 unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */
80 } content; /* zeppelin, returned by kernel. Used only when proxying */ 85 } proxy; /*
86 * For mapping LE_ARP requests to responses. Filled by
87 * zeppelin, returned by kernel. Used only when proxying
88 */
89 } content;
81} __ATM_API_ALIGN; 90} __ATM_API_ALIGN;
82 91
83struct atmlec_ioc { 92struct atmlec_ioc {
84 int dev_num; 93 int dev_num;
85 unsigned char atm_addr[ATM_ESA_LEN]; 94 unsigned char atm_addr[ATM_ESA_LEN];
86 unsigned char receive; /* 1= receive vcc, 0 = send vcc */ 95 unsigned char receive; /* 1= receive vcc, 0 = send vcc */
87}; 96};
88#endif /* _ATMLEC_H_ */ 97#endif /* _ATMLEC_H_ */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index e051ff9c5b50..c3aa09751814 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -95,6 +95,11 @@
95#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */ 95#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */
96#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */ 96#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */
97#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */ 97#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */
98#define AUDIT_MAC_UNLBL_ALLOW 1406 /* NetLabel: allow unlabeled traffic */
99#define AUDIT_MAC_CIPSOV4_ADD 1407 /* NetLabel: add CIPSOv4 DOI entry */
100#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
101#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
102#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
98 103
99#define AUDIT_FIRST_KERN_ANOM_MSG 1700 104#define AUDIT_FIRST_KERN_ANOM_MSG 1700
100#define AUDIT_LAST_KERN_ANOM_MSG 1799 105#define AUDIT_LAST_KERN_ANOM_MSG 1799
@@ -122,10 +127,21 @@
122/* Rule structure sizes -- if these change, different AUDIT_ADD and 127/* Rule structure sizes -- if these change, different AUDIT_ADD and
123 * AUDIT_LIST commands must be implemented. */ 128 * AUDIT_LIST commands must be implemented. */
124#define AUDIT_MAX_FIELDS 64 129#define AUDIT_MAX_FIELDS 64
130#define AUDIT_MAX_KEY_LEN 32
125#define AUDIT_BITMASK_SIZE 64 131#define AUDIT_BITMASK_SIZE 64
126#define AUDIT_WORD(nr) ((__u32)((nr)/32)) 132#define AUDIT_WORD(nr) ((__u32)((nr)/32))
127#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) 133#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32))
128 134
135#define AUDIT_SYSCALL_CLASSES 16
136#define AUDIT_CLASS_DIR_WRITE 0
137#define AUDIT_CLASS_DIR_WRITE_32 1
138#define AUDIT_CLASS_CHATTR 2
139#define AUDIT_CLASS_CHATTR_32 3
140#define AUDIT_CLASS_READ 4
141#define AUDIT_CLASS_READ_32 5
142#define AUDIT_CLASS_WRITE 6
143#define AUDIT_CLASS_WRITE_32 7
144
129/* This bitmask is used to validate user input. It represents all bits that 145/* This bitmask is used to validate user input. It represents all bits that
130 * are currently used in an audit field constant understood by the kernel. 146 * are currently used in an audit field constant understood by the kernel.
131 * If you are adding a new #define AUDIT_<whatever>, please ensure that 147 * If you are adding a new #define AUDIT_<whatever>, please ensure that
@@ -150,12 +166,17 @@
150#define AUDIT_PERS 10 166#define AUDIT_PERS 10
151#define AUDIT_ARCH 11 167#define AUDIT_ARCH 11
152#define AUDIT_MSGTYPE 12 168#define AUDIT_MSGTYPE 12
153#define AUDIT_SE_USER 13 /* security label user */ 169#define AUDIT_SUBJ_USER 13 /* security label user */
154#define AUDIT_SE_ROLE 14 /* security label role */ 170#define AUDIT_SUBJ_ROLE 14 /* security label role */
155#define AUDIT_SE_TYPE 15 /* security label type */ 171#define AUDIT_SUBJ_TYPE 15 /* security label type */
156#define AUDIT_SE_SEN 16 /* security label sensitivity label */ 172#define AUDIT_SUBJ_SEN 16 /* security label sensitivity label */
157#define AUDIT_SE_CLR 17 /* security label clearance label */ 173#define AUDIT_SUBJ_CLR 17 /* security label clearance label */
158#define AUDIT_PPID 18 174#define AUDIT_PPID 18
175#define AUDIT_OBJ_USER 19
176#define AUDIT_OBJ_ROLE 20
177#define AUDIT_OBJ_TYPE 21
178#define AUDIT_OBJ_LEV_LOW 22
179#define AUDIT_OBJ_LEV_HIGH 23
159 180
160 /* These are ONLY useful when checking 181 /* These are ONLY useful when checking
161 * at syscall exit time (AUDIT_AT_EXIT). */ 182 * at syscall exit time (AUDIT_AT_EXIT). */
@@ -165,12 +186,15 @@
165#define AUDIT_EXIT 103 186#define AUDIT_EXIT 103
166#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */ 187#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */
167#define AUDIT_WATCH 105 188#define AUDIT_WATCH 105
189#define AUDIT_PERM 106
168 190
169#define AUDIT_ARG0 200 191#define AUDIT_ARG0 200
170#define AUDIT_ARG1 (AUDIT_ARG0+1) 192#define AUDIT_ARG1 (AUDIT_ARG0+1)
171#define AUDIT_ARG2 (AUDIT_ARG0+2) 193#define AUDIT_ARG2 (AUDIT_ARG0+2)
172#define AUDIT_ARG3 (AUDIT_ARG0+3) 194#define AUDIT_ARG3 (AUDIT_ARG0+3)
173 195
196#define AUDIT_FILTERKEY 210
197
174#define AUDIT_NEGATE 0x80000000 198#define AUDIT_NEGATE 0x80000000
175 199
176/* These are the supported operators. 200/* These are the supported operators.
@@ -238,6 +262,11 @@
238#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) 262#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE)
239#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 263#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
240 264
265#define AUDIT_PERM_EXEC 1
266#define AUDIT_PERM_WRITE 2
267#define AUDIT_PERM_READ 4
268#define AUDIT_PERM_ATTR 8
269
241struct audit_status { 270struct audit_status {
242 __u32 mask; /* Bit mask for valid entries */ 271 __u32 mask; /* Bit mask for valid entries */
243 __u32 enabled; /* 1 = enabled, 0 = disabled */ 272 __u32 enabled; /* 1 = enabled, 0 = disabled */
@@ -299,6 +328,8 @@ struct mqstat;
299#define AUDITSC_SUCCESS 1 328#define AUDITSC_SUCCESS 1
300#define AUDITSC_FAILURE 2 329#define AUDITSC_FAILURE 2
301#define AUDITSC_RESULT(x) ( ((long)(x))<0?AUDITSC_FAILURE:AUDITSC_SUCCESS ) 330#define AUDITSC_RESULT(x) ( ((long)(x))<0?AUDITSC_FAILURE:AUDITSC_SUCCESS )
331extern int __init audit_register_class(int class, unsigned *list);
332extern int audit_classify_syscall(int abi, unsigned syscall);
302#ifdef CONFIG_AUDITSYSCALL 333#ifdef CONFIG_AUDITSYSCALL
303/* These are defined in auditsc.c */ 334/* These are defined in auditsc.c */
304 /* Public API */ 335 /* Public API */
@@ -312,21 +343,31 @@ extern void __audit_getname(const char *name);
312extern void audit_putname(const char *name); 343extern void audit_putname(const char *name);
313extern void __audit_inode(const char *name, const struct inode *inode); 344extern void __audit_inode(const char *name, const struct inode *inode);
314extern void __audit_inode_child(const char *dname, const struct inode *inode, 345extern void __audit_inode_child(const char *dname, const struct inode *inode,
315 unsigned long pino); 346 const struct inode *parent);
347extern void __audit_inode_update(const struct inode *inode);
348static inline int audit_dummy_context(void)
349{
350 void *p = current->audit_context;
351 return !p || *(int *)p;
352}
316static inline void audit_getname(const char *name) 353static inline void audit_getname(const char *name)
317{ 354{
318 if (unlikely(current->audit_context)) 355 if (unlikely(!audit_dummy_context()))
319 __audit_getname(name); 356 __audit_getname(name);
320} 357}
321static inline void audit_inode(const char *name, const struct inode *inode) { 358static inline void audit_inode(const char *name, const struct inode *inode) {
322 if (unlikely(current->audit_context)) 359 if (unlikely(!audit_dummy_context()))
323 __audit_inode(name, inode); 360 __audit_inode(name, inode);
324} 361}
325static inline void audit_inode_child(const char *dname, 362static inline void audit_inode_child(const char *dname,
326 const struct inode *inode, 363 const struct inode *inode,
327 unsigned long pino) { 364 const struct inode *parent) {
328 if (unlikely(current->audit_context)) 365 if (unlikely(!audit_dummy_context()))
329 __audit_inode_child(dname, inode, pino); 366 __audit_inode_child(dname, inode, parent);
367}
368static inline void audit_inode_update(const struct inode *inode) {
369 if (unlikely(!audit_dummy_context()))
370 __audit_inode_update(inode);
330} 371}
331 372
332 /* Private API (for audit.c only) */ 373 /* Private API (for audit.c only) */
@@ -350,57 +391,61 @@ extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
350 391
351static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) 392static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
352{ 393{
353 if (unlikely(current->audit_context)) 394 if (unlikely(!audit_dummy_context()))
354 return __audit_ipc_obj(ipcp); 395 return __audit_ipc_obj(ipcp);
355 return 0; 396 return 0;
356} 397}
357static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 398static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
358{ 399{
359 if (unlikely(current->audit_context)) 400 if (unlikely(!audit_dummy_context()))
360 return __audit_ipc_set_perm(qbytes, uid, gid, mode); 401 return __audit_ipc_set_perm(qbytes, uid, gid, mode);
361 return 0; 402 return 0;
362} 403}
363static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr) 404static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr)
364{ 405{
365 if (unlikely(current->audit_context)) 406 if (unlikely(!audit_dummy_context()))
366 return __audit_mq_open(oflag, mode, u_attr); 407 return __audit_mq_open(oflag, mode, u_attr);
367 return 0; 408 return 0;
368} 409}
369static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout) 410static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout)
370{ 411{
371 if (unlikely(current->audit_context)) 412 if (unlikely(!audit_dummy_context()))
372 return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout); 413 return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout);
373 return 0; 414 return 0;
374} 415}
375static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout) 416static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout)
376{ 417{
377 if (unlikely(current->audit_context)) 418 if (unlikely(!audit_dummy_context()))
378 return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout); 419 return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout);
379 return 0; 420 return 0;
380} 421}
381static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification) 422static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification)
382{ 423{
383 if (unlikely(current->audit_context)) 424 if (unlikely(!audit_dummy_context()))
384 return __audit_mq_notify(mqdes, u_notification); 425 return __audit_mq_notify(mqdes, u_notification);
385 return 0; 426 return 0;
386} 427}
387static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) 428static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
388{ 429{
389 if (unlikely(current->audit_context)) 430 if (unlikely(!audit_dummy_context()))
390 return __audit_mq_getsetattr(mqdes, mqstat); 431 return __audit_mq_getsetattr(mqdes, mqstat);
391 return 0; 432 return 0;
392} 433}
434extern int audit_n_rules;
393#else 435#else
394#define audit_alloc(t) ({ 0; }) 436#define audit_alloc(t) ({ 0; })
395#define audit_free(t) do { ; } while (0) 437#define audit_free(t) do { ; } while (0)
396#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0) 438#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
397#define audit_syscall_exit(f,r) do { ; } while (0) 439#define audit_syscall_exit(f,r) do { ; } while (0)
440#define audit_dummy_context() 1
398#define audit_getname(n) do { ; } while (0) 441#define audit_getname(n) do { ; } while (0)
399#define audit_putname(n) do { ; } while (0) 442#define audit_putname(n) do { ; } while (0)
400#define __audit_inode(n,i) do { ; } while (0) 443#define __audit_inode(n,i) do { ; } while (0)
401#define __audit_inode_child(d,i,p) do { ; } while (0) 444#define __audit_inode_child(d,i,p) do { ; } while (0)
445#define __audit_inode_update(i) do { ; } while (0)
402#define audit_inode(n,i) do { ; } while (0) 446#define audit_inode(n,i) do { ; } while (0)
403#define audit_inode_child(d,i,p) do { ; } while (0) 447#define audit_inode_child(d,i,p) do { ; } while (0)
448#define audit_inode_update(i) do { ; } while (0)
404#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0) 449#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
405#define audit_get_loginuid(c) ({ -1; }) 450#define audit_get_loginuid(c) ({ -1; })
406#define audit_ipc_obj(i) ({ 0; }) 451#define audit_ipc_obj(i) ({ 0; })
@@ -415,6 +460,7 @@ static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
415#define audit_mq_timedreceive(d,l,p,t) ({ 0; }) 460#define audit_mq_timedreceive(d,l,p,t) ({ 0; })
416#define audit_mq_notify(d,n) ({ 0; }) 461#define audit_mq_notify(d,n) ({ 0; })
417#define audit_mq_getsetattr(d,s) ({ 0; }) 462#define audit_mq_getsetattr(d,s) ({ 0; })
463#define audit_n_rules 0
418#endif 464#endif
419 465
420#ifdef CONFIG_AUDIT 466#ifdef CONFIG_AUDIT
diff --git a/include/linux/bio.h b/include/linux/bio.h
index b60ffe32cd21..76bdaeab6f62 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -47,7 +47,7 @@
47#define BIO_BUG_ON 47#define BIO_BUG_ON
48#endif 48#endif
49 49
50#define BIO_MAX_PAGES (256) 50#define BIO_MAX_PAGES 256
51#define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT) 51#define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT)
52#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) 52#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
53 53
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index d9ed27969855..dcc5de7cc487 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -24,6 +24,9 @@
24 * The available bitmap operations and their rough meaning in the 24 * The available bitmap operations and their rough meaning in the
25 * case that the bitmap is a single unsigned long are thus: 25 * case that the bitmap is a single unsigned long are thus:
26 * 26 *
27 * Note that nbits should be always a compile time evaluable constant.
28 * Otherwise many inlines will generate horrible code.
29 *
27 * bitmap_zero(dst, nbits) *dst = 0UL 30 * bitmap_zero(dst, nbits) *dst = 0UL
28 * bitmap_fill(dst, nbits) *dst = ~0UL 31 * bitmap_fill(dst, nbits) *dst = ~0UL
29 * bitmap_copy(dst, src, nbits) *dst = *src 32 * bitmap_copy(dst, src, nbits) *dst = *src
@@ -244,6 +247,8 @@ static inline int bitmap_full(const unsigned long *src, int nbits)
244 247
245static inline int bitmap_weight(const unsigned long *src, int nbits) 248static inline int bitmap_weight(const unsigned long *src, int nbits)
246{ 249{
250 if (nbits <= BITS_PER_LONG)
251 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
247 return __bitmap_weight(src, nbits); 252 return __bitmap_weight(src, nbits);
248} 253}
249 254
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index aafe82788b4e..cfde8b3ee919 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -417,9 +417,9 @@ struct request_queue
417 unsigned int sg_timeout; 417 unsigned int sg_timeout;
418 unsigned int sg_reserved_size; 418 unsigned int sg_reserved_size;
419 int node; 419 int node;
420 420#ifdef CONFIG_BLK_DEV_IO_TRACE
421 struct blk_trace *blk_trace; 421 struct blk_trace *blk_trace;
422 422#endif
423 /* 423 /*
424 * reserved for flush operations 424 * reserved for flush operations
425 */ 425 */
@@ -746,6 +746,9 @@ extern void blk_queue_free_tags(request_queue_t *);
746extern int blk_queue_resize_tags(request_queue_t *, int); 746extern int blk_queue_resize_tags(request_queue_t *, int);
747extern void blk_queue_invalidate_tags(request_queue_t *); 747extern void blk_queue_invalidate_tags(request_queue_t *);
748extern long blk_congestion_wait(int rw, long timeout); 748extern long blk_congestion_wait(int rw, long timeout);
749extern struct blk_queue_tag *blk_init_tags(int);
750extern void blk_free_tags(struct blk_queue_tag *);
751extern void blk_congestion_end(int rw);
749 752
750extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *); 753extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *);
751extern int blkdev_issue_flush(struct block_device *, sector_t *); 754extern int blkdev_issue_flush(struct block_device *, sector_t *);
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index a7e8cef73d15..7520cc1ff9e2 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -11,7 +11,7 @@ enum blktrace_cat {
11 BLK_TC_READ = 1 << 0, /* reads */ 11 BLK_TC_READ = 1 << 0, /* reads */
12 BLK_TC_WRITE = 1 << 1, /* writes */ 12 BLK_TC_WRITE = 1 << 1, /* writes */
13 BLK_TC_BARRIER = 1 << 2, /* barrier */ 13 BLK_TC_BARRIER = 1 << 2, /* barrier */
14 BLK_TC_SYNC = 1 << 3, /* barrier */ 14 BLK_TC_SYNC = 1 << 3, /* sync IO */
15 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ 15 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */
16 BLK_TC_REQUEUE = 1 << 5, /* requeueing */ 16 BLK_TC_REQUEUE = 1 << 5, /* requeueing */
17 BLK_TC_ISSUE = 1 << 6, /* issue */ 17 BLK_TC_ISSUE = 1 << 6, /* issue */
@@ -19,6 +19,7 @@ enum blktrace_cat {
19 BLK_TC_FS = 1 << 8, /* fs requests */ 19 BLK_TC_FS = 1 << 8, /* fs requests */
20 BLK_TC_PC = 1 << 9, /* pc requests */ 20 BLK_TC_PC = 1 << 9, /* pc requests */
21 BLK_TC_NOTIFY = 1 << 10, /* special message */ 21 BLK_TC_NOTIFY = 1 << 10, /* special message */
22 BLK_TC_AHEAD = 1 << 11, /* readahead */
22 23
23 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ 24 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */
24}; 25};
@@ -147,7 +148,7 @@ static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq,
147 u32 what) 148 u32 what)
148{ 149{
149 struct blk_trace *bt = q->blk_trace; 150 struct blk_trace *bt = q->blk_trace;
150 int rw = rq->flags & 0x07; 151 int rw = rq->flags & 0x03;
151 152
152 if (likely(!bt)) 153 if (likely(!bt))
153 return; 154 return;
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 22866fa2d960..31e9abb6d977 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -4,11 +4,8 @@
4#ifndef _LINUX_BOOTMEM_H 4#ifndef _LINUX_BOOTMEM_H
5#define _LINUX_BOOTMEM_H 5#define _LINUX_BOOTMEM_H
6 6
7#include <asm/pgtable.h>
8#include <asm/dma.h>
9#include <linux/cache.h>
10#include <linux/init.h>
11#include <linux/mmzone.h> 7#include <linux/mmzone.h>
8#include <asm/dma.h>
12 9
13/* 10/*
14 * simple boot-time physical memory area allocator. 11 * simple boot-time physical memory area allocator.
@@ -41,45 +38,64 @@ typedef struct bootmem_data {
41 struct list_head list; 38 struct list_head list;
42} bootmem_data_t; 39} bootmem_data_t;
43 40
44extern unsigned long __init bootmem_bootmap_pages (unsigned long); 41extern unsigned long bootmem_bootmap_pages(unsigned long);
45extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend); 42extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
46extern void __init free_bootmem (unsigned long addr, unsigned long size); 43extern void free_bootmem(unsigned long addr, unsigned long size);
47extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal); 44extern void *__alloc_bootmem(unsigned long size,
48extern void * __init __alloc_bootmem_nopanic (unsigned long size, unsigned long align, unsigned long goal); 45 unsigned long align,
49extern void * __init __alloc_bootmem_low(unsigned long size, 46 unsigned long goal);
50 unsigned long align, 47extern void *__alloc_bootmem_nopanic(unsigned long size,
51 unsigned long goal); 48 unsigned long align,
52extern void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, 49 unsigned long goal);
53 unsigned long size, 50extern void *__alloc_bootmem_low(unsigned long size,
54 unsigned long align, 51 unsigned long align,
55 unsigned long goal); 52 unsigned long goal);
56extern void * __init __alloc_bootmem_core(struct bootmem_data *bdata, 53extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
57 unsigned long size, unsigned long align, unsigned long goal, 54 unsigned long size,
58 unsigned long limit); 55 unsigned long align,
56 unsigned long goal);
57extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
58 unsigned long size,
59 unsigned long align,
60 unsigned long goal,
61 unsigned long limit);
62
59#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 63#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
60extern void __init reserve_bootmem (unsigned long addr, unsigned long size); 64extern void reserve_bootmem(unsigned long addr, unsigned long size);
61#define alloc_bootmem(x) \ 65#define alloc_bootmem(x) \
62 __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 66 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
63#define alloc_bootmem_low(x) \ 67#define alloc_bootmem_low(x) \
64 __alloc_bootmem_low((x), SMP_CACHE_BYTES, 0) 68 __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
65#define alloc_bootmem_pages(x) \ 69#define alloc_bootmem_pages(x) \
66 __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 70 __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
67#define alloc_bootmem_low_pages(x) \ 71#define alloc_bootmem_low_pages(x) \
68 __alloc_bootmem_low((x), PAGE_SIZE, 0) 72 __alloc_bootmem_low(x, PAGE_SIZE, 0)
69#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 73#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
70extern unsigned long __init free_all_bootmem (void); 74
71extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal); 75extern unsigned long free_all_bootmem(void);
72extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn); 76extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
73extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size); 77extern void *__alloc_bootmem_node(pg_data_t *pgdat,
74extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size); 78 unsigned long size,
75extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat); 79 unsigned long align,
80 unsigned long goal);
81extern unsigned long init_bootmem_node(pg_data_t *pgdat,
82 unsigned long freepfn,
83 unsigned long startpfn,
84 unsigned long endpfn);
85extern void reserve_bootmem_node(pg_data_t *pgdat,
86 unsigned long physaddr,
87 unsigned long size);
88extern void free_bootmem_node(pg_data_t *pgdat,
89 unsigned long addr,
90 unsigned long size);
91
76#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 92#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
77#define alloc_bootmem_node(pgdat, x) \ 93#define alloc_bootmem_node(pgdat, x) \
78 __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 94 __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
79#define alloc_bootmem_pages_node(pgdat, x) \ 95#define alloc_bootmem_pages_node(pgdat, x) \
80 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 96 __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
81#define alloc_bootmem_low_pages_node(pgdat, x) \ 97#define alloc_bootmem_low_pages_node(pgdat, x) \
82 __alloc_bootmem_low_node((pgdat), (x), PAGE_SIZE, 0) 98 __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0)
83#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 99#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
84 100
85#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP 101#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
@@ -89,19 +105,19 @@ static inline void *alloc_remap(int nid, unsigned long size)
89{ 105{
90 return NULL; 106 return NULL;
91} 107}
92#endif 108#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
93 109
94extern unsigned long nr_kernel_pages; 110extern unsigned long __meminitdata nr_kernel_pages;
95extern unsigned long nr_all_pages; 111extern unsigned long nr_all_pages;
96 112
97extern void *__init alloc_large_system_hash(const char *tablename, 113extern void *alloc_large_system_hash(const char *tablename,
98 unsigned long bucketsize, 114 unsigned long bucketsize,
99 unsigned long numentries, 115 unsigned long numentries,
100 int scale, 116 int scale,
101 int flags, 117 int flags,
102 unsigned int *_hash_shift, 118 unsigned int *_hash_shift,
103 unsigned int *_hash_mask, 119 unsigned int *_hash_mask,
104 unsigned long limit); 120 unsigned long limit);
105 121
106#define HASH_HIGHMEM 0x00000001 /* Consider highmem? */ 122#define HASH_HIGHMEM 0x00000001 /* Consider highmem? */
107#define HASH_EARLY 0x00000002 /* Allocating during early boot? */ 123#define HASH_EARLY 0x00000002 /* Allocating during early boot? */
@@ -114,7 +130,7 @@ extern void *__init alloc_large_system_hash(const char *tablename,
114#else 130#else
115#define HASHDIST_DEFAULT 0 131#define HASHDIST_DEFAULT 0
116#endif 132#endif
117extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */ 133extern int hashdist; /* Distribute hashes across NUMA nodes? */
118 134
119 135
120#endif /* _LINUX_BOOTMEM_H */ 136#endif /* _LINUX_BOOTMEM_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index fb7e9b7ccbe3..737e407d0cd1 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -149,7 +149,6 @@ void create_empty_buffers(struct page *, unsigned long,
149 unsigned long b_state); 149 unsigned long b_state);
150void end_buffer_read_sync(struct buffer_head *bh, int uptodate); 150void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
151void end_buffer_write_sync(struct buffer_head *bh, int uptodate); 151void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
152void end_buffer_async_write(struct buffer_head *bh, int uptodate);
153 152
154/* Things to do with buffers at mapping->private_list */ 153/* Things to do with buffers at mapping->private_list */
155void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode); 154void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode);
@@ -214,6 +213,7 @@ int nobh_truncate_page(struct address_space *, loff_t);
214int nobh_writepage(struct page *page, get_block_t *get_block, 213int nobh_writepage(struct page *page, get_block_t *get_block,
215 struct writeback_control *wbc); 214 struct writeback_control *wbc);
216 215
216void buffer_init(void);
217 217
218/* 218/*
219 * inline definitions 219 * inline definitions
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
new file mode 100644
index 000000000000..56499ab9e32e
--- /dev/null
+++ b/include/linux/byteorder/Kbuild
@@ -0,0 +1,7 @@
1header-y += big_endian.h
2header-y += little_endian.h
3header-y += pdp_endian.h
4
5unifdef-y += generic.h
6unifdef-y += swabb.h
7unifdef-y += swab.h
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 2216638962d2..ee5f53f2ca15 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -23,5 +23,7 @@ void cdev_del(struct cdev *);
23 23
24void cd_forget(struct inode *); 24void cd_forget(struct inode *);
25 25
26extern struct backing_dev_info directly_mappable_cdev_bdi;
27
26#endif 28#endif
27#endif 29#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
new file mode 100644
index 000000000000..d852024ed095
--- /dev/null
+++ b/include/linux/clocksource.h
@@ -0,0 +1,185 @@
1/* linux/include/linux/clocksource.h
2 *
3 * This file contains the structure definitions for clocksources.
4 *
5 * If you are not a clocksource, or timekeeping code, you should
6 * not be including this file!
7 */
8#ifndef _LINUX_CLOCKSOURCE_H
9#define _LINUX_CLOCKSOURCE_H
10
11#include <linux/types.h>
12#include <linux/timex.h>
13#include <linux/time.h>
14#include <linux/list.h>
15#include <asm/div64.h>
16#include <asm/io.h>
17
18/* clocksource cycle base type */
19typedef u64 cycle_t;
20
21/**
22 * struct clocksource - hardware abstraction for a free running counter
23 * Provides mostly state-free accessors to the underlying hardware.
24 *
25 * @name: ptr to clocksource name
26 * @list: list head for registration
27 * @rating: rating value for selection (higher is better)
28 * To avoid rating inflation the following
29 * list should give you a guide as to how
30 * to assign your clocksource a rating
31 * 1-99: Unfit for real use
32 * Only available for bootup and testing purposes.
33 * 100-199: Base level usability.
34 * Functional for real use, but not desired.
35 * 200-299: Good.
36 * A correct and usable clocksource.
37 * 300-399: Desired.
38 * A reasonably fast and accurate clocksource.
39 * 400-499: Perfect
40 * The ideal clocksource. A must-use where
41 * available.
42 * @read: returns a cycle value
43 * @mask: bitmask for two's complement
44 * subtraction of non 64 bit counters
45 * @mult: cycle to nanosecond multiplier
46 * @shift: cycle to nanosecond divisor (power of two)
47 * @update_callback: called when safe to alter clocksource values
48 * @is_continuous: defines if clocksource is free-running.
49 * @cycle_interval: Used internally by timekeeping core, please ignore.
50 * @xtime_interval: Used internally by timekeeping core, please ignore.
51 */
52struct clocksource {
53 char *name;
54 struct list_head list;
55 int rating;
56 cycle_t (*read)(void);
57 cycle_t mask;
58 u32 mult;
59 u32 shift;
60 int (*update_callback)(void);
61 int is_continuous;
62
63 /* timekeeping specific data, ignore */
64 cycle_t cycle_last, cycle_interval;
65 u64 xtime_nsec, xtime_interval;
66 s64 error;
67};
68
69/* simplify initialization of mask field */
70#define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1)
71
72/**
73 * clocksource_khz2mult - calculates mult from khz and shift
74 * @khz: Clocksource frequency in KHz
75 * @shift_constant: Clocksource shift factor
76 *
77 * Helper functions that converts a khz counter frequency to a timsource
78 * multiplier, given the clocksource shift value
79 */
80static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
81{
82 /* khz = cyc/(Million ns)
83 * mult/2^shift = ns/cyc
84 * mult = ns/cyc * 2^shift
85 * mult = 1Million/khz * 2^shift
86 * mult = 1000000 * 2^shift / khz
87 * mult = (1000000<<shift) / khz
88 */
89 u64 tmp = ((u64)1000000) << shift_constant;
90
91 tmp += khz/2; /* round for do_div */
92 do_div(tmp, khz);
93
94 return (u32)tmp;
95}
96
97/**
98 * clocksource_hz2mult - calculates mult from hz and shift
99 * @hz: Clocksource frequency in Hz
100 * @shift_constant: Clocksource shift factor
101 *
102 * Helper functions that converts a hz counter
103 * frequency to a timsource multiplier, given the
104 * clocksource shift value
105 */
106static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
107{
108 /* hz = cyc/(Billion ns)
109 * mult/2^shift = ns/cyc
110 * mult = ns/cyc * 2^shift
111 * mult = 1Billion/hz * 2^shift
112 * mult = 1000000000 * 2^shift / hz
113 * mult = (1000000000<<shift) / hz
114 */
115 u64 tmp = ((u64)1000000000) << shift_constant;
116
117 tmp += hz/2; /* round for do_div */
118 do_div(tmp, hz);
119
120 return (u32)tmp;
121}
122
123/**
124 * clocksource_read: - Access the clocksource's current cycle value
125 * @cs: pointer to clocksource being read
126 *
127 * Uses the clocksource to return the current cycle_t value
128 */
129static inline cycle_t clocksource_read(struct clocksource *cs)
130{
131 return cs->read();
132}
133
134/**
135 * cyc2ns - converts clocksource cycles to nanoseconds
136 * @cs: Pointer to clocksource
137 * @cycles: Cycles
138 *
139 * Uses the clocksource and ntp ajdustment to convert cycle_ts to nanoseconds.
140 *
141 * XXX - This could use some mult_lxl_ll() asm optimization
142 */
143static inline s64 cyc2ns(struct clocksource *cs, cycle_t cycles)
144{
145 u64 ret = (u64)cycles;
146 ret = (ret * cs->mult) >> cs->shift;
147 return ret;
148}
149
150/**
151 * clocksource_calculate_interval - Calculates a clocksource interval struct
152 *
153 * @c: Pointer to clocksource.
154 * @length_nsec: Desired interval length in nanoseconds.
155 *
156 * Calculates a fixed cycle/nsec interval for a given clocksource/adjustment
157 * pair and interval request.
158 *
159 * Unless you're the timekeeping code, you should not be using this!
160 */
161static inline void clocksource_calculate_interval(struct clocksource *c,
162 unsigned long length_nsec)
163{
164 u64 tmp;
165
166 /* XXX - All of this could use a whole lot of optimization */
167 tmp = length_nsec;
168 tmp <<= c->shift;
169 tmp += c->mult/2;
170 do_div(tmp, c->mult);
171
172 c->cycle_interval = (cycle_t)tmp;
173 if (c->cycle_interval == 0)
174 c->cycle_interval = 1;
175
176 c->xtime_interval = (u64)c->cycle_interval * c->mult;
177}
178
179
180/* used to install a new clocksource */
181int clocksource_register(struct clocksource*);
182void clocksource_reselect(void);
183struct clocksource* clocksource_get_next(void);
184
185#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index dbb7769009be..1c86d65bc4b9 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -57,7 +57,8 @@ struct proc_event {
57 PROC_EVENT_EXIT = 0x80000000 57 PROC_EVENT_EXIT = 0x80000000
58 } what; 58 } what;
59 __u32 cpu; 59 __u32 cpu;
60 struct timespec timestamp; 60 __u64 __attribute__((aligned(8))) timestamp_ns;
61 /* Number of nano seconds since system boot */
61 union { /* must be last field of proc_event struct */ 62 union { /* must be last field of proc_event struct */
62 struct { 63 struct {
63 __u32 err; 64 __u32 err;
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index 7b5c5df5cb69..be512cc98791 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -27,8 +27,8 @@ extern struct inode_operations coda_dir_inode_operations;
27extern struct inode_operations coda_file_inode_operations; 27extern struct inode_operations coda_file_inode_operations;
28extern struct inode_operations coda_ioctl_inode_operations; 28extern struct inode_operations coda_ioctl_inode_operations;
29 29
30extern struct address_space_operations coda_file_aops; 30extern const struct address_space_operations coda_file_aops;
31extern struct address_space_operations coda_symlink_aops; 31extern const struct address_space_operations coda_symlink_aops;
32 32
33extern const struct file_operations coda_dir_operations; 33extern const struct file_operations coda_dir_operations;
34extern const struct file_operations coda_file_operations; 34extern const struct file_operations coda_file_operations;
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 98f6c52c152b..b541bb3d1f4b 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -1,11 +1,11 @@
1#ifndef __CODA_PSDEV_H 1#ifndef __CODA_PSDEV_H
2#define __CODA_PSDEV_H 2#define __CODA_PSDEV_H
3 3
4#include <linux/magic.h>
5
4#define CODA_PSDEV_MAJOR 67 6#define CODA_PSDEV_MAJOR 67
5#define MAX_CODADEVS 5 /* how many do we allow */ 7#define MAX_CODADEVS 5 /* how many do we allow */
6 8
7#define CODA_SUPER_MAGIC 0x73757245
8
9struct kstatfs; 9struct kstatfs;
10 10
11struct coda_sb_info 11struct coda_sb_info
diff --git a/include/linux/compat.h b/include/linux/compat.h
index dda1697ec753..9760753e662b 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -226,5 +226,7 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs,
226 226
227asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); 227asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
228 228
229extern int compat_printk(const char *fmt, ...);
230
229#endif /* CONFIG_COMPAT */ 231#endif /* CONFIG_COMPAT */
230#endif /* _LINUX_COMPAT_H */ 232#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index 89ab677cb993..bea0255196c4 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -216,6 +216,7 @@ COMPATIBLE_IOCTL(VT_RESIZE)
216COMPATIBLE_IOCTL(VT_RESIZEX) 216COMPATIBLE_IOCTL(VT_RESIZEX)
217COMPATIBLE_IOCTL(VT_LOCKSWITCH) 217COMPATIBLE_IOCTL(VT_LOCKSWITCH)
218COMPATIBLE_IOCTL(VT_UNLOCKSWITCH) 218COMPATIBLE_IOCTL(VT_UNLOCKSWITCH)
219COMPATIBLE_IOCTL(VT_GETHIFONTMASK)
219/* Little p (/dev/rtc, /dev/envctrl, etc.) */ 220/* Little p (/dev/rtc, /dev/envctrl, etc.) */
220COMPATIBLE_IOCTL(RTC_AIE_ON) 221COMPATIBLE_IOCTL(RTC_AIE_ON)
221COMPATIBLE_IOCTL(RTC_AIE_OFF) 222COMPATIBLE_IOCTL(RTC_AIE_OFF)
@@ -567,11 +568,6 @@ COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOSUBVER)
567COMPATIBLE_IOCTL(AUTOFS_IOC_ASKREGHOST) 568COMPATIBLE_IOCTL(AUTOFS_IOC_ASKREGHOST)
568COMPATIBLE_IOCTL(AUTOFS_IOC_TOGGLEREGHOST) 569COMPATIBLE_IOCTL(AUTOFS_IOC_TOGGLEREGHOST)
569COMPATIBLE_IOCTL(AUTOFS_IOC_ASKUMOUNT) 570COMPATIBLE_IOCTL(AUTOFS_IOC_ASKUMOUNT)
570/* DEVFS */
571COMPATIBLE_IOCTL(DEVFSDIOC_GET_PROTO_REV)
572COMPATIBLE_IOCTL(DEVFSDIOC_SET_EVENT_MASK)
573COMPATIBLE_IOCTL(DEVFSDIOC_RELEASE_EVENT_QUEUE)
574COMPATIBLE_IOCTL(DEVFSDIOC_SET_DEBUG_MASK)
575/* Raw devices */ 571/* Raw devices */
576COMPATIBLE_IOCTL(RAW_SETBIND) 572COMPATIBLE_IOCTL(RAW_SETBIND)
577COMPATIBLE_IOCTL(RAW_GETBIND) 573COMPATIBLE_IOCTL(RAW_GETBIND)
@@ -673,6 +669,11 @@ COMPATIBLE_IOCTL(CAPI_SET_FLAGS)
673COMPATIBLE_IOCTL(CAPI_CLR_FLAGS) 669COMPATIBLE_IOCTL(CAPI_CLR_FLAGS)
674COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT) 670COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT)
675COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT) 671COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT)
672/* Siemens Gigaset */
673COMPATIBLE_IOCTL(GIGASET_REDIR)
674COMPATIBLE_IOCTL(GIGASET_CONFIG)
675COMPATIBLE_IOCTL(GIGASET_BRKCHARS)
676COMPATIBLE_IOCTL(GIGASET_VERSION)
676/* Misc. */ 677/* Misc. */
677COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */ 678COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */
678COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */ 679COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 9b4f11094937..0780de440220 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -14,7 +14,7 @@
14# define __releases(x) __attribute__((context(1,0))) 14# define __releases(x) __attribute__((context(1,0)))
15# define __acquire(x) __context__(1) 15# define __acquire(x) __context__(1)
16# define __release(x) __context__(-1) 16# define __release(x) __context__(-1)
17# define __cond_lock(x) ((x) ? ({ __context__(1); 1; }) : 0) 17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
18extern void __chk_user_ptr(void __user *); 18extern void __chk_user_ptr(void __user *);
19extern void __chk_io_ptr(void __iomem *); 19extern void __chk_io_ptr(void __iomem *);
20#else 20#else
@@ -31,7 +31,7 @@ extern void __chk_io_ptr(void __iomem *);
31# define __releases(x) 31# define __releases(x)
32# define __acquire(x) (void)0 32# define __acquire(x) (void)0
33# define __release(x) (void)0 33# define __release(x) (void)0
34# define __cond_lock(x) (x) 34# define __cond_lock(x,c) (c)
35#endif 35#endif
36 36
37#ifdef __KERNEL__ 37#ifdef __KERNEL__
@@ -99,6 +99,11 @@ extern void __chk_io_ptr(void __iomem *);
99#define __must_check 99#define __must_check
100#endif 100#endif
101 101
102#ifndef CONFIG_ENABLE_MUST_CHECK
103#undef __must_check
104#define __must_check
105#endif
106
102/* 107/*
103 * Allow us to avoid 'defined but not used' warnings on functions and data, 108 * Allow us to avoid 'defined but not used' warnings on functions and data,
104 * as well as force them to be emitted to the assembly file. 109 * as well as force them to be emitted to the assembly file.
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 90663ad217f9..268c5a4a2bd4 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -18,9 +18,24 @@ struct completion {
18#define COMPLETION_INITIALIZER(work) \ 18#define COMPLETION_INITIALIZER(work) \
19 { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) } 19 { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
20 20
21#define COMPLETION_INITIALIZER_ONSTACK(work) \
22 ({ init_completion(&work); work; })
23
21#define DECLARE_COMPLETION(work) \ 24#define DECLARE_COMPLETION(work) \
22 struct completion work = COMPLETION_INITIALIZER(work) 25 struct completion work = COMPLETION_INITIALIZER(work)
23 26
27/*
28 * Lockdep needs to run a non-constant initializer for on-stack
29 * completions - so we use the _ONSTACK() variant for those that
30 * are on the kernel stack:
31 */
32#ifdef CONFIG_LOCKDEP
33# define DECLARE_COMPLETION_ONSTACK(work) \
34 struct completion work = COMPLETION_INITIALIZER_ONSTACK(work)
35#else
36# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
37#endif
38
24static inline void init_completion(struct completion *x) 39static inline void init_completion(struct completion *x)
25{ 40{
26 x->done = 0; 41 x->done = 0;
diff --git a/include/linux/console.h b/include/linux/console.h
index 08734e660d41..76a1807726eb 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -63,9 +63,11 @@ extern const struct consw vga_con; /* VGA text console */
63extern const struct consw newport_con; /* SGI Newport console */ 63extern const struct consw newport_con; /* SGI Newport console */
64extern const struct consw prom_con; /* SPARC PROM console */ 64extern const struct consw prom_con; /* SPARC PROM console */
65 65
66int con_is_bound(const struct consw *csw);
67int register_con_driver(const struct consw *csw, int first, int last);
68int unregister_con_driver(const struct consw *csw);
66int take_over_console(const struct consw *sw, int first, int last, int deflt); 69int take_over_console(const struct consw *sw, int first, int last, int deflt);
67void give_up_console(const struct consw *sw); 70void give_up_console(const struct consw *sw);
68
69/* scroll */ 71/* scroll */
70#define SM_UP (1) 72#define SM_UP (1)
71#define SM_DOWN (2) 73#define SM_DOWN (2)
@@ -87,6 +89,7 @@ void give_up_console(const struct consw *sw);
87#define CON_CONSDEV (2) /* Last on the command line */ 89#define CON_CONSDEV (2) /* Last on the command line */
88#define CON_ENABLED (4) 90#define CON_ENABLED (4)
89#define CON_BOOT (8) 91#define CON_BOOT (8)
92#define CON_ANYTIME (16) /* Safe to call when cpu is offline */
90 93
91struct console 94struct console
92{ 95{
@@ -117,9 +120,14 @@ extern void console_stop(struct console *);
117extern void console_start(struct console *); 120extern void console_start(struct console *);
118extern int is_console_locked(void); 121extern int is_console_locked(void);
119 122
123#ifndef CONFIG_DISABLE_CONSOLE_SUSPEND
120/* Suspend and resume console messages over PM events */ 124/* Suspend and resume console messages over PM events */
121extern void suspend_console(void); 125extern void suspend_console(void);
122extern void resume_console(void); 126extern void resume_console(void);
127#else
128static inline void suspend_console(void) {}
129static inline void resume_console(void) {}
130#endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */
123 131
124/* Some debug stub to catch some of the obvious races in the VT code */ 132/* Some debug stub to catch some of the obvious races in the VT code */
125#if 1 133#if 1
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index f8e5587a0f92..25423f79bf9f 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -9,6 +9,7 @@
9 * to achieve effects such as fast scrolling by changing the origin. 9 * to achieve effects such as fast scrolling by changing the origin.
10 */ 10 */
11 11
12#include <linux/wait.h>
12#include <linux/vt.h> 13#include <linux/vt.h>
13 14
14struct vt_struct; 15struct vt_struct;
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 08d50c53aab4..3fef7d67aedc 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -31,18 +31,23 @@ struct cpu {
31 struct sys_device sysdev; 31 struct sys_device sysdev;
32}; 32};
33 33
34extern int register_cpu(struct cpu *, int, struct node *); 34extern int register_cpu(struct cpu *cpu, int num);
35extern struct sys_device *get_cpu_sysdev(unsigned cpu); 35extern struct sys_device *get_cpu_sysdev(unsigned cpu);
36#ifdef CONFIG_HOTPLUG_CPU 36#ifdef CONFIG_HOTPLUG_CPU
37extern void unregister_cpu(struct cpu *, struct node *); 37extern void unregister_cpu(struct cpu *cpu);
38#endif 38#endif
39struct notifier_block; 39struct notifier_block;
40 40
41#ifdef CONFIG_SMP 41#ifdef CONFIG_SMP
42/* Need to know about CPUs going up/down? */ 42/* Need to know about CPUs going up/down? */
43extern int register_cpu_notifier(struct notifier_block *nb); 43extern int register_cpu_notifier(struct notifier_block *nb);
44#ifdef CONFIG_HOTPLUG_CPU
44extern void unregister_cpu_notifier(struct notifier_block *nb); 45extern void unregister_cpu_notifier(struct notifier_block *nb);
45extern int current_in_cpu_hotplug(void); 46#else
47static inline void unregister_cpu_notifier(struct notifier_block *nb)
48{
49}
50#endif
46 51
47int cpu_up(unsigned int cpu); 52int cpu_up(unsigned int cpu);
48 53
@@ -55,10 +60,6 @@ static inline int register_cpu_notifier(struct notifier_block *nb)
55static inline void unregister_cpu_notifier(struct notifier_block *nb) 60static inline void unregister_cpu_notifier(struct notifier_block *nb)
56{ 61{
57} 62}
58static inline int current_in_cpu_hotplug(void)
59{
60 return 0;
61}
62 63
63#endif /* CONFIG_SMP */ 64#endif /* CONFIG_SMP */
64extern struct sysdev_class cpu_sysdev_class; 65extern struct sysdev_class cpu_sysdev_class;
@@ -67,22 +68,33 @@ extern struct sysdev_class cpu_sysdev_class;
67/* Stop CPUs going up and down. */ 68/* Stop CPUs going up and down. */
68extern void lock_cpu_hotplug(void); 69extern void lock_cpu_hotplug(void);
69extern void unlock_cpu_hotplug(void); 70extern void unlock_cpu_hotplug(void);
70extern int lock_cpu_hotplug_interruptible(void);
71#define hotcpu_notifier(fn, pri) { \ 71#define hotcpu_notifier(fn, pri) { \
72 static struct notifier_block fn##_nb = \ 72 static struct notifier_block fn##_nb = \
73 { .notifier_call = fn, .priority = pri }; \ 73 { .notifier_call = fn, .priority = pri }; \
74 register_cpu_notifier(&fn##_nb); \ 74 register_cpu_notifier(&fn##_nb); \
75} 75}
76#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
77#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
76int cpu_down(unsigned int cpu); 78int cpu_down(unsigned int cpu);
77#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) 79#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
78#else 80#else
79#define lock_cpu_hotplug() do { } while (0) 81#define lock_cpu_hotplug() do { } while (0)
80#define unlock_cpu_hotplug() do { } while (0) 82#define unlock_cpu_hotplug() do { } while (0)
81#define lock_cpu_hotplug_interruptible() 0 83#define lock_cpu_hotplug_interruptible() 0
82#define hotcpu_notifier(fn, pri) 84#define hotcpu_notifier(fn, pri) do { } while (0)
85#define register_hotcpu_notifier(nb) do { } while (0)
86#define unregister_hotcpu_notifier(nb) do { } while (0)
83 87
84/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */ 88/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */
85static inline int cpu_is_offline(int cpu) { return 0; } 89static inline int cpu_is_offline(int cpu) { return 0; }
86#endif 90#endif
87 91
92#ifdef CONFIG_SUSPEND_SMP
93extern int disable_nonboot_cpus(void);
94extern void enable_nonboot_cpus(void);
95#else
96static inline int disable_nonboot_cpus(void) { return 0; }
97static inline void enable_nonboot_cpus(void) {}
98#endif
99
88#endif /* _LINUX_CPU_H_ */ 100#endif /* _LINUX_CPU_H_ */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 466fbe9e4899..4ea39fee99c7 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -100,8 +100,10 @@ struct cpufreq_policy {
100#define CPUFREQ_INCOMPATIBLE (1) 100#define CPUFREQ_INCOMPATIBLE (1)
101#define CPUFREQ_NOTIFY (2) 101#define CPUFREQ_NOTIFY (2)
102 102
103#define CPUFREQ_SHARED_TYPE_ALL (0) /* All dependent CPUs should set freq */ 103#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
104#define CPUFREQ_SHARED_TYPE_ANY (1) /* Freq can be set from any dependent CPU */ 104#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */
105#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */
106#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
105 107
106/******************** cpufreq transition notifiers *******************/ 108/******************** cpufreq transition notifiers *******************/
107 109
@@ -170,9 +172,6 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
170 unsigned int relation); 172 unsigned int relation);
171 173
172 174
173/* pass an event to the cpufreq governor */
174int cpufreq_governor(unsigned int cpu, unsigned int event);
175
176int cpufreq_register_governor(struct cpufreq_governor *governor); 175int cpufreq_register_governor(struct cpufreq_governor *governor);
177void cpufreq_unregister_governor(struct cpufreq_governor *governor); 176void cpufreq_unregister_governor(struct cpufreq_governor *governor);
178 177
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 9cbb781d6f80..b268a3c0c376 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -317,7 +317,8 @@ static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
317 (cpu) < NR_CPUS; \ 317 (cpu) < NR_CPUS; \
318 (cpu) = next_cpu((cpu), (mask))) 318 (cpu) = next_cpu((cpu), (mask)))
319#else /* NR_CPUS == 1 */ 319#else /* NR_CPUS == 1 */
320#define for_each_cpu_mask(cpu, mask) for ((cpu) = 0; (cpu) < 1; (cpu)++) 320#define for_each_cpu_mask(cpu, mask) \
321 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
321#endif /* NR_CPUS */ 322#endif /* NR_CPUS */
322 323
323/* 324/*
@@ -405,7 +406,6 @@ int __any_online_cpu(const cpumask_t *mask);
405#define any_online_cpu(mask) 0 406#define any_online_cpu(mask) 0
406#endif 407#endif
407 408
408#define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
409#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) 409#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
410#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) 410#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map)
411#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) 411#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 9354722a9217..4d8adf663681 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -63,6 +63,8 @@ static inline int cpuset_do_slab_mem_spread(void)
63 return current->flags & PF_SPREAD_SLAB; 63 return current->flags & PF_SPREAD_SLAB;
64} 64}
65 65
66extern void cpuset_track_online_nodes(void);
67
66#else /* !CONFIG_CPUSETS */ 68#else /* !CONFIG_CPUSETS */
67 69
68static inline int cpuset_init_early(void) { return 0; } 70static inline int cpuset_init_early(void) { return 0; }
@@ -126,6 +128,8 @@ static inline int cpuset_do_slab_mem_spread(void)
126 return 0; 128 return 0;
127} 129}
128 130
131static inline void cpuset_track_online_nodes(void) {}
132
129#endif /* !CONFIG_CPUSETS */ 133#endif /* !CONFIG_CPUSETS */
130 134
131#endif /* _LINUX_CPUSET_H */ 135#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/cramfs_fs.h b/include/linux/cramfs_fs.h
index a41f38428c37..1dba681e428d 100644
--- a/include/linux/cramfs_fs.h
+++ b/include/linux/cramfs_fs.h
@@ -87,6 +87,6 @@ struct cramfs_super {
87/* Uncompression interfaces to the underlying zlib */ 87/* Uncompression interfaces to the underlying zlib */
88int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen); 88int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen);
89int cramfs_uncompress_init(void); 89int cramfs_uncompress_init(void);
90int cramfs_uncompress_exit(void); 90void cramfs_uncompress_exit(void);
91 91
92#endif 92#endif
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 5a0470e36111..8f2ffa4caabf 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -17,20 +17,36 @@
17#ifndef _LINUX_CRYPTO_H 17#ifndef _LINUX_CRYPTO_H
18#define _LINUX_CRYPTO_H 18#define _LINUX_CRYPTO_H
19 19
20#include <asm/atomic.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/types.h>
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/slab.h>
24#include <linux/string.h> 25#include <linux/string.h>
25#include <asm/page.h> 26#include <linux/uaccess.h>
26 27
27/* 28/*
28 * Algorithm masks and types. 29 * Algorithm masks and types.
29 */ 30 */
30#define CRYPTO_ALG_TYPE_MASK 0x000000ff 31#define CRYPTO_ALG_TYPE_MASK 0x0000000f
31#define CRYPTO_ALG_TYPE_CIPHER 0x00000001 32#define CRYPTO_ALG_TYPE_CIPHER 0x00000001
32#define CRYPTO_ALG_TYPE_DIGEST 0x00000002 33#define CRYPTO_ALG_TYPE_DIGEST 0x00000002
33#define CRYPTO_ALG_TYPE_COMPRESS 0x00000004 34#define CRYPTO_ALG_TYPE_HASH 0x00000003
35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
36#define CRYPTO_ALG_TYPE_COMPRESS 0x00000005
37
38#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
39
40#define CRYPTO_ALG_LARVAL 0x00000010
41#define CRYPTO_ALG_DEAD 0x00000020
42#define CRYPTO_ALG_DYING 0x00000040
43#define CRYPTO_ALG_ASYNC 0x00000080
44
45/*
46 * Set this bit if and only if the algorithm requires another algorithm of
47 * the same type to handle corner cases.
48 */
49#define CRYPTO_ALG_NEED_FALLBACK 0x00000100
34 50
35/* 51/*
36 * Transform masks and values (for crt_flags). 52 * Transform masks and values (for crt_flags).
@@ -61,82 +77,156 @@
61#define CRYPTO_DIR_ENCRYPT 1 77#define CRYPTO_DIR_ENCRYPT 1
62#define CRYPTO_DIR_DECRYPT 0 78#define CRYPTO_DIR_DECRYPT 0
63 79
80/*
81 * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
82 * declaration) is used to ensure that the crypto_tfm context structure is
83 * aligned correctly for the given architecture so that there are no alignment
84 * faults for C data types. In particular, this is required on platforms such
85 * as arm where pointers are 32-bit aligned but there are data types such as
86 * u64 which require 64-bit alignment.
87 */
88#if defined(ARCH_KMALLOC_MINALIGN)
89#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
90#elif defined(ARCH_SLAB_MINALIGN)
91#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
92#endif
93
94#ifdef CRYPTO_MINALIGN
95#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
96#else
97#define CRYPTO_MINALIGN_ATTR
98#endif
99
64struct scatterlist; 100struct scatterlist;
101struct crypto_blkcipher;
102struct crypto_hash;
65struct crypto_tfm; 103struct crypto_tfm;
104struct crypto_type;
105
106struct blkcipher_desc {
107 struct crypto_blkcipher *tfm;
108 void *info;
109 u32 flags;
110};
66 111
67struct cipher_desc { 112struct cipher_desc {
68 struct crypto_tfm *tfm; 113 struct crypto_tfm *tfm;
69 void (*crfn)(void *ctx, u8 *dst, const u8 *src); 114 void (*crfn)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
70 unsigned int (*prfn)(const struct cipher_desc *desc, u8 *dst, 115 unsigned int (*prfn)(const struct cipher_desc *desc, u8 *dst,
71 const u8 *src, unsigned int nbytes); 116 const u8 *src, unsigned int nbytes);
72 void *info; 117 void *info;
73}; 118};
74 119
120struct hash_desc {
121 struct crypto_hash *tfm;
122 u32 flags;
123};
124
75/* 125/*
76 * Algorithms: modular crypto algorithm implementations, managed 126 * Algorithms: modular crypto algorithm implementations, managed
77 * via crypto_register_alg() and crypto_unregister_alg(). 127 * via crypto_register_alg() and crypto_unregister_alg().
78 */ 128 */
129struct blkcipher_alg {
130 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
131 unsigned int keylen);
132 int (*encrypt)(struct blkcipher_desc *desc,
133 struct scatterlist *dst, struct scatterlist *src,
134 unsigned int nbytes);
135 int (*decrypt)(struct blkcipher_desc *desc,
136 struct scatterlist *dst, struct scatterlist *src,
137 unsigned int nbytes);
138
139 unsigned int min_keysize;
140 unsigned int max_keysize;
141 unsigned int ivsize;
142};
143
79struct cipher_alg { 144struct cipher_alg {
80 unsigned int cia_min_keysize; 145 unsigned int cia_min_keysize;
81 unsigned int cia_max_keysize; 146 unsigned int cia_max_keysize;
82 int (*cia_setkey)(void *ctx, const u8 *key, 147 int (*cia_setkey)(struct crypto_tfm *tfm, const u8 *key,
83 unsigned int keylen, u32 *flags); 148 unsigned int keylen);
84 void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); 149 void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
85 void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); 150 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
86 151
87 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, 152 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc,
88 u8 *dst, const u8 *src, 153 u8 *dst, const u8 *src,
89 unsigned int nbytes); 154 unsigned int nbytes) __deprecated;
90 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc, 155 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc,
91 u8 *dst, const u8 *src, 156 u8 *dst, const u8 *src,
92 unsigned int nbytes); 157 unsigned int nbytes) __deprecated;
93 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc, 158 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc,
94 u8 *dst, const u8 *src, 159 u8 *dst, const u8 *src,
95 unsigned int nbytes); 160 unsigned int nbytes) __deprecated;
96 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc, 161 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc,
97 u8 *dst, const u8 *src, 162 u8 *dst, const u8 *src,
98 unsigned int nbytes); 163 unsigned int nbytes) __deprecated;
99}; 164};
100 165
101struct digest_alg { 166struct digest_alg {
102 unsigned int dia_digestsize; 167 unsigned int dia_digestsize;
103 void (*dia_init)(void *ctx); 168 void (*dia_init)(struct crypto_tfm *tfm);
104 void (*dia_update)(void *ctx, const u8 *data, unsigned int len); 169 void (*dia_update)(struct crypto_tfm *tfm, const u8 *data,
105 void (*dia_final)(void *ctx, u8 *out); 170 unsigned int len);
106 int (*dia_setkey)(void *ctx, const u8 *key, 171 void (*dia_final)(struct crypto_tfm *tfm, u8 *out);
107 unsigned int keylen, u32 *flags); 172 int (*dia_setkey)(struct crypto_tfm *tfm, const u8 *key,
173 unsigned int keylen);
174};
175
176struct hash_alg {
177 int (*init)(struct hash_desc *desc);
178 int (*update)(struct hash_desc *desc, struct scatterlist *sg,
179 unsigned int nbytes);
180 int (*final)(struct hash_desc *desc, u8 *out);
181 int (*digest)(struct hash_desc *desc, struct scatterlist *sg,
182 unsigned int nbytes, u8 *out);
183 int (*setkey)(struct crypto_hash *tfm, const u8 *key,
184 unsigned int keylen);
185
186 unsigned int digestsize;
108}; 187};
109 188
110struct compress_alg { 189struct compress_alg {
111 int (*coa_init)(void *ctx); 190 int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src,
112 void (*coa_exit)(void *ctx); 191 unsigned int slen, u8 *dst, unsigned int *dlen);
113 int (*coa_compress)(void *ctx, const u8 *src, unsigned int slen, 192 int (*coa_decompress)(struct crypto_tfm *tfm, const u8 *src,
114 u8 *dst, unsigned int *dlen); 193 unsigned int slen, u8 *dst, unsigned int *dlen);
115 int (*coa_decompress)(void *ctx, const u8 *src, unsigned int slen,
116 u8 *dst, unsigned int *dlen);
117}; 194};
118 195
196#define cra_blkcipher cra_u.blkcipher
119#define cra_cipher cra_u.cipher 197#define cra_cipher cra_u.cipher
120#define cra_digest cra_u.digest 198#define cra_digest cra_u.digest
199#define cra_hash cra_u.hash
121#define cra_compress cra_u.compress 200#define cra_compress cra_u.compress
122 201
123struct crypto_alg { 202struct crypto_alg {
124 struct list_head cra_list; 203 struct list_head cra_list;
204 struct list_head cra_users;
205
125 u32 cra_flags; 206 u32 cra_flags;
126 unsigned int cra_blocksize; 207 unsigned int cra_blocksize;
127 unsigned int cra_ctxsize; 208 unsigned int cra_ctxsize;
128 unsigned int cra_alignmask; 209 unsigned int cra_alignmask;
129 210
130 int cra_priority; 211 int cra_priority;
212 atomic_t cra_refcnt;
131 213
132 const char cra_name[CRYPTO_MAX_ALG_NAME]; 214 char cra_name[CRYPTO_MAX_ALG_NAME];
133 const char cra_driver_name[CRYPTO_MAX_ALG_NAME]; 215 char cra_driver_name[CRYPTO_MAX_ALG_NAME];
216
217 const struct crypto_type *cra_type;
134 218
135 union { 219 union {
220 struct blkcipher_alg blkcipher;
136 struct cipher_alg cipher; 221 struct cipher_alg cipher;
137 struct digest_alg digest; 222 struct digest_alg digest;
223 struct hash_alg hash;
138 struct compress_alg compress; 224 struct compress_alg compress;
139 } cra_u; 225 } cra_u;
226
227 int (*cra_init)(struct crypto_tfm *tfm);
228 void (*cra_exit)(struct crypto_tfm *tfm);
229 void (*cra_destroy)(struct crypto_alg *alg);
140 230
141 struct module *cra_module; 231 struct module *cra_module;
142}; 232};
@@ -151,20 +241,39 @@ int crypto_unregister_alg(struct crypto_alg *alg);
151 * Algorithm query interface. 241 * Algorithm query interface.
152 */ 242 */
153#ifdef CONFIG_CRYPTO 243#ifdef CONFIG_CRYPTO
154int crypto_alg_available(const char *name, u32 flags); 244int crypto_alg_available(const char *name, u32 flags)
245 __deprecated_for_modules;
246int crypto_has_alg(const char *name, u32 type, u32 mask);
155#else 247#else
248static int crypto_alg_available(const char *name, u32 flags);
249 __deprecated_for_modules;
156static inline int crypto_alg_available(const char *name, u32 flags) 250static inline int crypto_alg_available(const char *name, u32 flags)
157{ 251{
158 return 0; 252 return 0;
159} 253}
254
255static inline int crypto_has_alg(const char *name, u32 type, u32 mask)
256{
257 return 0;
258}
160#endif 259#endif
161 260
162/* 261/*
163 * Transforms: user-instantiated objects which encapsulate algorithms 262 * Transforms: user-instantiated objects which encapsulate algorithms
164 * and core processing logic. Managed via crypto_alloc_tfm() and 263 * and core processing logic. Managed via crypto_alloc_*() and
165 * crypto_free_tfm(), as well as the various helpers below. 264 * crypto_free_*(), as well as the various helpers below.
166 */ 265 */
167 266
267struct blkcipher_tfm {
268 void *iv;
269 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
270 unsigned int keylen);
271 int (*encrypt)(struct blkcipher_desc *desc, struct scatterlist *dst,
272 struct scatterlist *src, unsigned int nbytes);
273 int (*decrypt)(struct blkcipher_desc *desc, struct scatterlist *dst,
274 struct scatterlist *src, unsigned int nbytes);
275};
276
168struct cipher_tfm { 277struct cipher_tfm {
169 void *cit_iv; 278 void *cit_iv;
170 unsigned int cit_ivsize; 279 unsigned int cit_ivsize;
@@ -188,20 +297,20 @@ struct cipher_tfm {
188 struct scatterlist *src, 297 struct scatterlist *src,
189 unsigned int nbytes, u8 *iv); 298 unsigned int nbytes, u8 *iv);
190 void (*cit_xor_block)(u8 *dst, const u8 *src); 299 void (*cit_xor_block)(u8 *dst, const u8 *src);
300 void (*cit_encrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
301 void (*cit_decrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
191}; 302};
192 303
193struct digest_tfm { 304struct hash_tfm {
194 void (*dit_init)(struct crypto_tfm *tfm); 305 int (*init)(struct hash_desc *desc);
195 void (*dit_update)(struct crypto_tfm *tfm, 306 int (*update)(struct hash_desc *desc,
196 struct scatterlist *sg, unsigned int nsg); 307 struct scatterlist *sg, unsigned int nsg);
197 void (*dit_final)(struct crypto_tfm *tfm, u8 *out); 308 int (*final)(struct hash_desc *desc, u8 *out);
198 void (*dit_digest)(struct crypto_tfm *tfm, struct scatterlist *sg, 309 int (*digest)(struct hash_desc *desc, struct scatterlist *sg,
199 unsigned int nsg, u8 *out); 310 unsigned int nsg, u8 *out);
200 int (*dit_setkey)(struct crypto_tfm *tfm, 311 int (*setkey)(struct crypto_hash *tfm, const u8 *key,
201 const u8 *key, unsigned int keylen); 312 unsigned int keylen);
202#ifdef CONFIG_CRYPTO_HMAC 313 unsigned int digestsize;
203 void *dit_hmac_block;
204#endif
205}; 314};
206 315
207struct compress_tfm { 316struct compress_tfm {
@@ -213,8 +322,9 @@ struct compress_tfm {
213 u8 *dst, unsigned int *dlen); 322 u8 *dst, unsigned int *dlen);
214}; 323};
215 324
325#define crt_blkcipher crt_u.blkcipher
216#define crt_cipher crt_u.cipher 326#define crt_cipher crt_u.cipher
217#define crt_digest crt_u.digest 327#define crt_hash crt_u.hash
218#define crt_compress crt_u.compress 328#define crt_compress crt_u.compress
219 329
220struct crypto_tfm { 330struct crypto_tfm {
@@ -222,30 +332,43 @@ struct crypto_tfm {
222 u32 crt_flags; 332 u32 crt_flags;
223 333
224 union { 334 union {
335 struct blkcipher_tfm blkcipher;
225 struct cipher_tfm cipher; 336 struct cipher_tfm cipher;
226 struct digest_tfm digest; 337 struct hash_tfm hash;
227 struct compress_tfm compress; 338 struct compress_tfm compress;
228 } crt_u; 339 } crt_u;
229 340
230 struct crypto_alg *__crt_alg; 341 struct crypto_alg *__crt_alg;
231 342
232 char __crt_ctx[] __attribute__ ((__aligned__)); 343 void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;
344};
345
346#define crypto_cipher crypto_tfm
347#define crypto_comp crypto_tfm
348
349struct crypto_blkcipher {
350 struct crypto_tfm base;
351};
352
353struct crypto_hash {
354 struct crypto_tfm base;
355};
356
357enum {
358 CRYPTOA_UNSPEC,
359 CRYPTOA_ALG,
360};
361
362struct crypto_attr_alg {
363 char name[CRYPTO_MAX_ALG_NAME];
233}; 364};
234 365
235/* 366/*
236 * Transform user interface. 367 * Transform user interface.
237 */ 368 */
238 369
239/*
240 * crypto_alloc_tfm() will first attempt to locate an already loaded algorithm.
241 * If that fails and the kernel supports dynamically loadable modules, it
242 * will then attempt to load a module of the same name or alias. A refcount
243 * is grabbed on the algorithm which is then associated with the new transform.
244 *
245 * crypto_free_tfm() frees up the transform and any associated resources,
246 * then drops the refcount on the associated algorithm.
247 */
248struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); 370struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags);
371struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
249void crypto_free_tfm(struct crypto_tfm *tfm); 372void crypto_free_tfm(struct crypto_tfm *tfm);
250 373
251/* 374/*
@@ -256,6 +379,16 @@ static inline const char *crypto_tfm_alg_name(struct crypto_tfm *tfm)
256 return tfm->__crt_alg->cra_name; 379 return tfm->__crt_alg->cra_name;
257} 380}
258 381
382static inline const char *crypto_tfm_alg_driver_name(struct crypto_tfm *tfm)
383{
384 return tfm->__crt_alg->cra_driver_name;
385}
386
387static inline int crypto_tfm_alg_priority(struct crypto_tfm *tfm)
388{
389 return tfm->__crt_alg->cra_priority;
390}
391
259static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm) 392static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm)
260{ 393{
261 return module_name(tfm->__crt_alg->cra_module); 394 return module_name(tfm->__crt_alg->cra_module);
@@ -266,18 +399,23 @@ static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm)
266 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; 399 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK;
267} 400}
268 401
402static unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm)
403 __deprecated;
269static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm) 404static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm)
270{ 405{
271 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 406 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
272 return tfm->__crt_alg->cra_cipher.cia_min_keysize; 407 return tfm->__crt_alg->cra_cipher.cia_min_keysize;
273} 408}
274 409
410static unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
411 __deprecated;
275static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm) 412static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
276{ 413{
277 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 414 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
278 return tfm->__crt_alg->cra_cipher.cia_max_keysize; 415 return tfm->__crt_alg->cra_cipher.cia_max_keysize;
279} 416}
280 417
418static unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) __deprecated;
281static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) 419static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm)
282{ 420{
283 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 421 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
@@ -300,6 +438,21 @@ static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm)
300 return tfm->__crt_alg->cra_alignmask; 438 return tfm->__crt_alg->cra_alignmask;
301} 439}
302 440
441static inline u32 crypto_tfm_get_flags(struct crypto_tfm *tfm)
442{
443 return tfm->crt_flags;
444}
445
446static inline void crypto_tfm_set_flags(struct crypto_tfm *tfm, u32 flags)
447{
448 tfm->crt_flags |= flags;
449}
450
451static inline void crypto_tfm_clear_flags(struct crypto_tfm *tfm, u32 flags)
452{
453 tfm->crt_flags &= ~flags;
454}
455
303static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) 456static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
304{ 457{
305 return tfm->__crt_ctx; 458 return tfm->__crt_ctx;
@@ -314,50 +467,374 @@ static inline unsigned int crypto_tfm_ctx_alignment(void)
314/* 467/*
315 * API wrappers. 468 * API wrappers.
316 */ 469 */
317static inline void crypto_digest_init(struct crypto_tfm *tfm) 470static inline struct crypto_blkcipher *__crypto_blkcipher_cast(
471 struct crypto_tfm *tfm)
318{ 472{
319 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 473 return (struct crypto_blkcipher *)tfm;
320 tfm->crt_digest.dit_init(tfm);
321} 474}
322 475
323static inline void crypto_digest_update(struct crypto_tfm *tfm, 476static inline struct crypto_blkcipher *crypto_blkcipher_cast(
324 struct scatterlist *sg, 477 struct crypto_tfm *tfm)
325 unsigned int nsg)
326{ 478{
327 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 479 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_BLKCIPHER);
328 tfm->crt_digest.dit_update(tfm, sg, nsg); 480 return __crypto_blkcipher_cast(tfm);
329} 481}
330 482
331static inline void crypto_digest_final(struct crypto_tfm *tfm, u8 *out) 483static inline struct crypto_blkcipher *crypto_alloc_blkcipher(
484 const char *alg_name, u32 type, u32 mask)
332{ 485{
333 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 486 type &= ~CRYPTO_ALG_TYPE_MASK;
334 tfm->crt_digest.dit_final(tfm, out); 487 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
488 mask |= CRYPTO_ALG_TYPE_MASK;
489
490 return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask));
335} 491}
336 492
337static inline void crypto_digest_digest(struct crypto_tfm *tfm, 493static inline struct crypto_tfm *crypto_blkcipher_tfm(
338 struct scatterlist *sg, 494 struct crypto_blkcipher *tfm)
339 unsigned int nsg, u8 *out)
340{ 495{
341 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 496 return &tfm->base;
342 tfm->crt_digest.dit_digest(tfm, sg, nsg, out);
343} 497}
344 498
345static inline int crypto_digest_setkey(struct crypto_tfm *tfm, 499static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm)
500{
501 crypto_free_tfm(crypto_blkcipher_tfm(tfm));
502}
503
504static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask)
505{
506 type &= ~CRYPTO_ALG_TYPE_MASK;
507 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
508 mask |= CRYPTO_ALG_TYPE_MASK;
509
510 return crypto_has_alg(alg_name, type, mask);
511}
512
513static inline const char *crypto_blkcipher_name(struct crypto_blkcipher *tfm)
514{
515 return crypto_tfm_alg_name(crypto_blkcipher_tfm(tfm));
516}
517
518static inline struct blkcipher_tfm *crypto_blkcipher_crt(
519 struct crypto_blkcipher *tfm)
520{
521 return &crypto_blkcipher_tfm(tfm)->crt_blkcipher;
522}
523
524static inline struct blkcipher_alg *crypto_blkcipher_alg(
525 struct crypto_blkcipher *tfm)
526{
527 return &crypto_blkcipher_tfm(tfm)->__crt_alg->cra_blkcipher;
528}
529
530static inline unsigned int crypto_blkcipher_ivsize(struct crypto_blkcipher *tfm)
531{
532 return crypto_blkcipher_alg(tfm)->ivsize;
533}
534
535static inline unsigned int crypto_blkcipher_blocksize(
536 struct crypto_blkcipher *tfm)
537{
538 return crypto_tfm_alg_blocksize(crypto_blkcipher_tfm(tfm));
539}
540
541static inline unsigned int crypto_blkcipher_alignmask(
542 struct crypto_blkcipher *tfm)
543{
544 return crypto_tfm_alg_alignmask(crypto_blkcipher_tfm(tfm));
545}
546
547static inline u32 crypto_blkcipher_get_flags(struct crypto_blkcipher *tfm)
548{
549 return crypto_tfm_get_flags(crypto_blkcipher_tfm(tfm));
550}
551
552static inline void crypto_blkcipher_set_flags(struct crypto_blkcipher *tfm,
553 u32 flags)
554{
555 crypto_tfm_set_flags(crypto_blkcipher_tfm(tfm), flags);
556}
557
558static inline void crypto_blkcipher_clear_flags(struct crypto_blkcipher *tfm,
559 u32 flags)
560{
561 crypto_tfm_clear_flags(crypto_blkcipher_tfm(tfm), flags);
562}
563
564static inline int crypto_blkcipher_setkey(struct crypto_blkcipher *tfm,
565 const u8 *key, unsigned int keylen)
566{
567 return crypto_blkcipher_crt(tfm)->setkey(crypto_blkcipher_tfm(tfm),
568 key, keylen);
569}
570
571static inline int crypto_blkcipher_encrypt(struct blkcipher_desc *desc,
572 struct scatterlist *dst,
573 struct scatterlist *src,
574 unsigned int nbytes)
575{
576 desc->info = crypto_blkcipher_crt(desc->tfm)->iv;
577 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
578}
579
580static inline int crypto_blkcipher_encrypt_iv(struct blkcipher_desc *desc,
581 struct scatterlist *dst,
582 struct scatterlist *src,
583 unsigned int nbytes)
584{
585 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
586}
587
588static inline int crypto_blkcipher_decrypt(struct blkcipher_desc *desc,
589 struct scatterlist *dst,
590 struct scatterlist *src,
591 unsigned int nbytes)
592{
593 desc->info = crypto_blkcipher_crt(desc->tfm)->iv;
594 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
595}
596
597static inline int crypto_blkcipher_decrypt_iv(struct blkcipher_desc *desc,
598 struct scatterlist *dst,
599 struct scatterlist *src,
600 unsigned int nbytes)
601{
602 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
603}
604
605static inline void crypto_blkcipher_set_iv(struct crypto_blkcipher *tfm,
606 const u8 *src, unsigned int len)
607{
608 memcpy(crypto_blkcipher_crt(tfm)->iv, src, len);
609}
610
611static inline void crypto_blkcipher_get_iv(struct crypto_blkcipher *tfm,
612 u8 *dst, unsigned int len)
613{
614 memcpy(dst, crypto_blkcipher_crt(tfm)->iv, len);
615}
616
617static inline struct crypto_cipher *__crypto_cipher_cast(struct crypto_tfm *tfm)
618{
619 return (struct crypto_cipher *)tfm;
620}
621
622static inline struct crypto_cipher *crypto_cipher_cast(struct crypto_tfm *tfm)
623{
624 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
625 return __crypto_cipher_cast(tfm);
626}
627
628static inline struct crypto_cipher *crypto_alloc_cipher(const char *alg_name,
629 u32 type, u32 mask)
630{
631 type &= ~CRYPTO_ALG_TYPE_MASK;
632 type |= CRYPTO_ALG_TYPE_CIPHER;
633 mask |= CRYPTO_ALG_TYPE_MASK;
634
635 return __crypto_cipher_cast(crypto_alloc_base(alg_name, type, mask));
636}
637
638static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm)
639{
640 return tfm;
641}
642
643static inline void crypto_free_cipher(struct crypto_cipher *tfm)
644{
645 crypto_free_tfm(crypto_cipher_tfm(tfm));
646}
647
648static inline int crypto_has_cipher(const char *alg_name, u32 type, u32 mask)
649{
650 type &= ~CRYPTO_ALG_TYPE_MASK;
651 type |= CRYPTO_ALG_TYPE_CIPHER;
652 mask |= CRYPTO_ALG_TYPE_MASK;
653
654 return crypto_has_alg(alg_name, type, mask);
655}
656
657static inline struct cipher_tfm *crypto_cipher_crt(struct crypto_cipher *tfm)
658{
659 return &crypto_cipher_tfm(tfm)->crt_cipher;
660}
661
662static inline unsigned int crypto_cipher_blocksize(struct crypto_cipher *tfm)
663{
664 return crypto_tfm_alg_blocksize(crypto_cipher_tfm(tfm));
665}
666
667static inline unsigned int crypto_cipher_alignmask(struct crypto_cipher *tfm)
668{
669 return crypto_tfm_alg_alignmask(crypto_cipher_tfm(tfm));
670}
671
672static inline u32 crypto_cipher_get_flags(struct crypto_cipher *tfm)
673{
674 return crypto_tfm_get_flags(crypto_cipher_tfm(tfm));
675}
676
677static inline void crypto_cipher_set_flags(struct crypto_cipher *tfm,
678 u32 flags)
679{
680 crypto_tfm_set_flags(crypto_cipher_tfm(tfm), flags);
681}
682
683static inline void crypto_cipher_clear_flags(struct crypto_cipher *tfm,
684 u32 flags)
685{
686 crypto_tfm_clear_flags(crypto_cipher_tfm(tfm), flags);
687}
688
689static inline int crypto_cipher_setkey(struct crypto_cipher *tfm,
346 const u8 *key, unsigned int keylen) 690 const u8 *key, unsigned int keylen)
347{ 691{
348 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 692 return crypto_cipher_crt(tfm)->cit_setkey(crypto_cipher_tfm(tfm),
349 if (tfm->crt_digest.dit_setkey == NULL) 693 key, keylen);
350 return -ENOSYS; 694}
351 return tfm->crt_digest.dit_setkey(tfm, key, keylen); 695
696static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm,
697 u8 *dst, const u8 *src)
698{
699 crypto_cipher_crt(tfm)->cit_encrypt_one(crypto_cipher_tfm(tfm),
700 dst, src);
701}
702
703static inline void crypto_cipher_decrypt_one(struct crypto_cipher *tfm,
704 u8 *dst, const u8 *src)
705{
706 crypto_cipher_crt(tfm)->cit_decrypt_one(crypto_cipher_tfm(tfm),
707 dst, src);
352} 708}
353 709
354static inline int crypto_cipher_setkey(struct crypto_tfm *tfm, 710void crypto_digest_init(struct crypto_tfm *tfm) __deprecated_for_modules;
711void crypto_digest_update(struct crypto_tfm *tfm,
712 struct scatterlist *sg, unsigned int nsg)
713 __deprecated_for_modules;
714void crypto_digest_final(struct crypto_tfm *tfm, u8 *out)
715 __deprecated_for_modules;
716void crypto_digest_digest(struct crypto_tfm *tfm,
717 struct scatterlist *sg, unsigned int nsg, u8 *out)
718 __deprecated_for_modules;
719
720static inline struct crypto_hash *__crypto_hash_cast(struct crypto_tfm *tfm)
721{
722 return (struct crypto_hash *)tfm;
723}
724
725static inline struct crypto_hash *crypto_hash_cast(struct crypto_tfm *tfm)
726{
727 BUG_ON((crypto_tfm_alg_type(tfm) ^ CRYPTO_ALG_TYPE_HASH) &
728 CRYPTO_ALG_TYPE_HASH_MASK);
729 return __crypto_hash_cast(tfm);
730}
731
732static int crypto_digest_setkey(struct crypto_tfm *tfm, const u8 *key,
733 unsigned int keylen) __deprecated;
734static inline int crypto_digest_setkey(struct crypto_tfm *tfm,
355 const u8 *key, unsigned int keylen) 735 const u8 *key, unsigned int keylen)
356{ 736{
357 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 737 return tfm->crt_hash.setkey(crypto_hash_cast(tfm), key, keylen);
358 return tfm->crt_cipher.cit_setkey(tfm, key, keylen);
359} 738}
360 739
740static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name,
741 u32 type, u32 mask)
742{
743 type &= ~CRYPTO_ALG_TYPE_MASK;
744 type |= CRYPTO_ALG_TYPE_HASH;
745 mask |= CRYPTO_ALG_TYPE_HASH_MASK;
746
747 return __crypto_hash_cast(crypto_alloc_base(alg_name, type, mask));
748}
749
750static inline struct crypto_tfm *crypto_hash_tfm(struct crypto_hash *tfm)
751{
752 return &tfm->base;
753}
754
755static inline void crypto_free_hash(struct crypto_hash *tfm)
756{
757 crypto_free_tfm(crypto_hash_tfm(tfm));
758}
759
760static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask)
761{
762 type &= ~CRYPTO_ALG_TYPE_MASK;
763 type |= CRYPTO_ALG_TYPE_HASH;
764 mask |= CRYPTO_ALG_TYPE_HASH_MASK;
765
766 return crypto_has_alg(alg_name, type, mask);
767}
768
769static inline struct hash_tfm *crypto_hash_crt(struct crypto_hash *tfm)
770{
771 return &crypto_hash_tfm(tfm)->crt_hash;
772}
773
774static inline unsigned int crypto_hash_blocksize(struct crypto_hash *tfm)
775{
776 return crypto_tfm_alg_blocksize(crypto_hash_tfm(tfm));
777}
778
779static inline unsigned int crypto_hash_alignmask(struct crypto_hash *tfm)
780{
781 return crypto_tfm_alg_alignmask(crypto_hash_tfm(tfm));
782}
783
784static inline unsigned int crypto_hash_digestsize(struct crypto_hash *tfm)
785{
786 return crypto_hash_crt(tfm)->digestsize;
787}
788
789static inline u32 crypto_hash_get_flags(struct crypto_hash *tfm)
790{
791 return crypto_tfm_get_flags(crypto_hash_tfm(tfm));
792}
793
794static inline void crypto_hash_set_flags(struct crypto_hash *tfm, u32 flags)
795{
796 crypto_tfm_set_flags(crypto_hash_tfm(tfm), flags);
797}
798
799static inline void crypto_hash_clear_flags(struct crypto_hash *tfm, u32 flags)
800{
801 crypto_tfm_clear_flags(crypto_hash_tfm(tfm), flags);
802}
803
804static inline int crypto_hash_init(struct hash_desc *desc)
805{
806 return crypto_hash_crt(desc->tfm)->init(desc);
807}
808
809static inline int crypto_hash_update(struct hash_desc *desc,
810 struct scatterlist *sg,
811 unsigned int nbytes)
812{
813 return crypto_hash_crt(desc->tfm)->update(desc, sg, nbytes);
814}
815
816static inline int crypto_hash_final(struct hash_desc *desc, u8 *out)
817{
818 return crypto_hash_crt(desc->tfm)->final(desc, out);
819}
820
821static inline int crypto_hash_digest(struct hash_desc *desc,
822 struct scatterlist *sg,
823 unsigned int nbytes, u8 *out)
824{
825 return crypto_hash_crt(desc->tfm)->digest(desc, sg, nbytes, out);
826}
827
828static inline int crypto_hash_setkey(struct crypto_hash *hash,
829 const u8 *key, unsigned int keylen)
830{
831 return crypto_hash_crt(hash)->setkey(hash, key, keylen);
832}
833
834static int crypto_cipher_encrypt(struct crypto_tfm *tfm,
835 struct scatterlist *dst,
836 struct scatterlist *src,
837 unsigned int nbytes) __deprecated;
361static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, 838static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
362 struct scatterlist *dst, 839 struct scatterlist *dst,
363 struct scatterlist *src, 840 struct scatterlist *src,
@@ -367,16 +844,23 @@ static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
367 return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); 844 return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes);
368} 845}
369 846
847static int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
848 struct scatterlist *dst,
849 struct scatterlist *src,
850 unsigned int nbytes, u8 *iv) __deprecated;
370static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, 851static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
371 struct scatterlist *dst, 852 struct scatterlist *dst,
372 struct scatterlist *src, 853 struct scatterlist *src,
373 unsigned int nbytes, u8 *iv) 854 unsigned int nbytes, u8 *iv)
374{ 855{
375 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 856 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
376 BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
377 return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv); 857 return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv);
378} 858}
379 859
860static int crypto_cipher_decrypt(struct crypto_tfm *tfm,
861 struct scatterlist *dst,
862 struct scatterlist *src,
863 unsigned int nbytes) __deprecated;
380static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, 864static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
381 struct scatterlist *dst, 865 struct scatterlist *dst,
382 struct scatterlist *src, 866 struct scatterlist *src,
@@ -386,16 +870,21 @@ static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
386 return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); 870 return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes);
387} 871}
388 872
873static int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
874 struct scatterlist *dst,
875 struct scatterlist *src,
876 unsigned int nbytes, u8 *iv) __deprecated;
389static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, 877static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
390 struct scatterlist *dst, 878 struct scatterlist *dst,
391 struct scatterlist *src, 879 struct scatterlist *src,
392 unsigned int nbytes, u8 *iv) 880 unsigned int nbytes, u8 *iv)
393{ 881{
394 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 882 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
395 BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
396 return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv); 883 return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv);
397} 884}
398 885
886static void crypto_cipher_set_iv(struct crypto_tfm *tfm,
887 const u8 *src, unsigned int len) __deprecated;
399static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm, 888static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm,
400 const u8 *src, unsigned int len) 889 const u8 *src, unsigned int len)
401{ 890{
@@ -403,6 +892,8 @@ static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm,
403 memcpy(tfm->crt_cipher.cit_iv, src, len); 892 memcpy(tfm->crt_cipher.cit_iv, src, len);
404} 893}
405 894
895static void crypto_cipher_get_iv(struct crypto_tfm *tfm,
896 u8 *dst, unsigned int len) __deprecated;
406static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm, 897static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm,
407 u8 *dst, unsigned int len) 898 u8 *dst, unsigned int len)
408{ 899{
@@ -410,34 +901,70 @@ static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm,
410 memcpy(dst, tfm->crt_cipher.cit_iv, len); 901 memcpy(dst, tfm->crt_cipher.cit_iv, len);
411} 902}
412 903
413static inline int crypto_comp_compress(struct crypto_tfm *tfm, 904static inline struct crypto_comp *__crypto_comp_cast(struct crypto_tfm *tfm)
905{
906 return (struct crypto_comp *)tfm;
907}
908
909static inline struct crypto_comp *crypto_comp_cast(struct crypto_tfm *tfm)
910{
911 BUG_ON((crypto_tfm_alg_type(tfm) ^ CRYPTO_ALG_TYPE_COMPRESS) &
912 CRYPTO_ALG_TYPE_MASK);
913 return __crypto_comp_cast(tfm);
914}
915
916static inline struct crypto_comp *crypto_alloc_comp(const char *alg_name,
917 u32 type, u32 mask)
918{
919 type &= ~CRYPTO_ALG_TYPE_MASK;
920 type |= CRYPTO_ALG_TYPE_COMPRESS;
921 mask |= CRYPTO_ALG_TYPE_MASK;
922
923 return __crypto_comp_cast(crypto_alloc_base(alg_name, type, mask));
924}
925
926static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm)
927{
928 return tfm;
929}
930
931static inline void crypto_free_comp(struct crypto_comp *tfm)
932{
933 crypto_free_tfm(crypto_comp_tfm(tfm));
934}
935
936static inline int crypto_has_comp(const char *alg_name, u32 type, u32 mask)
937{
938 type &= ~CRYPTO_ALG_TYPE_MASK;
939 type |= CRYPTO_ALG_TYPE_COMPRESS;
940 mask |= CRYPTO_ALG_TYPE_MASK;
941
942 return crypto_has_alg(alg_name, type, mask);
943}
944
945static inline const char *crypto_comp_name(struct crypto_comp *tfm)
946{
947 return crypto_tfm_alg_name(crypto_comp_tfm(tfm));
948}
949
950static inline struct compress_tfm *crypto_comp_crt(struct crypto_comp *tfm)
951{
952 return &crypto_comp_tfm(tfm)->crt_compress;
953}
954
955static inline int crypto_comp_compress(struct crypto_comp *tfm,
414 const u8 *src, unsigned int slen, 956 const u8 *src, unsigned int slen,
415 u8 *dst, unsigned int *dlen) 957 u8 *dst, unsigned int *dlen)
416{ 958{
417 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); 959 return crypto_comp_crt(tfm)->cot_compress(tfm, src, slen, dst, dlen);
418 return tfm->crt_compress.cot_compress(tfm, src, slen, dst, dlen);
419} 960}
420 961
421static inline int crypto_comp_decompress(struct crypto_tfm *tfm, 962static inline int crypto_comp_decompress(struct crypto_comp *tfm,
422 const u8 *src, unsigned int slen, 963 const u8 *src, unsigned int slen,
423 u8 *dst, unsigned int *dlen) 964 u8 *dst, unsigned int *dlen)
424{ 965{
425 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); 966 return crypto_comp_crt(tfm)->cot_decompress(tfm, src, slen, dst, dlen);
426 return tfm->crt_compress.cot_decompress(tfm, src, slen, dst, dlen);
427} 967}
428 968
429/*
430 * HMAC support.
431 */
432#ifdef CONFIG_CRYPTO_HMAC
433void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen);
434void crypto_hmac_update(struct crypto_tfm *tfm,
435 struct scatterlist *sg, unsigned int nsg);
436void crypto_hmac_final(struct crypto_tfm *tfm, u8 *key,
437 unsigned int *keylen, u8 *out);
438void crypto_hmac(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen,
439 struct scatterlist *sg, unsigned int nsg, u8 *out);
440#endif /* CONFIG_CRYPTO_HMAC */
441
442#endif /* _LINUX_CRYPTO_H */ 969#endif /* _LINUX_CRYPTO_H */
443 970
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 0dd1610a94a9..44605be59409 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -114,6 +114,18 @@ struct dentry {
114 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ 114 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
115}; 115};
116 116
117/*
118 * dentry->d_lock spinlock nesting subclasses:
119 *
120 * 0: normal
121 * 1: nested
122 */
123enum dentry_d_lock_class
124{
125 DENTRY_D_LOCK_NORMAL, /* implicitly used by plain spin_lock() APIs. */
126 DENTRY_D_LOCK_NESTED
127};
128
117struct dentry_operations { 129struct dentry_operations {
118 int (*d_revalidate)(struct dentry *, struct nameidata *); 130 int (*d_revalidate)(struct dentry *, struct nameidata *);
119 int (*d_hash) (struct dentry *, struct qstr *); 131 int (*d_hash) (struct dentry *, struct qstr *);
@@ -209,6 +221,7 @@ static inline int dname_external(struct dentry *dentry)
209 */ 221 */
210extern void d_instantiate(struct dentry *, struct inode *); 222extern void d_instantiate(struct dentry *, struct inode *);
211extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); 223extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
224extern struct dentry * d_materialise_unique(struct dentry *, struct inode *);
212extern void d_delete(struct dentry *); 225extern void d_delete(struct dentry *);
213 226
214/* allocate/de-allocate */ 227/* allocate/de-allocate */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 676333b9fad0..d6f4ec467a4b 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -169,6 +169,12 @@ enum {
169 DCCPO_MAX_CCID_SPECIFIC = 255, 169 DCCPO_MAX_CCID_SPECIFIC = 255,
170}; 170};
171 171
172/* DCCP CCIDS */
173enum {
174 DCCPC_CCID2 = 2,
175 DCCPC_CCID3 = 3,
176};
177
172/* DCCP features */ 178/* DCCP features */
173enum { 179enum {
174 DCCPF_RESERVED = 0, 180 DCCPF_RESERVED = 0,
@@ -320,7 +326,7 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
320/* initial values for each feature */ 326/* initial values for each feature */
321#define DCCPF_INITIAL_SEQUENCE_WINDOW 100 327#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
322#define DCCPF_INITIAL_ACK_RATIO 2 328#define DCCPF_INITIAL_ACK_RATIO 2
323#define DCCPF_INITIAL_CCID 2 329#define DCCPF_INITIAL_CCID DCCPC_CCID2
324#define DCCPF_INITIAL_SEND_ACK_VECTOR 1 330#define DCCPF_INITIAL_SEND_ACK_VECTOR 1
325/* FIXME: for now we're default to 1 but it should really be 0 */ 331/* FIXME: for now we're default to 1 but it should really be 0 */
326#define DCCPF_INITIAL_SEND_NDP_COUNT 1 332#define DCCPF_INITIAL_SEND_NDP_COUNT 1
@@ -404,6 +410,7 @@ struct dccp_service_list {
404}; 410};
405 411
406#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1) 412#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1)
413#define DCCP_SERVICE_CODE_IS_ABSENT 0
407 414
408static inline int dccp_list_has_service(const struct dccp_service_list *sl, 415static inline int dccp_list_has_service(const struct dccp_service_list *sl,
409 const __be32 service) 416 const __be32 service)
@@ -438,6 +445,7 @@ struct dccp_ackvec;
438 * @dccps_role - Role of this sock, one of %dccp_role 445 * @dccps_role - Role of this sock, one of %dccp_role
439 * @dccps_ndp_count - number of Non Data Packets since last data packet 446 * @dccps_ndp_count - number of Non Data Packets since last data packet
440 * @dccps_hc_rx_ackvec - rx half connection ack vector 447 * @dccps_hc_rx_ackvec - rx half connection ack vector
448 * @dccps_xmit_timer - timer for when CCID is not ready to send
441 */ 449 */
442struct dccp_sock { 450struct dccp_sock {
443 /* inet_connection_sock has to be the first member of dccp_sock */ 451 /* inet_connection_sock has to be the first member of dccp_sock */
@@ -470,6 +478,7 @@ struct dccp_sock {
470 enum dccp_role dccps_role:2; 478 enum dccp_role dccps_role:2;
471 __u8 dccps_hc_rx_insert_options:1; 479 __u8 dccps_hc_rx_insert_options:1;
472 __u8 dccps_hc_tx_insert_options:1; 480 __u8 dccps_hc_tx_insert_options:1;
481 struct timer_list dccps_xmit_timer;
473}; 482};
474 483
475static inline struct dccp_sock *dccp_sk(const struct sock *sk) 484static inline struct dccp_sock *dccp_sk(const struct sock *sk)
@@ -482,11 +491,6 @@ static inline struct dccp_minisock *dccp_msk(const struct sock *sk)
482 return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock; 491 return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock;
483} 492}
484 493
485static inline int dccp_service_not_initialized(const struct sock *sk)
486{
487 return dccp_sk(sk)->dccps_service == DCCP_SERVICE_INVALID_VALUE;
488}
489
490static inline const char *dccp_role(const struct sock *sk) 494static inline const char *dccp_role(const struct sock *sk)
491{ 495{
492 switch (dccp_sk(sk)->dccps_role) { 496 switch (dccp_sk(sk)->dccps_role) {
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
new file mode 100644
index 000000000000..88dafa246d87
--- /dev/null
+++ b/include/linux/debug_locks.h
@@ -0,0 +1,71 @@
1#ifndef __LINUX_DEBUG_LOCKING_H
2#define __LINUX_DEBUG_LOCKING_H
3
4struct task_struct;
5
6extern int debug_locks;
7extern int debug_locks_silent;
8
9/*
10 * Generic 'turn off all lock debugging' function:
11 */
12extern int debug_locks_off(void);
13
14/*
15 * In the debug case we carry the caller's instruction pointer into
16 * other functions, but we dont want the function argument overhead
17 * in the nondebug case - hence these macros:
18 */
19#define _RET_IP_ (unsigned long)__builtin_return_address(0)
20#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
21
22#define DEBUG_LOCKS_WARN_ON(c) \
23({ \
24 int __ret = 0; \
25 \
26 if (unlikely(c)) { \
27 if (debug_locks_off()) \
28 WARN_ON(1); \
29 __ret = 1; \
30 } \
31 __ret; \
32})
33
34#ifdef CONFIG_SMP
35# define SMP_DEBUG_LOCKS_WARN_ON(c) DEBUG_LOCKS_WARN_ON(c)
36#else
37# define SMP_DEBUG_LOCKS_WARN_ON(c) do { } while (0)
38#endif
39
40#ifdef CONFIG_DEBUG_LOCKING_API_SELFTESTS
41 extern void locking_selftest(void);
42#else
43# define locking_selftest() do { } while (0)
44#endif
45
46#ifdef CONFIG_LOCKDEP
47extern void debug_show_all_locks(void);
48extern void debug_show_held_locks(struct task_struct *task);
49extern void debug_check_no_locks_freed(const void *from, unsigned long len);
50extern void debug_check_no_locks_held(struct task_struct *task);
51#else
52static inline void debug_show_all_locks(void)
53{
54}
55
56static inline void debug_show_held_locks(struct task_struct *task)
57{
58}
59
60static inline void
61debug_check_no_locks_freed(const void *from, unsigned long len)
62{
63}
64
65static inline void
66debug_check_no_locks_held(struct task_struct *task)
67{
68}
69#endif
70
71#endif
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
new file mode 100644
index 000000000000..561e2a77805c
--- /dev/null
+++ b/include/linux/delayacct.h
@@ -0,0 +1,121 @@
1/* delayacct.h - per-task delay accounting
2 *
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 * the GNU General Public License for more details.
14 *
15 */
16
17#ifndef _LINUX_DELAYACCT_H
18#define _LINUX_DELAYACCT_H
19
20#include <linux/sched.h>
21#include <linux/taskstats_kern.h>
22
23/*
24 * Per-task flags relevant to delay accounting
25 * maintained privately to avoid exhausting similar flags in sched.h:PF_*
26 * Used to set current->delays->flags
27 */
28#define DELAYACCT_PF_SWAPIN 0x00000001 /* I am doing a swapin */
29
30#ifdef CONFIG_TASK_DELAY_ACCT
31
32extern int delayacct_on; /* Delay accounting turned on/off */
33extern kmem_cache_t *delayacct_cache;
34extern void delayacct_init(void);
35extern void __delayacct_tsk_init(struct task_struct *);
36extern void __delayacct_tsk_exit(struct task_struct *);
37extern void __delayacct_blkio_start(void);
38extern void __delayacct_blkio_end(void);
39extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *);
40extern __u64 __delayacct_blkio_ticks(struct task_struct *);
41
42static inline void delayacct_set_flag(int flag)
43{
44 if (current->delays)
45 current->delays->flags |= flag;
46}
47
48static inline void delayacct_clear_flag(int flag)
49{
50 if (current->delays)
51 current->delays->flags &= ~flag;
52}
53
54static inline void delayacct_tsk_init(struct task_struct *tsk)
55{
56 /* reinitialize in case parent's non-null pointer was dup'ed*/
57 tsk->delays = NULL;
58 if (delayacct_on)
59 __delayacct_tsk_init(tsk);
60}
61
62/* Free tsk->delays. Called from bad fork and __put_task_struct
63 * where there's no risk of tsk->delays being accessed elsewhere
64 */
65static inline void delayacct_tsk_free(struct task_struct *tsk)
66{
67 if (tsk->delays)
68 kmem_cache_free(delayacct_cache, tsk->delays);
69 tsk->delays = NULL;
70}
71
72static inline void delayacct_blkio_start(void)
73{
74 if (current->delays)
75 __delayacct_blkio_start();
76}
77
78static inline void delayacct_blkio_end(void)
79{
80 if (current->delays)
81 __delayacct_blkio_end();
82}
83
84static inline int delayacct_add_tsk(struct taskstats *d,
85 struct task_struct *tsk)
86{
87 if (!delayacct_on || !tsk->delays)
88 return 0;
89 return __delayacct_add_tsk(d, tsk);
90}
91
92static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk)
93{
94 if (tsk->delays)
95 return __delayacct_blkio_ticks(tsk);
96 return 0;
97}
98
99#else
100static inline void delayacct_set_flag(int flag)
101{}
102static inline void delayacct_clear_flag(int flag)
103{}
104static inline void delayacct_init(void)
105{}
106static inline void delayacct_tsk_init(struct task_struct *tsk)
107{}
108static inline void delayacct_tsk_free(struct task_struct *tsk)
109{}
110static inline void delayacct_blkio_start(void)
111{}
112static inline void delayacct_blkio_end(void)
113{}
114static inline int delayacct_add_tsk(struct taskstats *d,
115 struct task_struct *tsk)
116{ return 0; }
117static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk)
118{ return 0; }
119#endif /* CONFIG_TASK_DELAY_ACCT */
120
121#endif
diff --git a/include/linux/devfs_fs.h b/include/linux/devfs_fs.h
deleted file mode 100644
index de236f431877..000000000000
--- a/include/linux/devfs_fs.h
+++ /dev/null
@@ -1,41 +0,0 @@
1#ifndef _LINUX_DEVFS_FS_H
2#define _LINUX_DEVFS_FS_H
3
4#include <linux/ioctl.h>
5
6#define DEVFSD_PROTOCOL_REVISION_KERNEL 5
7
8#define DEVFSD_IOCTL_BASE 'd'
9
10/* These are the various ioctls */
11#define DEVFSDIOC_GET_PROTO_REV _IOR(DEVFSD_IOCTL_BASE, 0, int)
12#define DEVFSDIOC_SET_EVENT_MASK _IOW(DEVFSD_IOCTL_BASE, 2, int)
13#define DEVFSDIOC_RELEASE_EVENT_QUEUE _IOW(DEVFSD_IOCTL_BASE, 3, int)
14#define DEVFSDIOC_SET_DEBUG_MASK _IOW(DEVFSD_IOCTL_BASE, 4, int)
15
16#define DEVFSD_NOTIFY_REGISTERED 0
17#define DEVFSD_NOTIFY_UNREGISTERED 1
18#define DEVFSD_NOTIFY_ASYNC_OPEN 2
19#define DEVFSD_NOTIFY_CLOSE 3
20#define DEVFSD_NOTIFY_LOOKUP 4
21#define DEVFSD_NOTIFY_CHANGE 5
22#define DEVFSD_NOTIFY_CREATE 6
23#define DEVFSD_NOTIFY_DELETE 7
24
25#define DEVFS_PATHLEN 1024 /* Never change this otherwise the
26 binary interface will change */
27
28struct devfsd_notify_struct { /* Use native C types to ensure same types in kernel and user space */
29 unsigned int type; /* DEVFSD_NOTIFY_* value */
30 unsigned int mode; /* Mode of the inode or device entry */
31 unsigned int major; /* Major number of device entry */
32 unsigned int minor; /* Minor number of device entry */
33 unsigned int uid; /* Uid of process, inode or device entry */
34 unsigned int gid; /* Gid of process, inode or device entry */
35 unsigned int overrun_count; /* Number of lost events */
36 unsigned int namelen; /* Number of characters not including '\0' */
37 /* The device name MUST come last */
38 char devname[DEVFS_PATHLEN]; /* This will be '\0' terminated */
39};
40
41#endif /* _LINUX_DEVFS_FS_H */
diff --git a/include/linux/devfs_fs_kernel.h b/include/linux/devfs_fs_kernel.h
deleted file mode 100644
index 0d74a6f22abc..000000000000
--- a/include/linux/devfs_fs_kernel.h
+++ /dev/null
@@ -1,57 +0,0 @@
1#ifndef _LINUX_DEVFS_FS_KERNEL_H
2#define _LINUX_DEVFS_FS_KERNEL_H
3
4#include <linux/fs.h>
5#include <linux/spinlock.h>
6#include <linux/types.h>
7
8#include <asm/semaphore.h>
9
10#define DEVFS_SUPER_MAGIC 0x1373
11
12#ifdef CONFIG_DEVFS_FS
13extern int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...)
14 __attribute__ ((format(printf, 3, 4)));
15extern int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...)
16 __attribute__ ((format(printf, 3, 4)));
17extern int devfs_mk_symlink(const char *name, const char *link);
18extern int devfs_mk_dir(const char *fmt, ...)
19 __attribute__ ((format(printf, 1, 2)));
20extern void devfs_remove(const char *fmt, ...)
21 __attribute__ ((format(printf, 1, 2)));
22extern int devfs_register_tape(const char *name);
23extern void devfs_unregister_tape(int num);
24extern void mount_devfs_fs(void);
25#else /* CONFIG_DEVFS_FS */
26static inline int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...)
27{
28 return 0;
29}
30static inline int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...)
31{
32 return 0;
33}
34static inline int devfs_mk_symlink(const char *name, const char *link)
35{
36 return 0;
37}
38static inline int devfs_mk_dir(const char *fmt, ...)
39{
40 return 0;
41}
42static inline void devfs_remove(const char *fmt, ...)
43{
44}
45static inline int devfs_register_tape(const char *name)
46{
47 return -1;
48}
49static inline void devfs_unregister_tape(int num)
50{
51}
52static inline void mount_devfs_fs(void)
53{
54 return;
55}
56#endif /* CONFIG_DEVFS_FS */
57#endif /* _LINUX_DEVFS_FS_KERNEL_H */
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index aee10b2ea4c6..e3d1c33d1558 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -8,9 +8,12 @@
8#ifndef _LINUX_DEVICE_MAPPER_H 8#ifndef _LINUX_DEVICE_MAPPER_H
9#define _LINUX_DEVICE_MAPPER_H 9#define _LINUX_DEVICE_MAPPER_H
10 10
11#ifdef __KERNEL__
12
11struct dm_target; 13struct dm_target;
12struct dm_table; 14struct dm_table;
13struct dm_dev; 15struct dm_dev;
16struct mapped_device;
14 17
15typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; 18typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
16 19
@@ -78,7 +81,7 @@ void dm_put_device(struct dm_target *ti, struct dm_dev *d);
78struct target_type { 81struct target_type {
79 const char *name; 82 const char *name;
80 struct module *module; 83 struct module *module;
81 unsigned version[3]; 84 unsigned version[3];
82 dm_ctr_fn ctr; 85 dm_ctr_fn ctr;
83 dm_dtr_fn dtr; 86 dm_dtr_fn dtr;
84 dm_map_fn map; 87 dm_map_fn map;
@@ -128,4 +131,108 @@ struct dm_target {
128int dm_register_target(struct target_type *t); 131int dm_register_target(struct target_type *t);
129int dm_unregister_target(struct target_type *t); 132int dm_unregister_target(struct target_type *t);
130 133
131#endif /* _LINUX_DEVICE_MAPPER_H */ 134
135/*-----------------------------------------------------------------
136 * Functions for creating and manipulating mapped devices.
137 * Drop the reference with dm_put when you finish with the object.
138 *---------------------------------------------------------------*/
139
140/*
141 * DM_ANY_MINOR chooses the next available minor number.
142 */
143#define DM_ANY_MINOR (-1)
144int dm_create(int minor, struct mapped_device **md);
145
146/*
147 * Reference counting for md.
148 */
149struct mapped_device *dm_get_md(dev_t dev);
150void dm_get(struct mapped_device *md);
151void dm_put(struct mapped_device *md);
152
153/*
154 * An arbitrary pointer may be stored alongside a mapped device.
155 */
156void dm_set_mdptr(struct mapped_device *md, void *ptr);
157void *dm_get_mdptr(struct mapped_device *md);
158
159/*
160 * A device can still be used while suspended, but I/O is deferred.
161 */
162int dm_suspend(struct mapped_device *md, int with_lockfs);
163int dm_resume(struct mapped_device *md);
164
165/*
166 * Event functions.
167 */
168uint32_t dm_get_event_nr(struct mapped_device *md);
169int dm_wait_event(struct mapped_device *md, int event_nr);
170
171/*
172 * Info functions.
173 */
174const char *dm_device_name(struct mapped_device *md);
175struct gendisk *dm_disk(struct mapped_device *md);
176int dm_suspended(struct mapped_device *md);
177
178/*
179 * Geometry functions.
180 */
181int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo);
182int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo);
183
184
185/*-----------------------------------------------------------------
186 * Functions for manipulating device-mapper tables.
187 *---------------------------------------------------------------*/
188
189/*
190 * First create an empty table.
191 */
192int dm_table_create(struct dm_table **result, int mode,
193 unsigned num_targets, struct mapped_device *md);
194
195/*
196 * Then call this once for each target.
197 */
198int dm_table_add_target(struct dm_table *t, const char *type,
199 sector_t start, sector_t len, char *params);
200
201/*
202 * Finally call this to make the table ready for use.
203 */
204int dm_table_complete(struct dm_table *t);
205
206/*
207 * Table reference counting.
208 */
209struct dm_table *dm_get_table(struct mapped_device *md);
210void dm_table_get(struct dm_table *t);
211void dm_table_put(struct dm_table *t);
212
213/*
214 * Queries
215 */
216sector_t dm_table_get_size(struct dm_table *t);
217unsigned int dm_table_get_num_targets(struct dm_table *t);
218int dm_table_get_mode(struct dm_table *t);
219struct mapped_device *dm_table_get_md(struct dm_table *t);
220
221/*
222 * Trigger an event.
223 */
224void dm_table_event(struct dm_table *t);
225
226/*
227 * The device must be suspended before calling this method.
228 */
229int dm_swap_table(struct mapped_device *md, struct dm_table *t);
230
231/*
232 * Prepare a table for a device that will error all I/O.
233 * To make it active, call dm_suspend(), dm_swap_table() then dm_resume().
234 */
235int dm_create_error_table(struct dm_table **result, struct mapped_device *md);
236
237#endif /* __KERNEL__ */
238#endif /* _LINUX_DEVICE_MAPPER_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index 1e5f30da98bc..662e6a10144e 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -15,6 +15,7 @@
15#include <linux/kobject.h> 15#include <linux/kobject.h>
16#include <linux/klist.h> 16#include <linux/klist.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/compiler.h>
18#include <linux/types.h> 19#include <linux/types.h>
19#include <linux/module.h> 20#include <linux/module.h>
20#include <linux/pm.h> 21#include <linux/pm.h>
@@ -51,14 +52,17 @@ struct bus_type {
51 int (*probe)(struct device * dev); 52 int (*probe)(struct device * dev);
52 int (*remove)(struct device * dev); 53 int (*remove)(struct device * dev);
53 void (*shutdown)(struct device * dev); 54 void (*shutdown)(struct device * dev);
54 int (*suspend)(struct device * dev, pm_message_t state); 55
55 int (*resume)(struct device * dev); 56 int (*suspend)(struct device * dev, pm_message_t state);
57 int (*suspend_late)(struct device * dev, pm_message_t state);
58 int (*resume_early)(struct device * dev);
59 int (*resume)(struct device * dev);
56}; 60};
57 61
58extern int bus_register(struct bus_type * bus); 62extern int __must_check bus_register(struct bus_type * bus);
59extern void bus_unregister(struct bus_type * bus); 63extern void bus_unregister(struct bus_type * bus);
60 64
61extern void bus_rescan_devices(struct bus_type * bus); 65extern int __must_check bus_rescan_devices(struct bus_type * bus);
62 66
63/* iterator helpers for buses */ 67/* iterator helpers for buses */
64 68
@@ -67,9 +71,9 @@ int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data,
67struct device * bus_find_device(struct bus_type *bus, struct device *start, 71struct device * bus_find_device(struct bus_type *bus, struct device *start,
68 void *data, int (*match)(struct device *, void *)); 72 void *data, int (*match)(struct device *, void *));
69 73
70int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, 74int __must_check bus_for_each_drv(struct bus_type *bus,
71 void * data, int (*fn)(struct device_driver *, void *)); 75 struct device_driver *start, void *data,
72 76 int (*fn)(struct device_driver *, void *));
73 77
74/* driverfs interface for exporting bus attributes */ 78/* driverfs interface for exporting bus attributes */
75 79
@@ -82,7 +86,8 @@ struct bus_attribute {
82#define BUS_ATTR(_name,_mode,_show,_store) \ 86#define BUS_ATTR(_name,_mode,_show,_store) \
83struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) 87struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store)
84 88
85extern int bus_create_file(struct bus_type *, struct bus_attribute *); 89extern int __must_check bus_create_file(struct bus_type *,
90 struct bus_attribute *);
86extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 91extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
87 92
88struct device_driver { 93struct device_driver {
@@ -101,16 +106,18 @@ struct device_driver {
101 void (*shutdown) (struct device * dev); 106 void (*shutdown) (struct device * dev);
102 int (*suspend) (struct device * dev, pm_message_t state); 107 int (*suspend) (struct device * dev, pm_message_t state);
103 int (*resume) (struct device * dev); 108 int (*resume) (struct device * dev);
109
110 unsigned int multithread_probe:1;
104}; 111};
105 112
106 113
107extern int driver_register(struct device_driver * drv); 114extern int __must_check driver_register(struct device_driver * drv);
108extern void driver_unregister(struct device_driver * drv); 115extern void driver_unregister(struct device_driver * drv);
109 116
110extern struct device_driver * get_driver(struct device_driver * drv); 117extern struct device_driver * get_driver(struct device_driver * drv);
111extern void put_driver(struct device_driver * drv); 118extern void put_driver(struct device_driver * drv);
112extern struct device_driver *driver_find(const char *name, struct bus_type *bus); 119extern struct device_driver *driver_find(const char *name, struct bus_type *bus);
113 120extern int driver_probe_done(void);
114 121
115/* driverfs interface for exporting driver attributes */ 122/* driverfs interface for exporting driver attributes */
116 123
@@ -123,16 +130,17 @@ struct driver_attribute {
123#define DRIVER_ATTR(_name,_mode,_show,_store) \ 130#define DRIVER_ATTR(_name,_mode,_show,_store) \
124struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) 131struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store)
125 132
126extern int driver_create_file(struct device_driver *, struct driver_attribute *); 133extern int __must_check driver_create_file(struct device_driver *,
134 struct driver_attribute *);
127extern void driver_remove_file(struct device_driver *, struct driver_attribute *); 135extern void driver_remove_file(struct device_driver *, struct driver_attribute *);
128 136
129extern int driver_for_each_device(struct device_driver * drv, struct device * start, 137extern int __must_check driver_for_each_device(struct device_driver * drv,
130 void * data, int (*fn)(struct device *, void *)); 138 struct device *start, void *data,
139 int (*fn)(struct device *, void *));
131struct device * driver_find_device(struct device_driver *drv, 140struct device * driver_find_device(struct device_driver *drv,
132 struct device *start, void *data, 141 struct device *start, void *data,
133 int (*match)(struct device *, void *)); 142 int (*match)(struct device *, void *));
134 143
135
136/* 144/*
137 * device classes 145 * device classes
138 */ 146 */
@@ -146,17 +154,26 @@ struct class {
146 struct list_head interfaces; 154 struct list_head interfaces;
147 struct semaphore sem; /* locks both the children and interfaces lists */ 155 struct semaphore sem; /* locks both the children and interfaces lists */
148 156
157 struct kobject *virtual_dir;
158
149 struct class_attribute * class_attrs; 159 struct class_attribute * class_attrs;
150 struct class_device_attribute * class_dev_attrs; 160 struct class_device_attribute * class_dev_attrs;
161 struct device_attribute * dev_attrs;
151 162
152 int (*uevent)(struct class_device *dev, char **envp, 163 int (*uevent)(struct class_device *dev, char **envp,
153 int num_envp, char *buffer, int buffer_size); 164 int num_envp, char *buffer, int buffer_size);
165 int (*dev_uevent)(struct device *dev, char **envp, int num_envp,
166 char *buffer, int buffer_size);
154 167
155 void (*release)(struct class_device *dev); 168 void (*release)(struct class_device *dev);
156 void (*class_release)(struct class *class); 169 void (*class_release)(struct class *class);
170 void (*dev_release)(struct device *dev);
171
172 int (*suspend)(struct device *, pm_message_t state);
173 int (*resume)(struct device *);
157}; 174};
158 175
159extern int class_register(struct class *); 176extern int __must_check class_register(struct class *);
160extern void class_unregister(struct class *); 177extern void class_unregister(struct class *);
161 178
162 179
@@ -169,7 +186,8 @@ struct class_attribute {
169#define CLASS_ATTR(_name,_mode,_show,_store) \ 186#define CLASS_ATTR(_name,_mode,_show,_store) \
170struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) 187struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store)
171 188
172extern int class_create_file(struct class *, const struct class_attribute *); 189extern int __must_check class_create_file(struct class *,
190 const struct class_attribute *);
173extern void class_remove_file(struct class *, const struct class_attribute *); 191extern void class_remove_file(struct class *, const struct class_attribute *);
174 192
175struct class_device_attribute { 193struct class_device_attribute {
@@ -182,7 +200,7 @@ struct class_device_attribute {
182struct class_device_attribute class_device_attr_##_name = \ 200struct class_device_attribute class_device_attr_##_name = \
183 __ATTR(_name,_mode,_show,_store) 201 __ATTR(_name,_mode,_show,_store)
184 202
185extern int class_device_create_file(struct class_device *, 203extern int __must_check class_device_create_file(struct class_device *,
186 const struct class_device_attribute *); 204 const struct class_device_attribute *);
187 205
188/** 206/**
@@ -242,10 +260,10 @@ class_set_devdata (struct class_device *dev, void *data)
242} 260}
243 261
244 262
245extern int class_device_register(struct class_device *); 263extern int __must_check class_device_register(struct class_device *);
246extern void class_device_unregister(struct class_device *); 264extern void class_device_unregister(struct class_device *);
247extern void class_device_initialize(struct class_device *); 265extern void class_device_initialize(struct class_device *);
248extern int class_device_add(struct class_device *); 266extern int __must_check class_device_add(struct class_device *);
249extern void class_device_del(struct class_device *); 267extern void class_device_del(struct class_device *);
250 268
251extern int class_device_rename(struct class_device *, char *); 269extern int class_device_rename(struct class_device *, char *);
@@ -255,7 +273,7 @@ extern void class_device_put(struct class_device *);
255 273
256extern void class_device_remove_file(struct class_device *, 274extern void class_device_remove_file(struct class_device *,
257 const struct class_device_attribute *); 275 const struct class_device_attribute *);
258extern int class_device_create_bin_file(struct class_device *, 276extern int __must_check class_device_create_bin_file(struct class_device *,
259 struct bin_attribute *); 277 struct bin_attribute *);
260extern void class_device_remove_bin_file(struct class_device *, 278extern void class_device_remove_bin_file(struct class_device *,
261 struct bin_attribute *); 279 struct bin_attribute *);
@@ -266,22 +284,23 @@ struct class_interface {
266 284
267 int (*add) (struct class_device *, struct class_interface *); 285 int (*add) (struct class_device *, struct class_interface *);
268 void (*remove) (struct class_device *, struct class_interface *); 286 void (*remove) (struct class_device *, struct class_interface *);
287 int (*add_dev) (struct device *, struct class_interface *);
288 void (*remove_dev) (struct device *, struct class_interface *);
269}; 289};
270 290
271extern int class_interface_register(struct class_interface *); 291extern int __must_check class_interface_register(struct class_interface *);
272extern void class_interface_unregister(struct class_interface *); 292extern void class_interface_unregister(struct class_interface *);
273 293
274extern struct class *class_create(struct module *owner, char *name); 294extern struct class *class_create(struct module *owner, const char *name);
275extern void class_destroy(struct class *cls); 295extern void class_destroy(struct class *cls);
276extern struct class_device *class_device_create(struct class *cls, 296extern struct class_device *class_device_create(struct class *cls,
277 struct class_device *parent, 297 struct class_device *parent,
278 dev_t devt, 298 dev_t devt,
279 struct device *device, 299 struct device *device,
280 char *fmt, ...) 300 const char *fmt, ...)
281 __attribute__((format(printf,5,6))); 301 __attribute__((format(printf,5,6)));
282extern void class_device_destroy(struct class *cls, dev_t devt); 302extern void class_device_destroy(struct class *cls, dev_t devt);
283 303
284
285/* interface for exporting device attributes */ 304/* interface for exporting device attributes */
286struct device_attribute { 305struct device_attribute {
287 struct attribute attr; 306 struct attribute attr;
@@ -294,8 +313,13 @@ struct device_attribute {
294#define DEVICE_ATTR(_name,_mode,_show,_store) \ 313#define DEVICE_ATTR(_name,_mode,_show,_store) \
295struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) 314struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store)
296 315
297extern int device_create_file(struct device *device, struct device_attribute * entry); 316extern int __must_check device_create_file(struct device *device,
317 struct device_attribute * entry);
298extern void device_remove_file(struct device * dev, struct device_attribute * attr); 318extern void device_remove_file(struct device * dev, struct device_attribute * attr);
319extern int __must_check device_create_bin_file(struct device *dev,
320 struct bin_attribute *attr);
321extern void device_remove_bin_file(struct device *dev,
322 struct bin_attribute *attr);
299struct device { 323struct device {
300 struct klist klist_children; 324 struct klist klist_children;
301 struct klist_node knode_parent; /* node in sibling list */ 325 struct klist_node knode_parent; /* node in sibling list */
@@ -305,6 +329,7 @@ struct device {
305 329
306 struct kobject kobj; 330 struct kobject kobj;
307 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 331 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
332 unsigned is_registered:1;
308 struct device_attribute uevent_attr; 333 struct device_attribute uevent_attr;
309 struct device_attribute *devt_attr; 334 struct device_attribute *devt_attr;
310 335
@@ -338,6 +363,7 @@ struct device {
338 struct list_head node; 363 struct list_head node;
339 struct class *class; /* optional*/ 364 struct class *class; /* optional*/
340 dev_t devt; /* dev_t, creates the sysfs "dev" */ 365 dev_t devt; /* dev_t, creates the sysfs "dev" */
366 struct attribute_group **groups; /* optional groups */
341 367
342 void (*release)(struct device * dev); 368 void (*release)(struct device * dev);
343}; 369};
@@ -356,38 +382,41 @@ dev_set_drvdata (struct device *dev, void *data)
356 382
357static inline int device_is_registered(struct device *dev) 383static inline int device_is_registered(struct device *dev)
358{ 384{
359 return klist_node_attached(&dev->knode_bus); 385 return dev->is_registered;
360} 386}
361 387
362/* 388/*
363 * High level routines for use by the bus drivers 389 * High level routines for use by the bus drivers
364 */ 390 */
365extern int device_register(struct device * dev); 391extern int __must_check device_register(struct device * dev);
366extern void device_unregister(struct device * dev); 392extern void device_unregister(struct device * dev);
367extern void device_initialize(struct device * dev); 393extern void device_initialize(struct device * dev);
368extern int device_add(struct device * dev); 394extern int __must_check device_add(struct device * dev);
369extern void device_del(struct device * dev); 395extern void device_del(struct device * dev);
370extern int device_for_each_child(struct device *, void *, 396extern int __must_check device_for_each_child(struct device *, void *,
371 int (*fn)(struct device *, void *)); 397 int (*fn)(struct device *, void *));
398extern int device_rename(struct device *dev, char *new_name);
372 399
373/* 400/*
374 * Manual binding of a device to driver. See drivers/base/bus.c 401 * Manual binding of a device to driver. See drivers/base/bus.c
375 * for information on use. 402 * for information on use.
376 */ 403 */
377extern void device_bind_driver(struct device * dev); 404extern int __must_check device_bind_driver(struct device *dev);
378extern void device_release_driver(struct device * dev); 405extern void device_release_driver(struct device * dev);
379extern int device_attach(struct device * dev); 406extern int __must_check device_attach(struct device * dev);
380extern void driver_attach(struct device_driver * drv); 407extern int __must_check driver_attach(struct device_driver *drv);
381extern void device_reprobe(struct device *dev); 408extern int __must_check device_reprobe(struct device *dev);
382 409
383/* 410/*
384 * Easy functions for dynamically creating devices on the fly 411 * Easy functions for dynamically creating devices on the fly
385 */ 412 */
386extern struct device *device_create(struct class *cls, struct device *parent, 413extern struct device *device_create(struct class *cls, struct device *parent,
387 dev_t devt, char *fmt, ...) 414 dev_t devt, const char *fmt, ...)
388 __attribute__((format(printf,4,5))); 415 __attribute__((format(printf,4,5)));
389extern void device_destroy(struct class *cls, dev_t devt); 416extern void device_destroy(struct class *cls, dev_t devt);
390 417
418extern int virtual_device_parent(struct device *dev);
419
391/* 420/*
392 * Platform "fixup" functions - allow the platform to have their say 421 * Platform "fixup" functions - allow the platform to have their say
393 * about devices and actions that the general device layer doesn't 422 * about devices and actions that the general device layer doesn't
@@ -412,7 +441,7 @@ extern void device_shutdown(void);
412 441
413 442
414/* drivers/base/firmware.c */ 443/* drivers/base/firmware.c */
415extern int firmware_register(struct subsystem *); 444extern int __must_check firmware_register(struct subsystem *);
416extern void firmware_unregister(struct subsystem *); 445extern void firmware_unregister(struct subsystem *);
417 446
418/* debugging and troubleshooting/diagnostic helpers. */ 447/* debugging and troubleshooting/diagnostic helpers. */
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index c67c6786612a..9623bb625090 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -285,9 +285,9 @@ typedef char ioctl_struct[308];
285#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 285#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
286 286
287#define DM_VERSION_MAJOR 4 287#define DM_VERSION_MAJOR 4
288#define DM_VERSION_MINOR 6 288#define DM_VERSION_MINOR 7
289#define DM_VERSION_PATCHLEVEL 0 289#define DM_VERSION_PATCHLEVEL 0
290#define DM_VERSION_EXTRA "-ioctl (2006-02-17)" 290#define DM_VERSION_EXTRA "-ioctl (2006-06-24)"
291 291
292/* Status bits */ 292/* Status bits */
293#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 293#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -314,7 +314,7 @@ typedef char ioctl_struct[308];
314#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */ 314#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */
315 315
316/* 316/*
317 * Set this to improve performance when you aren't going to use open_count. 317 * This flag is now ignored.
318 */ 318 */
319#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */ 319#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */
320 320
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 635690cf3e3d..ff203c465fed 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -24,6 +24,13 @@ enum dma_data_direction {
24#define DMA_28BIT_MASK 0x000000000fffffffULL 24#define DMA_28BIT_MASK 0x000000000fffffffULL
25#define DMA_24BIT_MASK 0x0000000000ffffffULL 25#define DMA_24BIT_MASK 0x0000000000ffffffULL
26 26
27static inline int valid_dma_direction(int dma_direction)
28{
29 return ((dma_direction == DMA_BIDIRECTIONAL) ||
30 (dma_direction == DMA_TO_DEVICE) ||
31 (dma_direction == DMA_FROM_DEVICE));
32}
33
27#include <asm/dma-mapping.h> 34#include <asm/dma-mapping.h>
28 35
29/* Backwards compat, remove in 2.7.x */ 36/* Backwards compat, remove in 2.7.x */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 78b236ca04f8..c94d8f1d62e5 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -20,7 +20,7 @@
20 */ 20 */
21#ifndef DMAENGINE_H 21#ifndef DMAENGINE_H
22#define DMAENGINE_H 22#define DMAENGINE_H
23#include <linux/config.h> 23
24#ifdef CONFIG_DMA_ENGINE 24#ifdef CONFIG_DMA_ENGINE
25 25
26#include <linux/device.h> 26#include <linux/device.h>
@@ -44,7 +44,7 @@ enum dma_event {
44}; 44};
45 45
46/** 46/**
47 * typedef dma_cookie_t 47 * typedef dma_cookie_t - an opaque DMA cookie
48 * 48 *
49 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code 49 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code
50 */ 50 */
@@ -80,14 +80,14 @@ struct dma_chan_percpu {
80 80
81/** 81/**
82 * struct dma_chan - devices supply DMA channels, clients use them 82 * struct dma_chan - devices supply DMA channels, clients use them
83 * @client: ptr to the client user of this chan, will be NULL when unused 83 * @client: ptr to the client user of this chan, will be %NULL when unused
84 * @device: ptr to the dma device who supplies this channel, always !NULL 84 * @device: ptr to the dma device who supplies this channel, always !%NULL
85 * @cookie: last cookie value returned to client 85 * @cookie: last cookie value returned to client
86 * @chan_id: 86 * @chan_id: channel ID for sysfs
87 * @class_dev: 87 * @class_dev: class device for sysfs
88 * @refcount: kref, used in "bigref" slow-mode 88 * @refcount: kref, used in "bigref" slow-mode
89 * @slow_ref: 89 * @slow_ref: indicates that the DMA channel is free
90 * @rcu: 90 * @rcu: the DMA channel's RCU head
91 * @client_node: used to add this to the client chan list 91 * @client_node: used to add this to the client chan list
92 * @device_node: used to add this to the device chan list 92 * @device_node: used to add this to the device chan list
93 * @local: per-cpu pointer to a struct dma_chan_percpu 93 * @local: per-cpu pointer to a struct dma_chan_percpu
@@ -162,10 +162,17 @@ struct dma_client {
162 * @chancnt: how many DMA channels are supported 162 * @chancnt: how many DMA channels are supported
163 * @channels: the list of struct dma_chan 163 * @channels: the list of struct dma_chan
164 * @global_node: list_head for global dma_device_list 164 * @global_node: list_head for global dma_device_list
165 * @refcount: 165 * @refcount: reference count
166 * @done: 166 * @done: IO completion struct
167 * @dev_id: 167 * @dev_id: unique device ID
168 * Other func ptrs: used to make use of this device's capabilities 168 * @device_alloc_chan_resources: allocate resources and return the
169 * number of allocated descriptors
170 * @device_free_chan_resources: release DMA channel's resources
171 * @device_memcpy_buf_to_buf: memcpy buf pointer to buf pointer
172 * @device_memcpy_buf_to_pg: memcpy buf pointer to struct page
173 * @device_memcpy_pg_to_pg: memcpy struct page/offset to struct page/offset
174 * @device_memcpy_complete: poll the status of an IOAT DMA transaction
175 * @device_memcpy_issue_pending: push appended descriptors to hardware
169 */ 176 */
170struct dma_device { 177struct dma_device {
171 178
@@ -211,7 +218,7 @@ void dma_async_client_chan_request(struct dma_client *client,
211 * Both @dest and @src must be mappable to a bus address according to the 218 * Both @dest and @src must be mappable to a bus address according to the
212 * DMA mapping API rules for streaming mappings. 219 * DMA mapping API rules for streaming mappings.
213 * Both @dest and @src must stay memory resident (kernel memory or locked 220 * Both @dest and @src must stay memory resident (kernel memory or locked
214 * user space pages) 221 * user space pages).
215 */ 222 */
216static inline dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, 223static inline dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
217 void *dest, void *src, size_t len) 224 void *dest, void *src, size_t len)
@@ -225,7 +232,7 @@ static inline dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
225} 232}
226 233
227/** 234/**
228 * dma_async_memcpy_buf_to_pg - offloaded copy 235 * dma_async_memcpy_buf_to_pg - offloaded copy from address to page
229 * @chan: DMA channel to offload copy to 236 * @chan: DMA channel to offload copy to
230 * @page: destination page 237 * @page: destination page
231 * @offset: offset in page to copy to 238 * @offset: offset in page to copy to
@@ -250,18 +257,18 @@ static inline dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
250} 257}
251 258
252/** 259/**
253 * dma_async_memcpy_buf_to_pg - offloaded copy 260 * dma_async_memcpy_pg_to_pg - offloaded copy from page to page
254 * @chan: DMA channel to offload copy to 261 * @chan: DMA channel to offload copy to
255 * @dest_page: destination page 262 * @dest_pg: destination page
256 * @dest_off: offset in page to copy to 263 * @dest_off: offset in page to copy to
257 * @src_page: source page 264 * @src_pg: source page
258 * @src_off: offset in page to copy from 265 * @src_off: offset in page to copy from
259 * @len: length 266 * @len: length
260 * 267 *
261 * Both @dest_page/@dest_off and @src_page/@src_off must be mappable to a bus 268 * Both @dest_page/@dest_off and @src_page/@src_off must be mappable to a bus
262 * address according to the DMA mapping API rules for streaming mappings. 269 * address according to the DMA mapping API rules for streaming mappings.
263 * Both @dest_page/@dest_off and @src_page/@src_off must stay memory resident 270 * Both @dest_page/@dest_off and @src_page/@src_off must stay memory resident
264 * (kernel memory or locked user space pages) 271 * (kernel memory or locked user space pages).
265 */ 272 */
266static inline dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan, 273static inline dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan,
267 struct page *dest_pg, unsigned int dest_off, struct page *src_pg, 274 struct page *dest_pg, unsigned int dest_off, struct page *src_pg,
@@ -278,7 +285,7 @@ static inline dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan,
278 285
279/** 286/**
280 * dma_async_memcpy_issue_pending - flush pending copies to HW 287 * dma_async_memcpy_issue_pending - flush pending copies to HW
281 * @chan: 288 * @chan: target DMA channel
282 * 289 *
283 * This allows drivers to push copies to HW in batches, 290 * This allows drivers to push copies to HW in batches,
284 * reducing MMIO writes where possible. 291 * reducing MMIO writes where possible.
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index b2cd2071d432..38dc403be70b 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -27,7 +27,8 @@ enum dmi_device_type {
27 DMI_DEV_TYPE_ETHERNET, 27 DMI_DEV_TYPE_ETHERNET,
28 DMI_DEV_TYPE_TOKENRING, 28 DMI_DEV_TYPE_TOKENRING,
29 DMI_DEV_TYPE_SOUND, 29 DMI_DEV_TYPE_SOUND,
30 DMI_DEV_TYPE_IPMI = -1 30 DMI_DEV_TYPE_IPMI = -1,
31 DMI_DEV_TYPE_OEM_STRING = -2
31}; 32};
32 33
33struct dmi_header { 34struct dmi_header {
diff --git a/include/linux/dqblk_xfs.h b/include/linux/dqblk_xfs.h
index 2fda1b2aabd9..527504c11c5e 100644
--- a/include/linux/dqblk_xfs.h
+++ b/include/linux/dqblk_xfs.h
@@ -125,14 +125,14 @@ typedef struct fs_disk_quota {
125 125
126/* 126/*
127 * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. 127 * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system.
128 * Provides a centralized way to get meta infomation about the quota subsystem. 128 * Provides a centralized way to get meta information about the quota subsystem.
129 * eg. space taken up for user and group quotas, number of dquots currently 129 * eg. space taken up for user and group quotas, number of dquots currently
130 * incore. 130 * incore.
131 */ 131 */
132#define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ 132#define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */
133 133
134/* 134/*
135 * Some basic infomation about 'quota files'. 135 * Some basic information about 'quota files'.
136 */ 136 */
137typedef struct fs_qfilestat { 137typedef struct fs_qfilestat {
138 __u64 qfs_ino; /* inode number */ 138 __u64 qfs_ino; /* inode number */
diff --git a/include/linux/dvb/Kbuild b/include/linux/dvb/Kbuild
new file mode 100644
index 000000000000..d97b3a51e227
--- /dev/null
+++ b/include/linux/dvb/Kbuild
@@ -0,0 +1,9 @@
1header-y += ca.h
2header-y += frontend.h
3header-y += net.h
4header-y += osd.h
5header-y += version.h
6
7unifdef-y += audio.h
8unifdef-y += dmx.h
9unifdef-y += video.h
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
index 2787b8a22ff1..c6a2353c4e68 100644
--- a/include/linux/dvb/dmx.h
+++ b/include/linux/dvb/dmx.h
@@ -88,20 +88,6 @@ typedef enum
88#define DMX_PES_PCR DMX_PES_PCR0 88#define DMX_PES_PCR DMX_PES_PCR0
89 89
90 90
91typedef enum
92{
93 DMX_SCRAMBLING_EV,
94 DMX_FRONTEND_EV
95} dmx_event_t;
96
97
98typedef enum
99{
100 DMX_SCRAMBLING_OFF,
101 DMX_SCRAMBLING_ON
102} dmx_scrambling_status_t;
103
104
105typedef struct dmx_filter 91typedef struct dmx_filter
106{ 92{
107 __u8 filter[DMX_FILTER_SIZE]; 93 __u8 filter[DMX_FILTER_SIZE];
@@ -132,17 +118,6 @@ struct dmx_pes_filter_params
132 __u32 flags; 118 __u32 flags;
133}; 119};
134 120
135
136struct dmx_event
137{
138 dmx_event_t event;
139 time_t timeStamp;
140 union
141 {
142 dmx_scrambling_status_t scrambling;
143 } u;
144};
145
146typedef struct dmx_caps { 121typedef struct dmx_caps {
147 __u32 caps; 122 __u32 caps;
148 int num_decoders; 123 int num_decoders;
@@ -171,7 +146,6 @@ struct dmx_stc {
171#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) 146#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
172#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params) 147#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params)
173#define DMX_SET_BUFFER_SIZE _IO('o', 45) 148#define DMX_SET_BUFFER_SIZE _IO('o', 45)
174#define DMX_GET_EVENT _IOR('o', 46, struct dmx_event)
175#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) 149#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
176#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t) 150#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t)
177#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t) 151#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t)
diff --git a/include/linux/edd.h b/include/linux/edd.h
index 162512b886f7..b2b3e68aa512 100644
--- a/include/linux/edd.h
+++ b/include/linux/edd.h
@@ -52,6 +52,7 @@
52#define EDD_CL_EQUALS 0x3d646465 /* "edd=" */ 52#define EDD_CL_EQUALS 0x3d646465 /* "edd=" */
53#define EDD_CL_OFF 0x666f /* "of" for off */ 53#define EDD_CL_OFF 0x666f /* "of" for off */
54#define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */ 54#define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */
55#define EDD_CL_ON 0x6e6f /* "on" for on */
55 56
56#ifndef __ASSEMBLY__ 57#ifndef __ASSEMBLY__
57 58
diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h
index fbfa6b52e2fb..278ef4495819 100644
--- a/include/linux/efs_fs.h
+++ b/include/linux/efs_fs.h
@@ -38,7 +38,7 @@ struct statfs;
38 38
39extern struct inode_operations efs_dir_inode_operations; 39extern struct inode_operations efs_dir_inode_operations;
40extern const struct file_operations efs_dir_operations; 40extern const struct file_operations efs_dir_operations;
41extern struct address_space_operations efs_symlink_aops; 41extern const struct address_space_operations efs_symlink_aops;
42 42
43extern void efs_read_inode(struct inode *); 43extern void efs_read_inode(struct inode *);
44extern efs_block_t efs_map_block(struct inode *, efs_block_t); 44extern efs_block_t efs_map_block(struct inode *, efs_block_t);
diff --git a/include/linux/efs_fs_sb.h b/include/linux/efs_fs_sb.h
index c76088baef28..ff1945e37790 100644
--- a/include/linux/efs_fs_sb.h
+++ b/include/linux/efs_fs_sb.h
@@ -9,8 +9,7 @@
9#ifndef __EFS_FS_SB_H__ 9#ifndef __EFS_FS_SB_H__
10#define __EFS_FS_SB_H__ 10#define __EFS_FS_SB_H__
11 11
12/* statfs() magic number for EFS */ 12#include <linux/magic.h>
13#define EFS_SUPER_MAGIC 0x414A53
14 13
15/* EFS superblock magic numbers */ 14/* EFS superblock magic numbers */
16#define EFS_MAGIC 0x072959 15#define EFS_MAGIC 0x072959
diff --git a/include/linux/eisa.h b/include/linux/eisa.h
index 4079242dced8..1ff7c1392525 100644
--- a/include/linux/eisa.h
+++ b/include/linux/eisa.h
@@ -3,8 +3,8 @@
3 3
4#include <linux/ioport.h> 4#include <linux/ioport.h>
5#include <linux/device.h> 5#include <linux/device.h>
6#include <linux/mod_devicetable.h>
6 7
7#define EISA_SIG_LEN 8
8#define EISA_MAX_SLOTS 8 8#define EISA_MAX_SLOTS 8
9 9
10#define EISA_MAX_RESOURCES 4 10#define EISA_MAX_RESOURCES 4
@@ -27,12 +27,6 @@
27#define EISA_CONFIG_ENABLED 1 27#define EISA_CONFIG_ENABLED 1
28#define EISA_CONFIG_FORCED 2 28#define EISA_CONFIG_FORCED 2
29 29
30/* The EISA signature, in ASCII form, null terminated */
31struct eisa_device_id {
32 char sig[EISA_SIG_LEN];
33 unsigned long driver_data;
34};
35
36/* There is not much we can say about an EISA device, apart from 30/* There is not much we can say about an EISA device, apart from
37 * signature, slot number, and base address. dma_mask is set by 31 * signature, slot number, and base address. dma_mask is set by
38 * default to parent device mask..*/ 32 * default to parent device mask..*/
diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h
index 114a96d25652..666e0a5f00fc 100644
--- a/include/linux/elf-em.h
+++ b/include/linux/elf-em.h
@@ -11,7 +11,12 @@
11#define EM_486 6 /* Perhaps disused */ 11#define EM_486 6 /* Perhaps disused */
12#define EM_860 7 12#define EM_860 7
13#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ 13#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
14 /* Next two are historical and binaries and
15 modules of these types will be rejected by
16 Linux. */
17#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
14#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ 18#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
19
15#define EM_PARISC 15 /* HPPA */ 20#define EM_PARISC 15 /* HPPA */
16#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ 21#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
17#define EM_PPC 20 /* PowerPC */ 22#define EM_PPC 20 /* PowerPC */
@@ -26,6 +31,7 @@
26#define EM_M32R 88 /* Renesas M32R */ 31#define EM_M32R 88 /* Renesas M32R */
27#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ 32#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
28#define EM_FRV 0x5441 /* Fujitsu FR-V */ 33#define EM_FRV 0x5441 /* Fujitsu FR-V */
34#define EM_AVR32 0x18ad /* Atmel AVR32 */
29 35
30/* 36/*
31 * This is an interim value that we will use until the committee comes 37 * This is an interim value that we will use until the committee comes
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index 0cf0bea010fe..9631dddae348 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -60,6 +60,16 @@ struct elf_prstatus
60 long pr_instr; /* Current instruction */ 60 long pr_instr; /* Current instruction */
61#endif 61#endif
62 elf_gregset_t pr_reg; /* GP registers */ 62 elf_gregset_t pr_reg; /* GP registers */
63#ifdef CONFIG_BINFMT_ELF_FDPIC
64 /* When using FDPIC, the loadmap addresses need to be communicated
65 * to GDB in order for GDB to do the necessary relocations. The
66 * fields (below) used to communicate this information are placed
67 * immediately after ``pr_reg'', so that the loadmap addresses may
68 * be viewed as part of the register set if so desired.
69 */
70 unsigned long pr_exec_fdpic_loadmap;
71 unsigned long pr_interp_fdpic_loadmap;
72#endif
63 int pr_fpvalid; /* True if math co-processor being used. */ 73 int pr_fpvalid; /* True if math co-processor being used. */
64}; 74};
65 75
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
new file mode 100644
index 000000000000..67396db141e8
--- /dev/null
+++ b/include/linux/elfnote.h
@@ -0,0 +1,90 @@
1#ifndef _LINUX_ELFNOTE_H
2#define _LINUX_ELFNOTE_H
3/*
4 * Helper macros to generate ELF Note structures, which are put into a
5 * PT_NOTE segment of the final vmlinux image. These are useful for
6 * including name-value pairs of metadata into the kernel binary (or
7 * modules?) for use by external programs.
8 *
9 * Each note has three parts: a name, a type and a desc. The name is
10 * intended to distinguish the note's originator, so it would be a
11 * company, project, subsystem, etc; it must be in a suitable form for
12 * use in a section name. The type is an integer which is used to tag
13 * the data, and is considered to be within the "name" namespace (so
14 * "FooCo"'s type 42 is distinct from "BarProj"'s type 42). The
15 * "desc" field is the actual data. There are no constraints on the
16 * desc field's contents, though typically they're fairly small.
17 *
18 * All notes from a given NAME are put into a section named
19 * .note.NAME. When the kernel image is finally linked, all the notes
20 * are packed into a single .notes section, which is mapped into the
21 * PT_NOTE segment. Because notes for a given name are grouped into
22 * the same section, they'll all be adjacent the output file.
23 *
24 * This file defines macros for both C and assembler use. Their
25 * syntax is slightly different, but they're semantically similar.
26 *
27 * See the ELF specification for more detail about ELF notes.
28 */
29
30#ifdef __ASSEMBLER__
31/*
32 * Generate a structure with the same shape as Elf{32,64}_Nhdr (which
33 * turn out to be the same size and shape), followed by the name and
34 * desc data with appropriate padding. The 'desctype' argument is the
35 * assembler pseudo op defining the type of the data e.g. .asciz while
36 * 'descdata' is the data itself e.g. "hello, world".
37 *
38 * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two")
39 * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
40 */
41#define ELFNOTE(name, type, desctype, descdata) \
42.pushsection .note.name ; \
43 .align 4 ; \
44 .long 2f - 1f /* namesz */ ; \
45 .long 4f - 3f /* descsz */ ; \
46 .long type ; \
471:.asciz "name" ; \
482:.align 4 ; \
493:desctype descdata ; \
504:.align 4 ; \
51.popsection ;
52#else /* !__ASSEMBLER__ */
53#include <linux/elf.h>
54/*
55 * Use an anonymous structure which matches the shape of
56 * Elf{32,64}_Nhdr, but includes the name and desc data. The size and
57 * type of name and desc depend on the macro arguments. "name" must
58 * be a literal string, and "desc" must be passed by value. You may
59 * only define one note per line, since __LINE__ is used to generate
60 * unique symbols.
61 */
62#define _ELFNOTE_PASTE(a,b) a##b
63#define _ELFNOTE(size, name, unique, type, desc) \
64 static const struct { \
65 struct elf##size##_note _nhdr; \
66 unsigned char _name[sizeof(name)] \
67 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
68 typeof(desc) _desc \
69 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
70 } _ELFNOTE_PASTE(_note_, unique) \
71 __attribute_used__ \
72 __attribute__((section(".note." name), \
73 aligned(sizeof(Elf##size##_Word)), \
74 unused)) = { \
75 { \
76 sizeof(name), \
77 sizeof(desc), \
78 type, \
79 }, \
80 name, \
81 desc \
82 }
83#define ELFNOTE(size, name, type, desc) \
84 _ELFNOTE(size, name, __LINE__, type, desc)
85
86#define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc)
87#define ELFNOTE64(name, type, desc) ELFNOTE(64, name, type, desc)
88#endif /* __ASSEMBLER__ */
89
90#endif /* _LINUX_ELFNOTE_H */
diff --git a/include/linux/err.h b/include/linux/err.h
index ff71d2af5da3..1ab1d44f8d3b 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -13,7 +13,11 @@
13 * This should be a per-architecture thing, to allow different 13 * This should be a per-architecture thing, to allow different
14 * error and pointer decisions. 14 * error and pointer decisions.
15 */ 15 */
16#define IS_ERR_VALUE(x) unlikely((x) > (unsigned long)-1000L) 16#define MAX_ERRNO 4095
17
18#ifndef __ASSEMBLY__
19
20#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
17 21
18static inline void *ERR_PTR(long error) 22static inline void *ERR_PTR(long error)
19{ 23{
@@ -30,4 +34,6 @@ static inline long IS_ERR(const void *ptr)
30 return IS_ERR_VALUE((unsigned long)ptr); 34 return IS_ERR_VALUE((unsigned long)ptr);
31} 35}
32 36
37#endif
38
33#endif /* _LINUX_ERR_H */ 39#endif /* _LINUX_ERR_H */
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h
index 408118a07763..92f8d4fab32b 100644
--- a/include/linux/errqueue.h
+++ b/include/linux/errqueue.h
@@ -38,7 +38,7 @@ struct sock_exterr_skb
38 } header; 38 } header;
39 struct sock_extended_err ee; 39 struct sock_extended_err ee;
40 u16 addr_offset; 40 u16 addr_offset;
41 u16 port; 41 __be16 port;
42}; 42};
43 43
44#endif 44#endif
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 1e4bdfcf83a2..84cfa8bbdc36 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * include/linux/eventpoll.h ( Efficent event polling implementation ) 2 * include/linux/eventpoll.h ( Efficent event polling implementation )
3 * Copyright (C) 2001,...,2003 Davide Libenzi 3 * Copyright (C) 2001,...,2006 Davide Libenzi
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index facf34e98954..33a1aa107329 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -17,6 +17,7 @@
17#define _LINUX_EXT2_FS_H 17#define _LINUX_EXT2_FS_H
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/magic.h>
20 21
21/* 22/*
22 * The second extended filesystem constants/structures 23 * The second extended filesystem constants/structures
@@ -63,11 +64,6 @@
63/* First non-reserved inode for old ext2 filesystems */ 64/* First non-reserved inode for old ext2 filesystems */
64#define EXT2_GOOD_OLD_FIRST_INO 11 65#define EXT2_GOOD_OLD_FIRST_INO 11
65 66
66/*
67 * The second extended file system magic number
68 */
69#define EXT2_SUPER_MAGIC 0xEF53
70
71#ifdef __KERNEL__ 67#ifdef __KERNEL__
72#include <linux/ext2_fs_sb.h> 68#include <linux/ext2_fs_sb.h>
73static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb) 69static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 757d54d8f1a5..cc08f56750da 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -17,6 +17,7 @@
17#define _LINUX_EXT3_FS_H 17#define _LINUX_EXT3_FS_H
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/magic.h>
20 21
21/* 22/*
22 * The second extended filesystem constants/structures 23 * The second extended filesystem constants/structures
@@ -67,11 +68,6 @@
67#define EXT3_GOOD_OLD_FIRST_INO 11 68#define EXT3_GOOD_OLD_FIRST_INO 11
68 69
69/* 70/*
70 * The second extended file system magic number
71 */
72#define EXT3_SUPER_MAGIC 0xEF53
73
74/*
75 * Maximal count of links to a file 71 * Maximal count of links to a file
76 */ 72 */
77#define EXT3_LINK_MAX 32000 73#define EXT3_LINK_MAX 32000
@@ -464,7 +460,7 @@ struct ext3_super_block {
464 */ 460 */
465 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ 461 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
466 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ 462 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
467 __u16 s_reserved_gdt_blocks; /* Per group desc for online growth */ 463 __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
468 /* 464 /*
469 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. 465 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
470 */ 466 */
@@ -477,7 +473,7 @@ struct ext3_super_block {
477 __u8 s_reserved_char_pad; 473 __u8 s_reserved_char_pad;
478 __u16 s_reserved_word_pad; 474 __u16 s_reserved_word_pad;
479 __le32 s_default_mount_opts; 475 __le32 s_default_mount_opts;
480 __le32 s_first_meta_bg; /* First metablock block group */ 476 __le32 s_first_meta_bg; /* First metablock block group */
481 __u32 s_reserved[190]; /* Padding to the end of the block */ 477 __u32 s_reserved[190]; /* Padding to the end of the block */
482}; 478};
483 479
@@ -492,6 +488,15 @@ static inline struct ext3_inode_info *EXT3_I(struct inode *inode)
492{ 488{
493 return container_of(inode, struct ext3_inode_info, vfs_inode); 489 return container_of(inode, struct ext3_inode_info, vfs_inode);
494} 490}
491
492static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
493{
494 return ino == EXT3_ROOT_INO ||
495 ino == EXT3_JOURNAL_INO ||
496 ino == EXT3_RESIZE_INO ||
497 (ino >= EXT3_FIRST_INO(sb) &&
498 ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count));
499}
495#else 500#else
496/* Assume that user mode programs are passing in an ext3fs superblock, not 501/* Assume that user mode programs are passing in an ext3fs superblock, not
497 * a kernel struct super_block. This will allow us to call the feature-test 502 * a kernel struct super_block. This will allow us to call the feature-test
@@ -710,6 +715,14 @@ struct dir_private_info {
710 __u32 next_hash; 715 __u32 next_hash;
711}; 716};
712 717
718/* calculate the first block number of the group */
719static inline ext3_fsblk_t
720ext3_group_first_block_no(struct super_block *sb, unsigned long group_no)
721{
722 return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) +
723 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block);
724}
725
713/* 726/*
714 * Special error return code only used by dx_probe() and its callers. 727 * Special error return code only used by dx_probe() and its callers.
715 */ 728 */
@@ -730,14 +743,16 @@ struct dir_private_info {
730/* balloc.c */ 743/* balloc.c */
731extern int ext3_bg_has_super(struct super_block *sb, int group); 744extern int ext3_bg_has_super(struct super_block *sb, int group);
732extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group); 745extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group);
733extern int ext3_new_block (handle_t *, struct inode *, unsigned long, int *); 746extern ext3_fsblk_t ext3_new_block (handle_t *handle, struct inode *inode,
734extern int ext3_new_blocks (handle_t *, struct inode *, unsigned long, 747 ext3_fsblk_t goal, int *errp);
735 unsigned long *, int *); 748extern ext3_fsblk_t ext3_new_blocks (handle_t *handle, struct inode *inode,
736extern void ext3_free_blocks (handle_t *, struct inode *, unsigned long, 749 ext3_fsblk_t goal, unsigned long *count, int *errp);
737 unsigned long); 750extern void ext3_free_blocks (handle_t *handle, struct inode *inode,
738extern void ext3_free_blocks_sb (handle_t *, struct super_block *, 751 ext3_fsblk_t block, unsigned long count);
739 unsigned long, unsigned long, int *); 752extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb,
740extern unsigned long ext3_count_free_blocks (struct super_block *); 753 ext3_fsblk_t block, unsigned long count,
754 unsigned long *pdquot_freed_blocks);
755extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *);
741extern void ext3_check_blocks_bitmap (struct super_block *); 756extern void ext3_check_blocks_bitmap (struct super_block *);
742extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, 757extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
743 unsigned int block_group, 758 unsigned int block_group,
@@ -773,7 +788,8 @@ extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
773 788
774 789
775/* inode.c */ 790/* inode.c */
776int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int); 791int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
792 struct buffer_head *bh, ext3_fsblk_t blocknr);
777struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); 793struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
778struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); 794struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
779int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, 795int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
@@ -808,7 +824,7 @@ extern int ext3_group_add(struct super_block *sb,
808 struct ext3_new_group_data *input); 824 struct ext3_new_group_data *input);
809extern int ext3_group_extend(struct super_block *sb, 825extern int ext3_group_extend(struct super_block *sb,
810 struct ext3_super_block *es, 826 struct ext3_super_block *es,
811 unsigned long n_blocks_count); 827 ext3_fsblk_t n_blocks_count);
812 828
813/* super.c */ 829/* super.c */
814extern void ext3_error (struct super_block *, const char *, const char *, ...) 830extern void ext3_error (struct super_block *, const char *, const char *, ...)
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index 7abf90147180..4395e5206746 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -21,13 +21,21 @@
21#include <linux/seqlock.h> 21#include <linux/seqlock.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23 23
24/* data type for block offset of block group */
25typedef int ext3_grpblk_t;
26
27/* data type for filesystem-wide blocks number */
28typedef unsigned long ext3_fsblk_t;
29
30#define E3FSBLK "%lu"
31
24struct ext3_reserve_window { 32struct ext3_reserve_window {
25 __u32 _rsv_start; /* First byte reserved */ 33 ext3_fsblk_t _rsv_start; /* First byte reserved */
26 __u32 _rsv_end; /* Last byte reserved or 0 */ 34 ext3_fsblk_t _rsv_end; /* Last byte reserved or 0 */
27}; 35};
28 36
29struct ext3_reserve_window_node { 37struct ext3_reserve_window_node {
30 struct rb_node rsv_node; 38 struct rb_node rsv_node;
31 __u32 rsv_goal_size; 39 __u32 rsv_goal_size;
32 __u32 rsv_alloc_hit; 40 __u32 rsv_alloc_hit;
33 struct ext3_reserve_window rsv_window; 41 struct ext3_reserve_window rsv_window;
@@ -50,7 +58,7 @@ struct ext3_block_alloc_info {
50 * allocated to this file. This give us the goal (target) for the next 58 * allocated to this file. This give us the goal (target) for the next
51 * allocation when we detect linearly ascending requests. 59 * allocation when we detect linearly ascending requests.
52 */ 60 */
53 __u32 last_alloc_physical_block; 61 ext3_fsblk_t last_alloc_physical_block;
54}; 62};
55 63
56#define rsv_start rsv_window._rsv_start 64#define rsv_start rsv_window._rsv_start
@@ -67,7 +75,7 @@ struct ext3_inode_info {
67 __u8 i_frag_no; 75 __u8 i_frag_no;
68 __u8 i_frag_size; 76 __u8 i_frag_size;
69#endif 77#endif
70 __u32 i_file_acl; 78 ext3_fsblk_t i_file_acl;
71 __u32 i_dir_acl; 79 __u32 i_dir_acl;
72 __u32 i_dtime; 80 __u32 i_dtime;
73 81
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
index c8307c02dd07..ce0e6109aff0 100644
--- a/include/linux/ext3_jbd.h
+++ b/include/linux/ext3_jbd.h
@@ -23,7 +23,7 @@
23 23
24/* Define the number of blocks we need to account to a transaction to 24/* Define the number of blocks we need to account to a transaction to
25 * modify one block of data. 25 * modify one block of data.
26 * 26 *
27 * We may have to touch one inode, one bitmap buffer, up to three 27 * We may have to touch one inode, one bitmap buffer, up to three
28 * indirection blocks, the group and superblock summaries, and the data 28 * indirection blocks, the group and superblock summaries, and the data
29 * block to complete the transaction. */ 29 * block to complete the transaction. */
@@ -88,16 +88,16 @@
88#endif 88#endif
89 89
90int 90int
91ext3_mark_iloc_dirty(handle_t *handle, 91ext3_mark_iloc_dirty(handle_t *handle,
92 struct inode *inode, 92 struct inode *inode,
93 struct ext3_iloc *iloc); 93 struct ext3_iloc *iloc);
94 94
95/* 95/*
96 * On success, We end up with an outstanding reference count against 96 * On success, We end up with an outstanding reference count against
97 * iloc->bh. This _must_ be cleaned up later. 97 * iloc->bh. This _must_ be cleaned up later.
98 */ 98 */
99 99
100int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, 100int ext3_reserve_inode_write(handle_t *handle, struct inode *inode,
101 struct ext3_iloc *iloc); 101 struct ext3_iloc *iloc);
102 102
103int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode); 103int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 315d89740ddf..2f335e966011 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -366,16 +366,21 @@ struct fb_cursor {
366 struct fb_image image; /* Cursor image */ 366 struct fb_image image; /* Cursor image */
367}; 367};
368 368
369#ifdef CONFIG_FB_BACKLIGHT
370/* Settings for the generic backlight code */
371#define FB_BACKLIGHT_LEVELS 128
372#define FB_BACKLIGHT_MAX 0xFF
373#endif
374
369#ifdef __KERNEL__ 375#ifdef __KERNEL__
370 376
371#include <linux/fs.h> 377#include <linux/fs.h>
372#include <linux/init.h> 378#include <linux/init.h>
373#include <linux/tty.h>
374#include <linux/device.h> 379#include <linux/device.h>
375#include <linux/workqueue.h> 380#include <linux/workqueue.h>
376#include <linux/devfs_fs_kernel.h>
377#include <linux/notifier.h> 381#include <linux/notifier.h>
378#include <linux/list.h> 382#include <linux/list.h>
383#include <linux/backlight.h>
379#include <asm/io.h> 384#include <asm/io.h>
380 385
381struct vm_area_struct; 386struct vm_area_struct;
@@ -497,23 +502,19 @@ struct fb_cursor_user {
497#define FB_EVENT_MODE_DELETE 0x04 502#define FB_EVENT_MODE_DELETE 0x04
498/* A driver registered itself */ 503/* A driver registered itself */
499#define FB_EVENT_FB_REGISTERED 0x05 504#define FB_EVENT_FB_REGISTERED 0x05
505/* A driver unregistered itself */
506#define FB_EVENT_FB_UNREGISTERED 0x06
500/* CONSOLE-SPECIFIC: get console to framebuffer mapping */ 507/* CONSOLE-SPECIFIC: get console to framebuffer mapping */
501#define FB_EVENT_GET_CONSOLE_MAP 0x06 508#define FB_EVENT_GET_CONSOLE_MAP 0x07
502/* CONSOLE-SPECIFIC: set console to framebuffer mapping */ 509/* CONSOLE-SPECIFIC: set console to framebuffer mapping */
503#define FB_EVENT_SET_CONSOLE_MAP 0x07 510#define FB_EVENT_SET_CONSOLE_MAP 0x08
504/* A display blank is requested */ 511/* A display blank is requested */
505#define FB_EVENT_BLANK 0x08 512#define FB_EVENT_BLANK 0x09
506/* Private modelist is to be replaced */ 513/* Private modelist is to be replaced */
507#define FB_EVENT_NEW_MODELIST 0x09 514#define FB_EVENT_NEW_MODELIST 0x0A
508/* The resolution of the passed in fb_info about to change and 515/* The resolution of the passed in fb_info about to change and
509 all vc's should be changed */ 516 all vc's should be changed */
510#define FB_EVENT_MODE_CHANGE_ALL 0x0A 517#define FB_EVENT_MODE_CHANGE_ALL 0x0B
511/* CONSOLE-SPECIFIC: set console rotation */
512#define FB_EVENT_SET_CON_ROTATE 0x0B
513/* CONSOLE-SPECIFIC: get console rotation */
514#define FB_EVENT_GET_CON_ROTATE 0x0C
515/* CONSOLE-SPECIFIC: rotate all consoles */
516#define FB_EVENT_SET_CON_ROTATE_ALL 0x0D
517 518
518struct fb_event { 519struct fb_event {
519 struct fb_info *info; 520 struct fb_info *info;
@@ -523,7 +524,7 @@ struct fb_event {
523 524
524extern int fb_register_client(struct notifier_block *nb); 525extern int fb_register_client(struct notifier_block *nb);
525extern int fb_unregister_client(struct notifier_block *nb); 526extern int fb_unregister_client(struct notifier_block *nb);
526 527extern int fb_notifier_call_chain(unsigned long val, void *v);
527/* 528/*
528 * Pixmap structure definition 529 * Pixmap structure definition
529 * 530 *
@@ -555,7 +556,7 @@ struct fb_pixmap {
555 * Frame buffer operations 556 * Frame buffer operations
556 * 557 *
557 * LOCKING NOTE: those functions must _ALL_ be called with the console 558 * LOCKING NOTE: those functions must _ALL_ be called with the console
558 * semaphore held, this is the only suitable locking mecanism we have 559 * semaphore held, this is the only suitable locking mechanism we have
559 * in 2.6. Some may be called at interrupt time at this point though. 560 * in 2.6. Some may be called at interrupt time at this point though.
560 */ 561 */
561 562
@@ -756,6 +757,21 @@ struct fb_info {
756 struct fb_cmap cmap; /* Current cmap */ 757 struct fb_cmap cmap; /* Current cmap */
757 struct list_head modelist; /* mode list */ 758 struct list_head modelist; /* mode list */
758 struct fb_videomode *mode; /* current mode */ 759 struct fb_videomode *mode; /* current mode */
760
761#ifdef CONFIG_FB_BACKLIGHT
762 /* Lock ordering:
763 * bl_mutex (protects bl_dev and bl_curve)
764 * bl_dev->sem (backlight class)
765 */
766 struct mutex bl_mutex;
767
768 /* assigned backlight device */
769 struct backlight_device *bl_dev;
770
771 /* Backlight level curve */
772 u8 bl_curve[FB_BACKLIGHT_LEVELS];
773#endif
774
759 struct fb_ops *fbops; 775 struct fb_ops *fbops;
760 struct device *device; 776 struct device *device;
761 struct class_device *class_device; /* sysfs per device attrs */ 777 struct class_device *class_device; /* sysfs per device attrs */
@@ -870,7 +886,6 @@ extern int fb_get_color_depth(struct fb_var_screeninfo *var,
870 struct fb_fix_screeninfo *fix); 886 struct fb_fix_screeninfo *fix);
871extern int fb_get_options(char *name, char **option); 887extern int fb_get_options(char *name, char **option);
872extern int fb_new_modelist(struct fb_info *info); 888extern int fb_new_modelist(struct fb_info *info);
873extern int fb_con_duit(struct fb_info *info, int event, void *data);
874 889
875extern struct fb_info *registered_fb[FB_MAX]; 890extern struct fb_info *registered_fb[FB_MAX];
876extern int num_registered_fb; 891extern int num_registered_fb;
@@ -895,6 +910,7 @@ extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
895extern void framebuffer_release(struct fb_info *info); 910extern void framebuffer_release(struct fb_info *info);
896extern int fb_init_class_device(struct fb_info *fb_info); 911extern int fb_init_class_device(struct fb_info *fb_info);
897extern void fb_cleanup_class_device(struct fb_info *head); 912extern void fb_cleanup_class_device(struct fb_info *head);
913extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max);
898 914
899/* drivers/video/fbmon.c */ 915/* drivers/video/fbmon.c */
900#define FB_MAXTIMINGS 0 916#define FB_MAXTIMINGS 0
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index c52a63755fdd..996f5611cd59 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -29,6 +29,7 @@
29#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ 29#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
30#define AT_REMOVEDIR 0x200 /* Remove directory instead of 30#define AT_REMOVEDIR 0x200 /* Remove directory instead of
31 unlinking file. */ 31 unlinking file. */
32#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
32 33
33#ifdef __KERNEL__ 34#ifdef __KERNEL__
34 35
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
new file mode 100644
index 000000000000..4418c8d9d479
--- /dev/null
+++ b/include/linux/fib_rules.h
@@ -0,0 +1,65 @@
1#ifndef __LINUX_FIB_RULES_H
2#define __LINUX_FIB_RULES_H
3
4#include <linux/types.h>
5#include <linux/rtnetlink.h>
6
7/* rule is permanent, and cannot be deleted */
8#define FIB_RULE_PERMANENT 1
9
10struct fib_rule_hdr
11{
12 __u8 family;
13 __u8 dst_len;
14 __u8 src_len;
15 __u8 tos;
16
17 __u8 table;
18 __u8 res1; /* reserved */
19 __u8 res2; /* reserved */
20 __u8 action;
21
22 __u32 flags;
23};
24
25enum
26{
27 FRA_UNSPEC,
28 FRA_DST, /* destination address */
29 FRA_SRC, /* source address */
30 FRA_IFNAME, /* interface name */
31 FRA_UNUSED1,
32 FRA_UNUSED2,
33 FRA_PRIORITY, /* priority/preference */
34 FRA_UNUSED3,
35 FRA_UNUSED4,
36 FRA_UNUSED5,
37 FRA_FWMARK, /* netfilter mark */
38 FRA_FLOW, /* flow/class id */
39 FRA_UNUSED6,
40 FRA_UNUSED7,
41 FRA_UNUSED8,
42 FRA_TABLE, /* Extended table id */
43 FRA_FWMASK, /* mask for netfilter mark */
44 __FRA_MAX
45};
46
47#define FRA_MAX (__FRA_MAX - 1)
48
49enum
50{
51 FR_ACT_UNSPEC,
52 FR_ACT_TO_TBL, /* Pass to fixed table */
53 FR_ACT_RES1,
54 FR_ACT_RES2,
55 FR_ACT_RES3,
56 FR_ACT_RES4,
57 FR_ACT_BLACKHOLE, /* Drop without notification */
58 FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */
59 FR_ACT_PROHIBIT, /* Drop with EACCES */
60 __FR_ACT_MAX,
61};
62
63#define FR_ACT_MAX (__FR_ACT_MAX - 1)
64
65#endif
diff --git a/include/linux/file.h b/include/linux/file.h
index 9f7c2513866f..74183e6f7f45 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -112,5 +112,6 @@ struct task_struct;
112 112
113struct files_struct *get_files_struct(struct task_struct *); 113struct files_struct *get_files_struct(struct task_struct *);
114void FASTCALL(put_files_struct(struct files_struct *fs)); 114void FASTCALL(put_files_struct(struct files_struct *fs));
115void reset_files_struct(struct task_struct *, struct files_struct *);
115 116
116#endif /* __LINUX_FILE_H */ 117#endif /* __LINUX_FILE_H */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index c6cb8f095088..91b2e3b9251e 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -25,10 +25,10 @@
25 25
26struct sock_filter /* Filter block */ 26struct sock_filter /* Filter block */
27{ 27{
28 __u16 code; /* Actual filter code */ 28 __u16 code; /* Actual filter code */
29 __u8 jt; /* Jump true */ 29 __u8 jt; /* Jump true */
30 __u8 jf; /* Jump false */ 30 __u8 jf; /* Jump false */
31 __u32 k; /* Generic multiuse field */ 31 __u32 k; /* Generic multiuse field */
32}; 32};
33 33
34struct sock_fprog /* Required for SO_ATTACH_FILTER. */ 34struct sock_fprog /* Required for SO_ATTACH_FILTER. */
@@ -41,8 +41,9 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */
41struct sk_filter 41struct sk_filter
42{ 42{
43 atomic_t refcnt; 43 atomic_t refcnt;
44 unsigned int len; /* Number of filter blocks */ 44 unsigned int len; /* Number of filter blocks */
45 struct sock_filter insns[0]; 45 struct rcu_head rcu;
46 struct sock_filter insns[0];
46}; 47};
47 48
48static inline unsigned int sk_filter_len(struct sk_filter *fp) 49static inline unsigned int sk_filter_len(struct sk_filter *fp)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index dba4cbd157ee..6eafbe309483 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -27,6 +27,10 @@
27#define BLOCK_SIZE_BITS 10 27#define BLOCK_SIZE_BITS 10
28#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) 28#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
29 29
30#define SEEK_SET 0 /* seek relative to beginning of file */
31#define SEEK_CUR 1 /* seek relative to current file position */
32#define SEEK_END 2 /* seek relative to end of file */
33
30/* And dynamically-tunable limits and defaults: */ 34/* And dynamically-tunable limits and defaults: */
31struct files_stat_struct { 35struct files_stat_struct {
32 int nr_files; /* read only */ 36 int nr_files; /* read only */
@@ -88,9 +92,10 @@ extern int dir_notify_enable;
88#define FS_REQUIRES_DEV 1 92#define FS_REQUIRES_DEV 1
89#define FS_BINARY_MOUNTDATA 2 93#define FS_BINARY_MOUNTDATA 2
90#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ 94#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
91#define FS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon 95#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move()
92 * as nfs_rename() will be cleaned up 96 * during rename() internally.
93 */ 97 */
98
94/* 99/*
95 * These are the fs-independent mount-flags: up to 32 flags are supported 100 * These are the fs-independent mount-flags: up to 32 flags are supported
96 */ 101 */
@@ -392,7 +397,7 @@ struct address_space {
392 unsigned int truncate_count; /* Cover race condition with truncate */ 397 unsigned int truncate_count; /* Cover race condition with truncate */
393 unsigned long nrpages; /* number of total pages */ 398 unsigned long nrpages; /* number of total pages */
394 pgoff_t writeback_index;/* writeback starts here */ 399 pgoff_t writeback_index;/* writeback starts here */
395 struct address_space_operations *a_ops; /* methods */ 400 const struct address_space_operations *a_ops; /* methods */
396 unsigned long flags; /* error bits/gfp mask */ 401 unsigned long flags; /* error bits/gfp mask */
397 struct backing_dev_info *backing_dev_info; /* device readahead, etc */ 402 struct backing_dev_info *backing_dev_info; /* device readahead, etc */
398 spinlock_t private_lock; /* for use by the address_space */ 403 spinlock_t private_lock; /* for use by the address_space */
@@ -436,6 +441,21 @@ struct block_device {
436}; 441};
437 442
438/* 443/*
444 * bdev->bd_mutex nesting subclasses for the lock validator:
445 *
446 * 0: normal
447 * 1: 'whole'
448 * 2: 'partition'
449 */
450enum bdev_bd_mutex_lock_class
451{
452 BD_MUTEX_NORMAL,
453 BD_MUTEX_WHOLE,
454 BD_MUTEX_PARTITION
455};
456
457
458/*
439 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache 459 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache
440 * radix trees 460 * radix trees
441 */ 461 */
@@ -492,7 +512,6 @@ struct inode {
492 struct timespec i_mtime; 512 struct timespec i_mtime;
493 struct timespec i_ctime; 513 struct timespec i_ctime;
494 unsigned int i_blkbits; 514 unsigned int i_blkbits;
495 unsigned long i_blksize;
496 unsigned long i_version; 515 unsigned long i_version;
497 blkcnt_t i_blocks; 516 blkcnt_t i_blocks;
498 unsigned short i_bytes; 517 unsigned short i_bytes;
@@ -508,11 +527,12 @@ struct inode {
508#ifdef CONFIG_QUOTA 527#ifdef CONFIG_QUOTA
509 struct dquot *i_dquot[MAXQUOTAS]; 528 struct dquot *i_dquot[MAXQUOTAS];
510#endif 529#endif
511 /* These three should probably be a union */
512 struct list_head i_devices; 530 struct list_head i_devices;
513 struct pipe_inode_info *i_pipe; 531 union {
514 struct block_device *i_bdev; 532 struct pipe_inode_info *i_pipe;
515 struct cdev *i_cdev; 533 struct block_device *i_bdev;
534 struct cdev *i_cdev;
535 };
516 int i_cindex; 536 int i_cindex;
517 537
518 __u32 i_generation; 538 __u32 i_generation;
@@ -533,16 +553,36 @@ struct inode {
533 unsigned int i_flags; 553 unsigned int i_flags;
534 554
535 atomic_t i_writecount; 555 atomic_t i_writecount;
556#ifdef CONFIG_SECURITY
536 void *i_security; 557 void *i_security;
537 union { 558#endif
538 void *generic_ip; 559 void *i_private; /* fs or device private pointer */
539 } u;
540#ifdef __NEED_I_SIZE_ORDERED 560#ifdef __NEED_I_SIZE_ORDERED
541 seqcount_t i_size_seqcount; 561 seqcount_t i_size_seqcount;
542#endif 562#endif
543}; 563};
544 564
545/* 565/*
566 * inode->i_mutex nesting subclasses for the lock validator:
567 *
568 * 0: the object of the current VFS operation
569 * 1: parent
570 * 2: child/target
571 * 3: quota file
572 *
573 * The locking order between these classes is
574 * parent -> child -> normal -> xattr -> quota
575 */
576enum inode_i_mutex_lock_class
577{
578 I_MUTEX_NORMAL,
579 I_MUTEX_PARENT,
580 I_MUTEX_CHILD,
581 I_MUTEX_XATTR,
582 I_MUTEX_QUOTA
583};
584
585/*
546 * NOTE: in a 32bit arch with a preemptable kernel and 586 * NOTE: in a 32bit arch with a preemptable kernel and
547 * an UP compile the i_size_read/write must be atomic 587 * an UP compile the i_size_read/write must be atomic
548 * with respect to the local cpu (unlike with preempt disabled), 588 * with respect to the local cpu (unlike with preempt disabled),
@@ -607,7 +647,6 @@ struct fown_struct {
607 rwlock_t lock; /* protects pid, uid, euid fields */ 647 rwlock_t lock; /* protects pid, uid, euid fields */
608 int pid; /* pid or -pgrp where SIGIO should be sent */ 648 int pid; /* pid or -pgrp where SIGIO should be sent */
609 uid_t uid, euid; /* uid/euid of process setting the owner */ 649 uid_t uid, euid; /* uid/euid of process setting the owner */
610 void *security;
611 int signum; /* posix.1b rt signal to be delivered on IO */ 650 int signum; /* posix.1b rt signal to be delivered on IO */
612}; 651};
613 652
@@ -650,8 +689,9 @@ struct file {
650 struct file_ra_state f_ra; 689 struct file_ra_state f_ra;
651 690
652 unsigned long f_version; 691 unsigned long f_version;
692#ifdef CONFIG_SECURITY
653 void *f_security; 693 void *f_security;
654 694#endif
655 /* needed for tty driver, and maybe others */ 695 /* needed for tty driver, and maybe others */
656 void *private_data; 696 void *private_data;
657 697
@@ -682,6 +722,7 @@ extern spinlock_t files_lock;
682#define FL_POSIX 1 722#define FL_POSIX 1
683#define FL_FLOCK 2 723#define FL_FLOCK 2
684#define FL_ACCESS 8 /* not trying to lock, just looking */ 724#define FL_ACCESS 8 /* not trying to lock, just looking */
725#define FL_EXISTS 16 /* when unlocking, test for existence */
685#define FL_LEASE 32 /* lease held on this file */ 726#define FL_LEASE 32 /* lease held on this file */
686#define FL_CLOSE 64 /* unlock on close */ 727#define FL_CLOSE 64 /* unlock on close */
687#define FL_SLEEP 128 /* A blocking lock */ 728#define FL_SLEEP 128 /* A blocking lock */
@@ -838,7 +879,9 @@ struct super_block {
838 int s_syncing; 879 int s_syncing;
839 int s_need_sync_fs; 880 int s_need_sync_fs;
840 atomic_t s_active; 881 atomic_t s_active;
882#ifdef CONFIG_SECURITY
841 void *s_security; 883 void *s_security;
884#endif
842 struct xattr_handler **s_xattr; 885 struct xattr_handler **s_xattr;
843 886
844 struct list_head s_inodes; /* all inodes */ 887 struct list_head s_inodes; /* all inodes */
@@ -1100,13 +1143,14 @@ struct super_operations {
1100 int (*statfs) (struct dentry *, struct kstatfs *); 1143 int (*statfs) (struct dentry *, struct kstatfs *);
1101 int (*remount_fs) (struct super_block *, int *, char *); 1144 int (*remount_fs) (struct super_block *, int *, char *);
1102 void (*clear_inode) (struct inode *); 1145 void (*clear_inode) (struct inode *);
1103 void (*umount_begin) (struct super_block *); 1146 void (*umount_begin) (struct vfsmount *, int);
1104 1147
1105 int (*show_options)(struct seq_file *, struct vfsmount *); 1148 int (*show_options)(struct seq_file *, struct vfsmount *);
1106 int (*show_stats)(struct seq_file *, struct vfsmount *); 1149 int (*show_stats)(struct seq_file *, struct vfsmount *);
1107 1150#ifdef CONFIG_QUOTA
1108 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1151 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1109 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1152 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1153#endif
1110}; 1154};
1111 1155
1112/* Inode state bits. Protected by inode_lock. */ 1156/* Inode state bits. Protected by inode_lock. */
@@ -1276,6 +1320,8 @@ struct file_system_type {
1276 struct module *owner; 1320 struct module *owner;
1277 struct file_system_type * next; 1321 struct file_system_type * next;
1278 struct list_head fs_supers; 1322 struct list_head fs_supers;
1323 struct lock_class_key s_lock_key;
1324 struct lock_class_key s_umount_key;
1279}; 1325};
1280 1326
1281extern int get_sb_bdev(struct file_system_type *fs_type, 1327extern int get_sb_bdev(struct file_system_type *fs_type,
@@ -1404,8 +1450,9 @@ extern void bd_set_size(struct block_device *, loff_t size);
1404extern void bd_forget(struct inode *inode); 1450extern void bd_forget(struct inode *inode);
1405extern void bdput(struct block_device *); 1451extern void bdput(struct block_device *);
1406extern struct block_device *open_by_devnum(dev_t, unsigned); 1452extern struct block_device *open_by_devnum(dev_t, unsigned);
1453extern struct block_device *open_partition_by_devnum(dev_t, unsigned);
1407extern const struct file_operations def_blk_fops; 1454extern const struct file_operations def_blk_fops;
1408extern struct address_space_operations def_blk_aops; 1455extern const struct address_space_operations def_blk_aops;
1409extern const struct file_operations def_chr_fops; 1456extern const struct file_operations def_chr_fops;
1410extern const struct file_operations bad_sock_fops; 1457extern const struct file_operations bad_sock_fops;
1411extern const struct file_operations def_fifo_fops; 1458extern const struct file_operations def_fifo_fops;
@@ -1414,6 +1461,7 @@ extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
1414extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1461extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
1415extern int blkdev_get(struct block_device *, mode_t, unsigned); 1462extern int blkdev_get(struct block_device *, mode_t, unsigned);
1416extern int blkdev_put(struct block_device *); 1463extern int blkdev_put(struct block_device *);
1464extern int blkdev_put_partition(struct block_device *);
1417extern int bd_claim(struct block_device *, void *); 1465extern int bd_claim(struct block_device *, void *);
1418extern void bd_release(struct block_device *); 1466extern void bd_release(struct block_device *);
1419#ifdef CONFIG_SYSFS 1467#ifdef CONFIG_SYSFS
@@ -1767,7 +1815,7 @@ extern struct inode_operations simple_dir_inode_operations;
1767struct tree_descr { char *name; const struct file_operations *ops; int mode; }; 1815struct tree_descr { char *name; const struct file_operations *ops; int mode; };
1768struct dentry *d_alloc_name(struct dentry *, const char *); 1816struct dentry *d_alloc_name(struct dentry *, const char *);
1769extern int simple_fill_super(struct super_block *, int, struct tree_descr *); 1817extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
1770extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count); 1818extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
1771extern void simple_release_fs(struct vfsmount **mount, int *count); 1819extern void simple_release_fs(struct vfsmount **mount, int *count);
1772 1820
1773extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t); 1821extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t);
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 783c476b8674..74ed35a00a94 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -69,34 +69,21 @@ enum fs_ioport {
69 fsiop_porte, 69 fsiop_porte,
70}; 70};
71 71
72struct fs_mii_bus_info { 72struct fs_mii_bit {
73 int method; /* mii method */ 73 u32 offset;
74 int id; /* the id of the mii_bus */ 74 u8 bit;
75 int disable_aneg; /* if the controller needs to negothiate speed & duplex */ 75 u8 polarity;
76 int lpa; /* the default board-specific vallues will be applied otherwise */ 76};
77 77struct fs_mii_bb_platform_info {
78 union { 78 struct fs_mii_bit mdio_dir;
79 struct { 79 struct fs_mii_bit mdio_dat;
80 int duplex; 80 struct fs_mii_bit mdc_dat;
81 int speed; 81 int mdio_port; /* port & bit for MDIO */
82 } fixed; 82 int mdio_bit;
83 83 int mdc_port; /* port & bit for MDC */
84 struct { 84 int mdc_bit;
85 /* nothing */ 85 int delay; /* delay in us */
86 } fec; 86 int irq[32]; /* irqs per phy's */
87
88 struct {
89 /* nothing */
90 } scc;
91
92 struct {
93 int mdio_port; /* port & bit for MDIO */
94 int mdio_bit;
95 int mdc_port; /* port & bit for MDC */
96 int mdc_bit;
97 int delay; /* delay in us */
98 } bitbang;
99 } i;
100}; 87};
101 88
102struct fs_platform_info { 89struct fs_platform_info {
@@ -119,6 +106,7 @@ struct fs_platform_info {
119 u32 device_flags; 106 u32 device_flags;
120 107
121 int phy_addr; /* the phy address (-1 no phy) */ 108 int phy_addr; /* the phy address (-1 no phy) */
109 const char* bus_id;
122 int phy_irq; /* the phy irq (if it exists) */ 110 int phy_irq; /* the phy irq (if it exists) */
123 111
124 const struct fs_mii_bus_info *bus_info; 112 const struct fs_mii_bus_info *bus_info;
@@ -130,6 +118,10 @@ struct fs_platform_info {
130 int napi_weight; /* NAPI weight */ 118 int napi_weight; /* NAPI weight */
131 119
132 int use_rmii; /* use RMII mode */ 120 int use_rmii; /* use RMII mode */
121 int has_phy; /* if the network is phy container as well...*/
122};
123struct fs_mii_fec_platform_info {
124 u32 irq[32];
125 u32 mii_speed;
133}; 126};
134
135#endif 127#endif
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index cc5dec70c32c..d4f219ffaa5d 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -67,7 +67,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
67 if (source) { 67 if (source) {
68 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL); 68 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
69 } 69 }
70 audit_inode_child(new_name, source, new_dir->i_ino); 70 audit_inode_child(new_name, source, new_dir);
71} 71}
72 72
73/* 73/*
@@ -98,7 +98,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
98 inode_dir_notify(inode, DN_CREATE); 98 inode_dir_notify(inode, DN_CREATE);
99 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, 99 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
100 dentry->d_inode); 100 dentry->d_inode);
101 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); 101 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode);
102} 102}
103 103
104/* 104/*
@@ -109,7 +109,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
109 inode_dir_notify(inode, DN_CREATE); 109 inode_dir_notify(inode, DN_CREATE);
110 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, 110 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0,
111 dentry->d_name.name, dentry->d_inode); 111 dentry->d_name.name, dentry->d_inode);
112 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); 112 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode);
113} 113}
114 114
115/* 115/*
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 5425b60021e3..9fc48a674b82 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -1,6 +1,6 @@
1/* 1/*
2 FUSE: Filesystem in Userspace 2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> 3 Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
4 4
5 This program can be distributed under the terms of the GNU GPL. 5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING. 6 See the file COPYING.
@@ -9,18 +9,19 @@
9/* This file defines the kernel interface of FUSE */ 9/* This file defines the kernel interface of FUSE */
10 10
11#include <asm/types.h> 11#include <asm/types.h>
12#include <linux/major.h>
12 13
13/** Version number of this interface */ 14/** Version number of this interface */
14#define FUSE_KERNEL_VERSION 7 15#define FUSE_KERNEL_VERSION 7
15 16
16/** Minor version number of this interface */ 17/** Minor version number of this interface */
17#define FUSE_KERNEL_MINOR_VERSION 6 18#define FUSE_KERNEL_MINOR_VERSION 7
18 19
19/** The node ID of the root inode */ 20/** The node ID of the root inode */
20#define FUSE_ROOT_ID 1 21#define FUSE_ROOT_ID 1
21 22
22/** The major number of the fuse character device */ 23/** The major number of the fuse character device */
23#define FUSE_MAJOR 10 24#define FUSE_MAJOR MISC_MAJOR
24 25
25/** The minor number of the fuse character device */ 26/** The minor number of the fuse character device */
26#define FUSE_MINOR 229 27#define FUSE_MINOR 229
@@ -58,6 +59,13 @@ struct fuse_kstatfs {
58 __u32 spare[6]; 59 __u32 spare[6];
59}; 60};
60 61
62struct fuse_file_lock {
63 __u64 start;
64 __u64 end;
65 __u32 type;
66 __u32 pid; /* tgid */
67};
68
61/** 69/**
62 * Bitmasks for fuse_setattr_in.valid 70 * Bitmasks for fuse_setattr_in.valid
63 */ 71 */
@@ -82,6 +90,7 @@ struct fuse_kstatfs {
82 * INIT request/reply flags 90 * INIT request/reply flags
83 */ 91 */
84#define FUSE_ASYNC_READ (1 << 0) 92#define FUSE_ASYNC_READ (1 << 0)
93#define FUSE_POSIX_LOCKS (1 << 1)
85 94
86enum fuse_opcode { 95enum fuse_opcode {
87 FUSE_LOOKUP = 1, 96 FUSE_LOOKUP = 1,
@@ -112,8 +121,12 @@ enum fuse_opcode {
112 FUSE_READDIR = 28, 121 FUSE_READDIR = 28,
113 FUSE_RELEASEDIR = 29, 122 FUSE_RELEASEDIR = 29,
114 FUSE_FSYNCDIR = 30, 123 FUSE_FSYNCDIR = 30,
124 FUSE_GETLK = 31,
125 FUSE_SETLK = 32,
126 FUSE_SETLKW = 33,
115 FUSE_ACCESS = 34, 127 FUSE_ACCESS = 34,
116 FUSE_CREATE = 35 128 FUSE_CREATE = 35,
129 FUSE_INTERRUPT = 36,
117}; 130};
118 131
119/* The read buffer is required to be at least 8k, but may be much larger */ 132/* The read buffer is required to be at least 8k, but may be much larger */
@@ -199,6 +212,7 @@ struct fuse_flush_in {
199 __u64 fh; 212 __u64 fh;
200 __u32 flush_flags; 213 __u32 flush_flags;
201 __u32 padding; 214 __u32 padding;
215 __u64 lock_owner;
202}; 216};
203 217
204struct fuse_read_in { 218struct fuse_read_in {
@@ -247,6 +261,16 @@ struct fuse_getxattr_out {
247 __u32 padding; 261 __u32 padding;
248}; 262};
249 263
264struct fuse_lk_in {
265 __u64 fh;
266 __u64 owner;
267 struct fuse_file_lock lk;
268};
269
270struct fuse_lk_out {
271 struct fuse_file_lock lk;
272};
273
250struct fuse_access_in { 274struct fuse_access_in {
251 __u32 mask; 275 __u32 mask;
252 __u32 padding; 276 __u32 padding;
@@ -268,6 +292,10 @@ struct fuse_init_out {
268 __u32 max_write; 292 __u32 max_write;
269}; 293};
270 294
295struct fuse_interrupt_in {
296 __u64 unique;
297};
298
271struct fuse_in_header { 299struct fuse_in_header {
272 __u32 len; 300 __u32 len;
273 __u32 opcode; 301 __u32 opcode;
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 966a5b3da439..d097b5b72bc6 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -12,6 +12,9 @@
12#define FUTEX_REQUEUE 3 12#define FUTEX_REQUEUE 3
13#define FUTEX_CMP_REQUEUE 4 13#define FUTEX_CMP_REQUEUE 4
14#define FUTEX_WAKE_OP 5 14#define FUTEX_WAKE_OP 5
15#define FUTEX_LOCK_PI 6
16#define FUTEX_UNLOCK_PI 7
17#define FUTEX_TRYLOCK_PI 8
15 18
16/* 19/*
17 * Support for robust futexes: the kernel cleans up held futexes at 20 * Support for robust futexes: the kernel cleans up held futexes at
@@ -90,18 +93,22 @@ struct robust_list_head {
90 */ 93 */
91#define ROBUST_LIST_LIMIT 2048 94#define ROBUST_LIST_LIMIT 2048
92 95
93long do_futex(unsigned long uaddr, int op, int val, 96long do_futex(u32 __user *uaddr, int op, u32 val, unsigned long timeout,
94 unsigned long timeout, unsigned long uaddr2, int val2, 97 u32 __user *uaddr2, u32 val2, u32 val3);
95 int val3);
96 98
97extern int handle_futex_death(u32 __user *uaddr, struct task_struct *curr); 99extern int
100handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi);
98 101
99#ifdef CONFIG_FUTEX 102#ifdef CONFIG_FUTEX
100extern void exit_robust_list(struct task_struct *curr); 103extern void exit_robust_list(struct task_struct *curr);
104extern void exit_pi_state_list(struct task_struct *curr);
101#else 105#else
102static inline void exit_robust_list(struct task_struct *curr) 106static inline void exit_robust_list(struct task_struct *curr)
103{ 107{
104} 108}
109static inline void exit_pi_state_list(struct task_struct *curr)
110{
111}
105#endif 112#endif
106 113
107#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */ 114#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h
new file mode 100644
index 000000000000..80764f40be75
--- /dev/null
+++ b/include/linux/generic_acl.h
@@ -0,0 +1,36 @@
1/*
2 * fs/generic_acl.c
3 *
4 * (C) 2005 Andreas Gruenbacher <agruen@suse.de>
5 *
6 * This file is released under the GPL.
7 */
8
9#ifndef GENERIC_ACL_H
10#define GENERIC_ACL_H
11
12#include <linux/posix_acl.h>
13#include <linux/posix_acl_xattr.h>
14
15/**
16 * struct generic_acl_operations - filesystem operations
17 *
18 * Filesystems must make these operations available to the generic
19 * operations.
20 */
21struct generic_acl_operations {
22 struct posix_acl *(*getacl)(struct inode *, int);
23 void (*setacl)(struct inode *, int, struct posix_acl *);
24};
25
26size_t generic_acl_list(struct inode *, struct generic_acl_operations *, int,
27 char *, size_t);
28int generic_acl_get(struct inode *, struct generic_acl_operations *, int,
29 void *, size_t);
30int generic_acl_set(struct inode *, struct generic_acl_operations *, int,
31 const void *, size_t);
32int generic_acl_init(struct inode *, struct inode *,
33 struct generic_acl_operations *);
34int generic_acl_chmod(struct inode *, struct generic_acl_operations *);
35
36#endif
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 84f12a41dc01..9049dc65ae51 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -16,6 +16,8 @@ struct genlmsghdr {
16 16
17#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) 17#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
18 18
19#define GENL_ADMIN_PERM 0x01
20
19/* 21/*
20 * List of reserved static generic netlink identifiers: 22 * List of reserved static generic netlink identifiers:
21 */ 23 */
@@ -43,9 +45,25 @@ enum {
43 CTRL_ATTR_UNSPEC, 45 CTRL_ATTR_UNSPEC,
44 CTRL_ATTR_FAMILY_ID, 46 CTRL_ATTR_FAMILY_ID,
45 CTRL_ATTR_FAMILY_NAME, 47 CTRL_ATTR_FAMILY_NAME,
48 CTRL_ATTR_VERSION,
49 CTRL_ATTR_HDRSIZE,
50 CTRL_ATTR_MAXATTR,
51 CTRL_ATTR_OPS,
46 __CTRL_ATTR_MAX, 52 __CTRL_ATTR_MAX,
47}; 53};
48 54
49#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) 55#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
50 56
57enum {
58 CTRL_ATTR_OP_UNSPEC,
59 CTRL_ATTR_OP_ID,
60 CTRL_ATTR_OP_FLAGS,
61 CTRL_ATTR_OP_POLICY,
62 CTRL_ATTR_OP_DOIT,
63 CTRL_ATTR_OP_DUMPIT,
64 __CTRL_ATTR_OP_MAX,
65};
66
67#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
68
51#endif /* __LINUX_GENERIC_NETLINK_H */ 69#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 3498a0c68184..e4af57e87c17 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -112,8 +112,6 @@ struct gendisk {
112 sector_t capacity; 112 sector_t capacity;
113 113
114 int flags; 114 int flags;
115 char devfs_name[64]; /* devfs crap */
116 int number; /* more of the same */
117 struct device *driverfs_dev; 115 struct device *driverfs_dev;
118 struct kobject kobj; 116 struct kobject kobj;
119 struct kobject *holder_dir; 117 struct kobject *holder_dir;
diff --git a/include/linux/getcpu.h b/include/linux/getcpu.h
new file mode 100644
index 000000000000..c7372d7a97be
--- /dev/null
+++ b/include/linux/getcpu.h
@@ -0,0 +1,18 @@
1#ifndef _LINUX_GETCPU_H
2#define _LINUX_GETCPU_H 1
3
4/* Cache for getcpu() to speed it up. Results might be a short time
5 out of date, but will be faster.
6
7 User programs should not refer to the contents of this structure.
8 I repeat they should not refer to it. If they do they will break
9 in future kernels.
10
11 It is only a private cache for vgetcpu(). It will change in future kernels.
12 The user program must store this information per thread (__thread)
13 If you want 100% accurate information pass NULL instead. */
14struct getcpu_cache {
15 unsigned long blob[128 / sizeof(long)];
16};
17
18#endif
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index cc9e60844484..bf2b6bc3f6fd 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -9,17 +9,16 @@ struct vm_area_struct;
9 9
10/* 10/*
11 * GFP bitmasks.. 11 * GFP bitmasks..
12 *
13 * Zone modifiers (see linux/mmzone.h - low three bits)
14 *
15 * Do not put any conditional on these. If necessary modify the definitions
16 * without the underscores and use the consistently. The definitions here may
17 * be used in bit comparisons.
12 */ 18 */
13/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
14#define __GFP_DMA ((__force gfp_t)0x01u) 19#define __GFP_DMA ((__force gfp_t)0x01u)
15#define __GFP_HIGHMEM ((__force gfp_t)0x02u) 20#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
16#ifdef CONFIG_DMA_IS_DMA32 21#define __GFP_DMA32 ((__force gfp_t)0x04u)
17#define __GFP_DMA32 ((__force gfp_t)0x01) /* ZONE_DMA is ZONE_DMA32 */
18#elif BITS_PER_LONG < 64
19#define __GFP_DMA32 ((__force gfp_t)0x00) /* ZONE_NORMAL is ZONE_DMA32 */
20#else
21#define __GFP_DMA32 ((__force gfp_t)0x04) /* Has own ZONE_DMA32 */
22#endif
23 22
24/* 23/*
25 * Action modifiers - doesn't change the zoning 24 * Action modifiers - doesn't change the zoning
@@ -46,6 +45,7 @@ struct vm_area_struct;
46#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ 45#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */
47#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ 46#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */
48#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ 47#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */
48#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */
49 49
50#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ 50#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
51#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 51#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
@@ -54,7 +54,7 @@ struct vm_area_struct;
54#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ 54#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
55 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ 55 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
56 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ 56 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
57 __GFP_NOMEMALLOC|__GFP_HARDWALL) 57 __GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_THISNODE)
58 58
59/* This equals 0, but use constants in case they ever change */ 59/* This equals 0, but use constants in case they ever change */
60#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) 60#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH)
@@ -67,6 +67,13 @@ struct vm_area_struct;
67#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ 67#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \
68 __GFP_HIGHMEM) 68 __GFP_HIGHMEM)
69 69
70#ifdef CONFIG_NUMA
71#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
72#else
73#define GFP_THISNODE 0
74#endif
75
76
70/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some 77/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
71 platforms, used as appropriate on others */ 78 platforms, used as appropriate on others */
72 79
@@ -76,11 +83,19 @@ struct vm_area_struct;
76#define GFP_DMA32 __GFP_DMA32 83#define GFP_DMA32 __GFP_DMA32
77 84
78 85
79static inline int gfp_zone(gfp_t gfp) 86static inline enum zone_type gfp_zone(gfp_t flags)
80{ 87{
81 int zone = GFP_ZONEMASK & (__force int) gfp; 88 if (flags & __GFP_DMA)
82 BUG_ON(zone >= GFP_ZONETYPES); 89 return ZONE_DMA;
83 return zone; 90#ifdef CONFIG_ZONE_DMA32
91 if (flags & __GFP_DMA32)
92 return ZONE_DMA32;
93#endif
94#ifdef CONFIG_HIGHMEM
95 if (flags & __GFP_HIGHMEM)
96 return ZONE_HIGHMEM;
97#endif
98 return ZONE_NORMAL;
84} 99}
85 100
86/* 101/*
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 114ae583cca9..50d8b5744cf6 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/preempt.h> 4#include <linux/preempt.h>
5#include <linux/smp_lock.h> 5#include <linux/smp_lock.h>
6#include <linux/lockdep.h>
6#include <asm/hardirq.h> 7#include <asm/hardirq.h>
7#include <asm/system.h> 8#include <asm/system.h>
8 9
@@ -86,9 +87,6 @@ extern void synchronize_irq(unsigned int irq);
86# define synchronize_irq(irq) barrier() 87# define synchronize_irq(irq) barrier()
87#endif 88#endif
88 89
89#define nmi_enter() irq_enter()
90#define nmi_exit() sub_preempt_count(HARDIRQ_OFFSET)
91
92struct task_struct; 90struct task_struct;
93 91
94#ifndef CONFIG_VIRT_CPU_ACCOUNTING 92#ifndef CONFIG_VIRT_CPU_ACCOUNTING
@@ -97,12 +95,35 @@ static inline void account_system_vtime(struct task_struct *tsk)
97} 95}
98#endif 96#endif
99 97
98/*
99 * It is safe to do non-atomic ops on ->hardirq_context,
100 * because NMI handlers may not preempt and the ops are
101 * always balanced, so the interrupted value of ->hardirq_context
102 * will always be restored.
103 */
100#define irq_enter() \ 104#define irq_enter() \
101 do { \ 105 do { \
102 account_system_vtime(current); \ 106 account_system_vtime(current); \
103 add_preempt_count(HARDIRQ_OFFSET); \ 107 add_preempt_count(HARDIRQ_OFFSET); \
108 trace_hardirq_enter(); \
109 } while (0)
110
111/*
112 * Exit irq context without processing softirqs:
113 */
114#define __irq_exit() \
115 do { \
116 trace_hardirq_exit(); \
117 account_system_vtime(current); \
118 sub_preempt_count(HARDIRQ_OFFSET); \
104 } while (0) 119 } while (0)
105 120
121/*
122 * Exit irq context and process softirqs if needed:
123 */
106extern void irq_exit(void); 124extern void irq_exit(void);
107 125
126#define nmi_enter() do { lockdep_off(); irq_enter(); } while (0)
127#define nmi_exit() do { __irq_exit(); lockdep_on(); } while (0)
128
108#endif /* LINUX_HARDIRQ_H */ 129#endif /* LINUX_HARDIRQ_H */
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index 4513f9e40937..d4b333938f73 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -11,95 +11,46 @@
11#ifndef __HDLC_H 11#ifndef __HDLC_H
12#define __HDLC_H 12#define __HDLC_H
13 13
14#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
15
16#define CLOCK_DEFAULT 0 /* Default setting */
17#define CLOCK_EXT 1 /* External TX and RX clock - DTE */
18#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */
19#define CLOCK_TXINT 3 /* Internal TX and external RX clock */
20#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */
21
22
23#define ENCODING_DEFAULT 0 /* Default setting */
24#define ENCODING_NRZ 1
25#define ENCODING_NRZI 2
26#define ENCODING_FM_MARK 3
27#define ENCODING_FM_SPACE 4
28#define ENCODING_MANCHESTER 5
29
30
31#define PARITY_DEFAULT 0 /* Default setting */
32#define PARITY_NONE 1 /* No parity */
33#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */
34#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */
35#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */
36#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */
37#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */
38#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */
39
40#define LMI_DEFAULT 0 /* Default setting */
41#define LMI_NONE 1 /* No LMI, all PVCs are static */
42#define LMI_ANSI 2 /* ANSI Annex D */
43#define LMI_CCITT 3 /* ITU-T Annex A */
44#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
45 14
46#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ 15#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */
16#if 0
47#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ 17#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */
18#else
19#define HDLC_MAX_MRU 1600 /* as required for FR network */
20#endif
48 21
49 22
50#ifdef __KERNEL__ 23#ifdef __KERNEL__
51 24
52#include <linux/skbuff.h> 25#include <linux/skbuff.h>
53#include <linux/netdevice.h> 26#include <linux/netdevice.h>
54#include <net/syncppp.h>
55#include <linux/hdlc/ioctl.h> 27#include <linux/hdlc/ioctl.h>
56 28
57 29
58typedef struct { /* Used in Cisco and PPP mode */ 30/* Used by all network devices here, pointed to by netdev_priv(dev) */
59 u8 address; 31struct hdlc_device_desc {
60 u8 control; 32 int (*netif_rx)(struct sk_buff *skb);
61 u16 protocol;
62}__attribute__ ((packed)) hdlc_header;
63
64
65
66typedef struct {
67 u32 type; /* code */
68 u32 par1;
69 u32 par2;
70 u16 rel; /* reliability */
71 u32 time;
72}__attribute__ ((packed)) cisco_packet;
73#define CISCO_PACKET_LEN 18
74#define CISCO_BIG_PACKET_LEN 20
75
76
77
78typedef struct pvc_device_struct {
79 struct net_device *master;
80 struct net_device *main;
81 struct net_device *ether; /* bridged Ethernet interface */
82 struct pvc_device_struct *next; /* Sorted in ascending DLCI order */
83 int dlci;
84 int open_count;
85
86 struct {
87 unsigned int new: 1;
88 unsigned int active: 1;
89 unsigned int exist: 1;
90 unsigned int deleted: 1;
91 unsigned int fecn: 1;
92 unsigned int becn: 1;
93 unsigned int bandwidth; /* Cisco LMI reporting only */
94 }state;
95}pvc_device;
96
97
98
99typedef struct hdlc_device_struct {
100 /* To be initialized by hardware driver */
101 struct net_device_stats stats; 33 struct net_device_stats stats;
102 34};
35
36/* This structure is a private property of HDLC protocols.
37 Hardware drivers have no interest here */
38
39struct hdlc_proto {
40 int (*open)(struct net_device *dev);
41 void (*close)(struct net_device *dev);
42 void (*start)(struct net_device *dev); /* if open & DCD */
43 void (*stop)(struct net_device *dev); /* if open & !DCD */
44 void (*detach)(struct net_device *dev);
45 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
46 unsigned short (*type_trans)(struct sk_buff *skb,
47 struct net_device *dev);
48 struct module *module;
49 struct hdlc_proto *next; /* next protocol in the list */
50};
51
52
53typedef struct hdlc_device {
103 /* used by HDLC layer to take control over HDLC device from hw driver*/ 54 /* used by HDLC layer to take control over HDLC device from hw driver*/
104 int (*attach)(struct net_device *dev, 55 int (*attach)(struct net_device *dev,
105 unsigned short encoding, unsigned short parity); 56 unsigned short encoding, unsigned short parity);
@@ -107,82 +58,18 @@ typedef struct hdlc_device_struct {
107 /* hardware driver must handle this instead of dev->hard_start_xmit */ 58 /* hardware driver must handle this instead of dev->hard_start_xmit */
108 int (*xmit)(struct sk_buff *skb, struct net_device *dev); 59 int (*xmit)(struct sk_buff *skb, struct net_device *dev);
109 60
110
111 /* Things below are for HDLC layer internal use only */ 61 /* Things below are for HDLC layer internal use only */
112 struct { 62 const struct hdlc_proto *proto;
113 int (*open)(struct net_device *dev);
114 void (*close)(struct net_device *dev);
115
116 /* if open & DCD */
117 void (*start)(struct net_device *dev);
118 /* if open & !DCD */
119 void (*stop)(struct net_device *dev);
120
121 void (*detach)(struct hdlc_device_struct *hdlc);
122 int (*netif_rx)(struct sk_buff *skb);
123 unsigned short (*type_trans)(struct sk_buff *skb,
124 struct net_device *dev);
125 int id; /* IF_PROTO_HDLC/CISCO/FR/etc. */
126 }proto;
127
128 int carrier; 63 int carrier;
129 int open; 64 int open;
130 spinlock_t state_lock; 65 spinlock_t state_lock;
131 66 void *state;
132 union {
133 struct {
134 fr_proto settings;
135 pvc_device *first_pvc;
136 int dce_pvc_count;
137
138 struct timer_list timer;
139 unsigned long last_poll;
140 int reliable;
141 int dce_changed;
142 int request;
143 int fullrep_sent;
144 u32 last_errors; /* last errors bit list */
145 u8 n391cnt;
146 u8 txseq; /* TX sequence number */
147 u8 rxseq; /* RX sequence number */
148 }fr;
149
150 struct {
151 cisco_proto settings;
152
153 struct timer_list timer;
154 unsigned long last_poll;
155 int up;
156 int request_sent;
157 u32 txseq; /* TX sequence number */
158 u32 rxseq; /* RX sequence number */
159 }cisco;
160
161 struct {
162 raw_hdlc_proto settings;
163 }raw_hdlc;
164
165 struct {
166 struct ppp_device pppdev;
167 struct ppp_device *syncppp_ptr;
168 int (*old_change_mtu)(struct net_device *dev,
169 int new_mtu);
170 }ppp;
171 }state;
172 void *priv; 67 void *priv;
173}hdlc_device; 68}hdlc_device;
174 69
175 70
176 71
177int hdlc_raw_ioctl(struct net_device *dev, struct ifreq *ifr); 72/* Exported from hdlc module */
178int hdlc_raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr);
179int hdlc_cisco_ioctl(struct net_device *dev, struct ifreq *ifr);
180int hdlc_ppp_ioctl(struct net_device *dev, struct ifreq *ifr);
181int hdlc_fr_ioctl(struct net_device *dev, struct ifreq *ifr);
182int hdlc_x25_ioctl(struct net_device *dev, struct ifreq *ifr);
183
184
185/* Exported from hdlc.o */
186 73
187/* Called by hardware driver when a user requests HDLC service */ 74/* Called by hardware driver when a user requests HDLC service */
188int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 75int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
@@ -191,17 +78,21 @@ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
191#define register_hdlc_device(dev) register_netdev(dev) 78#define register_hdlc_device(dev) register_netdev(dev)
192void unregister_hdlc_device(struct net_device *dev); 79void unregister_hdlc_device(struct net_device *dev);
193 80
81
82void register_hdlc_protocol(struct hdlc_proto *proto);
83void unregister_hdlc_protocol(struct hdlc_proto *proto);
84
194struct net_device *alloc_hdlcdev(void *priv); 85struct net_device *alloc_hdlcdev(void *priv);
195 86
196static __inline__ hdlc_device* dev_to_hdlc(struct net_device *dev) 87
88static __inline__ struct hdlc_device_desc* dev_to_desc(struct net_device *dev)
197{ 89{
198 return netdev_priv(dev); 90 return netdev_priv(dev);
199} 91}
200 92
201 93static __inline__ hdlc_device* dev_to_hdlc(struct net_device *dev)
202static __inline__ pvc_device* dev_to_pvc(struct net_device *dev)
203{ 94{
204 return (pvc_device*)dev->priv; 95 return netdev_priv(dev) + sizeof(struct hdlc_device_desc);
205} 96}
206 97
207 98
@@ -224,21 +115,15 @@ static __inline__ void debug_frame(const struct sk_buff *skb)
224int hdlc_open(struct net_device *dev); 115int hdlc_open(struct net_device *dev);
225/* Must be called by hardware driver when HDLC device is being closed */ 116/* Must be called by hardware driver when HDLC device is being closed */
226void hdlc_close(struct net_device *dev); 117void hdlc_close(struct net_device *dev);
227/* Called by hardware driver when DCD line level changes */
228void hdlc_set_carrier(int on, struct net_device *dev);
229 118
119int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
120 int (*rx)(struct sk_buff *skb), size_t size);
230/* May be used by hardware driver to gain control over HDLC device */ 121/* May be used by hardware driver to gain control over HDLC device */
231static __inline__ void hdlc_proto_detach(hdlc_device *hdlc) 122void detach_hdlc_protocol(struct net_device *dev);
232{
233 if (hdlc->proto.detach)
234 hdlc->proto.detach(hdlc);
235 hdlc->proto.detach = NULL;
236}
237
238 123
239static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) 124static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev)
240{ 125{
241 return &dev_to_hdlc(dev)->stats; 126 return &dev_to_desc(dev)->stats;
242} 127}
243 128
244 129
@@ -250,8 +135,8 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
250 skb->mac.raw = skb->data; 135 skb->mac.raw = skb->data;
251 skb->dev = dev; 136 skb->dev = dev;
252 137
253 if (hdlc->proto.type_trans) 138 if (hdlc->proto->type_trans)
254 return hdlc->proto.type_trans(skb, dev); 139 return hdlc->proto->type_trans(skb, dev);
255 else 140 else
256 return htons(ETH_P_HDLC); 141 return htons(ETH_P_HDLC);
257} 142}
diff --git a/include/linux/hdlc/Kbuild b/include/linux/hdlc/Kbuild
new file mode 100644
index 000000000000..1fb26448faa9
--- /dev/null
+++ b/include/linux/hdlc/Kbuild
@@ -0,0 +1 @@
header-y += ioctl.h
diff --git a/include/linux/hdlc/ioctl.h b/include/linux/hdlc/ioctl.h
index 78430ba3ea69..583972364357 100644
--- a/include/linux/hdlc/ioctl.h
+++ b/include/linux/hdlc/ioctl.h
@@ -1,6 +1,39 @@
1#ifndef __HDLC_IOCTL_H__ 1#ifndef __HDLC_IOCTL_H__
2#define __HDLC_IOCTL_H__ 2#define __HDLC_IOCTL_H__
3 3
4
5#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
6
7#define CLOCK_DEFAULT 0 /* Default setting */
8#define CLOCK_EXT 1 /* External TX and RX clock - DTE */
9#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */
10#define CLOCK_TXINT 3 /* Internal TX and external RX clock */
11#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */
12
13
14#define ENCODING_DEFAULT 0 /* Default setting */
15#define ENCODING_NRZ 1
16#define ENCODING_NRZI 2
17#define ENCODING_FM_MARK 3
18#define ENCODING_FM_SPACE 4
19#define ENCODING_MANCHESTER 5
20
21
22#define PARITY_DEFAULT 0 /* Default setting */
23#define PARITY_NONE 1 /* No parity */
24#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */
25#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */
26#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */
27#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */
28#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */
29#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */
30
31#define LMI_DEFAULT 0 /* Default setting */
32#define LMI_NONE 1 /* No LMI, all PVCs are static */
33#define LMI_ANSI 2 /* ANSI Annex D */
34#define LMI_CCITT 3 /* ITU-T Annex A */
35#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
36
4typedef struct { 37typedef struct {
5 unsigned int clock_rate; /* bits per second */ 38 unsigned int clock_rate; /* bits per second */
6 unsigned int clock_type; /* internal, external, TX-internal etc. */ 39 unsigned int clock_type; /* internal, external, TX-internal etc. */
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 85ce7ef9a512..fd7d12daa94f 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -24,11 +24,15 @@ static inline void flush_kernel_dcache_page(struct page *page)
24 24
25/* declarations for linux/mm/highmem.c */ 25/* declarations for linux/mm/highmem.c */
26unsigned int nr_free_highpages(void); 26unsigned int nr_free_highpages(void);
27extern unsigned long totalhigh_pages;
27 28
28#else /* CONFIG_HIGHMEM */ 29#else /* CONFIG_HIGHMEM */
29 30
30static inline unsigned int nr_free_highpages(void) { return 0; } 31static inline unsigned int nr_free_highpages(void) { return 0; }
31 32
33#define totalhigh_pages 0
34
35#ifndef ARCH_HAS_KMAP
32static inline void *kmap(struct page *page) 36static inline void *kmap(struct page *page)
33{ 37{
34 might_sleep(); 38 might_sleep();
@@ -41,6 +45,7 @@ static inline void *kmap(struct page *page)
41#define kunmap_atomic(addr, idx) do { } while (0) 45#define kunmap_atomic(addr, idx) do { } while (0)
42#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) 46#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn))
43#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 47#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
48#endif
44 49
45#endif /* CONFIG_HIGHMEM */ 50#endif /* CONFIG_HIGHMEM */
46 51
diff --git a/include/linux/hpfs_fs.h b/include/linux/hpfs_fs.h
deleted file mode 100644
index a5028dd94d31..000000000000
--- a/include/linux/hpfs_fs.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _LINUX_HPFS_FS_H
2#define _LINUX_HPFS_FS_H
3
4/* HPFS magic number (word 0 of block 16) */
5
6#define HPFS_SUPER_MAGIC 0xf995e849
7
8#endif
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 7d2a1b974c5e..fca93025ab51 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -40,7 +40,6 @@ struct hrtimer_base;
40 40
41/** 41/**
42 * struct hrtimer - the basic hrtimer structure 42 * struct hrtimer - the basic hrtimer structure
43 *
44 * @node: red black tree node for time ordered insertion 43 * @node: red black tree node for time ordered insertion
45 * @expires: the absolute expiry time in the hrtimers internal 44 * @expires: the absolute expiry time in the hrtimers internal
46 * representation. The time is related to the clock on 45 * representation. The time is related to the clock on
@@ -59,7 +58,6 @@ struct hrtimer {
59 58
60/** 59/**
61 * struct hrtimer_sleeper - simple sleeper structure 60 * struct hrtimer_sleeper - simple sleeper structure
62 *
63 * @timer: embedded timer structure 61 * @timer: embedded timer structure
64 * @task: task to wake up 62 * @task: task to wake up
65 * 63 *
@@ -72,7 +70,6 @@ struct hrtimer_sleeper {
72 70
73/** 71/**
74 * struct hrtimer_base - the timer base for a specific clock 72 * struct hrtimer_base - the timer base for a specific clock
75 *
76 * @index: clock type index for per_cpu support when moving a timer 73 * @index: clock type index for per_cpu support when moving a timer
77 * to a base on another cpu. 74 * to a base on another cpu.
78 * @lock: lock protecting the base and associated timers 75 * @lock: lock protecting the base and associated timers
@@ -83,6 +80,7 @@ struct hrtimer_sleeper {
83 * @get_softirq_time: function to retrieve the current time from the softirq 80 * @get_softirq_time: function to retrieve the current time from the softirq
84 * @curr_timer: the timer which is executing a callback right now 81 * @curr_timer: the timer which is executing a callback right now
85 * @softirq_time: the time when running the hrtimer queue in the softirq 82 * @softirq_time: the time when running the hrtimer queue in the softirq
83 * @lock_key: the lock_class_key for use with lockdep
86 */ 84 */
87struct hrtimer_base { 85struct hrtimer_base {
88 clockid_t index; 86 clockid_t index;
@@ -94,6 +92,7 @@ struct hrtimer_base {
94 ktime_t (*get_softirq_time)(void); 92 ktime_t (*get_softirq_time)(void);
95 struct hrtimer *curr_timer; 93 struct hrtimer *curr_timer;
96 ktime_t softirq_time; 94 ktime_t softirq_time;
95 struct lock_class_key lock_key;
97}; 96};
98 97
99/* 98/*
@@ -139,6 +138,7 @@ extern long hrtimer_nanosleep(struct timespec *rqtp,
139 struct timespec __user *rmtp, 138 struct timespec __user *rmtp,
140 const enum hrtimer_mode mode, 139 const enum hrtimer_mode mode,
141 const clockid_t clockid); 140 const clockid_t clockid);
141extern long hrtimer_nanosleep_restart(struct restart_block *restart_block);
142 142
143extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, 143extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
144 struct task_struct *tsk); 144 struct task_struct *tsk);
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
new file mode 100644
index 000000000000..21ea7610e177
--- /dev/null
+++ b/include/linux/hw_random.h
@@ -0,0 +1,50 @@
1/*
2 Hardware Random Number Generator
3
4 Please read Documentation/hw_random.txt for details on use.
5
6 ----------------------------------------------------------
7 This software may be used and distributed according to the terms
8 of the GNU General Public License, incorporated herein by reference.
9
10 */
11
12#ifndef LINUX_HWRANDOM_H_
13#define LINUX_HWRANDOM_H_
14#ifdef __KERNEL__
15
16#include <linux/types.h>
17#include <linux/list.h>
18
19/**
20 * struct hwrng - Hardware Random Number Generator driver
21 * @name: Unique RNG name.
22 * @init: Initialization callback (can be NULL).
23 * @cleanup: Cleanup callback (can be NULL).
24 * @data_present: Callback to determine if data is available
25 * on the RNG. If NULL, it is assumed that
26 * there is always data available.
27 * @data_read: Read data from the RNG device.
28 * Returns the number of lower random bytes in "data".
29 * Must not be NULL.
30 * @priv: Private data, for use by the RNG driver.
31 */
32struct hwrng {
33 const char *name;
34 int (*init)(struct hwrng *rng);
35 void (*cleanup)(struct hwrng *rng);
36 int (*data_present)(struct hwrng *rng);
37 int (*data_read)(struct hwrng *rng, u32 *data);
38 unsigned long priv;
39
40 /* internal. */
41 struct list_head list;
42};
43
44/** Register a new Hardware Random Number Generator driver. */
45extern int hwrng_register(struct hwrng *rng);
46/** Unregister a Hardware Random Number Generator driver. */
47extern void hwrng_unregister(struct hwrng *rng);
48
49#endif /* __KERNEL__ */
50#endif /* LINUX_HWRANDOM_H_ */
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
index c0e7fab28ce3..c8f8df25c7e0 100644
--- a/include/linux/i2c-algo-bit.h
+++ b/include/linux/i2c-algo-bit.h
@@ -40,7 +40,6 @@ struct i2c_algo_bit_data {
40 /* local settings */ 40 /* local settings */
41 int udelay; /* half-clock-cycle time in microsecs */ 41 int udelay; /* half-clock-cycle time in microsecs */
42 /* i.e. clock is (500 / udelay) KHz */ 42 /* i.e. clock is (500 / udelay) KHz */
43 int mdelay; /* in millisecs, unused */
44 int timeout; /* in jiffies */ 43 int timeout; /* in jiffies */
45}; 44};
46 45
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
index 18b0adf57a3d..9908f3fc4839 100644
--- a/include/linux/i2c-algo-pcf.h
+++ b/include/linux/i2c-algo-pcf.h
@@ -35,7 +35,6 @@ struct i2c_algo_pcf_data {
35 35
36 /* local settings */ 36 /* local settings */
37 int udelay; 37 int udelay;
38 int mdelay;
39 int timeout; 38 int timeout;
40}; 39};
41 40
diff --git a/include/linux/i2c-algo-sibyte.h b/include/linux/i2c-algo-sibyte.h
deleted file mode 100644
index 03914ded8614..000000000000
--- a/include/linux/i2c-algo-sibyte.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * Copyright (C) 2001,2002,2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (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
19#ifndef I2C_ALGO_SIBYTE_H
20#define I2C_ALGO_SIBYTE_H 1
21
22#include <linux/i2c.h>
23
24struct i2c_algo_sibyte_data {
25 void *data; /* private data */
26 int bus; /* which bus */
27 void *reg_base; /* CSR base */
28};
29
30int i2c_sibyte_add_bus(struct i2c_adapter *, int speed);
31int i2c_sibyte_del_bus(struct i2c_adapter *);
32
33#endif /* I2C_ALGO_SIBYTE_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index cce6074dd754..0a8f750cbede 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -112,6 +112,10 @@
112#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */ 112#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */
113#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */ 113#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */
114#define I2C_DRIVERID_RS5C372 84 /* Ricoh RS5C372 RTC */ 114#define I2C_DRIVERID_RS5C372 84 /* Ricoh RS5C372 RTC */
115#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */
116#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
117#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
118#define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */
115 119
116#define I2C_DRIVERID_I2CDEV 900 120#define I2C_DRIVERID_I2CDEV 900
117#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 121#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 526ddc8eecfb..9b5d04768c2c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -64,14 +64,6 @@ extern int i2c_master_recv(struct i2c_client *,char* ,int);
64 */ 64 */
65extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); 65extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
66 66
67/*
68 * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
69 * This is not tested/implemented yet and will change in the future.
70 */
71extern int i2c_slave_send(struct i2c_client *,char*,int);
72extern int i2c_slave_recv(struct i2c_client *,char*,int);
73
74
75 67
76/* This is the very generalized SMBus access routine. You probably do not 68/* This is the very generalized SMBus access routine. You probably do not
77 want to use this, though; one of the functions below may be much easier, 69 want to use this, though; one of the functions below may be much easier,
@@ -193,16 +185,14 @@ struct i2c_algorithm {
193 to NULL. If an adapter algorithm can do SMBus access, set 185 to NULL. If an adapter algorithm can do SMBus access, set
194 smbus_xfer. If set to NULL, the SMBus protocol is simulated 186 smbus_xfer. If set to NULL, the SMBus protocol is simulated
195 using common I2C messages */ 187 using common I2C messages */
188 /* master_xfer should return the number of messages successfully
189 processed, or a negative value on error */
196 int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, 190 int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,
197 int num); 191 int num);
198 int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, 192 int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
199 unsigned short flags, char read_write, 193 unsigned short flags, char read_write,
200 u8 command, int size, union i2c_smbus_data * data); 194 u8 command, int size, union i2c_smbus_data * data);
201 195
202 /* --- these optional/future use for some adapter types.*/
203 int (*slave_send)(struct i2c_adapter *,char*,int);
204 int (*slave_recv)(struct i2c_adapter *,char*,int);
205
206 /* --- ioctl like call to set div. parameters. */ 196 /* --- ioctl like call to set div. parameters. */
207 int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long); 197 int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long);
208 198
@@ -218,7 +208,7 @@ struct i2c_adapter {
218 struct module *owner; 208 struct module *owner;
219 unsigned int id; 209 unsigned int id;
220 unsigned int class; 210 unsigned int class;
221 struct i2c_algorithm *algo;/* the algorithm to access the bus */ 211 const struct i2c_algorithm *algo; /* the algorithm to access the bus */
222 void *algo_data; 212 void *algo_data;
223 213
224 /* --- administration stuff. */ 214 /* --- administration stuff. */
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index f0b571f1060b..878cfe4e587f 100644
--- a/include/linux/icmp.h
+++ b/include/linux/icmp.h
@@ -68,16 +68,16 @@
68struct icmphdr { 68struct icmphdr {
69 __u8 type; 69 __u8 type;
70 __u8 code; 70 __u8 code;
71 __u16 checksum; 71 __be16 checksum;
72 union { 72 union {
73 struct { 73 struct {
74 __u16 id; 74 __be16 id;
75 __u16 sequence; 75 __be16 sequence;
76 } echo; 76 } echo;
77 __u32 gateway; 77 __be32 gateway;
78 struct { 78 struct {
79 __u16 __unused; 79 __be16 __unused;
80 __u16 mtu; 80 __be16 mtu;
81 } frag; 81 } frag;
82 } un; 82 } un;
83}; 83};
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 77e66d055f5b..99620451d958 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -552,7 +552,6 @@ typedef struct ide_drive_s {
552 struct hd_driveid *id; /* drive model identification info */ 552 struct hd_driveid *id; /* drive model identification info */
553 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 553 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
554 struct ide_settings_s *settings;/* /proc/ide/ drive settings */ 554 struct ide_settings_s *settings;/* /proc/ide/ drive settings */
555 char devfs_name[64]; /* devfs crap */
556 555
557 struct hwif_s *hwif; /* actually (ide_hwif_t *) */ 556 struct hwif_s *hwif; /* actually (ide_hwif_t *) */
558 557
@@ -572,6 +571,7 @@ typedef struct ide_drive_s {
572 u8 waiting_for_dma; /* dma currently in progress */ 571 u8 waiting_for_dma; /* dma currently in progress */
573 u8 unmask; /* okay to unmask other irqs */ 572 u8 unmask; /* okay to unmask other irqs */
574 u8 bswap; /* byte swap data */ 573 u8 bswap; /* byte swap data */
574 u8 noflush; /* don't attempt flushes */
575 u8 dsc_overlap; /* DSC overlap */ 575 u8 dsc_overlap; /* DSC overlap */
576 u8 nice1; /* give potential excess bandwidth */ 576 u8 nice1; /* give potential excess bandwidth */
577 577
@@ -630,6 +630,7 @@ typedef struct ide_drive_s {
630 unsigned int usage; /* current "open()" count for drive */ 630 unsigned int usage; /* current "open()" count for drive */
631 unsigned int failures; /* current failure count */ 631 unsigned int failures; /* current failure count */
632 unsigned int max_failures; /* maximum allowed failure count */ 632 unsigned int max_failures; /* maximum allowed failure count */
633 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */
633 634
634 u64 capacity64; /* total number of sectors */ 635 u64 capacity64; /* total number of sectors */
635 636
@@ -792,6 +793,7 @@ typedef struct hwif_s {
792 unsigned auto_poll : 1; /* supports nop auto-poll */ 793 unsigned auto_poll : 1; /* supports nop auto-poll */
793 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 794 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
794 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */ 795 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */
796 unsigned err_stops_fifo : 1; /* 1=data FIFO is cleared by an error */
795 797
796 struct device gendev; 798 struct device gendev;
797 struct completion gendev_rel_comp; /* To deal with device release() */ 799 struct completion gendev_rel_comp; /* To deal with device release() */
@@ -1005,6 +1007,8 @@ extern ide_hwif_t ide_hwifs[]; /* master data repository */
1005extern int noautodma; 1007extern int noautodma;
1006 1008
1007extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); 1009extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);
1010int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
1011 int uptodate, int nr_sectors);
1008 1012
1009/* 1013/*
1010 * This is used on exit from the driver to designate the next irq handler 1014 * This is used on exit from the driver to designate the next irq handler
@@ -1356,7 +1360,7 @@ extern struct semaphore ide_cfg_sem;
1356 * ide_drive_t->hwif: constant, no locking 1360 * ide_drive_t->hwif: constant, no locking
1357 */ 1361 */
1358 1362
1359#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable(); } while (0) 1363#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0)
1360 1364
1361extern struct bus_type ide_bus_type; 1365extern struct bus_type ide_bus_type;
1362 1366
diff --git a/include/linux/idr.h b/include/linux/idr.h
index d37c8d808b0f..826803449db7 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -66,7 +66,7 @@ struct idr {
66 .id_free = NULL, \ 66 .id_free = NULL, \
67 .layers = 0, \ 67 .layers = 0, \
68 .id_free_cnt = 0, \ 68 .id_free_cnt = 0, \
69 .lock = SPIN_LOCK_UNLOCKED, \ 69 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
70} 70}
71#define DEFINE_IDR(name) struct idr name = IDR_INIT(name) 71#define DEFINE_IDR(name) struct idr name = IDR_INIT(name)
72 72
@@ -78,6 +78,7 @@ void *idr_find(struct idr *idp, int id);
78int idr_pre_get(struct idr *idp, gfp_t gfp_mask); 78int idr_pre_get(struct idr *idp, gfp_t gfp_mask);
79int idr_get_new(struct idr *idp, void *ptr, int *id); 79int idr_get_new(struct idr *idp, void *ptr, int *id);
80int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); 80int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
81void *idr_replace(struct idr *idp, void *ptr, int id);
81void idr_remove(struct idr *idp, int id); 82void idr_remove(struct idr *idp, int id);
82void idr_destroy(struct idr *idp); 83void idr_destroy(struct idr *idp);
83void idr_init(struct idr *idp); 84void idr_init(struct idr *idp);
diff --git a/include/linux/if.h b/include/linux/if.h
index 374e20ad8b0d..32bf419351f1 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -59,6 +59,8 @@
59#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */ 59#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */
60#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */ 60#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */
61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ 61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
62#define IFF_BONDING 0x20 /* bonding master or slave */
63#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
62 64
63#define IF_GET_IFACE 0x0001 /* for querying only */ 65#define IF_GET_IFACE 0x0001 /* for querying only */
64#define IF_GET_PROTO 0x0002 66#define IF_GET_PROTO 0x0002
@@ -212,5 +214,4 @@ struct ifconf
212#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ 214#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
213#define ifc_req ifc_ifcu.ifcu_req /* array of structures */ 215#define ifc_req ifc_ifcu.ifcu_req /* array of structures */
214 216
215
216#endif /* _LINUX_IF_H */ 217#endif /* _LINUX_IF_H */
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
new file mode 100644
index 000000000000..dbe8f6120a40
--- /dev/null
+++ b/include/linux/if_addr.h
@@ -0,0 +1,55 @@
1#ifndef __LINUX_IF_ADDR_H
2#define __LINUX_IF_ADDR_H
3
4#include <linux/netlink.h>
5
6struct ifaddrmsg
7{
8 __u8 ifa_family;
9 __u8 ifa_prefixlen; /* The prefix length */
10 __u8 ifa_flags; /* Flags */
11 __u8 ifa_scope; /* Address scope */
12 __u32 ifa_index; /* Link index */
13};
14
15/*
16 * Important comment:
17 * IFA_ADDRESS is prefix address, rather than local interface address.
18 * It makes no difference for normally configured broadcast interfaces,
19 * but for point-to-point IFA_ADDRESS is DESTINATION address,
20 * local address is supplied in IFA_LOCAL attribute.
21 */
22enum
23{
24 IFA_UNSPEC,
25 IFA_ADDRESS,
26 IFA_LOCAL,
27 IFA_LABEL,
28 IFA_BROADCAST,
29 IFA_ANYCAST,
30 IFA_CACHEINFO,
31 IFA_MULTICAST,
32 __IFA_MAX,
33};
34
35#define IFA_MAX (__IFA_MAX - 1)
36
37/* ifa_flags */
38#define IFA_F_SECONDARY 0x01
39#define IFA_F_TEMPORARY IFA_F_SECONDARY
40
41#define IFA_F_NODAD 0x02
42#define IFA_F_HOMEADDRESS 0x10
43#define IFA_F_DEPRECATED 0x20
44#define IFA_F_TENTATIVE 0x40
45#define IFA_F_PERMANENT 0x80
46
47struct ifa_cacheinfo
48{
49 __u32 ifa_prefered;
50 __u32 ifa_valid;
51 __u32 cstamp; /* created timestamp, hundredths of seconds */
52 __u32 tstamp; /* updated timestamp, hundredths of seconds */
53};
54
55#endif
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index a8b1a2071838..7f5714214ee3 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -130,11 +130,11 @@ struct arpreq_old {
130 130
131struct arphdr 131struct arphdr
132{ 132{
133 unsigned short ar_hrd; /* format of hardware address */ 133 __be16 ar_hrd; /* format of hardware address */
134 unsigned short ar_pro; /* format of protocol address */ 134 __be16 ar_pro; /* format of protocol address */
135 unsigned char ar_hln; /* length of hardware address */ 135 unsigned char ar_hln; /* length of hardware address */
136 unsigned char ar_pln; /* length of protocol address */ 136 unsigned char ar_pln; /* length of protocol address */
137 unsigned short ar_op; /* ARP opcode (command) */ 137 __be16 ar_op; /* ARP opcode (command) */
138 138
139#if 0 139#if 0
140 /* 140 /*
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
new file mode 100644
index 000000000000..e963a077e6f5
--- /dev/null
+++ b/include/linux/if_link.h
@@ -0,0 +1,136 @@
1#ifndef _LINUX_IF_LINK_H
2#define _LINUX_IF_LINK_H
3
4#include <linux/netlink.h>
5
6/* The struct should be in sync with struct net_device_stats */
7struct rtnl_link_stats
8{
9 __u32 rx_packets; /* total packets received */
10 __u32 tx_packets; /* total packets transmitted */
11 __u32 rx_bytes; /* total bytes received */
12 __u32 tx_bytes; /* total bytes transmitted */
13 __u32 rx_errors; /* bad packets received */
14 __u32 tx_errors; /* packet transmit problems */
15 __u32 rx_dropped; /* no space in linux buffers */
16 __u32 tx_dropped; /* no space available in linux */
17 __u32 multicast; /* multicast packets received */
18 __u32 collisions;
19
20 /* detailed rx_errors: */
21 __u32 rx_length_errors;
22 __u32 rx_over_errors; /* receiver ring buff overflow */
23 __u32 rx_crc_errors; /* recved pkt with crc error */
24 __u32 rx_frame_errors; /* recv'd frame alignment error */
25 __u32 rx_fifo_errors; /* recv'r fifo overrun */
26 __u32 rx_missed_errors; /* receiver missed packet */
27
28 /* detailed tx_errors */
29 __u32 tx_aborted_errors;
30 __u32 tx_carrier_errors;
31 __u32 tx_fifo_errors;
32 __u32 tx_heartbeat_errors;
33 __u32 tx_window_errors;
34
35 /* for cslip etc */
36 __u32 rx_compressed;
37 __u32 tx_compressed;
38};
39
40/* The struct should be in sync with struct ifmap */
41struct rtnl_link_ifmap
42{
43 __u64 mem_start;
44 __u64 mem_end;
45 __u64 base_addr;
46 __u16 irq;
47 __u8 dma;
48 __u8 port;
49};
50
51enum
52{
53 IFLA_UNSPEC,
54 IFLA_ADDRESS,
55 IFLA_BROADCAST,
56 IFLA_IFNAME,
57 IFLA_MTU,
58 IFLA_LINK,
59 IFLA_QDISC,
60 IFLA_STATS,
61 IFLA_COST,
62#define IFLA_COST IFLA_COST
63 IFLA_PRIORITY,
64#define IFLA_PRIORITY IFLA_PRIORITY
65 IFLA_MASTER,
66#define IFLA_MASTER IFLA_MASTER
67 IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */
68#define IFLA_WIRELESS IFLA_WIRELESS
69 IFLA_PROTINFO, /* Protocol specific information for a link */
70#define IFLA_PROTINFO IFLA_PROTINFO
71 IFLA_TXQLEN,
72#define IFLA_TXQLEN IFLA_TXQLEN
73 IFLA_MAP,
74#define IFLA_MAP IFLA_MAP
75 IFLA_WEIGHT,
76#define IFLA_WEIGHT IFLA_WEIGHT
77 IFLA_OPERSTATE,
78 IFLA_LINKMODE,
79 __IFLA_MAX
80};
81
82
83#define IFLA_MAX (__IFLA_MAX - 1)
84
85/* ifi_flags.
86
87 IFF_* flags.
88
89 The only change is:
90 IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are
91 more not changeable by user. They describe link media
92 characteristics and set by device driver.
93
94 Comments:
95 - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid
96 - If neither of these three flags are set;
97 the interface is NBMA.
98
99 - IFF_MULTICAST does not mean anything special:
100 multicasts can be used on all not-NBMA links.
101 IFF_MULTICAST means that this media uses special encapsulation
102 for multicast frames. Apparently, all IFF_POINTOPOINT and
103 IFF_BROADCAST devices are able to use multicasts too.
104 */
105
106/* IFLA_LINK.
107 For usual devices it is equal ifi_index.
108 If it is a "virtual interface" (f.e. tunnel), ifi_link
109 can point to real physical interface (f.e. for bandwidth calculations),
110 or maybe 0, what means, that real media is unknown (usual
111 for IPIP tunnels, when route to endpoint is allowed to change)
112 */
113
114/* Subtype attributes for IFLA_PROTINFO */
115enum
116{
117 IFLA_INET6_UNSPEC,
118 IFLA_INET6_FLAGS, /* link flags */
119 IFLA_INET6_CONF, /* sysctl parameters */
120 IFLA_INET6_STATS, /* statistics */
121 IFLA_INET6_MCAST, /* MC things. What of them? */
122 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
123 __IFLA_INET6_MAX
124};
125
126#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
127
128struct ifla_cacheinfo
129{
130 __u32 max_reasm_len;
131 __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
132 __u32 reachable_time;
133 __u32 retrans_time;
134};
135
136#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index eef0876d8307..ab2740832742 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -23,8 +23,8 @@ struct vlan_collection;
23struct vlan_dev_info; 23struct vlan_dev_info;
24struct hlist_node; 24struct hlist_node;
25 25
26#include <linux/proc_fs.h> /* for proc_dir_entry */
27#include <linux/netdevice.h> 26#include <linux/netdevice.h>
27#include <linux/etherdevice.h>
28 28
29#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) 29#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header)
30 * that VLAN requires. 30 * that VLAN requires.
@@ -155,6 +155,11 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
155{ 155{
156 struct net_device_stats *stats; 156 struct net_device_stats *stats;
157 157
158 if (skb_bond_should_drop(skb)) {
159 dev_kfree_skb_any(skb);
160 return NET_RX_DROP;
161 }
162
158 skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; 163 skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK];
159 if (skb->dev == NULL) { 164 if (skb->dev == NULL) {
160 dev_kfree_skb_any(skb); 165 dev_kfree_skb_any(skb);
@@ -185,7 +190,8 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
185 * This allows the VLAN to have a different MAC than the underlying 190 * This allows the VLAN to have a different MAC than the underlying
186 * device, and still route correctly. 191 * device, and still route correctly.
187 */ 192 */
188 if (!memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN)) 193 if (!compare_ether_addr(eth_hdr(skb)->h_dest,
194 skb->dev->dev_addr))
189 skb->pkt_type = PACKET_HOST; 195 skb->pkt_type = PACKET_HOST;
190 break; 196 break;
191 }; 197 };
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 899c3d4776f3..03f43e2893a4 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -30,8 +30,8 @@ struct igmphdr
30{ 30{
31 __u8 type; 31 __u8 type;
32 __u8 code; /* For newer IGMP */ 32 __u8 code; /* For newer IGMP */
33 __u16 csum; 33 __be16 csum;
34 __u32 group; 34 __be32 group;
35}; 35};
36 36
37/* V3 group record types [grec_type] */ 37/* V3 group record types [grec_type] */
@@ -45,25 +45,25 @@ struct igmphdr
45struct igmpv3_grec { 45struct igmpv3_grec {
46 __u8 grec_type; 46 __u8 grec_type;
47 __u8 grec_auxwords; 47 __u8 grec_auxwords;
48 __u16 grec_nsrcs; 48 __be16 grec_nsrcs;
49 __u32 grec_mca; 49 __be32 grec_mca;
50 __u32 grec_src[0]; 50 __be32 grec_src[0];
51}; 51};
52 52
53struct igmpv3_report { 53struct igmpv3_report {
54 __u8 type; 54 __u8 type;
55 __u8 resv1; 55 __u8 resv1;
56 __u16 csum; 56 __be16 csum;
57 __u16 resv2; 57 __be16 resv2;
58 __u16 ngrec; 58 __be16 ngrec;
59 struct igmpv3_grec grec[0]; 59 struct igmpv3_grec grec[0];
60}; 60};
61 61
62struct igmpv3_query { 62struct igmpv3_query {
63 __u8 type; 63 __u8 type;
64 __u8 code; 64 __u8 code;
65 __u16 csum; 65 __be16 csum;
66 __u32 group; 66 __be32 group;
67#if defined(__LITTLE_ENDIAN_BITFIELD) 67#if defined(__LITTLE_ENDIAN_BITFIELD)
68 __u8 qrv:3, 68 __u8 qrv:3,
69 suppress:1, 69 suppress:1,
@@ -76,8 +76,8 @@ struct igmpv3_query {
76#error "Please fix <asm/byteorder.h>" 76#error "Please fix <asm/byteorder.h>"
77#endif 77#endif
78 __u8 qqic; 78 __u8 qqic;
79 __u16 nsrcs; 79 __be16 nsrcs;
80 __u32 srcs[0]; 80 __be32 srcs[0];
81}; 81};
82 82
83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ 83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
@@ -136,11 +136,11 @@ struct ip_sf_socklist
136{ 136{
137 unsigned int sl_max; 137 unsigned int sl_max;
138 unsigned int sl_count; 138 unsigned int sl_count;
139 __u32 sl_addr[0]; 139 __be32 sl_addr[0];
140}; 140};
141 141
142#define IP_SFLSIZE(count) (sizeof(struct ip_sf_socklist) + \ 142#define IP_SFLSIZE(count) (sizeof(struct ip_sf_socklist) + \
143 (count) * sizeof(__u32)) 143 (count) * sizeof(__be32))
144 144
145#define IP_SFBLOCK 10 /* allocate this many at once */ 145#define IP_SFBLOCK 10 /* allocate this many at once */
146 146
@@ -159,7 +159,7 @@ struct ip_mc_socklist
159struct ip_sf_list 159struct ip_sf_list
160{ 160{
161 struct ip_sf_list *sf_next; 161 struct ip_sf_list *sf_next;
162 __u32 sf_inaddr; 162 __be32 sf_inaddr;
163 unsigned long sf_count[2]; /* include/exclude counts */ 163 unsigned long sf_count[2]; /* include/exclude counts */
164 unsigned char sf_gsresp; /* include in g & s response? */ 164 unsigned char sf_gsresp; /* include in g & s response? */
165 unsigned char sf_oldin; /* change state */ 165 unsigned char sf_oldin; /* change state */
@@ -197,7 +197,7 @@ struct ip_mc_list
197#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) 197#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
198#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value) 198#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
199 199
200extern int ip_check_mc(struct in_device *dev, u32 mc_addr, u32 src_addr, u16 proto); 200extern int ip_check_mc(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
201extern int igmp_rcv(struct sk_buff *); 201extern int igmp_rcv(struct sk_buff *);
202extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr); 202extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
203extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr); 203extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
@@ -209,13 +209,13 @@ extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
209 struct ip_msfilter __user *optval, int __user *optlen); 209 struct ip_msfilter __user *optval, int __user *optlen);
210extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, 210extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
211 struct group_filter __user *optval, int __user *optlen); 211 struct group_filter __user *optval, int __user *optlen);
212extern int ip_mc_sf_allow(struct sock *sk, u32 local, u32 rmt, int dif); 212extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif);
213extern void ip_mr_init(void); 213extern void ip_mr_init(void);
214extern void ip_mc_init_dev(struct in_device *); 214extern void ip_mc_init_dev(struct in_device *);
215extern void ip_mc_destroy_dev(struct in_device *); 215extern void ip_mc_destroy_dev(struct in_device *);
216extern void ip_mc_up(struct in_device *); 216extern void ip_mc_up(struct in_device *);
217extern void ip_mc_down(struct in_device *); 217extern void ip_mc_down(struct in_device *);
218extern void ip_mc_dec_group(struct in_device *in_dev, u32 addr); 218extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
219extern void ip_mc_inc_group(struct in_device *in_dev, u32 addr); 219extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
220#endif 220#endif
221#endif 221#endif
diff --git a/include/linux/in.h b/include/linux/in.h
index 94f557fa4636..d79fc75fa7c2 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -52,7 +52,7 @@ enum {
52 52
53/* Internet address. */ 53/* Internet address. */
54struct in_addr { 54struct in_addr {
55 __u32 s_addr; 55 __be32 s_addr;
56}; 56};
57 57
58#define IP_TOS 1 58#define IP_TOS 1
@@ -123,17 +123,17 @@ struct ip_mreqn
123}; 123};
124 124
125struct ip_mreq_source { 125struct ip_mreq_source {
126 __u32 imr_multiaddr; 126 __be32 imr_multiaddr;
127 __u32 imr_interface; 127 __be32 imr_interface;
128 __u32 imr_sourceaddr; 128 __be32 imr_sourceaddr;
129}; 129};
130 130
131struct ip_msfilter { 131struct ip_msfilter {
132 __u32 imsf_multiaddr; 132 __be32 imsf_multiaddr;
133 __u32 imsf_interface; 133 __be32 imsf_interface;
134 __u32 imsf_fmode; 134 __u32 imsf_fmode;
135 __u32 imsf_numsrc; 135 __u32 imsf_numsrc;
136 __u32 imsf_slist[1]; 136 __be32 imsf_slist[1];
137}; 137};
138 138
139#define IP_MSFILTER_SIZE(numsrc) \ 139#define IP_MSFILTER_SIZE(numsrc) \
@@ -177,7 +177,7 @@ struct in_pktinfo
177#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ 177#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
178struct sockaddr_in { 178struct sockaddr_in {
179 sa_family_t sin_family; /* Address family */ 179 sa_family_t sin_family; /* Address family */
180 unsigned short int sin_port; /* Port number */ 180 __be16 sin_port; /* Port number */
181 struct in_addr sin_addr; /* Internet address */ 181 struct in_addr sin_addr; /* Internet address */
182 182
183 /* Pad to size of `struct sockaddr'. */ 183 /* Pad to size of `struct sockaddr'. */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 304aaedea305..9be6a4756f0b 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -32,8 +32,8 @@ struct in6_addr
32 union 32 union
33 { 33 {
34 __u8 u6_addr8[16]; 34 __u8 u6_addr8[16];
35 __u16 u6_addr16[8]; 35 __be16 u6_addr16[8];
36 __u32 u6_addr32[4]; 36 __be32 u6_addr32[4];
37 } in6_u; 37 } in6_u;
38#define s6_addr in6_u.u6_addr8 38#define s6_addr in6_u.u6_addr8
39#define s6_addr16 in6_u.u6_addr16 39#define s6_addr16 in6_u.u6_addr16
@@ -53,7 +53,7 @@ extern const struct in6_addr in6addr_loopback;
53 53
54struct sockaddr_in6 { 54struct sockaddr_in6 {
55 unsigned short int sin6_family; /* AF_INET6 */ 55 unsigned short int sin6_family; /* AF_INET6 */
56 __u16 sin6_port; /* Transport layer port # */ 56 __be16 sin6_port; /* Transport layer port # */
57 __u32 sin6_flowinfo; /* IPv6 flow information */ 57 __u32 sin6_flowinfo; /* IPv6 flow information */
58 struct in6_addr sin6_addr; /* IPv6 address */ 58 struct in6_addr sin6_addr; /* IPv6 address */
59 __u32 sin6_scope_id; /* scope id (new in RFC2553) */ 59 __u32 sin6_scope_id; /* scope id (new in RFC2553) */
@@ -134,6 +134,7 @@ struct in6_flowlabel_req
134#define IPPROTO_ICMPV6 58 /* ICMPv6 */ 134#define IPPROTO_ICMPV6 58 /* ICMPv6 */
135#define IPPROTO_NONE 59 /* IPv6 no next header */ 135#define IPPROTO_NONE 59 /* IPv6 no next header */
136#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ 136#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
137#define IPPROTO_MH 135 /* IPv6 mobility header */
137 138
138/* 139/*
139 * IPv6 TLV options. 140 * IPv6 TLV options.
@@ -142,6 +143,7 @@ struct in6_flowlabel_req
142#define IPV6_TLV_PADN 1 143#define IPV6_TLV_PADN 1
143#define IPV6_TLV_ROUTERALERT 5 144#define IPV6_TLV_ROUTERALERT 5
144#define IPV6_TLV_JUMBO 194 145#define IPV6_TLV_JUMBO 194
146#define IPV6_TLV_HAO 201 /* home address option */
145 147
146/* 148/*
147 * IPV6 socket options 149 * IPV6 socket options
diff --git a/include/linux/inet.h b/include/linux/inet.h
index 6c5587af118d..b7c6da7d6d32 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -46,5 +46,7 @@
46#include <linux/types.h> 46#include <linux/types.h>
47 47
48extern __be32 in_aton(const char *str); 48extern __be32 in_aton(const char *str);
49extern int in4_pton(const char *src, int srclen, u8 *dst, char delim, const char **end);
50extern int in6_pton(const char *src, int srclen, u8 *dst, char delim, const char **end);
49#endif 51#endif
50#endif /* _LINUX_INET_H */ 52#endif /* _LINUX_INET_H */
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index a4606e5810e5..6e8bc548635a 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -9,10 +9,10 @@
9 9
10/* Socket identity */ 10/* Socket identity */
11struct inet_diag_sockid { 11struct inet_diag_sockid {
12 __u16 idiag_sport; 12 __be16 idiag_sport;
13 __u16 idiag_dport; 13 __be16 idiag_dport;
14 __u32 idiag_src[4]; 14 __be32 idiag_src[4];
15 __u32 idiag_dst[4]; 15 __be32 idiag_dst[4];
16 __u32 idiag_if; 16 __u32 idiag_if;
17 __u32 idiag_cookie[2]; 17 __u32 idiag_cookie[2];
18#define INET_DIAG_NOCOOKIE (~0U) 18#define INET_DIAG_NOCOOKIE (~0U)
@@ -67,7 +67,7 @@ struct inet_diag_hostcond {
67 __u8 family; 67 __u8 family;
68 __u8 prefix_len; 68 __u8 prefix_len;
69 int port; 69 int port;
70 __u32 addr[0]; 70 __be32 addr[0];
71}; 71};
72 72
73/* Base info structure. It contains socket identity (addrs/ports/cookie) 73/* Base info structure. It contains socket identity (addrs/ports/cookie)
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 92297ff24e85..5a0ab04627bc 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -90,11 +90,11 @@ struct in_ifaddr
90 struct in_ifaddr *ifa_next; 90 struct in_ifaddr *ifa_next;
91 struct in_device *ifa_dev; 91 struct in_device *ifa_dev;
92 struct rcu_head rcu_head; 92 struct rcu_head rcu_head;
93 u32 ifa_local; 93 __be32 ifa_local;
94 u32 ifa_address; 94 __be32 ifa_address;
95 u32 ifa_mask; 95 __be32 ifa_mask;
96 u32 ifa_broadcast; 96 __be32 ifa_broadcast;
97 u32 ifa_anycast; 97 __be32 ifa_anycast;
98 unsigned char ifa_scope; 98 unsigned char ifa_scope;
99 unsigned char ifa_flags; 99 unsigned char ifa_flags;
100 unsigned char ifa_prefixlen; 100 unsigned char ifa_prefixlen;
@@ -104,18 +104,18 @@ struct in_ifaddr
104extern int register_inetaddr_notifier(struct notifier_block *nb); 104extern int register_inetaddr_notifier(struct notifier_block *nb);
105extern int unregister_inetaddr_notifier(struct notifier_block *nb); 105extern int unregister_inetaddr_notifier(struct notifier_block *nb);
106 106
107extern struct net_device *ip_dev_find(u32 addr); 107extern struct net_device *ip_dev_find(__be32 addr);
108extern int inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b); 108extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
109extern int devinet_ioctl(unsigned int cmd, void __user *); 109extern int devinet_ioctl(unsigned int cmd, void __user *);
110extern void devinet_init(void); 110extern void devinet_init(void);
111extern struct in_device *inetdev_init(struct net_device *dev); 111extern struct in_device *inetdev_init(struct net_device *dev);
112extern struct in_device *inetdev_by_index(int); 112extern struct in_device *inetdev_by_index(int);
113extern u32 inet_select_addr(const struct net_device *dev, u32 dst, int scope); 113extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
114extern u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scope); 114extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope);
115extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, u32 mask); 115extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask);
116extern void inet_forward_change(void); 116extern void inet_forward_change(void);
117 117
118static __inline__ int inet_ifa_match(u32 addr, struct in_ifaddr *ifa) 118static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
119{ 119{
120 return !((addr^ifa->ifa_address)&ifa->ifa_mask); 120 return !((addr^ifa->ifa_address)&ifa->ifa_mask);
121} 121}
@@ -183,7 +183,7 @@ static inline void in_dev_put(struct in_device *idev)
183 183
184#endif /* __KERNEL__ */ 184#endif /* __KERNEL__ */
185 185
186static __inline__ __u32 inet_make_mask(int logmask) 186static __inline__ __be32 inet_make_mask(int logmask)
187{ 187{
188 if (logmask) 188 if (logmask)
189 return htonl(~((1<<(32-logmask))-1)); 189 return htonl(~((1<<(32-logmask))-1));
diff --git a/include/linux/init.h b/include/linux/init.h
index 6667785dd1ff..e92b1455d7af 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -68,6 +68,7 @@ extern initcall_t __security_initcall_start[], __security_initcall_end[];
68 68
69/* Defined in init/main.c */ 69/* Defined in init/main.c */
70extern char saved_command_line[]; 70extern char saved_command_line[];
71extern unsigned int reset_devices;
71 72
72/* used by init/main.c */ 73/* used by init/main.c */
73extern void setup_arch(char **); 74extern void setup_arch(char **);
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 41ecbb847f32..60aac2cea0cf 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/file.h> 4#include <linux/file.h>
5#include <linux/rcupdate.h> 5#include <linux/rcupdate.h>
6#include <linux/irqflags.h>
7#include <linux/lockdep.h>
6 8
7#define INIT_FDTABLE \ 9#define INIT_FDTABLE \
8{ \ 10{ \
@@ -21,7 +23,7 @@
21 .count = ATOMIC_INIT(1), \ 23 .count = ATOMIC_INIT(1), \
22 .fdt = &init_files.fdtab, \ 24 .fdt = &init_files.fdtab, \
23 .fdtab = INIT_FDTABLE, \ 25 .fdtab = INIT_FDTABLE, \
24 .file_lock = SPIN_LOCK_UNLOCKED, \ 26 .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock), \
25 .next_fd = 0, \ 27 .next_fd = 0, \
26 .close_on_exec_init = { { 0, } }, \ 28 .close_on_exec_init = { { 0, } }, \
27 .open_fds_init = { { 0, } }, \ 29 .open_fds_init = { { 0, } }, \
@@ -36,7 +38,7 @@
36 .user_id = 0, \ 38 .user_id = 0, \
37 .next = NULL, \ 39 .next = NULL, \
38 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait), \ 40 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait), \
39 .ctx_lock = SPIN_LOCK_UNLOCKED, \ 41 .ctx_lock = __SPIN_LOCK_UNLOCKED(name.ctx_lock), \
40 .reqs_active = 0U, \ 42 .reqs_active = 0U, \
41 .max_reqs = ~0U, \ 43 .max_reqs = ~0U, \
42} 44}
@@ -48,7 +50,7 @@
48 .mm_users = ATOMIC_INIT(2), \ 50 .mm_users = ATOMIC_INIT(2), \
49 .mm_count = ATOMIC_INIT(1), \ 51 .mm_count = ATOMIC_INIT(1), \
50 .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \ 52 .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \
51 .page_table_lock = SPIN_LOCK_UNLOCKED, \ 53 .page_table_lock = __SPIN_LOCK_UNLOCKED(name.page_table_lock), \
52 .mmlist = LIST_HEAD_INIT(name.mmlist), \ 54 .mmlist = LIST_HEAD_INIT(name.mmlist), \
53 .cpu_vm_mask = CPU_MASK_ALL, \ 55 .cpu_vm_mask = CPU_MASK_ALL, \
54} 56}
@@ -69,7 +71,7 @@
69#define INIT_SIGHAND(sighand) { \ 71#define INIT_SIGHAND(sighand) { \
70 .count = ATOMIC_INIT(1), \ 72 .count = ATOMIC_INIT(1), \
71 .action = { { { .sa_handler = NULL, } }, }, \ 73 .action = { { { .sa_handler = NULL, } }, }, \
72 .siglock = SPIN_LOCK_UNLOCKED, \ 74 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
73} 75}
74 76
75extern struct group_info init_groups; 77extern struct group_info init_groups;
@@ -87,6 +89,7 @@ extern struct group_info init_groups;
87 .lock_depth = -1, \ 89 .lock_depth = -1, \
88 .prio = MAX_PRIO-20, \ 90 .prio = MAX_PRIO-20, \
89 .static_prio = MAX_PRIO-20, \ 91 .static_prio = MAX_PRIO-20, \
92 .normal_prio = MAX_PRIO-20, \
90 .policy = SCHED_NORMAL, \ 93 .policy = SCHED_NORMAL, \
91 .cpus_allowed = CPU_MASK_ALL, \ 94 .cpus_allowed = CPU_MASK_ALL, \
92 .mm = NULL, \ 95 .mm = NULL, \
@@ -118,11 +121,13 @@ extern struct group_info init_groups;
118 .list = LIST_HEAD_INIT(tsk.pending.list), \ 121 .list = LIST_HEAD_INIT(tsk.pending.list), \
119 .signal = {{0}}}, \ 122 .signal = {{0}}}, \
120 .blocked = {{0}}, \ 123 .blocked = {{0}}, \
121 .alloc_lock = SPIN_LOCK_UNLOCKED, \ 124 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
122 .proc_lock = SPIN_LOCK_UNLOCKED, \
123 .journal_info = NULL, \ 125 .journal_info = NULL, \
124 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ 126 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
125 .fs_excl = ATOMIC_INIT(0), \ 127 .fs_excl = ATOMIC_INIT(0), \
128 .pi_lock = SPIN_LOCK_UNLOCKED, \
129 INIT_TRACE_IRQFLAGS \
130 INIT_LOCKDEP \
126} 131}
127 132
128 133
diff --git a/include/linux/input.h b/include/linux/input.h
index b32c2b6e53f6..b3253ab72ff7 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -232,7 +232,8 @@ struct input_absinfo {
232#define KEY_PAUSE 119 232#define KEY_PAUSE 119
233 233
234#define KEY_KPCOMMA 121 234#define KEY_KPCOMMA 121
235#define KEY_HANGUEL 122 235#define KEY_HANGEUL 122
236#define KEY_HANGUEL KEY_HANGEUL
236#define KEY_HANJA 123 237#define KEY_HANJA 123
237#define KEY_YEN 124 238#define KEY_YEN 124
238#define KEY_LEFTMETA 125 239#define KEY_LEFTMETA 125
@@ -892,7 +893,6 @@ struct input_dev {
892 893
893 int (*open)(struct input_dev *dev); 894 int (*open)(struct input_dev *dev);
894 void (*close)(struct input_dev *dev); 895 void (*close)(struct input_dev *dev);
895 int (*accept)(struct input_dev *dev, struct file *file);
896 int (*flush)(struct input_dev *dev, struct file *file); 896 int (*flush)(struct input_dev *dev, struct file *file);
897 int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); 897 int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);
898 int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect); 898 int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect);
@@ -960,6 +960,26 @@ struct input_dev {
960 960
961struct input_handle; 961struct input_handle;
962 962
963/**
964 * struct input_handler - implements one of interfaces for input devices
965 * @private: driver-specific data
966 * @event: event handler
967 * @connect: called when attaching a handler to an input device
968 * @disconnect: disconnects a handler from input device
969 * @start: starts handler for given handle. This function is called by
970 * input core right after connect() method and also when a process
971 * that "grabbed" a device releases it
972 * @fops: file operations this driver implements
973 * @minor: beginning of range of 32 minors for devices this driver
974 * can provide
975 * @name: name of the handler, to be shown in /proc/bus/input/handlers
976 * @id_table: pointer to a table of input_device_ids this driver can
977 * handle
978 * @blacklist: prointer to a table of input_device_ids this driver should
979 * ignore even if they match @id_table
980 * @h_list: list of input handles associated with the handler
981 * @node: for placing the driver onto input_handler_list
982 */
963struct input_handler { 983struct input_handler {
964 984
965 void *private; 985 void *private;
@@ -967,6 +987,7 @@ struct input_handler {
967 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 987 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
968 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id); 988 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
969 void (*disconnect)(struct input_handle *handle); 989 void (*disconnect)(struct input_handle *handle);
990 void (*start)(struct input_handle *handle);
970 991
971 const struct file_operations *fops; 992 const struct file_operations *fops;
972 int minor; 993 int minor;
@@ -1005,6 +1026,7 @@ static inline void init_input_dev(struct input_dev *dev)
1005} 1026}
1006 1027
1007struct input_dev *input_allocate_device(void); 1028struct input_dev *input_allocate_device(void);
1029void input_free_device(struct input_dev *dev);
1008 1030
1009static inline struct input_dev *input_get_device(struct input_dev *dev) 1031static inline struct input_dev *input_get_device(struct input_dev *dev)
1010{ 1032{
@@ -1016,12 +1038,6 @@ static inline void input_put_device(struct input_dev *dev)
1016 class_device_put(&dev->cdev); 1038 class_device_put(&dev->cdev);
1017} 1039}
1018 1040
1019static inline void input_free_device(struct input_dev *dev)
1020{
1021 if (dev)
1022 input_put_device(dev);
1023}
1024
1025int input_register_device(struct input_dev *); 1041int input_register_device(struct input_dev *);
1026void input_unregister_device(struct input_dev *); 1042void input_unregister_device(struct input_dev *);
1027 1043
@@ -1034,10 +1050,10 @@ void input_release_device(struct input_handle *);
1034int input_open_device(struct input_handle *); 1050int input_open_device(struct input_handle *);
1035void input_close_device(struct input_handle *); 1051void input_close_device(struct input_handle *);
1036 1052
1037int input_accept_process(struct input_handle *handle, struct file *file);
1038int input_flush_device(struct input_handle* handle, struct file* file); 1053int input_flush_device(struct input_handle* handle, struct file* file);
1039 1054
1040void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); 1055void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
1056void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1041 1057
1042static inline void input_report_key(struct input_dev *dev, unsigned int code, int value) 1058static inline void input_report_key(struct input_dev *dev, unsigned int code, int value)
1043{ 1059{
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 70741e170114..1f97e3d92639 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -10,10 +10,60 @@
10#include <linux/irqreturn.h> 10#include <linux/irqreturn.h>
11#include <linux/hardirq.h> 11#include <linux/hardirq.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/irqflags.h>
13#include <asm/atomic.h> 14#include <asm/atomic.h>
14#include <asm/ptrace.h> 15#include <asm/ptrace.h>
15#include <asm/system.h> 16#include <asm/system.h>
16 17
18/*
19 * These correspond to the IORESOURCE_IRQ_* defines in
20 * linux/ioport.h to select the interrupt line behaviour. When
21 * requesting an interrupt without specifying a IRQF_TRIGGER, the
22 * setting should be assumed to be "as already configured", which
23 * may be as per machine or firmware initialisation.
24 */
25#define IRQF_TRIGGER_NONE 0x00000000
26#define IRQF_TRIGGER_RISING 0x00000001
27#define IRQF_TRIGGER_FALLING 0x00000002
28#define IRQF_TRIGGER_HIGH 0x00000004
29#define IRQF_TRIGGER_LOW 0x00000008
30#define IRQF_TRIGGER_MASK (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW | \
31 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)
32#define IRQF_TRIGGER_PROBE 0x00000010
33
34/*
35 * These flags used only by the kernel as part of the
36 * irq handling routines.
37 *
38 * IRQF_DISABLED - keep irqs disabled when calling the action handler
39 * IRQF_SAMPLE_RANDOM - irq is used to feed the random generator
40 * IRQF_SHARED - allow sharing the irq among several devices
41 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
42 * IRQF_TIMER - Flag to mark this interrupt as timer interrupt
43 */
44#define IRQF_DISABLED 0x00000020
45#define IRQF_SAMPLE_RANDOM 0x00000040
46#define IRQF_SHARED 0x00000080
47#define IRQF_PROBE_SHARED 0x00000100
48#define IRQF_TIMER 0x00000200
49#define IRQF_PERCPU 0x00000400
50
51/*
52 * Migration helpers. Scheduled for removal in 1/2007
53 * Do not use for new code !
54 */
55#define SA_INTERRUPT IRQF_DISABLED
56#define SA_SAMPLE_RANDOM IRQF_SAMPLE_RANDOM
57#define SA_SHIRQ IRQF_SHARED
58#define SA_PROBEIRQ IRQF_PROBE_SHARED
59#define SA_PERCPU IRQF_PERCPU
60
61#define SA_TRIGGER_LOW IRQF_TRIGGER_LOW
62#define SA_TRIGGER_HIGH IRQF_TRIGGER_HIGH
63#define SA_TRIGGER_FALLING IRQF_TRIGGER_FALLING
64#define SA_TRIGGER_RISING IRQF_TRIGGER_RISING
65#define SA_TRIGGER_MASK IRQF_TRIGGER_MASK
66
17struct irqaction { 67struct irqaction {
18 irqreturn_t (*handler)(int, void *, struct pt_regs *); 68 irqreturn_t (*handler)(int, void *, struct pt_regs *);
19 unsigned long flags; 69 unsigned long flags;
@@ -31,12 +81,106 @@ extern int request_irq(unsigned int,
31 unsigned long, const char *, void *); 81 unsigned long, const char *, void *);
32extern void free_irq(unsigned int, void *); 82extern void free_irq(unsigned int, void *);
33 83
84/*
85 * On lockdep we dont want to enable hardirqs in hardirq
86 * context. Use local_irq_enable_in_hardirq() to annotate
87 * kernel code that has to do this nevertheless (pretty much
88 * the only valid case is for old/broken hardware that is
89 * insanely slow).
90 *
91 * NOTE: in theory this might break fragile code that relies
92 * on hardirq delivery - in practice we dont seem to have such
93 * places left. So the only effect should be slightly increased
94 * irqs-off latencies.
95 */
96#ifdef CONFIG_LOCKDEP
97# define local_irq_enable_in_hardirq() do { } while (0)
98#else
99# define local_irq_enable_in_hardirq() local_irq_enable()
100#endif
34 101
35#ifdef CONFIG_GENERIC_HARDIRQS 102#ifdef CONFIG_GENERIC_HARDIRQS
36extern void disable_irq_nosync(unsigned int irq); 103extern void disable_irq_nosync(unsigned int irq);
37extern void disable_irq(unsigned int irq); 104extern void disable_irq(unsigned int irq);
38extern void enable_irq(unsigned int irq); 105extern void enable_irq(unsigned int irq);
106
107/*
108 * Special lockdep variants of irq disabling/enabling.
109 * These should be used for locking constructs that
110 * know that a particular irq context which is disabled,
111 * and which is the only irq-context user of a lock,
112 * that it's safe to take the lock in the irq-disabled
113 * section without disabling hardirqs.
114 *
115 * On !CONFIG_LOCKDEP they are equivalent to the normal
116 * irq disable/enable methods.
117 */
118static inline void disable_irq_nosync_lockdep(unsigned int irq)
119{
120 disable_irq_nosync(irq);
121#ifdef CONFIG_LOCKDEP
122 local_irq_disable();
123#endif
124}
125
126static inline void disable_irq_nosync_lockdep_irqsave(unsigned int irq, unsigned long *flags)
127{
128 disable_irq_nosync(irq);
129#ifdef CONFIG_LOCKDEP
130 local_irq_save(*flags);
131#endif
132}
133
134static inline void disable_irq_lockdep(unsigned int irq)
135{
136 disable_irq(irq);
137#ifdef CONFIG_LOCKDEP
138 local_irq_disable();
139#endif
140}
141
142static inline void enable_irq_lockdep(unsigned int irq)
143{
144#ifdef CONFIG_LOCKDEP
145 local_irq_enable();
146#endif
147 enable_irq(irq);
148}
149
150static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long *flags)
151{
152#ifdef CONFIG_LOCKDEP
153 local_irq_restore(*flags);
39#endif 154#endif
155 enable_irq(irq);
156}
157
158/* IRQ wakeup (PM) control: */
159extern int set_irq_wake(unsigned int irq, unsigned int on);
160
161static inline int enable_irq_wake(unsigned int irq)
162{
163 return set_irq_wake(irq, 1);
164}
165
166static inline int disable_irq_wake(unsigned int irq)
167{
168 return set_irq_wake(irq, 0);
169}
170
171#else /* !CONFIG_GENERIC_HARDIRQS */
172/*
173 * NOTE: non-genirq architectures, if they want to support the lock
174 * validator need to define the methods below in their asm/irq.h
175 * files, under an #ifdef CONFIG_LOCKDEP section.
176 */
177# ifndef CONFIG_LOCKDEP
178# define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq)
179# define disable_irq_lockdep(irq) disable_irq(irq)
180# define enable_irq_lockdep(irq) enable_irq(irq)
181# endif
182
183#endif /* CONFIG_GENERIC_HARDIRQS */
40 184
41#ifndef __ARCH_SET_SOFTIRQ_PENDING 185#ifndef __ARCH_SET_SOFTIRQ_PENDING
42#define set_softirq_pending(x) (local_softirq_pending() = (x)) 186#define set_softirq_pending(x) (local_softirq_pending() = (x))
@@ -72,13 +216,11 @@ static inline void __deprecated save_and_cli(unsigned long *x)
72#define save_and_cli(x) save_and_cli(&x) 216#define save_and_cli(x) save_and_cli(&x)
73#endif /* CONFIG_SMP */ 217#endif /* CONFIG_SMP */
74 218
75/* SoftIRQ primitives. */ 219extern void local_bh_disable(void);
76#define local_bh_disable() \ 220extern void __local_bh_enable(void);
77 do { add_preempt_count(SOFTIRQ_OFFSET); barrier(); } while (0) 221extern void _local_bh_enable(void);
78#define __local_bh_enable() \
79 do { barrier(); sub_preempt_count(SOFTIRQ_OFFSET); } while (0)
80
81extern void local_bh_enable(void); 222extern void local_bh_enable(void);
223extern void local_bh_enable_ip(unsigned long ip);
82 224
83/* PLEASE, avoid to allocate new softirqs, if you need not _really_ high 225/* PLEASE, avoid to allocate new softirqs, if you need not _really_ high
84 frequency threaded job scheduling. For almost all the purposes 226 frequency threaded job scheduling. For almost all the purposes
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index cd6bd001ba4e..d42c83399071 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -9,13 +9,15 @@
9#define _LINUX_IOPORT_H 9#define _LINUX_IOPORT_H
10 10
11#include <linux/compiler.h> 11#include <linux/compiler.h>
12#include <linux/types.h>
12/* 13/*
13 * Resources are tree-like, allowing 14 * Resources are tree-like, allowing
14 * nesting etc.. 15 * nesting etc..
15 */ 16 */
16struct resource { 17struct resource {
18 resource_size_t start;
19 resource_size_t end;
17 const char *name; 20 const char *name;
18 unsigned long start, end;
19 unsigned long flags; 21 unsigned long flags;
20 struct resource *parent, *sibling, *child; 22 struct resource *parent, *sibling, *child;
21}; 23};
@@ -53,6 +55,7 @@ struct resource_list {
53#define IORESOURCE_IRQ_LOWEDGE (1<<1) 55#define IORESOURCE_IRQ_LOWEDGE (1<<1)
54#define IORESOURCE_IRQ_HIGHLEVEL (1<<2) 56#define IORESOURCE_IRQ_HIGHLEVEL (1<<2)
55#define IORESOURCE_IRQ_LOWLEVEL (1<<3) 57#define IORESOURCE_IRQ_LOWLEVEL (1<<3)
58#define IORESOURCE_IRQ_SHAREABLE (1<<4)
56 59
57/* ISA PnP DMA specific bits (IORESOURCE_BITS) */ 60/* ISA PnP DMA specific bits (IORESOURCE_BITS) */
58#define IORESOURCE_DMA_TYPE_MASK (3<<0) 61#define IORESOURCE_DMA_TYPE_MASK (3<<0)
@@ -94,33 +97,39 @@ extern struct resource iomem_resource;
94extern int request_resource(struct resource *root, struct resource *new); 97extern int request_resource(struct resource *root, struct resource *new);
95extern struct resource * ____request_resource(struct resource *root, struct resource *new); 98extern struct resource * ____request_resource(struct resource *root, struct resource *new);
96extern int release_resource(struct resource *new); 99extern int release_resource(struct resource *new);
97extern __deprecated_for_modules int insert_resource(struct resource *parent, struct resource *new); 100extern int insert_resource(struct resource *parent, struct resource *new);
98extern int allocate_resource(struct resource *root, struct resource *new, 101extern int allocate_resource(struct resource *root, struct resource *new,
99 unsigned long size, 102 resource_size_t size, resource_size_t min,
100 unsigned long min, unsigned long max, 103 resource_size_t max, resource_size_t align,
101 unsigned long align,
102 void (*alignf)(void *, struct resource *, 104 void (*alignf)(void *, struct resource *,
103 unsigned long, unsigned long), 105 resource_size_t, resource_size_t),
104 void *alignf_data); 106 void *alignf_data);
105int adjust_resource(struct resource *res, unsigned long start, 107int adjust_resource(struct resource *res, resource_size_t start,
106 unsigned long size); 108 resource_size_t size);
109
110/* get registered SYSTEM_RAM resources in specified area */
111extern int find_next_system_ram(struct resource *res);
107 112
108/* Convenience shorthand with allocation */ 113/* Convenience shorthand with allocation */
109#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) 114#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
110#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name)) 115#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name))
111#define rename_region(region, newname) do { (region)->name = (newname); } while (0) 116#define rename_region(region, newname) do { (region)->name = (newname); } while (0)
112 117
113extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name); 118extern struct resource * __request_region(struct resource *,
119 resource_size_t start,
120 resource_size_t n, const char *name);
114 121
115/* Compatibility cruft */ 122/* Compatibility cruft */
116#define release_region(start,n) __release_region(&ioport_resource, (start), (n)) 123#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
117#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n)) 124#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n))
118#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n)) 125#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n))
119 126
120extern int __check_region(struct resource *, unsigned long, unsigned long); 127extern int __check_region(struct resource *, resource_size_t, resource_size_t);
121extern void __release_region(struct resource *, unsigned long, unsigned long); 128extern void __release_region(struct resource *, resource_size_t,
129 resource_size_t);
122 130
123static inline int __deprecated check_region(unsigned long s, unsigned long n) 131static inline int __deprecated check_region(resource_size_t s,
132 resource_size_t n)
124{ 133{
125 return __check_region(&ioport_resource, s, n); 134 return __check_region(&ioport_resource, s, n);
126} 135}
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index 88d5961f7a3f..8e2042b9d471 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -59,27 +59,6 @@ static inline int task_nice_ioprio(struct task_struct *task)
59/* 59/*
60 * For inheritance, return the highest of the two given priorities 60 * For inheritance, return the highest of the two given priorities
61 */ 61 */
62static inline int ioprio_best(unsigned short aprio, unsigned short bprio) 62extern int ioprio_best(unsigned short aprio, unsigned short bprio);
63{
64 unsigned short aclass = IOPRIO_PRIO_CLASS(aprio);
65 unsigned short bclass = IOPRIO_PRIO_CLASS(bprio);
66
67 if (!ioprio_valid(aprio))
68 return bprio;
69 if (!ioprio_valid(bprio))
70 return aprio;
71
72 if (aclass == IOPRIO_CLASS_NONE)
73 aclass = IOPRIO_CLASS_BE;
74 if (bclass == IOPRIO_CLASS_NONE)
75 bclass = IOPRIO_CLASS_BE;
76
77 if (aclass == bclass)
78 return min(aprio, bprio);
79 if (aclass > bclass)
80 return bprio;
81 else
82 return aprio;
83}
84 63
85#endif 64#endif
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 4b55cf1df732..6b25d36fc54c 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -57,6 +57,7 @@
57#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) 57#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY)
58#define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) 58#define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY)
59#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) 59#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT)
60#define IPOPT_CIPSO (6 |IPOPT_CONTROL|IPOPT_COPY)
60#define IPOPT_RR (7 |IPOPT_CONTROL) 61#define IPOPT_RR (7 |IPOPT_CONTROL)
61#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) 62#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY)
62#define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) 63#define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY)
@@ -95,7 +96,7 @@ struct iphdr {
95 __be16 frag_off; 96 __be16 frag_off;
96 __u8 ttl; 97 __u8 ttl;
97 __u8 protocol; 98 __u8 protocol;
98 __u16 check; 99 __be16 check;
99 __be32 saddr; 100 __be32 saddr;
100 __be32 daddr; 101 __be32 daddr;
101 /*The options start here. */ 102 /*The options start here. */
@@ -104,22 +105,22 @@ struct iphdr {
104struct ip_auth_hdr { 105struct ip_auth_hdr {
105 __u8 nexthdr; 106 __u8 nexthdr;
106 __u8 hdrlen; /* This one is measured in 32 bit units! */ 107 __u8 hdrlen; /* This one is measured in 32 bit units! */
107 __u16 reserved; 108 __be16 reserved;
108 __u32 spi; 109 __be32 spi;
109 __u32 seq_no; /* Sequence number */ 110 __be32 seq_no; /* Sequence number */
110 __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */ 111 __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */
111}; 112};
112 113
113struct ip_esp_hdr { 114struct ip_esp_hdr {
114 __u32 spi; 115 __be32 spi;
115 __u32 seq_no; /* Sequence number */ 116 __be32 seq_no; /* Sequence number */
116 __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ 117 __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */
117}; 118};
118 119
119struct ip_comp_hdr { 120struct ip_comp_hdr {
120 __u8 nexthdr; 121 __u8 nexthdr;
121 __u8 flags; 122 __u8 flags;
122 __u16 cpi; 123 __be16 cpi;
123}; 124};
124 125
125#endif /* _LINUX_IP_H */ 126#endif /* _LINUX_IP_H */
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 5653b2f23b6a..d09fbeabf1dc 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -210,11 +210,7 @@ struct kernel_ipmi_msg
210#include <linux/list.h> 210#include <linux/list.h>
211#include <linux/module.h> 211#include <linux/module.h>
212#include <linux/device.h> 212#include <linux/device.h>
213
214#ifdef CONFIG_PROC_FS
215#include <linux/proc_fs.h> 213#include <linux/proc_fs.h>
216extern struct proc_dir_entry *proc_ipmi_root;
217#endif /* CONFIG_PROC_FS */
218 214
219/* Opaque type for a IPMI message user. One of these is needed to 215/* Opaque type for a IPMI message user. One of these is needed to
220 send and receive messages. */ 216 send and receive messages. */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 297853c841b4..4f435c59de06 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -29,6 +29,7 @@ struct in6_ifreq {
29 29
30#define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */ 30#define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */
31#define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */ 31#define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */
32#define IPV6_SRCRT_TYPE_2 2 /* IPv6 type 2 Routing Header */
32 33
33/* 34/*
34 * routing header 35 * routing header
@@ -73,25 +74,47 @@ struct rt0_hdr {
73#define rt0_type rt_hdr.type 74#define rt0_type rt_hdr.type
74}; 75};
75 76
77/*
78 * routing header type 2
79 */
80
81struct rt2_hdr {
82 struct ipv6_rt_hdr rt_hdr;
83 __u32 reserved;
84 struct in6_addr addr;
85
86#define rt2_type rt_hdr.type
87};
88
89/*
90 * home address option in destination options header
91 */
92
93struct ipv6_destopt_hao {
94 __u8 type;
95 __u8 length;
96 struct in6_addr addr;
97} __attribute__ ((__packed__));
98
76struct ipv6_auth_hdr { 99struct ipv6_auth_hdr {
77 __u8 nexthdr; 100 __u8 nexthdr;
78 __u8 hdrlen; /* This one is measured in 32 bit units! */ 101 __u8 hdrlen; /* This one is measured in 32 bit units! */
79 __u16 reserved; 102 __be16 reserved;
80 __u32 spi; 103 __be32 spi;
81 __u32 seq_no; /* Sequence number */ 104 __be32 seq_no; /* Sequence number */
82 __u8 auth_data[0]; /* Length variable but >=4. Mind the 64 bit alignment! */ 105 __u8 auth_data[0]; /* Length variable but >=4. Mind the 64 bit alignment! */
83}; 106};
84 107
85struct ipv6_esp_hdr { 108struct ipv6_esp_hdr {
86 __u32 spi; 109 __be32 spi;
87 __u32 seq_no; /* Sequence number */ 110 __be32 seq_no; /* Sequence number */
88 __u8 enc_data[0]; /* Length variable but >=8. Mind the 64 bit alignment! */ 111 __u8 enc_data[0]; /* Length variable but >=8. Mind the 64 bit alignment! */
89}; 112};
90 113
91struct ipv6_comp_hdr { 114struct ipv6_comp_hdr {
92 __u8 nexthdr; 115 __u8 nexthdr;
93 __u8 flags; 116 __u8 flags;
94 __u16 cpi; 117 __be16 cpi;
95}; 118};
96 119
97/* 120/*
@@ -113,7 +136,7 @@ struct ipv6hdr {
113#endif 136#endif
114 __u8 flow_lbl[3]; 137 __u8 flow_lbl[3];
115 138
116 __u16 payload_len; 139 __be16 payload_len;
117 __u8 nexthdr; 140 __u8 nexthdr;
118 __u8 hop_limit; 141 __u8 hop_limit;
119 142
@@ -153,6 +176,7 @@ struct ipv6_devconf {
153 __s32 accept_ra_rt_info_max_plen; 176 __s32 accept_ra_rt_info_max_plen;
154#endif 177#endif
155#endif 178#endif
179 __s32 proxy_ndp;
156 void *sysctl; 180 void *sysctl;
157}; 181};
158 182
@@ -180,6 +204,7 @@ enum {
180 DEVCONF_ACCEPT_RA_RTR_PREF, 204 DEVCONF_ACCEPT_RA_RTR_PREF,
181 DEVCONF_RTR_PROBE_INTERVAL, 205 DEVCONF_RTR_PROBE_INTERVAL,
182 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, 206 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
207 DEVCONF_PROXY_NDP,
183 DEVCONF_MAX 208 DEVCONF_MAX
184}; 209};
185 210
@@ -206,6 +231,9 @@ struct inet6_skb_parm {
206 __u16 lastopt; 231 __u16 lastopt;
207 __u32 nhoff; 232 __u32 nhoff;
208 __u16 flags; 233 __u16 flags;
234#ifdef CONFIG_IPV6_MIP6
235 __u16 dsthao;
236#endif
209 237
210#define IP6SKB_XFRM_TRANSFORMED 1 238#define IP6SKB_XFRM_TRANSFORMED 1
211}; 239};
@@ -242,6 +270,9 @@ struct ipv6_pinfo {
242 struct in6_addr rcv_saddr; 270 struct in6_addr rcv_saddr;
243 struct in6_addr daddr; 271 struct in6_addr daddr;
244 struct in6_addr *daddr_cache; 272 struct in6_addr *daddr_cache;
273#ifdef CONFIG_IPV6_SUBTREES
274 struct in6_addr *saddr_cache;
275#endif
245 276
246 __u32 flow_label; 277 __u32 flow_label;
247 __u32 frag_size; 278 __u32 frag_size;
@@ -430,7 +461,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
430 461
431#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\ 462#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\
432 (((__sk)->sk_hash == (__hash)) && \ 463 (((__sk)->sk_hash == (__hash)) && \
433 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 464 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
434 ((__sk)->sk_family == AF_INET6) && \ 465 ((__sk)->sk_family == AF_INET6) && \
435 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 466 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
436 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ 467 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 676e00dfb21a..48d3cb3b6a47 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -1,5 +1,5 @@
1#ifndef __irq_h 1#ifndef _LINUX_IRQ_H
2#define __irq_h 2#define _LINUX_IRQ_H
3 3
4/* 4/*
5 * Please do not include this file in generic code. There is currently 5 * Please do not include this file in generic code. There is currently
@@ -11,7 +11,7 @@
11 11
12#include <linux/smp.h> 12#include <linux/smp.h>
13 13
14#if !defined(CONFIG_S390) 14#ifndef CONFIG_S390
15 15
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <linux/cache.h> 17#include <linux/cache.h>
@@ -24,84 +24,175 @@
24 24
25/* 25/*
26 * IRQ line status. 26 * IRQ line status.
27 *
28 * Bits 0-16 are reserved for the IRQF_* bits in linux/interrupt.h
29 *
30 * IRQ types
27 */ 31 */
28#define IRQ_INPROGRESS 1 /* IRQ handler active - do not enter! */ 32#define IRQ_TYPE_NONE 0x00000000 /* Default, unspecified type */
29#define IRQ_DISABLED 2 /* IRQ disabled - do not enter! */ 33#define IRQ_TYPE_EDGE_RISING 0x00000001 /* Edge rising type */
30#define IRQ_PENDING 4 /* IRQ pending - replay on enable */ 34#define IRQ_TYPE_EDGE_FALLING 0x00000002 /* Edge falling type */
31#define IRQ_REPLAY 8 /* IRQ has been replayed but not acked yet */ 35#define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)
32#define IRQ_AUTODETECT 16 /* IRQ is being autodetected */ 36#define IRQ_TYPE_LEVEL_HIGH 0x00000004 /* Level high type */
33#define IRQ_WAITING 32 /* IRQ not yet seen - for autodetection */ 37#define IRQ_TYPE_LEVEL_LOW 0x00000008 /* Level low type */
34#define IRQ_LEVEL 64 /* IRQ level triggered */ 38#define IRQ_TYPE_SENSE_MASK 0x0000000f /* Mask of the above */
35#define IRQ_MASKED 128 /* IRQ masked - shouldn't be seen again */ 39#define IRQ_TYPE_PROBE 0x00000010 /* Probing in progress */
36#if defined(ARCH_HAS_IRQ_PER_CPU) 40
37# define IRQ_PER_CPU 256 /* IRQ is per CPU */ 41/* Internal flags */
42#define IRQ_INPROGRESS 0x00010000 /* IRQ handler active - do not enter! */
43#define IRQ_DISABLED 0x00020000 /* IRQ disabled - do not enter! */
44#define IRQ_PENDING 0x00040000 /* IRQ pending - replay on enable */
45#define IRQ_REPLAY 0x00080000 /* IRQ has been replayed but not acked yet */
46#define IRQ_AUTODETECT 0x00100000 /* IRQ is being autodetected */
47#define IRQ_WAITING 0x00200000 /* IRQ not yet seen - for autodetection */
48#define IRQ_LEVEL 0x00400000 /* IRQ level triggered */
49#define IRQ_MASKED 0x00800000 /* IRQ masked - shouldn't be seen again */
50#define IRQ_PER_CPU 0x01000000 /* IRQ is per CPU */
51#ifdef CONFIG_IRQ_PER_CPU
38# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 52# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
39#else 53#else
40# define CHECK_IRQ_PER_CPU(var) 0 54# define CHECK_IRQ_PER_CPU(var) 0
41#endif 55#endif
42 56
43/* 57#define IRQ_NOPROBE 0x02000000 /* IRQ is not valid for probing */
44 * Interrupt controller descriptor. This is all we need 58#define IRQ_NOREQUEST 0x04000000 /* IRQ cannot be requested */
45 * to describe about the low-level hardware. 59#define IRQ_NOAUTOEN 0x08000000 /* IRQ will not be enabled on request irq */
60#define IRQ_DELAYED_DISABLE 0x10000000 /* IRQ disable (masking) happens delayed. */
61#define IRQ_WAKEUP 0x20000000 /* IRQ triggers system wakeup */
62
63struct proc_dir_entry;
64
65/**
66 * struct irq_chip - hardware interrupt chip descriptor
67 *
68 * @name: name for /proc/interrupts
69 * @startup: start up the interrupt (defaults to ->enable if NULL)
70 * @shutdown: shut down the interrupt (defaults to ->disable if NULL)
71 * @enable: enable the interrupt (defaults to chip->unmask if NULL)
72 * @disable: disable the interrupt (defaults to chip->mask if NULL)
73 * @ack: start of a new interrupt
74 * @mask: mask an interrupt source
75 * @mask_ack: ack and mask an interrupt source
76 * @unmask: unmask an interrupt source
77 * @eoi: end of interrupt - chip level
78 * @end: end of interrupt - flow level
79 * @set_affinity: set the CPU affinity on SMP machines
80 * @retrigger: resend an IRQ to the CPU
81 * @set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
82 * @set_wake: enable/disable power-management wake-on of an IRQ
83 *
84 * @release: release function solely used by UML
85 * @typename: obsoleted by name, kept as migration helper
46 */ 86 */
47struct hw_interrupt_type { 87struct irq_chip {
48 const char * typename; 88 const char *name;
49 unsigned int (*startup)(unsigned int irq); 89 unsigned int (*startup)(unsigned int irq);
50 void (*shutdown)(unsigned int irq); 90 void (*shutdown)(unsigned int irq);
51 void (*enable)(unsigned int irq); 91 void (*enable)(unsigned int irq);
52 void (*disable)(unsigned int irq); 92 void (*disable)(unsigned int irq);
53 void (*ack)(unsigned int irq); 93
54 void (*end)(unsigned int irq); 94 void (*ack)(unsigned int irq);
55 void (*set_affinity)(unsigned int irq, cpumask_t dest); 95 void (*mask)(unsigned int irq);
96 void (*mask_ack)(unsigned int irq);
97 void (*unmask)(unsigned int irq);
98 void (*eoi)(unsigned int irq);
99
100 void (*end)(unsigned int irq);
101 void (*set_affinity)(unsigned int irq, cpumask_t dest);
102 int (*retrigger)(unsigned int irq);
103 int (*set_type)(unsigned int irq, unsigned int flow_type);
104 int (*set_wake)(unsigned int irq, unsigned int on);
105
56 /* Currently used only by UML, might disappear one day.*/ 106 /* Currently used only by UML, might disappear one day.*/
57#ifdef CONFIG_IRQ_RELEASE_METHOD 107#ifdef CONFIG_IRQ_RELEASE_METHOD
58 void (*release)(unsigned int irq, void *dev_id); 108 void (*release)(unsigned int irq, void *dev_id);
59#endif 109#endif
110 /*
111 * For compatibility, ->typename is copied into ->name.
112 * Will disappear.
113 */
114 const char *typename;
60}; 115};
61 116
62typedef struct hw_interrupt_type hw_irq_controller; 117/**
63 118 * struct irq_desc - interrupt descriptor
64/* 119 *
65 * This is the "IRQ descriptor", which contains various information 120 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()]
66 * about the irq, including what kind of hardware handling it has, 121 * @chip: low level interrupt hardware access
67 * whether it is disabled etc etc. 122 * @handler_data: per-IRQ data for the irq_chip methods
123 * @chip_data: platform-specific per-chip private data for the chip
124 * methods, to allow shared chip implementations
125 * @action: the irq action chain
126 * @status: status information
127 * @depth: disable-depth, for nested irq_disable() calls
128 * @wake_depth: enable depth, for multiple set_irq_wake() callers
129 * @irq_count: stats field to detect stalled irqs
130 * @irqs_unhandled: stats field for spurious unhandled interrupts
131 * @lock: locking for SMP
132 * @affinity: IRQ affinity on SMP
133 * @cpu: cpu index useful for balancing
134 * @pending_mask: pending rebalanced interrupts
135 * @move_irq: need to re-target IRQ destination
136 * @dir: /proc/irq/ procfs entry
137 * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP
68 * 138 *
69 * Pad this out to 32 bytes for cache and indexing reasons. 139 * Pad this out to 32 bytes for cache and indexing reasons.
70 */ 140 */
71typedef struct irq_desc { 141struct irq_desc {
72 hw_irq_controller *handler; 142 void fastcall (*handle_irq)(unsigned int irq,
73 void *handler_data; 143 struct irq_desc *desc,
74 struct irqaction *action; /* IRQ action list */ 144 struct pt_regs *regs);
75 unsigned int status; /* IRQ status */ 145 struct irq_chip *chip;
76 unsigned int depth; /* nested irq disables */ 146 void *handler_data;
77 unsigned int irq_count; /* For detecting broken interrupts */ 147 void *chip_data;
78 unsigned int irqs_unhandled; 148 struct irqaction *action; /* IRQ action list */
79 spinlock_t lock; 149 unsigned int status; /* IRQ status */
80#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE) 150
81 unsigned int move_irq; /* Flag need to re-target intr dest*/ 151 unsigned int depth; /* nested irq disables */
152 unsigned int wake_depth; /* nested wake enables */
153 unsigned int irq_count; /* For detecting broken IRQs */
154 unsigned int irqs_unhandled;
155 spinlock_t lock;
156#ifdef CONFIG_SMP
157 cpumask_t affinity;
158 unsigned int cpu;
159#endif
160#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
161 cpumask_t pending_mask;
162 unsigned int move_irq; /* need to re-target IRQ dest */
163#endif
164#ifdef CONFIG_PROC_FS
165 struct proc_dir_entry *dir;
82#endif 166#endif
83} ____cacheline_aligned irq_desc_t; 167} ____cacheline_aligned;
84 168
85extern irq_desc_t irq_desc [NR_IRQS]; 169extern struct irq_desc irq_desc[NR_IRQS];
86 170
87/* Return a pointer to the irq descriptor for IRQ. */ 171/*
88static inline irq_desc_t * 172 * Migration helpers for obsolete names, they will go away:
89irq_descp (int irq) 173 */
90{ 174#define hw_interrupt_type irq_chip
91 return irq_desc + irq; 175typedef struct irq_chip hw_irq_controller;
92} 176#define no_irq_type no_irq_chip
177typedef struct irq_desc irq_desc_t;
93 178
94#include <asm/hw_irq.h> /* the arch dependent stuff */ 179/*
180 * Pick up the arch-dependent methods:
181 */
182#include <asm/hw_irq.h>
95 183
96extern int setup_irq(unsigned int irq, struct irqaction * new); 184extern int setup_irq(unsigned int irq, struct irqaction *new);
97 185
98#ifdef CONFIG_GENERIC_HARDIRQS 186#ifdef CONFIG_GENERIC_HARDIRQS
99extern cpumask_t irq_affinity[NR_IRQS]; 187
188#ifndef handle_dynamic_tick
189# define handle_dynamic_tick(a) do { } while (0)
190#endif
100 191
101#ifdef CONFIG_SMP 192#ifdef CONFIG_SMP
102static inline void set_native_irq_info(int irq, cpumask_t mask) 193static inline void set_native_irq_info(int irq, cpumask_t mask)
103{ 194{
104 irq_affinity[irq] = mask; 195 irq_desc[irq].affinity = mask;
105} 196}
106#else 197#else
107static inline void set_native_irq_info(int irq, cpumask_t mask) 198static inline void set_native_irq_info(int irq, cpumask_t mask)
@@ -111,8 +202,7 @@ static inline void set_native_irq_info(int irq, cpumask_t mask)
111 202
112#ifdef CONFIG_SMP 203#ifdef CONFIG_SMP
113 204
114#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE) 205#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
115extern cpumask_t pending_irq_cpumask[NR_IRQS];
116 206
117void set_pending_irq(unsigned int irq, cpumask_t mask); 207void set_pending_irq(unsigned int irq, cpumask_t mask);
118void move_native_irq(int irq); 208void move_native_irq(int irq);
@@ -133,7 +223,7 @@ static inline void set_irq_info(int irq, cpumask_t mask)
133{ 223{
134} 224}
135 225
136#else // CONFIG_PCI_MSI 226#else /* CONFIG_PCI_MSI */
137 227
138static inline void move_irq(int irq) 228static inline void move_irq(int irq)
139{ 229{
@@ -144,26 +234,36 @@ static inline void set_irq_info(int irq, cpumask_t mask)
144{ 234{
145 set_native_irq_info(irq, mask); 235 set_native_irq_info(irq, mask);
146} 236}
147#endif // CONFIG_PCI_MSI
148 237
149#else // CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE 238#endif /* CONFIG_PCI_MSI */
239
240#else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */
241
242static inline void move_irq(int irq)
243{
244}
245
246static inline void move_native_irq(int irq)
247{
248}
249
250static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
251{
252}
150 253
151#define move_irq(x)
152#define move_native_irq(x)
153#define set_pending_irq(x,y)
154static inline void set_irq_info(int irq, cpumask_t mask) 254static inline void set_irq_info(int irq, cpumask_t mask)
155{ 255{
156 set_native_irq_info(irq, mask); 256 set_native_irq_info(irq, mask);
157} 257}
158 258
159#endif // CONFIG_GENERIC_PENDING_IRQ 259#endif /* CONFIG_GENERIC_PENDING_IRQ */
160 260
161#else // CONFIG_SMP 261#else /* CONFIG_SMP */
162 262
163#define move_irq(x) 263#define move_irq(x)
164#define move_native_irq(x) 264#define move_native_irq(x)
165 265
166#endif // CONFIG_SMP 266#endif /* CONFIG_SMP */
167 267
168#ifdef CONFIG_IRQBALANCE 268#ifdef CONFIG_IRQBALANCE
169extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask); 269extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask);
@@ -173,32 +273,145 @@ static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
173} 273}
174#endif 274#endif
175 275
176extern int no_irq_affinity;
177extern int noirqdebug_setup(char *str);
178
179extern fastcall irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
180 struct irqaction *action);
181extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
182extern void note_interrupt(unsigned int irq, irq_desc_t *desc,
183 int action_ret, struct pt_regs *regs);
184extern int can_request_irq(unsigned int irq, unsigned long irqflags);
185
186extern void init_irq_proc(void);
187
188#ifdef CONFIG_AUTO_IRQ_AFFINITY 276#ifdef CONFIG_AUTO_IRQ_AFFINITY
189extern int select_smp_affinity(unsigned int irq); 277extern int select_smp_affinity(unsigned int irq);
190#else 278#else
191static inline int 279static inline int select_smp_affinity(unsigned int irq)
192select_smp_affinity(unsigned int irq)
193{ 280{
194 return 1; 281 return 1;
195} 282}
196#endif 283#endif
197 284
285extern int no_irq_affinity;
286
287/* Handle irq action chains: */
288extern int handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
289 struct irqaction *action);
290
291/*
292 * Built-in IRQ handlers for various IRQ types,
293 * callable via desc->chip->handle_irq()
294 */
295extern void fastcall
296handle_level_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs);
297extern void fastcall
298handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc,
299 struct pt_regs *regs);
300extern void fastcall
301handle_edge_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs);
302extern void fastcall
303handle_simple_irq(unsigned int irq, struct irq_desc *desc,
304 struct pt_regs *regs);
305extern void fastcall
306handle_percpu_irq(unsigned int irq, struct irq_desc *desc,
307 struct pt_regs *regs);
308extern void fastcall
309handle_bad_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs);
310
311/*
312 * Get a descriptive string for the highlevel handler, for
313 * /proc/interrupts output:
314 */
315extern const char *
316handle_irq_name(void fastcall (*handle)(unsigned int, struct irq_desc *,
317 struct pt_regs *));
318
319/*
320 * Monolithic do_IRQ implementation.
321 * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly)
322 */
323#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
324extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
198#endif 325#endif
199 326
200extern hw_irq_controller no_irq_type; /* needed in every arch ? */ 327/*
328 * Architectures call this to let the generic IRQ layer
329 * handle an interrupt. If the descriptor is attached to an
330 * irqchip-style controller then we call the ->handle_irq() handler,
331 * and it calls __do_IRQ() if it's attached to an irqtype-style controller.
332 */
333static inline void generic_handle_irq(unsigned int irq, struct pt_regs *regs)
334{
335 struct irq_desc *desc = irq_desc + irq;
201 336
337#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
338 desc->handle_irq(irq, desc, regs);
339#else
340 if (likely(desc->handle_irq))
341 desc->handle_irq(irq, desc, regs);
342 else
343 __do_IRQ(irq, regs);
202#endif 344#endif
345}
346
347/* Handling of unhandled and spurious interrupts: */
348extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
349 int action_ret, struct pt_regs *regs);
350
351/* Resending of interrupts :*/
352void check_irq_resend(struct irq_desc *desc, unsigned int irq);
353
354/* Initialize /proc/irq/ */
355extern void init_irq_proc(void);
356
357/* Enable/disable irq debugging output: */
358extern int noirqdebug_setup(char *str);
359
360/* Checks whether the interrupt can be requested by request_irq(): */
361extern int can_request_irq(unsigned int irq, unsigned long irqflags);
362
363/* Dummy irq-chip implementations: */
364extern struct irq_chip no_irq_chip;
365extern struct irq_chip dummy_irq_chip;
366
367extern void
368set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
369 void fastcall (*handle)(unsigned int,
370 struct irq_desc *,
371 struct pt_regs *));
372extern void
373__set_irq_handler(unsigned int irq,
374 void fastcall (*handle)(unsigned int, struct irq_desc *,
375 struct pt_regs *),
376 int is_chained);
377
378/*
379 * Set a highlevel flow handler for a given IRQ:
380 */
381static inline void
382set_irq_handler(unsigned int irq,
383 void fastcall (*handle)(unsigned int, struct irq_desc *,
384 struct pt_regs *))
385{
386 __set_irq_handler(irq, handle, 0);
387}
388
389/*
390 * Set a highlevel chained flow handler for a given IRQ.
391 * (a chained handler is automatically enabled and set to
392 * IRQ_NOREQUEST and IRQ_NOPROBE)
393 */
394static inline void
395set_irq_chained_handler(unsigned int irq,
396 void fastcall (*handle)(unsigned int, struct irq_desc *,
397 struct pt_regs *))
398{
399 __set_irq_handler(irq, handle, 1);
400}
401
402/* Set/get chip/data for an IRQ: */
403
404extern int set_irq_chip(unsigned int irq, struct irq_chip *chip);
405extern int set_irq_data(unsigned int irq, void *data);
406extern int set_irq_chip_data(unsigned int irq, void *data);
407extern int set_irq_type(unsigned int irq, unsigned int type);
408
409#define get_irq_chip(irq) (irq_desc[irq].chip)
410#define get_irq_chip_data(irq) (irq_desc[irq].chip_data)
411#define get_irq_data(irq) (irq_desc[irq].handler_data)
412
413#endif /* CONFIG_GENERIC_HARDIRQS */
414
415#endif /* !CONFIG_S390 */
203 416
204#endif /* __irq_h */ 417#endif /* _LINUX_IRQ_H */
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
new file mode 100644
index 000000000000..412e025bc5c7
--- /dev/null
+++ b/include/linux/irqflags.h
@@ -0,0 +1,96 @@
1/*
2 * include/linux/irqflags.h
3 *
4 * IRQ flags tracing: follow the state of the hardirq and softirq flags and
5 * provide callbacks for transitions between ON and OFF states.
6 *
7 * This file gets included from lowlevel asm headers too, to provide
8 * wrapped versions of the local_irq_*() APIs, based on the
9 * raw_local_irq_*() macros from the lowlevel headers.
10 */
11#ifndef _LINUX_TRACE_IRQFLAGS_H
12#define _LINUX_TRACE_IRQFLAGS_H
13
14#ifdef CONFIG_TRACE_IRQFLAGS
15 extern void trace_hardirqs_on(void);
16 extern void trace_hardirqs_off(void);
17 extern void trace_softirqs_on(unsigned long ip);
18 extern void trace_softirqs_off(unsigned long ip);
19# define trace_hardirq_context(p) ((p)->hardirq_context)
20# define trace_softirq_context(p) ((p)->softirq_context)
21# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled)
22# define trace_softirqs_enabled(p) ((p)->softirqs_enabled)
23# define trace_hardirq_enter() do { current->hardirq_context++; } while (0)
24# define trace_hardirq_exit() do { current->hardirq_context--; } while (0)
25# define trace_softirq_enter() do { current->softirq_context++; } while (0)
26# define trace_softirq_exit() do { current->softirq_context--; } while (0)
27# define INIT_TRACE_IRQFLAGS .softirqs_enabled = 1,
28#else
29# define trace_hardirqs_on() do { } while (0)
30# define trace_hardirqs_off() do { } while (0)
31# define trace_softirqs_on(ip) do { } while (0)
32# define trace_softirqs_off(ip) do { } while (0)
33# define trace_hardirq_context(p) 0
34# define trace_softirq_context(p) 0
35# define trace_hardirqs_enabled(p) 0
36# define trace_softirqs_enabled(p) 0
37# define trace_hardirq_enter() do { } while (0)
38# define trace_hardirq_exit() do { } while (0)
39# define trace_softirq_enter() do { } while (0)
40# define trace_softirq_exit() do { } while (0)
41# define INIT_TRACE_IRQFLAGS
42#endif
43
44#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
45
46#include <asm/irqflags.h>
47
48#define local_irq_enable() \
49 do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
50#define local_irq_disable() \
51 do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
52#define local_irq_save(flags) \
53 do { raw_local_irq_save(flags); trace_hardirqs_off(); } while (0)
54
55#define local_irq_restore(flags) \
56 do { \
57 if (raw_irqs_disabled_flags(flags)) { \
58 raw_local_irq_restore(flags); \
59 trace_hardirqs_off(); \
60 } else { \
61 trace_hardirqs_on(); \
62 raw_local_irq_restore(flags); \
63 } \
64 } while (0)
65#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
66/*
67 * The local_irq_*() APIs are equal to the raw_local_irq*()
68 * if !TRACE_IRQFLAGS.
69 */
70# define raw_local_irq_disable() local_irq_disable()
71# define raw_local_irq_enable() local_irq_enable()
72# define raw_local_irq_save(flags) local_irq_save(flags)
73# define raw_local_irq_restore(flags) local_irq_restore(flags)
74#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
75
76#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
77#define safe_halt() \
78 do { \
79 trace_hardirqs_on(); \
80 raw_safe_halt(); \
81 } while (0)
82
83#define local_save_flags(flags) raw_local_save_flags(flags)
84
85#define irqs_disabled() \
86({ \
87 unsigned long flags; \
88 \
89 raw_local_save_flags(flags); \
90 raw_irqs_disabled_flags(flags); \
91})
92
93#define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags)
94#endif /* CONFIG_X86 */
95
96#endif
diff --git a/include/linux/isdn/Kbuild b/include/linux/isdn/Kbuild
new file mode 100644
index 000000000000..991cdb29ab2e
--- /dev/null
+++ b/include/linux/isdn/Kbuild
@@ -0,0 +1 @@
header-y += capicmd.h
diff --git a/include/linux/isdn/tpam.h b/include/linux/isdn/tpam.h
deleted file mode 100644
index d18dd0dc570d..000000000000
--- a/include/linux/isdn/tpam.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/* $Id: tpam.h,v 1.1.2.1 2001/06/08 08:23:46 kai Exp $
2 *
3 * Turbo PAM ISDN driver for Linux. (Kernel Driver)
4 *
5 * Copyright 2001 Stelian Pop <stelian.pop@fr.alcove.com>, Alcôve
6 *
7 * For all support questions please contact: <support@auvertech.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25#ifndef _TPAM_H_
26#define _TPAM_H_
27
28#include <linux/types.h>
29
30/* IOCTL commands */
31#define TPAM_CMD_DSPLOAD 0x0001
32#define TPAM_CMD_DSPSAVE 0x0002
33#define TPAM_CMD_DSPRUN 0x0003
34#define TPAM_CMD_LOOPMODEON 0x0004
35#define TPAM_CMD_LOOPMODEOFF 0x0005
36
37/* addresses of debug information zones on board */
38#define TPAM_TRAPAUDIT_REGISTER 0x005493e4
39#define TPAM_NCOAUDIT_REGISTER 0x00500000
40#define TPAM_MSGAUDIT_REGISTER 0x008E30F0
41
42/* length of debug information zones on board */
43#define TPAM_TRAPAUDIT_LENGTH 10000
44#define TPAM_NCOAUDIT_LENGTH 300000
45#define TPAM_NCOAUDIT_COUNT 30
46#define TPAM_MSGAUDIT_LENGTH 60000
47
48/* IOCTL load/save parameter */
49typedef struct tpam_dsp_ioctl {
50 __u32 address; /* address to load/save data */
51 __u32 data_len; /* size of data to be loaded/saved */
52 __u8 data[0]; /* data */
53} tpam_dsp_ioctl;
54
55#endif /* _TPAM_H_ */
diff --git a/include/linux/iso_fs.h b/include/linux/iso_fs.h
index 47967878bfef..4688ac4284e2 100644
--- a/include/linux/iso_fs.h
+++ b/include/linux/iso_fs.h
@@ -2,6 +2,8 @@
2#define _ISOFS_FS_H 2#define _ISOFS_FS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/magic.h>
6
5/* 7/*
6 * The isofs filesystem constants/structures 8 * The isofs filesystem constants/structures
7 */ 9 */
@@ -160,6 +162,4 @@ struct iso_directory_record {
160#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) 162#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
161#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) 163#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
162 164
163#define ISOFS_SUPER_MAGIC 0x9660 165#endif /* _ISOFS_FS_H */
164
165#endif
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 20eb34403d0c..fe89444b1c6f 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * linux/include/linux/jbd.h 2 * linux/include/linux/jbd.h
3 * 3 *
4 * Written by Stephen C. Tweedie <sct@redhat.com> 4 * Written by Stephen C. Tweedie <sct@redhat.com>
5 * 5 *
6 * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved 6 * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
@@ -64,7 +64,7 @@ extern int journal_enable_debug;
64 if ((n) <= journal_enable_debug) { \ 64 if ((n) <= journal_enable_debug) { \
65 printk (KERN_DEBUG "(%s, %d): %s: ", \ 65 printk (KERN_DEBUG "(%s, %d): %s: ", \
66 __FILE__, __LINE__, __FUNCTION__); \ 66 __FILE__, __LINE__, __FUNCTION__); \
67 printk (f, ## a); \ 67 printk (f, ## a); \
68 } \ 68 } \
69 } while (0) 69 } while (0)
70#else 70#else
@@ -72,6 +72,9 @@ extern int journal_enable_debug;
72#endif 72#endif
73 73
74extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry); 74extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry);
75extern void * jbd_slab_alloc(size_t size, gfp_t flags);
76extern void jbd_slab_free(void *ptr, size_t size);
77
75#define jbd_kmalloc(size, flags) \ 78#define jbd_kmalloc(size, flags) \
76 __jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry) 79 __jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry)
77#define jbd_rep_kmalloc(size, flags) \ 80#define jbd_rep_kmalloc(size, flags) \
@@ -94,8 +97,8 @@ extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int re
94 * number of outstanding buffers possible at any time. When the 97 * number of outstanding buffers possible at any time. When the
95 * operation completes, any buffer credits not used are credited back to 98 * operation completes, any buffer credits not used are credited back to
96 * the transaction, so that at all times we know how many buffers the 99 * the transaction, so that at all times we know how many buffers the
97 * outstanding updates on a transaction might possibly touch. 100 * outstanding updates on a transaction might possibly touch.
98 * 101 *
99 * This is an opaque datatype. 102 * This is an opaque datatype.
100 **/ 103 **/
101typedef struct handle_s handle_t; /* Atomic operation type */ 104typedef struct handle_s handle_t; /* Atomic operation type */
@@ -105,7 +108,7 @@ typedef struct handle_s handle_t; /* Atomic operation type */
105 * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem. 108 * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem.
106 * 109 *
107 * journal_t is linked to from the fs superblock structure. 110 * journal_t is linked to from the fs superblock structure.
108 * 111 *
109 * We use the journal_t to keep track of all outstanding transaction 112 * We use the journal_t to keep track of all outstanding transaction
110 * activity on the filesystem, and to manage the state of the log 113 * activity on the filesystem, and to manage the state of the log
111 * writing process. 114 * writing process.
@@ -125,7 +128,7 @@ typedef struct journal_s journal_t; /* Journal control structure */
125 * On-disk structures 128 * On-disk structures
126 */ 129 */
127 130
128/* 131/*
129 * Descriptor block types: 132 * Descriptor block types:
130 */ 133 */
131 134
@@ -146,8 +149,8 @@ typedef struct journal_header_s
146} journal_header_t; 149} journal_header_t;
147 150
148 151
149/* 152/*
150 * The block tag: used to describe a single buffer in the journal 153 * The block tag: used to describe a single buffer in the journal
151 */ 154 */
152typedef struct journal_block_tag_s 155typedef struct journal_block_tag_s
153{ 156{
@@ -155,9 +158,9 @@ typedef struct journal_block_tag_s
155 __be32 t_flags; /* See below */ 158 __be32 t_flags; /* See below */
156} journal_block_tag_t; 159} journal_block_tag_t;
157 160
158/* 161/*
159 * The revoke descriptor: used on disk to describe a series of blocks to 162 * The revoke descriptor: used on disk to describe a series of blocks to
160 * be revoked from the log 163 * be revoked from the log
161 */ 164 */
162typedef struct journal_revoke_header_s 165typedef struct journal_revoke_header_s
163{ 166{
@@ -198,9 +201,9 @@ typedef struct journal_superblock_s
198 201
199/* 0x0024 */ 202/* 0x0024 */
200 /* Remaining fields are only valid in a version-2 superblock */ 203 /* Remaining fields are only valid in a version-2 superblock */
201 __be32 s_feature_compat; /* compatible feature set */ 204 __be32 s_feature_compat; /* compatible feature set */
202 __be32 s_feature_incompat; /* incompatible feature set */ 205 __be32 s_feature_incompat; /* incompatible feature set */
203 __be32 s_feature_ro_compat; /* readonly-compatible feature set */ 206 __be32 s_feature_ro_compat; /* readonly-compatible feature set */
204/* 0x0030 */ 207/* 0x0030 */
205 __u8 s_uuid[16]; /* 128-bit uuid for journal */ 208 __u8 s_uuid[16]; /* 128-bit uuid for journal */
206 209
@@ -371,10 +374,10 @@ struct jbd_revoke_table_s;
371 **/ 374 **/
372 375
373/* Docbook can't yet cope with the bit fields, but will leave the documentation 376/* Docbook can't yet cope with the bit fields, but will leave the documentation
374 * in so it can be fixed later. 377 * in so it can be fixed later.
375 */ 378 */
376 379
377struct handle_s 380struct handle_s
378{ 381{
379 /* Which compound transaction is this update a part of? */ 382 /* Which compound transaction is this update a part of? */
380 transaction_t *h_transaction; 383 transaction_t *h_transaction;
@@ -432,7 +435,7 @@ struct handle_s
432 * 435 *
433 */ 436 */
434 437
435struct transaction_s 438struct transaction_s
436{ 439{
437 /* Pointer to the journal for this transaction. [no locking] */ 440 /* Pointer to the journal for this transaction. [no locking] */
438 journal_t *t_journal; 441 journal_t *t_journal;
@@ -452,7 +455,7 @@ struct transaction_s
452 T_RUNDOWN, 455 T_RUNDOWN,
453 T_FLUSH, 456 T_FLUSH,
454 T_COMMIT, 457 T_COMMIT,
455 T_FINISHED 458 T_FINISHED
456 } t_state; 459 } t_state;
457 460
458 /* 461 /*
@@ -566,7 +569,7 @@ struct transaction_s
566 * journal_t. 569 * journal_t.
567 * @j_flags: General journaling state flags 570 * @j_flags: General journaling state flags
568 * @j_errno: Is there an outstanding uncleared error on the journal (from a 571 * @j_errno: Is there an outstanding uncleared error on the journal (from a
569 * prior abort)? 572 * prior abort)?
570 * @j_sb_buffer: First part of superblock buffer 573 * @j_sb_buffer: First part of superblock buffer
571 * @j_superblock: Second part of superblock buffer 574 * @j_superblock: Second part of superblock buffer
572 * @j_format_version: Version of the superblock format 575 * @j_format_version: Version of the superblock format
@@ -580,7 +583,7 @@ struct transaction_s
580 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction 583 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
581 * to start committing, or for a barrier lock to be released 584 * to start committing, or for a barrier lock to be released
582 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete 585 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete
583 * @j_wait_done_commit: Wait queue for waiting for commit to complete 586 * @j_wait_done_commit: Wait queue for waiting for commit to complete
584 * @j_wait_checkpoint: Wait queue to trigger checkpointing 587 * @j_wait_checkpoint: Wait queue to trigger checkpointing
585 * @j_wait_commit: Wait queue to trigger commit 588 * @j_wait_commit: Wait queue to trigger commit
586 * @j_wait_updates: Wait queue to wait for updates to complete 589 * @j_wait_updates: Wait queue to wait for updates to complete
@@ -589,7 +592,7 @@ struct transaction_s
589 * @j_tail: Journal tail - identifies the oldest still-used block in the 592 * @j_tail: Journal tail - identifies the oldest still-used block in the
590 * journal. 593 * journal.
591 * @j_free: Journal free - how many free blocks are there in the journal? 594 * @j_free: Journal free - how many free blocks are there in the journal?
592 * @j_first: The block number of the first usable block 595 * @j_first: The block number of the first usable block
593 * @j_last: The block number one beyond the last usable block 596 * @j_last: The block number one beyond the last usable block
594 * @j_dev: Device where we store the journal 597 * @j_dev: Device where we store the journal
595 * @j_blocksize: blocksize for the location where we store the journal. 598 * @j_blocksize: blocksize for the location where we store the journal.
@@ -601,12 +604,12 @@ struct transaction_s
601 * @j_list_lock: Protects the buffer lists and internal buffer state. 604 * @j_list_lock: Protects the buffer lists and internal buffer state.
602 * @j_inode: Optional inode where we store the journal. If present, all journal 605 * @j_inode: Optional inode where we store the journal. If present, all journal
603 * block numbers are mapped into this inode via bmap(). 606 * block numbers are mapped into this inode via bmap().
604 * @j_tail_sequence: Sequence number of the oldest transaction in the log 607 * @j_tail_sequence: Sequence number of the oldest transaction in the log
605 * @j_transaction_sequence: Sequence number of the next transaction to grant 608 * @j_transaction_sequence: Sequence number of the next transaction to grant
606 * @j_commit_sequence: Sequence number of the most recently committed 609 * @j_commit_sequence: Sequence number of the most recently committed
607 * transaction 610 * transaction
608 * @j_commit_request: Sequence number of the most recent transaction wanting 611 * @j_commit_request: Sequence number of the most recent transaction wanting
609 * commit 612 * commit
610 * @j_uuid: Uuid of client object. 613 * @j_uuid: Uuid of client object.
611 * @j_task: Pointer to the current commit thread for this journal 614 * @j_task: Pointer to the current commit thread for this journal
612 * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a 615 * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a
@@ -696,7 +699,7 @@ struct journal_s
696 wait_queue_head_t j_wait_updates; 699 wait_queue_head_t j_wait_updates;
697 700
698 /* Semaphore for locking against concurrent checkpoints */ 701 /* Semaphore for locking against concurrent checkpoints */
699 struct mutex j_checkpoint_mutex; 702 struct mutex j_checkpoint_mutex;
700 703
701 /* 704 /*
702 * Journal head: identifies the first unused block in the journal. 705 * Journal head: identifies the first unused block in the journal.
@@ -729,7 +732,7 @@ struct journal_s
729 */ 732 */
730 struct block_device *j_dev; 733 struct block_device *j_dev;
731 int j_blocksize; 734 int j_blocksize;
732 unsigned int j_blk_offset; 735 unsigned long j_blk_offset;
733 736
734 /* 737 /*
735 * Device which holds the client fs. For internal journal this will be 738 * Device which holds the client fs. For internal journal this will be
@@ -820,8 +823,8 @@ struct journal_s
820 void *j_private; 823 void *j_private;
821}; 824};
822 825
823/* 826/*
824 * Journal flag definitions 827 * Journal flag definitions
825 */ 828 */
826#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ 829#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */
827#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ 830#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */
@@ -830,7 +833,7 @@ struct journal_s
830#define JFS_LOADED 0x010 /* The journal superblock has been loaded */ 833#define JFS_LOADED 0x010 /* The journal superblock has been loaded */
831#define JFS_BARRIER 0x020 /* Use IDE barriers */ 834#define JFS_BARRIER 0x020 /* Use IDE barriers */
832 835
833/* 836/*
834 * Function declarations for the journaling transaction and buffer 837 * Function declarations for the journaling transaction and buffer
835 * management 838 * management
836 */ 839 */
@@ -859,11 +862,11 @@ int __journal_remove_checkpoint(struct journal_head *);
859void __journal_insert_checkpoint(struct journal_head *, transaction_t *); 862void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
860 863
861/* Buffer IO */ 864/* Buffer IO */
862extern int 865extern int
863journal_write_metadata_buffer(transaction_t *transaction, 866journal_write_metadata_buffer(transaction_t *transaction,
864 struct journal_head *jh_in, 867 struct journal_head *jh_in,
865 struct journal_head **jh_out, 868 struct journal_head **jh_out,
866 int blocknr); 869 unsigned long blocknr);
867 870
868/* Transaction locking */ 871/* Transaction locking */
869extern void __wait_on_journal (journal_t *); 872extern void __wait_on_journal (journal_t *);
@@ -887,7 +890,7 @@ static inline handle_t *journal_current_handle(void)
887/* The journaling code user interface: 890/* The journaling code user interface:
888 * 891 *
889 * Create and destroy handles 892 * Create and destroy handles
890 * Register buffer modifications against the current transaction. 893 * Register buffer modifications against the current transaction.
891 */ 894 */
892 895
893extern handle_t *journal_start(journal_t *, int nblocks); 896extern handle_t *journal_start(journal_t *, int nblocks);
@@ -914,11 +917,11 @@ extern journal_t * journal_init_dev(struct block_device *bdev,
914 int start, int len, int bsize); 917 int start, int len, int bsize);
915extern journal_t * journal_init_inode (struct inode *); 918extern journal_t * journal_init_inode (struct inode *);
916extern int journal_update_format (journal_t *); 919extern int journal_update_format (journal_t *);
917extern int journal_check_used_features 920extern int journal_check_used_features
918 (journal_t *, unsigned long, unsigned long, unsigned long); 921 (journal_t *, unsigned long, unsigned long, unsigned long);
919extern int journal_check_available_features 922extern int journal_check_available_features
920 (journal_t *, unsigned long, unsigned long, unsigned long); 923 (journal_t *, unsigned long, unsigned long, unsigned long);
921extern int journal_set_features 924extern int journal_set_features
922 (journal_t *, unsigned long, unsigned long, unsigned long); 925 (journal_t *, unsigned long, unsigned long, unsigned long);
923extern int journal_create (journal_t *); 926extern int journal_create (journal_t *);
924extern int journal_load (journal_t *journal); 927extern int journal_load (journal_t *journal);
@@ -974,7 +977,6 @@ extern void journal_write_revoke_records(journal_t *, transaction_t *);
974extern int journal_set_revoke(journal_t *, unsigned long, tid_t); 977extern int journal_set_revoke(journal_t *, unsigned long, tid_t);
975extern int journal_test_revoke(journal_t *, unsigned long, tid_t); 978extern int journal_test_revoke(journal_t *, unsigned long, tid_t);
976extern void journal_clear_revoke(journal_t *); 979extern void journal_clear_revoke(journal_t *);
977extern void journal_brelse_array(struct buffer_head *b[], int n);
978extern void journal_switch_revoke_table(journal_t *journal); 980extern void journal_switch_revoke_table(journal_t *journal);
979 981
980/* 982/*
@@ -1012,7 +1014,7 @@ do { \
1012 * bit, when set, indicates that we have had a fatal error somewhere, 1014 * bit, when set, indicates that we have had a fatal error somewhere,
1013 * either inside the journaling layer or indicated to us by the client 1015 * either inside the journaling layer or indicated to us by the client
1014 * (eg. ext3), and that we and should not commit any further 1016 * (eg. ext3), and that we and should not commit any further
1015 * transactions. 1017 * transactions.
1016 */ 1018 */
1017 1019
1018static inline int is_journal_aborted(journal_t *journal) 1020static inline int is_journal_aborted(journal_t *journal)
@@ -1079,7 +1081,7 @@ static inline int jbd_space_needed(journal_t *journal)
1079#define BJ_Reserved 7 /* Buffer is reserved for access by journal */ 1081#define BJ_Reserved 7 /* Buffer is reserved for access by journal */
1080#define BJ_Locked 8 /* Locked for I/O during commit */ 1082#define BJ_Locked 8 /* Locked for I/O during commit */
1081#define BJ_Types 9 1083#define BJ_Types 9
1082 1084
1083extern int jbd_blocks_per_page(struct inode *inode); 1085extern int jbd_blocks_per_page(struct inode *inode);
1084 1086
1085#ifdef __KERNEL__ 1087#ifdef __KERNEL__
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index c6f70660b371..840631fa5ff1 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -15,12 +15,12 @@
15#ifndef __LINUX_JFFS2_H__ 15#ifndef __LINUX_JFFS2_H__
16#define __LINUX_JFFS2_H__ 16#define __LINUX_JFFS2_H__
17 17
18#include <linux/magic.h>
19
18/* You must include something which defines the C99 uintXX_t types. 20/* You must include something which defines the C99 uintXX_t types.
19 We don't do it from here because this file is used in too many 21 We don't do it from here because this file is used in too many
20 different environments. */ 22 different environments. */
21 23
22#define JFFS2_SUPER_MAGIC 0x72b6
23
24/* Values we may expect to find in the 'magic' field */ 24/* Values we may expect to find in the 'magic' field */
25#define JFFS2_OLD_MAGIC_BITMASK 0x1984 25#define JFFS2_OLD_MAGIC_BITMASK 0x1984
26#define JFFS2_MAGIC_BITMASK 0x1985 26#define JFFS2_MAGIC_BITMASK 0x1985
@@ -186,6 +186,7 @@ struct jffs2_raw_xref
186 jint32_t hdr_crc; 186 jint32_t hdr_crc;
187 jint32_t ino; /* inode number */ 187 jint32_t ino; /* inode number */
188 jint32_t xid; /* XATTR identifier number */ 188 jint32_t xid; /* XATTR identifier number */
189 jint32_t xseqno; /* xref sequencial number */
189 jint32_t node_crc; 190 jint32_t node_crc;
190} __attribute__((packed)); 191} __attribute__((packed));
191 192
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 043376920f51..c8d5f207c3d4 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -47,8 +47,8 @@
47 * - (NOM / DEN) fits in (32 - LSH) bits. 47 * - (NOM / DEN) fits in (32 - LSH) bits.
48 * - (NOM % DEN) fits in (32 - LSH) bits. 48 * - (NOM % DEN) fits in (32 - LSH) bits.
49 */ 49 */
50#define SH_DIV(NOM,DEN,LSH) ( ((NOM / DEN) << LSH) \ 50#define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) \
51 + (((NOM % DEN) << LSH) + DEN / 2) / DEN) 51 + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))
52 52
53/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */ 53/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */
54#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8)) 54#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8))
@@ -115,6 +115,21 @@ static inline u64 get_jiffies_64(void)
115 ((long)(a) - (long)(b) >= 0)) 115 ((long)(a) - (long)(b) >= 0))
116#define time_before_eq(a,b) time_after_eq(b,a) 116#define time_before_eq(a,b) time_after_eq(b,a)
117 117
118/* Same as above, but does so with platform independent 64bit types.
119 * These must be used when utilizing jiffies_64 (i.e. return value of
120 * get_jiffies_64() */
121#define time_after64(a,b) \
122 (typecheck(__u64, a) && \
123 typecheck(__u64, b) && \
124 ((__s64)(b) - (__s64)(a) < 0))
125#define time_before64(a,b) time_after64(b,a)
126
127#define time_after_eq64(a,b) \
128 (typecheck(__u64, a) && \
129 typecheck(__u64, b) && \
130 ((__s64)(a) - (__s64)(b) >= 0))
131#define time_before_eq64(a,b) time_after_eq64(b,a)
132
118/* 133/*
119 * Have the 32 bit jiffies value wrap 5 minutes after boot 134 * Have the 32 bit jiffies value wrap 5 minutes after boot
120 * so jiffies wrap bugs show up earlier. 135 * so jiffies wrap bugs show up earlier.
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 54e2549f96ba..849043ce4ed6 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -57,10 +57,25 @@ do { \
57#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr) 57#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr)
58#endif 58#endif
59 59
60#define print_symbol(fmt, addr) \ 60static inline void print_symbol(const char *fmt, unsigned long addr)
61do { \ 61{
62 __check_printsym_format(fmt, ""); \ 62 __check_printsym_format(fmt, "");
63 __print_symbol(fmt, addr); \ 63 __print_symbol(fmt, (unsigned long)
64 __builtin_extract_return_addr((void *)addr));
65}
66
67#ifndef CONFIG_64BIT
68#define print_ip_sym(ip) \
69do { \
70 printk("[<%08lx>]", ip); \
71 print_symbol(" %s\n", ip); \
64} while(0) 72} while(0)
73#else
74#define print_ip_sym(ip) \
75do { \
76 printk("[<%016lx>]", ip); \
77 print_symbol(" %s\n", ip); \
78} while(0)
79#endif
65 80
66#endif /*_LINUX_KALLSYMS_H*/ 81#endif /*_LINUX_KALLSYMS_H*/
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 4eb851ece080..efe0ee4cc80b 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -155,10 +155,8 @@ static inline void con_schedule_flip(struct tty_struct *t)
155{ 155{
156 unsigned long flags; 156 unsigned long flags;
157 spin_lock_irqsave(&t->buf.lock, flags); 157 spin_lock_irqsave(&t->buf.lock, flags);
158 if (t->buf.tail != NULL) { 158 if (t->buf.tail != NULL)
159 t->buf.tail->active = 0;
160 t->buf.tail->commit = t->buf.tail->used; 159 t->buf.tail->commit = t->buf.tail->used;
161 }
162 spin_unlock_irqrestore(&t->buf.lock, flags); 160 spin_unlock_irqrestore(&t->buf.lock, flags);
163 schedule_work(&t->buf.work); 161 schedule_work(&t->buf.work);
164} 162}
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 8c21aaa248b4..4d00988dad03 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -31,7 +31,10 @@ extern const char linux_banner[];
31#define STACK_MAGIC 0xdeadbeef 31#define STACK_MAGIC 0xdeadbeef
32 32
33#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 33#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
34#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1)) 34#define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL))
35#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
36#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
37#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
35 38
36#define KERN_EMERG "<0>" /* system is unusable */ 39#define KERN_EMERG "<0>" /* system is unusable */
37#define KERN_ALERT "<1>" /* action must be taken immediately */ 40#define KERN_ALERT "<1>" /* action must be taken immediately */
@@ -117,6 +120,8 @@ extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
117 __attribute__ ((format (printf, 3, 4))); 120 __attribute__ ((format (printf, 3, 4)));
118extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) 121extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
119 __attribute__ ((format (printf, 3, 0))); 122 __attribute__ ((format (printf, 3, 0)));
123extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
124 __attribute__ ((format (printf, 2, 3)));
120 125
121extern int sscanf(const char *, const char *, ...) 126extern int sscanf(const char *, const char *, ...)
122 __attribute__ ((format (scanf, 2, 3))); 127 __attribute__ ((format (scanf, 2, 3)));
@@ -182,6 +187,7 @@ extern void bust_spinlocks(int yes);
182extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ 187extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
183extern int panic_timeout; 188extern int panic_timeout;
184extern int panic_on_oops; 189extern int panic_on_oops;
190extern int panic_on_unrecovered_nmi;
185extern int tainted; 191extern int tainted;
186extern const char *print_tainted(void); 192extern const char *print_tainted(void);
187extern void add_taint(unsigned); 193extern void add_taint(unsigned);
@@ -206,6 +212,7 @@ extern enum system_states {
206extern void dump_stack(void); 212extern void dump_stack(void);
207 213
208#ifdef DEBUG 214#ifdef DEBUG
215/* If you are writing a driver, please use dev_dbg instead */
209#define pr_debug(fmt,arg...) \ 216#define pr_debug(fmt,arg...) \
210 printk(KERN_DEBUG fmt,##arg) 217 printk(KERN_DEBUG fmt,##arg)
211#else 218#else
@@ -334,7 +341,20 @@ struct sysinfo {
334/* Force a compilation error if condition is true */ 341/* Force a compilation error if condition is true */
335#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 342#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
336 343
344/* Force a compilation error if condition is true, but also produce a
345 result (of value 0 and type size_t), so the expression can be used
346 e.g. in a structure initializer (or where-ever else comma expressions
347 aren't permitted). */
348#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
349
337/* Trap pasters of __FUNCTION__ at compile-time */ 350/* Trap pasters of __FUNCTION__ at compile-time */
338#define __FUNCTION__ (__func__) 351#define __FUNCTION__ (__func__)
339 352
353/* This helps us to avoid #ifdef CONFIG_NUMA */
354#ifdef CONFIG_NUMA
355#define NUMA_BUILD 1
356#else
357#define NUMA_BUILD 0
358#endif
359
340#endif 360#endif
diff --git a/include/linux/key.h b/include/linux/key.h
index e81ebf910d0b..169f05e4863e 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -177,7 +177,8 @@ struct key {
177/* 177/*
178 * kernel managed key type definition 178 * kernel managed key type definition
179 */ 179 */
180typedef int (*request_key_actor_t)(struct key *key, struct key *authkey, const char *op); 180typedef int (*request_key_actor_t)(struct key *key, struct key *authkey,
181 const char *op, void *aux);
181 182
182struct key_type { 183struct key_type {
183 /* name of the type */ 184 /* name of the type */
@@ -248,7 +249,14 @@ extern struct key *key_alloc(struct key_type *type,
248 const char *desc, 249 const char *desc,
249 uid_t uid, gid_t gid, 250 uid_t uid, gid_t gid,
250 struct task_struct *ctx, 251 struct task_struct *ctx,
251 key_perm_t perm, int not_in_quota); 252 key_perm_t perm,
253 unsigned long flags);
254
255
256#define KEY_ALLOC_IN_QUOTA 0x0000 /* add to quota, reject if would overrun */
257#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */
258#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */
259
252extern int key_payload_reserve(struct key *key, size_t datalen); 260extern int key_payload_reserve(struct key *key, size_t datalen);
253extern int key_instantiate_and_link(struct key *key, 261extern int key_instantiate_and_link(struct key *key,
254 const void *data, 262 const void *data,
@@ -278,6 +286,11 @@ extern struct key *request_key(struct key_type *type,
278 const char *description, 286 const char *description,
279 const char *callout_info); 287 const char *callout_info);
280 288
289extern struct key *request_key_with_auxdata(struct key_type *type,
290 const char *description,
291 const char *callout_info,
292 void *aux);
293
281extern int key_validate(struct key *key); 294extern int key_validate(struct key *key);
282 295
283extern key_ref_t key_create_or_update(key_ref_t keyring, 296extern key_ref_t key_create_or_update(key_ref_t keyring,
@@ -285,7 +298,7 @@ extern key_ref_t key_create_or_update(key_ref_t keyring,
285 const char *description, 298 const char *description,
286 const void *payload, 299 const void *payload,
287 size_t plen, 300 size_t plen,
288 int not_in_quota); 301 unsigned long flags);
289 302
290extern int key_update(key_ref_t key, 303extern int key_update(key_ref_t key,
291 const void *payload, 304 const void *payload,
@@ -299,7 +312,7 @@ extern int key_unlink(struct key *keyring,
299 312
300extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, 313extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid,
301 struct task_struct *ctx, 314 struct task_struct *ctx,
302 int not_in_quota, 315 unsigned long flags,
303 struct key *dest); 316 struct key *dest);
304 317
305extern int keyring_clear(struct key *keyring); 318extern int keyring_clear(struct key *keyring);
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 2d229327959e..bcd9cd173c2c 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -20,6 +20,7 @@
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/sysfs.h> 22#include <linux/sysfs.h>
23#include <linux/compiler.h>
23#include <linux/spinlock.h> 24#include <linux/spinlock.h>
24#include <linux/rwsem.h> 25#include <linux/rwsem.h>
25#include <linux/kref.h> 26#include <linux/kref.h>
@@ -71,12 +72,12 @@ static inline const char * kobject_name(const struct kobject * kobj)
71extern void kobject_init(struct kobject *); 72extern void kobject_init(struct kobject *);
72extern void kobject_cleanup(struct kobject *); 73extern void kobject_cleanup(struct kobject *);
73 74
74extern int kobject_add(struct kobject *); 75extern int __must_check kobject_add(struct kobject *);
75extern void kobject_del(struct kobject *); 76extern void kobject_del(struct kobject *);
76 77
77extern int kobject_rename(struct kobject *, const char *new_name); 78extern int __must_check kobject_rename(struct kobject *, const char *new_name);
78 79
79extern int kobject_register(struct kobject *); 80extern int __must_check kobject_register(struct kobject *);
80extern void kobject_unregister(struct kobject *); 81extern void kobject_unregister(struct kobject *);
81 82
82extern struct kobject * kobject_get(struct kobject *); 83extern struct kobject * kobject_get(struct kobject *);
@@ -128,8 +129,8 @@ struct kset {
128 129
129 130
130extern void kset_init(struct kset * k); 131extern void kset_init(struct kset * k);
131extern int kset_add(struct kset * k); 132extern int __must_check kset_add(struct kset * k);
132extern int kset_register(struct kset * k); 133extern int __must_check kset_register(struct kset * k);
133extern void kset_unregister(struct kset * k); 134extern void kset_unregister(struct kset * k);
134 135
135static inline struct kset * to_kset(struct kobject * kobj) 136static inline struct kset * to_kset(struct kobject * kobj)
@@ -239,7 +240,7 @@ extern struct subsystem hypervisor_subsys;
239 (obj)->subsys.kset.kobj.kset = &(_subsys).kset 240 (obj)->subsys.kset.kobj.kset = &(_subsys).kset
240 241
241extern void subsystem_init(struct subsystem *); 242extern void subsystem_init(struct subsystem *);
242extern int subsystem_register(struct subsystem *); 243extern int __must_check subsystem_register(struct subsystem *);
243extern void subsystem_unregister(struct subsystem *); 244extern void subsystem_unregister(struct subsystem *);
244 245
245static inline struct subsystem * subsys_get(struct subsystem * s) 246static inline struct subsystem * subsys_get(struct subsystem * s)
@@ -258,7 +259,8 @@ struct subsys_attribute {
258 ssize_t (*store)(struct subsystem *, const char *, size_t); 259 ssize_t (*store)(struct subsystem *, const char *, size_t);
259}; 260};
260 261
261extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); 262extern int __must_check subsys_create_file(struct subsystem * ,
263 struct subsys_attribute *);
262 264
263#if defined(CONFIG_HOTPLUG) 265#if defined(CONFIG_HOTPLUG)
264void kobject_uevent(struct kobject *kobj, enum kobject_action action); 266void kobject_uevent(struct kobject *kobj, enum kobject_action action);
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index ebdd41fd1082..1c65e7a9f186 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -4,37 +4,19 @@
4#include <linux/err.h> 4#include <linux/err.h>
5#include <linux/sched.h> 5#include <linux/sched.h>
6 6
7/**
8 * kthread_create: create a kthread.
9 * @threadfn: the function to run until signal_pending(current).
10 * @data: data ptr for @threadfn.
11 * @namefmt: printf-style name for the thread.
12 *
13 * Description: This helper function creates and names a kernel
14 * thread. The thread will be stopped: use wake_up_process() to start
15 * it. See also kthread_run(), kthread_create_on_cpu().
16 *
17 * When woken, the thread will run @threadfn() with @data as its
18 * argument. @threadfn can either call do_exit() directly if it is a
19 * standalone thread for which noone will call kthread_stop(), or
20 * return when 'kthread_should_stop()' is true (which means
21 * kthread_stop() has been called). The return value should be zero
22 * or a negative error number: it will be passed to kthread_stop().
23 *
24 * Returns a task_struct or ERR_PTR(-ENOMEM).
25 */
26struct task_struct *kthread_create(int (*threadfn)(void *data), 7struct task_struct *kthread_create(int (*threadfn)(void *data),
27 void *data, 8 void *data,
28 const char namefmt[], ...); 9 const char namefmt[], ...);
29 10
30/** 11/**
31 * kthread_run: create and wake a thread. 12 * kthread_run - create and wake a thread.
32 * @threadfn: the function to run until signal_pending(current). 13 * @threadfn: the function to run until signal_pending(current).
33 * @data: data ptr for @threadfn. 14 * @data: data ptr for @threadfn.
34 * @namefmt: printf-style name for the thread. 15 * @namefmt: printf-style name for the thread.
35 * 16 *
36 * Description: Convenient wrapper for kthread_create() followed by 17 * Description: Convenient wrapper for kthread_create() followed by
37 * wake_up_process(). Returns the kthread, or ERR_PTR(-ENOMEM). */ 18 * wake_up_process(). Returns the kthread or ERR_PTR(-ENOMEM).
19 */
38#define kthread_run(threadfn, data, namefmt, ...) \ 20#define kthread_run(threadfn, data, namefmt, ...) \
39({ \ 21({ \
40 struct task_struct *__k \ 22 struct task_struct *__k \
@@ -44,50 +26,8 @@ struct task_struct *kthread_create(int (*threadfn)(void *data),
44 __k; \ 26 __k; \
45}) 27})
46 28
47/**
48 * kthread_bind: bind a just-created kthread to a cpu.
49 * @k: thread created by kthread_create().
50 * @cpu: cpu (might not be online, must be possible) for @k to run on.
51 *
52 * Description: This function is equivalent to set_cpus_allowed(),
53 * except that @cpu doesn't need to be online, and the thread must be
54 * stopped (ie. just returned from kthread_create().
55 */
56void kthread_bind(struct task_struct *k, unsigned int cpu); 29void kthread_bind(struct task_struct *k, unsigned int cpu);
57
58/**
59 * kthread_stop: stop a thread created by kthread_create().
60 * @k: thread created by kthread_create().
61 *
62 * Sets kthread_should_stop() for @k to return true, wakes it, and
63 * waits for it to exit. Your threadfn() must not call do_exit()
64 * itself if you use this function! This can also be called after
65 * kthread_create() instead of calling wake_up_process(): the thread
66 * will exit without calling threadfn().
67 *
68 * Returns the result of threadfn(), or -EINTR if wake_up_process()
69 * was never called. */
70int kthread_stop(struct task_struct *k); 30int kthread_stop(struct task_struct *k);
71
72/**
73 * kthread_stop_sem: stop a thread created by kthread_create().
74 * @k: thread created by kthread_create().
75 * @s: semaphore that @k waits on while idle.
76 *
77 * Does essentially the same thing as kthread_stop() above, but wakes
78 * @k by calling up(@s).
79 *
80 * Returns the result of threadfn(), or -EINTR if wake_up_process()
81 * was never called. */
82int kthread_stop_sem(struct task_struct *k, struct semaphore *s);
83
84/**
85 * kthread_should_stop: should this kthread return now?
86 *
87 * When someone calls kthread_stop on your kthread, it will be woken
88 * and this will return true. You should then return, and your return
89 * value will be passed through to kthread_stop().
90 */
91int kthread_should_stop(void); 31int kthread_should_stop(void);
92 32
93#endif /* _LINUX_KTHREAD_H */ 33#endif /* _LINUX_KTHREAD_H */
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 62bc57580707..84eeecd60a02 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -56,7 +56,8 @@ typedef union {
56#endif 56#endif
57} ktime_t; 57} ktime_t;
58 58
59#define KTIME_MAX (~((u64)1 << 63)) 59#define KTIME_MAX ((s64)~((u64)1 << 63))
60#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
60 61
61/* 62/*
62 * ktime_t definitions when using the 64-bit scalar representation: 63 * ktime_t definitions when using the 64-bit scalar representation:
@@ -66,7 +67,6 @@ typedef union {
66 67
67/** 68/**
68 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value 69 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
69 *
70 * @secs: seconds to set 70 * @secs: seconds to set
71 * @nsecs: nanoseconds to set 71 * @nsecs: nanoseconds to set
72 * 72 *
@@ -74,6 +74,10 @@ typedef union {
74 */ 74 */
75static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) 75static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
76{ 76{
77#if (BITS_PER_LONG == 64)
78 if (unlikely(secs >= KTIME_SEC_MAX))
79 return (ktime_t){ .tv64 = KTIME_MAX };
80#endif
77 return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; 81 return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs };
78} 82}
79 83
@@ -138,7 +142,6 @@ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
138 142
139/** 143/**
140 * ktime_sub - subtract two ktime_t variables 144 * ktime_sub - subtract two ktime_t variables
141 *
142 * @lhs: minuend 145 * @lhs: minuend
143 * @rhs: subtrahend 146 * @rhs: subtrahend
144 * 147 *
@@ -157,7 +160,6 @@ static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
157 160
158/** 161/**
159 * ktime_add - add two ktime_t variables 162 * ktime_add - add two ktime_t variables
160 *
161 * @add1: addend1 163 * @add1: addend1
162 * @add2: addend2 164 * @add2: addend2
163 * 165 *
@@ -184,7 +186,6 @@ static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
184 186
185/** 187/**
186 * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable 188 * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable
187 *
188 * @kt: addend 189 * @kt: addend
189 * @nsec: the scalar nsec value to add 190 * @nsec: the scalar nsec value to add
190 * 191 *
@@ -194,7 +195,6 @@ extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
194 195
195/** 196/**
196 * timespec_to_ktime - convert a timespec to ktime_t format 197 * timespec_to_ktime - convert a timespec to ktime_t format
197 *
198 * @ts: the timespec variable to convert 198 * @ts: the timespec variable to convert
199 * 199 *
200 * Returns a ktime_t variable with the converted timespec value 200 * Returns a ktime_t variable with the converted timespec value
@@ -207,7 +207,6 @@ static inline ktime_t timespec_to_ktime(const struct timespec ts)
207 207
208/** 208/**
209 * timeval_to_ktime - convert a timeval to ktime_t format 209 * timeval_to_ktime - convert a timeval to ktime_t format
210 *
211 * @tv: the timeval variable to convert 210 * @tv: the timeval variable to convert
212 * 211 *
213 * Returns a ktime_t variable with the converted timeval value 212 * Returns a ktime_t variable with the converted timeval value
@@ -220,7 +219,6 @@ static inline ktime_t timeval_to_ktime(const struct timeval tv)
220 219
221/** 220/**
222 * ktime_to_timespec - convert a ktime_t variable to timespec format 221 * ktime_to_timespec - convert a ktime_t variable to timespec format
223 *
224 * @kt: the ktime_t variable to convert 222 * @kt: the ktime_t variable to convert
225 * 223 *
226 * Returns the timespec representation of the ktime value 224 * Returns the timespec representation of the ktime value
@@ -233,7 +231,6 @@ static inline struct timespec ktime_to_timespec(const ktime_t kt)
233 231
234/** 232/**
235 * ktime_to_timeval - convert a ktime_t variable to timeval format 233 * ktime_to_timeval - convert a ktime_t variable to timeval format
236 *
237 * @kt: the ktime_t variable to convert 234 * @kt: the ktime_t variable to convert
238 * 235 *
239 * Returns the timeval representation of the ktime value 236 * Returns the timeval representation of the ktime value
diff --git a/include/linux/leds.h b/include/linux/leds.h
index dc23c7c639f3..88afceffb7cb 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -12,6 +12,9 @@
12#ifndef __LINUX_LEDS_H_INCLUDED 12#ifndef __LINUX_LEDS_H_INCLUDED
13#define __LINUX_LEDS_H_INCLUDED 13#define __LINUX_LEDS_H_INCLUDED
14 14
15#include <linux/list.h>
16#include <linux/spinlock.h>
17
15struct device; 18struct device;
16struct class_device; 19struct class_device;
17/* 20/*
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 20b1cf527c60..d6a3d4b345fc 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -30,12 +30,23 @@
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
33#include <asm/scatterlist.h>
33#include <asm/io.h> 34#include <asm/io.h>
34#include <linux/ata.h> 35#include <linux/ata.h>
35#include <linux/workqueue.h> 36#include <linux/workqueue.h>
36#include <scsi/scsi_host.h> 37#include <scsi/scsi_host.h>
37 38
38/* 39/*
40 * Define if arch has non-standard setup. This is a _PCI_ standard
41 * not a legacy or ISA standard.
42 */
43#ifdef CONFIG_ATA_NONSTANDARD
44#include <asm/libata-portmap.h>
45#else
46#include <asm-generic/libata-portmap.h>
47#endif
48
49/*
39 * compile-time options: to be removed as soon as all the drivers are 50 * compile-time options: to be removed as soon as all the drivers are
40 * converted to the new debugging mechanism 51 * converted to the new debugging mechanism
41 */ 52 */
@@ -43,7 +54,7 @@
43#undef ATA_VERBOSE_DEBUG /* yet more debugging output */ 54#undef ATA_VERBOSE_DEBUG /* yet more debugging output */
44#undef ATA_IRQ_TRAP /* define to ack screaming irqs */ 55#undef ATA_IRQ_TRAP /* define to ack screaming irqs */
45#undef ATA_NDEBUG /* define to disable quick runtime checks */ 56#undef ATA_NDEBUG /* define to disable quick runtime checks */
46#undef ATA_ENABLE_PATA /* define to enable PATA support in some 57#define ATA_ENABLE_PATA /* define to enable PATA support in some
47 * low-level drivers */ 58 * low-level drivers */
48 59
49 60
@@ -111,8 +122,6 @@ enum {
111 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ 122 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */
112 ATA_MAX_QUEUE = 32, 123 ATA_MAX_QUEUE = 32,
113 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, 124 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1,
114 ATA_MAX_SECTORS = 200, /* FIXME */
115 ATA_MAX_SECTORS_LBA48 = 65535,
116 ATA_MAX_BUS = 2, 125 ATA_MAX_BUS = 2,
117 ATA_DEF_BUSY_WAIT = 10000, 126 ATA_DEF_BUSY_WAIT = 10000,
118 ATA_SHORT_PAUSE = (HZ >> 6) + 1, 127 ATA_SHORT_PAUSE = (HZ >> 6) + 1,
@@ -130,6 +139,7 @@ enum {
130 ATA_DFLAG_CFG_MASK = (1 << 8) - 1, 139 ATA_DFLAG_CFG_MASK = (1 << 8) - 1,
131 140
132 ATA_DFLAG_PIO = (1 << 8), /* device currently in PIO mode */ 141 ATA_DFLAG_PIO = (1 << 8), /* device currently in PIO mode */
142 ATA_DFLAG_SUSPENDED = (1 << 9), /* device suspended */
133 ATA_DFLAG_INIT_MASK = (1 << 16) - 1, 143 ATA_DFLAG_INIT_MASK = (1 << 16) - 1,
134 144
135 ATA_DFLAG_DETACH = (1 << 16), 145 ATA_DFLAG_DETACH = (1 << 16),
@@ -159,22 +169,28 @@ enum {
159 ATA_FLAG_HRST_TO_RESUME = (1 << 11), /* hardreset to resume phy */ 169 ATA_FLAG_HRST_TO_RESUME = (1 << 11), /* hardreset to resume phy */
160 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H 170 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H
161 * Register FIS clearing BSY */ 171 * Register FIS clearing BSY */
162
163 ATA_FLAG_DEBUGMSG = (1 << 13), 172 ATA_FLAG_DEBUGMSG = (1 << 13),
164 ATA_FLAG_FLUSH_PORT_TASK = (1 << 14), /* flush port task */
165 173
166 ATA_FLAG_EH_PENDING = (1 << 15), /* EH pending */ 174 /* The following flag belongs to ap->pflags but is kept in
167 ATA_FLAG_EH_IN_PROGRESS = (1 << 16), /* EH in progress */ 175 * ap->flags because it's referenced in many LLDs and will be
168 ATA_FLAG_FROZEN = (1 << 17), /* port is frozen */ 176 * removed in not-too-distant future.
169 ATA_FLAG_RECOVERED = (1 << 18), /* recovery action performed */ 177 */
170 ATA_FLAG_LOADING = (1 << 19), /* boot/loading probe */ 178 ATA_FLAG_DISABLED = (1 << 23), /* port is disabled, ignore it */
171 ATA_FLAG_UNLOADING = (1 << 20), /* module is unloading */
172 ATA_FLAG_SCSI_HOTPLUG = (1 << 21), /* SCSI hotplug scheduled */
173 179
174 ATA_FLAG_DISABLED = (1 << 22), /* port is disabled, ignore it */ 180 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
175 ATA_FLAG_SUSPENDED = (1 << 23), /* port is suspended (power) */
176 181
177 /* bits 24:31 of ap->flags are reserved for LLDD specific flags */ 182 /* struct ata_port pflags */
183 ATA_PFLAG_EH_PENDING = (1 << 0), /* EH pending */
184 ATA_PFLAG_EH_IN_PROGRESS = (1 << 1), /* EH in progress */
185 ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */
186 ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */
187 ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */
188 ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */
189 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */
190
191 ATA_PFLAG_FLUSH_PORT_TASK = (1 << 16), /* flush port task */
192 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
193 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
178 194
179 /* struct ata_queued_cmd flags */ 195 /* struct ata_queued_cmd flags */
180 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ 196 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
@@ -189,8 +205,8 @@ enum {
189 ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ 205 ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */
190 206
191 /* host set flags */ 207 /* host set flags */
192 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */ 208 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
193 209
194 /* various lengths of time */ 210 /* various lengths of time */
195 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 211 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
196 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ 212 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
@@ -217,8 +233,8 @@ enum {
217 /* encoding various smaller bitmaps into a single 233 /* encoding various smaller bitmaps into a single
218 * unsigned int bitmap 234 * unsigned int bitmap
219 */ 235 */
220 ATA_BITS_PIO = 5, 236 ATA_BITS_PIO = 7,
221 ATA_BITS_MWDMA = 3, 237 ATA_BITS_MWDMA = 5,
222 ATA_BITS_UDMA = 8, 238 ATA_BITS_UDMA = 8,
223 239
224 ATA_SHIFT_PIO = 0, 240 ATA_SHIFT_PIO = 0,
@@ -247,15 +263,24 @@ enum {
247 ATA_EH_REVALIDATE = (1 << 0), 263 ATA_EH_REVALIDATE = (1 << 0),
248 ATA_EH_SOFTRESET = (1 << 1), 264 ATA_EH_SOFTRESET = (1 << 1),
249 ATA_EH_HARDRESET = (1 << 2), 265 ATA_EH_HARDRESET = (1 << 2),
266 ATA_EH_SUSPEND = (1 << 3),
267 ATA_EH_RESUME = (1 << 4),
268 ATA_EH_PM_FREEZE = (1 << 5),
250 269
251 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, 270 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
252 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, 271 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_SUSPEND |
272 ATA_EH_RESUME | ATA_EH_PM_FREEZE,
253 273
254 /* ata_eh_info->flags */ 274 /* ata_eh_info->flags */
255 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ 275 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */
276 ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */
277 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */
278 ATA_EHI_QUIET = (1 << 3), /* be quiet */
256 279
257 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ 280 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */
258 281
282 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
283
259 /* max repeat if error condition is still set after ->error_handler */ 284 /* max repeat if error condition is still set after ->error_handler */
260 ATA_EH_MAX_REPEAT = 5, 285 ATA_EH_MAX_REPEAT = 5,
261 286
@@ -272,6 +297,11 @@ enum {
272 * most devices. 297 * most devices.
273 */ 298 */
274 ATA_SPINUP_WAIT = 8000, 299 ATA_SPINUP_WAIT = 8000,
300
301 /* Horkage types. May be set by libata or controller on drives
302 (some horkage may be drive/controller pair dependant */
303
304 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */
275}; 305};
276 306
277enum hsm_task_states { 307enum hsm_task_states {
@@ -333,23 +363,32 @@ struct ata_probe_ent {
333 struct scsi_host_template *sht; 363 struct scsi_host_template *sht;
334 struct ata_ioports port[ATA_MAX_PORTS]; 364 struct ata_ioports port[ATA_MAX_PORTS];
335 unsigned int n_ports; 365 unsigned int n_ports;
336 unsigned int hard_port_no; 366 unsigned int dummy_port_mask;
337 unsigned int pio_mask; 367 unsigned int pio_mask;
338 unsigned int mwdma_mask; 368 unsigned int mwdma_mask;
339 unsigned int udma_mask; 369 unsigned int udma_mask;
340 unsigned int legacy_mode;
341 unsigned long irq; 370 unsigned long irq;
371 unsigned long irq2;
342 unsigned int irq_flags; 372 unsigned int irq_flags;
343 unsigned long host_flags; 373 unsigned long port_flags;
344 unsigned long host_set_flags; 374 unsigned long _host_flags;
345 void __iomem *mmio_base; 375 void __iomem *mmio_base;
346 void *private_data; 376 void *private_data;
377
378 /* port_info for the secondary port. Together with irq2, it's
379 * used to implement non-uniform secondary port. Currently,
380 * the only user is ata_piix combined mode. This workaround
381 * will be removed together with ata_probe_ent when init model
382 * is updated.
383 */
384 const struct ata_port_info *pinfo2;
347}; 385};
348 386
349struct ata_host_set { 387struct ata_host {
350 spinlock_t lock; 388 spinlock_t lock;
351 struct device *dev; 389 struct device *dev;
352 unsigned long irq; 390 unsigned long irq;
391 unsigned long irq2;
353 void __iomem *mmio_base; 392 void __iomem *mmio_base;
354 unsigned int n_ports; 393 unsigned int n_ports;
355 void *private_data; 394 void *private_data;
@@ -357,7 +396,6 @@ struct ata_host_set {
357 unsigned long flags; 396 unsigned long flags;
358 int simplex_claimed; /* Keep seperate in case we 397 int simplex_claimed; /* Keep seperate in case we
359 ever need to do this locked */ 398 ever need to do this locked */
360 struct ata_host_set *next; /* for legacy mode */
361 struct ata_port *ports[0]; 399 struct ata_port *ports[0];
362}; 400};
363 401
@@ -403,7 +441,7 @@ struct ata_queued_cmd {
403 void *private_data; 441 void *private_data;
404}; 442};
405 443
406struct ata_host_stats { 444struct ata_port_stats {
407 unsigned long unhandled_irq; 445 unsigned long unhandled_irq;
408 unsigned long idle_irq; 446 unsigned long idle_irq;
409 unsigned long rw_reqbuf; 447 unsigned long rw_reqbuf;
@@ -451,6 +489,7 @@ struct ata_device {
451 489
452 /* error history */ 490 /* error history */
453 struct ata_ering ering; 491 struct ata_ering ering;
492 unsigned int horkage; /* List of broken features */
454}; 493};
455 494
456/* Offset into struct ata_device. Fields above it are maintained 495/* Offset into struct ata_device. Fields above it are maintained
@@ -481,13 +520,13 @@ struct ata_eh_context {
481}; 520};
482 521
483struct ata_port { 522struct ata_port {
484 struct Scsi_Host *host; /* our co-allocated scsi host */ 523 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
485 const struct ata_port_operations *ops; 524 const struct ata_port_operations *ops;
486 spinlock_t *lock; 525 spinlock_t *lock;
487 unsigned long flags; /* ATA_FLAG_xxx */ 526 unsigned long flags; /* ATA_FLAG_xxx */
527 unsigned int pflags; /* ATA_PFLAG_xxx */
488 unsigned int id; /* unique id req'd by scsi midlyr */ 528 unsigned int id; /* unique id req'd by scsi midlyr */
489 unsigned int port_no; /* unique port #; from zero */ 529 unsigned int port_no; /* unique port #; from zero */
490 unsigned int hard_port_no; /* hardware port #; from zero */
491 530
492 struct ata_prd *prd; /* our SG list */ 531 struct ata_prd *prd; /* our SG list */
493 dma_addr_t prd_dma; /* and its DMA mapping */ 532 dma_addr_t prd_dma; /* and its DMA mapping */
@@ -506,7 +545,7 @@ struct ata_port {
506 unsigned int hw_sata_spd_limit; 545 unsigned int hw_sata_spd_limit;
507 unsigned int sata_spd_limit; /* SATA PHY speed limit */ 546 unsigned int sata_spd_limit; /* SATA PHY speed limit */
508 547
509 /* record runtime error info, protected by host_set lock */ 548 /* record runtime error info, protected by host lock */
510 struct ata_eh_info eh_info; 549 struct ata_eh_info eh_info;
511 /* EH context owned by EH */ 550 /* EH context owned by EH */
512 struct ata_eh_context eh_context; 551 struct ata_eh_context eh_context;
@@ -520,8 +559,8 @@ struct ata_port {
520 unsigned int active_tag; 559 unsigned int active_tag;
521 u32 sactive; 560 u32 sactive;
522 561
523 struct ata_host_stats stats; 562 struct ata_port_stats stats;
524 struct ata_host_set *host_set; 563 struct ata_host *host;
525 struct device *dev; 564 struct device *dev;
526 565
527 struct work_struct port_task; 566 struct work_struct port_task;
@@ -534,6 +573,9 @@ struct ata_port {
534 struct list_head eh_done_q; 573 struct list_head eh_done_q;
535 wait_queue_head_t eh_wait_q; 574 wait_queue_head_t eh_wait_q;
536 575
576 pm_message_t pm_mesg;
577 int *pm_result;
578
537 void *private_data; 579 void *private_data;
538 580
539 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ 581 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */
@@ -588,10 +630,13 @@ struct ata_port_operations {
588 void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, 630 void (*scr_write) (struct ata_port *ap, unsigned int sc_reg,
589 u32 val); 631 u32 val);
590 632
633 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg);
634 int (*port_resume) (struct ata_port *ap);
635
591 int (*port_start) (struct ata_port *ap); 636 int (*port_start) (struct ata_port *ap);
592 void (*port_stop) (struct ata_port *ap); 637 void (*port_stop) (struct ata_port *ap);
593 638
594 void (*host_stop) (struct ata_host_set *host_set); 639 void (*host_stop) (struct ata_host *host);
595 640
596 void (*bmdma_stop) (struct ata_queued_cmd *qc); 641 void (*bmdma_stop) (struct ata_queued_cmd *qc);
597 u8 (*bmdma_status) (struct ata_port *ap); 642 u8 (*bmdma_status) (struct ata_port *ap);
@@ -599,7 +644,7 @@ struct ata_port_operations {
599 644
600struct ata_port_info { 645struct ata_port_info {
601 struct scsi_host_template *sht; 646 struct scsi_host_template *sht;
602 unsigned long host_flags; 647 unsigned long flags;
603 unsigned long pio_mask; 648 unsigned long pio_mask;
604 unsigned long mwdma_mask; 649 unsigned long mwdma_mask;
605 unsigned long udma_mask; 650 unsigned long udma_mask;
@@ -621,9 +666,25 @@ struct ata_timing {
621 666
622#define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin) 667#define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin)
623 668
624extern const unsigned long sata_deb_timing_boot[]; 669extern const unsigned long sata_deb_timing_normal[];
625extern const unsigned long sata_deb_timing_eh[]; 670extern const unsigned long sata_deb_timing_hotplug[];
626extern const unsigned long sata_deb_timing_before_fsrst[]; 671extern const unsigned long sata_deb_timing_long[];
672
673extern const struct ata_port_operations ata_dummy_port_ops;
674
675static inline const unsigned long *
676sata_ehc_deb_timing(struct ata_eh_context *ehc)
677{
678 if (ehc->i.flags & ATA_EHI_HOTPLUGGED)
679 return sata_deb_timing_hotplug;
680 else
681 return sata_deb_timing_normal;
682}
683
684static inline int ata_port_is_dummy(struct ata_port *ap)
685{
686 return ap->ops == &ata_dummy_port_ops;
687}
627 688
628extern void ata_port_probe(struct ata_port *); 689extern void ata_port_probe(struct ata_port *);
629extern void __sata_phy_reset(struct ata_port *ap); 690extern void __sata_phy_reset(struct ata_port *ap);
@@ -643,17 +704,30 @@ extern void ata_std_ports(struct ata_ioports *ioaddr);
643extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, 704extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
644 unsigned int n_ports); 705 unsigned int n_ports);
645extern void ata_pci_remove_one (struct pci_dev *pdev); 706extern void ata_pci_remove_one (struct pci_dev *pdev);
646extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state); 707extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
708extern void ata_pci_device_do_resume(struct pci_dev *pdev);
709extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
647extern int ata_pci_device_resume(struct pci_dev *pdev); 710extern int ata_pci_device_resume(struct pci_dev *pdev);
648extern int ata_pci_clear_simplex(struct pci_dev *pdev); 711extern int ata_pci_clear_simplex(struct pci_dev *pdev);
649#endif /* CONFIG_PCI */ 712#endif /* CONFIG_PCI */
650extern int ata_device_add(const struct ata_probe_ent *ent); 713extern int ata_device_add(const struct ata_probe_ent *ent);
651extern void ata_port_detach(struct ata_port *ap); 714extern void ata_port_detach(struct ata_port *ap);
652extern void ata_host_set_remove(struct ata_host_set *host_set); 715extern void ata_host_init(struct ata_host *, struct device *,
716 unsigned long, const struct ata_port_operations *);
717extern void ata_host_remove(struct ata_host *host);
653extern int ata_scsi_detect(struct scsi_host_template *sht); 718extern int ata_scsi_detect(struct scsi_host_template *sht);
654extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 719extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
655extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 720extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
656extern int ata_scsi_release(struct Scsi_Host *host); 721extern int ata_scsi_release(struct Scsi_Host *host);
722extern void ata_sas_port_destroy(struct ata_port *);
723extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
724 struct ata_port_info *, struct Scsi_Host *);
725extern int ata_sas_port_init(struct ata_port *);
726extern int ata_sas_port_start(struct ata_port *ap);
727extern void ata_sas_port_stop(struct ata_port *ap);
728extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
729extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
730 struct ata_port *ap);
657extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 731extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
658extern int sata_scr_valid(struct ata_port *ap); 732extern int sata_scr_valid(struct ata_port *ap);
659extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); 733extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val);
@@ -662,9 +736,9 @@ extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val);
662extern int ata_port_online(struct ata_port *ap); 736extern int ata_port_online(struct ata_port *ap);
663extern int ata_port_offline(struct ata_port *ap); 737extern int ata_port_offline(struct ata_port *ap);
664extern int ata_scsi_device_resume(struct scsi_device *); 738extern int ata_scsi_device_resume(struct scsi_device *);
665extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); 739extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg);
666extern int ata_device_resume(struct ata_device *); 740extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
667extern int ata_device_suspend(struct ata_device *, pm_message_t state); 741extern void ata_host_resume(struct ata_host *host);
668extern int ata_ratelimit(void); 742extern int ata_ratelimit(void);
669extern unsigned int ata_busy_sleep(struct ata_port *ap, 743extern unsigned int ata_busy_sleep(struct ata_port *ap,
670 unsigned long timeout_pat, 744 unsigned long timeout_pat,
@@ -689,7 +763,7 @@ extern u8 ata_altstatus(struct ata_port *ap);
689extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); 763extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
690extern int ata_port_start (struct ata_port *ap); 764extern int ata_port_start (struct ata_port *ap);
691extern void ata_port_stop (struct ata_port *ap); 765extern void ata_port_stop (struct ata_port *ap);
692extern void ata_host_stop (struct ata_host_set *host_set); 766extern void ata_host_stop (struct ata_host *host);
693extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 767extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
694extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, 768extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf,
695 unsigned int buflen, int write_data); 769 unsigned int buflen, int write_data);
@@ -775,7 +849,7 @@ struct pci_bits {
775 unsigned long val; 849 unsigned long val;
776}; 850};
777 851
778extern void ata_pci_host_stop (struct ata_host_set *host_set); 852extern void ata_pci_host_stop (struct ata_host *host);
779extern struct ata_probe_ent * 853extern struct ata_probe_ent *
780ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); 854ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask);
781extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); 855extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
@@ -824,19 +898,24 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
824 (ehi)->desc_len = 0; \ 898 (ehi)->desc_len = 0; \
825} while (0) 899} while (0)
826 900
827static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi) 901static inline void __ata_ehi_hotplugged(struct ata_eh_info *ehi)
828{ 902{
829 if (ehi->flags & ATA_EHI_HOTPLUGGED) 903 if (ehi->flags & ATA_EHI_HOTPLUGGED)
830 return; 904 return;
831 905
832 ehi->flags |= ATA_EHI_HOTPLUGGED; 906 ehi->flags |= ATA_EHI_HOTPLUGGED | ATA_EHI_RESUME_LINK;
833 ehi->hotplug_timestamp = jiffies; 907 ehi->hotplug_timestamp = jiffies;
834 908
835 ehi->err_mask |= AC_ERR_ATA_BUS;
836 ehi->action |= ATA_EH_SOFTRESET; 909 ehi->action |= ATA_EH_SOFTRESET;
837 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; 910 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
838} 911}
839 912
913static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
914{
915 __ata_ehi_hotplugged(ehi);
916 ehi->err_mask |= AC_ERR_ATA_BUS;
917}
918
840/* 919/*
841 * qc helpers 920 * qc helpers
842 */ 921 */
@@ -887,6 +966,9 @@ static inline unsigned int ata_tag_internal(unsigned int tag)
887 return tag == ATA_MAX_QUEUE - 1; 966 return tag == ATA_MAX_QUEUE - 1;
888} 967}
889 968
969/*
970 * device helpers
971 */
890static inline unsigned int ata_class_enabled(unsigned int class) 972static inline unsigned int ata_class_enabled(unsigned int class)
891{ 973{
892 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI; 974 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI;
@@ -917,6 +999,22 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev)
917 return ata_class_absent(dev->class); 999 return ata_class_absent(dev->class);
918} 1000}
919 1001
1002static inline unsigned int ata_dev_ready(const struct ata_device *dev)
1003{
1004 return ata_dev_enabled(dev) && !(dev->flags & ATA_DFLAG_SUSPENDED);
1005}
1006
1007/*
1008 * port helpers
1009 */
1010static inline int ata_port_max_devices(const struct ata_port *ap)
1011{
1012 if (ap->flags & ATA_FLAG_SLAVE_POSS)
1013 return 2;
1014 return 1;
1015}
1016
1017
920static inline u8 ata_chk_status(struct ata_port *ap) 1018static inline u8 ata_chk_status(struct ata_port *ap)
921{ 1019{
922 return ap->ops->check_status(ap); 1020 return ap->ops->check_status(ap);
diff --git a/include/linux/license.h b/include/linux/license.h
new file mode 100644
index 000000000000..decdbf43cb5c
--- /dev/null
+++ b/include/linux/license.h
@@ -0,0 +1,14 @@
1#ifndef __LICENSE_H
2#define __LICENSE_H
3
4static inline int license_is_gpl_compatible(const char *license)
5{
6 return (strcmp(license, "GPL") == 0
7 || strcmp(license, "GPL v2") == 0
8 || strcmp(license, "GPL and additional rights") == 0
9 || strcmp(license, "Dual BSD/GPL") == 0
10 || strcmp(license, "Dual MIT/GPL") == 0
11 || strcmp(license, "Dual MPL/GPL") == 0);
12}
13
14#endif
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 932021f872d5..6c9873f88287 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -35,9 +35,13 @@
35#endif 35#endif
36 36
37#define KPROBE_ENTRY(name) \ 37#define KPROBE_ENTRY(name) \
38 .section .kprobes.text, "ax"; \ 38 .pushsection .kprobes.text, "ax"; \
39 ENTRY(name) 39 ENTRY(name)
40 40
41#define KPROBE_END(name) \
42 END(name); \
43 .popsection
44
41#ifndef END 45#ifndef END
42#define END(name) \ 46#define END(name) \
43 .size name, .-name 47 .size name, .-name
diff --git a/include/linux/list.h b/include/linux/list.h
index a02642e4710a..a9c90287c0ff 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -4,18 +4,11 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7#include <linux/poison.h>
7#include <linux/prefetch.h> 8#include <linux/prefetch.h>
8#include <asm/system.h> 9#include <asm/system.h>
9 10
10/* 11/*
11 * These are non-NULL pointers that will result in page faults
12 * under normal circumstances, used to verify that nobody uses
13 * non-initialized list entries.
14 */
15#define LIST_POISON1 ((void *) 0x00100100)
16#define LIST_POISON2 ((void *) 0x00200200)
17
18/*
19 * Simple doubly linked list implementation. 12 * Simple doubly linked list implementation.
20 * 13 *
21 * Some of the internal functions ("__xxx") are useful when 14 * Some of the internal functions ("__xxx") are useful when
@@ -46,6 +39,7 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
46 * This is only for internal list manipulation where we know 39 * This is only for internal list manipulation where we know
47 * the prev/next entries already! 40 * the prev/next entries already!
48 */ 41 */
42#ifndef CONFIG_DEBUG_LIST
49static inline void __list_add(struct list_head *new, 43static inline void __list_add(struct list_head *new,
50 struct list_head *prev, 44 struct list_head *prev,
51 struct list_head *next) 45 struct list_head *next)
@@ -55,6 +49,11 @@ static inline void __list_add(struct list_head *new,
55 new->prev = prev; 49 new->prev = prev;
56 prev->next = new; 50 prev->next = new;
57} 51}
52#else
53extern void __list_add(struct list_head *new,
54 struct list_head *prev,
55 struct list_head *next);
56#endif
58 57
59/** 58/**
60 * list_add - add a new entry 59 * list_add - add a new entry
@@ -64,10 +63,15 @@ static inline void __list_add(struct list_head *new,
64 * Insert a new entry after the specified head. 63 * Insert a new entry after the specified head.
65 * This is good for implementing stacks. 64 * This is good for implementing stacks.
66 */ 65 */
66#ifndef CONFIG_DEBUG_LIST
67static inline void list_add(struct list_head *new, struct list_head *head) 67static inline void list_add(struct list_head *new, struct list_head *head)
68{ 68{
69 __list_add(new, head, head->next); 69 __list_add(new, head, head->next);
70} 70}
71#else
72extern void list_add(struct list_head *new, struct list_head *head);
73#endif
74
71 75
72/** 76/**
73 * list_add_tail - add a new entry 77 * list_add_tail - add a new entry
@@ -160,12 +164,16 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
160 * Note: list_empty on entry does not return true after this, the entry is 164 * Note: list_empty on entry does not return true after this, the entry is
161 * in an undefined state. 165 * in an undefined state.
162 */ 166 */
167#ifndef CONFIG_DEBUG_LIST
163static inline void list_del(struct list_head *entry) 168static inline void list_del(struct list_head *entry)
164{ 169{
165 __list_del(entry->prev, entry->next); 170 __list_del(entry->prev, entry->next);
166 entry->next = LIST_POISON1; 171 entry->next = LIST_POISON1;
167 entry->prev = LIST_POISON2; 172 entry->prev = LIST_POISON2;
168} 173}
174#else
175extern void list_del(struct list_head *entry);
176#endif
169 177
170/** 178/**
171 * list_del_rcu - deletes entry from list without re-initialization 179 * list_del_rcu - deletes entry from list without re-initialization
@@ -272,6 +280,17 @@ static inline void list_move_tail(struct list_head *list,
272} 280}
273 281
274/** 282/**
283 * list_is_last - tests whether @list is the last entry in list @head
284 * @list: the entry to test
285 * @head: the head of the list
286 */
287static inline int list_is_last(const struct list_head *list,
288 const struct list_head *head)
289{
290 return list->next == head;
291}
292
293/**
275 * list_empty - tests whether a list is empty 294 * list_empty - tests whether a list is empty
276 * @head: the list to test. 295 * @head: the list to test.
277 */ 296 */
@@ -281,16 +300,17 @@ static inline int list_empty(const struct list_head *head)
281} 300}
282 301
283/** 302/**
284 * list_empty_careful - tests whether a list is 303 * list_empty_careful - tests whether a list is empty and not being modified
285 * empty _and_ checks that no other CPU might be 304 * @head: the list to test
286 * in the process of still modifying either member 305 *
306 * Description:
307 * tests whether a list is empty _and_ checks that no other CPU might be
308 * in the process of modifying either member (next or prev)
287 * 309 *
288 * NOTE: using list_empty_careful() without synchronization 310 * NOTE: using list_empty_careful() without synchronization
289 * can only be safe if the only activity that can happen 311 * can only be safe if the only activity that can happen
290 * to the list entry is list_del_init(). Eg. it cannot be used 312 * to the list entry is list_del_init(). Eg. it cannot be used
291 * if another CPU could re-list_add() it. 313 * if another CPU could re-list_add() it.
292 *
293 * @head: the list to test.
294 */ 314 */
295static inline int list_empty_careful(const struct list_head *head) 315static inline int list_empty_careful(const struct list_head *head)
296{ 316{
@@ -350,7 +370,7 @@ static inline void list_splice_init(struct list_head *list,
350 370
351/** 371/**
352 * list_for_each - iterate over a list 372 * list_for_each - iterate over a list
353 * @pos: the &struct list_head to use as a loop counter. 373 * @pos: the &struct list_head to use as a loop cursor.
354 * @head: the head for your list. 374 * @head: the head for your list.
355 */ 375 */
356#define list_for_each(pos, head) \ 376#define list_for_each(pos, head) \
@@ -359,7 +379,7 @@ static inline void list_splice_init(struct list_head *list,
359 379
360/** 380/**
361 * __list_for_each - iterate over a list 381 * __list_for_each - iterate over a list
362 * @pos: the &struct list_head to use as a loop counter. 382 * @pos: the &struct list_head to use as a loop cursor.
363 * @head: the head for your list. 383 * @head: the head for your list.
364 * 384 *
365 * This variant differs from list_for_each() in that it's the 385 * This variant differs from list_for_each() in that it's the
@@ -372,7 +392,7 @@ static inline void list_splice_init(struct list_head *list,
372 392
373/** 393/**
374 * list_for_each_prev - iterate over a list backwards 394 * list_for_each_prev - iterate over a list backwards
375 * @pos: the &struct list_head to use as a loop counter. 395 * @pos: the &struct list_head to use as a loop cursor.
376 * @head: the head for your list. 396 * @head: the head for your list.
377 */ 397 */
378#define list_for_each_prev(pos, head) \ 398#define list_for_each_prev(pos, head) \
@@ -380,8 +400,8 @@ static inline void list_splice_init(struct list_head *list,
380 pos = pos->prev) 400 pos = pos->prev)
381 401
382/** 402/**
383 * list_for_each_safe - iterate over a list safe against removal of list entry 403 * list_for_each_safe - iterate over a list safe against removal of list entry
384 * @pos: the &struct list_head to use as a loop counter. 404 * @pos: the &struct list_head to use as a loop cursor.
385 * @n: another &struct list_head to use as temporary storage 405 * @n: another &struct list_head to use as temporary storage
386 * @head: the head for your list. 406 * @head: the head for your list.
387 */ 407 */
@@ -391,7 +411,7 @@ static inline void list_splice_init(struct list_head *list,
391 411
392/** 412/**
393 * list_for_each_entry - iterate over list of given type 413 * list_for_each_entry - iterate over list of given type
394 * @pos: the type * to use as a loop counter. 414 * @pos: the type * to use as a loop cursor.
395 * @head: the head for your list. 415 * @head: the head for your list.
396 * @member: the name of the list_struct within the struct. 416 * @member: the name of the list_struct within the struct.
397 */ 417 */
@@ -402,7 +422,7 @@ static inline void list_splice_init(struct list_head *list,
402 422
403/** 423/**
404 * list_for_each_entry_reverse - iterate backwards over list of given type. 424 * list_for_each_entry_reverse - iterate backwards over list of given type.
405 * @pos: the type * to use as a loop counter. 425 * @pos: the type * to use as a loop cursor.
406 * @head: the head for your list. 426 * @head: the head for your list.
407 * @member: the name of the list_struct within the struct. 427 * @member: the name of the list_struct within the struct.
408 */ 428 */
@@ -412,21 +432,24 @@ static inline void list_splice_init(struct list_head *list,
412 pos = list_entry(pos->member.prev, typeof(*pos), member)) 432 pos = list_entry(pos->member.prev, typeof(*pos), member))
413 433
414/** 434/**
415 * list_prepare_entry - prepare a pos entry for use as a start point in 435 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue
416 * list_for_each_entry_continue
417 * @pos: the type * to use as a start point 436 * @pos: the type * to use as a start point
418 * @head: the head of the list 437 * @head: the head of the list
419 * @member: the name of the list_struct within the struct. 438 * @member: the name of the list_struct within the struct.
439 *
440 * Prepares a pos entry for use as a start point in list_for_each_entry_continue.
420 */ 441 */
421#define list_prepare_entry(pos, head, member) \ 442#define list_prepare_entry(pos, head, member) \
422 ((pos) ? : list_entry(head, typeof(*pos), member)) 443 ((pos) ? : list_entry(head, typeof(*pos), member))
423 444
424/** 445/**
425 * list_for_each_entry_continue - iterate over list of given type 446 * list_for_each_entry_continue - continue iteration over list of given type
426 * continuing after existing point 447 * @pos: the type * to use as a loop cursor.
427 * @pos: the type * to use as a loop counter.
428 * @head: the head for your list. 448 * @head: the head for your list.
429 * @member: the name of the list_struct within the struct. 449 * @member: the name of the list_struct within the struct.
450 *
451 * Continue to iterate over list of given type, continuing after
452 * the current position.
430 */ 453 */
431#define list_for_each_entry_continue(pos, head, member) \ 454#define list_for_each_entry_continue(pos, head, member) \
432 for (pos = list_entry(pos->member.next, typeof(*pos), member); \ 455 for (pos = list_entry(pos->member.next, typeof(*pos), member); \
@@ -434,11 +457,12 @@ static inline void list_splice_init(struct list_head *list,
434 pos = list_entry(pos->member.next, typeof(*pos), member)) 457 pos = list_entry(pos->member.next, typeof(*pos), member))
435 458
436/** 459/**
437 * list_for_each_entry_from - iterate over list of given type 460 * list_for_each_entry_from - iterate over list of given type from the current point
438 * continuing from existing point 461 * @pos: the type * to use as a loop cursor.
439 * @pos: the type * to use as a loop counter.
440 * @head: the head for your list. 462 * @head: the head for your list.
441 * @member: the name of the list_struct within the struct. 463 * @member: the name of the list_struct within the struct.
464 *
465 * Iterate over list of given type, continuing from current position.
442 */ 466 */
443#define list_for_each_entry_from(pos, head, member) \ 467#define list_for_each_entry_from(pos, head, member) \
444 for (; prefetch(pos->member.next), &pos->member != (head); \ 468 for (; prefetch(pos->member.next), &pos->member != (head); \
@@ -446,7 +470,7 @@ static inline void list_splice_init(struct list_head *list,
446 470
447/** 471/**
448 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry 472 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
449 * @pos: the type * to use as a loop counter. 473 * @pos: the type * to use as a loop cursor.
450 * @n: another type * to use as temporary storage 474 * @n: another type * to use as temporary storage
451 * @head: the head for your list. 475 * @head: the head for your list.
452 * @member: the name of the list_struct within the struct. 476 * @member: the name of the list_struct within the struct.
@@ -458,12 +482,14 @@ static inline void list_splice_init(struct list_head *list,
458 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 482 pos = n, n = list_entry(n->member.next, typeof(*n), member))
459 483
460/** 484/**
461 * list_for_each_entry_safe_continue - iterate over list of given type 485 * list_for_each_entry_safe_continue
462 * continuing after existing point safe against removal of list entry 486 * @pos: the type * to use as a loop cursor.
463 * @pos: the type * to use as a loop counter.
464 * @n: another type * to use as temporary storage 487 * @n: another type * to use as temporary storage
465 * @head: the head for your list. 488 * @head: the head for your list.
466 * @member: the name of the list_struct within the struct. 489 * @member: the name of the list_struct within the struct.
490 *
491 * Iterate over list of given type, continuing after current point,
492 * safe against removal of list entry.
467 */ 493 */
468#define list_for_each_entry_safe_continue(pos, n, head, member) \ 494#define list_for_each_entry_safe_continue(pos, n, head, member) \
469 for (pos = list_entry(pos->member.next, typeof(*pos), member), \ 495 for (pos = list_entry(pos->member.next, typeof(*pos), member), \
@@ -472,12 +498,14 @@ static inline void list_splice_init(struct list_head *list,
472 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 498 pos = n, n = list_entry(n->member.next, typeof(*n), member))
473 499
474/** 500/**
475 * list_for_each_entry_safe_from - iterate over list of given type 501 * list_for_each_entry_safe_from
476 * from existing point safe against removal of list entry 502 * @pos: the type * to use as a loop cursor.
477 * @pos: the type * to use as a loop counter.
478 * @n: another type * to use as temporary storage 503 * @n: another type * to use as temporary storage
479 * @head: the head for your list. 504 * @head: the head for your list.
480 * @member: the name of the list_struct within the struct. 505 * @member: the name of the list_struct within the struct.
506 *
507 * Iterate over list of given type from current point, safe against
508 * removal of list entry.
481 */ 509 */
482#define list_for_each_entry_safe_from(pos, n, head, member) \ 510#define list_for_each_entry_safe_from(pos, n, head, member) \
483 for (n = list_entry(pos->member.next, typeof(*pos), member); \ 511 for (n = list_entry(pos->member.next, typeof(*pos), member); \
@@ -485,12 +513,14 @@ static inline void list_splice_init(struct list_head *list,
485 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 513 pos = n, n = list_entry(n->member.next, typeof(*n), member))
486 514
487/** 515/**
488 * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against 516 * list_for_each_entry_safe_reverse
489 * removal of list entry 517 * @pos: the type * to use as a loop cursor.
490 * @pos: the type * to use as a loop counter.
491 * @n: another type * to use as temporary storage 518 * @n: another type * to use as temporary storage
492 * @head: the head for your list. 519 * @head: the head for your list.
493 * @member: the name of the list_struct within the struct. 520 * @member: the name of the list_struct within the struct.
521 *
522 * Iterate backwards over list of given type, safe against removal
523 * of list entry.
494 */ 524 */
495#define list_for_each_entry_safe_reverse(pos, n, head, member) \ 525#define list_for_each_entry_safe_reverse(pos, n, head, member) \
496 for (pos = list_entry((head)->prev, typeof(*pos), member), \ 526 for (pos = list_entry((head)->prev, typeof(*pos), member), \
@@ -500,7 +530,7 @@ static inline void list_splice_init(struct list_head *list,
500 530
501/** 531/**
502 * list_for_each_rcu - iterate over an rcu-protected list 532 * list_for_each_rcu - iterate over an rcu-protected list
503 * @pos: the &struct list_head to use as a loop counter. 533 * @pos: the &struct list_head to use as a loop cursor.
504 * @head: the head for your list. 534 * @head: the head for your list.
505 * 535 *
506 * This list-traversal primitive may safely run concurrently with 536 * This list-traversal primitive may safely run concurrently with
@@ -518,12 +548,13 @@ static inline void list_splice_init(struct list_head *list,
518 pos = pos->next) 548 pos = pos->next)
519 549
520/** 550/**
521 * list_for_each_safe_rcu - iterate over an rcu-protected list safe 551 * list_for_each_safe_rcu
522 * against removal of list entry 552 * @pos: the &struct list_head to use as a loop cursor.
523 * @pos: the &struct list_head to use as a loop counter.
524 * @n: another &struct list_head to use as temporary storage 553 * @n: another &struct list_head to use as temporary storage
525 * @head: the head for your list. 554 * @head: the head for your list.
526 * 555 *
556 * Iterate over an rcu-protected list, safe against removal of list entry.
557 *
527 * This list-traversal primitive may safely run concurrently with 558 * This list-traversal primitive may safely run concurrently with
528 * the _rcu list-mutation primitives such as list_add_rcu() 559 * the _rcu list-mutation primitives such as list_add_rcu()
529 * as long as the traversal is guarded by rcu_read_lock(). 560 * as long as the traversal is guarded by rcu_read_lock().
@@ -535,7 +566,7 @@ static inline void list_splice_init(struct list_head *list,
535 566
536/** 567/**
537 * list_for_each_entry_rcu - iterate over rcu list of given type 568 * list_for_each_entry_rcu - iterate over rcu list of given type
538 * @pos: the type * to use as a loop counter. 569 * @pos: the type * to use as a loop cursor.
539 * @head: the head for your list. 570 * @head: the head for your list.
540 * @member: the name of the list_struct within the struct. 571 * @member: the name of the list_struct within the struct.
541 * 572 *
@@ -551,11 +582,12 @@ static inline void list_splice_init(struct list_head *list,
551 582
552 583
553/** 584/**
554 * list_for_each_continue_rcu - iterate over an rcu-protected list 585 * list_for_each_continue_rcu
555 * continuing after existing point. 586 * @pos: the &struct list_head to use as a loop cursor.
556 * @pos: the &struct list_head to use as a loop counter.
557 * @head: the head for your list. 587 * @head: the head for your list.
558 * 588 *
589 * Iterate over an rcu-protected list, continuing after current point.
590 *
559 * This list-traversal primitive may safely run concurrently with 591 * This list-traversal primitive may safely run concurrently with
560 * the _rcu list-mutation primitives such as list_add_rcu() 592 * the _rcu list-mutation primitives such as list_add_rcu()
561 * as long as the traversal is guarded by rcu_read_lock(). 593 * as long as the traversal is guarded by rcu_read_lock().
@@ -681,11 +713,14 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
681 713
682 714
683/** 715/**
684 * hlist_add_head_rcu - adds the specified element to the specified hlist, 716 * hlist_add_head_rcu
685 * while permitting racing traversals.
686 * @n: the element to add to the hash list. 717 * @n: the element to add to the hash list.
687 * @h: the list to add to. 718 * @h: the list to add to.
688 * 719 *
720 * Description:
721 * Adds the specified element to the specified hlist,
722 * while permitting racing traversals.
723 *
689 * The caller must take whatever precautions are necessary 724 * The caller must take whatever precautions are necessary
690 * (such as holding appropriate locks) to avoid racing 725 * (such as holding appropriate locks) to avoid racing
691 * with another list-mutation primitive, such as hlist_add_head_rcu() 726 * with another list-mutation primitive, such as hlist_add_head_rcu()
@@ -730,11 +765,14 @@ static inline void hlist_add_after(struct hlist_node *n,
730} 765}
731 766
732/** 767/**
733 * hlist_add_before_rcu - adds the specified element to the specified hlist 768 * hlist_add_before_rcu
734 * before the specified node while permitting racing traversals.
735 * @n: the new element to add to the hash list. 769 * @n: the new element to add to the hash list.
736 * @next: the existing element to add the new element before. 770 * @next: the existing element to add the new element before.
737 * 771 *
772 * Description:
773 * Adds the specified element to the specified hlist
774 * before the specified node while permitting racing traversals.
775 *
738 * The caller must take whatever precautions are necessary 776 * The caller must take whatever precautions are necessary
739 * (such as holding appropriate locks) to avoid racing 777 * (such as holding appropriate locks) to avoid racing
740 * with another list-mutation primitive, such as hlist_add_head_rcu() 778 * with another list-mutation primitive, such as hlist_add_head_rcu()
@@ -755,11 +793,14 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
755} 793}
756 794
757/** 795/**
758 * hlist_add_after_rcu - adds the specified element to the specified hlist 796 * hlist_add_after_rcu
759 * after the specified node while permitting racing traversals.
760 * @prev: the existing element to add the new element after. 797 * @prev: the existing element to add the new element after.
761 * @n: the new element to add to the hash list. 798 * @n: the new element to add to the hash list.
762 * 799 *
800 * Description:
801 * Adds the specified element to the specified hlist
802 * after the specified node while permitting racing traversals.
803 *
763 * The caller must take whatever precautions are necessary 804 * The caller must take whatever precautions are necessary
764 * (such as holding appropriate locks) to avoid racing 805 * (such as holding appropriate locks) to avoid racing
765 * with another list-mutation primitive, such as hlist_add_head_rcu() 806 * with another list-mutation primitive, such as hlist_add_head_rcu()
@@ -792,8 +833,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
792 833
793/** 834/**
794 * hlist_for_each_entry - iterate over list of given type 835 * hlist_for_each_entry - iterate over list of given type
795 * @tpos: the type * to use as a loop counter. 836 * @tpos: the type * to use as a loop cursor.
796 * @pos: the &struct hlist_node to use as a loop counter. 837 * @pos: the &struct hlist_node to use as a loop cursor.
797 * @head: the head for your list. 838 * @head: the head for your list.
798 * @member: the name of the hlist_node within the struct. 839 * @member: the name of the hlist_node within the struct.
799 */ 840 */
@@ -804,9 +845,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
804 pos = pos->next) 845 pos = pos->next)
805 846
806/** 847/**
807 * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point 848 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
808 * @tpos: the type * to use as a loop counter. 849 * @tpos: the type * to use as a loop cursor.
809 * @pos: the &struct hlist_node to use as a loop counter. 850 * @pos: the &struct hlist_node to use as a loop cursor.
810 * @member: the name of the hlist_node within the struct. 851 * @member: the name of the hlist_node within the struct.
811 */ 852 */
812#define hlist_for_each_entry_continue(tpos, pos, member) \ 853#define hlist_for_each_entry_continue(tpos, pos, member) \
@@ -816,9 +857,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
816 pos = pos->next) 857 pos = pos->next)
817 858
818/** 859/**
819 * hlist_for_each_entry_from - iterate over a hlist continuing from existing point 860 * hlist_for_each_entry_from - iterate over a hlist continuing from current point
820 * @tpos: the type * to use as a loop counter. 861 * @tpos: the type * to use as a loop cursor.
821 * @pos: the &struct hlist_node to use as a loop counter. 862 * @pos: the &struct hlist_node to use as a loop cursor.
822 * @member: the name of the hlist_node within the struct. 863 * @member: the name of the hlist_node within the struct.
823 */ 864 */
824#define hlist_for_each_entry_from(tpos, pos, member) \ 865#define hlist_for_each_entry_from(tpos, pos, member) \
@@ -828,8 +869,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
828 869
829/** 870/**
830 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry 871 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
831 * @tpos: the type * to use as a loop counter. 872 * @tpos: the type * to use as a loop cursor.
832 * @pos: the &struct hlist_node to use as a loop counter. 873 * @pos: the &struct hlist_node to use as a loop cursor.
833 * @n: another &struct hlist_node to use as temporary storage 874 * @n: another &struct hlist_node to use as temporary storage
834 * @head: the head for your list. 875 * @head: the head for your list.
835 * @member: the name of the hlist_node within the struct. 876 * @member: the name of the hlist_node within the struct.
@@ -842,8 +883,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
842 883
843/** 884/**
844 * hlist_for_each_entry_rcu - iterate over rcu list of given type 885 * hlist_for_each_entry_rcu - iterate over rcu list of given type
845 * @tpos: the type * to use as a loop counter. 886 * @tpos: the type * to use as a loop cursor.
846 * @pos: the &struct hlist_node to use as a loop counter. 887 * @pos: the &struct hlist_node to use as a loop cursor.
847 * @head: the head for your list. 888 * @head: the head for your list.
848 * @member: the name of the hlist_node within the struct. 889 * @member: the name of the hlist_node within the struct.
849 * 890 *
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index a8876bc6513b..0d92c468d55a 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -49,11 +49,12 @@ struct nlm_host {
49 h_killed : 1, 49 h_killed : 1,
50 h_monitored : 1; 50 h_monitored : 1;
51 wait_queue_head_t h_gracewait; /* wait while reclaiming */ 51 wait_queue_head_t h_gracewait; /* wait while reclaiming */
52 struct rw_semaphore h_rwsem; /* Reboot recovery lock */
52 u32 h_state; /* pseudo-state counter */ 53 u32 h_state; /* pseudo-state counter */
53 u32 h_nsmstate; /* true remote NSM state */ 54 u32 h_nsmstate; /* true remote NSM state */
54 u32 h_pidcount; /* Pseudopids */ 55 u32 h_pidcount; /* Pseudopids */
55 atomic_t h_count; /* reference count */ 56 atomic_t h_count; /* reference count */
56 struct semaphore h_sema; /* mutex for pmap binding */ 57 struct mutex h_mutex; /* mutex for pmap binding */
57 unsigned long h_nextrebind; /* next portmap call */ 58 unsigned long h_nextrebind; /* next portmap call */
58 unsigned long h_expires; /* eligible for GC */ 59 unsigned long h_expires; /* eligible for GC */
59 struct list_head h_lockowners; /* Lockowners for the client */ 60 struct list_head h_lockowners; /* Lockowners for the client */
@@ -122,7 +123,6 @@ struct nlm_block {
122 unsigned int b_id; /* block id */ 123 unsigned int b_id; /* block id */
123 unsigned char b_queued; /* re-queued */ 124 unsigned char b_queued; /* re-queued */
124 unsigned char b_granted; /* VFS granted lock */ 125 unsigned char b_granted; /* VFS granted lock */
125 unsigned char b_done; /* callback complete */
126 struct nlm_file * b_file; /* file in question */ 126 struct nlm_file * b_file; /* file in question */
127}; 127};
128 128
@@ -219,6 +219,7 @@ static __inline__ int
219nlm_compare_locks(const struct file_lock *fl1, const struct file_lock *fl2) 219nlm_compare_locks(const struct file_lock *fl1, const struct file_lock *fl2)
220{ 220{
221 return fl1->fl_pid == fl2->fl_pid 221 return fl1->fl_pid == fl2->fl_pid
222 && fl1->fl_owner == fl2->fl_owner
222 && fl1->fl_start == fl2->fl_start 223 && fl1->fl_start == fl2->fl_start
223 && fl1->fl_end == fl2->fl_end 224 && fl1->fl_end == fl2->fl_end
224 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK); 225 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK);
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
new file mode 100644
index 000000000000..1314ca0f29be
--- /dev/null
+++ b/include/linux/lockdep.h
@@ -0,0 +1,353 @@
1/*
2 * Runtime locking correctness validator
3 *
4 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
5 *
6 * see Documentation/lockdep-design.txt for more details.
7 */
8#ifndef __LINUX_LOCKDEP_H
9#define __LINUX_LOCKDEP_H
10
11#ifdef CONFIG_LOCKDEP
12
13#include <linux/linkage.h>
14#include <linux/list.h>
15#include <linux/debug_locks.h>
16#include <linux/stacktrace.h>
17
18/*
19 * Lock-class usage-state bits:
20 */
21enum lock_usage_bit
22{
23 LOCK_USED = 0,
24 LOCK_USED_IN_HARDIRQ,
25 LOCK_USED_IN_SOFTIRQ,
26 LOCK_ENABLED_SOFTIRQS,
27 LOCK_ENABLED_HARDIRQS,
28 LOCK_USED_IN_HARDIRQ_READ,
29 LOCK_USED_IN_SOFTIRQ_READ,
30 LOCK_ENABLED_SOFTIRQS_READ,
31 LOCK_ENABLED_HARDIRQS_READ,
32 LOCK_USAGE_STATES
33};
34
35/*
36 * Usage-state bitmasks:
37 */
38#define LOCKF_USED (1 << LOCK_USED)
39#define LOCKF_USED_IN_HARDIRQ (1 << LOCK_USED_IN_HARDIRQ)
40#define LOCKF_USED_IN_SOFTIRQ (1 << LOCK_USED_IN_SOFTIRQ)
41#define LOCKF_ENABLED_HARDIRQS (1 << LOCK_ENABLED_HARDIRQS)
42#define LOCKF_ENABLED_SOFTIRQS (1 << LOCK_ENABLED_SOFTIRQS)
43
44#define LOCKF_ENABLED_IRQS (LOCKF_ENABLED_HARDIRQS | LOCKF_ENABLED_SOFTIRQS)
45#define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ)
46
47#define LOCKF_USED_IN_HARDIRQ_READ (1 << LOCK_USED_IN_HARDIRQ_READ)
48#define LOCKF_USED_IN_SOFTIRQ_READ (1 << LOCK_USED_IN_SOFTIRQ_READ)
49#define LOCKF_ENABLED_HARDIRQS_READ (1 << LOCK_ENABLED_HARDIRQS_READ)
50#define LOCKF_ENABLED_SOFTIRQS_READ (1 << LOCK_ENABLED_SOFTIRQS_READ)
51
52#define LOCKF_ENABLED_IRQS_READ \
53 (LOCKF_ENABLED_HARDIRQS_READ | LOCKF_ENABLED_SOFTIRQS_READ)
54#define LOCKF_USED_IN_IRQ_READ \
55 (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ)
56
57#define MAX_LOCKDEP_SUBCLASSES 8UL
58
59/*
60 * Lock-classes are keyed via unique addresses, by embedding the
61 * lockclass-key into the kernel (or module) .data section. (For
62 * static locks we use the lock address itself as the key.)
63 */
64struct lockdep_subclass_key {
65 char __one_byte;
66} __attribute__ ((__packed__));
67
68struct lock_class_key {
69 struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES];
70};
71
72/*
73 * The lock-class itself:
74 */
75struct lock_class {
76 /*
77 * class-hash:
78 */
79 struct list_head hash_entry;
80
81 /*
82 * global list of all lock-classes:
83 */
84 struct list_head lock_entry;
85
86 struct lockdep_subclass_key *key;
87 unsigned int subclass;
88
89 /*
90 * IRQ/softirq usage tracking bits:
91 */
92 unsigned long usage_mask;
93 struct stack_trace usage_traces[LOCK_USAGE_STATES];
94
95 /*
96 * These fields represent a directed graph of lock dependencies,
97 * to every node we attach a list of "forward" and a list of
98 * "backward" graph nodes.
99 */
100 struct list_head locks_after, locks_before;
101
102 /*
103 * Generation counter, when doing certain classes of graph walking,
104 * to ensure that we check one node only once:
105 */
106 unsigned int version;
107
108 /*
109 * Statistics counter:
110 */
111 unsigned long ops;
112
113 const char *name;
114 int name_version;
115};
116
117/*
118 * Map the lock object (the lock instance) to the lock-class object.
119 * This is embedded into specific lock instances:
120 */
121struct lockdep_map {
122 struct lock_class_key *key;
123 struct lock_class *class_cache;
124 const char *name;
125};
126
127/*
128 * Every lock has a list of other locks that were taken after it.
129 * We only grow the list, never remove from it:
130 */
131struct lock_list {
132 struct list_head entry;
133 struct lock_class *class;
134 struct stack_trace trace;
135};
136
137/*
138 * We record lock dependency chains, so that we can cache them:
139 */
140struct lock_chain {
141 struct list_head entry;
142 u64 chain_key;
143};
144
145struct held_lock {
146 /*
147 * One-way hash of the dependency chain up to this point. We
148 * hash the hashes step by step as the dependency chain grows.
149 *
150 * We use it for dependency-caching and we skip detection
151 * passes and dependency-updates if there is a cache-hit, so
152 * it is absolutely critical for 100% coverage of the validator
153 * to have a unique key value for every unique dependency path
154 * that can occur in the system, to make a unique hash value
155 * as likely as possible - hence the 64-bit width.
156 *
157 * The task struct holds the current hash value (initialized
158 * with zero), here we store the previous hash value:
159 */
160 u64 prev_chain_key;
161 struct lock_class *class;
162 unsigned long acquire_ip;
163 struct lockdep_map *instance;
164
165 /*
166 * The lock-stack is unified in that the lock chains of interrupt
167 * contexts nest ontop of process context chains, but we 'separate'
168 * the hashes by starting with 0 if we cross into an interrupt
169 * context, and we also keep do not add cross-context lock
170 * dependencies - the lock usage graph walking covers that area
171 * anyway, and we'd just unnecessarily increase the number of
172 * dependencies otherwise. [Note: hardirq and softirq contexts
173 * are separated from each other too.]
174 *
175 * The following field is used to detect when we cross into an
176 * interrupt context:
177 */
178 int irq_context;
179 int trylock;
180 int read;
181 int check;
182 int hardirqs_off;
183};
184
185/*
186 * Initialization, self-test and debugging-output methods:
187 */
188extern void lockdep_init(void);
189extern void lockdep_info(void);
190extern void lockdep_reset(void);
191extern void lockdep_reset_lock(struct lockdep_map *lock);
192extern void lockdep_free_key_range(void *start, unsigned long size);
193
194extern void lockdep_off(void);
195extern void lockdep_on(void);
196extern int lockdep_internal(void);
197
198/*
199 * These methods are used by specific locking variants (spinlocks,
200 * rwlocks, mutexes and rwsems) to pass init/acquire/release events
201 * to lockdep:
202 */
203
204extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
205 struct lock_class_key *key);
206
207/*
208 * Reinitialize a lock key - for cases where there is special locking or
209 * special initialization of locks so that the validator gets the scope
210 * of dependencies wrong: they are either too broad (they need a class-split)
211 * or they are too narrow (they suffer from a false class-split):
212 */
213#define lockdep_set_class(lock, key) \
214 lockdep_init_map(&(lock)->dep_map, #key, key)
215#define lockdep_set_class_and_name(lock, key, name) \
216 lockdep_init_map(&(lock)->dep_map, name, key)
217
218/*
219 * Acquire a lock.
220 *
221 * Values for "read":
222 *
223 * 0: exclusive (write) acquire
224 * 1: read-acquire (no recursion allowed)
225 * 2: read-acquire with same-instance recursion allowed
226 *
227 * Values for check:
228 *
229 * 0: disabled
230 * 1: simple checks (freeing, held-at-exit-time, etc.)
231 * 2: full validation
232 */
233extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
234 int trylock, int read, int check, unsigned long ip);
235
236extern void lock_release(struct lockdep_map *lock, int nested,
237 unsigned long ip);
238
239# define INIT_LOCKDEP .lockdep_recursion = 0,
240
241#else /* !LOCKDEP */
242
243static inline void lockdep_off(void)
244{
245}
246
247static inline void lockdep_on(void)
248{
249}
250
251static inline int lockdep_internal(void)
252{
253 return 0;
254}
255
256# define lock_acquire(l, s, t, r, c, i) do { } while (0)
257# define lock_release(l, n, i) do { } while (0)
258# define lockdep_init() do { } while (0)
259# define lockdep_info() do { } while (0)
260# define lockdep_init_map(lock, name, key) do { (void)(key); } while (0)
261# define lockdep_set_class(lock, key) do { (void)(key); } while (0)
262# define lockdep_set_class_and_name(lock, key, name) \
263 do { (void)(key); } while (0)
264# define INIT_LOCKDEP
265# define lockdep_reset() do { debug_locks = 1; } while (0)
266# define lockdep_free_key_range(start, size) do { } while (0)
267/*
268 * The class key takes no space if lockdep is disabled:
269 */
270struct lock_class_key { };
271#endif /* !LOCKDEP */
272
273#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS)
274extern void early_init_irq_lock_class(void);
275#else
276# define early_init_irq_lock_class() do { } while (0)
277#endif
278
279#ifdef CONFIG_TRACE_IRQFLAGS
280extern void early_boot_irqs_off(void);
281extern void early_boot_irqs_on(void);
282#else
283# define early_boot_irqs_off() do { } while (0)
284# define early_boot_irqs_on() do { } while (0)
285#endif
286
287/*
288 * For trivial one-depth nesting of a lock-class, the following
289 * global define can be used. (Subsystems with multiple levels
290 * of nesting should define their own lock-nesting subclasses.)
291 */
292#define SINGLE_DEPTH_NESTING 1
293
294/*
295 * Map the dependency ops to NOP or to real lockdep ops, depending
296 * on the per lock-class debug mode:
297 */
298
299#ifdef CONFIG_DEBUG_LOCK_ALLOC
300# ifdef CONFIG_PROVE_LOCKING
301# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i)
302# else
303# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i)
304# endif
305# define spin_release(l, n, i) lock_release(l, n, i)
306#else
307# define spin_acquire(l, s, t, i) do { } while (0)
308# define spin_release(l, n, i) do { } while (0)
309#endif
310
311#ifdef CONFIG_DEBUG_LOCK_ALLOC
312# ifdef CONFIG_PROVE_LOCKING
313# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i)
314# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 2, i)
315# else
316# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i)
317# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 1, i)
318# endif
319# define rwlock_release(l, n, i) lock_release(l, n, i)
320#else
321# define rwlock_acquire(l, s, t, i) do { } while (0)
322# define rwlock_acquire_read(l, s, t, i) do { } while (0)
323# define rwlock_release(l, n, i) do { } while (0)
324#endif
325
326#ifdef CONFIG_DEBUG_LOCK_ALLOC
327# ifdef CONFIG_PROVE_LOCKING
328# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i)
329# else
330# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i)
331# endif
332# define mutex_release(l, n, i) lock_release(l, n, i)
333#else
334# define mutex_acquire(l, s, t, i) do { } while (0)
335# define mutex_release(l, n, i) do { } while (0)
336#endif
337
338#ifdef CONFIG_DEBUG_LOCK_ALLOC
339# ifdef CONFIG_PROVE_LOCKING
340# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i)
341# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, i)
342# else
343# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i)
344# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, i)
345# endif
346# define rwsem_release(l, n, i) lock_release(l, n, i)
347#else
348# define rwsem_acquire(l, s, t, i) do { } while (0)
349# define rwsem_acquire_read(l, s, t, i) do { } while (0)
350# define rwsem_release(l, n, i) do { } while (0)
351#endif
352
353#endif /* __LINUX_LOCKDEP_H */
diff --git a/include/linux/loop.h b/include/linux/loop.h
index e76c7611d6cc..191a595055f0 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -59,10 +59,9 @@ struct loop_device {
59 struct bio *lo_bio; 59 struct bio *lo_bio;
60 struct bio *lo_biotail; 60 struct bio *lo_biotail;
61 int lo_state; 61 int lo_state;
62 struct completion lo_done;
63 struct completion lo_bh_done;
64 struct mutex lo_ctl_mutex; 62 struct mutex lo_ctl_mutex;
65 int lo_pending; 63 struct task_struct *lo_thread;
64 wait_queue_head_t lo_event;
66 65
67 request_queue_t *lo_queue; 66 request_queue_t *lo_queue;
68}; 67};
diff --git a/include/linux/magic.h b/include/linux/magic.h
new file mode 100644
index 000000000000..22036dd2ba36
--- /dev/null
+++ b/include/linux/magic.h
@@ -0,0 +1,37 @@
1#ifndef __LINUX_MAGIC_H__
2#define __LINUX_MAGIC_H__
3
4#define ADFS_SUPER_MAGIC 0xadf5
5#define AFFS_SUPER_MAGIC 0xadff
6#define AUTOFS_SUPER_MAGIC 0x0187
7#define CODA_SUPER_MAGIC 0x73757245
8#define EFS_SUPER_MAGIC 0x414A53
9#define EXT2_SUPER_MAGIC 0xEF53
10#define EXT3_SUPER_MAGIC 0xEF53
11#define HPFS_SUPER_MAGIC 0xf995e849
12#define ISOFS_SUPER_MAGIC 0x9660
13#define JFFS2_SUPER_MAGIC 0x72b6
14
15#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
16#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
17#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */
18#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */
19
20#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */
21#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */
22#define NFS_SUPER_MAGIC 0x6969
23#define OPENPROM_SUPER_MAGIC 0x9fa1
24#define PROC_SUPER_MAGIC 0x9fa0
25#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */
26
27#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */
28 /* used by file system utilities that
29 look at the superblock, etc. */
30#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
31#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
32#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
33
34#define SMB_SUPER_MAGIC 0x517B
35#define USBDEVICE_SUPER_MAGIC 0x9fa2
36
37#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
index bbc93ae217e1..432b2fa24929 100644
--- a/include/linux/mc146818rtc.h
+++ b/include/linux/mc146818rtc.h
@@ -89,4 +89,11 @@ extern spinlock_t rtc_lock; /* serialize CMOS RAM access */
89# define RTC_VRT 0x80 /* valid RAM and time */ 89# define RTC_VRT 0x80 /* valid RAM and time */
90/**********************************************************************/ 90/**********************************************************************/
91 91
92#ifndef ARCH_RTC_LOCATION /* Override by <asm/mc146818rtc.h>? */
93
94#define RTC_IO_EXTENT 0x8
95#define RTC_IOMAPPED 1 /* Default to I/O mapping. */
96
97#endif /* ARCH_RTC_LOCATION */
98
92#endif /* _MC146818RTC_H */ 99#endif /* _MC146818RTC_H */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 911206386171..218501cfaeb9 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -63,6 +63,76 @@ extern int online_pages(unsigned long, unsigned long);
63/* reasonably generic interface to expand the physical pages in a zone */ 63/* reasonably generic interface to expand the physical pages in a zone */
64extern int __add_pages(struct zone *zone, unsigned long start_pfn, 64extern int __add_pages(struct zone *zone, unsigned long start_pfn,
65 unsigned long nr_pages); 65 unsigned long nr_pages);
66
67#ifdef CONFIG_NUMA
68extern int memory_add_physaddr_to_nid(u64 start);
69#else
70static inline int memory_add_physaddr_to_nid(u64 start)
71{
72 return 0;
73}
74#endif
75
76#ifdef CONFIG_HAVE_ARCH_NODEDATA_EXTENSION
77/*
78 * For supporting node-hotadd, we have to allocate a new pgdat.
79 *
80 * If an arch has generic style NODE_DATA(),
81 * node_data[nid] = kzalloc() works well. But it depends on the architecture.
82 *
83 * In general, generic_alloc_nodedata() is used.
84 * Now, arch_free_nodedata() is just defined for error path of node_hot_add.
85 *
86 */
87extern pg_data_t *arch_alloc_nodedata(int nid);
88extern void arch_free_nodedata(pg_data_t *pgdat);
89extern void arch_refresh_nodedata(int nid, pg_data_t *pgdat);
90
91#else /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
92
93#define arch_alloc_nodedata(nid) generic_alloc_nodedata(nid)
94#define arch_free_nodedata(pgdat) generic_free_nodedata(pgdat)
95
96#ifdef CONFIG_NUMA
97/*
98 * If ARCH_HAS_NODEDATA_EXTENSION=n, this func is used to allocate pgdat.
99 * XXX: kmalloc_node() can't work well to get new node's memory at this time.
100 * Because, pgdat for the new node is not allocated/initialized yet itself.
101 * To use new node's memory, more consideration will be necessary.
102 */
103#define generic_alloc_nodedata(nid) \
104({ \
105 kzalloc(sizeof(pg_data_t), GFP_KERNEL); \
106})
107/*
108 * This definition is just for error path in node hotadd.
109 * For node hotremove, we have to replace this.
110 */
111#define generic_free_nodedata(pgdat) kfree(pgdat)
112
113extern pg_data_t *node_data[];
114static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
115{
116 node_data[nid] = pgdat;
117}
118
119#else /* !CONFIG_NUMA */
120
121/* never called */
122static inline pg_data_t *generic_alloc_nodedata(int nid)
123{
124 BUG();
125 return NULL;
126}
127static inline void generic_free_nodedata(pg_data_t *pgdat)
128{
129}
130static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
131{
132}
133#endif /* CONFIG_NUMA */
134#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
135
66#else /* ! CONFIG_MEMORY_HOTPLUG */ 136#else /* ! CONFIG_MEMORY_HOTPLUG */
67/* 137/*
68 * Stub functions for when hotplug is off 138 * Stub functions for when hotplug is off
@@ -99,7 +169,8 @@ static inline int __remove_pages(struct zone *zone, unsigned long start_pfn,
99 return -ENOSYS; 169 return -ENOSYS;
100} 170}
101 171
102extern int add_memory(u64 start, u64 size); 172extern int add_memory(int nid, u64 start, u64 size);
173extern int arch_add_memory(int nid, u64 start, u64 size);
103extern int remove_memory(u64 start, u64 size); 174extern int remove_memory(u64 start, u64 size);
104 175
105#endif /* __LINUX_MEMORY_HOTPLUG_H */ 176#endif /* __LINUX_MEMORY_HOTPLUG_H */
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 72440f0a443d..09f0f575ddff 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -162,9 +162,9 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
162 unsigned long addr); 162 unsigned long addr);
163extern unsigned slab_node(struct mempolicy *policy); 163extern unsigned slab_node(struct mempolicy *policy);
164 164
165extern int policy_zone; 165extern enum zone_type policy_zone;
166 166
167static inline void check_highest_zone(int k) 167static inline void check_highest_zone(enum zone_type k)
168{ 168{
169 if (k > policy_zone) 169 if (k > policy_zone)
170 policy_zone = k; 170 policy_zone = k;
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 5dba23a1c0d0..48148e0cdbd1 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -16,7 +16,9 @@ extern int fail_migrate_page(struct address_space *,
16 struct page *, struct page *); 16 struct page *, struct page *);
17 17
18extern int migrate_prep(void); 18extern int migrate_prep(void);
19 19extern int migrate_vmas(struct mm_struct *mm,
20 const nodemask_t *from, const nodemask_t *to,
21 unsigned long flags);
20#else 22#else
21 23
22static inline int isolate_lru_page(struct page *p, struct list_head *list) 24static inline int isolate_lru_page(struct page *p, struct list_head *list)
@@ -30,6 +32,13 @@ static inline int migrate_pages_to(struct list_head *pagelist,
30 32
31static inline int migrate_prep(void) { return -ENOSYS; } 33static inline int migrate_prep(void) { return -ENOSYS; }
32 34
35static inline int migrate_vmas(struct mm_struct *mm,
36 const nodemask_t *from, const nodemask_t *to,
37 unsigned long flags)
38{
39 return -ENOSYS;
40}
41
33/* Possible settings for the migrate_page() method in address_operations */ 42/* Possible settings for the migrate_page() method in address_operations */
34#define migrate_page NULL 43#define migrate_page NULL
35#define fail_migrate_page NULL 44#define fail_migrate_page NULL
diff --git a/include/linux/minix_fs.h b/include/linux/minix_fs.h
index 1ecc3cc8cef5..916e8f72c63d 100644
--- a/include/linux/minix_fs.h
+++ b/include/linux/minix_fs.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_MINIX_FS_H 1#ifndef _LINUX_MINIX_FS_H
2#define _LINUX_MINIX_FS_H 2#define _LINUX_MINIX_FS_H
3 3
4#include <linux/magic.h>
5
4/* 6/*
5 * The minix filesystem constants/structures 7 * The minix filesystem constants/structures
6 */ 8 */
@@ -19,10 +21,6 @@
19 21
20#define MINIX_I_MAP_SLOTS 8 22#define MINIX_I_MAP_SLOTS 8
21#define MINIX_Z_MAP_SLOTS 64 23#define MINIX_Z_MAP_SLOTS 64
22#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
23#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
24#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */
25#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */
26#define MINIX_VALID_FS 0x0001 /* Clean fs. */ 24#define MINIX_VALID_FS 0x0001 /* Clean fs. */
27#define MINIX_ERROR_FS 0x0002 /* fs has errors. */ 25#define MINIX_ERROR_FS 0x0002 /* fs has errors. */
28 26
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 5b584dafb5a6..b03cfb91e228 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -40,7 +40,6 @@ struct miscdevice {
40 struct list_head list; 40 struct list_head list;
41 struct device *dev; 41 struct device *dev;
42 struct class_device *class; 42 struct class_device *class;
43 char devfs_name[64];
44}; 43};
45 44
46extern int misc_register(struct miscdevice * misc); 45extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 3b09444121d9..7b703b6d4358 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -14,6 +14,9 @@
14#include <linux/prio_tree.h> 14#include <linux/prio_tree.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/debug_locks.h>
18#include <linux/backing-dev.h>
19#include <linux/mm_types.h>
17 20
18struct mempolicy; 21struct mempolicy;
19struct anon_vma; 22struct anon_vma;
@@ -36,7 +39,6 @@ extern int sysctl_legacy_va_layout;
36#include <asm/page.h> 39#include <asm/page.h>
37#include <asm/pgtable.h> 40#include <asm/pgtable.h>
38#include <asm/processor.h> 41#include <asm/processor.h>
39#include <asm/atomic.h>
40 42
41#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) 43#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
42 44
@@ -145,7 +147,6 @@ extern unsigned int kobjsize(const void *objp);
145 147
146#define VM_GROWSDOWN 0x00000100 /* general info on the segment */ 148#define VM_GROWSDOWN 0x00000100 /* general info on the segment */
147#define VM_GROWSUP 0x00000200 149#define VM_GROWSUP 0x00000200
148#define VM_SHM 0x00000000 /* Means nothing: delete it later */
149#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ 150#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
150#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ 151#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
151 152
@@ -198,6 +199,7 @@ struct vm_operations_struct {
198 void (*open)(struct vm_area_struct * area); 199 void (*open)(struct vm_area_struct * area);
199 void (*close)(struct vm_area_struct * area); 200 void (*close)(struct vm_area_struct * area);
200 struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type); 201 struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type);
202 unsigned long (*nopfn)(struct vm_area_struct * area, unsigned long address);
201 int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock); 203 int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
202 204
203 /* notification that a previously read-only page is about to become 205 /* notification that a previously read-only page is about to become
@@ -207,67 +209,14 @@ struct vm_operations_struct {
207 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new); 209 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
208 struct mempolicy *(*get_policy)(struct vm_area_struct *vma, 210 struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
209 unsigned long addr); 211 unsigned long addr);
212 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
213 const nodemask_t *to, unsigned long flags);
210#endif 214#endif
211}; 215};
212 216
213struct mmu_gather; 217struct mmu_gather;
214struct inode; 218struct inode;
215 219
216/*
217 * Each physical page in the system has a struct page associated with
218 * it to keep track of whatever it is we are using the page for at the
219 * moment. Note that we have no way to track which tasks are using
220 * a page.
221 */
222struct page {
223 unsigned long flags; /* Atomic flags, some possibly
224 * updated asynchronously */
225 atomic_t _count; /* Usage count, see below. */
226 atomic_t _mapcount; /* Count of ptes mapped in mms,
227 * to show when page is mapped
228 * & limit reverse map searches.
229 */
230 union {
231 struct {
232 unsigned long private; /* Mapping-private opaque data:
233 * usually used for buffer_heads
234 * if PagePrivate set; used for
235 * swp_entry_t if PageSwapCache;
236 * indicates order in the buddy
237 * system if PG_buddy is set.
238 */
239 struct address_space *mapping; /* If low bit clear, points to
240 * inode address_space, or NULL.
241 * If page mapped as anonymous
242 * memory, low bit is set, and
243 * it points to anon_vma object:
244 * see PAGE_MAPPING_ANON below.
245 */
246 };
247#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
248 spinlock_t ptl;
249#endif
250 };
251 pgoff_t index; /* Our offset within mapping. */
252 struct list_head lru; /* Pageout list, eg. active_list
253 * protected by zone->lru_lock !
254 */
255 /*
256 * On machines where all RAM is mapped into kernel address space,
257 * we can simply calculate the virtual address. On machines with
258 * highmem some memory is mapped into kernel virtual memory
259 * dynamically, so we need a place to store that address.
260 * Note that this field could be 16 bits on x86 ... ;)
261 *
262 * Architectures with slow multiplication can define
263 * WANT_PAGE_VIRTUAL in asm/page.h
264 */
265#if defined(WANT_PAGE_VIRTUAL)
266 void *virtual; /* Kernel virtual address (NULL if
267 not kmapped, ie. highmem) */
268#endif /* WANT_PAGE_VIRTUAL */
269};
270
271#define page_private(page) ((page)->private) 220#define page_private(page) ((page)->private)
272#define set_page_private(page, v) ((page)->private = (v)) 221#define set_page_private(page, v) ((page)->private = (v))
273 222
@@ -277,6 +226,12 @@ struct page {
277 */ 226 */
278#include <linux/page-flags.h> 227#include <linux/page-flags.h>
279 228
229#ifdef CONFIG_DEBUG_VM
230#define VM_BUG_ON(cond) BUG_ON(cond)
231#else
232#define VM_BUG_ON(condition) do { } while(0)
233#endif
234
280/* 235/*
281 * Methods to modify the page usage count. 236 * Methods to modify the page usage count.
282 * 237 *
@@ -291,12 +246,11 @@ struct page {
291 */ 246 */
292 247
293/* 248/*
294 * Drop a ref, return true if the logical refcount fell to zero (the page has 249 * Drop a ref, return true if the refcount fell to zero (the page has no users)
295 * no users)
296 */ 250 */
297static inline int put_page_testzero(struct page *page) 251static inline int put_page_testzero(struct page *page)
298{ 252{
299 BUG_ON(atomic_read(&page->_count) == 0); 253 VM_BUG_ON(atomic_read(&page->_count) == 0);
300 return atomic_dec_and_test(&page->_count); 254 return atomic_dec_and_test(&page->_count);
301} 255}
302 256
@@ -306,11 +260,10 @@ static inline int put_page_testzero(struct page *page)
306 */ 260 */
307static inline int get_page_unless_zero(struct page *page) 261static inline int get_page_unless_zero(struct page *page)
308{ 262{
263 VM_BUG_ON(PageCompound(page));
309 return atomic_inc_not_zero(&page->_count); 264 return atomic_inc_not_zero(&page->_count);
310} 265}
311 266
312extern void FASTCALL(__page_cache_release(struct page *));
313
314static inline int page_count(struct page *page) 267static inline int page_count(struct page *page)
315{ 268{
316 if (unlikely(PageCompound(page))) 269 if (unlikely(PageCompound(page)))
@@ -322,6 +275,7 @@ static inline void get_page(struct page *page)
322{ 275{
323 if (unlikely(PageCompound(page))) 276 if (unlikely(PageCompound(page)))
324 page = (struct page *)page_private(page); 277 page = (struct page *)page_private(page);
278 VM_BUG_ON(atomic_read(&page->_count) == 0);
325 atomic_inc(&page->_count); 279 atomic_inc(&page->_count);
326} 280}
327 281
@@ -335,6 +289,7 @@ static inline void init_page_count(struct page *page)
335} 289}
336 290
337void put_page(struct page *page); 291void put_page(struct page *page);
292void put_pages_list(struct list_head *pages);
338 293
339void split_page(struct page *page, unsigned int order); 294void split_page(struct page *page, unsigned int order);
340 295
@@ -347,43 +302,55 @@ void split_page(struct page *page, unsigned int order);
347 * For the non-reserved pages, page_count(page) denotes a reference count. 302 * For the non-reserved pages, page_count(page) denotes a reference count.
348 * page_count() == 0 means the page is free. page->lru is then used for 303 * page_count() == 0 means the page is free. page->lru is then used for
349 * freelist management in the buddy allocator. 304 * freelist management in the buddy allocator.
350 * page_count() == 1 means the page is used for exactly one purpose 305 * page_count() > 0 means the page has been allocated.
351 * (e.g. a private data page of one process). 306 *
307 * Pages are allocated by the slab allocator in order to provide memory
308 * to kmalloc and kmem_cache_alloc. In this case, the management of the
309 * page, and the fields in 'struct page' are the responsibility of mm/slab.c
310 * unless a particular usage is carefully commented. (the responsibility of
311 * freeing the kmalloc memory is the caller's, of course).
352 * 312 *
353 * A page may be used for kmalloc() or anyone else who does a 313 * A page may be used by anyone else who does a __get_free_page().
354 * __get_free_page(). In this case the page_count() is at least 1, and 314 * In this case, page_count still tracks the references, and should only
355 * all other fields are unused but should be 0 or NULL. The 315 * be used through the normal accessor functions. The top bits of page->flags
356 * management of this page is the responsibility of the one who uses 316 * and page->virtual store page management information, but all other fields
357 * it. 317 * are unused and could be used privately, carefully. The management of this
318 * page is the responsibility of the one who allocated it, and those who have
319 * subsequently been given references to it.
358 * 320 *
359 * The other pages (we may call them "process pages") are completely 321 * The other pages (we may call them "pagecache pages") are completely
360 * managed by the Linux memory manager: I/O, buffers, swapping etc. 322 * managed by the Linux memory manager: I/O, buffers, swapping etc.
361 * The following discussion applies only to them. 323 * The following discussion applies only to them.
362 * 324 *
363 * A page may belong to an inode's memory mapping. In this case, 325 * A pagecache page contains an opaque `private' member, which belongs to the
364 * page->mapping is the pointer to the inode, and page->index is the 326 * page's address_space. Usually, this is the address of a circular list of
365 * file offset of the page, in units of PAGE_CACHE_SIZE. 327 * the page's disk buffers. PG_private must be set to tell the VM to call
328 * into the filesystem to release these pages.
366 * 329 *
367 * A page contains an opaque `private' member, which belongs to the 330 * A page may belong to an inode's memory mapping. In this case, page->mapping
368 * page's address_space. Usually, this is the address of a circular 331 * is the pointer to the inode, and page->index is the file offset of the page,
369 * list of the page's disk buffers. 332 * in units of PAGE_CACHE_SIZE.
370 * 333 *
371 * For pages belonging to inodes, the page_count() is the number of 334 * If pagecache pages are not associated with an inode, they are said to be
372 * attaches, plus 1 if `private' contains something, plus one for 335 * anonymous pages. These may become associated with the swapcache, and in that
373 * the page cache itself. 336 * case PG_swapcache is set, and page->private is an offset into the swapcache.
374 * 337 *
375 * Instead of keeping dirty/clean pages in per address-space lists, we instead 338 * In either case (swapcache or inode backed), the pagecache itself holds one
376 * now tag pages as dirty/under writeback in the radix tree. 339 * reference to the page. Setting PG_private should also increment the
340 * refcount. The each user mapping also has a reference to the page.
377 * 341 *
378 * There is also a per-mapping radix tree mapping index to the page 342 * The pagecache pages are stored in a per-mapping radix tree, which is
379 * in memory if present. The tree is rooted at mapping->root. 343 * rooted at mapping->page_tree, and indexed by offset.
344 * Where 2.4 and early 2.6 kernels kept dirty/clean pages in per-address_space
345 * lists, we instead now tag pages as dirty/writeback in the radix tree.
380 * 346 *
381 * All process pages can do I/O: 347 * All pagecache pages may be subject to I/O:
382 * - inode pages may need to be read from disk, 348 * - inode pages may need to be read from disk,
383 * - inode pages which have been modified and are MAP_SHARED may need 349 * - inode pages which have been modified and are MAP_SHARED may need
384 * to be written to disk, 350 * to be written back to the inode on disk,
385 * - private pages which have been modified may need to be swapped out 351 * - anonymous pages (including MAP_PRIVATE file mappings) which have been
386 * to swap space and (later) to be read back into memory. 352 * modified may need to be swapped out to swap space and (later) to be read
353 * back into memory.
387 */ 354 */
388 355
389/* 356/*
@@ -461,7 +428,7 @@ void split_page(struct page *page, unsigned int order);
461#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 428#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
462#define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1) 429#define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1)
463 430
464static inline unsigned long page_zonenum(struct page *page) 431static inline enum zone_type page_zonenum(struct page *page)
465{ 432{
466 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; 433 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
467} 434}
@@ -478,23 +445,33 @@ static inline struct zone *page_zone(struct page *page)
478 return zone_table[page_zone_id(page)]; 445 return zone_table[page_zone_id(page)];
479} 446}
480 447
448static inline unsigned long zone_to_nid(struct zone *zone)
449{
450#ifdef CONFIG_NUMA
451 return zone->node;
452#else
453 return 0;
454#endif
455}
456
481static inline unsigned long page_to_nid(struct page *page) 457static inline unsigned long page_to_nid(struct page *page)
482{ 458{
483 if (FLAGS_HAS_NODE) 459 if (FLAGS_HAS_NODE)
484 return (page->flags >> NODES_PGSHIFT) & NODES_MASK; 460 return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
485 else 461 else
486 return page_zone(page)->zone_pgdat->node_id; 462 return zone_to_nid(page_zone(page));
487} 463}
488static inline unsigned long page_to_section(struct page *page) 464static inline unsigned long page_to_section(struct page *page)
489{ 465{
490 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; 466 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
491} 467}
492 468
493static inline void set_page_zone(struct page *page, unsigned long zone) 469static inline void set_page_zone(struct page *page, enum zone_type zone)
494{ 470{
495 page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT); 471 page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
496 page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT; 472 page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
497} 473}
474
498static inline void set_page_node(struct page *page, unsigned long node) 475static inline void set_page_node(struct page *page, unsigned long node)
499{ 476{
500 page->flags &= ~(NODES_MASK << NODES_PGSHIFT); 477 page->flags &= ~(NODES_MASK << NODES_PGSHIFT);
@@ -506,7 +483,7 @@ static inline void set_page_section(struct page *page, unsigned long section)
506 page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; 483 page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
507} 484}
508 485
509static inline void set_page_links(struct page *page, unsigned long zone, 486static inline void set_page_links(struct page *page, enum zone_type zone,
510 unsigned long node, unsigned long pfn) 487 unsigned long node, unsigned long pfn)
511{ 488{
512 set_page_zone(page, zone); 489 set_page_zone(page, zone);
@@ -514,10 +491,10 @@ static inline void set_page_links(struct page *page, unsigned long zone,
514 set_page_section(page, pfn_to_section_nr(pfn)); 491 set_page_section(page, pfn_to_section_nr(pfn));
515} 492}
516 493
517#ifndef CONFIG_DISCONTIGMEM 494/*
518/* The array of struct pages - for discontigmem use pgdat->lmem_map */ 495 * Some inline functions in vmstat.h depend on page_zone()
519extern struct page *mem_map; 496 */
520#endif 497#include <linux/vmstat.h>
521 498
522static __always_inline void *lowmem_page_address(struct page *page) 499static __always_inline void *lowmem_page_address(struct page *page)
523{ 500{
@@ -618,6 +595,12 @@ static inline int page_mapped(struct page *page)
618#define NOPAGE_OOM ((struct page *) (-1)) 595#define NOPAGE_OOM ((struct page *) (-1))
619 596
620/* 597/*
598 * Error return values for the *_nopfn functions
599 */
600#define NOPFN_SIGBUS ((unsigned long) -1)
601#define NOPFN_OOM ((unsigned long) -2)
602
603/*
621 * Different kinds of faults, as returned by handle_mm_fault(). 604 * Different kinds of faults, as returned by handle_mm_fault().
622 * Used to decide whether a process gets delivered SIGBUS or 605 * Used to decide whether a process gets delivered SIGBUS or
623 * just gets major/minor fault counters bumped up. 606 * just gets major/minor fault counters bumped up.
@@ -795,6 +778,39 @@ struct shrinker;
795extern struct shrinker *set_shrinker(int, shrinker_t); 778extern struct shrinker *set_shrinker(int, shrinker_t);
796extern void remove_shrinker(struct shrinker *shrinker); 779extern void remove_shrinker(struct shrinker *shrinker);
797 780
781/*
782 * Some shared mappigns will want the pages marked read-only
783 * to track write events. If so, we'll downgrade vm_page_prot
784 * to the private version (using protection_map[] without the
785 * VM_SHARED bit).
786 */
787static inline int vma_wants_writenotify(struct vm_area_struct *vma)
788{
789 unsigned int vm_flags = vma->vm_flags;
790
791 /* If it was private or non-writable, the write bit is already clear */
792 if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
793 return 0;
794
795 /* The backer wishes to know when pages are first written to? */
796 if (vma->vm_ops && vma->vm_ops->page_mkwrite)
797 return 1;
798
799 /* The open routine did something to the protections already? */
800 if (pgprot_val(vma->vm_page_prot) !=
801 pgprot_val(protection_map[vm_flags &
802 (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
803 return 0;
804
805 /* Specialty mapping? */
806 if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
807 return 0;
808
809 /* Can the mapping track the dirty pages? */
810 return vma->vm_file && vma->vm_file->f_mapping &&
811 mapping_cap_account_dirty(vma->vm_file->f_mapping);
812}
813
798extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl)); 814extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl));
799 815
800int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address); 816int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
@@ -872,6 +888,56 @@ extern void free_area_init(unsigned long * zones_size);
872extern void free_area_init_node(int nid, pg_data_t *pgdat, 888extern void free_area_init_node(int nid, pg_data_t *pgdat,
873 unsigned long * zones_size, unsigned long zone_start_pfn, 889 unsigned long * zones_size, unsigned long zone_start_pfn,
874 unsigned long *zholes_size); 890 unsigned long *zholes_size);
891#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
892/*
893 * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its
894 * zones, allocate the backing mem_map and account for memory holes in a more
895 * architecture independent manner. This is a substitute for creating the
896 * zone_sizes[] and zholes_size[] arrays and passing them to
897 * free_area_init_node()
898 *
899 * An architecture is expected to register range of page frames backed by
900 * physical memory with add_active_range() before calling
901 * free_area_init_nodes() passing in the PFN each zone ends at. At a basic
902 * usage, an architecture is expected to do something like
903 *
904 * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn,
905 * max_highmem_pfn};
906 * for_each_valid_physical_page_range()
907 * add_active_range(node_id, start_pfn, end_pfn)
908 * free_area_init_nodes(max_zone_pfns);
909 *
910 * If the architecture guarantees that there are no holes in the ranges
911 * registered with add_active_range(), free_bootmem_active_regions()
912 * will call free_bootmem_node() for each registered physical page range.
913 * Similarly sparse_memory_present_with_active_regions() calls
914 * memory_present() for each range when SPARSEMEM is enabled.
915 *
916 * See mm/page_alloc.c for more information on each function exposed by
917 * CONFIG_ARCH_POPULATES_NODE_MAP
918 */
919extern void free_area_init_nodes(unsigned long *max_zone_pfn);
920extern void add_active_range(unsigned int nid, unsigned long start_pfn,
921 unsigned long end_pfn);
922extern void shrink_active_range(unsigned int nid, unsigned long old_end_pfn,
923 unsigned long new_end_pfn);
924extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn,
925 unsigned long end_pfn);
926extern void remove_all_active_ranges(void);
927extern unsigned long absent_pages_in_range(unsigned long start_pfn,
928 unsigned long end_pfn);
929extern void get_pfn_range_for_nid(unsigned int nid,
930 unsigned long *start_pfn, unsigned long *end_pfn);
931extern unsigned long find_min_pfn_with_active_regions(void);
932extern unsigned long find_max_pfn_with_active_regions(void);
933extern void free_bootmem_with_active_regions(int nid,
934 unsigned long max_low_pfn);
935extern void sparse_memory_present_with_active_regions(int nid);
936#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
937extern int early_pfn_to_nid(unsigned long pfn);
938#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
939#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
940extern void set_dma_reserve(unsigned long new_dma_reserve);
875extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long); 941extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long);
876extern void setup_per_zone_pages_min(void); 942extern void setup_per_zone_pages_min(void);
877extern void mem_init(void); 943extern void mem_init(void);
@@ -1006,6 +1072,7 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma)
1006 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 1072 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
1007} 1073}
1008 1074
1075pgprot_t vm_get_page_prot(unsigned long vm_flags);
1009struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); 1076struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr);
1010struct page *vmalloc_to_page(void *addr); 1077struct page *vmalloc_to_page(void *addr);
1011unsigned long vmalloc_to_pfn(void *addr); 1078unsigned long vmalloc_to_pfn(void *addr);
@@ -1034,8 +1101,8 @@ static inline void
1034kernel_map_pages(struct page *page, int numpages, int enable) 1101kernel_map_pages(struct page *page, int numpages, int enable)
1035{ 1102{
1036 if (!PageHighMem(page) && !enable) 1103 if (!PageHighMem(page) && !enable)
1037 mutex_debug_check_no_locks_freed(page_address(page), 1104 debug_check_no_locks_freed(page_address(page),
1038 numpages * PAGE_SIZE); 1105 numpages * PAGE_SIZE);
1039} 1106}
1040#endif 1107#endif
1041 1108
@@ -1064,5 +1131,7 @@ void drop_slab(void);
1064extern int randomize_va_space; 1131extern int randomize_va_space;
1065#endif 1132#endif
1066 1133
1134__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma);
1135
1067#endif /* __KERNEL__ */ 1136#endif /* __KERNEL__ */
1068#endif /* _LINUX_MM_H */ 1137#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
new file mode 100644
index 000000000000..c3852fd4a1cc
--- /dev/null
+++ b/include/linux/mm_types.h
@@ -0,0 +1,67 @@
1#ifndef _LINUX_MM_TYPES_H
2#define _LINUX_MM_TYPES_H
3
4#include <linux/types.h>
5#include <linux/threads.h>
6#include <linux/list.h>
7#include <linux/spinlock.h>
8
9struct address_space;
10
11/*
12 * Each physical page in the system has a struct page associated with
13 * it to keep track of whatever it is we are using the page for at the
14 * moment. Note that we have no way to track which tasks are using
15 * a page, though if it is a pagecache page, rmap structures can tell us
16 * who is mapping it.
17 */
18struct page {
19 unsigned long flags; /* Atomic flags, some possibly
20 * updated asynchronously */
21 atomic_t _count; /* Usage count, see below. */
22 atomic_t _mapcount; /* Count of ptes mapped in mms,
23 * to show when page is mapped
24 * & limit reverse map searches.
25 */
26 union {
27 struct {
28 unsigned long private; /* Mapping-private opaque data:
29 * usually used for buffer_heads
30 * if PagePrivate set; used for
31 * swp_entry_t if PageSwapCache;
32 * indicates order in the buddy
33 * system if PG_buddy is set.
34 */
35 struct address_space *mapping; /* If low bit clear, points to
36 * inode address_space, or NULL.
37 * If page mapped as anonymous
38 * memory, low bit is set, and
39 * it points to anon_vma object:
40 * see PAGE_MAPPING_ANON below.
41 */
42 };
43#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
44 spinlock_t ptl;
45#endif
46 };
47 pgoff_t index; /* Our offset within mapping. */
48 struct list_head lru; /* Pageout list, eg. active_list
49 * protected by zone->lru_lock !
50 */
51 /*
52 * On machines where all RAM is mapped into kernel address space,
53 * we can simply calculate the virtual address. On machines with
54 * highmem some memory is mapped into kernel virtual memory
55 * dynamically, so we need a place to store that address.
56 * Note that this field could be 16 bits on x86 ... ;)
57 *
58 * Architectures with slow multiplication can define
59 * WANT_PAGE_VIRTUAL in asm/page.h
60 */
61#if defined(WANT_PAGE_VIRTUAL)
62 void *virtual; /* Kernel virtual address (NULL if
63 not kmapped, ie. highmem) */
64#endif /* WANT_PAGE_VIRTUAL */
65};
66
67#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index c1f021eddffa..587264a58d56 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -77,7 +77,7 @@ struct mmc_host {
77 struct device *dev; 77 struct device *dev;
78 struct class_device class_dev; 78 struct class_device class_dev;
79 int index; 79 int index;
80 struct mmc_host_ops *ops; 80 const struct mmc_host_ops *ops;
81 unsigned int f_min; 81 unsigned int f_min;
82 unsigned int f_max; 82 unsigned int f_max;
83 u32 ocr_avail; 83 u32 ocr_avail;
@@ -85,6 +85,8 @@ struct mmc_host {
85 unsigned long caps; /* Host capabilities */ 85 unsigned long caps; /* Host capabilities */
86 86
87#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ 87#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
88#define MMC_CAP_MULTIWRITE (1 << 1) /* Can accurately report bytes sent to card on error */
89#define MMC_CAP_BYTEBLOCK (1 << 2) /* Can do non-log2 block sizes */
88 90
89 /* host specific block data */ 91 /* host specific block data */
90 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 92 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 03a14a30c46a..a3594dfd6963 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -68,7 +68,6 @@ struct mmc_command {
68struct mmc_data { 68struct mmc_data {
69 unsigned int timeout_ns; /* data timeout (in ns, max 80ms) */ 69 unsigned int timeout_ns; /* data timeout (in ns, max 80ms) */
70 unsigned int timeout_clks; /* data timeout (in clocks) */ 70 unsigned int timeout_clks; /* data timeout (in clocks) */
71 unsigned int blksz_bits; /* data block size */
72 unsigned int blksz; /* data block size */ 71 unsigned int blksz; /* data block size */
73 unsigned int blocks; /* number of blocks */ 72 unsigned int blocks; /* number of blocks */
74 unsigned int error; /* data error */ 73 unsigned int error; /* data error */
@@ -105,6 +104,8 @@ extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
105extern int mmc_wait_for_app_cmd(struct mmc_host *, unsigned int, 104extern int mmc_wait_for_app_cmd(struct mmc_host *, unsigned int,
106 struct mmc_command *, int); 105 struct mmc_command *, int);
107 106
107extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *, int);
108
108extern int __mmc_claim_host(struct mmc_host *host, struct mmc_card *card); 109extern int __mmc_claim_host(struct mmc_host *host, struct mmc_card *card);
109 110
110static inline void mmc_claim_host(struct mmc_host *host) 111static inline void mmc_claim_host(struct mmc_host *host)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index d6120fa69116..59855b8718a0 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -46,6 +46,29 @@ struct zone_padding {
46#define ZONE_PADDING(name) 46#define ZONE_PADDING(name)
47#endif 47#endif
48 48
49enum zone_stat_item {
50 NR_ANON_PAGES, /* Mapped anonymous pages */
51 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
52 only modified from process context */
53 NR_FILE_PAGES,
54 NR_SLAB_RECLAIMABLE,
55 NR_SLAB_UNRECLAIMABLE,
56 NR_PAGETABLE, /* used for pagetables */
57 NR_FILE_DIRTY,
58 NR_WRITEBACK,
59 NR_UNSTABLE_NFS, /* NFS unstable pages */
60 NR_BOUNCE,
61 NR_VMSCAN_WRITE,
62#ifdef CONFIG_NUMA
63 NUMA_HIT, /* allocated in intended node */
64 NUMA_MISS, /* allocated in non intended node */
65 NUMA_FOREIGN, /* was intended here, hit elsewhere */
66 NUMA_INTERLEAVE_HIT, /* interleaver preferred this zone */
67 NUMA_LOCAL, /* allocation from local node */
68 NUMA_OTHER, /* allocation from other node */
69#endif
70 NR_VM_ZONE_STAT_ITEMS };
71
49struct per_cpu_pages { 72struct per_cpu_pages {
50 int count; /* number of pages in the list */ 73 int count; /* number of pages in the list */
51 int high; /* high watermark, emptying needed */ 74 int high; /* high watermark, emptying needed */
@@ -55,13 +78,9 @@ struct per_cpu_pages {
55 78
56struct per_cpu_pageset { 79struct per_cpu_pageset {
57 struct per_cpu_pages pcp[2]; /* 0: hot. 1: cold */ 80 struct per_cpu_pages pcp[2]; /* 0: hot. 1: cold */
58#ifdef CONFIG_NUMA 81#ifdef CONFIG_SMP
59 unsigned long numa_hit; /* allocated in intended node */ 82 s8 stat_threshold;
60 unsigned long numa_miss; /* allocated in non intended node */ 83 s8 vm_stat_diff[NR_VM_ZONE_STAT_ITEMS];
61 unsigned long numa_foreign; /* was intended here, hit elsewhere */
62 unsigned long interleave_hit; /* interleaver prefered this zone */
63 unsigned long local_node; /* allocation from local node */
64 unsigned long other_node; /* allocation from other node */
65#endif 84#endif
66} ____cacheline_aligned_in_smp; 85} ____cacheline_aligned_in_smp;
67 86
@@ -71,53 +90,68 @@ struct per_cpu_pageset {
71#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) 90#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
72#endif 91#endif
73 92
74#define ZONE_DMA 0 93enum zone_type {
75#define ZONE_DMA32 1 94 /*
76#define ZONE_NORMAL 2 95 * ZONE_DMA is used when there are devices that are not able
77#define ZONE_HIGHMEM 3 96 * to do DMA to all of addressable memory (ZONE_NORMAL). Then we
78 97 * carve out the portion of memory that is needed for these devices.
79#define MAX_NR_ZONES 4 /* Sync this with ZONES_SHIFT */ 98 * The range is arch specific.
80#define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ 99 *
81 100 * Some examples
101 *
102 * Architecture Limit
103 * ---------------------------
104 * parisc, ia64, sparc <4G
105 * s390 <2G
106 * arm26 <48M
107 * arm Various
108 * alpha Unlimited or 0-16MB.
109 *
110 * i386, x86_64 and multiple other arches
111 * <16M.
112 */
113 ZONE_DMA,
114#ifdef CONFIG_ZONE_DMA32
115 /*
116 * x86_64 needs two ZONE_DMAs because it supports devices that are
117 * only able to do DMA to the lower 16M but also 32 bit devices that
118 * can only do DMA areas below 4G.
119 */
120 ZONE_DMA32,
121#endif
122 /*
123 * Normal addressable memory is in ZONE_NORMAL. DMA operations can be
124 * performed on pages in ZONE_NORMAL if the DMA devices support
125 * transfers to all addressable memory.
126 */
127 ZONE_NORMAL,
128#ifdef CONFIG_HIGHMEM
129 /*
130 * A memory area that is only addressable by the kernel through
131 * mapping portions into its own address space. This is for example
132 * used by i386 to allow the kernel to address the memory beyond
133 * 900MB. The kernel will set up special mappings (page
134 * table entries on i386) for each page that the kernel needs to
135 * access.
136 */
137 ZONE_HIGHMEM,
138#endif
139 MAX_NR_ZONES
140};
82 141
83/* 142/*
84 * When a memory allocation must conform to specific limitations (such 143 * When a memory allocation must conform to specific limitations (such
85 * as being suitable for DMA) the caller will pass in hints to the 144 * as being suitable for DMA) the caller will pass in hints to the
86 * allocator in the gfp_mask, in the zone modifier bits. These bits 145 * allocator in the gfp_mask, in the zone modifier bits. These bits
87 * are used to select a priority ordered list of memory zones which 146 * are used to select a priority ordered list of memory zones which
88 * match the requested limits. GFP_ZONEMASK defines which bits within 147 * match the requested limits. See gfp_zone() in include/linux/gfp.h
89 * the gfp_mask should be considered as zone modifiers. Each valid
90 * combination of the zone modifier bits has a corresponding list
91 * of zones (in node_zonelists). Thus for two zone modifiers there
92 * will be a maximum of 4 (2 ** 2) zonelists, for 3 modifiers there will
93 * be 8 (2 ** 3) zonelists. GFP_ZONETYPES defines the number of possible
94 * combinations of zone modifiers in "zone modifier space".
95 *
96 * As an optimisation any zone modifier bits which are only valid when
97 * no other zone modifier bits are set (loners) should be placed in
98 * the highest order bits of this field. This allows us to reduce the
99 * extent of the zonelists thus saving space. For example in the case
100 * of three zone modifier bits, we could require up to eight zonelists.
101 * If the left most zone modifier is a "loner" then the highest valid
102 * zonelist would be four allowing us to allocate only five zonelists.
103 * Use the first form for GFP_ZONETYPES when the left most bit is not
104 * a "loner", otherwise use the second.
105 *
106 * NOTE! Make sure this matches the zones in <linux/gfp.h>
107 */ 148 */
108#define GFP_ZONEMASK 0x07
109/* #define GFP_ZONETYPES (GFP_ZONEMASK + 1) */ /* Non-loner */
110#define GFP_ZONETYPES ((GFP_ZONEMASK + 1) / 2 + 1) /* Loner */
111 149
112/* 150#if !defined(CONFIG_ZONE_DMA32) && !defined(CONFIG_HIGHMEM)
113 * On machines where it is needed (eg PCs) we divide physical memory 151#define ZONES_SHIFT 1
114 * into multiple physical zones. On a 32bit PC we have 4 zones: 152#else
115 * 153#define ZONES_SHIFT 2
116 * ZONE_DMA < 16 MB ISA DMA capable memory 154#endif
117 * ZONE_DMA32 0 MB Empty
118 * ZONE_NORMAL 16-896 MB direct mapped by the kernel
119 * ZONE_HIGHMEM > 896 MB only page cache and user processes
120 */
121 155
122struct zone { 156struct zone {
123 /* Fields commonly accessed by the page allocator */ 157 /* Fields commonly accessed by the page allocator */
@@ -134,6 +168,12 @@ struct zone {
134 unsigned long lowmem_reserve[MAX_NR_ZONES]; 168 unsigned long lowmem_reserve[MAX_NR_ZONES];
135 169
136#ifdef CONFIG_NUMA 170#ifdef CONFIG_NUMA
171 int node;
172 /*
173 * zone reclaim becomes active if more unmapped pages exist.
174 */
175 unsigned long min_unmapped_pages;
176 unsigned long min_slab_pages;
137 struct per_cpu_pageset *pageset[NR_CPUS]; 177 struct per_cpu_pageset *pageset[NR_CPUS];
138#else 178#else
139 struct per_cpu_pageset pageset[NR_CPUS]; 179 struct per_cpu_pageset pageset[NR_CPUS];
@@ -165,12 +205,8 @@ struct zone {
165 /* A count of how many reclaimers are scanning this zone */ 205 /* A count of how many reclaimers are scanning this zone */
166 atomic_t reclaim_in_progress; 206 atomic_t reclaim_in_progress;
167 207
168 /* 208 /* Zone statistics */
169 * timestamp (in jiffies) of the last zone reclaim that did not 209 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
170 * result in freeing of pages. This is used to avoid repeated scans
171 * if all memory in the zone is in use.
172 */
173 unsigned long last_unsuccessful_zone_reclaim;
174 210
175 /* 211 /*
176 * prev_priority holds the scanning priority for this zone. It is 212 * prev_priority holds the scanning priority for this zone. It is
@@ -249,7 +285,6 @@ struct zone {
249 char *name; 285 char *name;
250} ____cacheline_internodealigned_in_smp; 286} ____cacheline_internodealigned_in_smp;
251 287
252
253/* 288/*
254 * The "priority" of VM scanning is how much of the queues we will scan in one 289 * The "priority" of VM scanning is how much of the queues we will scan in one
255 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the 290 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
@@ -272,6 +307,18 @@ struct zonelist {
272 struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited 307 struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited
273}; 308};
274 309
310#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
311struct node_active_region {
312 unsigned long start_pfn;
313 unsigned long end_pfn;
314 int nid;
315};
316#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
317
318#ifndef CONFIG_DISCONTIGMEM
319/* The array of struct pages - for discontigmem use pgdat->lmem_map */
320extern struct page *mem_map;
321#endif
275 322
276/* 323/*
277 * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM 324 * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM
@@ -287,7 +334,7 @@ struct zonelist {
287struct bootmem_data; 334struct bootmem_data;
288typedef struct pglist_data { 335typedef struct pglist_data {
289 struct zone node_zones[MAX_NR_ZONES]; 336 struct zone node_zones[MAX_NR_ZONES];
290 struct zonelist node_zonelists[GFP_ZONETYPES]; 337 struct zonelist node_zonelists[MAX_NR_ZONES];
291 int nr_zones; 338 int nr_zones;
292#ifdef CONFIG_FLAT_NODE_MEM_MAP 339#ifdef CONFIG_FLAT_NODE_MEM_MAP
293 struct page *node_mem_map; 340 struct page *node_mem_map;
@@ -356,12 +403,16 @@ static inline int populated_zone(struct zone *zone)
356 return (!!zone->present_pages); 403 return (!!zone->present_pages);
357} 404}
358 405
359static inline int is_highmem_idx(int idx) 406static inline int is_highmem_idx(enum zone_type idx)
360{ 407{
408#ifdef CONFIG_HIGHMEM
361 return (idx == ZONE_HIGHMEM); 409 return (idx == ZONE_HIGHMEM);
410#else
411 return 0;
412#endif
362} 413}
363 414
364static inline int is_normal_idx(int idx) 415static inline int is_normal_idx(enum zone_type idx)
365{ 416{
366 return (idx == ZONE_NORMAL); 417 return (idx == ZONE_NORMAL);
367} 418}
@@ -374,7 +425,11 @@ static inline int is_normal_idx(int idx)
374 */ 425 */
375static inline int is_highmem(struct zone *zone) 426static inline int is_highmem(struct zone *zone)
376{ 427{
428#ifdef CONFIG_HIGHMEM
377 return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM; 429 return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM;
430#else
431 return 0;
432#endif
378} 433}
379 434
380static inline int is_normal(struct zone *zone) 435static inline int is_normal(struct zone *zone)
@@ -384,7 +439,11 @@ static inline int is_normal(struct zone *zone)
384 439
385static inline int is_dma32(struct zone *zone) 440static inline int is_dma32(struct zone *zone)
386{ 441{
442#ifdef CONFIG_ZONE_DMA32
387 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32; 443 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
444#else
445 return 0;
446#endif
388} 447}
389 448
390static inline int is_dma(struct zone *zone) 449static inline int is_dma(struct zone *zone)
@@ -402,6 +461,10 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *,
402 void __user *, size_t *, loff_t *); 461 void __user *, size_t *, loff_t *);
403int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *, 462int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *,
404 void __user *, size_t *, loff_t *); 463 void __user *, size_t *, loff_t *);
464int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,
465 struct file *, void __user *, size_t *, loff_t *);
466int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int,
467 struct file *, void __user *, size_t *, loff_t *);
405 468
406#include <linux/topology.h> 469#include <linux/topology.h>
407/* Returns the number of the current Node. */ 470/* Returns the number of the current Node. */
@@ -469,7 +532,8 @@ extern struct zone *next_zone(struct zone *zone);
469 532
470#endif 533#endif
471 534
472#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID 535#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
536 !defined(CONFIG_ARCH_POPULATES_NODE_MAP)
473#define early_pfn_to_nid(nid) (0UL) 537#define early_pfn_to_nid(nid) (0UL)
474#endif 538#endif
475 539
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index f6977708585c..e0c393cc7240 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -148,6 +148,17 @@ struct ccw_device_id {
148#define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04 148#define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04
149#define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08 149#define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08
150 150
151/* s390 AP bus devices */
152struct ap_device_id {
153 __u16 match_flags; /* which fields to match against */
154 __u8 dev_type; /* device type */
155 __u8 pad1;
156 __u32 pad2;
157 kernel_ulong_t driver_info;
158};
159
160#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01
161
151 162
152#define PNP_ID_LEN 8 163#define PNP_ID_LEN 8
153#define PNP_MAX_DEVICES 8 164#define PNP_MAX_DEVICES 8
@@ -297,4 +308,16 @@ struct input_device_id {
297 kernel_ulong_t driver_info; 308 kernel_ulong_t driver_info;
298}; 309};
299 310
311/* EISA */
312
313#define EISA_SIG_LEN 8
314
315/* The EISA signature, in ASCII form, null terminated */
316struct eisa_device_id {
317 char sig[EISA_SIG_LEN];
318 kernel_ulong_t driver_data;
319};
320
321#define EISA_DEVICE_MODALIAS_FMT "eisa:s%s"
322
300#endif /* LINUX_MOD_DEVICETABLE_H */ 323#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 2d366098eab5..2c599175c583 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -156,6 +156,11 @@ extern struct module __this_module;
156*/ 156*/
157#define MODULE_VERSION(_version) MODULE_INFO(version, _version) 157#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
158 158
159/* Optional firmware file (or files) needed by the module
160 * format is simply firmware file name. Multiple firmware
161 * files require multiple MODULE_FIRMWARE() specifiers */
162#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
163
159/* Given an address, look for it in the exception tables */ 164/* Given an address, look for it in the exception tables */
160const struct exception_table_entry *search_exception_tables(unsigned long add); 165const struct exception_table_entry *search_exception_tables(unsigned long add);
161 166
@@ -203,6 +208,15 @@ void *__symbol_get_gpl(const char *symbol);
203#define EXPORT_SYMBOL_GPL_FUTURE(sym) \ 208#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
204 __EXPORT_SYMBOL(sym, "_gpl_future") 209 __EXPORT_SYMBOL(sym, "_gpl_future")
205 210
211
212#ifdef CONFIG_UNUSED_SYMBOLS
213#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
214#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
215#else
216#define EXPORT_UNUSED_SYMBOL(sym)
217#define EXPORT_UNUSED_SYMBOL_GPL(sym)
218#endif
219
206#endif 220#endif
207 221
208struct module_ref 222struct module_ref
@@ -218,17 +232,17 @@ enum module_state
218}; 232};
219 233
220/* Similar stuff for section attributes. */ 234/* Similar stuff for section attributes. */
221#define MODULE_SECT_NAME_LEN 32
222struct module_sect_attr 235struct module_sect_attr
223{ 236{
224 struct module_attribute mattr; 237 struct module_attribute mattr;
225 char name[MODULE_SECT_NAME_LEN]; 238 char *name;
226 unsigned long address; 239 unsigned long address;
227}; 240};
228 241
229struct module_sect_attrs 242struct module_sect_attrs
230{ 243{
231 struct attribute_group grp; 244 struct attribute_group grp;
245 int nsections;
232 struct module_sect_attr attrs[0]; 246 struct module_sect_attr attrs[0];
233}; 247};
234 248
@@ -261,6 +275,15 @@ struct module
261 unsigned int num_gpl_syms; 275 unsigned int num_gpl_syms;
262 const unsigned long *gpl_crcs; 276 const unsigned long *gpl_crcs;
263 277
278 /* unused exported symbols. */
279 const struct kernel_symbol *unused_syms;
280 unsigned int num_unused_syms;
281 const unsigned long *unused_crcs;
282 /* GPL-only, unused exported symbols. */
283 const struct kernel_symbol *unused_gpl_syms;
284 unsigned int num_unused_gpl_syms;
285 const unsigned long *unused_gpl_crcs;
286
264 /* symbols that will be GPL-only in the near future. */ 287 /* symbols that will be GPL-only in the near future. */
265 const struct kernel_symbol *gpl_future_syms; 288 const struct kernel_symbol *gpl_future_syms;
266 unsigned int num_gpl_future_syms; 289 unsigned int num_gpl_future_syms;
@@ -285,6 +308,9 @@ struct module
285 /* The size of the executable code in each section. */ 308 /* The size of the executable code in each section. */
286 unsigned long init_text_size, core_text_size; 309 unsigned long init_text_size, core_text_size;
287 310
311 /* The handle returned from unwind_add_table. */
312 void *unwind_info;
313
288 /* Arch-specific module values */ 314 /* Arch-specific module values */
289 struct mod_arch_specific arch; 315 struct mod_arch_specific arch;
290 316
@@ -337,13 +363,12 @@ static inline int module_is_live(struct module *mod)
337/* Is this address in a module? (second is with no locks, for oops) */ 363/* Is this address in a module? (second is with no locks, for oops) */
338struct module *module_text_address(unsigned long addr); 364struct module *module_text_address(unsigned long addr);
339struct module *__module_text_address(unsigned long addr); 365struct module *__module_text_address(unsigned long addr);
366int is_module_address(unsigned long addr);
340 367
341/* Returns module and fills in value, defined and namebuf, or NULL if 368/* Returns module and fills in value, defined and namebuf, or NULL if
342 symnum out of range. */ 369 symnum out of range. */
343struct module *module_get_kallsym(unsigned int symnum, 370struct module *module_get_kallsym(unsigned int symnum, unsigned long *value,
344 unsigned long *value, 371 char *type, char *name, size_t namelen);
345 char *type,
346 char namebuf[128]);
347 372
348/* Look for this name: can be of form module:name. */ 373/* Look for this name: can be of form module:name. */
349unsigned long module_kallsyms_lookup_name(const char *name); 374unsigned long module_kallsyms_lookup_name(const char *name);
@@ -453,6 +478,8 @@ void module_remove_driver(struct device_driver *);
453#define EXPORT_SYMBOL(sym) 478#define EXPORT_SYMBOL(sym)
454#define EXPORT_SYMBOL_GPL(sym) 479#define EXPORT_SYMBOL_GPL(sym)
455#define EXPORT_SYMBOL_GPL_FUTURE(sym) 480#define EXPORT_SYMBOL_GPL_FUTURE(sym)
481#define EXPORT_UNUSED_SYMBOL(sym)
482#define EXPORT_UNUSED_SYMBOL_GPL(sym)
456 483
457/* Given an address, look for it in the exception tables. */ 484/* Given an address, look for it in the exception tables. */
458static inline const struct exception_table_entry * 485static inline const struct exception_table_entry *
@@ -473,6 +500,11 @@ static inline struct module *__module_text_address(unsigned long addr)
473 return NULL; 500 return NULL;
474} 501}
475 502
503static inline int is_module_address(unsigned long addr)
504{
505 return 0;
506}
507
476/* Get/put a kernel symbol (calls should be symmetric) */ 508/* Get/put a kernel symbol (calls should be symmetric) */
477#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); }) 509#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
478#define symbol_put(x) do { } while(0) 510#define symbol_put(x) do { } while(0)
@@ -506,8 +538,8 @@ static inline const char *module_address_lookup(unsigned long addr,
506 538
507static inline struct module *module_get_kallsym(unsigned int symnum, 539static inline struct module *module_get_kallsym(unsigned int symnum,
508 unsigned long *value, 540 unsigned long *value,
509 char *type, 541 char *type, char *name,
510 char namebuf[128]) 542 size_t namelen)
511{ 543{
512 return NULL; 544 return NULL;
513} 545}
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 60718f12caa9..403d1a97c512 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -28,6 +28,8 @@ struct namespace;
28#define MNT_NOATIME 0x08 28#define MNT_NOATIME 0x08
29#define MNT_NODIRATIME 0x10 29#define MNT_NODIRATIME 0x10
30 30
31#define MNT_SHRINKABLE 0x100
32
31#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ 33#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
32#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ 34#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
33#define MNT_PNODE_MASK 0x3000 /* propogation flag mask */ 35#define MNT_PNODE_MASK 0x3000 /* propogation flag mask */
@@ -78,12 +80,18 @@ extern struct vfsmount *alloc_vfsmnt(const char *name);
78extern struct vfsmount *do_kern_mount(const char *fstype, int flags, 80extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
79 const char *name, void *data); 81 const char *name, void *data);
80 82
83struct file_system_type;
84extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
85 int flags, const char *name,
86 void *data);
87
81struct nameidata; 88struct nameidata;
82 89
83extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, 90extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
84 int mnt_flags, struct list_head *fslist); 91 int mnt_flags, struct list_head *fslist);
85 92
86extern void mark_mounts_for_expiry(struct list_head *mounts); 93extern void mark_mounts_for_expiry(struct list_head *mounts);
94extern void shrink_submounts(struct vfsmount *mountpoint, struct list_head *mounts);
87 95
88extern spinlock_t vfsmount_lock; 96extern spinlock_t vfsmount_lock;
89extern dev_t name_to_dev_t(char *name); 97extern dev_t name_to_dev_t(char *name);
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index e05d54a90743..7da2cee8e132 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -142,7 +142,7 @@ struct vif_device
142 unsigned long rate_limit; /* Traffic shaping (NI) */ 142 unsigned long rate_limit; /* Traffic shaping (NI) */
143 unsigned char threshold; /* TTL threshold */ 143 unsigned char threshold; /* TTL threshold */
144 unsigned short flags; /* Control flags */ 144 unsigned short flags; /* Control flags */
145 __u32 local,remote; /* Addresses(remote for tunnels)*/ 145 __be32 local,remote; /* Addresses(remote for tunnels)*/
146 int link; /* Physical interface index */ 146 int link; /* Physical interface index */
147}; 147};
148 148
@@ -151,8 +151,8 @@ struct vif_device
151struct mfc_cache 151struct mfc_cache
152{ 152{
153 struct mfc_cache *next; /* Next entry on cache line */ 153 struct mfc_cache *next; /* Next entry on cache line */
154 __u32 mfc_mcastgrp; /* Group the entry belongs to */ 154 __be32 mfc_mcastgrp; /* Group the entry belongs to */
155 __u32 mfc_origin; /* Source of packet */ 155 __be32 mfc_origin; /* Source of packet */
156 vifi_t mfc_parent; /* Source interface */ 156 vifi_t mfc_parent; /* Source interface */
157 int mfc_flags; /* Flags on line */ 157 int mfc_flags; /* Flags on line */
158 158
@@ -179,9 +179,9 @@ struct mfc_cache
179#define MFC_LINES 64 179#define MFC_LINES 64
180 180
181#ifdef __BIG_ENDIAN 181#ifdef __BIG_ENDIAN
182#define MFC_HASH(a,b) ((((a)>>24)^((b)>>26))&(MFC_LINES-1)) 182#define MFC_HASH(a,b) (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
183#else 183#else
184#define MFC_HASH(a,b) (((a)^((b)>>2))&(MFC_LINES-1)) 184#define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
185#endif 185#endif
186 186
187#endif 187#endif
@@ -213,8 +213,8 @@ struct pimreghdr
213{ 213{
214 __u8 type; 214 __u8 type;
215 __u8 reserved; 215 __u8 reserved;
216 __u16 csum; 216 __be16 csum;
217 __u32 flags; 217 __be32 flags;
218}; 218};
219 219
220extern int pim_rcv_v1(struct sk_buff *); 220extern int pim_rcv_v1(struct sk_buff *);
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index d9035c73e5d1..ce6c85815cbd 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_MSDOS_FS_H 1#ifndef _LINUX_MSDOS_FS_H
2#define _LINUX_MSDOS_FS_H 2#define _LINUX_MSDOS_FS_H
3 3
4#include <linux/magic.h>
5
4/* 6/*
5 * The MS-DOS filesystem constants/structures 7 * The MS-DOS filesystem constants/structures
6 */ 8 */
@@ -18,8 +20,6 @@
18#define CT_LE_L(v) cpu_to_le32(v) 20#define CT_LE_L(v) cpu_to_le32(v)
19 21
20 22
21#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */
22
23#define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */ 23#define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */
24#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */ 24#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */
25 25
@@ -204,6 +204,7 @@ struct fat_mount_options {
204 unicode_xlate:1, /* create escape sequences for unhandled Unicode */ 204 unicode_xlate:1, /* create escape sequences for unhandled Unicode */
205 numtail:1, /* Does first alias have a numeric '~1' type tail? */ 205 numtail:1, /* Does first alias have a numeric '~1' type tail? */
206 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */ 206 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */
207 flush:1, /* write things quickly */
207 nocase:1; /* Does this need case conversion? 0=need case conversion*/ 208 nocase:1; /* Does this need case conversion? 0=need case conversion*/
208}; 209};
209 210
@@ -412,6 +413,8 @@ extern int fat_sync_inode(struct inode *inode);
412extern int fat_fill_super(struct super_block *sb, void *data, int silent, 413extern int fat_fill_super(struct super_block *sb, void *data, int silent,
413 struct inode_operations *fs_dir_inode_ops, int isvfat); 414 struct inode_operations *fs_dir_inode_ops, int isvfat);
414 415
416extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
417 struct inode *i2);
415/* fat/misc.c */ 418/* fat/misc.c */
416extern void fat_fs_panic(struct super_block *s, const char *fmt, ...); 419extern void fat_fs_panic(struct super_block *s, const char *fmt, ...);
417extern void fat_clusters_flush(struct super_block *sb); 420extern void fat_clusters_flush(struct super_block *sb);
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 7a7fbe87fef0..1221b7c44158 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -19,21 +19,21 @@
19 19
20/** 20/**
21 * struct nand_bbt_descr - bad block table descriptor 21 * struct nand_bbt_descr - bad block table descriptor
22 * @param options options for this descriptor 22 * @options: options for this descriptor
23 * @param pages the page(s) where we find the bbt, used with 23 * @pages: the page(s) where we find the bbt, used with
24 * option BBT_ABSPAGE when bbt is searched, 24 * option BBT_ABSPAGE when bbt is searched,
25 * then we store the found bbts pages here. 25 * then we store the found bbts pages here.
26 * Its an array and supports up to 8 chips now 26 * Its an array and supports up to 8 chips now
27 * @param offs offset of the pattern in the oob area of the page 27 * @offs: offset of the pattern in the oob area of the page
28 * @param veroffs offset of the bbt version counter in the oob are of the page 28 * @veroffs: offset of the bbt version counter in the oob area of the page
29 * @param version version read from the bbt page during scan 29 * @version: version read from the bbt page during scan
30 * @param len length of the pattern, if 0 no pattern check is performed 30 * @len: length of the pattern, if 0 no pattern check is performed
31 * @param maxblocks maximum number of blocks to search for a bbt. This number of 31 * @maxblocks: maximum number of blocks to search for a bbt. This
32 * blocks is reserved at the end of the device 32 * number of blocks is reserved at the end of the device
33 * where the tables are written. 33 * where the tables are written.
34 * @param reserved_block_code if non-0, this pattern denotes a reserved 34 * @reserved_block_code: if non-0, this pattern denotes a reserved
35 * (rather than bad) block in the stored bbt 35 * (rather than bad) block in the stored bbt
36 * @param pattern pattern to identify bad block table or factory marked 36 * @pattern: pattern to identify bad block table or factory marked
37 * good / bad blocks, can be NULL, if len = 0 37 * good / bad blocks, can be NULL, if len = 0
38 * 38 *
39 * Descriptor for the bad block table marker and the descriptor for the 39 * Descriptor for the bad block table marker and the descriptor for the
@@ -93,12 +93,15 @@ struct nand_bbt_descr {
93#define ONENAND_BADBLOCK_POS 0 93#define ONENAND_BADBLOCK_POS 0
94 94
95/** 95/**
96 * struct bbt_info - [GENERIC] Bad Block Table data structure 96 * struct bbm_info - [GENERIC] Bad Block Table data structure
97 * @param bbt_erase_shift [INTERN] number of address bits in a bbt entry 97 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
98 * @param badblockpos [INTERN] position of the bad block marker in the oob area 98 * @badblockpos: [INTERN] position of the bad block marker in the oob area
99 * @param bbt [INTERN] bad block table pointer 99 * @options: options for this descriptor
100 * @param badblock_pattern [REPLACEABLE] bad block scan pattern used for initial bad block scan 100 * @bbt: [INTERN] bad block table pointer
101 * @param priv [OPTIONAL] pointer to private bbm date 101 * @isbad_bbt: function to determine if a block is bad
102 * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for
103 * initial bad block scan
104 * @priv: [OPTIONAL] pointer to private bbm date
102 */ 105 */
103struct bbm_info { 106struct bbm_info {
104 int bbt_erase_shift; 107 int bbt_erase_shift;
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 09bfae6938b3..123948b14547 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -199,6 +199,18 @@ struct cfi_pri_amdstd {
199 uint8_t TopBottom; 199 uint8_t TopBottom;
200} __attribute__((packed)); 200} __attribute__((packed));
201 201
202/* Vendor-Specific PRI for Atmel chips (command set 0x0002) */
203
204struct cfi_pri_atmel {
205 uint8_t pri[3];
206 uint8_t MajorVersion;
207 uint8_t MinorVersion;
208 uint8_t Features;
209 uint8_t BottomBoot;
210 uint8_t BurstMode;
211 uint8_t PageMode;
212} __attribute__((packed));
213
202struct cfi_pri_query { 214struct cfi_pri_query {
203 uint8_t NumFields; 215 uint8_t NumFields;
204 uint32_t ProtField[1]; /* Not host ordered */ 216 uint32_t ProtField[1]; /* Not host ordered */
@@ -464,6 +476,7 @@ struct cfi_fixup {
464#define CFI_ID_ANY 0xffff 476#define CFI_ID_ANY 0xffff
465 477
466#define CFI_MFR_AMD 0x0001 478#define CFI_MFR_AMD 0x0001
479#define CFI_MFR_ATMEL 0x001F
467#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ 480#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
468 481
469void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); 482void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 9b7a2b525d63..94a443d45258 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -77,11 +77,11 @@ typedef enum {
77 * 77 *
78 * @len: number of bytes to write/read. When a data buffer is given 78 * @len: number of bytes to write/read. When a data buffer is given
79 * (datbuf != NULL) this is the number of data bytes. When 79 * (datbuf != NULL) this is the number of data bytes. When
80 + no data buffer is available this is the number of oob bytes. 80 * no data buffer is available this is the number of oob bytes.
81 * 81 *
82 * @retlen: number of bytes written/read. When a data buffer is given 82 * @retlen: number of bytes written/read. When a data buffer is given
83 * (datbuf != NULL) this is the number of data bytes. When 83 * (datbuf != NULL) this is the number of data bytes. When
84 + no data buffer is available this is the number of oob bytes. 84 * no data buffer is available this is the number of oob bytes.
85 * 85 *
86 * @ooblen: number of oob bytes per page 86 * @ooblen: number of oob bytes per page
87 * @ooboffs: offset of oob data in the oob area (only relevant when 87 * @ooboffs: offset of oob data in the oob area (only relevant when
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 66559272ebcb..0b4cd2fa64aa 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -202,7 +202,7 @@ typedef enum {
202struct nand_chip; 202struct nand_chip;
203 203
204/** 204/**
205 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices 205 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
206 * @lock: protection lock 206 * @lock: protection lock
207 * @active: the mtd device which holds the controller currently 207 * @active: the mtd device which holds the controller currently
208 * @wq: wait queue to sleep on if a NAND operation is in progress 208 * @wq: wait queue to sleep on if a NAND operation is in progress
@@ -223,12 +223,15 @@ struct nand_hw_control {
223 * @total: total number of ecc bytes per page 223 * @total: total number of ecc bytes per page
224 * @prepad: padding information for syndrome based ecc generators 224 * @prepad: padding information for syndrome based ecc generators
225 * @postpad: padding information for syndrome based ecc generators 225 * @postpad: padding information for syndrome based ecc generators
226 * @layout: ECC layout control struct pointer
226 * @hwctl: function to control hardware ecc generator. Must only 227 * @hwctl: function to control hardware ecc generator. Must only
227 * be provided if an hardware ECC is available 228 * be provided if an hardware ECC is available
228 * @calculate: function for ecc calculation or readback from ecc hardware 229 * @calculate: function for ecc calculation or readback from ecc hardware
229 * @correct: function for ecc correction, matching to ecc generator (sw/hw) 230 * @correct: function for ecc correction, matching to ecc generator (sw/hw)
230 * @read_page: function to read a page according to the ecc generator requirements 231 * @read_page: function to read a page according to the ecc generator requirements
231 * @write_page: function to write a page according to the ecc generator requirements 232 * @write_page: function to write a page according to the ecc generator requirements
233 * @read_oob: function to read chip OOB data
234 * @write_oob: function to write chip OOB data
232 */ 235 */
233struct nand_ecc_ctrl { 236struct nand_ecc_ctrl {
234 nand_ecc_modes_t mode; 237 nand_ecc_modes_t mode;
@@ -300,11 +303,15 @@ struct nand_buffers {
300 * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip 303 * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip
301 * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready 304 * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready
302 * @ecc: [BOARDSPECIFIC] ecc control ctructure 305 * @ecc: [BOARDSPECIFIC] ecc control ctructure
306 * @buffers: buffer structure for read/write
307 * @hwcontrol: platform-specific hardware control structure
308 * @ops: oob operation operands
303 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support 309 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support
304 * @scan_bbt: [REPLACEABLE] function to scan bad block table 310 * @scan_bbt: [REPLACEABLE] function to scan bad block table
305 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) 311 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR)
306 * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress 312 * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress
307 * @state: [INTERN] the current state of the NAND device 313 * @state: [INTERN] the current state of the NAND device
314 * @oob_poi: poison value buffer
308 * @page_shift: [INTERN] number of address bits in a page (column address bits) 315 * @page_shift: [INTERN] number of address bits in a page (column address bits)
309 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock 316 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock
310 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry 317 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
@@ -400,7 +407,6 @@ struct nand_chip {
400 407
401/** 408/**
402 * struct nand_flash_dev - NAND Flash Device ID Structure 409 * struct nand_flash_dev - NAND Flash Device ID Structure
403 *
404 * @name: Identify the device type 410 * @name: Identify the device type
405 * @id: device ID code 411 * @id: device ID code
406 * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 412 * @pagesize: Pagesize in bytes. Either 256 or 512 or 0
@@ -519,9 +525,8 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
519 525
520/** 526/**
521 * struct platform_nand_chip - chip level device structure 527 * struct platform_nand_chip - chip level device structure
522 *
523 * @nr_chips: max. number of chips to scan for 528 * @nr_chips: max. number of chips to scan for
524 * @chip_offs: chip number offset 529 * @chip_offset: chip number offset
525 * @nr_partitions: number of partitions pointed to by partitions (or zero) 530 * @nr_partitions: number of partitions pointed to by partitions (or zero)
526 * @partitions: mtd partition list 531 * @partitions: mtd partition list
527 * @chip_delay: R/B delay value in us 532 * @chip_delay: R/B delay value in us
@@ -542,11 +547,10 @@ struct platform_nand_chip {
542 547
543/** 548/**
544 * struct platform_nand_ctrl - controller level device structure 549 * struct platform_nand_ctrl - controller level device structure
545 *
546 * @hwcontrol: platform specific hardware control structure 550 * @hwcontrol: platform specific hardware control structure
547 * @dev_ready: platform specific function to read ready/busy pin 551 * @dev_ready: platform specific function to read ready/busy pin
548 * @select_chip: platform specific chip select function 552 * @select_chip: platform specific chip select function
549 * @priv_data: private data to transport driver specific settings 553 * @priv: private data to transport driver specific settings
550 * 554 *
551 * All fields are optional and depend on the hardware driver requirements 555 * All fields are optional and depend on the hardware driver requirements
552 */ 556 */
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 9ce9a48db444..1f4972155249 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -23,7 +23,7 @@ extern int onenand_scan(struct mtd_info *mtd, int max_chips);
23/* Free resources held by the OneNAND device */ 23/* Free resources held by the OneNAND device */
24extern void onenand_release(struct mtd_info *mtd); 24extern void onenand_release(struct mtd_info *mtd);
25 25
26/** 26/*
27 * onenand_state_t - chip states 27 * onenand_state_t - chip states
28 * Enumeration for OneNAND flash chip state 28 * Enumeration for OneNAND flash chip state
29 */ 29 */
@@ -42,9 +42,9 @@ typedef enum {
42 42
43/** 43/**
44 * struct onenand_bufferram - OneNAND BufferRAM Data 44 * struct onenand_bufferram - OneNAND BufferRAM Data
45 * @param block block address in BufferRAM 45 * @block: block address in BufferRAM
46 * @param page page address in BufferRAM 46 * @page: page address in BufferRAM
47 * @param valid valid flag 47 * @valid: valid flag
48 */ 48 */
49struct onenand_bufferram { 49struct onenand_bufferram {
50 int block; 50 int block;
@@ -54,32 +54,43 @@ struct onenand_bufferram {
54 54
55/** 55/**
56 * struct onenand_chip - OneNAND Private Flash Chip Data 56 * struct onenand_chip - OneNAND Private Flash Chip Data
57 * @param base [BOARDSPECIFIC] address to access OneNAND 57 * @base: [BOARDSPECIFIC] address to access OneNAND
58 * @param chipsize [INTERN] the size of one chip for multichip arrays 58 * @chipsize: [INTERN] the size of one chip for multichip arrays
59 * @param device_id [INTERN] device ID 59 * @device_id: [INTERN] device ID
60 * @param verstion_id [INTERN] version ID 60 * @density_mask: chip density, used for DDP devices
61 * @param options [BOARDSPECIFIC] various chip options. They can partly be set to inform onenand_scan about 61 * @verstion_id: [INTERN] version ID
62 * @param erase_shift [INTERN] number of address bits in a block 62 * @options: [BOARDSPECIFIC] various chip options. They can
63 * @param page_shift [INTERN] number of address bits in a page 63 * partly be set to inform onenand_scan about
64 * @param ppb_shift [INTERN] number of address bits in a pages per block 64 * @erase_shift: [INTERN] number of address bits in a block
65 * @param page_mask [INTERN] a page per block mask 65 * @page_shift: [INTERN] number of address bits in a page
66 * @param bufferam_index [INTERN] BufferRAM index 66 * @ppb_shift: [INTERN] number of address bits in a pages per block
67 * @param bufferam [INTERN] BufferRAM info 67 * @page_mask: [INTERN] a page per block mask
68 * @param readw [REPLACEABLE] hardware specific function for read short 68 * @bufferram_index: [INTERN] BufferRAM index
69 * @param writew [REPLACEABLE] hardware specific function for write short 69 * @bufferram: [INTERN] BufferRAM info
70 * @param command [REPLACEABLE] hardware specific function for writing commands to the chip 70 * @readw: [REPLACEABLE] hardware specific function for read short
71 * @param wait [REPLACEABLE] hardware specific function for wait on ready 71 * @writew: [REPLACEABLE] hardware specific function for write short
72 * @param read_bufferram [REPLACEABLE] hardware specific function for BufferRAM Area 72 * @command: [REPLACEABLE] hardware specific function for writing
73 * @param write_bufferram [REPLACEABLE] hardware specific function for BufferRAM Area 73 * commands to the chip
74 * @param read_word [REPLACEABLE] hardware specific function for read register of OneNAND 74 * @wait: [REPLACEABLE] hardware specific function for wait on ready
75 * @param write_word [REPLACEABLE] hardware specific function for write register of OneNAND 75 * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
76 * @param scan_bbt [REPLACEALBE] hardware specific function for scaning Bad block Table 76 * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
77 * @param chip_lock [INTERN] spinlock used to protect access to this structure and the chip 77 * @read_word: [REPLACEABLE] hardware specific function for read
78 * @param wq [INTERN] wait queue to sleep on if a OneNAND operation is in progress 78 * register of OneNAND
79 * @param state [INTERN] the current state of the OneNAND device 79 * @write_word: [REPLACEABLE] hardware specific function for write
80 * @param ecclayout [REPLACEABLE] the default ecc placement scheme 80 * register of OneNAND
81 * @param bbm [REPLACEABLE] pointer to Bad Block Management 81 * @mmcontrol: sync burst read function
82 * @param priv [OPTIONAL] pointer to private chip date 82 * @block_markbad: function to mark a block as bad
83 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning
84 * Bad block Table
85 * @chip_lock: [INTERN] spinlock used to protect access to this
86 * structure and the chip
87 * @wq: [INTERN] wait queue to sleep on if a OneNAND
88 * operation is in progress
89 * @state: [INTERN] the current state of the OneNAND device
90 * @page_buf: data buffer
91 * @ecclayout: [REPLACEABLE] the default ecc placement scheme
92 * @bbm: [REPLACEABLE] pointer to Bad Block Management
93 * @priv: [OPTIONAL] pointer to private chip date
83 */ 94 */
84struct onenand_chip { 95struct onenand_chip {
85 void __iomem *base; 96 void __iomem *base;
@@ -147,9 +158,9 @@ struct onenand_chip {
147#define ONENAND_MFR_SAMSUNG 0xec 158#define ONENAND_MFR_SAMSUNG 0xec
148 159
149/** 160/**
150 * struct nand_manufacturers - NAND Flash Manufacturer ID Structure 161 * struct onenand_manufacturers - NAND Flash Manufacturer ID Structure
151 * @param name: Manufacturer name 162 * @name: Manufacturer name
152 * @param id: manufacturer ID code of device. 163 * @id: manufacturer ID code of device.
153*/ 164*/
154struct onenand_manufacturers { 165struct onenand_manufacturers {
155 int id; 166 int id;
diff --git a/include/linux/mutex-debug.h b/include/linux/mutex-debug.h
index 8b5769f00467..2537285e1064 100644
--- a/include/linux/mutex-debug.h
+++ b/include/linux/mutex-debug.h
@@ -2,22 +2,22 @@
2#define __LINUX_MUTEX_DEBUG_H 2#define __LINUX_MUTEX_DEBUG_H
3 3
4#include <linux/linkage.h> 4#include <linux/linkage.h>
5#include <linux/lockdep.h>
5 6
6/* 7/*
7 * Mutexes - debugging helpers: 8 * Mutexes - debugging helpers:
8 */ 9 */
9 10
10#define __DEBUG_MUTEX_INITIALIZER(lockname) \ 11#define __DEBUG_MUTEX_INITIALIZER(lockname) \
11 , .held_list = LIST_HEAD_INIT(lockname.held_list), \ 12 , .magic = &lockname
12 .name = #lockname , .magic = &lockname
13 13
14#define mutex_init(sem) __mutex_init(sem, __FUNCTION__) 14#define mutex_init(mutex) \
15do { \
16 static struct lock_class_key __key; \
17 \
18 __mutex_init((mutex), #mutex, &__key); \
19} while (0)
15 20
16extern void FASTCALL(mutex_destroy(struct mutex *lock)); 21extern void FASTCALL(mutex_destroy(struct mutex *lock));
17 22
18extern void mutex_debug_show_all_locks(void);
19extern void mutex_debug_show_held_locks(struct task_struct *filter);
20extern void mutex_debug_check_no_locks_held(struct task_struct *task);
21extern void mutex_debug_check_no_locks_freed(const void *from, unsigned long len);
22
23#endif 23#endif
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index f1ac507fa20d..27c48daa3183 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -13,6 +13,7 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/spinlock_types.h> 14#include <linux/spinlock_types.h>
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/lockdep.h>
16 17
17#include <asm/atomic.h> 18#include <asm/atomic.h>
18 19
@@ -50,11 +51,12 @@ struct mutex {
50 struct list_head wait_list; 51 struct list_head wait_list;
51#ifdef CONFIG_DEBUG_MUTEXES 52#ifdef CONFIG_DEBUG_MUTEXES
52 struct thread_info *owner; 53 struct thread_info *owner;
53 struct list_head held_list;
54 unsigned long acquire_ip;
55 const char *name; 54 const char *name;
56 void *magic; 55 void *magic;
57#endif 56#endif
57#ifdef CONFIG_DEBUG_LOCK_ALLOC
58 struct lockdep_map dep_map;
59#endif
58}; 60};
59 61
60/* 62/*
@@ -74,24 +76,34 @@ struct mutex_waiter {
74# include <linux/mutex-debug.h> 76# include <linux/mutex-debug.h>
75#else 77#else
76# define __DEBUG_MUTEX_INITIALIZER(lockname) 78# define __DEBUG_MUTEX_INITIALIZER(lockname)
77# define mutex_init(mutex) __mutex_init(mutex, NULL) 79# define mutex_init(mutex) \
80do { \
81 static struct lock_class_key __key; \
82 \
83 __mutex_init((mutex), #mutex, &__key); \
84} while (0)
78# define mutex_destroy(mutex) do { } while (0) 85# define mutex_destroy(mutex) do { } while (0)
79# define mutex_debug_show_all_locks() do { } while (0) 86#endif
80# define mutex_debug_show_held_locks(p) do { } while (0) 87
81# define mutex_debug_check_no_locks_held(task) do { } while (0) 88#ifdef CONFIG_DEBUG_LOCK_ALLOC
82# define mutex_debug_check_no_locks_freed(from, len) do { } while (0) 89# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \
90 , .dep_map = { .name = #lockname }
91#else
92# define __DEP_MAP_MUTEX_INITIALIZER(lockname)
83#endif 93#endif
84 94
85#define __MUTEX_INITIALIZER(lockname) \ 95#define __MUTEX_INITIALIZER(lockname) \
86 { .count = ATOMIC_INIT(1) \ 96 { .count = ATOMIC_INIT(1) \
87 , .wait_lock = SPIN_LOCK_UNLOCKED \ 97 , .wait_lock = SPIN_LOCK_UNLOCKED \
88 , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \ 98 , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \
89 __DEBUG_MUTEX_INITIALIZER(lockname) } 99 __DEBUG_MUTEX_INITIALIZER(lockname) \
100 __DEP_MAP_MUTEX_INITIALIZER(lockname) }
90 101
91#define DEFINE_MUTEX(mutexname) \ 102#define DEFINE_MUTEX(mutexname) \
92 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname) 103 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
93 104
94extern void fastcall __mutex_init(struct mutex *lock, const char *name); 105extern void __mutex_init(struct mutex *lock, const char *name,
106 struct lock_class_key *key);
95 107
96/*** 108/***
97 * mutex_is_locked - is the mutex locked 109 * mutex_is_locked - is the mutex locked
@@ -110,6 +122,13 @@ static inline int fastcall mutex_is_locked(struct mutex *lock)
110 */ 122 */
111extern void fastcall mutex_lock(struct mutex *lock); 123extern void fastcall mutex_lock(struct mutex *lock);
112extern int fastcall mutex_lock_interruptible(struct mutex *lock); 124extern int fastcall mutex_lock_interruptible(struct mutex *lock);
125
126#ifdef CONFIG_DEBUG_LOCK_ALLOC
127extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
128#else
129# define mutex_lock_nested(lock, subclass) mutex_lock(lock)
130#endif
131
113/* 132/*
114 * NOTE: mutex_trylock() follows the spin_trylock() convention, 133 * NOTE: mutex_trylock() follows the spin_trylock() convention,
115 * not the down_trylock() convention! 134 * not the down_trylock() convention!
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 58cb3d3d44b4..c6470ba00668 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -11,7 +11,7 @@ struct open_intent {
11 struct file *file; 11 struct file *file;
12}; 12};
13 13
14enum { MAX_NESTED_LINKS = 5 }; 14enum { MAX_NESTED_LINKS = 8 };
15 15
16struct nameidata { 16struct nameidata {
17 struct dentry *dentry; 17 struct dentry *dentry;
@@ -54,6 +54,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
54#define LOOKUP_OPEN (0x0100) 54#define LOOKUP_OPEN (0x0100)
55#define LOOKUP_CREATE (0x0200) 55#define LOOKUP_CREATE (0x0200)
56#define LOOKUP_ACCESS (0x0400) 56#define LOOKUP_ACCESS (0x0400)
57#define LOOKUP_CHDIR (0x0800)
57 58
58extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *)); 59extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
59extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *)); 60extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *));
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 1d7cdd20b553..e712e7d47cc2 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -77,11 +77,11 @@ struct nbd_device {
77 * server. All data are in network byte order. 77 * server. All data are in network byte order.
78 */ 78 */
79struct nbd_request { 79struct nbd_request {
80 __u32 magic; 80 __be32 magic;
81 __u32 type; /* == READ || == WRITE */ 81 __be32 type; /* == READ || == WRITE */
82 char handle[8]; 82 char handle[8];
83 __u64 from; 83 __be64 from;
84 __u32 len; 84 __be32 len;
85} 85}
86#ifdef __GNUC__ 86#ifdef __GNUC__
87 __attribute__ ((packed)) 87 __attribute__ ((packed))
@@ -93,8 +93,8 @@ struct nbd_request {
93 * it has completed an I/O request (or an error occurs). 93 * it has completed an I/O request (or an error occurs).
94 */ 94 */
95struct nbd_reply { 95struct nbd_reply {
96 __u32 magic; 96 __be32 magic;
97 __u32 error; /* 0 = ok, else error */ 97 __be32 error; /* 0 = ok, else error */
98 char handle[8]; /* handle you got from request */ 98 char handle[8]; /* handle you got from request */
99}; 99};
100#endif 100#endif
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index b208f0cd556b..02e352be717e 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -11,6 +11,7 @@
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/magic.h>
14 15
15#include <linux/ipx.h> 16#include <linux/ipx.h>
16#include <linux/ncp_no.h> 17#include <linux/ncp_no.h>
@@ -185,10 +186,6 @@ struct ncp_entry_info {
185 __u8 file_handle[6]; 186 __u8 file_handle[6];
186}; 187};
187 188
188/* Guess, what 0x564c is :-) */
189#define NCP_SUPER_MAGIC 0x564c
190
191
192static inline struct ncp_server *NCP_SBP(struct super_block *sb) 189static inline struct ncp_server *NCP_SBP(struct super_block *sb)
193{ 190{
194 return sb->s_fs_info; 191 return sb->s_fs_info;
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
new file mode 100644
index 000000000000..bd3bbf668cdb
--- /dev/null
+++ b/include/linux/neighbour.h
@@ -0,0 +1,159 @@
1#ifndef __LINUX_NEIGHBOUR_H
2#define __LINUX_NEIGHBOUR_H
3
4#include <linux/netlink.h>
5
6struct ndmsg
7{
8 __u8 ndm_family;
9 __u8 ndm_pad1;
10 __u16 ndm_pad2;
11 __s32 ndm_ifindex;
12 __u16 ndm_state;
13 __u8 ndm_flags;
14 __u8 ndm_type;
15};
16
17enum
18{
19 NDA_UNSPEC,
20 NDA_DST,
21 NDA_LLADDR,
22 NDA_CACHEINFO,
23 NDA_PROBES,
24 __NDA_MAX
25};
26
27#define NDA_MAX (__NDA_MAX - 1)
28
29/*
30 * Neighbor Cache Entry Flags
31 */
32
33#define NTF_PROXY 0x08 /* == ATF_PUBL */
34#define NTF_ROUTER 0x80
35
36/*
37 * Neighbor Cache Entry States.
38 */
39
40#define NUD_INCOMPLETE 0x01
41#define NUD_REACHABLE 0x02
42#define NUD_STALE 0x04
43#define NUD_DELAY 0x08
44#define NUD_PROBE 0x10
45#define NUD_FAILED 0x20
46
47/* Dummy states */
48#define NUD_NOARP 0x40
49#define NUD_PERMANENT 0x80
50#define NUD_NONE 0x00
51
52/* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change
53 and make no address resolution or NUD.
54 NUD_PERMANENT is also cannot be deleted by garbage collectors.
55 */
56
57struct nda_cacheinfo
58{
59 __u32 ndm_confirmed;
60 __u32 ndm_used;
61 __u32 ndm_updated;
62 __u32 ndm_refcnt;
63};
64
65/*****************************************************************
66 * Neighbour tables specific messages.
67 *
68 * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the
69 * NLM_F_DUMP flag set. Every neighbour table configuration is
70 * spread over multiple messages to avoid running into message
71 * size limits on systems with many interfaces. The first message
72 * in the sequence transports all not device specific data such as
73 * statistics, configuration, and the default parameter set.
74 * This message is followed by 0..n messages carrying device
75 * specific parameter sets.
76 * Although the ordering should be sufficient, NDTA_NAME can be
77 * used to identify sequences. The initial message can be identified
78 * by checking for NDTA_CONFIG. The device specific messages do
79 * not contain this TLV but have NDTPA_IFINDEX set to the
80 * corresponding interface index.
81 *
82 * To change neighbour table attributes, send RTM_SETNEIGHTBL
83 * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3],
84 * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked
85 * otherwise. Device specific parameter sets can be changed by
86 * setting NDTPA_IFINDEX to the interface index of the corresponding
87 * device.
88 ****/
89
90struct ndt_stats
91{
92 __u64 ndts_allocs;
93 __u64 ndts_destroys;
94 __u64 ndts_hash_grows;
95 __u64 ndts_res_failed;
96 __u64 ndts_lookups;
97 __u64 ndts_hits;
98 __u64 ndts_rcv_probes_mcast;
99 __u64 ndts_rcv_probes_ucast;
100 __u64 ndts_periodic_gc_runs;
101 __u64 ndts_forced_gc_runs;
102};
103
104enum {
105 NDTPA_UNSPEC,
106 NDTPA_IFINDEX, /* u32, unchangeable */
107 NDTPA_REFCNT, /* u32, read-only */
108 NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */
109 NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */
110 NDTPA_RETRANS_TIME, /* u64, msecs */
111 NDTPA_GC_STALETIME, /* u64, msecs */
112 NDTPA_DELAY_PROBE_TIME, /* u64, msecs */
113 NDTPA_QUEUE_LEN, /* u32 */
114 NDTPA_APP_PROBES, /* u32 */
115 NDTPA_UCAST_PROBES, /* u32 */
116 NDTPA_MCAST_PROBES, /* u32 */
117 NDTPA_ANYCAST_DELAY, /* u64, msecs */
118 NDTPA_PROXY_DELAY, /* u64, msecs */
119 NDTPA_PROXY_QLEN, /* u32 */
120 NDTPA_LOCKTIME, /* u64, msecs */
121 __NDTPA_MAX
122};
123#define NDTPA_MAX (__NDTPA_MAX - 1)
124
125struct ndtmsg
126{
127 __u8 ndtm_family;
128 __u8 ndtm_pad1;
129 __u16 ndtm_pad2;
130};
131
132struct ndt_config
133{
134 __u16 ndtc_key_len;
135 __u16 ndtc_entry_size;
136 __u32 ndtc_entries;
137 __u32 ndtc_last_flush; /* delta to now in msecs */
138 __u32 ndtc_last_rand; /* delta to now in msecs */
139 __u32 ndtc_hash_rnd;
140 __u32 ndtc_hash_mask;
141 __u32 ndtc_hash_chain_gc;
142 __u32 ndtc_proxy_qlen;
143};
144
145enum {
146 NDTA_UNSPEC,
147 NDTA_NAME, /* char *, unchangeable */
148 NDTA_THRESH1, /* u32 */
149 NDTA_THRESH2, /* u32 */
150 NDTA_THRESH3, /* u32 */
151 NDTA_CONFIG, /* struct ndt_config, read-only */
152 NDTA_PARMS, /* nested TLV NDTPA_* */
153 NDTA_STATS, /* struct ndt_stats, read-only */
154 NDTA_GC_INTERVAL, /* u64, msecs */
155 __NDTA_MAX
156};
157#define NDTA_MAX (__NDTA_MAX - 1)
158
159#endif
diff --git a/include/linux/net.h b/include/linux/net.h
index 385e68f5bd93..c257f716e00f 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -61,6 +61,7 @@ typedef enum {
61#define SOCK_ASYNC_WAITDATA 1 61#define SOCK_ASYNC_WAITDATA 1
62#define SOCK_NOSPACE 2 62#define SOCK_NOSPACE 2
63#define SOCK_PASSCRED 3 63#define SOCK_PASSCRED 3
64#define SOCK_PASSSEC 4
64 65
65#ifndef ARCH_HAS_SOCKET_TYPES 66#ifndef ARCH_HAS_SOCKET_TYPES
66/** 67/**
@@ -168,11 +169,6 @@ struct proto_ops {
168struct net_proto_family { 169struct net_proto_family {
169 int family; 170 int family;
170 int (*create)(struct socket *sock, int protocol); 171 int (*create)(struct socket *sock, int protocol);
171 /* These are counters for the number of different methods of
172 each we support */
173 short authentication;
174 short encryption;
175 short encrypt_net;
176 struct module *owner; 172 struct module *owner;
177}; 173};
178 174
@@ -180,8 +176,8 @@ struct iovec;
180struct kvec; 176struct kvec;
181 177
182extern int sock_wake_async(struct socket *sk, int how, int band); 178extern int sock_wake_async(struct socket *sk, int how, int band);
183extern int sock_register(struct net_proto_family *fam); 179extern int sock_register(const struct net_proto_family *fam);
184extern int sock_unregister(int family); 180extern void sock_unregister(int family);
185extern int sock_create(int family, int type, int proto, 181extern int sock_create(int family, int type, int proto,
186 struct socket **res); 182 struct socket **res);
187extern int sock_create_kern(int family, int type, int proto, 183extern int sock_create_kern(int family, int type, int proto,
@@ -207,6 +203,25 @@ extern int kernel_recvmsg(struct socket *sock, struct msghdr *msg,
207 struct kvec *vec, size_t num, 203 struct kvec *vec, size_t num,
208 size_t len, int flags); 204 size_t len, int flags);
209 205
206extern int kernel_bind(struct socket *sock, struct sockaddr *addr,
207 int addrlen);
208extern int kernel_listen(struct socket *sock, int backlog);
209extern int kernel_accept(struct socket *sock, struct socket **newsock,
210 int flags);
211extern int kernel_connect(struct socket *sock, struct sockaddr *addr,
212 int addrlen, int flags);
213extern int kernel_getsockname(struct socket *sock, struct sockaddr *addr,
214 int *addrlen);
215extern int kernel_getpeername(struct socket *sock, struct sockaddr *addr,
216 int *addrlen);
217extern int kernel_getsockopt(struct socket *sock, int level, int optname,
218 char *optval, int *optlen);
219extern int kernel_setsockopt(struct socket *sock, int level, int optname,
220 char *optval, int optlen);
221extern int kernel_sendpage(struct socket *sock, struct page *page, int offset,
222 size_t size, int flags);
223extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
224
210#ifndef CONFIG_SMP 225#ifndef CONFIG_SMP
211#define SOCKOPS_WRAPPED(name) name 226#define SOCKOPS_WRAPPED(name) name
212#define SOCKOPS_WRAP(name, fam) 227#define SOCKOPS_WRAP(name, fam)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index bc747e5d7138..9264139bd8df 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -187,7 +187,7 @@ struct hh_cache
187{ 187{
188 struct hh_cache *hh_next; /* Next entry */ 188 struct hh_cache *hh_next; /* Next entry */
189 atomic_t hh_refcnt; /* number of users */ 189 atomic_t hh_refcnt; /* number of users */
190 unsigned short hh_type; /* protocol identifier, f.e ETH_P_IP 190 __be16 hh_type; /* protocol identifier, f.e ETH_P_IP
191 * NOTE: For VLANs, this will be the 191 * NOTE: For VLANs, this will be the
192 * encapuslated type. --BLG 192 * encapuslated type. --BLG
193 */ 193 */
@@ -313,8 +313,15 @@ struct net_device
313 313
314 /* Segmentation offload features */ 314 /* Segmentation offload features */
315#define NETIF_F_GSO_SHIFT 16 315#define NETIF_F_GSO_SHIFT 16
316#define NETIF_F_GSO_MASK 0xffff0000
316#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) 317#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
317#define NETIF_F_UFO (SKB_GSO_UDPV4 << NETIF_F_GSO_SHIFT) 318#define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT)
319#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
320#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
321#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
322
323 /* List of features with software fallbacks. */
324#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
318 325
319#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) 326#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
320#define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) 327#define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM)
@@ -327,7 +334,6 @@ struct net_device
327 334
328 335
329 struct net_device_stats* (*get_stats)(struct net_device *dev); 336 struct net_device_stats* (*get_stats)(struct net_device *dev);
330 struct iw_statistics* (*get_wireless_stats)(struct net_device *dev);
331 337
332 /* List of functions to handle Wireless Extensions (instead of ioctl). 338 /* List of functions to handle Wireless Extensions (instead of ioctl).
333 * See <net/iw_handler.h> for details. Jean II */ 339 * See <net/iw_handler.h> for details. Jean II */
@@ -335,7 +341,7 @@ struct net_device
335 /* Instance data managed by the core of Wireless Extensions. */ 341 /* Instance data managed by the core of Wireless Extensions. */
336 struct iw_public_data * wireless_data; 342 struct iw_public_data * wireless_data;
337 343
338 struct ethtool_ops *ethtool_ops; 344 const struct ethtool_ops *ethtool_ops;
339 345
340 /* 346 /*
341 * This marks the end of the "visible" part of the structure. All 347 * This marks the end of the "visible" part of the structure. All
@@ -543,7 +549,9 @@ struct packet_type {
543 struct net_device *, 549 struct net_device *,
544 struct packet_type *, 550 struct packet_type *,
545 struct net_device *); 551 struct net_device *);
546 struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg); 552 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
553 int features);
554 int (*gso_send_check)(struct sk_buff *skb);
547 void *af_packet_priv; 555 void *af_packet_priv;
548 struct list_head list; 556 struct list_head list;
549}; 557};
@@ -699,7 +707,6 @@ extern int dev_hard_start_xmit(struct sk_buff *skb,
699 707
700extern void dev_init(void); 708extern void dev_init(void);
701 709
702extern int netdev_nit;
703extern int netdev_budget; 710extern int netdev_budget;
704 711
705/* Called by rtnetlink.c:rtnl_unlock() */ 712/* Called by rtnetlink.c:rtnl_unlock() */
@@ -919,10 +926,10 @@ static inline void netif_tx_lock_bh(struct net_device *dev)
919 926
920static inline int netif_tx_trylock(struct net_device *dev) 927static inline int netif_tx_trylock(struct net_device *dev)
921{ 928{
922 int err = spin_trylock(&dev->_xmit_lock); 929 int ok = spin_trylock(&dev->_xmit_lock);
923 if (!err) 930 if (likely(ok))
924 dev->xmit_lock_owner = smp_processor_id(); 931 dev->xmit_lock_owner = smp_processor_id();
925 return err; 932 return ok;
926} 933}
927 934
928static inline void netif_tx_unlock(struct net_device *dev) 935static inline void netif_tx_unlock(struct net_device *dev)
@@ -968,8 +975,8 @@ extern void dev_mcast_init(void);
968extern int netdev_max_backlog; 975extern int netdev_max_backlog;
969extern int weight_p; 976extern int weight_p;
970extern int netdev_set_master(struct net_device *dev, struct net_device *master); 977extern int netdev_set_master(struct net_device *dev, struct net_device *master);
971extern int skb_checksum_help(struct sk_buff *skb, int inward); 978extern int skb_checksum_help(struct sk_buff *skb);
972extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int sg); 979extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features);
973#ifdef CONFIG_BUG 980#ifdef CONFIG_BUG
974extern void netdev_rx_csum_fault(struct net_device *dev); 981extern void netdev_rx_csum_fault(struct net_device *dev);
975#else 982#else
@@ -989,11 +996,51 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
989 996
990extern void linkwatch_run_queue(void); 997extern void linkwatch_run_queue(void);
991 998
999static inline int net_gso_ok(int features, int gso_type)
1000{
1001 int feature = gso_type << NETIF_F_GSO_SHIFT;
1002 return (features & feature) == feature;
1003}
1004
1005static inline int skb_gso_ok(struct sk_buff *skb, int features)
1006{
1007 return net_gso_ok(features, skb_shinfo(skb)->gso_type);
1008}
1009
992static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) 1010static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
993{ 1011{
994 int feature = skb_shinfo(skb)->gso_type << NETIF_F_GSO_SHIFT; 1012 return skb_is_gso(skb) &&
995 return skb_shinfo(skb)->gso_size && 1013 (!skb_gso_ok(skb, dev->features) ||
996 (dev->features & feature) != feature; 1014 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1015}
1016
1017/* On bonding slaves other than the currently active slave, suppress
1018 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
1019 * ARP on active-backup slaves with arp_validate enabled.
1020 */
1021static inline int skb_bond_should_drop(struct sk_buff *skb)
1022{
1023 struct net_device *dev = skb->dev;
1024 struct net_device *master = dev->master;
1025
1026 if (master &&
1027 (dev->priv_flags & IFF_SLAVE_INACTIVE)) {
1028 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1029 skb->protocol == __constant_htons(ETH_P_ARP))
1030 return 0;
1031
1032 if (master->priv_flags & IFF_MASTER_ALB) {
1033 if (skb->pkt_type != PACKET_BROADCAST &&
1034 skb->pkt_type != PACKET_MULTICAST)
1035 return 0;
1036 }
1037 if (master->priv_flags & IFF_MASTER_8023AD &&
1038 skb->protocol == __constant_htons(ETH_P_SLOW))
1039 return 0;
1040
1041 return 1;
1042 }
1043 return 0;
997} 1044}
998 1045
999#endif /* __KERNEL__ */ 1046#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 10168e26a846..b7e67d1d4382 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -282,6 +282,12 @@ extern void nf_invalidate_cache(int pf);
282 Returns true or false. */ 282 Returns true or false. */
283extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); 283extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len);
284 284
285extern u_int16_t nf_csum_update(u_int32_t oldval, u_int32_t newval,
286 u_int32_t csum);
287extern u_int16_t nf_proto_csum_update(struct sk_buff *skb,
288 u_int32_t oldval, u_int32_t newval,
289 u_int16_t csum, int pseudohdr);
290
285struct nf_afinfo { 291struct nf_afinfo {
286 unsigned short family; 292 unsigned short family;
287 unsigned int (*checksum)(struct sk_buff *skb, unsigned int hook, 293 unsigned int (*checksum)(struct sk_buff *skb, unsigned int hook,
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
new file mode 100644
index 000000000000..312bd2ffee33
--- /dev/null
+++ b/include/linux/netfilter/Kbuild
@@ -0,0 +1,40 @@
1header-y += nf_conntrack_sctp.h
2header-y += nf_conntrack_tuple_common.h
3header-y += nfnetlink_conntrack.h
4header-y += nfnetlink_log.h
5header-y += nfnetlink_queue.h
6header-y += xt_CLASSIFY.h
7header-y += xt_comment.h
8header-y += xt_connbytes.h
9header-y += xt_connmark.h
10header-y += xt_CONNMARK.h
11header-y += xt_conntrack.h
12header-y += xt_dccp.h
13header-y += xt_dscp.h
14header-y += xt_DSCP.h
15header-y += xt_esp.h
16header-y += xt_helper.h
17header-y += xt_length.h
18header-y += xt_limit.h
19header-y += xt_mac.h
20header-y += xt_mark.h
21header-y += xt_MARK.h
22header-y += xt_multiport.h
23header-y += xt_NFQUEUE.h
24header-y += xt_pkttype.h
25header-y += xt_policy.h
26header-y += xt_realm.h
27header-y += xt_sctp.h
28header-y += xt_state.h
29header-y += xt_string.h
30header-y += xt_tcpmss.h
31header-y += xt_tcpudp.h
32header-y += xt_SECMARK.h
33header-y += xt_CONNSECMARK.h
34
35unifdef-y += nf_conntrack_common.h
36unifdef-y += nf_conntrack_ftp.h
37unifdef-y += nf_conntrack_tcp.h
38unifdef-y += nfnetlink.h
39unifdef-y += x_tables.h
40unifdef-y += xt_physdev.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index d2e4bd7a7a14..9e0dae07861e 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -125,6 +125,10 @@ enum ip_conntrack_events
125 /* Counter highest bit has been set */ 125 /* Counter highest bit has been set */
126 IPCT_COUNTER_FILLING_BIT = 11, 126 IPCT_COUNTER_FILLING_BIT = 11,
127 IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), 127 IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT),
128
129 /* Mark is set */
130 IPCT_MARK_BIT = 12,
131 IPCT_MARK = (1 << IPCT_MARK_BIT),
128}; 132};
129 133
130enum ip_conntrack_expect_events { 134enum ip_conntrack_expect_events {
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index b2feeffde384..6b01ba297727 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -49,6 +49,7 @@ struct ip_ct_tcp
49 u_int32_t last_seq; /* Last sequence number seen in dir */ 49 u_int32_t last_seq; /* Last sequence number seen in dir */
50 u_int32_t last_ack; /* Last sequence number seen in opposite dir */ 50 u_int32_t last_ack; /* Last sequence number seen in opposite dir */
51 u_int32_t last_end; /* Last seq + len */ 51 u_int32_t last_end; /* Last seq + len */
52 u_int16_t last_win; /* Last window advertisement seen in dir */
52}; 53};
53 54
54#endif /* __KERNEL__ */ 55#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 9f5b12cf489b..6d8e3e5a80e9 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -43,7 +43,7 @@ struct nfattr
43 u_int16_t nfa_len; 43 u_int16_t nfa_len;
44 u_int16_t nfa_type; /* we use 15 bits for the type, and the highest 44 u_int16_t nfa_type; /* we use 15 bits for the type, and the highest
45 * bit to indicate whether the payload is nested */ 45 * bit to indicate whether the payload is nested */
46} __attribute__ ((packed)); 46};
47 47
48/* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from 48/* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from
49 * rtnetlink.h, it's time to put this in a generic file */ 49 * rtnetlink.h, it's time to put this in a generic file */
@@ -79,7 +79,7 @@ struct nfgenmsg {
79 u_int8_t nfgen_family; /* AF_xxx */ 79 u_int8_t nfgen_family; /* AF_xxx */
80 u_int8_t version; /* nfnetlink version */ 80 u_int8_t version; /* nfnetlink version */
81 u_int16_t res_id; /* resource id */ 81 u_int16_t res_id; /* resource id */
82} __attribute__ ((packed)); 82};
83 83
84#define NFNETLINK_V0 0 84#define NFNETLINK_V0 0
85 85
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index a7497c7436df..87b92f8b988f 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -19,18 +19,18 @@ struct nfulnl_msg_packet_hdr {
19 u_int16_t hw_protocol; /* hw protocol (network order) */ 19 u_int16_t hw_protocol; /* hw protocol (network order) */
20 u_int8_t hook; /* netfilter hook */ 20 u_int8_t hook; /* netfilter hook */
21 u_int8_t _pad; 21 u_int8_t _pad;
22} __attribute__ ((packed)); 22};
23 23
24struct nfulnl_msg_packet_hw { 24struct nfulnl_msg_packet_hw {
25 u_int16_t hw_addrlen; 25 u_int16_t hw_addrlen;
26 u_int16_t _pad; 26 u_int16_t _pad;
27 u_int8_t hw_addr[8]; 27 u_int8_t hw_addr[8];
28} __attribute__ ((packed)); 28};
29 29
30struct nfulnl_msg_packet_timestamp { 30struct nfulnl_msg_packet_timestamp {
31 aligned_u64 sec; 31 aligned_u64 sec;
32 aligned_u64 usec; 32 aligned_u64 usec;
33} __attribute__ ((packed)); 33};
34 34
35#define NFULNL_PREFIXLEN 30 /* just like old log target */ 35#define NFULNL_PREFIXLEN 30 /* just like old log target */
36 36
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
index 9e774373244c..36af0360b56d 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -22,12 +22,12 @@ struct nfqnl_msg_packet_hw {
22 u_int16_t hw_addrlen; 22 u_int16_t hw_addrlen;
23 u_int16_t _pad; 23 u_int16_t _pad;
24 u_int8_t hw_addr[8]; 24 u_int8_t hw_addr[8];
25} __attribute__ ((packed)); 25};
26 26
27struct nfqnl_msg_packet_timestamp { 27struct nfqnl_msg_packet_timestamp {
28 aligned_u64 sec; 28 aligned_u64 sec;
29 aligned_u64 usec; 29 aligned_u64 usec;
30} __attribute__ ((packed)); 30};
31 31
32enum nfqnl_attr_type { 32enum nfqnl_attr_type {
33 NFQA_UNSPEC, 33 NFQA_UNSPEC,
@@ -49,7 +49,7 @@ enum nfqnl_attr_type {
49struct nfqnl_msg_verdict_hdr { 49struct nfqnl_msg_verdict_hdr {
50 u_int32_t verdict; 50 u_int32_t verdict;
51 u_int32_t id; 51 u_int32_t id;
52} __attribute__ ((packed)); 52};
53 53
54 54
55enum nfqnl_msg_config_cmds { 55enum nfqnl_msg_config_cmds {
@@ -64,7 +64,7 @@ struct nfqnl_msg_config_cmd {
64 u_int8_t command; /* nfqnl_msg_config_cmds */ 64 u_int8_t command; /* nfqnl_msg_config_cmds */
65 u_int8_t _pad; 65 u_int8_t _pad;
66 u_int16_t pf; /* AF_xxx for PF_[UN]BIND */ 66 u_int16_t pf; /* AF_xxx for PF_[UN]BIND */
67} __attribute__ ((packed)); 67};
68 68
69enum nfqnl_config_mode { 69enum nfqnl_config_mode {
70 NFQNL_COPY_NONE, 70 NFQNL_COPY_NONE,
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 48cc32d83f77..04319a76103a 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -138,16 +138,6 @@ struct xt_counters_info
138 138
139#include <linux/netdevice.h> 139#include <linux/netdevice.h>
140 140
141#define ASSERT_READ_LOCK(x)
142#define ASSERT_WRITE_LOCK(x)
143#include <linux/netfilter_ipv4/listhelp.h>
144
145#ifdef CONFIG_COMPAT
146#define COMPAT_TO_USER 1
147#define COMPAT_FROM_USER -1
148#define COMPAT_CALC_SIZE 0
149#endif
150
151struct xt_match 141struct xt_match
152{ 142{
153 struct list_head list; 143 struct list_head list;
@@ -174,21 +164,24 @@ struct xt_match
174 const void *ip, 164 const void *ip,
175 const struct xt_match *match, 165 const struct xt_match *match,
176 void *matchinfo, 166 void *matchinfo,
177 unsigned int matchinfosize,
178 unsigned int hook_mask); 167 unsigned int hook_mask);
179 168
180 /* Called when entry of this type deleted. */ 169 /* Called when entry of this type deleted. */
181 void (*destroy)(const struct xt_match *match, void *matchinfo, 170 void (*destroy)(const struct xt_match *match, void *matchinfo);
182 unsigned int matchinfosize);
183 171
184 /* Called when userspace align differs from kernel space one */ 172 /* Called when userspace align differs from kernel space one */
185 int (*compat)(void *match, void **dstptr, int *size, int convert); 173 void (*compat_from_user)(void *dst, void *src);
174 int (*compat_to_user)(void __user *dst, void *src);
186 175
187 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 176 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
188 struct module *me; 177 struct module *me;
189 178
179 /* Free to use by each match */
180 unsigned long data;
181
190 char *table; 182 char *table;
191 unsigned int matchsize; 183 unsigned int matchsize;
184 unsigned int compatsize;
192 unsigned int hooks; 185 unsigned int hooks;
193 unsigned short proto; 186 unsigned short proto;
194 187
@@ -211,8 +204,7 @@ struct xt_target
211 const struct net_device *out, 204 const struct net_device *out,
212 unsigned int hooknum, 205 unsigned int hooknum,
213 const struct xt_target *target, 206 const struct xt_target *target,
214 const void *targinfo, 207 const void *targinfo);
215 void *userdata);
216 208
217 /* Called when user tries to insert an entry of this type: 209 /* Called when user tries to insert an entry of this type:
218 hook_mask is a bitmask of hooks from which it can be 210 hook_mask is a bitmask of hooks from which it can be
@@ -222,21 +214,21 @@ struct xt_target
222 const void *entry, 214 const void *entry,
223 const struct xt_target *target, 215 const struct xt_target *target,
224 void *targinfo, 216 void *targinfo,
225 unsigned int targinfosize,
226 unsigned int hook_mask); 217 unsigned int hook_mask);
227 218
228 /* Called when entry of this type deleted. */ 219 /* Called when entry of this type deleted. */
229 void (*destroy)(const struct xt_target *target, void *targinfo, 220 void (*destroy)(const struct xt_target *target, void *targinfo);
230 unsigned int targinfosize);
231 221
232 /* Called when userspace align differs from kernel space one */ 222 /* Called when userspace align differs from kernel space one */
233 int (*compat)(void *target, void **dstptr, int *size, int convert); 223 void (*compat_from_user)(void *dst, void *src);
224 int (*compat_to_user)(void __user *dst, void *src);
234 225
235 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 226 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
236 struct module *me; 227 struct module *me;
237 228
238 char *table; 229 char *table;
239 unsigned int targetsize; 230 unsigned int targetsize;
231 unsigned int compatsize;
240 unsigned int hooks; 232 unsigned int hooks;
241 unsigned short proto; 233 unsigned short proto;
242 234
@@ -290,8 +282,13 @@ struct xt_table_info
290 282
291extern int xt_register_target(struct xt_target *target); 283extern int xt_register_target(struct xt_target *target);
292extern void xt_unregister_target(struct xt_target *target); 284extern void xt_unregister_target(struct xt_target *target);
285extern int xt_register_targets(struct xt_target *target, unsigned int n);
286extern void xt_unregister_targets(struct xt_target *target, unsigned int n);
287
293extern int xt_register_match(struct xt_match *target); 288extern int xt_register_match(struct xt_match *target);
294extern void xt_unregister_match(struct xt_match *target); 289extern void xt_unregister_match(struct xt_match *target);
290extern int xt_register_matches(struct xt_match *match, unsigned int n);
291extern void xt_unregister_matches(struct xt_match *match, unsigned int n);
295 292
296extern int xt_check_match(const struct xt_match *match, unsigned short family, 293extern int xt_check_match(const struct xt_match *match, unsigned short family,
297 unsigned int size, const char *table, unsigned int hook, 294 unsigned int size, const char *table, unsigned int hook,
@@ -388,9 +385,18 @@ struct compat_xt_counters_info
388 385
389extern void xt_compat_lock(int af); 386extern void xt_compat_lock(int af);
390extern void xt_compat_unlock(int af); 387extern void xt_compat_unlock(int af);
391extern int xt_compat_match(void *match, void **dstptr, int *size, int convert); 388
392extern int xt_compat_target(void *target, void **dstptr, int *size, 389extern int xt_compat_match_offset(struct xt_match *match);
393 int convert); 390extern void xt_compat_match_from_user(struct xt_entry_match *m,
391 void **dstptr, int *size);
392extern int xt_compat_match_to_user(struct xt_entry_match *m,
393 void __user **dstptr, int *size);
394
395extern int xt_compat_target_offset(struct xt_target *target);
396extern void xt_compat_target_from_user(struct xt_entry_target *t,
397 void **dstptr, int *size);
398extern int xt_compat_target_to_user(struct xt_entry_target *t,
399 void __user **dstptr, int *size);
394 400
395#endif /* CONFIG_COMPAT */ 401#endif /* CONFIG_COMPAT */
396#endif /* __KERNEL__ */ 402#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter/xt_DSCP.h b/include/linux/netfilter/xt_DSCP.h
new file mode 100644
index 000000000000..3c7c963997bd
--- /dev/null
+++ b/include/linux/netfilter/xt_DSCP.h
@@ -0,0 +1,20 @@
1/* x_tables module for setting the IPv4/IPv6 DSCP field
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com>
5 * This software is distributed under GNU GPL v2, 1991
6 *
7 * See RFC2474 for a description of the DSCP field within the IP Header.
8 *
9 * xt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp
10*/
11#ifndef _XT_DSCP_TARGET_H
12#define _XT_DSCP_TARGET_H
13#include <linux/netfilter/xt_dscp.h>
14
15/* target info */
16struct xt_DSCP_info {
17 u_int8_t dscp;
18};
19
20#endif /* _XT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter/xt_dscp.h b/include/linux/netfilter/xt_dscp.h
new file mode 100644
index 000000000000..1da61e6acaf7
--- /dev/null
+++ b/include/linux/netfilter/xt_dscp.h
@@ -0,0 +1,23 @@
1/* x_tables module for matching the IPv4/IPv6 DSCP field
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 * This software is distributed under GNU GPL v2, 1991
5 *
6 * See RFC2474 for a description of the DSCP field within the IP Header.
7 *
8 * xt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp
9*/
10#ifndef _XT_DSCP_H
11#define _XT_DSCP_H
12
13#define XT_DSCP_MASK 0xfc /* 11111100 */
14#define XT_DSCP_SHIFT 2
15#define XT_DSCP_MAX 0x3f /* 00111111 */
16
17/* match info */
18struct xt_dscp_info {
19 u_int8_t dscp;
20 u_int8_t invert;
21};
22
23#endif /* _XT_DSCP_H */
diff --git a/include/linux/netfilter_arp/Kbuild b/include/linux/netfilter_arp/Kbuild
new file mode 100644
index 000000000000..4f13dfcb92ea
--- /dev/null
+++ b/include/linux/netfilter_arp/Kbuild
@@ -0,0 +1,3 @@
1header-y += arpt_mangle.h
2
3unifdef-y += arp_tables.h
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 62cc27daca4e..44e39b61d9e7 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -46,11 +46,11 @@ struct arpt_arp {
46 struct arpt_devaddr_info tgt_devaddr; 46 struct arpt_devaddr_info tgt_devaddr;
47 47
48 /* ARP operation code. */ 48 /* ARP operation code. */
49 u_int16_t arpop, arpop_mask; 49 __be16 arpop, arpop_mask;
50 50
51 /* ARP hardware address and protocol address format. */ 51 /* ARP hardware address and protocol address format. */
52 u_int16_t arhrd, arhrd_mask; 52 __be16 arhrd, arhrd_mask;
53 u_int16_t arpro, arpro_mask; 53 __be16 arpro, arpro_mask;
54 54
55 /* The protocol address length is only accepted if it is 4 55 /* The protocol address length is only accepted if it is 4
56 * so there is no use in offering a way to do filtering on it. 56 * so there is no use in offering a way to do filtering on it.
@@ -248,8 +248,7 @@ extern unsigned int arpt_do_table(struct sk_buff **pskb,
248 unsigned int hook, 248 unsigned int hook,
249 const struct net_device *in, 249 const struct net_device *in,
250 const struct net_device *out, 250 const struct net_device *out,
251 struct arpt_table *table, 251 struct arpt_table *table);
252 void *userdata);
253 252
254#define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1)) 253#define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1))
255#endif /*__KERNEL__*/ 254#endif /*__KERNEL__*/
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 87764022cc67..9a4dd11af86e 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -5,10 +5,8 @@
5 */ 5 */
6 6
7#include <linux/netfilter.h> 7#include <linux/netfilter.h>
8#if defined(__KERNEL__) && defined(CONFIG_BRIDGE_NETFILTER)
9#include <asm/atomic.h>
10#include <linux/if_ether.h> 8#include <linux/if_ether.h>
11#endif 9#include <linux/if_vlan.h>
12 10
13/* Bridge Hooks */ 11/* Bridge Hooks */
14/* After promisc drops, checksum checks. */ 12/* After promisc drops, checksum checks. */
@@ -48,30 +46,20 @@ enum nf_br_hook_priorities {
48 46
49 47
50/* Only used in br_forward.c */ 48/* Only used in br_forward.c */
51static inline 49extern int nf_bridge_copy_header(struct sk_buff *skb);
52void nf_bridge_maybe_copy_header(struct sk_buff *skb) 50static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
53{ 51{
54 if (skb->nf_bridge) { 52 if (skb->nf_bridge)
55 if (skb->protocol == __constant_htons(ETH_P_8021Q)) { 53 return nf_bridge_copy_header(skb);
56 memcpy(skb->data - 18, skb->nf_bridge->data, 18); 54 return 0;
57 skb_push(skb, 4);
58 } else
59 memcpy(skb->data - 16, skb->nf_bridge->data, 16);
60 }
61} 55}
62 56
63/* This is called by the IP fragmenting code and it ensures there is 57/* This is called by the IP fragmenting code and it ensures there is
64 * enough room for the encapsulating header (if there is one). */ 58 * enough room for the encapsulating header (if there is one). */
65static inline 59static inline int nf_bridge_pad(const struct sk_buff *skb)
66int nf_bridge_pad(struct sk_buff *skb)
67{ 60{
68 if (skb->protocol == __constant_htons(ETH_P_IP)) 61 return (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q))
69 return 0; 62 ? VLAN_HLEN : 0;
70 if (skb->nf_bridge) {
71 if (skb->protocol == __constant_htons(ETH_P_8021Q))
72 return 4;
73 }
74 return 0;
75} 63}
76 64
77struct bridge_skb_cb { 65struct bridge_skb_cb {
@@ -79,6 +67,11 @@ struct bridge_skb_cb {
79 __u32 ipv4; 67 __u32 ipv4;
80 } daddr; 68 } daddr;
81}; 69};
70
71extern int brnf_deferred_hooks;
72#else
73#define nf_bridge_maybe_copy_header(skb) (0)
74#define nf_bridge_pad(skb) (0)
82#endif /* CONFIG_BRIDGE_NETFILTER */ 75#endif /* CONFIG_BRIDGE_NETFILTER */
83 76
84#endif /* __KERNEL__ */ 77#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter_bridge/Kbuild b/include/linux/netfilter_bridge/Kbuild
new file mode 100644
index 000000000000..76ff4c47d8c4
--- /dev/null
+++ b/include/linux/netfilter_bridge/Kbuild
@@ -0,0 +1,17 @@
1header-y += ebt_among.h
2header-y += ebt_arp.h
3header-y += ebt_arpreply.h
4header-y += ebt_ip.h
5header-y += ebt_limit.h
6header-y += ebt_log.h
7header-y += ebt_mark_m.h
8header-y += ebt_mark_t.h
9header-y += ebt_nat.h
10header-y += ebt_pkttype.h
11header-y += ebt_redirect.h
12header-y += ebt_stp.h
13header-y += ebt_ulog.h
14header-y += ebt_vlan.h
15
16unifdef-y += ebtables.h
17unifdef-y += ebt_802_3.h
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
new file mode 100644
index 000000000000..591c1a809c00
--- /dev/null
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -0,0 +1,63 @@
1header-y += ip_conntrack_helper.h
2header-y += ip_conntrack_helper_h323_asn1.h
3header-y += ip_conntrack_helper_h323_types.h
4header-y += ip_conntrack_protocol.h
5header-y += ip_conntrack_sctp.h
6header-y += ip_conntrack_tcp.h
7header-y += ip_conntrack_tftp.h
8header-y += ip_nat_pptp.h
9header-y += ipt_addrtype.h
10header-y += ipt_ah.h
11header-y += ipt_CLASSIFY.h
12header-y += ipt_CLUSTERIP.h
13header-y += ipt_comment.h
14header-y += ipt_connbytes.h
15header-y += ipt_connmark.h
16header-y += ipt_CONNMARK.h
17header-y += ipt_conntrack.h
18header-y += ipt_dccp.h
19header-y += ipt_dscp.h
20header-y += ipt_DSCP.h
21header-y += ipt_ecn.h
22header-y += ipt_ECN.h
23header-y += ipt_esp.h
24header-y += ipt_hashlimit.h
25header-y += ipt_helper.h
26header-y += ipt_iprange.h
27header-y += ipt_length.h
28header-y += ipt_limit.h
29header-y += ipt_LOG.h
30header-y += ipt_mac.h
31header-y += ipt_mark.h
32header-y += ipt_MARK.h
33header-y += ipt_multiport.h
34header-y += ipt_NFQUEUE.h
35header-y += ipt_owner.h
36header-y += ipt_physdev.h
37header-y += ipt_pkttype.h
38header-y += ipt_policy.h
39header-y += ipt_realm.h
40header-y += ipt_recent.h
41header-y += ipt_REJECT.h
42header-y += ipt_SAME.h
43header-y += ipt_sctp.h
44header-y += ipt_state.h
45header-y += ipt_string.h
46header-y += ipt_tcpmss.h
47header-y += ipt_TCPMSS.h
48header-y += ipt_tos.h
49header-y += ipt_TOS.h
50header-y += ipt_ttl.h
51header-y += ipt_TTL.h
52header-y += ipt_ULOG.h
53
54unifdef-y += ip_conntrack.h
55unifdef-y += ip_conntrack_h323.h
56unifdef-y += ip_conntrack_irc.h
57unifdef-y += ip_conntrack_pptp.h
58unifdef-y += ip_conntrack_proto_gre.h
59unifdef-y += ip_conntrack_tuple.h
60unifdef-y += ip_nat.h
61unifdef-y += ip_nat_rule.h
62unifdef-y += ip_queue.h
63unifdef-y += ip_tables.h
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index 51dbec1892c8..64e868034c4a 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -157,7 +157,7 @@ struct ip_conntrack_expect
157 unsigned int flags; 157 unsigned int flags;
158 158
159#ifdef CONFIG_IP_NF_NAT_NEEDED 159#ifdef CONFIG_IP_NF_NAT_NEEDED
160 u_int32_t saved_ip; 160 __be32 saved_ip;
161 /* This is the original per-proto part, used to map the 161 /* This is the original per-proto part, used to map the
162 * expected connection the way the recipient expects. */ 162 * expected connection the way the recipient expects. */
163 union ip_conntrack_manip_proto saved_proto; 163 union ip_conntrack_manip_proto saved_proto;
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
index 3cbff7379002..943cc6a4871d 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
@@ -30,7 +30,7 @@ struct ip_ct_h323_master {
30struct ip_conntrack_expect; 30struct ip_conntrack_expect;
31 31
32extern int get_h225_addr(unsigned char *data, TransportAddress * addr, 32extern int get_h225_addr(unsigned char *data, TransportAddress * addr,
33 u_int32_t * ip, u_int16_t * port); 33 __be32 * ip, u_int16_t * port);
34extern void ip_conntrack_h245_expect(struct ip_conntrack *new, 34extern void ip_conntrack_h245_expect(struct ip_conntrack *new,
35 struct ip_conntrack_expect *this); 35 struct ip_conntrack_expect *this);
36extern void ip_conntrack_q931_expect(struct ip_conntrack *new, 36extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
@@ -38,11 +38,11 @@ extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
38extern int (*set_h245_addr_hook) (struct sk_buff ** pskb, 38extern int (*set_h245_addr_hook) (struct sk_buff ** pskb,
39 unsigned char **data, int dataoff, 39 unsigned char **data, int dataoff,
40 H245_TransportAddress * addr, 40 H245_TransportAddress * addr,
41 u_int32_t ip, u_int16_t port); 41 __be32 ip, u_int16_t port);
42extern int (*set_h225_addr_hook) (struct sk_buff ** pskb, 42extern int (*set_h225_addr_hook) (struct sk_buff ** pskb,
43 unsigned char **data, int dataoff, 43 unsigned char **data, int dataoff,
44 TransportAddress * addr, 44 TransportAddress * addr,
45 u_int32_t ip, u_int16_t port); 45 __be32 ip, u_int16_t port);
46extern int (*set_sig_addr_hook) (struct sk_buff ** pskb, 46extern int (*set_sig_addr_hook) (struct sk_buff ** pskb,
47 struct ip_conntrack * ct, 47 struct ip_conntrack * ct,
48 enum ip_conntrack_info ctinfo, 48 enum ip_conntrack_info ctinfo,
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
index 8d69279ccfe4..77fe868d36ff 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
@@ -25,6 +25,8 @@ struct ip_conntrack_helper
25 struct ip_conntrack *ct, 25 struct ip_conntrack *ct,
26 enum ip_conntrack_info conntrackinfo); 26 enum ip_conntrack_info conntrackinfo);
27 27
28 void (*destroy)(struct ip_conntrack *ct);
29
28 int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct); 30 int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct);
29}; 31};
30 32
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
index 816144c75de0..2644b1faddd6 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
@@ -31,8 +31,8 @@ struct ip_ct_pptp_master {
31 /* everything below is going to be per-expectation in newnat, 31 /* everything below is going to be per-expectation in newnat,
32 * since there could be more than one call within one session */ 32 * since there could be more than one call within one session */
33 enum pptp_ctrlcall_state cstate; /* call state */ 33 enum pptp_ctrlcall_state cstate; /* call state */
34 u_int16_t pac_call_id; /* call id of PAC, host byte order */ 34 __be16 pac_call_id; /* call id of PAC, host byte order */
35 u_int16_t pns_call_id; /* call id of PNS, host byte order */ 35 __be16 pns_call_id; /* call id of PNS, host byte order */
36 36
37 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack 37 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
38 * and therefore imposes a fixed limit on the number of maps */ 38 * and therefore imposes a fixed limit on the number of maps */
@@ -42,8 +42,8 @@ struct ip_ct_pptp_master {
42/* conntrack_expect private member */ 42/* conntrack_expect private member */
43struct ip_ct_pptp_expect { 43struct ip_ct_pptp_expect {
44 enum pptp_ctrlcall_state cstate; /* call state */ 44 enum pptp_ctrlcall_state cstate; /* call state */
45 u_int16_t pac_call_id; /* call id of PAC */ 45 __be16 pac_call_id; /* call id of PAC */
46 u_int16_t pns_call_id; /* call id of PNS */ 46 __be16 pns_call_id; /* call id of PNS */
47}; 47};
48 48
49 49
@@ -107,8 +107,7 @@ struct PptpControlHeader {
107 107
108struct PptpStartSessionRequest { 108struct PptpStartSessionRequest {
109 __be16 protocolVersion; 109 __be16 protocolVersion;
110 __u8 reserved1; 110 __u16 reserved1;
111 __u8 reserved2;
112 __be32 framingCapability; 111 __be32 framingCapability;
113 __be32 bearerCapability; 112 __be32 bearerCapability;
114 __be16 maxChannels; 113 __be16 maxChannels;
@@ -143,6 +142,8 @@ struct PptpStartSessionReply {
143 142
144struct PptpStopSessionRequest { 143struct PptpStopSessionRequest {
145 __u8 reason; 144 __u8 reason;
145 __u8 reserved1;
146 __u16 reserved2;
146}; 147};
147 148
148/* PptpStopSessionResultCode */ 149/* PptpStopSessionResultCode */
@@ -152,6 +153,7 @@ struct PptpStopSessionRequest {
152struct PptpStopSessionReply { 153struct PptpStopSessionReply {
153 __u8 resultCode; 154 __u8 resultCode;
154 __u8 generalErrorCode; 155 __u8 generalErrorCode;
156 __u16 reserved1;
155}; 157};
156 158
157struct PptpEchoRequest { 159struct PptpEchoRequest {
@@ -188,9 +190,8 @@ struct PptpOutCallRequest {
188 __be32 framingType; 190 __be32 framingType;
189 __be16 packetWindow; 191 __be16 packetWindow;
190 __be16 packetProcDelay; 192 __be16 packetProcDelay;
191 __u16 reserved1;
192 __be16 phoneNumberLength; 193 __be16 phoneNumberLength;
193 __u16 reserved2; 194 __u16 reserved1;
194 __u8 phoneNumber[64]; 195 __u8 phoneNumber[64];
195 __u8 subAddress[64]; 196 __u8 subAddress[64];
196}; 197};
@@ -285,19 +286,19 @@ struct PptpSetLinkInfo {
285}; 286};
286 287
287union pptp_ctrl_union { 288union pptp_ctrl_union {
288 struct PptpStartSessionRequest sreq; 289 struct PptpStartSessionRequest sreq;
289 struct PptpStartSessionReply srep; 290 struct PptpStartSessionReply srep;
290 struct PptpStopSessionRequest streq; 291 struct PptpStopSessionRequest streq;
291 struct PptpStopSessionReply strep; 292 struct PptpStopSessionReply strep;
292 struct PptpOutCallRequest ocreq; 293 struct PptpOutCallRequest ocreq;
293 struct PptpOutCallReply ocack; 294 struct PptpOutCallReply ocack;
294 struct PptpInCallRequest icreq; 295 struct PptpInCallRequest icreq;
295 struct PptpInCallReply icack; 296 struct PptpInCallReply icack;
296 struct PptpInCallConnected iccon; 297 struct PptpInCallConnected iccon;
297 struct PptpClearCallRequest clrreq; 298 struct PptpClearCallRequest clrreq;
298 struct PptpCallDisconnectNotify disc; 299 struct PptpCallDisconnectNotify disc;
299 struct PptpWanErrorNotify wanerr; 300 struct PptpWanErrorNotify wanerr;
300 struct PptpSetLinkInfo setlink; 301 struct PptpSetLinkInfo setlink;
301}; 302};
302 303
303extern int 304extern int
@@ -314,7 +315,7 @@ extern int
314 struct PptpControlHeader *ctlh, 315 struct PptpControlHeader *ctlh,
315 union pptp_ctrl_union *pptpReq); 316 union pptp_ctrl_union *pptpReq);
316 317
317extern int 318extern void
318(*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig, 319(*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig,
319 struct ip_conntrack_expect *exp_reply); 320 struct ip_conntrack_expect *exp_reply);
320 321
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
index 8d090ef82f5f..1d853aa873eb 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
@@ -49,18 +49,18 @@ struct gre_hdr {
49#else 49#else
50#error "Adjust your <asm/byteorder.h> defines" 50#error "Adjust your <asm/byteorder.h> defines"
51#endif 51#endif
52 __u16 protocol; 52 __be16 protocol;
53}; 53};
54 54
55/* modified GRE header for PPTP */ 55/* modified GRE header for PPTP */
56struct gre_hdr_pptp { 56struct gre_hdr_pptp {
57 __u8 flags; /* bitfield */ 57 __u8 flags; /* bitfield */
58 __u8 version; /* should be GRE_VERSION_PPTP */ 58 __u8 version; /* should be GRE_VERSION_PPTP */
59 __u16 protocol; /* should be GRE_PROTOCOL_PPTP */ 59 __be16 protocol; /* should be GRE_PROTOCOL_PPTP */
60 __u16 payload_len; /* size of ppp payload, not inc. gre header */ 60 __be16 payload_len; /* size of ppp payload, not inc. gre header */
61 __u16 call_id; /* peer's call_id for this session */ 61 __be16 call_id; /* peer's call_id for this session */
62 __u32 seq; /* sequence number. Present if S==1 */ 62 __be32 seq; /* sequence number. Present if S==1 */
63 __u32 ack; /* seq number of highest packet recieved by */ 63 __be32 ack; /* seq number of highest packet recieved by */
64 /* sender in this session */ 64 /* sender in this session */
65}; 65};
66 66
@@ -92,13 +92,13 @@ void ip_ct_gre_keymap_destroy(struct ip_conntrack *ct);
92 92
93 93
94/* get pointer to gre key, if present */ 94/* get pointer to gre key, if present */
95static inline u_int32_t *gre_key(struct gre_hdr *greh) 95static inline __be32 *gre_key(struct gre_hdr *greh)
96{ 96{
97 if (!greh->key) 97 if (!greh->key)
98 return NULL; 98 return NULL;
99 if (greh->csum || greh->routing) 99 if (greh->csum || greh->routing)
100 return (u_int32_t *) (greh+sizeof(*greh)+4); 100 return (__be32 *) (greh+sizeof(*greh)+4);
101 return (u_int32_t *) (greh+sizeof(*greh)); 101 return (__be32 *) (greh+sizeof(*greh));
102} 102}
103 103
104/* get pointer ot gre csum, if present */ 104/* get pointer ot gre csum, if present */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
index 2fdabdb4c0ef..c228bde74c33 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
@@ -23,13 +23,13 @@ union ip_conntrack_manip_proto
23 __be16 port; 23 __be16 port;
24 } tcp; 24 } tcp;
25 struct { 25 struct {
26 u_int16_t port; 26 __be16 port;
27 } udp; 27 } udp;
28 struct { 28 struct {
29 u_int16_t id; 29 __be16 id;
30 } icmp; 30 } icmp;
31 struct { 31 struct {
32 u_int16_t port; 32 __be16 port;
33 } sctp; 33 } sctp;
34 struct { 34 struct {
35 __be16 key; /* key is 32bit, pptp only uses 16 */ 35 __be16 key; /* key is 32bit, pptp only uses 16 */
@@ -39,7 +39,7 @@ union ip_conntrack_manip_proto
39/* The manipulable part of the tuple. */ 39/* The manipulable part of the tuple. */
40struct ip_conntrack_manip 40struct ip_conntrack_manip
41{ 41{
42 u_int32_t ip; 42 __be32 ip;
43 union ip_conntrack_manip_proto u; 43 union ip_conntrack_manip_proto u;
44}; 44};
45 45
@@ -50,22 +50,22 @@ struct ip_conntrack_tuple
50 50
51 /* These are the parts of the tuple which are fixed. */ 51 /* These are the parts of the tuple which are fixed. */
52 struct { 52 struct {
53 u_int32_t ip; 53 __be32 ip;
54 union { 54 union {
55 /* Add other protocols here. */ 55 /* Add other protocols here. */
56 u_int16_t all; 56 u_int16_t all;
57 57
58 struct { 58 struct {
59 u_int16_t port; 59 __be16 port;
60 } tcp; 60 } tcp;
61 struct { 61 struct {
62 u_int16_t port; 62 __be16 port;
63 } udp; 63 } udp;
64 struct { 64 struct {
65 u_int8_t type, code; 65 u_int8_t type, code;
66 } icmp; 66 } icmp;
67 struct { 67 struct {
68 u_int16_t port; 68 __be16 port;
69 } sctp; 69 } sctp;
70 struct { 70 struct {
71 __be16 key; /* key is 32bit, 71 __be16 key; /* key is 32bit,
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
index e9f5ed1d9f68..bdf553620ca1 100644
--- a/include/linux/netfilter_ipv4/ip_nat.h
+++ b/include/linux/netfilter_ipv4/ip_nat.h
@@ -33,7 +33,7 @@ struct ip_nat_range
33 unsigned int flags; 33 unsigned int flags;
34 34
35 /* Inclusive: network order. */ 35 /* Inclusive: network order. */
36 u_int32_t min_ip, max_ip; 36 __be32 min_ip, max_ip;
37 37
38 /* Inclusive: network order */ 38 /* Inclusive: network order */
39 union ip_conntrack_manip_proto min, max; 39 union ip_conntrack_manip_proto min, max;
@@ -72,10 +72,6 @@ extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack,
72extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple, 72extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple,
73 const struct ip_conntrack *ignored_conntrack); 73 const struct ip_conntrack *ignored_conntrack);
74 74
75/* Calculate relative checksum. */
76extern u_int16_t ip_nat_cheat_check(u_int32_t oldvalinv,
77 u_int32_t newval,
78 u_int16_t oldcheck);
79#else /* !__KERNEL__: iptables wants this to compile. */ 75#else /* !__KERNEL__: iptables wants this to compile. */
80#define ip_nat_multi_range ip_nat_multi_range_compat 76#define ip_nat_multi_range ip_nat_multi_range_compat
81#endif /*__KERNEL__*/ 77#endif /*__KERNEL__*/
diff --git a/include/linux/netfilter_ipv4/ip_nat_core.h b/include/linux/netfilter_ipv4/ip_nat_core.h
index 30db23f06b03..60566f9fd7b3 100644
--- a/include/linux/netfilter_ipv4/ip_nat_core.h
+++ b/include/linux/netfilter_ipv4/ip_nat_core.h
@@ -11,8 +11,8 @@ extern unsigned int ip_nat_packet(struct ip_conntrack *ct,
11 unsigned int hooknum, 11 unsigned int hooknum,
12 struct sk_buff **pskb); 12 struct sk_buff **pskb);
13 13
14extern int ip_nat_icmp_reply_translation(struct sk_buff **pskb, 14extern int ip_nat_icmp_reply_translation(struct ip_conntrack *ct,
15 struct ip_conntrack *ct, 15 enum ip_conntrack_info ctinfo,
16 enum ip_nat_manip_type manip, 16 unsigned int hooknum,
17 enum ip_conntrack_dir dir); 17 struct sk_buff **pskb);
18#endif /* _IP_NAT_CORE_H */ 18#endif /* _IP_NAT_CORE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_pptp.h b/include/linux/netfilter_ipv4/ip_nat_pptp.h
index eaf66c2e8f93..36668bf0f373 100644
--- a/include/linux/netfilter_ipv4/ip_nat_pptp.h
+++ b/include/linux/netfilter_ipv4/ip_nat_pptp.h
@@ -4,8 +4,8 @@
4 4
5/* conntrack private data */ 5/* conntrack private data */
6struct ip_nat_pptp { 6struct ip_nat_pptp {
7 u_int16_t pns_call_id; /* NAT'ed PNS call id */ 7 __be16 pns_call_id; /* NAT'ed PNS call id */
8 u_int16_t pac_call_id; /* NAT'ed PAC call id */ 8 __be16 pac_call_id; /* NAT'ed PAC call id */
9}; 9};
10 10
11#endif /* _NAT_PPTP_H */ 11#endif /* _NAT_PPTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h
index aa08d68c4841..a03507f465f8 100644
--- a/include/linux/netfilter_ipv4/ip_queue.h
+++ b/include/linux/netfilter_ipv4/ip_queue.h
@@ -26,7 +26,7 @@ typedef struct ipq_packet_msg {
26 unsigned int hook; /* Netfilter hook we rode in on */ 26 unsigned int hook; /* Netfilter hook we rode in on */
27 char indev_name[IFNAMSIZ]; /* Name of incoming interface */ 27 char indev_name[IFNAMSIZ]; /* Name of incoming interface */
28 char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */ 28 char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */
29 unsigned short hw_protocol; /* Hardware protocol (network order) */ 29 __be16 hw_protocol; /* Hardware protocol (network order) */
30 unsigned short hw_type; /* Hardware type */ 30 unsigned short hw_type; /* Hardware type */
31 unsigned char hw_addrlen; /* Hardware address length */ 31 unsigned char hw_addrlen; /* Hardware address length */
32 unsigned char hw_addr[8]; /* Hardware address */ 32 unsigned char hw_addr[8]; /* Hardware address */
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index c0dac16e1902..a536bbdef145 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -312,8 +312,7 @@ extern unsigned int ipt_do_table(struct sk_buff **pskb,
312 unsigned int hook, 312 unsigned int hook,
313 const struct net_device *in, 313 const struct net_device *in,
314 const struct net_device *out, 314 const struct net_device *out,
315 struct ipt_table *table, 315 struct ipt_table *table);
316 void *userdata);
317 316
318#define IPT_ALIGN(s) XT_ALIGN(s) 317#define IPT_ALIGN(s) XT_ALIGN(s)
319 318
diff --git a/include/linux/netfilter_ipv4/ipt_DSCP.h b/include/linux/netfilter_ipv4/ipt_DSCP.h
index b30f510b5bef..3491e524d5ea 100644
--- a/include/linux/netfilter_ipv4/ipt_DSCP.h
+++ b/include/linux/netfilter_ipv4/ipt_DSCP.h
@@ -11,10 +11,8 @@
11#ifndef _IPT_DSCP_TARGET_H 11#ifndef _IPT_DSCP_TARGET_H
12#define _IPT_DSCP_TARGET_H 12#define _IPT_DSCP_TARGET_H
13#include <linux/netfilter_ipv4/ipt_dscp.h> 13#include <linux/netfilter_ipv4/ipt_dscp.h>
14#include <linux/netfilter/xt_DSCP.h>
14 15
15/* target info */ 16#define ipt_DSCP_info xt_DSCP_info
16struct ipt_DSCP_info {
17 u_int8_t dscp;
18};
19 17
20#endif /* _IPT_DSCP_TARGET_H */ 18#endif /* _IPT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter_ipv4/ipt_dscp.h b/include/linux/netfilter_ipv4/ipt_dscp.h
index 2fa6dfe92894..4b82ca912b0e 100644
--- a/include/linux/netfilter_ipv4/ipt_dscp.h
+++ b/include/linux/netfilter_ipv4/ipt_dscp.h
@@ -10,14 +10,12 @@
10#ifndef _IPT_DSCP_H 10#ifndef _IPT_DSCP_H
11#define _IPT_DSCP_H 11#define _IPT_DSCP_H
12 12
13#define IPT_DSCP_MASK 0xfc /* 11111100 */ 13#include <linux/netfilter/xt_dscp.h>
14#define IPT_DSCP_SHIFT 2
15#define IPT_DSCP_MAX 0x3f /* 00111111 */
16 14
17/* match info */ 15#define IPT_DSCP_MASK XT_DSCP_MASK
18struct ipt_dscp_info { 16#define IPT_DSCP_SHIFT XT_DSCP_SHIFT
19 u_int8_t dscp; 17#define IPT_DSCP_MAX XT_DSCP_MAX
20 u_int8_t invert; 18
21}; 19#define ipt_dscp_info xt_dscp_info
22 20
23#endif /* _IPT_DSCP_H */ 21#endif /* _IPT_DSCP_H */
diff --git a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h
index 3ecb3bd63676..34ab0fb736e2 100644
--- a/include/linux/netfilter_ipv4/ipt_iprange.h
+++ b/include/linux/netfilter_ipv4/ipt_iprange.h
@@ -8,7 +8,7 @@
8 8
9struct ipt_iprange { 9struct ipt_iprange {
10 /* Inclusive: network order. */ 10 /* Inclusive: network order. */
11 u_int32_t min_ip, max_ip; 11 __be32 min_ip, max_ip;
12}; 12};
13 13
14struct ipt_iprange_info 14struct ipt_iprange_info
diff --git a/include/linux/netfilter_ipv4/listhelp.h b/include/linux/netfilter_ipv4/listhelp.h
deleted file mode 100644
index 5d92cf044d91..000000000000
--- a/include/linux/netfilter_ipv4/listhelp.h
+++ /dev/null
@@ -1,123 +0,0 @@
1#ifndef _LISTHELP_H
2#define _LISTHELP_H
3#include <linux/list.h>
4
5/* Header to do more comprehensive job than linux/list.h; assume list
6 is first entry in structure. */
7
8/* Return pointer to first true entry, if any, or NULL. A macro
9 required to allow inlining of cmpfn. */
10#define LIST_FIND(head, cmpfn, type, args...) \
11({ \
12 const struct list_head *__i, *__j = NULL; \
13 \
14 ASSERT_READ_LOCK(head); \
15 list_for_each(__i, (head)) \
16 if (cmpfn((const type)__i , ## args)) { \
17 __j = __i; \
18 break; \
19 } \
20 (type)__j; \
21})
22
23#define LIST_FIND_W(head, cmpfn, type, args...) \
24({ \
25 const struct list_head *__i, *__j = NULL; \
26 \
27 ASSERT_WRITE_LOCK(head); \
28 list_for_each(__i, (head)) \
29 if (cmpfn((type)__i , ## args)) { \
30 __j = __i; \
31 break; \
32 } \
33 (type)__j; \
34})
35
36/* Just like LIST_FIND but we search backwards */
37#define LIST_FIND_B(head, cmpfn, type, args...) \
38({ \
39 const struct list_head *__i, *__j = NULL; \
40 \
41 ASSERT_READ_LOCK(head); \
42 list_for_each_prev(__i, (head)) \
43 if (cmpfn((const type)__i , ## args)) { \
44 __j = __i; \
45 break; \
46 } \
47 (type)__j; \
48})
49
50static inline int
51__list_cmp_same(const void *p1, const void *p2) { return p1 == p2; }
52
53/* Is this entry in the list? */
54static inline int
55list_inlist(struct list_head *head, const void *entry)
56{
57 return LIST_FIND(head, __list_cmp_same, void *, entry) != NULL;
58}
59
60/* Delete from list. */
61#ifdef CONFIG_NETFILTER_DEBUG
62#define LIST_DELETE(head, oldentry) \
63do { \
64 ASSERT_WRITE_LOCK(head); \
65 if (!list_inlist(head, oldentry)) \
66 printk("LIST_DELETE: %s:%u `%s'(%p) not in %s.\n", \
67 __FILE__, __LINE__, #oldentry, oldentry, #head); \
68 else list_del((struct list_head *)oldentry); \
69} while(0)
70#else
71#define LIST_DELETE(head, oldentry) list_del((struct list_head *)oldentry)
72#endif
73
74/* Append. */
75static inline void
76list_append(struct list_head *head, void *new)
77{
78 ASSERT_WRITE_LOCK(head);
79 list_add((new), (head)->prev);
80}
81
82/* Prepend. */
83static inline void
84list_prepend(struct list_head *head, void *new)
85{
86 ASSERT_WRITE_LOCK(head);
87 list_add(new, head);
88}
89
90/* Insert according to ordering function; insert before first true. */
91#define LIST_INSERT(head, new, cmpfn) \
92do { \
93 struct list_head *__i; \
94 ASSERT_WRITE_LOCK(head); \
95 list_for_each(__i, (head)) \
96 if ((new), (typeof (new))__i) \
97 break; \
98 list_add((struct list_head *)(new), __i->prev); \
99} while(0)
100
101/* If the field after the list_head is a nul-terminated string, you
102 can use these functions. */
103static inline int __list_cmp_name(const void *i, const char *name)
104{
105 return strcmp(name, i+sizeof(struct list_head)) == 0;
106}
107
108/* Returns false if same name already in list, otherwise does insert. */
109static inline int
110list_named_insert(struct list_head *head, void *new)
111{
112 if (LIST_FIND(head, __list_cmp_name, void *,
113 new + sizeof(struct list_head)))
114 return 0;
115 list_prepend(head, new);
116 return 1;
117}
118
119/* Find this named element in the list. */
120#define list_named_find(head, name) \
121LIST_FIND(head, __list_cmp_name, void *, name)
122
123#endif /*_LISTHELP_H*/
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 52a7b9e76428..d97e268cdfe5 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -73,6 +73,7 @@ enum nf_ip6_hook_priorities {
73}; 73};
74 74
75#ifdef CONFIG_NETFILTER 75#ifdef CONFIG_NETFILTER
76extern int ip6_route_me_harder(struct sk_buff *skb);
76extern unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, 77extern unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
77 unsigned int dataoff, u_int8_t protocol); 78 unsigned int dataoff, u_int8_t protocol);
78 79
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
new file mode 100644
index 000000000000..9dd978d149ff
--- /dev/null
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -0,0 +1,21 @@
1header-y += ip6t_HL.h
2header-y += ip6t_LOG.h
3header-y += ip6t_MARK.h
4header-y += ip6t_REJECT.h
5header-y += ip6t_ah.h
6header-y += ip6t_esp.h
7header-y += ip6t_frag.h
8header-y += ip6t_hl.h
9header-y += ip6t_ipv6header.h
10header-y += ip6t_length.h
11header-y += ip6t_limit.h
12header-y += ip6t_mac.h
13header-y += ip6t_mark.h
14header-y += ip6t_multiport.h
15header-y += ip6t_opts.h
16header-y += ip6t_owner.h
17header-y += ip6t_policy.h
18header-y += ip6t_physdev.h
19header-y += ip6t_rt.h
20
21unifdef-y += ip6_tables.h
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index d0d5d1ee4be3..d7a8e9c0dad0 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -300,8 +300,7 @@ extern unsigned int ip6t_do_table(struct sk_buff **pskb,
300 unsigned int hook, 300 unsigned int hook,
301 const struct net_device *in, 301 const struct net_device *in,
302 const struct net_device *out, 302 const struct net_device *out,
303 struct ip6t_table *table, 303 struct ip6t_table *table);
304 void *userdata);
305 304
306/* Check for an extension */ 305/* Check for an extension */
307extern int ip6t_ext_hdr(u8 nexthdr); 306extern int ip6t_ext_hdr(u8 nexthdr);
diff --git a/include/linux/netfilter_logging.h b/include/linux/netfilter_logging.h
deleted file mode 100644
index 562bb6aad4e1..000000000000
--- a/include/linux/netfilter_logging.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/* Internal logging interface, which relies on the real
2 LOG target modules */
3#ifndef __LINUX_NETFILTER_LOGGING_H
4#define __LINUX_NETFILTER_LOGGING_H
5
6#ifdef __KERNEL__
7#include <asm/atomic.h>
8
9struct nf_logging_t {
10 void (*nf_log_packet)(struct sk_buff **pskb,
11 unsigned int hooknum,
12 const struct net_device *in,
13 const struct net_device *out,
14 const char *prefix);
15 void (*nf_log)(char *pfh, size_t len,
16 const char *prefix);
17};
18
19extern void nf_log_register(int pf, const struct nf_logging_t *logging);
20extern void nf_log_unregister(int pf, const struct nf_logging_t *logging);
21
22extern void nf_log_packet(int pf,
23 struct sk_buff **pskb,
24 unsigned int hooknum,
25 const struct net_device *in,
26 const struct net_device *out,
27 const char *fmt, ...);
28extern void nf_log(int pf,
29 char *pfh, size_t len,
30 const char *fmt, ...);
31#endif /*__KERNEL__*/
32
33#endif /*__LINUX_NETFILTER_LOGGING_H*/
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 855b44668caa..66411622e06e 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -21,6 +21,8 @@
21#define NETLINK_DNRTMSG 14 /* DECnet routing messages */ 21#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
22#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ 22#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
23#define NETLINK_GENERIC 16 23#define NETLINK_GENERIC 16
24/* leave room for NETLINK_DM (DM Events) */
25#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */
24 26
25#define MAX_LINKS 32 27#define MAX_LINKS 32
26 28
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index ca5a8733000f..1efe60c5c00c 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -31,6 +31,7 @@ struct netpoll_info {
31 int rx_flags; 31 int rx_flags;
32 spinlock_t rx_lock; 32 spinlock_t rx_lock;
33 struct netpoll *rx_np; /* netpoll that registered an rx_hook */ 33 struct netpoll *rx_np; /* netpoll that registered an rx_hook */
34 struct sk_buff_head arp_tx; /* list of arp requests to reply to */
34}; 35};
35 36
36void netpoll_poll(struct netpoll *np); 37void netpoll_poll(struct netpoll *np);
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 1059e6d69d3b..db05182ca0e8 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -157,6 +157,12 @@ enum nfs_opnum4 {
157 OP_ILLEGAL = 10044, 157 OP_ILLEGAL = 10044,
158}; 158};
159 159
160/*Defining first and last NFS4 operations implemented.
161Needs to be updated if more operations are defined in future.*/
162
163#define FIRST_NFS4_OP OP_ACCESS
164#define LAST_NFS4_OP OP_RELEASE_LOCKOWNER
165
160enum nfsstat4 { 166enum nfsstat4 {
161 NFS4_OK = 0, 167 NFS4_OK = 0,
162 NFS4ERR_PERM = 1, 168 NFS4ERR_PERM = 1,
@@ -384,6 +390,7 @@ enum {
384 NFSPROC4_CLNT_DELEGRETURN, 390 NFSPROC4_CLNT_DELEGRETURN,
385 NFSPROC4_CLNT_GETACL, 391 NFSPROC4_CLNT_GETACL,
386 NFSPROC4_CLNT_SETACL, 392 NFSPROC4_CLNT_SETACL,
393 NFSPROC4_CLNT_FS_LOCATIONS,
387}; 394};
388 395
389#endif 396#endif
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 7e079f8ce18b..98c9b9f667a5 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -9,6 +9,7 @@
9#ifndef _LINUX_NFS_FS_H 9#ifndef _LINUX_NFS_FS_H
10#define _LINUX_NFS_FS_H 10#define _LINUX_NFS_FS_H
11 11
12#include <linux/magic.h>
12 13
13/* 14/*
14 * Enable debugging support for nfs client. 15 * Enable debugging support for nfs client.
@@ -23,16 +24,6 @@
23#define NFS_MAX_TCP_TIMEOUT (600*HZ) 24#define NFS_MAX_TCP_TIMEOUT (600*HZ)
24 25
25/* 26/*
26 * superblock magic number for NFS
27 */
28#define NFS_SUPER_MAGIC 0x6969
29
30/*
31 * These are the default flags for swap requests
32 */
33#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS)
34
35/*
36 * When flushing a cluster of dirty pages, there can be different 27 * When flushing a cluster of dirty pages, there can be different
37 * strategies: 28 * strategies:
38 */ 29 */
@@ -41,16 +32,17 @@
41#define FLUSH_LOWPRI 8 /* low priority background flush */ 32#define FLUSH_LOWPRI 8 /* low priority background flush */
42#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 33#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
43#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */ 34#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */
35#define FLUSH_INVALIDATE 64 /* Invalidate the page cache */
44 36
45#ifdef __KERNEL__ 37#ifdef __KERNEL__
38
46#include <linux/in.h> 39#include <linux/in.h>
47#include <linux/mm.h> 40#include <linux/mm.h>
48#include <linux/pagemap.h> 41#include <linux/pagemap.h>
42#include <linux/rbtree.h>
49#include <linux/rwsem.h> 43#include <linux/rwsem.h>
50#include <linux/wait.h> 44#include <linux/wait.h>
51 45
52#include <linux/nfs_fs_sb.h>
53
54#include <linux/sunrpc/debug.h> 46#include <linux/sunrpc/debug.h>
55#include <linux/sunrpc/auth.h> 47#include <linux/sunrpc/auth.h>
56#include <linux/sunrpc/clnt.h> 48#include <linux/sunrpc/clnt.h>
@@ -60,13 +52,23 @@
60#include <linux/nfs3.h> 52#include <linux/nfs3.h>
61#include <linux/nfs4.h> 53#include <linux/nfs4.h>
62#include <linux/nfs_xdr.h> 54#include <linux/nfs_xdr.h>
55
56#include <linux/nfs_fs_sb.h>
57
63#include <linux/rwsem.h> 58#include <linux/rwsem.h>
64#include <linux/mempool.h> 59#include <linux/mempool.h>
65 60
66/* 61/*
62 * These are the default flags for swap requests
63 */
64#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS)
65
66/*
67 * NFSv3/v4 Access mode cache entry 67 * NFSv3/v4 Access mode cache entry
68 */ 68 */
69struct nfs_access_entry { 69struct nfs_access_entry {
70 struct rb_node rb_node;
71 struct list_head lru;
70 unsigned long jiffies; 72 unsigned long jiffies;
71 struct rpc_cred * cred; 73 struct rpc_cred * cred;
72 int mask; 74 int mask;
@@ -143,7 +145,9 @@ struct nfs_inode {
143 */ 145 */
144 atomic_t data_updates; 146 atomic_t data_updates;
145 147
146 struct nfs_access_entry cache_access; 148 struct rb_root access_cache;
149 struct list_head access_cache_entry_lru;
150 struct list_head access_cache_inode_lru;
147#ifdef CONFIG_NFS_V3_ACL 151#ifdef CONFIG_NFS_V3_ACL
148 struct posix_acl *acl_access; 152 struct posix_acl *acl_access;
149 struct posix_acl *acl_default; 153 struct posix_acl *acl_default;
@@ -197,6 +201,7 @@ struct nfs_inode {
197#define NFS_INO_REVALIDATING (0) /* revalidating attrs */ 201#define NFS_INO_REVALIDATING (0) /* revalidating attrs */
198#define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */ 202#define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */
199#define NFS_INO_STALE (2) /* possible stale inode */ 203#define NFS_INO_STALE (2) /* possible stale inode */
204#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */
200 205
201static inline struct nfs_inode *NFS_I(struct inode *inode) 206static inline struct nfs_inode *NFS_I(struct inode *inode)
202{ 207{
@@ -207,8 +212,7 @@ static inline struct nfs_inode *NFS_I(struct inode *inode)
207#define NFS_FH(inode) (&NFS_I(inode)->fh) 212#define NFS_FH(inode) (&NFS_I(inode)->fh)
208#define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) 213#define NFS_SERVER(inode) (NFS_SB(inode->i_sb))
209#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) 214#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client)
210#define NFS_PROTO(inode) (NFS_SERVER(inode)->rpc_ops) 215#define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops)
211#define NFS_ADDR(inode) (RPC_PEERADDR(NFS_CLIENT(inode)))
212#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) 216#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf)
213#define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies) 217#define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies)
214#define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr) 218#define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr)
@@ -233,8 +237,12 @@ static inline int nfs_caches_unstable(struct inode *inode)
233 237
234static inline void nfs_mark_for_revalidate(struct inode *inode) 238static inline void nfs_mark_for_revalidate(struct inode *inode)
235{ 239{
240 struct nfs_inode *nfsi = NFS_I(inode);
241
236 spin_lock(&inode->i_lock); 242 spin_lock(&inode->i_lock);
237 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; 243 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS;
244 if (S_ISDIR(inode->i_mode))
245 nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA;
238 spin_unlock(&inode->i_lock); 246 spin_unlock(&inode->i_lock);
239} 247}
240 248
@@ -291,12 +299,13 @@ extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
291extern int nfs_permission(struct inode *, int, struct nameidata *); 299extern int nfs_permission(struct inode *, int, struct nameidata *);
292extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *); 300extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *);
293extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *); 301extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *);
302extern void nfs_access_zap_cache(struct inode *inode);
294extern int nfs_open(struct inode *, struct file *); 303extern int nfs_open(struct inode *, struct file *);
295extern int nfs_release(struct inode *, struct file *); 304extern int nfs_release(struct inode *, struct file *);
296extern int nfs_attribute_timeout(struct inode *inode); 305extern int nfs_attribute_timeout(struct inode *inode);
297extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 306extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
298extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 307extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
299extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 308extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
300extern int nfs_setattr(struct dentry *, struct iattr *); 309extern int nfs_setattr(struct dentry *, struct iattr *);
301extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 310extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
302extern void nfs_begin_attr_update(struct inode *); 311extern void nfs_begin_attr_update(struct inode *);
@@ -324,7 +333,7 @@ extern struct inode_operations nfs_file_inode_operations;
324extern struct inode_operations nfs3_file_inode_operations; 333extern struct inode_operations nfs3_file_inode_operations;
325#endif /* CONFIG_NFS_V3 */ 334#endif /* CONFIG_NFS_V3 */
326extern const struct file_operations nfs_file_operations; 335extern const struct file_operations nfs_file_operations;
327extern struct address_space_operations nfs_file_aops; 336extern const struct address_space_operations nfs_file_aops;
328 337
329static inline struct rpc_cred *nfs_file_cred(struct file *file) 338static inline struct rpc_cred *nfs_file_cred(struct file *file)
330{ 339{
@@ -392,6 +401,15 @@ extern void nfs_unregister_sysctl(void);
392#endif 401#endif
393 402
394/* 403/*
404 * linux/fs/nfs/namespace.c
405 */
406extern struct list_head nfs_automount_list;
407extern struct inode_operations nfs_mountpoint_inode_operations;
408extern struct inode_operations nfs_referral_inode_operations;
409extern int nfs_mountpoint_expiry_timeout;
410extern void nfs_release_automount_timer(void);
411
412/*
395 * linux/fs/nfs/unlink.c 413 * linux/fs/nfs/unlink.c
396 */ 414 */
397extern int nfs_async_unlink(struct dentry *); 415extern int nfs_async_unlink(struct dentry *);
@@ -408,7 +426,7 @@ extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
408extern void nfs_writedata_release(void *); 426extern void nfs_writedata_release(void *);
409 427
410#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 428#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
411struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount); 429struct nfs_write_data *nfs_commit_alloc(void);
412void nfs_commit_free(struct nfs_write_data *p); 430void nfs_commit_free(struct nfs_write_data *p);
413#endif 431#endif
414 432
@@ -457,10 +475,9 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page)
457} 475}
458 476
459/* 477/*
460 * Allocate and free nfs_write_data structures 478 * Allocate nfs_write_data structures
461 */ 479 */
462extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount); 480extern struct nfs_write_data *nfs_writedata_alloc(size_t len);
463extern void nfs_writedata_free(struct nfs_write_data *p);
464 481
465/* 482/*
466 * linux/fs/nfs/read.c 483 * linux/fs/nfs/read.c
@@ -472,10 +489,9 @@ extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
472extern void nfs_readdata_release(void *data); 489extern void nfs_readdata_release(void *data);
473 490
474/* 491/*
475 * Allocate and free nfs_read_data structures 492 * Allocate nfs_read_data structures
476 */ 493 */
477extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount); 494extern struct nfs_read_data *nfs_readdata_alloc(size_t len);
478extern void nfs_readdata_free(struct nfs_read_data *p);
479 495
480/* 496/*
481 * linux/fs/nfs3proc.c 497 * linux/fs/nfs3proc.c
@@ -562,6 +578,7 @@ extern void * nfs_root_data(void);
562#define NFSDBG_FILE 0x0040 578#define NFSDBG_FILE 0x0040
563#define NFSDBG_ROOT 0x0080 579#define NFSDBG_ROOT 0x0080
564#define NFSDBG_CALLBACK 0x0100 580#define NFSDBG_CALLBACK 0x0100
581#define NFSDBG_CLIENT 0x0200
565#define NFSDBG_ALL 0xFFFF 582#define NFSDBG_ALL 0xFFFF
566 583
567#ifdef __KERNEL__ 584#ifdef __KERNEL__
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 65dec21af774..7ccfc7ef0a83 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -7,13 +7,79 @@
7struct nfs_iostats; 7struct nfs_iostats;
8 8
9/* 9/*
10 * The nfs_client identifies our client state to the server.
11 */
12struct nfs_client {
13 atomic_t cl_count;
14 int cl_cons_state; /* current construction state (-ve: init error) */
15#define NFS_CS_READY 0 /* ready to be used */
16#define NFS_CS_INITING 1 /* busy initialising */
17 int cl_nfsversion; /* NFS protocol version */
18 unsigned long cl_res_state; /* NFS resources state */
19#define NFS_CS_RPCIOD 0 /* - rpciod started */
20#define NFS_CS_CALLBACK 1 /* - callback started */
21#define NFS_CS_IDMAP 2 /* - idmap started */
22#define NFS_CS_RENEWD 3 /* - renewd started */
23 struct sockaddr_in cl_addr; /* server identifier */
24 char * cl_hostname; /* hostname of server */
25 struct list_head cl_share_link; /* link in global client list */
26 struct list_head cl_superblocks; /* List of nfs_server structs */
27
28 struct rpc_clnt * cl_rpcclient;
29 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */
30 unsigned long retrans_timeo; /* retransmit timeout */
31 unsigned int retrans_count; /* number of retransmit tries */
32
33#ifdef CONFIG_NFS_V4
34 u64 cl_clientid; /* constant */
35 nfs4_verifier cl_confirm;
36 unsigned long cl_state;
37
38 u32 cl_lockowner_id;
39
40 /*
41 * The following rwsem ensures exclusive access to the server
42 * while we recover the state following a lease expiration.
43 */
44 struct rw_semaphore cl_sem;
45
46 struct list_head cl_delegations;
47 struct list_head cl_state_owners;
48 struct list_head cl_unused;
49 int cl_nunused;
50 spinlock_t cl_lock;
51
52 unsigned long cl_lease_time;
53 unsigned long cl_last_renewal;
54 struct work_struct cl_renewd;
55
56 struct rpc_wait_queue cl_rpcwaitq;
57
58 /* used for the setclientid verifier */
59 struct timespec cl_boot_time;
60
61 /* idmapper */
62 struct idmap * cl_idmap;
63
64 /* Our own IP address, as a null-terminated string.
65 * This is used to generate the clientid, and the callback address.
66 */
67 char cl_ipaddr[16];
68 unsigned char cl_id_uniquifier;
69#endif
70};
71
72/*
10 * NFS client parameters stored in the superblock. 73 * NFS client parameters stored in the superblock.
11 */ 74 */
12struct nfs_server { 75struct nfs_server {
76 struct nfs_client * nfs_client; /* shared client and NFS4 state */
77 struct list_head client_link; /* List of other nfs_server structs
78 * that share the same client
79 */
80 struct list_head master_link; /* link in master servers list */
13 struct rpc_clnt * client; /* RPC client handle */ 81 struct rpc_clnt * client; /* RPC client handle */
14 struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */
15 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 82 struct rpc_clnt * client_acl; /* ACL RPC client handle */
16 struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */
17 struct nfs_iostats * io_stats; /* I/O statistics */ 83 struct nfs_iostats * io_stats; /* I/O statistics */
18 struct backing_dev_info backing_dev_info; 84 struct backing_dev_info backing_dev_info;
19 int flags; /* various flags */ 85 int flags; /* various flags */
@@ -29,23 +95,14 @@ struct nfs_server {
29 unsigned int acregmax; 95 unsigned int acregmax;
30 unsigned int acdirmin; 96 unsigned int acdirmin;
31 unsigned int acdirmax; 97 unsigned int acdirmax;
32 unsigned long retrans_timeo; /* retransmit timeout */
33 unsigned int retrans_count; /* number of retransmit tries */
34 unsigned int namelen; 98 unsigned int namelen;
35 char * hostname; /* remote hostname */ 99
36 struct nfs_fh fh; 100 struct nfs_fsid fsid;
37 struct sockaddr_in addr; 101 __u64 maxfilesize; /* maximum file size */
38 unsigned long mount_time; /* when this fs was mounted */ 102 unsigned long mount_time; /* when this fs was mounted */
103 dev_t s_dev; /* superblock dev numbers */
104
39#ifdef CONFIG_NFS_V4 105#ifdef CONFIG_NFS_V4
40 /* Our own IP address, as a null-terminated string.
41 * This is used to generate the clientid, and the callback address.
42 */
43 char ip_addr[16];
44 char * mnt_path;
45 struct nfs4_client * nfs4_state; /* all NFSv4 state starts here */
46 struct list_head nfs4_siblings; /* List of other nfs_server structs
47 * that share the same clientid
48 */
49 u32 attr_bitmask[2];/* V4 bitmask representing the set 106 u32 attr_bitmask[2];/* V4 bitmask representing the set
50 of attributes supported on this 107 of attributes supported on this
51 filesystem */ 108 filesystem */
@@ -53,6 +110,7 @@ struct nfs_server {
53 that are supported on this 110 that are supported on this
54 filesystem */ 111 filesystem */
55#endif 112#endif
113 void (*destroy)(struct nfs_server *);
56}; 114};
57 115
58/* Server capabilities */ 116/* Server capabilities */
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index 102e56094296..15a9f3b7289a 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -62,15 +62,15 @@ struct idmap_msg {
62#ifdef __KERNEL__ 62#ifdef __KERNEL__
63 63
64/* Forward declaration to make this header independent of others */ 64/* Forward declaration to make this header independent of others */
65struct nfs4_client; 65struct nfs_client;
66 66
67void nfs_idmap_new(struct nfs4_client *); 67int nfs_idmap_new(struct nfs_client *);
68void nfs_idmap_delete(struct nfs4_client *); 68void nfs_idmap_delete(struct nfs_client *);
69 69
70int nfs_map_name_to_uid(struct nfs4_client *, const char *, size_t, __u32 *); 70int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32 *);
71int nfs_map_group_to_gid(struct nfs4_client *, const char *, size_t, __u32 *); 71int nfs_map_group_to_gid(struct nfs_client *, const char *, size_t, __u32 *);
72int nfs_map_uid_to_name(struct nfs4_client *, __u32, char *); 72int nfs_map_uid_to_name(struct nfs_client *, __u32, char *);
73int nfs_map_gid_to_group(struct nfs4_client *, __u32, char *); 73int nfs_map_gid_to_group(struct nfs_client *, __u32, char *);
74 74
75extern unsigned int nfs_idmap_cache_timeout; 75extern unsigned int nfs_idmap_cache_timeout;
76#endif /* __KERNEL__ */ 76#endif /* __KERNEL__ */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 66e2ed658527..1f7bd287c230 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -13,7 +13,6 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15#include <linux/wait.h> 15#include <linux/wait.h>
16#include <linux/nfs_fs_sb.h>
17#include <linux/sunrpc/auth.h> 16#include <linux/sunrpc/auth.h>
18#include <linux/nfs_xdr.h> 17#include <linux/nfs_xdr.h>
19 18
@@ -63,8 +62,8 @@ extern void nfs_release_request(struct nfs_page *req);
63 62
64extern int nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst, 63extern int nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst,
65 unsigned long idx_start, unsigned int npages); 64 unsigned long idx_start, unsigned int npages);
66extern int nfs_scan_list(struct list_head *, struct list_head *, 65extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, struct list_head *dst,
67 unsigned long, unsigned int); 66 unsigned long idx_start, unsigned int npages);
68extern int nfs_coalesce_requests(struct list_head *, struct list_head *, 67extern int nfs_coalesce_requests(struct list_head *, struct list_head *,
69 unsigned int); 68 unsigned int);
70extern int nfs_wait_on_request(struct nfs_page *); 69extern int nfs_wait_on_request(struct nfs_page *);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 7fafc4c546b7..dc5397d9d23c 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1,7 +1,6 @@
1#ifndef _LINUX_NFS_XDR_H 1#ifndef _LINUX_NFS_XDR_H
2#define _LINUX_NFS_XDR_H 2#define _LINUX_NFS_XDR_H
3 3
4#include <linux/sunrpc/xprt.h>
5#include <linux/nfsacl.h> 4#include <linux/nfsacl.h>
6 5
7/* 6/*
@@ -14,11 +13,19 @@
14#define NFS_DEF_FILE_IO_SIZE (4096U) 13#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U) 14#define NFS_MIN_FILE_IO_SIZE (1024U)
16 15
17struct nfs4_fsid { 16struct nfs_fsid {
18 __u64 major; 17 uint64_t major;
19 __u64 minor; 18 uint64_t minor;
20}; 19};
21 20
21/*
22 * Helper for checking equality between 2 fsids.
23 */
24static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
25{
26 return a->major == b->major && a->minor == b->minor;
27}
28
22struct nfs_fattr { 29struct nfs_fattr {
23 unsigned short valid; /* which fields are valid */ 30 unsigned short valid; /* which fields are valid */
24 __u64 pre_size; /* pre_op_attr.size */ 31 __u64 pre_size; /* pre_op_attr.size */
@@ -40,10 +47,7 @@ struct nfs_fattr {
40 } nfs3; 47 } nfs3;
41 } du; 48 } du;
42 dev_t rdev; 49 dev_t rdev;
43 union { 50 struct nfs_fsid fsid;
44 __u64 nfs3; /* also nfs2 */
45 struct nfs4_fsid nfs4;
46 } fsid_u;
47 __u64 fileid; 51 __u64 fileid;
48 struct timespec atime; 52 struct timespec atime;
49 struct timespec mtime; 53 struct timespec mtime;
@@ -57,8 +61,8 @@ struct nfs_fattr {
57#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ 61#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
58#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ 62#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
59#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ 63#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
60#define NFS_ATTR_FATTR_V4 0x0008 64#define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */
61#define NFS_ATTR_PRE_CHANGE 0x0010 65#define NFS_ATTR_FATTR_V4_REFERRAL 0x0010 /* NFSv4 referral */
62 66
63/* 67/*
64 * Info on the file system 68 * Info on the file system
@@ -354,8 +358,8 @@ struct nfs_symlinkargs {
354 struct nfs_fh * fromfh; 358 struct nfs_fh * fromfh;
355 const char * fromname; 359 const char * fromname;
356 unsigned int fromlen; 360 unsigned int fromlen;
357 const char * topath; 361 struct page ** pages;
358 unsigned int tolen; 362 unsigned int pathlen;
359 struct iattr * sattr; 363 struct iattr * sattr;
360}; 364};
361 365
@@ -430,8 +434,8 @@ struct nfs3_symlinkargs {
430 struct nfs_fh * fromfh; 434 struct nfs_fh * fromfh;
431 const char * fromname; 435 const char * fromname;
432 unsigned int fromlen; 436 unsigned int fromlen;
433 const char * topath; 437 struct page ** pages;
434 unsigned int tolen; 438 unsigned int pathlen;
435 struct iattr * sattr; 439 struct iattr * sattr;
436}; 440};
437 441
@@ -529,7 +533,10 @@ struct nfs4_accessres {
529struct nfs4_create_arg { 533struct nfs4_create_arg {
530 u32 ftype; 534 u32 ftype;
531 union { 535 union {
532 struct qstr * symlink; /* NF4LNK */ 536 struct {
537 struct page ** pages;
538 unsigned int len;
539 } symlink; /* NF4LNK */
533 struct { 540 struct {
534 u32 specdata1; 541 u32 specdata1;
535 u32 specdata2; 542 u32 specdata2;
@@ -654,7 +661,7 @@ struct nfs4_rename_res {
654struct nfs4_setclientid { 661struct nfs4_setclientid {
655 const nfs4_verifier * sc_verifier; /* request */ 662 const nfs4_verifier * sc_verifier; /* request */
656 unsigned int sc_name_len; 663 unsigned int sc_name_len;
657 char sc_name[32]; /* request */ 664 char sc_name[48]; /* request */
658 u32 sc_prog; /* request */ 665 u32 sc_prog; /* request */
659 unsigned int sc_netid_len; 666 unsigned int sc_netid_len;
660 char sc_netid[4]; /* request */ 667 char sc_netid[4]; /* request */
@@ -675,6 +682,40 @@ struct nfs4_server_caps_res {
675 u32 has_symlinks; 682 u32 has_symlinks;
676}; 683};
677 684
685struct nfs4_string {
686 unsigned int len;
687 char *data;
688};
689
690#define NFS4_PATHNAME_MAXCOMPONENTS 512
691struct nfs4_pathname {
692 unsigned int ncomponents;
693 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
694};
695
696#define NFS4_FS_LOCATION_MAXSERVERS 10
697struct nfs4_fs_location {
698 unsigned int nservers;
699 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
700 struct nfs4_pathname rootpath;
701};
702
703#define NFS4_FS_LOCATIONS_MAXENTRIES 10
704struct nfs4_fs_locations {
705 struct nfs_fattr fattr;
706 const struct nfs_server *server;
707 struct nfs4_pathname fs_path;
708 int nlocations;
709 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
710};
711
712struct nfs4_fs_locations_arg {
713 const struct nfs_fh *dir_fh;
714 const struct qstr *name;
715 struct page *page;
716 const u32 *bitmask;
717};
718
678#endif /* CONFIG_NFS_V4 */ 719#endif /* CONFIG_NFS_V4 */
679 720
680struct nfs_page; 721struct nfs_page;
@@ -690,12 +731,13 @@ struct nfs_read_data {
690 struct list_head pages; /* Coalesced read requests */ 731 struct list_head pages; /* Coalesced read requests */
691 struct nfs_page *req; /* multi ops per nfs_page */ 732 struct nfs_page *req; /* multi ops per nfs_page */
692 struct page **pagevec; 733 struct page **pagevec;
734 unsigned int npages; /* Max length of pagevec */
693 struct nfs_readargs args; 735 struct nfs_readargs args;
694 struct nfs_readres res; 736 struct nfs_readres res;
695#ifdef CONFIG_NFS_V4 737#ifdef CONFIG_NFS_V4
696 unsigned long timestamp; /* For lease renewal */ 738 unsigned long timestamp; /* For lease renewal */
697#endif 739#endif
698 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 740 struct page *page_array[NFS_PAGEVEC_SIZE];
699}; 741};
700 742
701struct nfs_write_data { 743struct nfs_write_data {
@@ -708,12 +750,13 @@ struct nfs_write_data {
708 struct list_head pages; /* Coalesced requests we wish to flush */ 750 struct list_head pages; /* Coalesced requests we wish to flush */
709 struct nfs_page *req; /* multi ops per nfs_page */ 751 struct nfs_page *req; /* multi ops per nfs_page */
710 struct page **pagevec; 752 struct page **pagevec;
753 unsigned int npages; /* Max length of pagevec */
711 struct nfs_writeargs args; /* argument struct */ 754 struct nfs_writeargs args; /* argument struct */
712 struct nfs_writeres res; /* result struct */ 755 struct nfs_writeres res; /* result struct */
713#ifdef CONFIG_NFS_V4 756#ifdef CONFIG_NFS_V4
714 unsigned long timestamp; /* For lease renewal */ 757 unsigned long timestamp; /* For lease renewal */
715#endif 758#endif
716 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 759 struct page *page_array[NFS_PAGEVEC_SIZE];
717}; 760};
718 761
719struct nfs_access_entry; 762struct nfs_access_entry;
@@ -729,6 +772,9 @@ struct nfs_rpc_ops {
729 772
730 int (*getroot) (struct nfs_server *, struct nfs_fh *, 773 int (*getroot) (struct nfs_server *, struct nfs_fh *,
731 struct nfs_fsinfo *); 774 struct nfs_fsinfo *);
775 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
776 struct qstr *, struct nfs_fh *,
777 struct nfs_fattr *);
732 int (*getattr) (struct nfs_server *, struct nfs_fh *, 778 int (*getattr) (struct nfs_server *, struct nfs_fh *,
733 struct nfs_fattr *); 779 struct nfs_fattr *);
734 int (*setattr) (struct dentry *, struct nfs_fattr *, 780 int (*setattr) (struct dentry *, struct nfs_fattr *,
@@ -750,9 +796,8 @@ struct nfs_rpc_ops {
750 int (*rename) (struct inode *, struct qstr *, 796 int (*rename) (struct inode *, struct qstr *,
751 struct inode *, struct qstr *); 797 struct inode *, struct qstr *);
752 int (*link) (struct inode *, struct inode *, struct qstr *); 798 int (*link) (struct inode *, struct inode *, struct qstr *);
753 int (*symlink) (struct inode *, struct qstr *, struct qstr *, 799 int (*symlink) (struct inode *, struct dentry *, struct page *,
754 struct iattr *, struct nfs_fh *, 800 unsigned int, struct iattr *);
755 struct nfs_fattr *);
756 int (*mkdir) (struct inode *, struct dentry *, struct iattr *); 801 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
757 int (*rmdir) (struct inode *, struct qstr *); 802 int (*rmdir) (struct inode *, struct qstr *);
758 int (*readdir) (struct dentry *, struct rpc_cred *, 803 int (*readdir) (struct dentry *, struct rpc_cred *,
@@ -765,6 +810,7 @@ struct nfs_rpc_ops {
765 struct nfs_fsinfo *); 810 struct nfs_fsinfo *);
766 int (*pathconf) (struct nfs_server *, struct nfs_fh *, 811 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
767 struct nfs_pathconf *); 812 struct nfs_pathconf *);
813 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
768 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); 814 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
769 void (*read_setup) (struct nfs_read_data *); 815 void (*read_setup) (struct nfs_read_data *);
770 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 816 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
@@ -788,9 +834,9 @@ struct nfs_rpc_ops {
788/* 834/*
789 * Function vectors etc. for the NFS client 835 * Function vectors etc. for the NFS client
790 */ 836 */
791extern struct nfs_rpc_ops nfs_v2_clientops; 837extern const struct nfs_rpc_ops nfs_v2_clientops;
792extern struct nfs_rpc_ops nfs_v3_clientops; 838extern const struct nfs_rpc_ops nfs_v3_clientops;
793extern struct nfs_rpc_ops nfs_v4_clientops; 839extern const struct nfs_rpc_ops nfs_v4_clientops;
794extern struct rpc_version nfs_version2; 840extern struct rpc_version nfs_version2;
795extern struct rpc_version nfs_version3; 841extern struct rpc_version nfs_version3;
796extern struct rpc_version nfs_version4; 842extern struct rpc_version nfs_version4;
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
new file mode 100644
index 000000000000..d9c5455808e5
--- /dev/null
+++ b/include/linux/nfsd/Kbuild
@@ -0,0 +1,7 @@
1unifdef-y += const.h
2unifdef-y += export.h
3unifdef-y += stats.h
4unifdef-y += syscall.h
5unifdef-y += nfsfh.h
6unifdef-y += debug.h
7unifdef-y += auth.h
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index f9edcd2ff3c8..31a3cb617ce0 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -269,14 +269,8 @@ fill_post_wcc(struct svc_fh *fhp)
269 fhp->fh_post_uid = inode->i_uid; 269 fhp->fh_post_uid = inode->i_uid;
270 fhp->fh_post_gid = inode->i_gid; 270 fhp->fh_post_gid = inode->i_gid;
271 fhp->fh_post_size = inode->i_size; 271 fhp->fh_post_size = inode->i_size;
272 if (inode->i_blksize) { 272 fhp->fh_post_blksize = BLOCK_SIZE;
273 fhp->fh_post_blksize = inode->i_blksize; 273 fhp->fh_post_blocks = inode->i_blocks;
274 fhp->fh_post_blocks = inode->i_blocks;
275 } else {
276 fhp->fh_post_blksize = BLOCK_SIZE;
277 /* how much do we care for accuracy with MinixFS? */
278 fhp->fh_post_blocks = (inode->i_size+511) >> 9;
279 }
280 fhp->fh_post_rdev[0] = htonl((u32)imajor(inode)); 274 fhp->fh_post_rdev[0] = htonl((u32)imajor(inode));
281 fhp->fh_post_rdev[1] = htonl((u32)iminor(inode)); 275 fhp->fh_post_rdev[1] = htonl((u32)iminor(inode));
282 fhp->fh_post_atime = inode->i_atime; 276 fhp->fh_post_atime = inode->i_atime;
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h
index b6f1e0cda4f2..28a82fdd922f 100644
--- a/include/linux/nfsd/stats.h
+++ b/include/linux/nfsd/stats.h
@@ -9,6 +9,8 @@
9#ifndef LINUX_NFSD_STATS_H 9#ifndef LINUX_NFSD_STATS_H
10#define LINUX_NFSD_STATS_H 10#define LINUX_NFSD_STATS_H
11 11
12#include <linux/nfs4.h>
13
12struct nfsd_stats { 14struct nfsd_stats {
13 unsigned int rchits; /* repcache hits */ 15 unsigned int rchits; /* repcache hits */
14 unsigned int rcmisses; /* repcache hits */ 16 unsigned int rcmisses; /* repcache hits */
@@ -27,6 +29,10 @@ struct nfsd_stats {
27 unsigned int ra_size; /* size of ra cache */ 29 unsigned int ra_size; /* size of ra cache */
28 unsigned int ra_depth[11]; /* number of times ra entry was found that deep 30 unsigned int ra_depth[11]; /* number of times ra entry was found that deep
29 * in the cache (10percentiles). [10] = not found */ 31 * in the cache (10percentiles). [10] = not found */
32#ifdef CONFIG_NFSD_V4
33 unsigned int nfs4_opcount[LAST_NFS4_OP + 1]; /* count of individual nfsv4 operations */
34#endif
35
30}; 36};
31 37
32/* thread usage wraps very million seconds (approx one fortnight) */ 38/* thread usage wraps very million seconds (approx one fortnight) */
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index c8f4d2f627d7..e16904e28c3a 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -4,6 +4,7 @@
4#ifndef LINUX_NMI_H 4#ifndef LINUX_NMI_H
5#define LINUX_NMI_H 5#define LINUX_NMI_H
6 6
7#include <linux/sched.h>
7#include <asm/irq.h> 8#include <asm/irq.h>
8 9
9/** 10/**
@@ -16,7 +17,7 @@
16#ifdef ARCH_HAS_NMI_WATCHDOG 17#ifdef ARCH_HAS_NMI_WATCHDOG
17extern void touch_nmi_watchdog(void); 18extern void touch_nmi_watchdog(void);
18#else 19#else
19# define touch_nmi_watchdog() do { } while(0) 20# define touch_nmi_watchdog() touch_softlockup_watchdog()
20#endif 21#endif
21 22
22#endif 23#endif
diff --git a/include/linux/node.h b/include/linux/node.h
index 254dc3de650b..bc001bc225c3 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -26,8 +26,33 @@ struct node {
26 struct sys_device sysdev; 26 struct sys_device sysdev;
27}; 27};
28 28
29extern struct node node_devices[];
30
29extern int register_node(struct node *, int, struct node *); 31extern int register_node(struct node *, int, struct node *);
30extern void unregister_node(struct node *node); 32extern void unregister_node(struct node *node);
33#ifdef CONFIG_NUMA
34extern int register_one_node(int nid);
35extern void unregister_one_node(int nid);
36extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
37extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
38#else
39static inline int register_one_node(int nid)
40{
41 return 0;
42}
43static inline int unregister_one_node(int nid)
44{
45 return 0;
46}
47static inline int register_cpu_under_node(unsigned int cpu, unsigned int nid)
48{
49 return 0;
50}
51static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
52{
53 return 0;
54}
55#endif
31 56
32#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 57#define to_node(sys_device) container_of(sys_device, struct node, sysdev)
33 58
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 51dbab9710c7..7ff386a6ae87 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -65,7 +65,7 @@ struct raw_notifier_head {
65 } while (0) 65 } while (0)
66 66
67#define ATOMIC_NOTIFIER_INIT(name) { \ 67#define ATOMIC_NOTIFIER_INIT(name) { \
68 .lock = SPIN_LOCK_UNLOCKED, \ 68 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
69 .head = NULL } 69 .head = NULL }
70#define BLOCKING_NOTIFIER_INIT(name) { \ 70#define BLOCKING_NOTIFIER_INIT(name) { \
71 .rwsem = __RWSEM_INITIALIZER((name).rwsem), \ 71 .rwsem = __RWSEM_INITIALIZER((name).rwsem), \
diff --git a/include/linux/nsc_gpio.h b/include/linux/nsc_gpio.h
new file mode 100644
index 000000000000..7da0cf3702ee
--- /dev/null
+++ b/include/linux/nsc_gpio.h
@@ -0,0 +1,40 @@
1/**
2 nsc_gpio.c
3
4 National Semiconductor GPIO common access methods.
5
6 struct nsc_gpio_ops abstracts the low-level access
7 operations for the GPIO units on 2 NSC chip families; the GEODE
8 integrated CPU, and the PC-8736[03456] integrated PC-peripheral
9 chips.
10
11 The GPIO units on these chips have the same pin architecture, but
12 the access methods differ. Thus, scx200_gpio and pc8736x_gpio
13 implement their own versions of these routines; and use the common
14 file-operations routines implemented in nsc_gpio module.
15
16 Copyright (c) 2005 Jim Cromie <jim.cromie@gmail.com>
17
18 NB: this work was tested on the Geode SC-1100 and PC-87366 chips.
19 NSC sold the GEODE line to AMD, and the PC-8736x line to Winbond.
20*/
21
22struct nsc_gpio_ops {
23 struct module* owner;
24 u32 (*gpio_config) (unsigned iminor, u32 mask, u32 bits);
25 void (*gpio_dump) (struct nsc_gpio_ops *amp, unsigned iminor);
26 int (*gpio_get) (unsigned iminor);
27 void (*gpio_set) (unsigned iminor, int state);
28 void (*gpio_change) (unsigned iminor);
29 int (*gpio_current) (unsigned iminor);
30 struct device* dev; /* for dev_dbg() support, set in init */
31};
32
33extern ssize_t nsc_gpio_write(struct file *file, const char __user *data,
34 size_t len, loff_t *ppos);
35
36extern ssize_t nsc_gpio_read(struct file *file, char __user *buf,
37 size_t len, loff_t *ppos);
38
39extern void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned index);
40
diff --git a/include/linux/openprom_fs.h b/include/linux/openprom_fs.h
deleted file mode 100644
index a837aab8217e..000000000000
--- a/include/linux/openprom_fs.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _LINUX_OPENPROM_FS_H
2#define _LINUX_OPENPROM_FS_H
3
4/*
5 * The openprom filesystem constants/structures
6 */
7
8#define OPENPROM_SUPER_MAGIC 0x9fa1
9
10#endif /* _LINUX_OPENPROM_FS_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 0c076d58c676..4830a3bedfb2 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -5,36 +5,33 @@
5#ifndef PAGE_FLAGS_H 5#ifndef PAGE_FLAGS_H
6#define PAGE_FLAGS_H 6#define PAGE_FLAGS_H
7 7
8#include <linux/percpu.h>
9#include <linux/cache.h>
10#include <linux/types.h> 8#include <linux/types.h>
11 9
12#include <asm/pgtable.h>
13
14/* 10/*
15 * Various page->flags bits: 11 * Various page->flags bits:
16 * 12 *
17 * PG_reserved is set for special pages, which can never be swapped out. Some 13 * PG_reserved is set for special pages, which can never be swapped out. Some
18 * of them might not even exist (eg empty_bad_page)... 14 * of them might not even exist (eg empty_bad_page)...
19 * 15 *
20 * The PG_private bitflag is set if page->private contains a valid value. 16 * The PG_private bitflag is set on pagecache pages if they contain filesystem
17 * specific data (which is normally at page->private). It can be used by
18 * private allocations for its own usage.
19 *
20 * During initiation of disk I/O, PG_locked is set. This bit is set before I/O
21 * and cleared when writeback _starts_ or when read _completes_. PG_writeback
22 * is set before writeback starts and cleared when it finishes.
21 * 23 *
22 * During disk I/O, PG_locked is used. This bit is set before I/O and 24 * PG_locked also pins a page in pagecache, and blocks truncation of the file
23 * reset when I/O completes. page_waitqueue(page) is a wait queue of all tasks 25 * while it is held.
24 * waiting for the I/O on this page to complete. 26 *
27 * page_waitqueue(page) is a wait queue of all tasks waiting for the page
28 * to become unlocked.
25 * 29 *
26 * PG_uptodate tells whether the page's contents is valid. When a read 30 * PG_uptodate tells whether the page's contents is valid. When a read
27 * completes, the page becomes uptodate, unless a disk I/O error happened. 31 * completes, the page becomes uptodate, unless a disk I/O error happened.
28 * 32 *
29 * For choosing which pages to swap out, inode pages carry a PG_referenced bit, 33 * PG_referenced, PG_reclaim are used for page reclaim for anonymous and
30 * which is set any time the system accesses that page through the (mapping, 34 * file-backed pagecache (see mm/vmscan.c).
31 * index) hash table. This referenced bit, together with the referenced bit
32 * in the page tables, is used to manipulate page->age and move the page across
33 * the active, inactive_dirty and inactive_clean lists.
34 *
35 * Note that the referenced bit, the page->lru list_head and the active,
36 * inactive_dirty and inactive_clean lists are protected by the
37 * zone->lru_lock, and *NOT* by the usual PG_locked bit!
38 * 35 *
39 * PG_error is set to indicate that an I/O error occurred on this page. 36 * PG_error is set to indicate that an I/O error occurred on this page.
40 * 37 *
@@ -46,6 +43,10 @@
46 * space, they need to be kmapped separately for doing IO on the pages. The 43 * space, they need to be kmapped separately for doing IO on the pages. The
47 * struct page (these bits with information) are always mapped into kernel 44 * struct page (these bits with information) are always mapped into kernel
48 * address space... 45 * address space...
46 *
47 * PG_buddy is set to indicate that the page is free and in the buddy system
48 * (see mm/page_alloc.c).
49 *
49 */ 50 */
50 51
51/* 52/*
@@ -78,7 +79,7 @@
78#define PG_checked 8 /* kill me in 2.5.<early>. */ 79#define PG_checked 8 /* kill me in 2.5.<early>. */
79#define PG_arch_1 9 80#define PG_arch_1 9
80#define PG_reserved 10 81#define PG_reserved 10
81#define PG_private 11 /* Has something at ->private */ 82#define PG_private 11 /* If pagecache, has fs-private data */
82 83
83#define PG_writeback 12 /* Page is under writeback */ 84#define PG_writeback 12 /* Page is under writeback */
84#define PG_nosave 13 /* Used for system suspend/resume */ 85#define PG_nosave 13 /* Used for system suspend/resume */
@@ -87,7 +88,7 @@
87 88
88#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */ 89#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */
89#define PG_reclaim 17 /* To be reclaimed asap */ 90#define PG_reclaim 17 /* To be reclaimed asap */
90#define PG_nosave_free 18 /* Free, should not be written */ 91#define PG_nosave_free 18 /* Used for system suspend/resume */
91#define PG_buddy 19 /* Page is free, on buddy lists */ 92#define PG_buddy 19 /* Page is free, on buddy lists */
92 93
93 94
@@ -103,134 +104,6 @@
103#endif 104#endif
104 105
105/* 106/*
106 * Global page accounting. One instance per CPU. Only unsigned longs are
107 * allowed.
108 *
109 * - Fields can be modified with xxx_page_state and xxx_page_state_zone at
110 * any time safely (which protects the instance from modification by
111 * interrupt.
112 * - The __xxx_page_state variants can be used safely when interrupts are
113 * disabled.
114 * - The __xxx_page_state variants can be used if the field is only
115 * modified from process context and protected from preemption, or only
116 * modified from interrupt context. In this case, the field should be
117 * commented here.
118 */
119struct page_state {
120 unsigned long nr_dirty; /* Dirty writeable pages */
121 unsigned long nr_writeback; /* Pages under writeback */
122 unsigned long nr_unstable; /* NFS unstable pages */
123 unsigned long nr_page_table_pages;/* Pages used for pagetables */
124 unsigned long nr_mapped; /* mapped into pagetables.
125 * only modified from process context */
126 unsigned long nr_slab; /* In slab */
127#define GET_PAGE_STATE_LAST nr_slab
128
129 /*
130 * The below are zeroed by get_page_state(). Use get_full_page_state()
131 * to add up all these.
132 */
133 unsigned long pgpgin; /* Disk reads */
134 unsigned long pgpgout; /* Disk writes */
135 unsigned long pswpin; /* swap reads */
136 unsigned long pswpout; /* swap writes */
137
138 unsigned long pgalloc_high; /* page allocations */
139 unsigned long pgalloc_normal;
140 unsigned long pgalloc_dma32;
141 unsigned long pgalloc_dma;
142
143 unsigned long pgfree; /* page freeings */
144 unsigned long pgactivate; /* pages moved inactive->active */
145 unsigned long pgdeactivate; /* pages moved active->inactive */
146
147 unsigned long pgfault; /* faults (major+minor) */
148 unsigned long pgmajfault; /* faults (major only) */
149
150 unsigned long pgrefill_high; /* inspected in refill_inactive_zone */
151 unsigned long pgrefill_normal;
152 unsigned long pgrefill_dma32;
153 unsigned long pgrefill_dma;
154
155 unsigned long pgsteal_high; /* total highmem pages reclaimed */
156 unsigned long pgsteal_normal;
157 unsigned long pgsteal_dma32;
158 unsigned long pgsteal_dma;
159
160 unsigned long pgscan_kswapd_high;/* total highmem pages scanned */
161 unsigned long pgscan_kswapd_normal;
162 unsigned long pgscan_kswapd_dma32;
163 unsigned long pgscan_kswapd_dma;
164
165 unsigned long pgscan_direct_high;/* total highmem pages scanned */
166 unsigned long pgscan_direct_normal;
167 unsigned long pgscan_direct_dma32;
168 unsigned long pgscan_direct_dma;
169
170 unsigned long pginodesteal; /* pages reclaimed via inode freeing */
171 unsigned long slabs_scanned; /* slab objects scanned */
172 unsigned long kswapd_steal; /* pages reclaimed by kswapd */
173 unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */
174 unsigned long pageoutrun; /* kswapd's calls to page reclaim */
175 unsigned long allocstall; /* direct reclaim calls */
176
177 unsigned long pgrotated; /* pages rotated to tail of the LRU */
178 unsigned long nr_bounce; /* pages for bounce buffers */
179};
180
181extern void get_page_state(struct page_state *ret);
182extern void get_page_state_node(struct page_state *ret, int node);
183extern void get_full_page_state(struct page_state *ret);
184extern unsigned long read_page_state_offset(unsigned long offset);
185extern void mod_page_state_offset(unsigned long offset, unsigned long delta);
186extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
187
188#define read_page_state(member) \
189 read_page_state_offset(offsetof(struct page_state, member))
190
191#define mod_page_state(member, delta) \
192 mod_page_state_offset(offsetof(struct page_state, member), (delta))
193
194#define __mod_page_state(member, delta) \
195 __mod_page_state_offset(offsetof(struct page_state, member), (delta))
196
197#define inc_page_state(member) mod_page_state(member, 1UL)
198#define dec_page_state(member) mod_page_state(member, 0UL - 1)
199#define add_page_state(member,delta) mod_page_state(member, (delta))
200#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta))
201
202#define __inc_page_state(member) __mod_page_state(member, 1UL)
203#define __dec_page_state(member) __mod_page_state(member, 0UL - 1)
204#define __add_page_state(member,delta) __mod_page_state(member, (delta))
205#define __sub_page_state(member,delta) __mod_page_state(member, 0UL - (delta))
206
207#define page_state(member) (*__page_state(offsetof(struct page_state, member)))
208
209#define state_zone_offset(zone, member) \
210({ \
211 unsigned offset; \
212 if (is_highmem(zone)) \
213 offset = offsetof(struct page_state, member##_high); \
214 else if (is_normal(zone)) \
215 offset = offsetof(struct page_state, member##_normal); \
216 else if (is_dma32(zone)) \
217 offset = offsetof(struct page_state, member##_dma32); \
218 else \
219 offset = offsetof(struct page_state, member##_dma); \
220 offset; \
221})
222
223#define __mod_page_state_zone(zone, member, delta) \
224 do { \
225 __mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
226 } while (0)
227
228#define mod_page_state_zone(zone, member, delta) \
229 do { \
230 mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
231 } while (0)
232
233/*
234 * Manipulation of page state flags 107 * Manipulation of page state flags
235 */ 108 */
236#define PageLocked(page) \ 109#define PageLocked(page) \
@@ -254,7 +127,13 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
254#define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags) 127#define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags)
255 128
256#define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags) 129#define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags)
257#ifndef SetPageUptodate 130#ifdef CONFIG_S390
131static inline void SetPageUptodate(struct page *page)
132{
133 if (!test_and_set_bit(PG_uptodate, &page->flags))
134 page_test_and_clear_dirty(page);
135}
136#else
258#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) 137#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags)
259#endif 138#endif
260#define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) 139#define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags)
@@ -306,7 +185,7 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
306 do { \ 185 do { \
307 if (!test_and_set_bit(PG_writeback, \ 186 if (!test_and_set_bit(PG_writeback, \
308 &(page)->flags)) \ 187 &(page)->flags)) \
309 inc_page_state(nr_writeback); \ 188 inc_zone_page_state(page, NR_WRITEBACK); \
310 } while (0) 189 } while (0)
311#define TestSetPageWriteback(page) \ 190#define TestSetPageWriteback(page) \
312 ({ \ 191 ({ \
@@ -314,14 +193,14 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
314 ret = test_and_set_bit(PG_writeback, \ 193 ret = test_and_set_bit(PG_writeback, \
315 &(page)->flags); \ 194 &(page)->flags); \
316 if (!ret) \ 195 if (!ret) \
317 inc_page_state(nr_writeback); \ 196 inc_zone_page_state(page, NR_WRITEBACK); \
318 ret; \ 197 ret; \
319 }) 198 })
320#define ClearPageWriteback(page) \ 199#define ClearPageWriteback(page) \
321 do { \ 200 do { \
322 if (test_and_clear_bit(PG_writeback, \ 201 if (test_and_clear_bit(PG_writeback, \
323 &(page)->flags)) \ 202 &(page)->flags)) \
324 dec_page_state(nr_writeback); \ 203 dec_zone_page_state(page, NR_WRITEBACK); \
325 } while (0) 204 } while (0)
326#define TestClearPageWriteback(page) \ 205#define TestClearPageWriteback(page) \
327 ({ \ 206 ({ \
@@ -329,7 +208,7 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
329 ret = test_and_clear_bit(PG_writeback, \ 208 ret = test_and_clear_bit(PG_writeback, \
330 &(page)->flags); \ 209 &(page)->flags); \
331 if (ret) \ 210 if (ret) \
332 dec_page_state(nr_writeback); \ 211 dec_zone_page_state(page, NR_WRITEBACK); \
333 ret; \ 212 ret; \
334 }) 213 })
335 214
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 1245df7141aa..64f950925151 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -113,51 +113,6 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
113extern void remove_from_page_cache(struct page *page); 113extern void remove_from_page_cache(struct page *page);
114extern void __remove_from_page_cache(struct page *page); 114extern void __remove_from_page_cache(struct page *page);
115 115
116extern atomic_t nr_pagecache;
117
118#ifdef CONFIG_SMP
119
120#define PAGECACHE_ACCT_THRESHOLD max(16, NR_CPUS * 2)
121DECLARE_PER_CPU(long, nr_pagecache_local);
122
123/*
124 * pagecache_acct implements approximate accounting for pagecache.
125 * vm_enough_memory() do not need high accuracy. Writers will keep
126 * an offset in their per-cpu arena and will spill that into the
127 * global count whenever the absolute value of the local count
128 * exceeds the counter's threshold.
129 *
130 * MUST be protected from preemption.
131 * current protection is mapping->page_lock.
132 */
133static inline void pagecache_acct(int count)
134{
135 long *local;
136
137 local = &__get_cpu_var(nr_pagecache_local);
138 *local += count;
139 if (*local > PAGECACHE_ACCT_THRESHOLD || *local < -PAGECACHE_ACCT_THRESHOLD) {
140 atomic_add(*local, &nr_pagecache);
141 *local = 0;
142 }
143}
144
145#else
146
147static inline void pagecache_acct(int count)
148{
149 atomic_add(count, &nr_pagecache);
150}
151#endif
152
153static inline unsigned long get_page_cache_size(void)
154{
155 int ret = atomic_read(&nr_pagecache);
156 if (unlikely(ret < 0))
157 ret = 0;
158 return ret;
159}
160
161/* 116/*
162 * Return byte-offset into filesystem object for page. 117 * Return byte-offset into filesystem object for page.
163 */ 118 */
@@ -175,14 +130,29 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
175} 130}
176 131
177extern void FASTCALL(__lock_page(struct page *page)); 132extern void FASTCALL(__lock_page(struct page *page));
133extern void FASTCALL(__lock_page_nosync(struct page *page));
178extern void FASTCALL(unlock_page(struct page *page)); 134extern void FASTCALL(unlock_page(struct page *page));
179 135
136/*
137 * lock_page may only be called if we have the page's inode pinned.
138 */
180static inline void lock_page(struct page *page) 139static inline void lock_page(struct page *page)
181{ 140{
182 might_sleep(); 141 might_sleep();
183 if (TestSetPageLocked(page)) 142 if (TestSetPageLocked(page))
184 __lock_page(page); 143 __lock_page(page);
185} 144}
145
146/*
147 * lock_page_nosync should only be used if we can't pin the page's inode.
148 * Doesn't play quite so well with block device plugging.
149 */
150static inline void lock_page_nosync(struct page *page)
151{
152 might_sleep();
153 if (TestSetPageLocked(page))
154 __lock_page_nosync(page);
155}
186 156
187/* 157/*
188 * This is exported only for wait_on_page_locked/wait_on_page_writeback. 158 * This is exported only for wait_on_page_locked/wait_on_page_writeback.
diff --git a/include/linux/parport.h b/include/linux/parport.h
index d42737eeee06..5bf321e82c99 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -127,6 +127,10 @@ struct amiga_parport_state {
127 unsigned char statusdir;/* ciab.ddrb & 7 */ 127 unsigned char statusdir;/* ciab.ddrb & 7 */
128}; 128};
129 129
130struct ax88796_parport_state {
131 unsigned char cpr;
132};
133
130struct ip32_parport_state { 134struct ip32_parport_state {
131 unsigned int dcr; 135 unsigned int dcr;
132 unsigned int ecr; 136 unsigned int ecr;
@@ -138,6 +142,7 @@ struct parport_state {
138 /* ARC has no state. */ 142 /* ARC has no state. */
139 struct ax_parport_state ax; 143 struct ax_parport_state ax;
140 struct amiga_parport_state amiga; 144 struct amiga_parport_state amiga;
145 struct ax88796_parport_state ax88796;
141 /* Atari has not state. */ 146 /* Atari has not state. */
142 struct ip32_parport_state ip32; 147 struct ip32_parport_state ip32;
143 void *misc; 148 void *misc;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 62a8c22f5f60..5c3a4176eb64 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -49,6 +49,7 @@
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/ioport.h> 50#include <linux/ioport.h>
51#include <linux/list.h> 51#include <linux/list.h>
52#include <linux/compiler.h>
52#include <linux/errno.h> 53#include <linux/errno.h>
53#include <linux/device.h> 54#include <linux/device.h>
54 55
@@ -161,6 +162,7 @@ struct pci_dev {
161 unsigned int is_enabled:1; /* pci_enable_device has been called */ 162 unsigned int is_enabled:1; /* pci_enable_device has been called */
162 unsigned int is_busmaster:1; /* device is busmaster */ 163 unsigned int is_busmaster:1; /* device is busmaster */
163 unsigned int no_msi:1; /* device may not use msi */ 164 unsigned int no_msi:1; /* device may not use msi */
165 unsigned int no_d1d2:1; /* only allow d0 or d3 */
164 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 166 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
165 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 167 unsigned int broken_parity_status:1; /* Device generates false positive parity */
166 unsigned int msi_enabled:1; 168 unsigned int msi_enabled:1;
@@ -345,6 +347,8 @@ struct pci_driver {
345 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ 347 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
346 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ 348 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
347 int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */ 349 int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */
350 int (*suspend_late) (struct pci_dev *dev, pm_message_t state);
351 int (*resume_early) (struct pci_dev *dev);
348 int (*resume) (struct pci_dev *dev); /* Device woken up */ 352 int (*resume) (struct pci_dev *dev); /* Device woken up */
349 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ 353 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */
350 void (*shutdown) (struct pci_dev *dev); 354 void (*shutdown) (struct pci_dev *dev);
@@ -352,6 +356,8 @@ struct pci_driver {
352 struct pci_error_handlers *err_handler; 356 struct pci_error_handlers *err_handler;
353 struct device_driver driver; 357 struct device_driver driver;
354 struct pci_dynids dynids; 358 struct pci_dynids dynids;
359
360 int multithread_probe;
355}; 361};
356 362
357#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) 363#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver)
@@ -400,12 +406,12 @@ extern struct list_head pci_root_buses; /* list of all known PCI buses */
400extern struct list_head pci_devices; /* list of all devices */ 406extern struct list_head pci_devices; /* list of all devices */
401 407
402void pcibios_fixup_bus(struct pci_bus *); 408void pcibios_fixup_bus(struct pci_bus *);
403int pcibios_enable_device(struct pci_dev *, int mask); 409int __must_check pcibios_enable_device(struct pci_dev *, int mask);
404char *pcibios_setup (char *str); 410char *pcibios_setup (char *str);
405 411
406/* Used only when drivers/pci/setup.c is used */ 412/* Used only when drivers/pci/setup.c is used */
407void pcibios_align_resource(void *, struct resource *, 413void pcibios_align_resource(void *, struct resource *, resource_size_t,
408 unsigned long, unsigned long); 414 resource_size_t);
409void pcibios_update_irq(struct pci_dev *, int irq); 415void pcibios_update_irq(struct pci_dev *, int irq);
410 416
411/* Generic PCI functions used internally */ 417/* Generic PCI functions used internally */
@@ -427,7 +433,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn);
427struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); 433struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn);
428void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 434void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
429unsigned int pci_scan_child_bus(struct pci_bus *bus); 435unsigned int pci_scan_child_bus(struct pci_bus *bus);
430void pci_bus_add_device(struct pci_dev *dev); 436int __must_check pci_bus_add_device(struct pci_dev *dev);
431void pci_read_bridge_bases(struct pci_bus *child); 437void pci_read_bridge_bases(struct pci_bus *child);
432struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); 438struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res);
433int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 439int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
@@ -435,6 +441,7 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
435extern void pci_dev_put(struct pci_dev *dev); 441extern void pci_dev_put(struct pci_dev *dev);
436extern void pci_remove_bus(struct pci_bus *b); 442extern void pci_remove_bus(struct pci_bus *b);
437extern void pci_remove_bus_device(struct pci_dev *dev); 443extern void pci_remove_bus_device(struct pci_dev *dev);
444extern void pci_stop_bus_device(struct pci_dev *dev);
438void pci_setup_cardbus(struct pci_bus *bus); 445void pci_setup_cardbus(struct pci_bus *bus);
439 446
440/* Generic PCI functions exported to card drivers */ 447/* Generic PCI functions exported to card drivers */
@@ -487,19 +494,19 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val
487 return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); 494 return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val);
488} 495}
489 496
490int pci_enable_device(struct pci_dev *dev); 497int __must_check pci_enable_device(struct pci_dev *dev);
491int pci_enable_device_bars(struct pci_dev *dev, int mask); 498int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask);
492void pci_disable_device(struct pci_dev *dev); 499void pci_disable_device(struct pci_dev *dev);
493void pci_set_master(struct pci_dev *dev); 500void pci_set_master(struct pci_dev *dev);
494#define HAVE_PCI_SET_MWI 501#define HAVE_PCI_SET_MWI
495int pci_set_mwi(struct pci_dev *dev); 502int __must_check pci_set_mwi(struct pci_dev *dev);
496void pci_clear_mwi(struct pci_dev *dev); 503void pci_clear_mwi(struct pci_dev *dev);
497void pci_intx(struct pci_dev *dev, int enable); 504void pci_intx(struct pci_dev *dev, int enable);
498int pci_set_dma_mask(struct pci_dev *dev, u64 mask); 505int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
499int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); 506int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
500void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 507void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
501int pci_assign_resource(struct pci_dev *dev, int i); 508int __must_check pci_assign_resource(struct pci_dev *dev, int i);
502int pci_assign_resource_fixed(struct pci_dev *dev, int i); 509int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
503void pci_restore_bars(struct pci_dev *dev); 510void pci_restore_bars(struct pci_dev *dev);
504 511
505/* ROM control related routines */ 512/* ROM control related routines */
@@ -525,23 +532,24 @@ void pdev_sort_resources(struct pci_dev *, struct resource_list *);
525void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 532void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
526 int (*)(struct pci_dev *, u8, u8)); 533 int (*)(struct pci_dev *, u8, u8));
527#define HAVE_PCI_REQ_REGIONS 2 534#define HAVE_PCI_REQ_REGIONS 2
528int pci_request_regions(struct pci_dev *, const char *); 535int __must_check pci_request_regions(struct pci_dev *, const char *);
529void pci_release_regions(struct pci_dev *); 536void pci_release_regions(struct pci_dev *);
530int pci_request_region(struct pci_dev *, int, const char *); 537int __must_check pci_request_region(struct pci_dev *, int, const char *);
531void pci_release_region(struct pci_dev *, int); 538void pci_release_region(struct pci_dev *, int);
532 539
533/* drivers/pci/bus.c */ 540/* drivers/pci/bus.c */
534int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, 541int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
535 unsigned long size, unsigned long align, 542 struct resource *res, resource_size_t size,
536 unsigned long min, unsigned int type_mask, 543 resource_size_t align, resource_size_t min,
537 void (*alignf)(void *, struct resource *, 544 unsigned int type_mask,
538 unsigned long, unsigned long), 545 void (*alignf)(void *, struct resource *,
539 void *alignf_data); 546 resource_size_t, resource_size_t),
547 void *alignf_data);
540void pci_enable_bridges(struct pci_bus *bus); 548void pci_enable_bridges(struct pci_bus *bus);
541 549
542/* Proper probing supporting hot-pluggable devices */ 550/* Proper probing supporting hot-pluggable devices */
543int __pci_register_driver(struct pci_driver *, struct module *); 551int __must_check __pci_register_driver(struct pci_driver *, struct module *);
544static inline int pci_register_driver(struct pci_driver *driver) 552static inline int __must_check pci_register_driver(struct pci_driver *driver)
545{ 553{
546 return __pci_register_driver(driver, THIS_MODULE); 554 return __pci_register_driver(driver, THIS_MODULE);
547} 555}
@@ -730,7 +738,8 @@ static inline char *pci_name(struct pci_dev *pdev)
730 */ 738 */
731#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER 739#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER
732static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, 740static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
733 const struct resource *rsrc, u64 *start, u64 *end) 741 const struct resource *rsrc, resource_size_t *start,
742 resource_size_t *end)
734{ 743{
735 *start = rsrc->start; 744 *start = rsrc->start;
736 *end = rsrc->end; 745 *end = rsrc->end;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c2fd2d19938b..c9ffbc3843d5 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -479,6 +479,7 @@
479 479
480#define PCI_VENDOR_ID_AMD 0x1022 480#define PCI_VENDOR_ID_AMD 0x1022
481#define PCI_DEVICE_ID_AMD_K8_NB 0x1100 481#define PCI_DEVICE_ID_AMD_K8_NB 0x1100
482#define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103
482#define PCI_DEVICE_ID_AMD_LANCE 0x2000 483#define PCI_DEVICE_ID_AMD_LANCE 0x2000
483#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 484#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
484#define PCI_DEVICE_ID_AMD_SCSI 0x2020 485#define PCI_DEVICE_ID_AMD_SCSI 0x2020
@@ -506,6 +507,7 @@
506#define PCI_DEVICE_ID_AMD_8151_0 0x7454 507#define PCI_DEVICE_ID_AMD_8151_0 0x7454
507#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 508#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450
508#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 509#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451
510#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458
509#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 511#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
510#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 512#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
511#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093 513#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093
@@ -648,6 +650,8 @@
648#define PCI_DEVICE_ID_SI_962 0x0962 650#define PCI_DEVICE_ID_SI_962 0x0962
649#define PCI_DEVICE_ID_SI_963 0x0963 651#define PCI_DEVICE_ID_SI_963 0x0963
650#define PCI_DEVICE_ID_SI_965 0x0965 652#define PCI_DEVICE_ID_SI_965 0x0965
653#define PCI_DEVICE_ID_SI_966 0x0966
654#define PCI_DEVICE_ID_SI_968 0x0968
651#define PCI_DEVICE_ID_SI_5511 0x5511 655#define PCI_DEVICE_ID_SI_5511 0x5511
652#define PCI_DEVICE_ID_SI_5513 0x5513 656#define PCI_DEVICE_ID_SI_5513 0x5513
653#define PCI_DEVICE_ID_SI_5517 0x5517 657#define PCI_DEVICE_ID_SI_5517 0x5517
@@ -728,7 +732,9 @@
728#define PCI_DEVICE_ID_TI_TVP4020 0x3d07 732#define PCI_DEVICE_ID_TI_TVP4020 0x3d07
729#define PCI_DEVICE_ID_TI_4450 0x8011 733#define PCI_DEVICE_ID_TI_4450 0x8011
730#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 734#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031
735#define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034
731#define PCI_DEVICE_ID_TI_X515 0x8036 736#define PCI_DEVICE_ID_TI_X515 0x8036
737#define PCI_DEVICE_ID_TI_XX12 0x8039
732#define PCI_DEVICE_ID_TI_1130 0xac12 738#define PCI_DEVICE_ID_TI_1130 0xac12
733#define PCI_DEVICE_ID_TI_1031 0xac13 739#define PCI_DEVICE_ID_TI_1031 0xac13
734#define PCI_DEVICE_ID_TI_1131 0xac15 740#define PCI_DEVICE_ID_TI_1131 0xac15
@@ -1202,6 +1208,7 @@
1202#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF 1208#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF
1203#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6 1209#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6
1204#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7 1210#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7
1211#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE 0x0448
1205#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450 1212#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450
1206#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 1213#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
1207#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 1214#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452
@@ -1289,6 +1296,7 @@
1289#define PCI_DEVICE_ID_VIA_8367_0 0x3099 1296#define PCI_DEVICE_ID_VIA_8367_0 0x3099
1290#define PCI_DEVICE_ID_VIA_8653_0 0x3101 1297#define PCI_DEVICE_ID_VIA_8653_0 0x3101
1291#define PCI_DEVICE_ID_VIA_8622 0x3102 1298#define PCI_DEVICE_ID_VIA_8622 0x3102
1299#define PCI_DEVICE_ID_VIA_8235_USB_2 0x3104
1292#define PCI_DEVICE_ID_VIA_8233C_0 0x3109 1300#define PCI_DEVICE_ID_VIA_8233C_0 0x3109
1293#define PCI_DEVICE_ID_VIA_8361 0x3112 1301#define PCI_DEVICE_ID_VIA_8361 0x3112
1294#define PCI_DEVICE_ID_VIA_XM266 0x3116 1302#define PCI_DEVICE_ID_VIA_XM266 0x3116
@@ -1405,6 +1413,7 @@
1405#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 1413#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
1406#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 1414#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
1407#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 1415#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103
1416#define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132
1408#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 1417#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
1409#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 1418#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
1410#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 1419#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203
@@ -1440,6 +1449,7 @@
1440#define PCI_DEVICE_ID_RICOH_RL5C475 0x0475 1449#define PCI_DEVICE_ID_RICOH_RL5C475 0x0475
1441#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 1450#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
1442#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 1451#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
1452#define PCI_DEVICE_ID_RICOH_R5C822 0x0822
1443 1453
1444#define PCI_VENDOR_ID_DLINK 0x1186 1454#define PCI_VENDOR_ID_DLINK 0x1186
1445#define PCI_DEVICE_ID_DLINK_DGE510T 0x4c00 1455#define PCI_DEVICE_ID_DLINK_DGE510T 0x4c00
@@ -1475,9 +1485,6 @@
1475#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 1485#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430
1476#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 1486#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460
1477#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 1487#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480
1478#define PCI_DEVICE_ID_MARVELL_GT96100 0x9652
1479#define PCI_DEVICE_ID_MARVELL_GT96100A 0x9653
1480
1481 1488
1482#define PCI_VENDOR_ID_V3 0x11b0 1489#define PCI_VENDOR_ID_V3 0x11b0
1483#define PCI_DEVICE_ID_V3_V960 0x0001 1490#define PCI_DEVICE_ID_V3_V960 0x0001
@@ -1722,6 +1729,9 @@
1722#define PCI_VENDOR_ID_DOMEX 0x134a 1729#define PCI_VENDOR_ID_DOMEX 0x134a
1723#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001 1730#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001
1724 1731
1732#define PCI_VENDOR_ID_INTASHIELD 0x135a
1733#define PCI_DEVICE_ID_INTASHIELD_IS200 0x0d80
1734
1725#define PCI_VENDOR_ID_QUATECH 0x135C 1735#define PCI_VENDOR_ID_QUATECH 0x135C
1726#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 1736#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010
1727#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 1737#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020
@@ -1895,6 +1905,7 @@
1895#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 1905#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
1896#define PCI_DEVICE_ID_TIGON3_5720 0x1658 1906#define PCI_DEVICE_ID_TIGON3_5720 0x1658
1897#define PCI_DEVICE_ID_TIGON3_5721 0x1659 1907#define PCI_DEVICE_ID_TIGON3_5721 0x1659
1908#define PCI_DEVICE_ID_TIGON3_5722 0x165a
1898#define PCI_DEVICE_ID_TIGON3_5705M 0x165d 1909#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
1899#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e 1910#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
1900#define PCI_DEVICE_ID_TIGON3_5714 0x1668 1911#define PCI_DEVICE_ID_TIGON3_5714 0x1668
@@ -1904,6 +1915,7 @@
1904#define PCI_DEVICE_ID_TIGON3_5705F 0x166e 1915#define PCI_DEVICE_ID_TIGON3_5705F 0x166e
1905#define PCI_DEVICE_ID_TIGON3_5754M 0x1672 1916#define PCI_DEVICE_ID_TIGON3_5754M 0x1672
1906#define PCI_DEVICE_ID_TIGON3_5755M 0x1673 1917#define PCI_DEVICE_ID_TIGON3_5755M 0x1673
1918#define PCI_DEVICE_ID_TIGON3_5756 0x1674
1907#define PCI_DEVICE_ID_TIGON3_5750 0x1676 1919#define PCI_DEVICE_ID_TIGON3_5750 0x1676
1908#define PCI_DEVICE_ID_TIGON3_5751 0x1677 1920#define PCI_DEVICE_ID_TIGON3_5751 0x1677
1909#define PCI_DEVICE_ID_TIGON3_5715 0x1678 1921#define PCI_DEVICE_ID_TIGON3_5715 0x1678
@@ -1933,6 +1945,8 @@
1933#define PCI_DEVICE_ID_TIGON3_5901 0x170d 1945#define PCI_DEVICE_ID_TIGON3_5901 0x170d
1934#define PCI_DEVICE_ID_BCM4401B1 0x170c 1946#define PCI_DEVICE_ID_BCM4401B1 0x170c
1935#define PCI_DEVICE_ID_TIGON3_5901_2 0x170e 1947#define PCI_DEVICE_ID_TIGON3_5901_2 0x170e
1948#define PCI_DEVICE_ID_TIGON3_5906 0x1712
1949#define PCI_DEVICE_ID_TIGON3_5906M 0x1713
1936#define PCI_DEVICE_ID_BCM4401 0x4401 1950#define PCI_DEVICE_ID_BCM4401 0x4401
1937#define PCI_DEVICE_ID_BCM4401B0 0x4402 1951#define PCI_DEVICE_ID_BCM4401B0 0x4402
1938 1952
@@ -2000,6 +2014,23 @@
2000#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea 2014#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea
2001#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb 2015#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb
2002 2016
2017#define PCI_VENDOR_ID_ARECA 0x17d3
2018#define PCI_DEVICE_ID_ARECA_1110 0x1110
2019#define PCI_DEVICE_ID_ARECA_1120 0x1120
2020#define PCI_DEVICE_ID_ARECA_1130 0x1130
2021#define PCI_DEVICE_ID_ARECA_1160 0x1160
2022#define PCI_DEVICE_ID_ARECA_1170 0x1170
2023#define PCI_DEVICE_ID_ARECA_1210 0x1210
2024#define PCI_DEVICE_ID_ARECA_1220 0x1220
2025#define PCI_DEVICE_ID_ARECA_1230 0x1230
2026#define PCI_DEVICE_ID_ARECA_1260 0x1260
2027#define PCI_DEVICE_ID_ARECA_1270 0x1270
2028#define PCI_DEVICE_ID_ARECA_1280 0x1280
2029#define PCI_DEVICE_ID_ARECA_1380 0x1380
2030#define PCI_DEVICE_ID_ARECA_1381 0x1381
2031#define PCI_DEVICE_ID_ARECA_1680 0x1680
2032#define PCI_DEVICE_ID_ARECA_1681 0x1681
2033
2003#define PCI_VENDOR_ID_S2IO 0x17d5 2034#define PCI_VENDOR_ID_S2IO 0x17d5
2004#define PCI_DEVICE_ID_S2IO_WIN 0x5731 2035#define PCI_DEVICE_ID_S2IO_WIN 0x5731
2005#define PCI_DEVICE_ID_S2IO_UNI 0x5831 2036#define PCI_DEVICE_ID_S2IO_UNI 0x5831
@@ -2015,6 +2046,13 @@
2015#define PCI_VENDOR_ID_TDI 0x192E 2046#define PCI_VENDOR_ID_TDI 0x192E
2016#define PCI_DEVICE_ID_TDI_EHCI 0x0101 2047#define PCI_DEVICE_ID_TDI_EHCI 0x0101
2017 2048
2049#define PCI_VENDOR_ID_JMICRON 0x197B
2050#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360
2051#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361
2052#define PCI_DEVICE_ID_JMICRON_JMB363 0x2363
2053#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365
2054#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366
2055#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368
2018 2056
2019#define PCI_VENDOR_ID_TEKRAM 0x1de1 2057#define PCI_VENDOR_ID_TEKRAM 0x1de1
2020#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 2058#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
@@ -2131,6 +2169,7 @@
2131#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501 2169#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501
2132#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530 2170#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530
2133#define PCI_DEVICE_ID_INTEL_82860_HB 0x2531 2171#define PCI_DEVICE_ID_INTEL_82860_HB 0x2531
2172#define PCI_DEVICE_ID_INTEL_E7501_MCH 0x254c
2134#define PCI_DEVICE_ID_INTEL_82845G_HB 0x2560 2173#define PCI_DEVICE_ID_INTEL_82845G_HB 0x2560
2135#define PCI_DEVICE_ID_INTEL_82845G_IG 0x2562 2174#define PCI_DEVICE_ID_INTEL_82845G_IG 0x2562
2136#define PCI_DEVICE_ID_INTEL_82865_HB 0x2570 2175#define PCI_DEVICE_ID_INTEL_82865_HB 0x2570
@@ -2170,7 +2209,6 @@
2170#define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815 2209#define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815
2171#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e 2210#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e
2172#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850 2211#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850
2173#define PCI_DEVICE_ID_INTEL_GD31244 0x3200
2174#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2212#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2175#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2213#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
2176#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 2214#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 6bce4a240364..7d0e26cba420 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -196,7 +196,7 @@
196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ 196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
199#define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */ 199#define PCI_CAP_ID_HT 0x08 /* HyperTransport */
200#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */ 200#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */
201#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 201#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
202#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 202#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
@@ -422,7 +422,23 @@
422#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ 422#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */
423#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ 423#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */
424#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ 424#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */
425/* Correctable Err Reporting Enable */
426#define PCI_ERR_ROOT_CMD_COR_EN 0x00000001
427/* Non-fatal Err Reporting Enable */
428#define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002
429/* Fatal Err Reporting Enable */
430#define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004
425#define PCI_ERR_ROOT_STATUS 48 431#define PCI_ERR_ROOT_STATUS 48
432#define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */
433/* Multi ERR_COR Received */
434#define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002
435/* ERR_FATAL/NONFATAL Recevied */
436#define PCI_ERR_ROOT_UNCOR_RCV 0x00000004
437/* Multi ERR_FATAL/NONFATAL Recevied */
438#define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008
439#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */
440#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */
441#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */
426#define PCI_ERR_ROOT_COR_SRC 52 442#define PCI_ERR_ROOT_COR_SRC 52
427#define PCI_ERR_ROOT_SRC 54 443#define PCI_ERR_ROOT_SRC 54
428 444
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index b44e01a70914..6cd91e3f9820 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -62,6 +62,12 @@ struct pcie_port_service_driver {
62 int (*suspend) (struct pcie_device *dev, pm_message_t state); 62 int (*suspend) (struct pcie_device *dev, pm_message_t state);
63 int (*resume) (struct pcie_device *dev); 63 int (*resume) (struct pcie_device *dev);
64 64
65 /* Service Error Recovery Handler */
66 struct pci_error_handlers *err_handler;
67
68 /* Link Reset Capability - AER service driver specific */
69 pci_ers_result_t (*reset_link) (struct pci_dev *dev);
70
65 const struct pcie_port_service_id *id_table; 71 const struct pcie_port_service_id *id_table;
66 struct device_driver driver; 72 struct device_driver driver;
67}; 73};
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index cb9039a21f2a..46ec72fa2c84 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -1,9 +1,12 @@
1#ifndef __LINUX_PERCPU_H 1#ifndef __LINUX_PERCPU_H
2#define __LINUX_PERCPU_H 2#define __LINUX_PERCPU_H
3
3#include <linux/spinlock.h> /* For preempt_disable() */ 4#include <linux/spinlock.h> /* For preempt_disable() */
4#include <linux/slab.h> /* For kmalloc() */ 5#include <linux/slab.h> /* For kmalloc() */
5#include <linux/smp.h> 6#include <linux/smp.h>
6#include <linux/string.h> /* For memset() */ 7#include <linux/string.h> /* For memset() */
8#include <linux/cpumask.h>
9
7#include <asm/percpu.h> 10#include <asm/percpu.h>
8 11
9/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ 12/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
@@ -11,8 +14,14 @@
11#define PERCPU_ENOUGH_ROOM 32768 14#define PERCPU_ENOUGH_ROOM 32768
12#endif 15#endif
13 16
14/* Must be an lvalue. */ 17/*
15#define get_cpu_var(var) (*({ preempt_disable(); &__get_cpu_var(var); })) 18 * Must be an lvalue. Since @var must be a simple identifier,
19 * we force a syntax error here if it isn't.
20 */
21#define get_cpu_var(var) (*({ \
22 extern int simple_indentifier_##var(void); \
23 preempt_disable(); \
24 &__get_cpu_var(var); }))
16#define put_cpu_var(var) preempt_enable() 25#define put_cpu_var(var) preempt_enable()
17 26
18#ifdef CONFIG_SMP 27#ifdef CONFIG_SMP
@@ -21,39 +30,77 @@ struct percpu_data {
21 void *ptrs[NR_CPUS]; 30 void *ptrs[NR_CPUS];
22}; 31};
23 32
33#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata)
24/* 34/*
25 * Use this to get to a cpu's version of the per-cpu object allocated using 35 * Use this to get to a cpu's version of the per-cpu object dynamically
26 * alloc_percpu. Non-atomic access to the current CPU's version should 36 * allocated. Non-atomic access to the current CPU's version should
27 * probably be combined with get_cpu()/put_cpu(). 37 * probably be combined with get_cpu()/put_cpu().
28 */ 38 */
29#define per_cpu_ptr(ptr, cpu) \ 39#define percpu_ptr(ptr, cpu) \
30({ \ 40({ \
31 struct percpu_data *__p = (struct percpu_data *)~(unsigned long)(ptr); \ 41 struct percpu_data *__p = __percpu_disguise(ptr); \
32 (__typeof__(ptr))__p->ptrs[(cpu)]; \ 42 (__typeof__(ptr))__p->ptrs[(cpu)]; \
33}) 43})
34 44
35extern void *__alloc_percpu(size_t size); 45extern void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu);
36extern void free_percpu(const void *); 46extern void percpu_depopulate(void *__pdata, int cpu);
47extern int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
48 cpumask_t *mask);
49extern void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask);
50extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask);
51extern void percpu_free(void *__pdata);
37 52
38#else /* CONFIG_SMP */ 53#else /* CONFIG_SMP */
39 54
40#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 55#define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
56
57static inline void percpu_depopulate(void *__pdata, int cpu)
58{
59}
60
61static inline void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask)
62{
63}
41 64
42static inline void *__alloc_percpu(size_t size) 65static inline void *percpu_populate(void *__pdata, size_t size, gfp_t gfp,
66 int cpu)
43{ 67{
44 void *ret = kmalloc(size, GFP_KERNEL); 68 return percpu_ptr(__pdata, cpu);
45 if (ret)
46 memset(ret, 0, size);
47 return ret;
48} 69}
49static inline void free_percpu(const void *ptr) 70
50{ 71static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
51 kfree(ptr); 72 cpumask_t *mask)
73{
74 return 0;
75}
76
77static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask)
78{
79 return kzalloc(size, gfp);
80}
81
82static inline void percpu_free(void *__pdata)
83{
84 kfree(__pdata);
52} 85}
53 86
54#endif /* CONFIG_SMP */ 87#endif /* CONFIG_SMP */
55 88
56/* Simple wrapper for the common case: zeros memory. */ 89#define percpu_populate_mask(__pdata, size, gfp, mask) \
57#define alloc_percpu(type) ((type *)(__alloc_percpu(sizeof(type)))) 90 __percpu_populate_mask((__pdata), (size), (gfp), &(mask))
91#define percpu_depopulate_mask(__pdata, mask) \
92 __percpu_depopulate_mask((__pdata), &(mask))
93#define percpu_alloc_mask(size, gfp, mask) \
94 __percpu_alloc_mask((size), (gfp), &(mask))
95
96#define percpu_alloc(size, gfp) percpu_alloc_mask((size), (gfp), cpu_online_map)
97
98/* (legacy) interface for use without CPU hotplug handling */
99
100#define __alloc_percpu(size) percpu_alloc_mask((size), GFP_KERNEL, \
101 cpu_possible_map)
102#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type))
103#define free_percpu(ptr) percpu_free((ptr))
104#define per_cpu_ptr(ptr, cpu) percpu_ptr((ptr), (cpu))
58 105
59#endif /* __LINUX_PERCPU_H */ 106#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 331521a10a2d..9447a57ee8a9 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -378,6 +378,7 @@ int phy_mii_ioctl(struct phy_device *phydev,
378 struct mii_ioctl_data *mii_data, int cmd); 378 struct mii_ioctl_data *mii_data, int cmd);
379int phy_start_interrupts(struct phy_device *phydev); 379int phy_start_interrupts(struct phy_device *phydev);
380void phy_print_status(struct phy_device *phydev); 380void phy_print_status(struct phy_device *phydev);
381struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
381 382
382extern struct bus_type mdio_bus_type; 383extern struct bus_type mdio_bus_type;
383#endif /* __PHY_H */ 384#endif /* __PHY_H */
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 29960b03bef7..93da7e2d9f30 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -76,6 +76,8 @@ extern int FASTCALL(attach_pid(struct task_struct *task,
76 enum pid_type type, int nr)); 76 enum pid_type type, int nr));
77 77
78extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type)); 78extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type));
79extern void FASTCALL(transfer_pid(struct task_struct *old,
80 struct task_struct *new, enum pid_type));
79 81
80/* 82/*
81 * look up a PID in the hash table. Must be called with the tasklist_lock 83 * look up a PID in the hash table. Must be called with the tasklist_lock
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index bd2c5a2bbbf5..c3f01b3085a4 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -305,6 +305,7 @@ enum
305 TCA_FW_POLICE, 305 TCA_FW_POLICE,
306 TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */ 306 TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */
307 TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ 307 TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */
308 TCA_FW_MASK,
308 __TCA_FW_MAX 309 __TCA_FW_MAX
309}; 310};
310 311
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 782090c68932..29cd6dee13db 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -49,6 +49,8 @@ struct platform_driver {
49 int (*remove)(struct platform_device *); 49 int (*remove)(struct platform_device *);
50 void (*shutdown)(struct platform_device *); 50 void (*shutdown)(struct platform_device *);
51 int (*suspend)(struct platform_device *, pm_message_t state); 51 int (*suspend)(struct platform_device *, pm_message_t state);
52 int (*suspend_late)(struct platform_device *, pm_message_t state);
53 int (*resume_early)(struct platform_device *);
52 int (*resume)(struct platform_device *); 54 int (*resume)(struct platform_device *);
53 struct device_driver driver; 55 struct device_driver driver;
54}; 56};
diff --git a/include/linux/plist.h b/include/linux/plist.h
new file mode 100644
index 000000000000..b95818a037ad
--- /dev/null
+++ b/include/linux/plist.h
@@ -0,0 +1,248 @@
1/*
2 * Descending-priority-sorted double-linked list
3 *
4 * (C) 2002-2003 Intel Corp
5 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>.
6 *
7 * 2001-2005 (c) MontaVista Software, Inc.
8 * Daniel Walker <dwalker@mvista.com>
9 *
10 * (C) 2005 Thomas Gleixner <tglx@linutronix.de>
11 *
12 * Simplifications of the original code by
13 * Oleg Nesterov <oleg@tv-sign.ru>
14 *
15 * Licensed under the FSF's GNU Public License v2 or later.
16 *
17 * Based on simple lists (include/linux/list.h).
18 *
19 * This is a priority-sorted list of nodes; each node has a
20 * priority from INT_MIN (highest) to INT_MAX (lowest).
21 *
22 * Addition is O(K), removal is O(1), change of priority of a node is
23 * O(K) and K is the number of RT priority levels used in the system.
24 * (1 <= K <= 99)
25 *
26 * This list is really a list of lists:
27 *
28 * - The tier 1 list is the prio_list, different priority nodes.
29 *
30 * - The tier 2 list is the node_list, serialized nodes.
31 *
32 * Simple ASCII art explanation:
33 *
34 * |HEAD |
35 * | |
36 * |prio_list.prev|<------------------------------------|
37 * |prio_list.next|<->|pl|<->|pl|<--------------->|pl|<-|
38 * |10 | |10| |21| |21| |21| |40| (prio)
39 * | | | | | | | | | | | |
40 * | | | | | | | | | | | |
41 * |node_list.next|<->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<-|
42 * |node_list.prev|<------------------------------------|
43 *
44 * The nodes on the prio_list list are sorted by priority to simplify
45 * the insertion of new nodes. There are no nodes with duplicate
46 * priorites on the list.
47 *
48 * The nodes on the node_list is ordered by priority and can contain
49 * entries which have the same priority. Those entries are ordered
50 * FIFO
51 *
52 * Addition means: look for the prio_list node in the prio_list
53 * for the priority of the node and insert it before the node_list
54 * entry of the next prio_list node. If it is the first node of
55 * that priority, add it to the prio_list in the right position and
56 * insert it into the serialized node_list list
57 *
58 * Removal means remove it from the node_list and remove it from
59 * the prio_list if the node_list list_head is non empty. In case
60 * of removal from the prio_list it must be checked whether other
61 * entries of the same priority are on the list or not. If there
62 * is another entry of the same priority then this entry has to
63 * replace the removed entry on the prio_list. If the entry which
64 * is removed is the only entry of this priority then a simple
65 * remove from both list is sufficient.
66 *
67 * INT_MIN is the highest priority, 0 is the medium highest, INT_MAX
68 * is lowest priority.
69 *
70 * No locking is done, up to the caller.
71 *
72 */
73#ifndef _LINUX_PLIST_H_
74#define _LINUX_PLIST_H_
75
76#include <linux/kernel.h>
77#include <linux/list.h>
78#include <linux/spinlock_types.h>
79
80struct plist_head {
81 struct list_head prio_list;
82 struct list_head node_list;
83#ifdef CONFIG_DEBUG_PI_LIST
84 spinlock_t *lock;
85#endif
86};
87
88struct plist_node {
89 int prio;
90 struct plist_head plist;
91};
92
93#ifdef CONFIG_DEBUG_PI_LIST
94# define PLIST_HEAD_LOCK_INIT(_lock) .lock = _lock
95#else
96# define PLIST_HEAD_LOCK_INIT(_lock)
97#endif
98
99/**
100 * #PLIST_HEAD_INIT - static struct plist_head initializer
101 *
102 * @head: struct plist_head variable name
103 */
104#define PLIST_HEAD_INIT(head, _lock) \
105{ \
106 .prio_list = LIST_HEAD_INIT((head).prio_list), \
107 .node_list = LIST_HEAD_INIT((head).node_list), \
108 PLIST_HEAD_LOCK_INIT(&(_lock)) \
109}
110
111/**
112 * #PLIST_NODE_INIT - static struct plist_node initializer
113 *
114 * @node: struct plist_node variable name
115 * @__prio: initial node priority
116 */
117#define PLIST_NODE_INIT(node, __prio) \
118{ \
119 .prio = (__prio), \
120 .plist = PLIST_HEAD_INIT((node).plist, NULL), \
121}
122
123/**
124 * plist_head_init - dynamic struct plist_head initializer
125 *
126 * @head: &struct plist_head pointer
127 */
128static inline void
129plist_head_init(struct plist_head *head, spinlock_t *lock)
130{
131 INIT_LIST_HEAD(&head->prio_list);
132 INIT_LIST_HEAD(&head->node_list);
133#ifdef CONFIG_DEBUG_PI_LIST
134 head->lock = lock;
135#endif
136}
137
138/**
139 * plist_node_init - Dynamic struct plist_node initializer
140 *
141 * @node: &struct plist_node pointer
142 * @prio: initial node priority
143 */
144static inline void plist_node_init(struct plist_node *node, int prio)
145{
146 node->prio = prio;
147 plist_head_init(&node->plist, NULL);
148}
149
150extern void plist_add(struct plist_node *node, struct plist_head *head);
151extern void plist_del(struct plist_node *node, struct plist_head *head);
152
153/**
154 * plist_for_each - iterate over the plist
155 *
156 * @pos1: the type * to use as a loop counter.
157 * @head: the head for your list.
158 */
159#define plist_for_each(pos, head) \
160 list_for_each_entry(pos, &(head)->node_list, plist.node_list)
161
162/**
163 * plist_for_each_entry_safe - iterate over a plist of given type safe
164 * against removal of list entry
165 *
166 * @pos1: the type * to use as a loop counter.
167 * @n1: another type * to use as temporary storage
168 * @head: the head for your list.
169 */
170#define plist_for_each_safe(pos, n, head) \
171 list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list)
172
173/**
174 * plist_for_each_entry - iterate over list of given type
175 *
176 * @pos: the type * to use as a loop counter.
177 * @head: the head for your list.
178 * @member: the name of the list_struct within the struct.
179 */
180#define plist_for_each_entry(pos, head, mem) \
181 list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list)
182
183/**
184 * plist_for_each_entry_safe - iterate over list of given type safe against
185 * removal of list entry
186 *
187 * @pos: the type * to use as a loop counter.
188 * @n: another type * to use as temporary storage
189 * @head: the head for your list.
190 * @m: the name of the list_struct within the struct.
191 */
192#define plist_for_each_entry_safe(pos, n, head, m) \
193 list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list)
194
195/**
196 * plist_head_empty - return !0 if a plist_head is empty
197 *
198 * @head: &struct plist_head pointer
199 */
200static inline int plist_head_empty(const struct plist_head *head)
201{
202 return list_empty(&head->node_list);
203}
204
205/**
206 * plist_node_empty - return !0 if plist_node is not on a list
207 *
208 * @node: &struct plist_node pointer
209 */
210static inline int plist_node_empty(const struct plist_node *node)
211{
212 return plist_head_empty(&node->plist);
213}
214
215/* All functions below assume the plist_head is not empty. */
216
217/**
218 * plist_first_entry - get the struct for the first entry
219 *
220 * @ptr: the &struct plist_head pointer.
221 * @type: the type of the struct this is embedded in.
222 * @member: the name of the list_struct within the struct.
223 */
224#ifdef CONFIG_DEBUG_PI_LIST
225# define plist_first_entry(head, type, member) \
226({ \
227 WARN_ON(plist_head_empty(head)); \
228 container_of(plist_first(head), type, member); \
229})
230#else
231# define plist_first_entry(head, type, member) \
232 container_of(plist_first(head), type, member)
233#endif
234
235/**
236 * plist_first - return the first node (and thus, highest priority)
237 *
238 * @head: the &struct plist_head pointer
239 *
240 * Assumes the plist is _not_ empty.
241 */
242static inline struct plist_node* plist_first(const struct plist_head *head)
243{
244 return list_entry(head->node_list.next,
245 struct plist_node, plist.node_list);
246}
247
248#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 658c1b93d5bb..6b27e07aef19 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -142,29 +142,61 @@ typedef struct pm_message {
142} pm_message_t; 142} pm_message_t;
143 143
144/* 144/*
145 * There are 4 important states driver can be in: 145 * Several driver power state transitions are externally visible, affecting
146 * ON -- driver is working 146 * the state of pending I/O queues and (for drivers that touch hardware)
147 * FREEZE -- stop operations and apply whatever policy is applicable to a 147 * interrupts, wakeups, DMA, and other hardware state. There may also be
148 * suspended driver of that class, freeze queues for block like IDE 148 * internal transitions to various low power modes, which are transparent
149 * does, drop packets for ethernet, etc... stop DMA engine too etc... 149 * to the rest of the driver stack (such as a driver that's ON gating off
150 * so a consistent image can be saved; but do not power any hardware 150 * clocks which are not in active use).
151 * down.
152 * SUSPEND - like FREEZE, but hardware is doing as much powersaving as
153 * possible. Roughly pci D3.
154 * 151 *
155 * Unfortunately, current drivers only recognize numeric values 0 (ON) and 3 152 * One transition is triggered by resume(), after a suspend() call; the
156 * (SUSPEND). We'll need to fix the drivers. So yes, putting 3 to all different 153 * message is implicit:
157 * defines is intentional, and will go away as soon as drivers are fixed. Also 154 *
158 * note that typedef is neccessary, we'll probably want to switch to 155 * ON Driver starts working again, responding to hardware events
159 * typedef struct pm_message_t { int event; int flags; } pm_message_t 156 * and software requests. The hardware may have gone through
160 * or something similar soon. 157 * a power-off reset, or it may have maintained state from the
158 * previous suspend() which the driver will rely on while
159 * resuming. On most platforms, there are no restrictions on
160 * availability of resources like clocks during resume().
161 *
162 * Other transitions are triggered by messages sent using suspend(). All
163 * these transitions quiesce the driver, so that I/O queues are inactive.
164 * That commonly entails turning off IRQs and DMA; there may be rules
165 * about how to quiesce that are specific to the bus or the device's type.
166 * (For example, network drivers mark the link state.) Other details may
167 * differ according to the message:
168 *
169 * SUSPEND Quiesce, enter a low power device state appropriate for
170 * the upcoming system state (such as PCI_D3hot), and enable
171 * wakeup events as appropriate.
172 *
173 * FREEZE Quiesce operations so that a consistent image can be saved;
174 * but do NOT otherwise enter a low power device state, and do
175 * NOT emit system wakeup events.
176 *
177 * PRETHAW Quiesce as if for FREEZE; additionally, prepare for restoring
178 * the system from a snapshot taken after an earlier FREEZE.
179 * Some drivers will need to reset their hardware state instead
180 * of preserving it, to ensure that it's never mistaken for the
181 * state which that earlier snapshot had set up.
182 *
183 * A minimally power-aware driver treats all messages as SUSPEND, fully
184 * reinitializes its device during resume() -- whether or not it was reset
185 * during the suspend/resume cycle -- and can't issue wakeup events.
186 *
187 * More power-aware drivers may also use low power states at runtime as
188 * well as during system sleep states like PM_SUSPEND_STANDBY. They may
189 * be able to use wakeup events to exit from runtime low-power states,
190 * or from system low-power states such as standby or suspend-to-RAM.
161 */ 191 */
162 192
163#define PM_EVENT_ON 0 193#define PM_EVENT_ON 0
164#define PM_EVENT_FREEZE 1 194#define PM_EVENT_FREEZE 1
165#define PM_EVENT_SUSPEND 2 195#define PM_EVENT_SUSPEND 2
196#define PM_EVENT_PRETHAW 3
166 197
167#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, }) 198#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, })
199#define PMSG_PRETHAW ((struct pm_message){ .event = PM_EVENT_PRETHAW, })
168#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, }) 200#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
169#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, }) 201#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, })
170 202
@@ -190,6 +222,7 @@ extern void device_resume(void);
190extern suspend_disk_method_t pm_disk_mode; 222extern suspend_disk_method_t pm_disk_mode;
191 223
192extern int device_suspend(pm_message_t state); 224extern int device_suspend(pm_message_t state);
225extern int device_prepare_suspend(pm_message_t state);
193 226
194#define device_set_wakeup_enable(dev,val) \ 227#define device_set_wakeup_enable(dev,val) \
195 ((dev)->power.should_wakeup = !!(val)) 228 ((dev)->power.should_wakeup = !!(val))
diff --git a/include/linux/pm_legacy.h b/include/linux/pm_legacy.h
index 78027c533b94..514729a44688 100644
--- a/include/linux/pm_legacy.h
+++ b/include/linux/pm_legacy.h
@@ -15,11 +15,6 @@ struct pm_dev __deprecated *
15pm_register(pm_dev_t type, unsigned long id, pm_callback callback); 15pm_register(pm_dev_t type, unsigned long id, pm_callback callback);
16 16
17/* 17/*
18 * Unregister all devices with matching callback
19 */
20void __deprecated pm_unregister_all(pm_callback callback);
21
22/*
23 * Send a request to all devices 18 * Send a request to all devices
24 */ 19 */
25int __deprecated pm_send_all(pm_request_t rqst, void *data); 20int __deprecated pm_send_all(pm_request_t rqst, void *data);
@@ -35,8 +30,6 @@ static inline struct pm_dev *pm_register(pm_dev_t type,
35 return NULL; 30 return NULL;
36} 31}
37 32
38static inline void pm_unregister_all(pm_callback callback) {}
39
40static inline int pm_send_all(pm_request_t rqst, void *data) 33static inline int pm_send_all(pm_request_t rqst, void *data)
41{ 34{
42 return 0; 35 return 0;
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index ecce5912f4d6..783177387ac6 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -230,4 +230,7 @@ extern int pmu_battery_count;
230extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES]; 230extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
231extern unsigned int pmu_power_flags; 231extern unsigned int pmu_power_flags;
232 232
233/* Backlight */
234extern void pmu_backlight_init(void);
235
233#endif /* __KERNEL__ */ 236#endif /* __KERNEL__ */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 93b0959eb40f..ab8a8dd8d64c 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -389,7 +389,8 @@ int pnp_start_dev(struct pnp_dev *dev);
389int pnp_stop_dev(struct pnp_dev *dev); 389int pnp_stop_dev(struct pnp_dev *dev);
390int pnp_activate_dev(struct pnp_dev *dev); 390int pnp_activate_dev(struct pnp_dev *dev);
391int pnp_disable_dev(struct pnp_dev *dev); 391int pnp_disable_dev(struct pnp_dev *dev);
392void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size); 392void pnp_resource_change(struct resource *resource, resource_size_t start,
393 resource_size_t size);
393 394
394/* protocol helpers */ 395/* protocol helpers */
395int pnp_is_active(struct pnp_dev * dev); 396int pnp_is_active(struct pnp_dev * dev);
@@ -434,7 +435,9 @@ static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
434static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } 435static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
435static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 436static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
436static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 437static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
437static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { } 438static inline void pnp_resource_change(struct resource *resource,
439 resource_size_t start,
440 resource_size_t size) { }
438 441
439/* protocol helpers */ 442/* protocol helpers */
440static inline int pnp_is_active(struct pnp_dev * dev) { return 0; } 443static inline int pnp_is_active(struct pnp_dev * dev) { return 0; }
diff --git a/include/linux/poison.h b/include/linux/poison.h
new file mode 100644
index 000000000000..3e628f990fdf
--- /dev/null
+++ b/include/linux/poison.h
@@ -0,0 +1,63 @@
1#ifndef _LINUX_POISON_H
2#define _LINUX_POISON_H
3
4/********** include/linux/list.h **********/
5/*
6 * These are non-NULL pointers that will result in page faults
7 * under normal circumstances, used to verify that nobody uses
8 * non-initialized list entries.
9 */
10#define LIST_POISON1 ((void *) 0x00100100)
11#define LIST_POISON2 ((void *) 0x00200200)
12
13/********** mm/slab.c **********/
14/*
15 * Magic nums for obj red zoning.
16 * Placed in the first word before and the first word after an obj.
17 */
18#define RED_INACTIVE 0x5A2CF071UL /* when obj is inactive */
19#define RED_ACTIVE 0x170FC2A5UL /* when obj is active */
20
21/* ...and for poisoning */
22#define POISON_INUSE 0x5a /* for use-uninitialised poisoning */
23#define POISON_FREE 0x6b /* for use-after-free poisoning */
24#define POISON_END 0xa5 /* end-byte of poisoning */
25
26/********** arch/$ARCH/mm/init.c **********/
27#define POISON_FREE_INITMEM 0xcc
28
29/********** arch/x86_64/mm/init.c **********/
30#define POISON_FREE_INITDATA 0xba
31
32/********** arch/ia64/hp/common/sba_iommu.c **********/
33/*
34 * arch/ia64/hp/common/sba_iommu.c uses a 16-byte poison string with a
35 * value of "SBAIOMMU POISON\0" for spill-over poisoning.
36 */
37
38/********** fs/jbd/journal.c **********/
39#define JBD_POISON_FREE 0x5b
40
41/********** drivers/base/dmapool.c **********/
42#define POOL_POISON_FREED 0xa7 /* !inuse */
43#define POOL_POISON_ALLOCATED 0xa9 /* !initted */
44
45/********** drivers/atm/ **********/
46#define ATM_POISON_FREE 0x12
47#define ATM_POISON 0xdeadbeef
48
49/********** net/ **********/
50#define NEIGHBOR_DEAD 0xdeadbeef
51#define NETFILTER_LINK_POISON 0xdead57ac
52
53/********** kernel/mutexes **********/
54#define MUTEX_DEBUG_INIT 0x11
55#define MUTEX_DEBUG_FREE 0x22
56
57/********** security/ **********/
58#define KEY_DESTROY 0xbd
59
60/********** sound/oss/ **********/
61#define OSS_POISON_FREE 0xAB
62
63#endif
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 95572c434bc9..a7dd38f30ade 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -72,6 +72,7 @@ struct k_clock {
72 int (*timer_create) (struct k_itimer *timer); 72 int (*timer_create) (struct k_itimer *timer);
73 int (*nsleep) (const clockid_t which_clock, int flags, 73 int (*nsleep) (const clockid_t which_clock, int flags,
74 struct timespec *, struct timespec __user *); 74 struct timespec *, struct timespec __user *);
75 long (*nsleep_restart) (struct restart_block *restart_block);
75 int (*timer_set) (struct k_itimer * timr, int flags, 76 int (*timer_set) (struct k_itimer * timr, int flags,
76 struct itimerspec * new_setting, 77 struct itimerspec * new_setting,
77 struct itimerspec * old_setting); 78 struct itimerspec * old_setting);
@@ -97,6 +98,7 @@ int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts);
97int posix_cpu_timer_create(struct k_itimer *timer); 98int posix_cpu_timer_create(struct k_itimer *timer);
98int posix_cpu_nsleep(const clockid_t which_clock, int flags, 99int posix_cpu_nsleep(const clockid_t which_clock, int flags,
99 struct timespec *rqtp, struct timespec __user *rmtp); 100 struct timespec *rqtp, struct timespec __user *rmtp);
101long posix_cpu_nsleep_restart(struct restart_block *restart_block);
100int posix_cpu_timer_set(struct k_itimer *timer, int flags, 102int posix_cpu_timer_set(struct k_itimer *timer, int flags,
101 struct itimerspec *new, struct itimerspec *old); 103 struct itimerspec *new, struct itimerspec *old);
102int posix_cpu_timer_del(struct k_itimer *timer); 104int posix_cpu_timer_del(struct k_itimer *timer);
@@ -111,4 +113,6 @@ void posix_cpu_timers_exit_group(struct task_struct *task);
111void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx, 113void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
112 cputime_t *newval, cputime_t *oldval); 114 cputime_t *newval, cputime_t *oldval);
113 115
116long clock_nanosleep_restart(struct restart_block *restart_block);
117
114#endif 118#endif
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 5810d28fbed9..57f70bc8b24b 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -4,6 +4,7 @@
4#include <linux/slab.h> 4#include <linux/slab.h>
5#include <linux/fs.h> 5#include <linux/fs.h>
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/magic.h>
7#include <asm/atomic.h> 8#include <asm/atomic.h>
8 9
9/* 10/*
@@ -24,8 +25,6 @@ enum {
24 PROC_ROOT_INO = 1, 25 PROC_ROOT_INO = 1,
25}; 26};
26 27
27#define PROC_SUPER_MAGIC 0x9fa0
28
29/* 28/*
30 * This is not completely implemented yet. The idea is to 29 * This is not completely implemented yet. The idea is to
31 * create an in-memory tree (like the actual /proc filesystem 30 * create an in-memory tree (like the actual /proc filesystem
@@ -99,9 +98,8 @@ extern void proc_misc_init(void);
99 98
100struct mm_struct; 99struct mm_struct;
101 100
101void proc_flush_task(struct task_struct *task);
102struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); 102struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *);
103struct dentry *proc_pid_unhash(struct task_struct *p);
104void proc_pid_flush(struct dentry *proc_dentry);
105int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); 103int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
106unsigned long task_vsize(struct mm_struct *); 104unsigned long task_vsize(struct mm_struct *);
107int task_statm(struct mm_struct *, int *, int *, int *, int *); 105int task_statm(struct mm_struct *, int *, int *, int *, int *);
@@ -211,8 +209,7 @@ static inline void proc_net_remove(const char *name)
211#define proc_net_create(name, mode, info) ({ (void)(mode), NULL; }) 209#define proc_net_create(name, mode, info) ({ (void)(mode), NULL; })
212static inline void proc_net_remove(const char *name) {} 210static inline void proc_net_remove(const char *name) {}
213 211
214static inline struct dentry *proc_pid_unhash(struct task_struct *p) { return NULL; } 212static inline void proc_flush_task(struct task_struct *task) { }
215static inline void proc_pid_flush(struct dentry *proc_dentry) { }
216 213
217static inline struct proc_dir_entry *create_proc_entry(const char *name, 214static inline struct proc_dir_entry *create_proc_entry(const char *name,
218 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 215 mode_t mode, struct proc_dir_entry *parent) { return NULL; }
@@ -248,8 +245,8 @@ extern void kclist_add(struct kcore_list *, void *, size_t);
248#endif 245#endif
249 246
250struct proc_inode { 247struct proc_inode {
251 struct task_struct *task; 248 struct pid *pid;
252 int type; 249 int fd;
253 union { 250 union {
254 int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **); 251 int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **);
255 int (*proc_read)(struct task_struct *task, char *page); 252 int (*proc_read)(struct task_struct *task, char *page);
@@ -268,4 +265,12 @@ static inline struct proc_dir_entry *PDE(const struct inode *inode)
268 return PROC_I(inode)->pde; 265 return PROC_I(inode)->pde;
269} 266}
270 267
268struct proc_maps_private {
269 struct pid *pid;
270 struct task_struct *task;
271#ifdef CONFIG_MMU
272 struct vm_area_struct *tail_vma;
273#endif
274};
275
271#endif /* _LINUX_PROC_FS_H */ 276#endif /* _LINUX_PROC_FS_H */
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index ee918bc6e18c..eeb1976ef7bf 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -16,8 +16,8 @@
16#define PTRACE_KILL 8 16#define PTRACE_KILL 8
17#define PTRACE_SINGLESTEP 9 17#define PTRACE_SINGLESTEP 9
18 18
19#define PTRACE_ATTACH 0x10 19#define PTRACE_ATTACH 16
20#define PTRACE_DETACH 0x11 20#define PTRACE_DETACH 17
21 21
22#define PTRACE_SYSCALL 24 22#define PTRACE_SYSCALL 24
23 23
@@ -88,7 +88,6 @@ extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __us
88extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 88extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
89extern int ptrace_attach(struct task_struct *tsk); 89extern int ptrace_attach(struct task_struct *tsk);
90extern int ptrace_detach(struct task_struct *, unsigned int); 90extern int ptrace_detach(struct task_struct *, unsigned int);
91extern void __ptrace_detach(struct task_struct *, unsigned int);
92extern void ptrace_disable(struct task_struct *); 91extern void ptrace_disable(struct task_struct *);
93extern int ptrace_check_attach(struct task_struct *task, int kill); 92extern int ptrace_check_attach(struct task_struct *task, int kill);
94extern int ptrace_request(struct task_struct *child, long request, long addr, long data); 93extern int ptrace_request(struct task_struct *child, long request, long addr, long data);
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index 27f49c85d5d6..0c7ac444fd35 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -11,6 +11,7 @@
11#define _LINUX_QNX4_FS_H 11#define _LINUX_QNX4_FS_H
12 12
13#include <linux/qnxtypes.h> 13#include <linux/qnxtypes.h>
14#include <linux/magic.h>
14 15
15#define QNX4_ROOT_INO 1 16#define QNX4_ROOT_INO 1
16 17
@@ -25,7 +26,6 @@
25 26
26#define QNX4_I_MAP_SLOTS 8 27#define QNX4_I_MAP_SLOTS 8
27#define QNX4_Z_MAP_SLOTS 64 28#define QNX4_Z_MAP_SLOTS 64
28#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */
29#define QNX4_VALID_FS 0x0001 /* Clean fs. */ 29#define QNX4_VALID_FS 0x0001 /* Clean fs. */
30#define QNX4_ERROR_FS 0x0002 /* fs has errors. */ 30#define QNX4_ERROR_FS 0x0002 /* fs has errors. */
31#define QNX4_BLOCK_SIZE 0x200 /* blocksize of 512 bytes */ 31#define QNX4_BLOCK_SIZE 0x200 /* blocksize of 512 bytes */
diff --git a/include/linux/raid/Kbuild b/include/linux/raid/Kbuild
new file mode 100644
index 000000000000..2415a64c5e51
--- /dev/null
+++ b/include/linux/raid/Kbuild
@@ -0,0 +1,2 @@
1header-y += md_p.h
2header-y += md_u.h
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 899437802aea..63df898fe2e9 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -140,6 +140,7 @@ typedef __u16 bitmap_counter_t;
140enum bitmap_state { 140enum bitmap_state {
141 BITMAP_ACTIVE = 0x001, /* the bitmap is in use */ 141 BITMAP_ACTIVE = 0x001, /* the bitmap is in use */
142 BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */ 142 BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */
143 BITMAP_WRITE_ERROR = 0x004, /* A write error has occurred */
143 BITMAP_HOSTENDIAN = 0x8000, 144 BITMAP_HOSTENDIAN = 0x8000,
144}; 145};
145 146
@@ -244,15 +245,9 @@ struct bitmap {
244 unsigned long daemon_lastrun; /* jiffies of last run */ 245 unsigned long daemon_lastrun; /* jiffies of last run */
245 unsigned long daemon_sleep; /* how many seconds between updates? */ 246 unsigned long daemon_sleep; /* how many seconds between updates? */
246 247
247 /* 248 atomic_t pending_writes; /* pending writes to the bitmap file */
248 * bitmap_writeback_daemon waits for file-pages that have been written,
249 * as there is no way to get a call-back when a page write completes.
250 */
251 mdk_thread_t *writeback_daemon;
252 spinlock_t write_lock;
253 wait_queue_head_t write_wait; 249 wait_queue_head_t write_wait;
254 struct list_head complete_pages; 250
255 mempool_t *write_pool;
256}; 251};
257 252
258/* the bitmap API */ 253/* the bitmap API */
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h
index 7eaf290e10e7..ba15469daf11 100644
--- a/include/linux/raid/linear.h
+++ b/include/linux/raid/linear.h
@@ -13,8 +13,10 @@ typedef struct dev_info dev_info_t;
13 13
14struct linear_private_data 14struct linear_private_data
15{ 15{
16 struct linear_private_data *prev; /* earlier version */
16 dev_info_t **hash_table; 17 dev_info_t **hash_table;
17 sector_t hash_spacing; 18 sector_t hash_spacing;
19 sector_t array_size;
18 int preshift; /* shift before dividing by hash_spacing */ 20 int preshift; /* shift before dividing by hash_spacing */
19 dev_info_t disks[0]; 21 dev_info_t disks[0];
20}; 22};
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 66b44e5e0d6e..eb3e547c8fee 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -85,8 +85,6 @@ extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
85extern void md_error (mddev_t *mddev, mdk_rdev_t *rdev); 85extern void md_error (mddev_t *mddev, mdk_rdev_t *rdev);
86extern void md_unplug_mddev(mddev_t *mddev); 86extern void md_unplug_mddev(mddev_t *mddev);
87 87
88extern void md_print_devices (void);
89
90extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, 88extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
91 sector_t sector, int size, struct page *page); 89 sector_t sector, int size, struct page *page);
92extern void md_super_wait(mddev_t *mddev); 90extern void md_super_wait(mddev_t *mddev);
@@ -97,7 +95,5 @@ extern void md_new_event(mddev_t *mddev);
97 95
98extern void md_update_sb(mddev_t * mddev); 96extern void md_update_sb(mddev_t * mddev);
99 97
100#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }
101
102#endif 98#endif
103 99
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index e2df61f5b09a..d28890295852 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -40,7 +40,8 @@ typedef struct mdk_rdev_s mdk_rdev_t;
40 * options passed in raidrun: 40 * options passed in raidrun:
41 */ 41 */
42 42
43#define MAX_CHUNK_SIZE (4096*1024) 43/* Currently this must fix in an 'int' */
44#define MAX_CHUNK_SIZE (1<<30)
44 45
45/* 46/*
46 * MD's 'extended' device 47 * MD's 'extended' device
@@ -57,6 +58,7 @@ struct mdk_rdev_s
57 58
58 struct page *sb_page; 59 struct page *sb_page;
59 int sb_loaded; 60 int sb_loaded;
61 __u64 sb_events;
60 sector_t data_offset; /* start of data in array */ 62 sector_t data_offset; /* start of data in array */
61 sector_t sb_offset; 63 sector_t sb_offset;
62 int sb_size; /* bytes in the superblock */ 64 int sb_size; /* bytes in the superblock */
@@ -87,6 +89,10 @@ struct mdk_rdev_s
87 * array and could again if we did a partial 89 * array and could again if we did a partial
88 * resync from the bitmap 90 * resync from the bitmap
89 */ 91 */
92 sector_t recovery_offset;/* If this device has been partially
93 * recovered, this is where we were
94 * up to.
95 */
90 96
91 atomic_t nr_pending; /* number of pending requests. 97 atomic_t nr_pending; /* number of pending requests.
92 * only maintained for arrays that 98 * only maintained for arrays that
@@ -142,9 +148,10 @@ struct mddev_s
142 148
143 struct mdk_thread_s *thread; /* management thread */ 149 struct mdk_thread_s *thread; /* management thread */
144 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ 150 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */
145 sector_t curr_resync; /* blocks scheduled */ 151 sector_t curr_resync; /* last block scheduled */
146 unsigned long resync_mark; /* a recent timestamp */ 152 unsigned long resync_mark; /* a recent timestamp */
147 sector_t resync_mark_cnt;/* blocks written at resync_mark */ 153 sector_t resync_mark_cnt;/* blocks written at resync_mark */
154 sector_t curr_mark_cnt; /* blocks scheduled now */
148 155
149 sector_t resync_max_sectors; /* may be set by personality */ 156 sector_t resync_max_sectors; /* may be set by personality */
150 157
@@ -182,6 +189,8 @@ struct mddev_s
182#define MD_RECOVERY_REQUESTED 6 189#define MD_RECOVERY_REQUESTED 6
183#define MD_RECOVERY_CHECK 7 190#define MD_RECOVERY_CHECK 7
184#define MD_RECOVERY_RESHAPE 8 191#define MD_RECOVERY_RESHAPE 8
192#define MD_RECOVERY_FROZEN 9
193
185 unsigned long recovery; 194 unsigned long recovery;
186 195
187 int in_sync; /* know to not need resync */ 196 int in_sync; /* know to not need resync */
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index f1fbae7e390e..b6ebc69bae54 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -265,9 +265,12 @@ struct mdp_superblock_1 {
265 265
266/* feature_map bits */ 266/* feature_map bits */
267#define MD_FEATURE_BITMAP_OFFSET 1 267#define MD_FEATURE_BITMAP_OFFSET 1
268#define MD_FEATURE_RECOVERY_OFFSET 2 /* recovery_offset is present and
269 * must be honoured
270 */
268#define MD_FEATURE_RESHAPE_ACTIVE 4 271#define MD_FEATURE_RESHAPE_ACTIVE 4
269 272
270#define MD_FEATURE_ALL 5 273#define MD_FEATURE_ALL (1|2|4)
271 274
272#endif 275#endif
273 276
diff --git a/include/linux/raid/raid10.h b/include/linux/raid/raid10.h
index b1103298a8c2..c41e56a7c090 100644
--- a/include/linux/raid/raid10.h
+++ b/include/linux/raid/raid10.h
@@ -24,11 +24,16 @@ struct r10_private_data_s {
24 int far_copies; /* number of copies layed out 24 int far_copies; /* number of copies layed out
25 * at large strides across drives 25 * at large strides across drives
26 */ 26 */
27 int far_offset; /* far_copies are offset by 1 stripe
28 * instead of many
29 */
27 int copies; /* near_copies * far_copies. 30 int copies; /* near_copies * far_copies.
28 * must be <= raid_disks 31 * must be <= raid_disks
29 */ 32 */
30 sector_t stride; /* distance between far copies. 33 sector_t stride; /* distance between far copies.
31 * This is size / far_copies 34 * This is size / far_copies unless
35 * far_offset, in which case it is
36 * 1 stripe.
32 */ 37 */
33 38
34 int chunk_shift; /* shift from chunks to sectors */ 39 int chunk_shift; /* shift from chunks to sectors */
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 914af667044f..20ed4c997636 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -212,6 +212,7 @@ struct raid5_private_data {
212 mddev_t *mddev; 212 mddev_t *mddev;
213 struct disk_info *spare; 213 struct disk_info *spare;
214 int chunk_size, level, algorithm; 214 int chunk_size, level, algorithm;
215 int max_degraded;
215 int raid_disks, working_disks, failed_disks; 216 int raid_disks, working_disks, failed_disks;
216 int max_nr_stripes; 217 int max_nr_stripes;
217 218
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 6312758393b6..b4ca73d65891 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -163,14 +163,22 @@ extern int rcu_needs_cpu(int cpu);
163 * 163 *
164 * It is illegal to block while in an RCU read-side critical section. 164 * It is illegal to block while in an RCU read-side critical section.
165 */ 165 */
166#define rcu_read_lock() preempt_disable() 166#define rcu_read_lock() \
167 do { \
168 preempt_disable(); \
169 __acquire(RCU); \
170 } while(0)
167 171
168/** 172/**
169 * rcu_read_unlock - marks the end of an RCU read-side critical section. 173 * rcu_read_unlock - marks the end of an RCU read-side critical section.
170 * 174 *
171 * See rcu_read_lock() for more information. 175 * See rcu_read_lock() for more information.
172 */ 176 */
173#define rcu_read_unlock() preempt_enable() 177#define rcu_read_unlock() \
178 do { \
179 __release(RCU); \
180 preempt_enable(); \
181 } while(0)
174 182
175/* 183/*
176 * So where is rcu_write_lock()? It does not exist, as there is no 184 * So where is rcu_write_lock()? It does not exist, as there is no
@@ -193,14 +201,22 @@ extern int rcu_needs_cpu(int cpu);
193 * can use just rcu_read_lock(). 201 * can use just rcu_read_lock().
194 * 202 *
195 */ 203 */
196#define rcu_read_lock_bh() local_bh_disable() 204#define rcu_read_lock_bh() \
205 do { \
206 local_bh_disable(); \
207 __acquire(RCU_BH); \
208 } while(0)
197 209
198/* 210/*
199 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section 211 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section
200 * 212 *
201 * See rcu_read_lock_bh() for more information. 213 * See rcu_read_lock_bh() for more information.
202 */ 214 */
203#define rcu_read_unlock_bh() local_bh_enable() 215#define rcu_read_unlock_bh() \
216 do { \
217 __release(RCU_BH); \
218 local_bh_enable(); \
219 } while(0)
204 220
205/** 221/**
206 * rcu_dereference - fetch an RCU-protected pointer in an 222 * rcu_dereference - fetch an RCU-protected pointer in an
@@ -258,6 +274,7 @@ extern void rcu_init(void);
258extern void rcu_check_callbacks(int cpu, int user); 274extern void rcu_check_callbacks(int cpu, int user);
259extern void rcu_restart_cpu(int cpu); 275extern void rcu_restart_cpu(int cpu);
260extern long rcu_batches_completed(void); 276extern long rcu_batches_completed(void);
277extern long rcu_batches_completed_bh(void);
261 278
262/* Exported interfaces */ 279/* Exported interfaces */
263extern void FASTCALL(call_rcu(struct rcu_head *head, 280extern void FASTCALL(call_rcu(struct rcu_head *head,
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 015297ff73fa..1dd1c707311f 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -59,13 +59,13 @@ extern void machine_crash_shutdown(struct pt_regs *);
59 * Architecture independent implemenations of sys_reboot commands. 59 * Architecture independent implemenations of sys_reboot commands.
60 */ 60 */
61 61
62extern void kernel_restart_prepare(char *cmd);
63extern void kernel_shutdown_prepare(enum system_states state); 62extern void kernel_shutdown_prepare(enum system_states state);
64 63
65extern void kernel_restart(char *cmd); 64extern void kernel_restart(char *cmd);
66extern void kernel_halt(void); 65extern void kernel_halt(void);
67extern void kernel_power_off(void); 66extern void kernel_power_off(void);
68extern void kernel_kexec(void); 67
68void ctrl_alt_del(void);
69 69
70/* 70/*
71 * Emergency restart, callable from an interrupt handler. 71 * Emergency restart, callable from an interrupt handler.
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index 806ec5b06707..fe00f781a622 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -56,6 +56,16 @@ extern int reiserfs_xattr_posix_acl_init(void) __init;
56extern int reiserfs_xattr_posix_acl_exit(void); 56extern int reiserfs_xattr_posix_acl_exit(void);
57extern struct reiserfs_xattr_handler posix_acl_default_handler; 57extern struct reiserfs_xattr_handler posix_acl_default_handler;
58extern struct reiserfs_xattr_handler posix_acl_access_handler; 58extern struct reiserfs_xattr_handler posix_acl_access_handler;
59
60static inline void reiserfs_init_acl_access(struct inode *inode)
61{
62 REISERFS_I(inode)->i_acl_access = NULL;
63}
64
65static inline void reiserfs_init_acl_default(struct inode *inode)
66{
67 REISERFS_I(inode)->i_acl_default = NULL;
68}
59#else 69#else
60 70
61#define reiserfs_cache_default_acl(inode) 0 71#define reiserfs_cache_default_acl(inode) 0
@@ -87,4 +97,11 @@ reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry,
87 return 0; 97 return 0;
88} 98}
89 99
100static inline void reiserfs_init_acl_access(struct inode *inode)
101{
102}
103
104static inline void reiserfs_init_acl_default(struct inode *inode)
105{
106}
90#endif 107#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 5676c4210e2c..28493ffaafe7 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -12,6 +12,8 @@
12#define _LINUX_REISER_FS_H 12#define _LINUX_REISER_FS_H
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/magic.h>
16
15#ifdef __KERNEL__ 17#ifdef __KERNEL__
16#include <linux/slab.h> 18#include <linux/slab.h>
17#include <linux/interrupt.h> 19#include <linux/interrupt.h>
@@ -227,14 +229,6 @@ struct reiserfs_super_block {
227 ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ 229 ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \
228 SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) 230 SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s)))
229 231
230 /* used by gcc */
231#define REISERFS_SUPER_MAGIC 0x52654973
232 /* used by file system utilities that
233 look at the superblock, etc. */
234#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
235#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
236#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
237
238int is_reiserfs_3_5(struct reiserfs_super_block *rs); 232int is_reiserfs_3_5(struct reiserfs_super_block *rs);
239int is_reiserfs_3_6(struct reiserfs_super_block *rs); 233int is_reiserfs_3_6(struct reiserfs_super_block *rs);
240int is_reiserfs_jr(struct reiserfs_super_block *rs); 234int is_reiserfs_jr(struct reiserfs_super_block *rs);
@@ -1973,7 +1967,7 @@ void reiserfs_unmap_buffer(struct buffer_head *);
1973/* file.c */ 1967/* file.c */
1974extern struct inode_operations reiserfs_file_inode_operations; 1968extern struct inode_operations reiserfs_file_inode_operations;
1975extern const struct file_operations reiserfs_file_operations; 1969extern const struct file_operations reiserfs_file_operations;
1976extern struct address_space_operations reiserfs_address_space_operations; 1970extern const struct address_space_operations reiserfs_address_space_operations;
1977 1971
1978/* fix_nodes.c */ 1972/* fix_nodes.c */
1979 1973
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index 149be8d9a0c9..5b3b297aa2c5 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -52,10 +52,13 @@ struct reiserfs_inode_info {
52 ** flushed */ 52 ** flushed */
53 unsigned long i_trans_id; 53 unsigned long i_trans_id;
54 struct reiserfs_journal_list *i_jl; 54 struct reiserfs_journal_list *i_jl;
55 55#ifdef CONFIG_REISERFS_FS_POSIX_ACL
56 struct posix_acl *i_acl_access; 56 struct posix_acl *i_acl_access;
57 struct posix_acl *i_acl_default; 57 struct posix_acl *i_acl_default;
58#endif
59#ifdef CONFIG_REISERFS_FS_XATTR
58 struct rw_semaphore xattr_sem; 60 struct rw_semaphore xattr_sem;
61#endif
59 struct inode vfs_inode; 62 struct inode vfs_inode;
60}; 63};
61 64
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 5e961035c725..966c35851b2e 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -97,6 +97,11 @@ static inline void reiserfs_mark_inode_private(struct inode *inode)
97 inode->i_flags |= S_PRIVATE; 97 inode->i_flags |= S_PRIVATE;
98} 98}
99 99
100static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
101{
102 init_rwsem(&REISERFS_I(inode)->xattr_sem);
103}
104
100#else 105#else
101 106
102#define is_reiserfs_priv_object(inode) 0 107#define is_reiserfs_priv_object(inode) 0
@@ -129,6 +134,9 @@ static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags)
129 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */ 134 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
130 return 0; 135 return 0;
131}; 136};
137static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
138{
139}
132#endif 140#endif
133 141
134#endif /* __KERNEL__ */ 142#endif /* __KERNEL__ */
diff --git a/include/linux/resource.h b/include/linux/resource.h
index 21a86cb6acdb..ae13db714742 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/time.h> 4#include <linux/time.h>
5 5
6struct task_struct;
7
6/* 8/*
7 * Resource control/accounting header file for linux 9 * Resource control/accounting header file for linux
8 */ 10 */
@@ -67,4 +69,6 @@ struct rlimit {
67 */ 69 */
68#include <asm/resource.h> 70#include <asm/resource.h>
69 71
72int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
73
70#endif 74#endif
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h
new file mode 100644
index 000000000000..81e9299ca148
--- /dev/null
+++ b/include/linux/resume-trace.h
@@ -0,0 +1,34 @@
1#ifndef RESUME_TRACE_H
2#define RESUME_TRACE_H
3
4#ifdef CONFIG_PM_TRACE
5
6extern int pm_trace_enabled;
7
8struct device;
9extern void set_trace_device(struct device *);
10extern void generate_resume_trace(void *tracedata, unsigned int user);
11
12#define TRACE_DEVICE(dev) set_trace_device(dev)
13#define TRACE_RESUME(user) do { \
14 if (pm_trace_enabled) { \
15 void *tracedata; \
16 asm volatile("movl $1f,%0\n" \
17 ".section .tracedata,\"a\"\n" \
18 "1:\t.word %c1\n" \
19 "\t.long %c2\n" \
20 ".previous" \
21 :"=r" (tracedata) \
22 : "i" (__LINE__), "i" (__FILE__)); \
23 generate_resume_trace(tracedata, user); \
24 } \
25} while (0)
26
27#else
28
29#define TRACE_DEVICE(dev) do { } while (0)
30#define TRACE_RESUME(dev) do { } while (0)
31
32#endif
33
34#endif
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index bf97b0900014..db2c1df4fef9 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -103,6 +103,14 @@ pte_t *page_check_address(struct page *, struct mm_struct *,
103 */ 103 */
104unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); 104unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
105 105
106/*
107 * Cleans the PTEs of shared mappings.
108 * (and since clean PTEs should also be readonly, write protects them too)
109 *
110 * returns the number of cleaned PTEs.
111 */
112int page_mkclean(struct page *);
113
106#else /* !CONFIG_MMU */ 114#else /* !CONFIG_MMU */
107 115
108#define anon_vma_init() do {} while (0) 116#define anon_vma_init() do {} while (0)
@@ -112,6 +120,12 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
112#define page_referenced(page,l) TestClearPageReferenced(page) 120#define page_referenced(page,l) TestClearPageReferenced(page)
113#define try_to_unmap(page, refs) SWAP_FAIL 121#define try_to_unmap(page, refs) SWAP_FAIL
114 122
123static inline int page_mkclean(struct page *page)
124{
125 return 0;
126}
127
128
115#endif /* CONFIG_MMU */ 129#endif /* CONFIG_MMU */
116 130
117/* 131/*
diff --git a/include/linux/root_dev.h b/include/linux/root_dev.h
index ea4bc9d13735..ed241aad7c17 100644
--- a/include/linux/root_dev.h
+++ b/include/linux/root_dev.h
@@ -2,6 +2,8 @@
2#define _ROOT_DEV_H_ 2#define _ROOT_DEV_H_
3 3
4#include <linux/major.h> 4#include <linux/major.h>
5#include <linux/types.h>
6#include <linux/kdev_t.h>
5 7
6enum { 8enum {
7 Root_NFS = MKDEV(UNNAMED_MAJOR, 255), 9 Root_NFS = MKDEV(UNNAMED_MAJOR, 255),
diff --git a/include/linux/rtc-v3020.h b/include/linux/rtc-v3020.h
new file mode 100644
index 000000000000..bf74e63c98fe
--- /dev/null
+++ b/include/linux/rtc-v3020.h
@@ -0,0 +1,35 @@
1/*
2 * v3020.h - Registers definition and platform data structure for the v3020 RTC.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2006, 8D Technologies inc.
9 */
10#ifndef __LINUX_V3020_H
11#define __LINUX_V3020_H
12
13/* The v3020 has only one data pin but which one
14 * is used depends on the board. */
15struct v3020_platform_data {
16 int leftshift; /* (1<<(leftshift)) & readl() */
17};
18
19#define V3020_STATUS_0 0x00
20#define V3020_STATUS_1 0x01
21#define V3020_SECONDS 0x02
22#define V3020_MINUTES 0x03
23#define V3020_HOURS 0x04
24#define V3020_MONTH_DAY 0x05
25#define V3020_MONTH 0x06
26#define V3020_YEAR 0x07
27#define V3020_WEEK_DAY 0x08
28#define V3020_WEEK 0x09
29
30#define V3020_IS_COMMAND(val) ((val)>=0x0E)
31
32#define V3020_CMD_RAM2CLOCK 0x0E
33#define V3020_CMD_CLOCK2RAM 0x0F
34
35#endif /* __LINUX_V3020_H */
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index ab61cd1199f2..5371e4e74595 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -34,8 +34,8 @@ struct rtc_time {
34 * alarm API. 34 * alarm API.
35 */ 35 */
36struct rtc_wkalrm { 36struct rtc_wkalrm {
37 unsigned char enabled; /* 0 = alarm disable, 1 = alarm disabled */ 37 unsigned char enabled; /* 0 = alarm disabled, 1 = alarm enabled */
38 unsigned char pending; /* 0 = alarm pending, 1 = alarm not pending */ 38 unsigned char pending; /* 0 = alarm not pending, 1 = alarm pending */
39 struct rtc_time time; /* time the alarm is set to */ 39 struct rtc_time time; /* time the alarm is set to */
40}; 40};
41 41
@@ -102,6 +102,7 @@ struct rtc_pll_info {
102#include <linux/interrupt.h> 102#include <linux/interrupt.h>
103 103
104extern int rtc_month_days(unsigned int month, unsigned int year); 104extern int rtc_month_days(unsigned int month, unsigned int year);
105extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year);
105extern int rtc_valid_tm(struct rtc_time *tm); 106extern int rtc_valid_tm(struct rtc_time *tm);
106extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time); 107extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time);
107extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); 108extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm);
@@ -155,6 +156,17 @@ struct rtc_device
155 struct rtc_task *irq_task; 156 struct rtc_task *irq_task;
156 spinlock_t irq_task_lock; 157 spinlock_t irq_task_lock;
157 int irq_freq; 158 int irq_freq;
159 int max_user_freq;
160#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
161 struct work_struct uie_task;
162 struct timer_list uie_timer;
163 /* Those fields are protected by rtc->irq_lock */
164 unsigned int oldsecs;
165 unsigned int irq_active:1;
166 unsigned int stop_uie_polling:1;
167 unsigned int uie_task_active:1;
168 unsigned int uie_timer_active:1;
169#endif
158}; 170};
159#define to_rtc_device(d) container_of(d, struct rtc_device, class_dev) 171#define to_rtc_device(d) container_of(d, struct rtc_device, class_dev)
160 172
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
new file mode 100644
index 000000000000..5d41dee82f80
--- /dev/null
+++ b/include/linux/rtmutex.h
@@ -0,0 +1,107 @@
1/*
2 * RT Mutexes: blocking mutual exclusion locks with PI support
3 *
4 * started by Ingo Molnar and Thomas Gleixner:
5 *
6 * Copyright (C) 2004-2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
7 * Copyright (C) 2006, Timesys Corp., Thomas Gleixner <tglx@timesys.com>
8 *
9 * This file contains the public data structure and API definitions.
10 */
11
12#ifndef __LINUX_RT_MUTEX_H
13#define __LINUX_RT_MUTEX_H
14
15#include <linux/linkage.h>
16#include <linux/plist.h>
17#include <linux/spinlock_types.h>
18
19/*
20 * The rt_mutex structure
21 *
22 * @wait_lock: spinlock to protect the structure
23 * @wait_list: pilist head to enqueue waiters in priority order
24 * @owner: the mutex owner
25 */
26struct rt_mutex {
27 spinlock_t wait_lock;
28 struct plist_head wait_list;
29 struct task_struct *owner;
30#ifdef CONFIG_DEBUG_RT_MUTEXES
31 int save_state;
32 const char *name, *file;
33 int line;
34 void *magic;
35#endif
36};
37
38struct rt_mutex_waiter;
39struct hrtimer_sleeper;
40
41#ifdef CONFIG_DEBUG_RT_MUTEXES
42 extern int rt_mutex_debug_check_no_locks_freed(const void *from,
43 unsigned long len);
44 extern void rt_mutex_debug_check_no_locks_held(struct task_struct *task);
45#else
46 static inline int rt_mutex_debug_check_no_locks_freed(const void *from,
47 unsigned long len)
48 {
49 return 0;
50 }
51# define rt_mutex_debug_check_no_locks_held(task) do { } while (0)
52#endif
53
54#ifdef CONFIG_DEBUG_RT_MUTEXES
55# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
56 , .name = #mutexname, .file = __FILE__, .line = __LINE__
57# define rt_mutex_init(mutex) __rt_mutex_init(mutex, __FUNCTION__)
58 extern void rt_mutex_debug_task_free(struct task_struct *tsk);
59#else
60# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname)
61# define rt_mutex_init(mutex) __rt_mutex_init(mutex, NULL)
62# define rt_mutex_debug_task_free(t) do { } while (0)
63#endif
64
65#define __RT_MUTEX_INITIALIZER(mutexname) \
66 { .wait_lock = SPIN_LOCK_UNLOCKED \
67 , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list, mutexname.wait_lock) \
68 , .owner = NULL \
69 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
70
71#define DEFINE_RT_MUTEX(mutexname) \
72 struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
73
74/***
75 * rt_mutex_is_locked - is the mutex locked
76 * @lock: the mutex to be queried
77 *
78 * Returns 1 if the mutex is locked, 0 if unlocked.
79 */
80static inline int rt_mutex_is_locked(struct rt_mutex *lock)
81{
82 return lock->owner != NULL;
83}
84
85extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
86extern void rt_mutex_destroy(struct rt_mutex *lock);
87
88extern void rt_mutex_lock(struct rt_mutex *lock);
89extern int rt_mutex_lock_interruptible(struct rt_mutex *lock,
90 int detect_deadlock);
91extern int rt_mutex_timed_lock(struct rt_mutex *lock,
92 struct hrtimer_sleeper *timeout,
93 int detect_deadlock);
94
95extern int rt_mutex_trylock(struct rt_mutex *lock);
96
97extern void rt_mutex_unlock(struct rt_mutex *lock);
98
99#ifdef CONFIG_RT_MUTEXES
100# define INIT_RT_MUTEXES(tsk) \
101 .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters, tsk.pi_lock), \
102 INIT_RT_MUTEX_DEBUG(tsk)
103#else
104# define INIT_RT_MUTEXES(tsk)
105#endif
106
107#endif
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index facd9ee37b76..3a18addaed4c 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -2,6 +2,7 @@
2#define __LINUX_RTNETLINK_H 2#define __LINUX_RTNETLINK_H
3 3
4#include <linux/netlink.h> 4#include <linux/netlink.h>
5#include <linux/if_link.h>
5 6
6/**** 7/****
7 * Routing/neighbour discovery messages. 8 * Routing/neighbour discovery messages.
@@ -238,10 +239,8 @@ enum rt_class_t
238 RT_TABLE_DEFAULT=253, 239 RT_TABLE_DEFAULT=253,
239 RT_TABLE_MAIN=254, 240 RT_TABLE_MAIN=254,
240 RT_TABLE_LOCAL=255, 241 RT_TABLE_LOCAL=255,
241 __RT_TABLE_MAX 242 RT_TABLE_MAX=0xFFFFFFFF
242}; 243};
243#define RT_TABLE_MAX (__RT_TABLE_MAX - 1)
244
245 244
246 245
247/* Routing message attributes */ 246/* Routing message attributes */
@@ -263,6 +262,7 @@ enum rtattr_type_t
263 RTA_CACHEINFO, 262 RTA_CACHEINFO,
264 RTA_SESSION, 263 RTA_SESSION,
265 RTA_MP_ALGO, 264 RTA_MP_ALGO,
265 RTA_TABLE,
266 __RTA_MAX 266 __RTA_MAX
267}; 267};
268 268
@@ -383,226 +383,6 @@ struct rta_session
383 } u; 383 } u;
384}; 384};
385 385
386
387/*********************************************************
388 * Interface address.
389 ****/
390
391struct ifaddrmsg
392{
393 unsigned char ifa_family;
394 unsigned char ifa_prefixlen; /* The prefix length */
395 unsigned char ifa_flags; /* Flags */
396 unsigned char ifa_scope; /* See above */
397 int ifa_index; /* Link index */
398};
399
400enum
401{
402 IFA_UNSPEC,
403 IFA_ADDRESS,
404 IFA_LOCAL,
405 IFA_LABEL,
406 IFA_BROADCAST,
407 IFA_ANYCAST,
408 IFA_CACHEINFO,
409 IFA_MULTICAST,
410 __IFA_MAX
411};
412
413#define IFA_MAX (__IFA_MAX - 1)
414
415/* ifa_flags */
416
417#define IFA_F_SECONDARY 0x01
418#define IFA_F_TEMPORARY IFA_F_SECONDARY
419
420#define IFA_F_DEPRECATED 0x20
421#define IFA_F_TENTATIVE 0x40
422#define IFA_F_PERMANENT 0x80
423
424struct ifa_cacheinfo
425{
426 __u32 ifa_prefered;
427 __u32 ifa_valid;
428 __u32 cstamp; /* created timestamp, hundredths of seconds */
429 __u32 tstamp; /* updated timestamp, hundredths of seconds */
430};
431
432
433#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))
434#define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg))
435
436/*
437 Important comment:
438 IFA_ADDRESS is prefix address, rather than local interface address.
439 It makes no difference for normally configured broadcast interfaces,
440 but for point-to-point IFA_ADDRESS is DESTINATION address,
441 local address is supplied in IFA_LOCAL attribute.
442 */
443
444/**************************************************************
445 * Neighbour discovery.
446 ****/
447
448struct ndmsg
449{
450 unsigned char ndm_family;
451 unsigned char ndm_pad1;
452 unsigned short ndm_pad2;
453 int ndm_ifindex; /* Link index */
454 __u16 ndm_state;
455 __u8 ndm_flags;
456 __u8 ndm_type;
457};
458
459enum
460{
461 NDA_UNSPEC,
462 NDA_DST,
463 NDA_LLADDR,
464 NDA_CACHEINFO,
465 NDA_PROBES,
466 __NDA_MAX
467};
468
469#define NDA_MAX (__NDA_MAX - 1)
470
471#define NDA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg))))
472#define NDA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndmsg))
473
474/*
475 * Neighbor Cache Entry Flags
476 */
477
478#define NTF_PROXY 0x08 /* == ATF_PUBL */
479#define NTF_ROUTER 0x80
480
481/*
482 * Neighbor Cache Entry States.
483 */
484
485#define NUD_INCOMPLETE 0x01
486#define NUD_REACHABLE 0x02
487#define NUD_STALE 0x04
488#define NUD_DELAY 0x08
489#define NUD_PROBE 0x10
490#define NUD_FAILED 0x20
491
492/* Dummy states */
493#define NUD_NOARP 0x40
494#define NUD_PERMANENT 0x80
495#define NUD_NONE 0x00
496
497
498struct nda_cacheinfo
499{
500 __u32 ndm_confirmed;
501 __u32 ndm_used;
502 __u32 ndm_updated;
503 __u32 ndm_refcnt;
504};
505
506
507/*****************************************************************
508 * Neighbour tables specific messages.
509 *
510 * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the
511 * NLM_F_DUMP flag set. Every neighbour table configuration is
512 * spread over multiple messages to avoid running into message
513 * size limits on systems with many interfaces. The first message
514 * in the sequence transports all not device specific data such as
515 * statistics, configuration, and the default parameter set.
516 * This message is followed by 0..n messages carrying device
517 * specific parameter sets.
518 * Although the ordering should be sufficient, NDTA_NAME can be
519 * used to identify sequences. The initial message can be identified
520 * by checking for NDTA_CONFIG. The device specific messages do
521 * not contain this TLV but have NDTPA_IFINDEX set to the
522 * corresponding interface index.
523 *
524 * To change neighbour table attributes, send RTM_SETNEIGHTBL
525 * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3],
526 * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked
527 * otherwise. Device specific parameter sets can be changed by
528 * setting NDTPA_IFINDEX to the interface index of the corresponding
529 * device.
530 ****/
531
532struct ndt_stats
533{
534 __u64 ndts_allocs;
535 __u64 ndts_destroys;
536 __u64 ndts_hash_grows;
537 __u64 ndts_res_failed;
538 __u64 ndts_lookups;
539 __u64 ndts_hits;
540 __u64 ndts_rcv_probes_mcast;
541 __u64 ndts_rcv_probes_ucast;
542 __u64 ndts_periodic_gc_runs;
543 __u64 ndts_forced_gc_runs;
544};
545
546enum {
547 NDTPA_UNSPEC,
548 NDTPA_IFINDEX, /* u32, unchangeable */
549 NDTPA_REFCNT, /* u32, read-only */
550 NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */
551 NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */
552 NDTPA_RETRANS_TIME, /* u64, msecs */
553 NDTPA_GC_STALETIME, /* u64, msecs */
554 NDTPA_DELAY_PROBE_TIME, /* u64, msecs */
555 NDTPA_QUEUE_LEN, /* u32 */
556 NDTPA_APP_PROBES, /* u32 */
557 NDTPA_UCAST_PROBES, /* u32 */
558 NDTPA_MCAST_PROBES, /* u32 */
559 NDTPA_ANYCAST_DELAY, /* u64, msecs */
560 NDTPA_PROXY_DELAY, /* u64, msecs */
561 NDTPA_PROXY_QLEN, /* u32 */
562 NDTPA_LOCKTIME, /* u64, msecs */
563 __NDTPA_MAX
564};
565#define NDTPA_MAX (__NDTPA_MAX - 1)
566
567struct ndtmsg
568{
569 __u8 ndtm_family;
570 __u8 ndtm_pad1;
571 __u16 ndtm_pad2;
572};
573
574struct ndt_config
575{
576 __u16 ndtc_key_len;
577 __u16 ndtc_entry_size;
578 __u32 ndtc_entries;
579 __u32 ndtc_last_flush; /* delta to now in msecs */
580 __u32 ndtc_last_rand; /* delta to now in msecs */
581 __u32 ndtc_hash_rnd;
582 __u32 ndtc_hash_mask;
583 __u32 ndtc_hash_chain_gc;
584 __u32 ndtc_proxy_qlen;
585};
586
587enum {
588 NDTA_UNSPEC,
589 NDTA_NAME, /* char *, unchangeable */
590 NDTA_THRESH1, /* u32 */
591 NDTA_THRESH2, /* u32 */
592 NDTA_THRESH3, /* u32 */
593 NDTA_CONFIG, /* struct ndt_config, read-only */
594 NDTA_PARMS, /* nested TLV NDTPA_* */
595 NDTA_STATS, /* struct ndt_stats, read-only */
596 NDTA_GC_INTERVAL, /* u64, msecs */
597 __NDTA_MAX
598};
599#define NDTA_MAX (__NDTA_MAX - 1)
600
601#define NDTA_RTA(r) ((struct rtattr*)(((char*)(r)) + \
602 NLMSG_ALIGN(sizeof(struct ndtmsg))))
603#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
604
605
606/**** 386/****
607 * General form of address family dependent message. 387 * General form of address family dependent message.
608 ****/ 388 ****/
@@ -663,138 +443,6 @@ struct prefix_cacheinfo
663 __u32 valid_time; 443 __u32 valid_time;
664}; 444};
665 445
666/* The struct should be in sync with struct net_device_stats */
667struct rtnl_link_stats
668{
669 __u32 rx_packets; /* total packets received */
670 __u32 tx_packets; /* total packets transmitted */
671 __u32 rx_bytes; /* total bytes received */
672 __u32 tx_bytes; /* total bytes transmitted */
673 __u32 rx_errors; /* bad packets received */
674 __u32 tx_errors; /* packet transmit problems */
675 __u32 rx_dropped; /* no space in linux buffers */
676 __u32 tx_dropped; /* no space available in linux */
677 __u32 multicast; /* multicast packets received */
678 __u32 collisions;
679
680 /* detailed rx_errors: */
681 __u32 rx_length_errors;
682 __u32 rx_over_errors; /* receiver ring buff overflow */
683 __u32 rx_crc_errors; /* recved pkt with crc error */
684 __u32 rx_frame_errors; /* recv'd frame alignment error */
685 __u32 rx_fifo_errors; /* recv'r fifo overrun */
686 __u32 rx_missed_errors; /* receiver missed packet */
687
688 /* detailed tx_errors */
689 __u32 tx_aborted_errors;
690 __u32 tx_carrier_errors;
691 __u32 tx_fifo_errors;
692 __u32 tx_heartbeat_errors;
693 __u32 tx_window_errors;
694
695 /* for cslip etc */
696 __u32 rx_compressed;
697 __u32 tx_compressed;
698};
699
700/* The struct should be in sync with struct ifmap */
701struct rtnl_link_ifmap
702{
703 __u64 mem_start;
704 __u64 mem_end;
705 __u64 base_addr;
706 __u16 irq;
707 __u8 dma;
708 __u8 port;
709};
710
711enum
712{
713 IFLA_UNSPEC,
714 IFLA_ADDRESS,
715 IFLA_BROADCAST,
716 IFLA_IFNAME,
717 IFLA_MTU,
718 IFLA_LINK,
719 IFLA_QDISC,
720 IFLA_STATS,
721 IFLA_COST,
722#define IFLA_COST IFLA_COST
723 IFLA_PRIORITY,
724#define IFLA_PRIORITY IFLA_PRIORITY
725 IFLA_MASTER,
726#define IFLA_MASTER IFLA_MASTER
727 IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */
728#define IFLA_WIRELESS IFLA_WIRELESS
729 IFLA_PROTINFO, /* Protocol specific information for a link */
730#define IFLA_PROTINFO IFLA_PROTINFO
731 IFLA_TXQLEN,
732#define IFLA_TXQLEN IFLA_TXQLEN
733 IFLA_MAP,
734#define IFLA_MAP IFLA_MAP
735 IFLA_WEIGHT,
736#define IFLA_WEIGHT IFLA_WEIGHT
737 IFLA_OPERSTATE,
738 IFLA_LINKMODE,
739 __IFLA_MAX
740};
741
742
743#define IFLA_MAX (__IFLA_MAX - 1)
744
745#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
746#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
747
748/* ifi_flags.
749
750 IFF_* flags.
751
752 The only change is:
753 IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are
754 more not changeable by user. They describe link media
755 characteristics and set by device driver.
756
757 Comments:
758 - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid
759 - If neither of these three flags are set;
760 the interface is NBMA.
761
762 - IFF_MULTICAST does not mean anything special:
763 multicasts can be used on all not-NBMA links.
764 IFF_MULTICAST means that this media uses special encapsulation
765 for multicast frames. Apparently, all IFF_POINTOPOINT and
766 IFF_BROADCAST devices are able to use multicasts too.
767 */
768
769/* IFLA_LINK.
770 For usual devices it is equal ifi_index.
771 If it is a "virtual interface" (f.e. tunnel), ifi_link
772 can point to real physical interface (f.e. for bandwidth calculations),
773 or maybe 0, what means, that real media is unknown (usual
774 for IPIP tunnels, when route to endpoint is allowed to change)
775 */
776
777/* Subtype attributes for IFLA_PROTINFO */
778enum
779{
780 IFLA_INET6_UNSPEC,
781 IFLA_INET6_FLAGS, /* link flags */
782 IFLA_INET6_CONF, /* sysctl parameters */
783 IFLA_INET6_STATS, /* statistics */
784 IFLA_INET6_MCAST, /* MC things. What of them? */
785 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
786 __IFLA_INET6_MAX
787};
788
789#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
790
791struct ifla_cacheinfo
792{
793 __u32 max_reasm_len;
794 __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
795 __u32 reachable_time;
796 __u32 retrans_time;
797};
798 446
799/***************************************************************** 447/*****************************************************************
800 * Traffic control messages. 448 * Traffic control messages.
@@ -885,10 +533,13 @@ enum rtnetlink_groups {
885 RTNLGRP_NOP2, 533 RTNLGRP_NOP2,
886 RTNLGRP_DECnet_ROUTE, 534 RTNLGRP_DECnet_ROUTE,
887#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE 535#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE
888 RTNLGRP_NOP3, 536 RTNLGRP_DECnet_RULE,
537#define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE
889 RTNLGRP_NOP4, 538 RTNLGRP_NOP4,
890 RTNLGRP_IPV6_PREFIX, 539 RTNLGRP_IPV6_PREFIX,
891#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX 540#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX
541 RTNLGRP_IPV6_RULE,
542#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE
892 __RTNLGRP_MAX 543 __RTNLGRP_MAX
893}; 544};
894#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) 545#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
@@ -923,8 +574,6 @@ extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, in
923#define rtattr_parse_nested(tb, max, rta) \ 574#define rtattr_parse_nested(tb, max, rta) \
924 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta))) 575 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta)))
925 576
926extern struct sock *rtnl;
927
928struct rtnetlink_link 577struct rtnetlink_link
929{ 578{
930 int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr); 579 int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr);
@@ -933,6 +582,10 @@ struct rtnetlink_link
933 582
934extern struct rtnetlink_link * rtnetlink_links[NPROTO]; 583extern struct rtnetlink_link * rtnetlink_links[NPROTO];
935extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); 584extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo);
585extern int rtnl_unicast(struct sk_buff *skb, u32 pid);
586extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group,
587 struct nlmsghdr *nlh, gfp_t flags);
588extern void rtnl_set_sk_err(u32 group, int error);
936extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); 589extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
937 590
938extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data); 591extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data);
@@ -1065,6 +718,13 @@ extern void __rtnl_unlock(void);
1065 } \ 718 } \
1066} while(0) 719} while(0)
1067 720
721static inline u32 rtm_get_table(struct rtattr **rta, u8 table)
722{
723 return RTA_GET_U32(rta[RTA_TABLE-1]);
724rtattr_failure:
725 return table;
726}
727
1068#endif /* __KERNEL__ */ 728#endif /* __KERNEL__ */
1069 729
1070 730
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index f30f805080ae..ae1fcadd598e 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -32,30 +32,37 @@ struct rw_semaphore {
32 __s32 activity; 32 __s32 activity;
33 spinlock_t wait_lock; 33 spinlock_t wait_lock;
34 struct list_head wait_list; 34 struct list_head wait_list;
35#if RWSEM_DEBUG 35#ifdef CONFIG_DEBUG_LOCK_ALLOC
36 int debug; 36 struct lockdep_map dep_map;
37#endif 37#endif
38}; 38};
39 39
40/* 40#ifdef CONFIG_DEBUG_LOCK_ALLOC
41 * initialisation 41# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
42 */
43#if RWSEM_DEBUG
44#define __RWSEM_DEBUG_INIT , 0
45#else 42#else
46#define __RWSEM_DEBUG_INIT /* */ 43# define __RWSEM_DEP_MAP_INIT(lockname)
47#endif 44#endif
48 45
49#define __RWSEM_INITIALIZER(name) \ 46#define __RWSEM_INITIALIZER(name) \
50{ 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) __RWSEM_DEBUG_INIT } 47{ 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
51 48
52#define DECLARE_RWSEM(name) \ 49#define DECLARE_RWSEM(name) \
53 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 50 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
54 51
55extern void FASTCALL(init_rwsem(struct rw_semaphore *sem)); 52extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
53 struct lock_class_key *key);
54
55#define init_rwsem(sem) \
56do { \
57 static struct lock_class_key __key; \
58 \
59 __init_rwsem((sem), #sem, &__key); \
60} while (0)
61
56extern void FASTCALL(__down_read(struct rw_semaphore *sem)); 62extern void FASTCALL(__down_read(struct rw_semaphore *sem));
57extern int FASTCALL(__down_read_trylock(struct rw_semaphore *sem)); 63extern int FASTCALL(__down_read_trylock(struct rw_semaphore *sem));
58extern void FASTCALL(__down_write(struct rw_semaphore *sem)); 64extern void FASTCALL(__down_write(struct rw_semaphore *sem));
65extern void FASTCALL(__down_write_nested(struct rw_semaphore *sem, int subclass));
59extern int FASTCALL(__down_write_trylock(struct rw_semaphore *sem)); 66extern int FASTCALL(__down_write_trylock(struct rw_semaphore *sem));
60extern void FASTCALL(__up_read(struct rw_semaphore *sem)); 67extern void FASTCALL(__up_read(struct rw_semaphore *sem));
61extern void FASTCALL(__up_write(struct rw_semaphore *sem)); 68extern void FASTCALL(__up_write(struct rw_semaphore *sem));
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index f99fe90732ab..7b524b4109a0 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -9,8 +9,6 @@
9 9
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11 11
12#define RWSEM_DEBUG 0
13
14#ifdef __KERNEL__ 12#ifdef __KERNEL__
15 13
16#include <linux/types.h> 14#include <linux/types.h>
@@ -26,89 +24,71 @@ struct rw_semaphore;
26#include <asm/rwsem.h> /* use an arch-specific implementation */ 24#include <asm/rwsem.h> /* use an arch-specific implementation */
27#endif 25#endif
28 26
29#ifndef rwsemtrace
30#if RWSEM_DEBUG
31extern void FASTCALL(rwsemtrace(struct rw_semaphore *sem, const char *str));
32#else
33#define rwsemtrace(SEM,FMT)
34#endif
35#endif
36
37/* 27/*
38 * lock for reading 28 * lock for reading
39 */ 29 */
40static inline void down_read(struct rw_semaphore *sem) 30extern void down_read(struct rw_semaphore *sem);
41{
42 might_sleep();
43 rwsemtrace(sem,"Entering down_read");
44 __down_read(sem);
45 rwsemtrace(sem,"Leaving down_read");
46}
47 31
48/* 32/*
49 * trylock for reading -- returns 1 if successful, 0 if contention 33 * trylock for reading -- returns 1 if successful, 0 if contention
50 */ 34 */
51static inline int down_read_trylock(struct rw_semaphore *sem) 35extern int down_read_trylock(struct rw_semaphore *sem);
52{
53 int ret;
54 rwsemtrace(sem,"Entering down_read_trylock");
55 ret = __down_read_trylock(sem);
56 rwsemtrace(sem,"Leaving down_read_trylock");
57 return ret;
58}
59 36
60/* 37/*
61 * lock for writing 38 * lock for writing
62 */ 39 */
63static inline void down_write(struct rw_semaphore *sem) 40extern void down_write(struct rw_semaphore *sem);
64{
65 might_sleep();
66 rwsemtrace(sem,"Entering down_write");
67 __down_write(sem);
68 rwsemtrace(sem,"Leaving down_write");
69}
70 41
71/* 42/*
72 * trylock for writing -- returns 1 if successful, 0 if contention 43 * trylock for writing -- returns 1 if successful, 0 if contention
73 */ 44 */
74static inline int down_write_trylock(struct rw_semaphore *sem) 45extern int down_write_trylock(struct rw_semaphore *sem);
75{
76 int ret;
77 rwsemtrace(sem,"Entering down_write_trylock");
78 ret = __down_write_trylock(sem);
79 rwsemtrace(sem,"Leaving down_write_trylock");
80 return ret;
81}
82 46
83/* 47/*
84 * release a read lock 48 * release a read lock
85 */ 49 */
86static inline void up_read(struct rw_semaphore *sem) 50extern void up_read(struct rw_semaphore *sem);
87{
88 rwsemtrace(sem,"Entering up_read");
89 __up_read(sem);
90 rwsemtrace(sem,"Leaving up_read");
91}
92 51
93/* 52/*
94 * release a write lock 53 * release a write lock
95 */ 54 */
96static inline void up_write(struct rw_semaphore *sem) 55extern void up_write(struct rw_semaphore *sem);
97{
98 rwsemtrace(sem,"Entering up_write");
99 __up_write(sem);
100 rwsemtrace(sem,"Leaving up_write");
101}
102 56
103/* 57/*
104 * downgrade write lock to read lock 58 * downgrade write lock to read lock
105 */ 59 */
106static inline void downgrade_write(struct rw_semaphore *sem) 60extern void downgrade_write(struct rw_semaphore *sem);
107{ 61
108 rwsemtrace(sem,"Entering downgrade_write"); 62#ifdef CONFIG_DEBUG_LOCK_ALLOC
109 __downgrade_write(sem); 63/*
110 rwsemtrace(sem,"Leaving downgrade_write"); 64 * nested locking. NOTE: rwsems are not allowed to recurse
111} 65 * (which occurs if the same task tries to acquire the same
66 * lock instance multiple times), but multiple locks of the
67 * same lock class might be taken, if the order of the locks
68 * is always the same. This ordering rule can be expressed
69 * to lockdep via the _nested() APIs, but enumerating the
70 * subclasses that are used. (If the nesting relationship is
71 * static then another method for expressing nested locking is
72 * the explicit definition of lock class keys and the use of
73 * lockdep_set_class() at lock initialization time.
74 * See Documentation/lockdep-design.txt for more details.)
75 */
76extern void down_read_nested(struct rw_semaphore *sem, int subclass);
77extern void down_write_nested(struct rw_semaphore *sem, int subclass);
78/*
79 * Take/release a lock when not the owner will release it.
80 *
81 * [ This API should be avoided as much as possible - the
82 * proper abstraction for this case is completions. ]
83 */
84extern void down_read_non_owner(struct rw_semaphore *sem);
85extern void up_read_non_owner(struct rw_semaphore *sem);
86#else
87# define down_read_nested(sem, subclass) down_read(sem)
88# define down_write_nested(sem, subclass) down_write(sem)
89# define down_read_non_owner(sem) down_read(sem)
90# define up_read_non_owner(sem) up_read(sem)
91#endif
112 92
113#endif /* __KERNEL__ */ 93#endif /* __KERNEL__ */
114#endif /* _LINUX_RWSEM_H */ 94#endif /* _LINUX_RWSEM_H */
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 66ff545552f7..4efbd9c445f5 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -5,7 +5,7 @@
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <linux/string.h> 6#include <linux/string.h>
7 7
8static inline void sg_set_buf(struct scatterlist *sg, void *buf, 8static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
9 unsigned int buflen) 9 unsigned int buflen)
10{ 10{
11 sg->page = virt_to_page(buf); 11 sg->page = virt_to_page(buf);
@@ -13,7 +13,7 @@ static inline void sg_set_buf(struct scatterlist *sg, void *buf,
13 sg->length = buflen; 13 sg->length = buflen;
14} 14}
15 15
16static inline void sg_init_one(struct scatterlist *sg, void *buf, 16static inline void sg_init_one(struct scatterlist *sg, const void *buf,
17 unsigned int buflen) 17 unsigned int buflen)
18{ 18{
19 memset(sg, 0, sizeof(*sg)); 19 memset(sg, 0, sizeof(*sg));
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 38b4791e6a5d..a06fc89cf6e5 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -73,6 +73,7 @@ struct sched_param {
73#include <linux/seccomp.h> 73#include <linux/seccomp.h>
74#include <linux/rcupdate.h> 74#include <linux/rcupdate.h>
75#include <linux/futex.h> 75#include <linux/futex.h>
76#include <linux/rtmutex.h>
76 77
77#include <linux/time.h> 78#include <linux/time.h>
78#include <linux/param.h> 79#include <linux/param.h>
@@ -83,6 +84,7 @@ struct sched_param {
83#include <asm/processor.h> 84#include <asm/processor.h>
84 85
85struct exec_domain; 86struct exec_domain;
87struct futex_pi_state;
86 88
87/* 89/*
88 * List of flags we want to share for kernel threads, 90 * List of flags we want to share for kernel threads,
@@ -123,6 +125,7 @@ extern unsigned long nr_running(void);
123extern unsigned long nr_uninterruptible(void); 125extern unsigned long nr_uninterruptible(void);
124extern unsigned long nr_active(void); 126extern unsigned long nr_active(void);
125extern unsigned long nr_iowait(void); 127extern unsigned long nr_iowait(void);
128extern unsigned long weighted_cpuload(const int cpu);
126 129
127 130
128/* 131/*
@@ -145,6 +148,7 @@ extern unsigned long nr_iowait(void);
145#define EXIT_DEAD 32 148#define EXIT_DEAD 32
146/* in tsk->state again */ 149/* in tsk->state again */
147#define TASK_NONINTERACTIVE 64 150#define TASK_NONINTERACTIVE 64
151#define TASK_DEAD 128
148 152
149#define __set_task_state(tsk, state_value) \ 153#define __set_task_state(tsk, state_value) \
150 do { (tsk)->state = (state_value); } while (0) 154 do { (tsk)->state = (state_value); } while (0)
@@ -181,11 +185,11 @@ extern unsigned long nr_iowait(void);
181extern rwlock_t tasklist_lock; 185extern rwlock_t tasklist_lock;
182extern spinlock_t mmlist_lock; 186extern spinlock_t mmlist_lock;
183 187
184typedef struct task_struct task_t; 188struct task_struct;
185 189
186extern void sched_init(void); 190extern void sched_init(void);
187extern void sched_init_smp(void); 191extern void sched_init_smp(void);
188extern void init_idle(task_t *idle, int cpu); 192extern void init_idle(struct task_struct *idle, int cpu);
189 193
190extern cpumask_t nohz_cpu_mask; 194extern cpumask_t nohz_cpu_mask;
191 195
@@ -358,6 +362,14 @@ struct sighand_struct {
358 spinlock_t siglock; 362 spinlock_t siglock;
359}; 363};
360 364
365struct pacct_struct {
366 int ac_flag;
367 long ac_exitcode;
368 unsigned long ac_mem;
369 cputime_t ac_utime, ac_stime;
370 unsigned long ac_minflt, ac_majflt;
371};
372
361/* 373/*
362 * NOTE! "signal_struct" does not have it's own 374 * NOTE! "signal_struct" does not have it's own
363 * locking, because a shared signal_struct always 375 * locking, because a shared signal_struct always
@@ -372,7 +384,7 @@ struct signal_struct {
372 wait_queue_head_t wait_chldexit; /* for wait4() */ 384 wait_queue_head_t wait_chldexit; /* for wait4() */
373 385
374 /* current thread group signal load-balancing target: */ 386 /* current thread group signal load-balancing target: */
375 task_t *curr_target; 387 struct task_struct *curr_target;
376 388
377 /* shared signal handling: */ 389 /* shared signal handling: */
378 struct sigpending shared_pending; 390 struct sigpending shared_pending;
@@ -449,6 +461,13 @@ struct signal_struct {
449 struct key *session_keyring; /* keyring inherited over fork */ 461 struct key *session_keyring; /* keyring inherited over fork */
450 struct key *process_keyring; /* keyring private to this process */ 462 struct key *process_keyring; /* keyring private to this process */
451#endif 463#endif
464#ifdef CONFIG_BSD_PROCESS_ACCT
465 struct pacct_struct pacct; /* per-process accounting information */
466#endif
467#ifdef CONFIG_TASKSTATS
468 spinlock_t stats_lock;
469 struct taskstats *stats;
470#endif
452}; 471};
453 472
454/* Context switch must be unlocked if interrupts are to be enabled */ 473/* Context switch must be unlocked if interrupts are to be enabled */
@@ -483,8 +502,11 @@ struct signal_struct {
483 502
484#define MAX_PRIO (MAX_RT_PRIO + 40) 503#define MAX_PRIO (MAX_RT_PRIO + 40)
485 504
486#define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO)) 505#define rt_prio(prio) unlikely((prio) < MAX_RT_PRIO)
506#define rt_task(p) rt_prio((p)->prio)
487#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH)) 507#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH))
508#define is_rt_policy(p) ((p) != SCHED_NORMAL && (p) != SCHED_BATCH)
509#define has_rt_policy(p) unlikely(is_rt_policy((p)->policy))
488 510
489/* 511/*
490 * Some day this will be a full-fledged user tracking system.. 512 * Some day this will be a full-fledged user tracking system..
@@ -517,11 +539,10 @@ extern struct user_struct *find_user(uid_t);
517extern struct user_struct root_user; 539extern struct user_struct root_user;
518#define INIT_USER (&root_user) 540#define INIT_USER (&root_user)
519 541
520typedef struct prio_array prio_array_t;
521struct backing_dev_info; 542struct backing_dev_info;
522struct reclaim_state; 543struct reclaim_state;
523 544
524#ifdef CONFIG_SCHEDSTATS 545#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
525struct sched_info { 546struct sched_info {
526 /* cumulative counters */ 547 /* cumulative counters */
527 unsigned long cpu_time, /* time spent on the cpu */ 548 unsigned long cpu_time, /* time spent on the cpu */
@@ -532,9 +553,53 @@ struct sched_info {
532 unsigned long last_arrival, /* when we last ran on a cpu */ 553 unsigned long last_arrival, /* when we last ran on a cpu */
533 last_queued; /* when we were last queued to run */ 554 last_queued; /* when we were last queued to run */
534}; 555};
556#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
535 557
558#ifdef CONFIG_SCHEDSTATS
536extern struct file_operations proc_schedstat_operations; 559extern struct file_operations proc_schedstat_operations;
560#endif /* CONFIG_SCHEDSTATS */
561
562#ifdef CONFIG_TASK_DELAY_ACCT
563struct task_delay_info {
564 spinlock_t lock;
565 unsigned int flags; /* Private per-task flags */
566
567 /* For each stat XXX, add following, aligned appropriately
568 *
569 * struct timespec XXX_start, XXX_end;
570 * u64 XXX_delay;
571 * u32 XXX_count;
572 *
573 * Atomicity of updates to XXX_delay, XXX_count protected by
574 * single lock above (split into XXX_lock if contention is an issue).
575 */
576
577 /*
578 * XXX_count is incremented on every XXX operation, the delay
579 * associated with the operation is added to XXX_delay.
580 * XXX_delay contains the accumulated delay time in nanoseconds.
581 */
582 struct timespec blkio_start, blkio_end; /* Shared by blkio, swapin */
583 u64 blkio_delay; /* wait for sync block io completion */
584 u64 swapin_delay; /* wait for swapin block io completion */
585 u32 blkio_count; /* total count of the number of sync block */
586 /* io operations performed */
587 u32 swapin_count; /* total count of the number of swapin block */
588 /* io operations performed */
589};
590#endif /* CONFIG_TASK_DELAY_ACCT */
591
592static inline int sched_info_on(void)
593{
594#ifdef CONFIG_SCHEDSTATS
595 return 1;
596#elif defined(CONFIG_TASK_DELAY_ACCT)
597 extern int delayacct_on;
598 return delayacct_on;
599#else
600 return 0;
537#endif 601#endif
602}
538 603
539enum idle_type 604enum idle_type
540{ 605{
@@ -547,9 +612,9 @@ enum idle_type
547/* 612/*
548 * sched-domains (multiprocessor balancing) declarations: 613 * sched-domains (multiprocessor balancing) declarations:
549 */ 614 */
550#ifdef CONFIG_SMP
551#define SCHED_LOAD_SCALE 128UL /* increase resolution of load */ 615#define SCHED_LOAD_SCALE 128UL /* increase resolution of load */
552 616
617#ifdef CONFIG_SMP
553#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ 618#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */
554#define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */ 619#define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */
555#define SD_BALANCE_EXEC 4 /* Balance on exec */ 620#define SD_BALANCE_EXEC 4 /* Balance on exec */
@@ -558,6 +623,11 @@ enum idle_type
558#define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */ 623#define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */
559#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */ 624#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */
560#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ 625#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */
626#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */
627
628#define BALANCE_FOR_POWER ((sched_mc_power_savings || sched_smt_power_savings) \
629 ? SD_POWERSAVINGS_BALANCE : 0)
630
561 631
562struct sched_group { 632struct sched_group {
563 struct sched_group *next; /* Must be a circular list */ 633 struct sched_group *next; /* Must be a circular list */
@@ -627,7 +697,7 @@ struct sched_domain {
627#endif 697#endif
628}; 698};
629 699
630extern void partition_sched_domains(cpumask_t *partition1, 700extern int partition_sched_domains(cpumask_t *partition1,
631 cpumask_t *partition2); 701 cpumask_t *partition2);
632 702
633/* 703/*
@@ -677,7 +747,7 @@ extern int groups_search(struct group_info *group_info, gid_t grp);
677 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) 747 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK])
678 748
679#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK 749#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK
680extern void prefetch_stack(struct task_struct*); 750extern void prefetch_stack(struct task_struct *t);
681#else 751#else
682static inline void prefetch_stack(struct task_struct *t) { } 752static inline void prefetch_stack(struct task_struct *t) { }
683#endif 753#endif
@@ -693,6 +763,8 @@ enum sleep_type {
693 SLEEP_INTERRUPTED, 763 SLEEP_INTERRUPTED,
694}; 764};
695 765
766struct prio_array;
767
696struct task_struct { 768struct task_struct {
697 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 769 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
698 struct thread_info *thread_info; 770 struct thread_info *thread_info;
@@ -702,16 +774,20 @@ struct task_struct {
702 774
703 int lock_depth; /* BKL lock depth */ 775 int lock_depth; /* BKL lock depth */
704 776
705#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) 777#ifdef CONFIG_SMP
778#ifdef __ARCH_WANT_UNLOCKED_CTXSW
706 int oncpu; 779 int oncpu;
707#endif 780#endif
708 int prio, static_prio; 781#endif
782 int load_weight; /* for niceness load balancing purposes */
783 int prio, static_prio, normal_prio;
709 struct list_head run_list; 784 struct list_head run_list;
710 prio_array_t *array; 785 struct prio_array *array;
711 786
712 unsigned short ioprio; 787 unsigned short ioprio;
788#ifdef CONFIG_BLK_DEV_IO_TRACE
713 unsigned int btrace_seq; 789 unsigned int btrace_seq;
714 790#endif
715 unsigned long sleep_avg; 791 unsigned long sleep_avg;
716 unsigned long long timestamp, last_ran; 792 unsigned long long timestamp, last_ran;
717 unsigned long long sched_time; /* sched_clock time spent running */ 793 unsigned long long sched_time; /* sched_clock time spent running */
@@ -721,7 +797,7 @@ struct task_struct {
721 cpumask_t cpus_allowed; 797 cpumask_t cpus_allowed;
722 unsigned int time_slice, first_time_slice; 798 unsigned int time_slice, first_time_slice;
723 799
724#ifdef CONFIG_SCHEDSTATS 800#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
725 struct sched_info sched_info; 801 struct sched_info sched_info;
726#endif 802#endif
727 803
@@ -745,6 +821,11 @@ struct task_struct {
745 unsigned did_exec:1; 821 unsigned did_exec:1;
746 pid_t pid; 822 pid_t pid;
747 pid_t tgid; 823 pid_t tgid;
824
825#ifdef CONFIG_CC_STACKPROTECTOR
826 /* Canary value for the -fstack-protector gcc feature */
827 unsigned long stack_canary;
828#endif
748 /* 829 /*
749 * pointers to (original) parent process, youngest child, younger sibling, 830 * pointers to (original) parent process, youngest child, younger sibling,
750 * older sibling, respectively. (p->father can be replaced with 831 * older sibling, respectively. (p->father can be replaced with
@@ -791,6 +872,15 @@ struct task_struct {
791 struct key *thread_keyring; /* keyring private to this thread */ 872 struct key *thread_keyring; /* keyring private to this thread */
792 unsigned char jit_keyring; /* default keyring to attach requested keys to */ 873 unsigned char jit_keyring; /* default keyring to attach requested keys to */
793#endif 874#endif
875 /*
876 * fpu_counter contains the number of consecutive context switches
877 * that the FPU is used. If this is over a threshold, the lazy fpu
878 * saving becomes unlazy to save the trap. This is an unsigned char
879 * so that after 256 times the counter wraps and the behavior turns
880 * lazy again; this to deal with bursty apps that only use FPU for
881 * a short time
882 */
883 unsigned char fpu_counter;
794 int oomkilladj; /* OOM kill score adjustment (bit shift). */ 884 int oomkilladj; /* OOM kill score adjustment (bit shift). */
795 char comm[TASK_COMM_LEN]; /* executable name excluding path 885 char comm[TASK_COMM_LEN]; /* executable name excluding path
796 - access with [gs]et_task_comm (which lock 886 - access with [gs]et_task_comm (which lock
@@ -798,8 +888,10 @@ struct task_struct {
798 - initialized normally by flush_old_exec */ 888 - initialized normally by flush_old_exec */
799/* file system info */ 889/* file system info */
800 int link_count, total_link_count; 890 int link_count, total_link_count;
891#ifdef CONFIG_SYSVIPC
801/* ipc stuff */ 892/* ipc stuff */
802 struct sysv_sem sysvsem; 893 struct sysv_sem sysvsem;
894#endif
803/* CPU-specific state of this task */ 895/* CPU-specific state of this task */
804 struct thread_struct thread; 896 struct thread_struct thread;
805/* filesystem information */ 897/* filesystem information */
@@ -831,13 +923,43 @@ struct task_struct {
831 u32 self_exec_id; 923 u32 self_exec_id;
832/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ 924/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */
833 spinlock_t alloc_lock; 925 spinlock_t alloc_lock;
834/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ 926
835 spinlock_t proc_lock; 927 /* Protection of the PI data structures: */
928 spinlock_t pi_lock;
929
930#ifdef CONFIG_RT_MUTEXES
931 /* PI waiters blocked on a rt_mutex held by this task */
932 struct plist_head pi_waiters;
933 /* Deadlock detection and priority inheritance handling */
934 struct rt_mutex_waiter *pi_blocked_on;
935#endif
836 936
837#ifdef CONFIG_DEBUG_MUTEXES 937#ifdef CONFIG_DEBUG_MUTEXES
838 /* mutex deadlock detection */ 938 /* mutex deadlock detection */
839 struct mutex_waiter *blocked_on; 939 struct mutex_waiter *blocked_on;
840#endif 940#endif
941#ifdef CONFIG_TRACE_IRQFLAGS
942 unsigned int irq_events;
943 int hardirqs_enabled;
944 unsigned long hardirq_enable_ip;
945 unsigned int hardirq_enable_event;
946 unsigned long hardirq_disable_ip;
947 unsigned int hardirq_disable_event;
948 int softirqs_enabled;
949 unsigned long softirq_disable_ip;
950 unsigned int softirq_disable_event;
951 unsigned long softirq_enable_ip;
952 unsigned int softirq_enable_event;
953 int hardirq_context;
954 int softirq_context;
955#endif
956#ifdef CONFIG_LOCKDEP
957# define MAX_LOCK_DEPTH 30UL
958 u64 curr_chain_key;
959 int lockdep_depth;
960 struct held_lock held_locks[MAX_LOCK_DEPTH];
961 unsigned int lockdep_recursion;
962#endif
841 963
842/* journalling filesystem info */ 964/* journalling filesystem info */
843 void *journal_info; 965 void *journal_info;
@@ -845,7 +967,6 @@ struct task_struct {
845/* VM state */ 967/* VM state */
846 struct reclaim_state *reclaim_state; 968 struct reclaim_state *reclaim_state;
847 969
848 struct dentry *proc_dentry;
849 struct backing_dev_info *backing_dev_info; 970 struct backing_dev_info *backing_dev_info;
850 971
851 struct io_context *io_context; 972 struct io_context *io_context;
@@ -880,6 +1001,8 @@ struct task_struct {
880#ifdef CONFIG_COMPAT 1001#ifdef CONFIG_COMPAT
881 struct compat_robust_list_head __user *compat_robust_list; 1002 struct compat_robust_list_head __user *compat_robust_list;
882#endif 1003#endif
1004 struct list_head pi_state_list;
1005 struct futex_pi_state *pi_state_cache;
883 1006
884 atomic_t fs_excl; /* holding fs exclusive resources */ 1007 atomic_t fs_excl; /* holding fs exclusive resources */
885 struct rcu_head rcu; 1008 struct rcu_head rcu;
@@ -888,6 +1011,9 @@ struct task_struct {
888 * cache last used pipe for splice 1011 * cache last used pipe for splice
889 */ 1012 */
890 struct pipe_inode_info *splice_pipe; 1013 struct pipe_inode_info *splice_pipe;
1014#ifdef CONFIG_TASK_DELAY_ACCT
1015 struct task_delay_info *delays;
1016#endif
891}; 1017};
892 1018
893static inline pid_t process_group(struct task_struct *tsk) 1019static inline pid_t process_group(struct task_struct *tsk)
@@ -908,6 +1034,16 @@ static inline int pid_alive(struct task_struct *p)
908 return p->pids[PIDTYPE_PID].pid != NULL; 1034 return p->pids[PIDTYPE_PID].pid != NULL;
909} 1035}
910 1036
1037/**
1038 * is_init - check if a task structure is the first user space
1039 * task the kernel created.
1040 * @p: Task structure to be checked.
1041 */
1042static inline int is_init(struct task_struct *tsk)
1043{
1044 return tsk->pid == 1;
1045}
1046
911extern void free_task(struct task_struct *tsk); 1047extern void free_task(struct task_struct *tsk);
912#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) 1048#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
913 1049
@@ -926,7 +1062,6 @@ static inline void put_task_struct(struct task_struct *t)
926 /* Not implemented yet, only for 486*/ 1062 /* Not implemented yet, only for 486*/
927#define PF_STARTING 0x00000002 /* being created */ 1063#define PF_STARTING 0x00000002 /* being created */
928#define PF_EXITING 0x00000004 /* getting shut down */ 1064#define PF_EXITING 0x00000004 /* getting shut down */
929#define PF_DEAD 0x00000008 /* Dead */
930#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ 1065#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
931#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ 1066#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
932#define PF_DUMPCORE 0x00000200 /* dumped core */ 1067#define PF_DUMPCORE 0x00000200 /* dumped core */
@@ -947,6 +1082,7 @@ static inline void put_task_struct(struct task_struct *t)
947#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ 1082#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
948#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1083#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
949#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1084#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1085#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
950 1086
951/* 1087/*
952 * Only the _current_ task can read/write to tsk->flags, but other 1088 * Only the _current_ task can read/write to tsk->flags, but other
@@ -974,9 +1110,9 @@ static inline void put_task_struct(struct task_struct *t)
974#define used_math() tsk_used_math(current) 1110#define used_math() tsk_used_math(current)
975 1111
976#ifdef CONFIG_SMP 1112#ifdef CONFIG_SMP
977extern int set_cpus_allowed(task_t *p, cpumask_t new_mask); 1113extern int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask);
978#else 1114#else
979static inline int set_cpus_allowed(task_t *p, cpumask_t new_mask) 1115static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
980{ 1116{
981 if (!cpu_isset(0, new_mask)) 1117 if (!cpu_isset(0, new_mask))
982 return -EINVAL; 1118 return -EINVAL;
@@ -985,7 +1121,8 @@ static inline int set_cpus_allowed(task_t *p, cpumask_t new_mask)
985#endif 1121#endif
986 1122
987extern unsigned long long sched_clock(void); 1123extern unsigned long long sched_clock(void);
988extern unsigned long long current_sched_time(const task_t *current_task); 1124extern unsigned long long
1125current_sched_time(const struct task_struct *current_task);
989 1126
990/* sched_exec is called by processes performing an exec */ 1127/* sched_exec is called by processes performing an exec */
991#ifdef CONFIG_SMP 1128#ifdef CONFIG_SMP
@@ -1001,16 +1138,29 @@ static inline void idle_task_exit(void) {}
1001#endif 1138#endif
1002 1139
1003extern void sched_idle_next(void); 1140extern void sched_idle_next(void);
1004extern void set_user_nice(task_t *p, long nice); 1141
1005extern int task_prio(const task_t *p); 1142#ifdef CONFIG_RT_MUTEXES
1006extern int task_nice(const task_t *p); 1143extern int rt_mutex_getprio(struct task_struct *p);
1007extern int can_nice(const task_t *p, const int nice); 1144extern void rt_mutex_setprio(struct task_struct *p, int prio);
1008extern int task_curr(const task_t *p); 1145extern void rt_mutex_adjust_pi(struct task_struct *p);
1146#else
1147static inline int rt_mutex_getprio(struct task_struct *p)
1148{
1149 return p->normal_prio;
1150}
1151# define rt_mutex_adjust_pi(p) do { } while (0)
1152#endif
1153
1154extern void set_user_nice(struct task_struct *p, long nice);
1155extern int task_prio(const struct task_struct *p);
1156extern int task_nice(const struct task_struct *p);
1157extern int can_nice(const struct task_struct *p, const int nice);
1158extern int task_curr(const struct task_struct *p);
1009extern int idle_cpu(int cpu); 1159extern int idle_cpu(int cpu);
1010extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); 1160extern int sched_setscheduler(struct task_struct *, int, struct sched_param *);
1011extern task_t *idle_task(int cpu); 1161extern struct task_struct *idle_task(int cpu);
1012extern task_t *curr_task(int cpu); 1162extern struct task_struct *curr_task(int cpu);
1013extern void set_curr_task(int cpu, task_t *p); 1163extern void set_curr_task(int cpu, struct task_struct *p);
1014 1164
1015void yield(void); 1165void yield(void);
1016 1166
@@ -1056,7 +1206,7 @@ extern void switch_uid(struct user_struct *);
1056 1206
1057#include <asm/current.h> 1207#include <asm/current.h>
1058 1208
1059extern void do_timer(struct pt_regs *); 1209extern void do_timer(unsigned long ticks);
1060 1210
1061extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state)); 1211extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state));
1062extern int FASTCALL(wake_up_process(struct task_struct * tsk)); 1212extern int FASTCALL(wake_up_process(struct task_struct * tsk));
@@ -1067,8 +1217,8 @@ extern void FASTCALL(wake_up_new_task(struct task_struct * tsk,
1067#else 1217#else
1068 static inline void kick_process(struct task_struct *tsk) { } 1218 static inline void kick_process(struct task_struct *tsk) { }
1069#endif 1219#endif
1070extern void FASTCALL(sched_fork(task_t * p, int clone_flags)); 1220extern void FASTCALL(sched_fork(struct task_struct * p, int clone_flags));
1071extern void FASTCALL(sched_exit(task_t * p)); 1221extern void FASTCALL(sched_exit(struct task_struct * p));
1072 1222
1073extern int in_group_p(gid_t); 1223extern int in_group_p(gid_t);
1074extern int in_egroup_p(gid_t); 1224extern int in_egroup_p(gid_t);
@@ -1101,7 +1251,7 @@ extern int force_sig_info(int, struct siginfo *, struct task_struct *);
1101extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp); 1251extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp);
1102extern int kill_pg_info(int, struct siginfo *, pid_t); 1252extern int kill_pg_info(int, struct siginfo *, pid_t);
1103extern int kill_proc_info(int, struct siginfo *, pid_t); 1253extern int kill_proc_info(int, struct siginfo *, pid_t);
1104extern int kill_proc_info_as_uid(int, struct siginfo *, pid_t, uid_t, uid_t); 1254extern int kill_proc_info_as_uid(int, struct siginfo *, pid_t, uid_t, uid_t, u32);
1105extern void do_notify_parent(struct task_struct *, int); 1255extern void do_notify_parent(struct task_struct *, int);
1106extern void force_sig(int, struct task_struct *); 1256extern void force_sig(int, struct task_struct *);
1107extern void force_sig_specific(int, struct task_struct *); 1257extern void force_sig_specific(int, struct task_struct *);
@@ -1173,17 +1323,17 @@ extern NORET_TYPE void do_group_exit(int);
1173extern void daemonize(const char *, ...); 1323extern void daemonize(const char *, ...);
1174extern int allow_signal(int); 1324extern int allow_signal(int);
1175extern int disallow_signal(int); 1325extern int disallow_signal(int);
1176extern task_t *child_reaper; 1326extern struct task_struct *child_reaper;
1177 1327
1178extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *); 1328extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *);
1179extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); 1329extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
1180task_t *fork_idle(int); 1330struct task_struct *fork_idle(int);
1181 1331
1182extern void set_task_comm(struct task_struct *tsk, char *from); 1332extern void set_task_comm(struct task_struct *tsk, char *from);
1183extern void get_task_comm(char *to, struct task_struct *tsk); 1333extern void get_task_comm(char *to, struct task_struct *tsk);
1184 1334
1185#ifdef CONFIG_SMP 1335#ifdef CONFIG_SMP
1186extern void wait_task_inactive(task_t * p); 1336extern void wait_task_inactive(struct task_struct * p);
1187#else 1337#else
1188#define wait_task_inactive(p) do { } while (0) 1338#define wait_task_inactive(p) do { } while (0)
1189#endif 1339#endif
@@ -1209,13 +1359,13 @@ extern void wait_task_inactive(task_t * p);
1209/* de_thread depends on thread_group_leader not being a pid based check */ 1359/* de_thread depends on thread_group_leader not being a pid based check */
1210#define thread_group_leader(p) (p == p->group_leader) 1360#define thread_group_leader(p) (p == p->group_leader)
1211 1361
1212static inline task_t *next_thread(const task_t *p) 1362static inline struct task_struct *next_thread(const struct task_struct *p)
1213{ 1363{
1214 return list_entry(rcu_dereference(p->thread_group.next), 1364 return list_entry(rcu_dereference(p->thread_group.next),
1215 task_t, thread_group); 1365 struct task_struct, thread_group);
1216} 1366}
1217 1367
1218static inline int thread_group_empty(task_t *p) 1368static inline int thread_group_empty(struct task_struct *p)
1219{ 1369{
1220 return list_empty(&p->thread_group); 1370 return list_empty(&p->thread_group);
1221} 1371}
@@ -1400,6 +1550,11 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm)
1400extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); 1550extern long sched_setaffinity(pid_t pid, cpumask_t new_mask);
1401extern long sched_getaffinity(pid_t pid, cpumask_t *mask); 1551extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
1402 1552
1553#include <linux/sysdev.h>
1554extern int sched_mc_power_savings, sched_smt_power_savings;
1555extern struct sysdev_attribute attr_sched_mc_power_savings, attr_sched_smt_power_savings;
1556extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
1557
1403extern void normalize_rt_tasks(void); 1558extern void normalize_rt_tasks(void);
1404 1559
1405#ifdef CONFIG_PM 1560#ifdef CONFIG_PM
@@ -1429,6 +1584,14 @@ static inline void freeze(struct task_struct *p)
1429} 1584}
1430 1585
1431/* 1586/*
1587 * Sometimes we may need to cancel the previous 'freeze' request
1588 */
1589static inline void do_not_freeze(struct task_struct *p)
1590{
1591 p->flags &= ~PF_FREEZE;
1592}
1593
1594/*
1432 * Wake up a frozen process 1595 * Wake up a frozen process
1433 */ 1596 */
1434static inline int thaw_process(struct task_struct *p) 1597static inline int thaw_process(struct task_struct *p)
diff --git a/include/linux/scx200.h b/include/linux/scx200.h
index a22f9e173ad2..693c0557e70b 100644
--- a/include/linux/scx200.h
+++ b/include/linux/scx200.h
@@ -49,10 +49,3 @@ extern unsigned scx200_cb_base;
49#define SCx200_REV 0x3d /* Revision Register */ 49#define SCx200_REV 0x3d /* Revision Register */
50#define SCx200_CBA 0x3e /* Configuration Base Address Register */ 50#define SCx200_CBA 0x3e /* Configuration Base Address Register */
51#define SCx200_CBA_SCRATCH 0x64 /* Configuration Base Address Scratchpad */ 51#define SCx200_CBA_SCRATCH 0x64 /* Configuration Base Address Scratchpad */
52
53/*
54 Local variables:
55 compile-command: "make -C ../.. bzImage modules"
56 c-basic-offset: 8
57 End:
58*/
diff --git a/include/linux/scx200_gpio.h b/include/linux/scx200_gpio.h
index 30cdd648ba79..1a82d30c4b17 100644
--- a/include/linux/scx200_gpio.h
+++ b/include/linux/scx200_gpio.h
@@ -1,9 +1,10 @@
1#include <linux/spinlock.h> 1#include <linux/spinlock.h>
2 2
3u32 scx200_gpio_configure(int index, u32 set, u32 clear); 3u32 scx200_gpio_configure(unsigned index, u32 set, u32 clear);
4 4
5extern unsigned scx200_gpio_base; 5extern unsigned scx200_gpio_base;
6extern long scx200_gpio_shadow[2]; 6extern long scx200_gpio_shadow[2];
7extern struct nsc_gpio_ops scx200_gpio_ops;
7 8
8#define scx200_gpio_present() (scx200_gpio_base!=0) 9#define scx200_gpio_present() (scx200_gpio_base!=0)
9 10
@@ -17,7 +18,7 @@ extern long scx200_gpio_shadow[2];
17 18
18/* returns the value of the GPIO pin */ 19/* returns the value of the GPIO pin */
19 20
20static inline int scx200_gpio_get(int index) { 21static inline int scx200_gpio_get(unsigned index) {
21 __SCx200_GPIO_BANK; 22 __SCx200_GPIO_BANK;
22 __SCx200_GPIO_IOADDR + 0x04; 23 __SCx200_GPIO_IOADDR + 0x04;
23 __SCx200_GPIO_INDEX; 24 __SCx200_GPIO_INDEX;
@@ -29,7 +30,7 @@ static inline int scx200_gpio_get(int index) {
29 driven if the GPIO is configured as an output, it might not be the 30 driven if the GPIO is configured as an output, it might not be the
30 state of the GPIO right now if the GPIO is configured as an input) */ 31 state of the GPIO right now if the GPIO is configured as an input) */
31 32
32static inline int scx200_gpio_current(int index) { 33static inline int scx200_gpio_current(unsigned index) {
33 __SCx200_GPIO_BANK; 34 __SCx200_GPIO_BANK;
34 __SCx200_GPIO_INDEX; 35 __SCx200_GPIO_INDEX;
35 36
@@ -38,7 +39,7 @@ static inline int scx200_gpio_current(int index) {
38 39
39/* drive the GPIO signal high */ 40/* drive the GPIO signal high */
40 41
41static inline void scx200_gpio_set_high(int index) { 42static inline void scx200_gpio_set_high(unsigned index) {
42 __SCx200_GPIO_BANK; 43 __SCx200_GPIO_BANK;
43 __SCx200_GPIO_IOADDR; 44 __SCx200_GPIO_IOADDR;
44 __SCx200_GPIO_SHADOW; 45 __SCx200_GPIO_SHADOW;
@@ -49,7 +50,7 @@ static inline void scx200_gpio_set_high(int index) {
49 50
50/* drive the GPIO signal low */ 51/* drive the GPIO signal low */
51 52
52static inline void scx200_gpio_set_low(int index) { 53static inline void scx200_gpio_set_low(unsigned index) {
53 __SCx200_GPIO_BANK; 54 __SCx200_GPIO_BANK;
54 __SCx200_GPIO_IOADDR; 55 __SCx200_GPIO_IOADDR;
55 __SCx200_GPIO_SHADOW; 56 __SCx200_GPIO_SHADOW;
@@ -60,7 +61,7 @@ static inline void scx200_gpio_set_low(int index) {
60 61
61/* drive the GPIO signal to state */ 62/* drive the GPIO signal to state */
62 63
63static inline void scx200_gpio_set(int index, int state) { 64static inline void scx200_gpio_set(unsigned index, int state) {
64 __SCx200_GPIO_BANK; 65 __SCx200_GPIO_BANK;
65 __SCx200_GPIO_IOADDR; 66 __SCx200_GPIO_IOADDR;
66 __SCx200_GPIO_SHADOW; 67 __SCx200_GPIO_SHADOW;
@@ -73,7 +74,7 @@ static inline void scx200_gpio_set(int index, int state) {
73} 74}
74 75
75/* toggle the GPIO signal */ 76/* toggle the GPIO signal */
76static inline void scx200_gpio_change(int index) { 77static inline void scx200_gpio_change(unsigned index) {
77 __SCx200_GPIO_BANK; 78 __SCx200_GPIO_BANK;
78 __SCx200_GPIO_IOADDR; 79 __SCx200_GPIO_IOADDR;
79 __SCx200_GPIO_SHADOW; 80 __SCx200_GPIO_SHADOW;
@@ -87,10 +88,3 @@ static inline void scx200_gpio_change(int index) {
87#undef __SCx200_GPIO_SHADOW 88#undef __SCx200_GPIO_SHADOW
88#undef __SCx200_GPIO_INDEX 89#undef __SCx200_GPIO_INDEX
89#undef __SCx200_GPIO_OUT 90#undef __SCx200_GPIO_OUT
90
91/*
92 Local variables:
93 compile-command: "make -C ../.. bzImage modules"
94 c-basic-offset: 8
95 End:
96*/
diff --git a/include/linux/security.h b/include/linux/security.h
index d2c17bd91a29..9b5fea81f55e 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -31,6 +31,8 @@
31#include <linux/msg.h> 31#include <linux/msg.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/key.h> 33#include <linux/key.h>
34#include <linux/xfrm.h>
35#include <net/flow.h>
34 36
35struct ctl_table; 37struct ctl_table;
36 38
@@ -67,7 +69,7 @@ struct xfrm_state;
67struct xfrm_user_sec_ctx; 69struct xfrm_user_sec_ctx;
68 70
69extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 71extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
70extern int cap_netlink_recv(struct sk_buff *skb); 72extern int cap_netlink_recv(struct sk_buff *skb, int cap);
71 73
72/* 74/*
73 * Values used in the task_security_ops calls 75 * Values used in the task_security_ops calls
@@ -88,6 +90,7 @@ extern int cap_netlink_recv(struct sk_buff *skb);
88struct nfsctl_arg; 90struct nfsctl_arg;
89struct sched_param; 91struct sched_param;
90struct swap_info_struct; 92struct swap_info_struct;
93struct request_sock;
91 94
92/* bprm_apply_creds unsafe reasons */ 95/* bprm_apply_creds unsafe reasons */
93#define LSM_UNSAFE_SHARE 1 96#define LSM_UNSAFE_SHARE 1
@@ -567,6 +570,9 @@ struct swap_info_struct;
567 * @p. 570 * @p.
568 * @p contains the task_struct for the process. 571 * @p contains the task_struct for the process.
569 * Return 0 if permission is granted. 572 * Return 0 if permission is granted.
573 * @task_getsecid:
574 * Retrieve the security identifier of the process @p.
575 * @p contains the task_struct for the process and place is into @secid.
570 * @task_setgroups: 576 * @task_setgroups:
571 * Check permission before setting the supplementary group set of the 577 * Check permission before setting the supplementary group set of the
572 * current process. 578 * current process.
@@ -582,6 +588,10 @@ struct swap_info_struct;
582 * @p contains the task_struct of process. 588 * @p contains the task_struct of process.
583 * @ioprio contains the new ioprio value 589 * @ioprio contains the new ioprio value
584 * Return 0 if permission is granted. 590 * Return 0 if permission is granted.
591 * @task_getioprio
592 * Check permission before getting the ioprio value of @p.
593 * @p contains the task_struct of process.
594 * Return 0 if permission is granted.
585 * @task_setrlimit: 595 * @task_setrlimit:
586 * Check permission before setting the resource limits of the current 596 * Check permission before setting the resource limits of the current
587 * process for @resource to @new_rlim. The old resource limit values can 597 * process for @resource to @new_rlim. The old resource limit values can
@@ -615,6 +625,7 @@ struct swap_info_struct;
615 * @p contains the task_struct for process. 625 * @p contains the task_struct for process.
616 * @info contains the signal information. 626 * @info contains the signal information.
617 * @sig contains the signal value. 627 * @sig contains the signal value.
628 * @secid contains the sid of the process where the signal originated
618 * Return 0 if permission is granted. 629 * Return 0 if permission is granted.
619 * @task_wait: 630 * @task_wait:
620 * Check permission before allowing a process to reap a child process @p 631 * Check permission before allowing a process to reap a child process @p
@@ -656,6 +667,7 @@ struct swap_info_struct;
656 * Check permission before processing the received netlink message in 667 * Check permission before processing the received netlink message in
657 * @skb. 668 * @skb.
658 * @skb contains the sk_buff structure for the netlink message. 669 * @skb contains the sk_buff structure for the netlink message.
670 * @cap indicates the capability required
659 * Return 0 if permission is granted. 671 * Return 0 if permission is granted.
660 * 672 *
661 * Security hooks for Unix domain networking. 673 * Security hooks for Unix domain networking.
@@ -803,9 +815,19 @@ struct swap_info_struct;
803 * which is used to copy security attributes between local stream sockets. 815 * which is used to copy security attributes between local stream sockets.
804 * @sk_free_security: 816 * @sk_free_security:
805 * Deallocate security structure. 817 * Deallocate security structure.
806 * @sk_getsid: 818 * @sk_clone_security:
807 * Retrieve the LSM-specific sid for the sock to enable caching of network 819 * Clone/copy security structure.
820 * @sk_getsecid:
821 * Retrieve the LSM-specific secid for the sock to enable caching of network
808 * authorizations. 822 * authorizations.
823 * @sock_graft:
824 * Sets the socket's isec sid to the sock's sid.
825 * @inet_conn_request:
826 * Sets the openreq's sid to socket's sid with MLS portion taken from peer sid.
827 * @inet_csk_clone:
828 * Sets the new child socket's sid to the openreq sid.
829 * @req_classify_flow:
830 * Sets the flow's sid to the openreq sid.
809 * 831 *
810 * Security hooks for XFRM operations. 832 * Security hooks for XFRM operations.
811 * 833 *
@@ -814,9 +836,10 @@ struct swap_info_struct;
814 * used by the XFRM system. 836 * used by the XFRM system.
815 * @sec_ctx contains the security context information being provided by 837 * @sec_ctx contains the security context information being provided by
816 * the user-level policy update program (e.g., setkey). 838 * the user-level policy update program (e.g., setkey).
817 * Allocate a security structure to the xp->security field. 839 * @sk refers to the sock from which to derive the security context.
818 * The security field is initialized to NULL when the xfrm_policy is 840 * Allocate a security structure to the xp->security field; the security
819 * allocated. 841 * field is initialized to NULL when the xfrm_policy is allocated. Only
842 * one of sec_ctx or sock can be specified.
820 * Return 0 if operation was successful (memory to allocate, legal context) 843 * Return 0 if operation was successful (memory to allocate, legal context)
821 * @xfrm_policy_clone_security: 844 * @xfrm_policy_clone_security:
822 * @old contains an existing xfrm_policy in the SPD. 845 * @old contains an existing xfrm_policy in the SPD.
@@ -835,9 +858,14 @@ struct swap_info_struct;
835 * Database by the XFRM system. 858 * Database by the XFRM system.
836 * @sec_ctx contains the security context information being provided by 859 * @sec_ctx contains the security context information being provided by
837 * the user-level SA generation program (e.g., setkey or racoon). 860 * the user-level SA generation program (e.g., setkey or racoon).
838 * Allocate a security structure to the x->security field. The 861 * @polsec contains the security context information associated with a xfrm
839 * security field is initialized to NULL when the xfrm_state is 862 * policy rule from which to take the base context. polsec must be NULL
840 * allocated. 863 * when sec_ctx is specified.
864 * @secid contains the secid from which to take the mls portion of the context.
865 * Allocate a security structure to the x->security field; the security
866 * field is initialized to NULL when the xfrm_state is allocated. Set the
867 * context to correspond to either sec_ctx or polsec, with the mls portion
868 * taken from secid in the latter case.
841 * Return 0 if operation was successful (memory to allocate, legal context). 869 * Return 0 if operation was successful (memory to allocate, legal context).
842 * @xfrm_state_free_security: 870 * @xfrm_state_free_security:
843 * @x contains the xfrm_state. 871 * @x contains the xfrm_state.
@@ -848,13 +876,27 @@ struct swap_info_struct;
848 * @xfrm_policy_lookup: 876 * @xfrm_policy_lookup:
849 * @xp contains the xfrm_policy for which the access control is being 877 * @xp contains the xfrm_policy for which the access control is being
850 * checked. 878 * checked.
851 * @sk_sid contains the sock security label that is used to authorize 879 * @fl_secid contains the flow security label that is used to authorize
852 * access to the policy xp. 880 * access to the policy xp.
853 * @dir contains the direction of the flow (input or output). 881 * @dir contains the direction of the flow (input or output).
854 * Check permission when a sock selects a xfrm_policy for processing 882 * Check permission when a flow selects a xfrm_policy for processing
855 * XFRMs on a packet. The hook is called when selecting either a 883 * XFRMs on a packet. The hook is called when selecting either a
856 * per-socket policy or a generic xfrm policy. 884 * per-socket policy or a generic xfrm policy.
857 * Return 0 if permission is granted. 885 * Return 0 if permission is granted.
886 * @xfrm_state_pol_flow_match:
887 * @x contains the state to match.
888 * @xp contains the policy to check for a match.
889 * @fl contains the flow to check for a match.
890 * Return 1 if there is a match.
891 * @xfrm_flow_state_match:
892 * @fl contains the flow key to match.
893 * @xfrm points to the xfrm_state to match.
894 * Return 1 if there is a match.
895 * @xfrm_decode_session:
896 * @skb points to skb to decode.
897 * @secid points to the flow key secid to set.
898 * @ckall says if all xfrms used should be checked for same secid.
899 * Return 0 if ckall is zero or all xfrms used have the same secid.
858 * 900 *
859 * Security hooks affecting all Key Management operations 901 * Security hooks affecting all Key Management operations
860 * 902 *
@@ -862,6 +904,7 @@ struct swap_info_struct;
862 * Permit allocation of a key and assign security data. Note that key does 904 * Permit allocation of a key and assign security data. Note that key does
863 * not have a serial number assigned at this point. 905 * not have a serial number assigned at this point.
864 * @key points to the key. 906 * @key points to the key.
907 * @flags is the allocation flags
865 * Return 0 if permission is granted, -ve error otherwise. 908 * Return 0 if permission is granted, -ve error otherwise.
866 * @key_free: 909 * @key_free:
867 * Notification of destruction; free security data. 910 * Notification of destruction; free security data.
@@ -1099,6 +1142,16 @@ struct swap_info_struct;
1099 * @name contains the name of the security module being unstacked. 1142 * @name contains the name of the security module being unstacked.
1100 * @ops contains a pointer to the struct security_operations of the module to unstack. 1143 * @ops contains a pointer to the struct security_operations of the module to unstack.
1101 * 1144 *
1145 * @secid_to_secctx:
1146 * Convert secid to security context.
1147 * @secid contains the security ID.
1148 * @secdata contains the pointer that stores the converted security context.
1149 *
1150 * @release_secctx:
1151 * Release the security context.
1152 * @secdata contains the security context.
1153 * @seclen contains the length of the security context.
1154 *
1102 * This is the main security structure. 1155 * This is the main security structure.
1103 */ 1156 */
1104struct security_operations { 1157struct security_operations {
@@ -1217,16 +1270,18 @@ struct security_operations {
1217 int (*task_setpgid) (struct task_struct * p, pid_t pgid); 1270 int (*task_setpgid) (struct task_struct * p, pid_t pgid);
1218 int (*task_getpgid) (struct task_struct * p); 1271 int (*task_getpgid) (struct task_struct * p);
1219 int (*task_getsid) (struct task_struct * p); 1272 int (*task_getsid) (struct task_struct * p);
1273 void (*task_getsecid) (struct task_struct * p, u32 * secid);
1220 int (*task_setgroups) (struct group_info *group_info); 1274 int (*task_setgroups) (struct group_info *group_info);
1221 int (*task_setnice) (struct task_struct * p, int nice); 1275 int (*task_setnice) (struct task_struct * p, int nice);
1222 int (*task_setioprio) (struct task_struct * p, int ioprio); 1276 int (*task_setioprio) (struct task_struct * p, int ioprio);
1277 int (*task_getioprio) (struct task_struct * p);
1223 int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim); 1278 int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim);
1224 int (*task_setscheduler) (struct task_struct * p, int policy, 1279 int (*task_setscheduler) (struct task_struct * p, int policy,
1225 struct sched_param * lp); 1280 struct sched_param * lp);
1226 int (*task_getscheduler) (struct task_struct * p); 1281 int (*task_getscheduler) (struct task_struct * p);
1227 int (*task_movememory) (struct task_struct * p); 1282 int (*task_movememory) (struct task_struct * p);
1228 int (*task_kill) (struct task_struct * p, 1283 int (*task_kill) (struct task_struct * p,
1229 struct siginfo * info, int sig); 1284 struct siginfo * info, int sig, u32 secid);
1230 int (*task_wait) (struct task_struct * p); 1285 int (*task_wait) (struct task_struct * p);
1231 int (*task_prctl) (int option, unsigned long arg2, 1286 int (*task_prctl) (int option, unsigned long arg2,
1232 unsigned long arg3, unsigned long arg4, 1287 unsigned long arg3, unsigned long arg4,
@@ -1265,7 +1320,7 @@ struct security_operations {
1265 struct sembuf * sops, unsigned nsops, int alter); 1320 struct sembuf * sops, unsigned nsops, int alter);
1266 1321
1267 int (*netlink_send) (struct sock * sk, struct sk_buff * skb); 1322 int (*netlink_send) (struct sock * sk, struct sk_buff * skb);
1268 int (*netlink_recv) (struct sk_buff * skb); 1323 int (*netlink_recv) (struct sk_buff * skb, int cap);
1269 1324
1270 /* allow module stacking */ 1325 /* allow module stacking */
1271 int (*register_security) (const char *name, 1326 int (*register_security) (const char *name,
@@ -1277,6 +1332,8 @@ struct security_operations {
1277 1332
1278 int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1333 int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1279 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1334 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1335 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen);
1336 void (*release_secctx)(char *secdata, u32 seclen);
1280 1337
1281#ifdef CONFIG_SECURITY_NETWORK 1338#ifdef CONFIG_SECURITY_NETWORK
1282 int (*unix_stream_connect) (struct socket * sock, 1339 int (*unix_stream_connect) (struct socket * sock,
@@ -1284,8 +1341,8 @@ struct security_operations {
1284 int (*unix_may_send) (struct socket * sock, struct socket * other); 1341 int (*unix_may_send) (struct socket * sock, struct socket * other);
1285 1342
1286 int (*socket_create) (int family, int type, int protocol, int kern); 1343 int (*socket_create) (int family, int type, int protocol, int kern);
1287 void (*socket_post_create) (struct socket * sock, int family, 1344 int (*socket_post_create) (struct socket * sock, int family,
1288 int type, int protocol, int kern); 1345 int type, int protocol, int kern);
1289 int (*socket_bind) (struct socket * sock, 1346 int (*socket_bind) (struct socket * sock,
1290 struct sockaddr * address, int addrlen); 1347 struct sockaddr * address, int addrlen);
1291 int (*socket_connect) (struct socket * sock, 1348 int (*socket_connect) (struct socket * sock,
@@ -1305,26 +1362,39 @@ struct security_operations {
1305 int (*socket_shutdown) (struct socket * sock, int how); 1362 int (*socket_shutdown) (struct socket * sock, int how);
1306 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb); 1363 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb);
1307 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); 1364 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1308 int (*socket_getpeersec_dgram) (struct sk_buff *skb, char **secdata, u32 *seclen); 1365 int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid);
1309 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); 1366 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
1310 void (*sk_free_security) (struct sock *sk); 1367 void (*sk_free_security) (struct sock *sk);
1311 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir); 1368 void (*sk_clone_security) (const struct sock *sk, struct sock *newsk);
1369 void (*sk_getsecid) (struct sock *sk, u32 *secid);
1370 void (*sock_graft)(struct sock* sk, struct socket *parent);
1371 int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb,
1372 struct request_sock *req);
1373 void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req);
1374 void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl);
1312#endif /* CONFIG_SECURITY_NETWORK */ 1375#endif /* CONFIG_SECURITY_NETWORK */
1313 1376
1314#ifdef CONFIG_SECURITY_NETWORK_XFRM 1377#ifdef CONFIG_SECURITY_NETWORK_XFRM
1315 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); 1378 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp,
1379 struct xfrm_user_sec_ctx *sec_ctx, struct sock *sk);
1316 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); 1380 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
1317 void (*xfrm_policy_free_security) (struct xfrm_policy *xp); 1381 void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
1318 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); 1382 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp);
1319 int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); 1383 int (*xfrm_state_alloc_security) (struct xfrm_state *x,
1384 struct xfrm_user_sec_ctx *sec_ctx, struct xfrm_sec_ctx *polsec,
1385 u32 secid);
1320 void (*xfrm_state_free_security) (struct xfrm_state *x); 1386 void (*xfrm_state_free_security) (struct xfrm_state *x);
1321 int (*xfrm_state_delete_security) (struct xfrm_state *x); 1387 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1322 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir); 1388 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
1389 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
1390 struct xfrm_policy *xp, struct flowi *fl);
1391 int (*xfrm_flow_state_match)(struct flowi *fl, struct xfrm_state *xfrm);
1392 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
1323#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1393#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1324 1394
1325 /* key management security hooks */ 1395 /* key management security hooks */
1326#ifdef CONFIG_KEYS 1396#ifdef CONFIG_KEYS
1327 int (*key_alloc)(struct key *key, struct task_struct *tsk); 1397 int (*key_alloc)(struct key *key, struct task_struct *tsk, unsigned long flags);
1328 void (*key_free)(struct key *key); 1398 void (*key_free)(struct key *key);
1329 int (*key_permission)(key_ref_t key_ref, 1399 int (*key_permission)(key_ref_t key_ref,
1330 struct task_struct *context, 1400 struct task_struct *context,
@@ -1525,6 +1595,7 @@ static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
1525 1595
1526static inline int security_inode_alloc (struct inode *inode) 1596static inline int security_inode_alloc (struct inode *inode)
1527{ 1597{
1598 inode->i_security = NULL;
1528 return security_ops->inode_alloc_security (inode); 1599 return security_ops->inode_alloc_security (inode);
1529} 1600}
1530 1601
@@ -1837,6 +1908,11 @@ static inline int security_task_getsid (struct task_struct *p)
1837 return security_ops->task_getsid (p); 1908 return security_ops->task_getsid (p);
1838} 1909}
1839 1910
1911static inline void security_task_getsecid (struct task_struct *p, u32 *secid)
1912{
1913 security_ops->task_getsecid (p, secid);
1914}
1915
1840static inline int security_task_setgroups (struct group_info *group_info) 1916static inline int security_task_setgroups (struct group_info *group_info)
1841{ 1917{
1842 return security_ops->task_setgroups (group_info); 1918 return security_ops->task_setgroups (group_info);
@@ -1852,6 +1928,11 @@ static inline int security_task_setioprio (struct task_struct *p, int ioprio)
1852 return security_ops->task_setioprio (p, ioprio); 1928 return security_ops->task_setioprio (p, ioprio);
1853} 1929}
1854 1930
1931static inline int security_task_getioprio (struct task_struct *p)
1932{
1933 return security_ops->task_getioprio (p);
1934}
1935
1855static inline int security_task_setrlimit (unsigned int resource, 1936static inline int security_task_setrlimit (unsigned int resource,
1856 struct rlimit *new_rlim) 1937 struct rlimit *new_rlim)
1857{ 1938{
@@ -1876,9 +1957,10 @@ static inline int security_task_movememory (struct task_struct *p)
1876} 1957}
1877 1958
1878static inline int security_task_kill (struct task_struct *p, 1959static inline int security_task_kill (struct task_struct *p,
1879 struct siginfo *info, int sig) 1960 struct siginfo *info, int sig,
1961 u32 secid)
1880{ 1962{
1881 return security_ops->task_kill (p, info, sig); 1963 return security_ops->task_kill (p, info, sig, secid);
1882} 1964}
1883 1965
1884static inline int security_task_wait (struct task_struct *p) 1966static inline int security_task_wait (struct task_struct *p)
@@ -2031,9 +2113,19 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff * skb)
2031 return security_ops->netlink_send(sk, skb); 2113 return security_ops->netlink_send(sk, skb);
2032} 2114}
2033 2115
2034static inline int security_netlink_recv(struct sk_buff * skb) 2116static inline int security_netlink_recv(struct sk_buff * skb, int cap)
2117{
2118 return security_ops->netlink_recv(skb, cap);
2119}
2120
2121static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2035{ 2122{
2036 return security_ops->netlink_recv(skb); 2123 return security_ops->secid_to_secctx(secid, secdata, seclen);
2124}
2125
2126static inline void security_release_secctx(char *secdata, u32 seclen)
2127{
2128 return security_ops->release_secctx(secdata, seclen);
2037} 2129}
2038 2130
2039/* prototypes */ 2131/* prototypes */
@@ -2489,6 +2581,9 @@ static inline int security_task_getsid (struct task_struct *p)
2489 return 0; 2581 return 0;
2490} 2582}
2491 2583
2584static inline void security_task_getsecid (struct task_struct *p, u32 *secid)
2585{ }
2586
2492static inline int security_task_setgroups (struct group_info *group_info) 2587static inline int security_task_setgroups (struct group_info *group_info)
2493{ 2588{
2494 return 0; 2589 return 0;
@@ -2504,6 +2599,11 @@ static inline int security_task_setioprio (struct task_struct *p, int ioprio)
2504 return 0; 2599 return 0;
2505} 2600}
2506 2601
2602static inline int security_task_getioprio (struct task_struct *p)
2603{
2604 return 0;
2605}
2606
2507static inline int security_task_setrlimit (unsigned int resource, 2607static inline int security_task_setrlimit (unsigned int resource,
2508 struct rlimit *new_rlim) 2608 struct rlimit *new_rlim)
2509{ 2609{
@@ -2528,7 +2628,8 @@ static inline int security_task_movememory (struct task_struct *p)
2528} 2628}
2529 2629
2530static inline int security_task_kill (struct task_struct *p, 2630static inline int security_task_kill (struct task_struct *p,
2531 struct siginfo *info, int sig) 2631 struct siginfo *info, int sig,
2632 u32 secid)
2532{ 2633{
2533 return 0; 2634 return 0;
2534} 2635}
@@ -2669,9 +2770,9 @@ static inline int security_netlink_send (struct sock *sk, struct sk_buff *skb)
2669 return cap_netlink_send (sk, skb); 2770 return cap_netlink_send (sk, skb);
2670} 2771}
2671 2772
2672static inline int security_netlink_recv (struct sk_buff *skb) 2773static inline int security_netlink_recv (struct sk_buff *skb, int cap)
2673{ 2774{
2674 return cap_netlink_recv (skb); 2775 return cap_netlink_recv (skb, cap);
2675} 2776}
2676 2777
2677static inline struct dentry *securityfs_create_dir(const char *name, 2778static inline struct dentry *securityfs_create_dir(const char *name,
@@ -2693,6 +2794,14 @@ static inline void securityfs_remove(struct dentry *dentry)
2693{ 2794{
2694} 2795}
2695 2796
2797static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2798{
2799 return -EOPNOTSUPP;
2800}
2801
2802static inline void security_release_secctx(char *secdata, u32 seclen)
2803{
2804}
2696#endif /* CONFIG_SECURITY */ 2805#endif /* CONFIG_SECURITY */
2697 2806
2698#ifdef CONFIG_SECURITY_NETWORK 2807#ifdef CONFIG_SECURITY_NETWORK
@@ -2716,13 +2825,13 @@ static inline int security_socket_create (int family, int type,
2716 return security_ops->socket_create(family, type, protocol, kern); 2825 return security_ops->socket_create(family, type, protocol, kern);
2717} 2826}
2718 2827
2719static inline void security_socket_post_create(struct socket * sock, 2828static inline int security_socket_post_create(struct socket * sock,
2720 int family, 2829 int family,
2721 int type, 2830 int type,
2722 int protocol, int kern) 2831 int protocol, int kern)
2723{ 2832{
2724 security_ops->socket_post_create(sock, family, type, 2833 return security_ops->socket_post_create(sock, family, type,
2725 protocol, kern); 2834 protocol, kern);
2726} 2835}
2727 2836
2728static inline int security_socket_bind(struct socket * sock, 2837static inline int security_socket_bind(struct socket * sock,
@@ -2808,10 +2917,9 @@ static inline int security_socket_getpeersec_stream(struct socket *sock, char __
2808 return security_ops->socket_getpeersec_stream(sock, optval, optlen, len); 2917 return security_ops->socket_getpeersec_stream(sock, optval, optlen, len);
2809} 2918}
2810 2919
2811static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, 2920static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
2812 u32 *seclen)
2813{ 2921{
2814 return security_ops->socket_getpeersec_dgram(skb, secdata, seclen); 2922 return security_ops->socket_getpeersec_dgram(sock, skb, secid);
2815} 2923}
2816 2924
2817static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) 2925static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
@@ -2824,9 +2932,36 @@ static inline void security_sk_free(struct sock *sk)
2824 return security_ops->sk_free_security(sk); 2932 return security_ops->sk_free_security(sk);
2825} 2933}
2826 2934
2827static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir) 2935static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
2936{
2937 return security_ops->sk_clone_security(sk, newsk);
2938}
2939
2940static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
2941{
2942 security_ops->sk_getsecid(sk, &fl->secid);
2943}
2944
2945static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
2946{
2947 security_ops->req_classify_flow(req, fl);
2948}
2949
2950static inline void security_sock_graft(struct sock* sk, struct socket *parent)
2828{ 2951{
2829 return security_ops->sk_getsid(sk, fl, dir); 2952 security_ops->sock_graft(sk, parent);
2953}
2954
2955static inline int security_inet_conn_request(struct sock *sk,
2956 struct sk_buff *skb, struct request_sock *req)
2957{
2958 return security_ops->inet_conn_request(sk, skb, req);
2959}
2960
2961static inline void security_inet_csk_clone(struct sock *newsk,
2962 const struct request_sock *req)
2963{
2964 security_ops->inet_csk_clone(newsk, req);
2830} 2965}
2831#else /* CONFIG_SECURITY_NETWORK */ 2966#else /* CONFIG_SECURITY_NETWORK */
2832static inline int security_unix_stream_connect(struct socket * sock, 2967static inline int security_unix_stream_connect(struct socket * sock,
@@ -2848,11 +2983,12 @@ static inline int security_socket_create (int family, int type,
2848 return 0; 2983 return 0;
2849} 2984}
2850 2985
2851static inline void security_socket_post_create(struct socket * sock, 2986static inline int security_socket_post_create(struct socket * sock,
2852 int family, 2987 int family,
2853 int type, 2988 int type,
2854 int protocol, int kern) 2989 int protocol, int kern)
2855{ 2990{
2991 return 0;
2856} 2992}
2857 2993
2858static inline int security_socket_bind(struct socket * sock, 2994static inline int security_socket_bind(struct socket * sock,
@@ -2936,8 +3072,7 @@ static inline int security_socket_getpeersec_stream(struct socket *sock, char __
2936 return -ENOPROTOOPT; 3072 return -ENOPROTOOPT;
2937} 3073}
2938 3074
2939static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, 3075static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
2940 u32 *seclen)
2941{ 3076{
2942 return -ENOPROTOOPT; 3077 return -ENOPROTOOPT;
2943} 3078}
@@ -2951,16 +3086,43 @@ static inline void security_sk_free(struct sock *sk)
2951{ 3086{
2952} 3087}
2953 3088
2954static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir) 3089static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
3090{
3091}
3092
3093static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
3094{
3095}
3096
3097static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
3098{
3099}
3100
3101static inline void security_sock_graft(struct sock* sk, struct socket *parent)
3102{
3103}
3104
3105static inline int security_inet_conn_request(struct sock *sk,
3106 struct sk_buff *skb, struct request_sock *req)
2955{ 3107{
2956 return 0; 3108 return 0;
2957} 3109}
3110
3111static inline void security_inet_csk_clone(struct sock *newsk,
3112 const struct request_sock *req)
3113{
3114}
2958#endif /* CONFIG_SECURITY_NETWORK */ 3115#endif /* CONFIG_SECURITY_NETWORK */
2959 3116
2960#ifdef CONFIG_SECURITY_NETWORK_XFRM 3117#ifdef CONFIG_SECURITY_NETWORK_XFRM
2961static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) 3118static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
2962{ 3119{
2963 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx); 3120 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx, NULL);
3121}
3122
3123static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk)
3124{
3125 return security_ops->xfrm_policy_alloc_security(xp, NULL, sk);
2964} 3126}
2965 3127
2966static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) 3128static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
@@ -2978,9 +3140,18 @@ static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
2978 return security_ops->xfrm_policy_delete_security(xp); 3140 return security_ops->xfrm_policy_delete_security(xp);
2979} 3141}
2980 3142
2981static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) 3143static inline int security_xfrm_state_alloc(struct xfrm_state *x,
3144 struct xfrm_user_sec_ctx *sec_ctx)
3145{
3146 return security_ops->xfrm_state_alloc_security(x, sec_ctx, NULL, 0);
3147}
3148
3149static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
3150 struct xfrm_sec_ctx *polsec, u32 secid)
2982{ 3151{
2983 return security_ops->xfrm_state_alloc_security(x, sec_ctx); 3152 if (!polsec)
3153 return 0;
3154 return security_ops->xfrm_state_alloc_security(x, NULL, polsec, secid);
2984} 3155}
2985 3156
2986static inline int security_xfrm_state_delete(struct xfrm_state *x) 3157static inline int security_xfrm_state_delete(struct xfrm_state *x)
@@ -2993,9 +3164,32 @@ static inline void security_xfrm_state_free(struct xfrm_state *x)
2993 security_ops->xfrm_state_free_security(x); 3164 security_ops->xfrm_state_free_security(x);
2994} 3165}
2995 3166
2996static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) 3167static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir)
2997{ 3168{
2998 return security_ops->xfrm_policy_lookup(xp, sk_sid, dir); 3169 return security_ops->xfrm_policy_lookup(xp, fl_secid, dir);
3170}
3171
3172static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3173 struct xfrm_policy *xp, struct flowi *fl)
3174{
3175 return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
3176}
3177
3178static inline int security_xfrm_flow_state_match(struct flowi *fl, struct xfrm_state *xfrm)
3179{
3180 return security_ops->xfrm_flow_state_match(fl, xfrm);
3181}
3182
3183static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
3184{
3185 return security_ops->xfrm_decode_session(skb, secid, 1);
3186}
3187
3188static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
3189{
3190 int rc = security_ops->xfrm_decode_session(skb, &fl->secid, 0);
3191
3192 BUG_ON(rc);
2999} 3193}
3000#else /* CONFIG_SECURITY_NETWORK_XFRM */ 3194#else /* CONFIG_SECURITY_NETWORK_XFRM */
3001static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) 3195static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
@@ -3003,6 +3197,11 @@ static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm
3003 return 0; 3197 return 0;
3004} 3198}
3005 3199
3200static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk)
3201{
3202 return 0;
3203}
3204
3006static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) 3205static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
3007{ 3206{
3008 return 0; 3207 return 0;
@@ -3017,7 +3216,14 @@ static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
3017 return 0; 3216 return 0;
3018} 3217}
3019 3218
3020static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) 3219static inline int security_xfrm_state_alloc(struct xfrm_state *x,
3220 struct xfrm_user_sec_ctx *sec_ctx)
3221{
3222 return 0;
3223}
3224
3225static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
3226 struct xfrm_sec_ctx *polsec, u32 secid)
3021{ 3227{
3022 return 0; 3228 return 0;
3023} 3229}
@@ -3031,18 +3237,41 @@ static inline int security_xfrm_state_delete(struct xfrm_state *x)
3031 return 0; 3237 return 0;
3032} 3238}
3033 3239
3034static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) 3240static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir)
3035{ 3241{
3036 return 0; 3242 return 0;
3037} 3243}
3244
3245static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3246 struct xfrm_policy *xp, struct flowi *fl)
3247{
3248 return 1;
3249}
3250
3251static inline int security_xfrm_flow_state_match(struct flowi *fl,
3252 struct xfrm_state *xfrm)
3253{
3254 return 1;
3255}
3256
3257static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
3258{
3259 return 0;
3260}
3261
3262static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
3263{
3264}
3265
3038#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 3266#endif /* CONFIG_SECURITY_NETWORK_XFRM */
3039 3267
3040#ifdef CONFIG_KEYS 3268#ifdef CONFIG_KEYS
3041#ifdef CONFIG_SECURITY 3269#ifdef CONFIG_SECURITY
3042static inline int security_key_alloc(struct key *key, 3270static inline int security_key_alloc(struct key *key,
3043 struct task_struct *tsk) 3271 struct task_struct *tsk,
3272 unsigned long flags)
3044{ 3273{
3045 return security_ops->key_alloc(key, tsk); 3274 return security_ops->key_alloc(key, tsk, flags);
3046} 3275}
3047 3276
3048static inline void security_key_free(struct key *key) 3277static inline void security_key_free(struct key *key)
@@ -3060,7 +3289,8 @@ static inline int security_key_permission(key_ref_t key_ref,
3060#else 3289#else
3061 3290
3062static inline int security_key_alloc(struct key *key, 3291static inline int security_key_alloc(struct key *key,
3063 struct task_struct *tsk) 3292 struct task_struct *tsk,
3293 unsigned long flags)
3064{ 3294{
3065 return 0; 3295 return 0;
3066} 3296}
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index aad4e390d6a5..d1b7ca6c1c57 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -46,7 +46,7 @@ void selinux_audit_rule_free(struct selinux_audit_rule *rule);
46 46
47/** 47/**
48 * selinux_audit_rule_match - determine if a context ID matches a rule. 48 * selinux_audit_rule_match - determine if a context ID matches a rule.
49 * @ctxid: the context ID to check 49 * @sid: the context ID to check
50 * @field: the field this rule refers to 50 * @field: the field this rule refers to
51 * @op: the operater the rule uses 51 * @op: the operater the rule uses
52 * @rule: pointer to the audit rule to check against 52 * @rule: pointer to the audit rule to check against
@@ -55,7 +55,7 @@ void selinux_audit_rule_free(struct selinux_audit_rule *rule);
55 * Returns 1 if the context id matches the rule, 0 if it does not, and 55 * Returns 1 if the context id matches the rule, 0 if it does not, and
56 * -errno on failure. 56 * -errno on failure.
57 */ 57 */
58int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op, 58int selinux_audit_rule_match(u32 sid, u32 field, u32 op,
59 struct selinux_audit_rule *rule, 59 struct selinux_audit_rule *rule,
60 struct audit_context *actx); 60 struct audit_context *actx);
61 61
@@ -70,18 +70,8 @@ int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op,
70void selinux_audit_set_callback(int (*callback)(void)); 70void selinux_audit_set_callback(int (*callback)(void));
71 71
72/** 72/**
73 * selinux_task_ctxid - determine a context ID for a process. 73 * selinux_sid_to_string - map a security context ID to a string
74 * @tsk: the task object 74 * @sid: security context ID to be converted.
75 * @ctxid: ID value returned via this
76 *
77 * On return, ctxid will contain an ID for the context. This value
78 * should only be used opaquely.
79 */
80void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid);
81
82/**
83 * selinux_ctxid_to_string - map a security context ID to a string
84 * @ctxid: security context ID to be converted.
85 * @ctx: address of context string to be returned 75 * @ctx: address of context string to be returned
86 * @ctxlen: length of returned context string. 76 * @ctxlen: length of returned context string.
87 * 77 *
@@ -89,7 +79,7 @@ void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid);
89 * string will be allocated internally, and the caller must call 79 * string will be allocated internally, and the caller must call
90 * kfree() on it after use. 80 * kfree() on it after use.
91 */ 81 */
92int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen); 82int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen);
93 83
94/** 84/**
95 * selinux_get_inode_sid - get the inode's security context ID 85 * selinux_get_inode_sid - get the inode's security context ID
@@ -154,7 +144,7 @@ static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule)
154 return; 144 return;
155} 145}
156 146
157static inline int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op, 147static inline int selinux_audit_rule_match(u32 sid, u32 field, u32 op,
158 struct selinux_audit_rule *rule, 148 struct selinux_audit_rule *rule,
159 struct audit_context *actx) 149 struct audit_context *actx)
160{ 150{
@@ -166,12 +156,7 @@ static inline void selinux_audit_set_callback(int (*callback)(void))
166 return; 156 return;
167} 157}
168 158
169static inline void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid) 159static inline int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen)
170{
171 *ctxid = 0;
172}
173
174static inline int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen)
175{ 160{
176 *ctx = NULL; 161 *ctx = NULL;
177 *ctxlen = 0; 162 *ctxlen = 0;
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 7bc5c7c12b54..46000936f8f1 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -38,9 +38,17 @@ typedef struct {
38 * These macros triggered gcc-3.x compile-time problems. We think these are 38 * These macros triggered gcc-3.x compile-time problems. We think these are
39 * OK now. Be cautious. 39 * OK now. Be cautious.
40 */ 40 */
41#define SEQLOCK_UNLOCKED { 0, SPIN_LOCK_UNLOCKED } 41#define __SEQLOCK_UNLOCKED(lockname) \
42#define seqlock_init(x) do { *(x) = (seqlock_t) SEQLOCK_UNLOCKED; } while (0) 42 { 0, __SPIN_LOCK_UNLOCKED(lockname) }
43 43
44#define SEQLOCK_UNLOCKED \
45 __SEQLOCK_UNLOCKED(old_style_seqlock_init)
46
47#define seqlock_init(x) \
48 do { *(x) = (seqlock_t) __SEQLOCK_UNLOCKED(x); } while (0)
49
50#define DEFINE_SEQLOCK(x) \
51 seqlock_t x = __SEQLOCK_UNLOCKED(x)
44 52
45/* Lock out other writers and update the count. 53/* Lock out other writers and update the count.
46 * Acts like a normal spin_lock/unlock. 54 * Acts like a normal spin_lock/unlock.
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 0ef50baa7da6..86501a3de2ac 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -130,6 +130,9 @@
130/* SUN4V Hypervisor Console */ 130/* SUN4V Hypervisor Console */
131#define PORT_SUNHV 72 131#define PORT_SUNHV 72
132 132
133#define PORT_S3C2412 73
134
135
133#ifdef __KERNEL__ 136#ifdef __KERNEL__
134 137
135#include <linux/compiler.h> 138#include <linux/compiler.h>
@@ -213,16 +216,18 @@ struct uart_port {
213 unsigned char __iomem *membase; /* read/write[bwl] */ 216 unsigned char __iomem *membase; /* read/write[bwl] */
214 unsigned int irq; /* irq number */ 217 unsigned int irq; /* irq number */
215 unsigned int uartclk; /* base uart clock */ 218 unsigned int uartclk; /* base uart clock */
216 unsigned char fifosize; /* tx fifo size */ 219 unsigned int fifosize; /* tx fifo size */
217 unsigned char x_char; /* xon/xoff char */ 220 unsigned char x_char; /* xon/xoff char */
218 unsigned char regshift; /* reg offset shift */ 221 unsigned char regshift; /* reg offset shift */
219 unsigned char iotype; /* io access style */ 222 unsigned char iotype; /* io access style */
223 unsigned char unused1;
220 224
221#define UPIO_PORT (0) 225#define UPIO_PORT (0)
222#define UPIO_HUB6 (1) 226#define UPIO_HUB6 (1)
223#define UPIO_MEM (2) 227#define UPIO_MEM (2)
224#define UPIO_MEM32 (3) 228#define UPIO_MEM32 (3)
225#define UPIO_AU (4) /* Au1x00 type IO */ 229#define UPIO_AU (4) /* Au1x00 type IO */
230#define UPIO_TSI (5) /* Tsi108/109 type IO */
226 231
227 unsigned int read_status_mask; /* driver specific */ 232 unsigned int read_status_mask; /* driver specific */
228 unsigned int ignore_status_mask; /* driver specific */ 233 unsigned int ignore_status_mask; /* driver specific */
@@ -333,7 +338,6 @@ struct uart_driver {
333 struct module *owner; 338 struct module *owner;
334 const char *driver_name; 339 const char *driver_name;
335 const char *dev_name; 340 const char *dev_name;
336 const char *devfs_name;
337 int major; 341 int major;
338 int minor; 342 int minor;
339 int nr; 343 int nr;
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index c057f0b32318..f3c51899117f 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -19,6 +19,10 @@ struct shmem_inode_info {
19 swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */ 19 swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */
20 struct list_head swaplist; /* chain of maybes on swap */ 20 struct list_head swaplist; /* chain of maybes on swap */
21 struct inode vfs_inode; 21 struct inode vfs_inode;
22#ifdef CONFIG_TMPFS_POSIX_ACL
23 struct posix_acl *i_acl;
24 struct posix_acl *i_default_acl;
25#endif
22}; 26};
23 27
24struct shmem_sb_info { 28struct shmem_sb_info {
@@ -36,4 +40,24 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
36 return container_of(inode, struct shmem_inode_info, vfs_inode); 40 return container_of(inode, struct shmem_inode_info, vfs_inode);
37} 41}
38 42
43#ifdef CONFIG_TMPFS_POSIX_ACL
44int shmem_permission(struct inode *, int, struct nameidata *);
45int shmem_acl_init(struct inode *, struct inode *);
46void shmem_acl_destroy_inode(struct inode *);
47
48extern struct xattr_handler shmem_xattr_acl_access_handler;
49extern struct xattr_handler shmem_xattr_acl_default_handler;
50
51extern struct generic_acl_operations shmem_acl_ops;
52
53#else
54static inline int shmem_acl_init(struct inode *inode, struct inode *dir)
55{
56 return 0;
57}
58static inline void shmem_acl_destroy_inode(struct inode *inode)
59{
60}
61#endif /* CONFIG_TMPFS_POSIX_ACL */
62
39#endif 63#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 1e4ce7225eee..117135e33d67 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -9,32 +9,6 @@
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10 10
11/* 11/*
12 * These values of sa_flags are used only by the kernel as part of the
13 * irq handling routines.
14 *
15 * SA_INTERRUPT is also used by the irq handling routines.
16 * SA_SHIRQ is for shared interrupt support on PCI and EISA.
17 * SA_PROBEIRQ is set by callers when they expect sharing mismatches to occur
18 */
19#define SA_SAMPLE_RANDOM SA_RESTART
20#define SA_SHIRQ 0x04000000
21#define SA_PROBEIRQ 0x08000000
22
23/*
24 * As above, these correspond to the IORESOURCE_IRQ_* defines in
25 * linux/ioport.h to select the interrupt line behaviour. When
26 * requesting an interrupt without specifying a SA_TRIGGER, the
27 * setting should be assumed to be "as already configured", which
28 * may be as per machine or firmware initialisation.
29 */
30#define SA_TRIGGER_LOW 0x00000008
31#define SA_TRIGGER_HIGH 0x00000004
32#define SA_TRIGGER_FALLING 0x00000002
33#define SA_TRIGGER_RISING 0x00000001
34#define SA_TRIGGER_MASK (SA_TRIGGER_HIGH|SA_TRIGGER_LOW|\
35 SA_TRIGGER_RISING|SA_TRIGGER_FALLING)
36
37/*
38 * Real Time signals may be queued. 12 * Real Time signals may be queued.
39 */ 13 */
40 14
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 16eef03ce0eb..85577a4ffa61 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -34,8 +34,9 @@
34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
35 35
36#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
37#define CHECKSUM_HW 1 37#define CHECKSUM_PARTIAL 1
38#define CHECKSUM_UNNECESSARY 2 38#define CHECKSUM_UNNECESSARY 2
39#define CHECKSUM_COMPLETE 3
39 40
40#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ 41#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \
41 ~(SMP_CACHE_BYTES - 1)) 42 ~(SMP_CACHE_BYTES - 1))
@@ -56,17 +57,17 @@
56 * Apparently with secret goal to sell you new device, when you 57 * Apparently with secret goal to sell you new device, when you
57 * will add new protocol to your host. F.e. IPv6. 8) 58 * will add new protocol to your host. F.e. IPv6. 8)
58 * 59 *
59 * HW: the most generic way. Device supplied checksum of _all_ 60 * COMPLETE: the most generic way. Device supplied checksum of _all_
60 * the packet as seen by netif_rx in skb->csum. 61 * the packet as seen by netif_rx in skb->csum.
61 * NOTE: Even if device supports only some protocols, but 62 * NOTE: Even if device supports only some protocols, but
62 * is able to produce some skb->csum, it MUST use HW, 63 * is able to produce some skb->csum, it MUST use COMPLETE,
63 * not UNNECESSARY. 64 * not UNNECESSARY.
64 * 65 *
65 * B. Checksumming on output. 66 * B. Checksumming on output.
66 * 67 *
67 * NONE: skb is checksummed by protocol or csum is not required. 68 * NONE: skb is checksummed by protocol or csum is not required.
68 * 69 *
69 * HW: device is required to csum packet as seen by hard_start_xmit 70 * PARTIAL: device is required to csum packet as seen by hard_start_xmit
70 * from skb->h.raw to the end and to record the checksum 71 * from skb->h.raw to the end and to record the checksum
71 * at skb->h.raw+skb->csum. 72 * at skb->h.raw+skb->csum.
72 * 73 *
@@ -171,7 +172,15 @@ enum {
171 172
172enum { 173enum {
173 SKB_GSO_TCPV4 = 1 << 0, 174 SKB_GSO_TCPV4 = 1 << 0,
174 SKB_GSO_UDPV4 = 1 << 1, 175 SKB_GSO_UDP = 1 << 1,
176
177 /* This indicates the skb is from an untrusted source. */
178 SKB_GSO_DODGY = 1 << 2,
179
180 /* This indicates the tcp segment has CWR set. */
181 SKB_GSO_TCP_ECN = 1 << 3,
182
183 SKB_GSO_TCPV6 = 1 << 4,
175}; 184};
176 185
177/** 186/**
@@ -596,6 +605,14 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
596 return list_->qlen; 605 return list_->qlen;
597} 606}
598 607
608/*
609 * This function creates a split out lock class for each invocation;
610 * this is needed for now since a whole lot of users of the skb-queue
611 * infrastructure in drivers have different locking usage (in hardirq)
612 * than the networking core (in softirq only). In the long run either the
613 * network layer or drivers should need annotation to consolidate the
614 * main types of usage into 3 classes.
615 */
599static inline void skb_queue_head_init(struct sk_buff_head *list) 616static inline void skb_queue_head_init(struct sk_buff_head *list)
600{ 617{
601 spin_lock_init(&list->lock); 618 spin_lock_init(&list->lock);
@@ -1024,6 +1041,21 @@ static inline int pskb_trim(struct sk_buff *skb, unsigned int len)
1024} 1041}
1025 1042
1026/** 1043/**
1044 * pskb_trim_unique - remove end from a paged unique (not cloned) buffer
1045 * @skb: buffer to alter
1046 * @len: new length
1047 *
1048 * This is identical to pskb_trim except that the caller knows that
1049 * the skb is not cloned so we should never get an error due to out-
1050 * of-memory.
1051 */
1052static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len)
1053{
1054 int err = pskb_trim(skb, len);
1055 BUG_ON(err);
1056}
1057
1058/**
1027 * skb_orphan - orphan a buffer 1059 * skb_orphan - orphan a buffer
1028 * @skb: buffer to orphan 1060 * @skb: buffer to orphan
1029 * 1061 *
@@ -1055,9 +1087,8 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1055 kfree_skb(skb); 1087 kfree_skb(skb);
1056} 1088}
1057 1089
1058#ifndef CONFIG_HAVE_ARCH_DEV_ALLOC_SKB
1059/** 1090/**
1060 * __dev_alloc_skb - allocate an skbuff for sending 1091 * __dev_alloc_skb - allocate an skbuff for receiving
1061 * @length: length to allocate 1092 * @length: length to allocate
1062 * @gfp_mask: get_free_pages mask, passed to alloc_skb 1093 * @gfp_mask: get_free_pages mask, passed to alloc_skb
1063 * 1094 *
@@ -1066,7 +1097,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1066 * the headroom they think they need without accounting for the 1097 * the headroom they think they need without accounting for the
1067 * built in space. The built in space is used for optimisations. 1098 * built in space. The built in space is used for optimisations.
1068 * 1099 *
1069 * %NULL is returned in there is no free memory. 1100 * %NULL is returned if there is no free memory.
1070 */ 1101 */
1071static inline struct sk_buff *__dev_alloc_skb(unsigned int length, 1102static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1072 gfp_t gfp_mask) 1103 gfp_t gfp_mask)
@@ -1076,12 +1107,9 @@ static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1076 skb_reserve(skb, NET_SKB_PAD); 1107 skb_reserve(skb, NET_SKB_PAD);
1077 return skb; 1108 return skb;
1078} 1109}
1079#else
1080extern struct sk_buff *__dev_alloc_skb(unsigned int length, int gfp_mask);
1081#endif
1082 1110
1083/** 1111/**
1084 * dev_alloc_skb - allocate an skbuff for sending 1112 * dev_alloc_skb - allocate an skbuff for receiving
1085 * @length: length to allocate 1113 * @length: length to allocate
1086 * 1114 *
1087 * Allocate a new &sk_buff and assign it a usage count of one. The 1115 * Allocate a new &sk_buff and assign it a usage count of one. The
@@ -1089,7 +1117,7 @@ extern struct sk_buff *__dev_alloc_skb(unsigned int length, int gfp_mask);
1089 * the headroom they think they need without accounting for the 1117 * the headroom they think they need without accounting for the
1090 * built in space. The built in space is used for optimisations. 1118 * built in space. The built in space is used for optimisations.
1091 * 1119 *
1092 * %NULL is returned in there is no free memory. Although this function 1120 * %NULL is returned if there is no free memory. Although this function
1093 * allocates memory it can be called from an interrupt. 1121 * allocates memory it can be called from an interrupt.
1094 */ 1122 */
1095static inline struct sk_buff *dev_alloc_skb(unsigned int length) 1123static inline struct sk_buff *dev_alloc_skb(unsigned int length)
@@ -1097,6 +1125,28 @@ static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1097 return __dev_alloc_skb(length, GFP_ATOMIC); 1125 return __dev_alloc_skb(length, GFP_ATOMIC);
1098} 1126}
1099 1127
1128extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1129 unsigned int length, gfp_t gfp_mask);
1130
1131/**
1132 * netdev_alloc_skb - allocate an skbuff for rx on a specific device
1133 * @dev: network device to receive on
1134 * @length: length to allocate
1135 *
1136 * Allocate a new &sk_buff and assign it a usage count of one. The
1137 * buffer has unspecified headroom built in. Users should allocate
1138 * the headroom they think they need without accounting for the
1139 * built in space. The built in space is used for optimisations.
1140 *
1141 * %NULL is returned if there is no free memory. Although this function
1142 * allocates memory it can be called from an interrupt.
1143 */
1144static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1145 unsigned int length)
1146{
1147 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1148}
1149
1100/** 1150/**
1101 * skb_cow - copy header of skb when it is required 1151 * skb_cow - copy header of skb when it is required
1102 * @skb: buffer to cow 1152 * @skb: buffer to cow
@@ -1212,14 +1262,14 @@ static inline int skb_linearize_cow(struct sk_buff *skb)
1212 * @len: length of data pulled 1262 * @len: length of data pulled
1213 * 1263 *
1214 * After doing a pull on a received packet, you need to call this to 1264 * After doing a pull on a received packet, you need to call this to
1215 * update the CHECKSUM_HW checksum, or set ip_summed to CHECKSUM_NONE 1265 * update the CHECKSUM_COMPLETE checksum, or set ip_summed to
1216 * so that it can be recomputed from scratch. 1266 * CHECKSUM_NONE so that it can be recomputed from scratch.
1217 */ 1267 */
1218 1268
1219static inline void skb_postpull_rcsum(struct sk_buff *skb, 1269static inline void skb_postpull_rcsum(struct sk_buff *skb,
1220 const void *start, unsigned int len) 1270 const void *start, unsigned int len)
1221{ 1271{
1222 if (skb->ip_summed == CHECKSUM_HW) 1272 if (skb->ip_summed == CHECKSUM_COMPLETE)
1223 skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); 1273 skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0));
1224} 1274}
1225 1275
@@ -1238,7 +1288,7 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1238{ 1288{
1239 if (likely(len >= skb->len)) 1289 if (likely(len >= skb->len))
1240 return 0; 1290 return 0;
1241 if (skb->ip_summed == CHECKSUM_HW) 1291 if (skb->ip_summed == CHECKSUM_COMPLETE)
1242 skb->ip_summed = CHECKSUM_NONE; 1292 skb->ip_summed = CHECKSUM_NONE;
1243 return __pskb_trim(skb, len); 1293 return __pskb_trim(skb, len);
1244} 1294}
@@ -1298,8 +1348,7 @@ extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1298extern void skb_split(struct sk_buff *skb, 1348extern void skb_split(struct sk_buff *skb,
1299 struct sk_buff *skb1, const u32 len); 1349 struct sk_buff *skb1, const u32 len);
1300 1350
1301extern void skb_release_data(struct sk_buff *skb); 1351extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
1302extern struct sk_buff *skb_segment(struct sk_buff *skb, int sg);
1303 1352
1304static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1353static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1305 int len, void *buffer) 1354 int len, void *buffer)
@@ -1445,5 +1494,10 @@ static inline void skb_init_secmark(struct sk_buff *skb)
1445{ } 1494{ }
1446#endif 1495#endif
1447 1496
1497static inline int skb_is_gso(const struct sk_buff *skb)
1498{
1499 return skb_shinfo(skb)->gso_size;
1500}
1501
1448#endif /* __KERNEL__ */ 1502#endif /* __KERNEL__ */
1449#endif /* _LINUX_SKBUFF_H */ 1503#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 45ad55b70d1c..a96fd9310d55 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -60,14 +60,13 @@ extern void __init kmem_cache_init(void);
60extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long, 60extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long,
61 void (*)(void *, kmem_cache_t *, unsigned long), 61 void (*)(void *, kmem_cache_t *, unsigned long),
62 void (*)(void *, kmem_cache_t *, unsigned long)); 62 void (*)(void *, kmem_cache_t *, unsigned long));
63extern int kmem_cache_destroy(kmem_cache_t *); 63extern void kmem_cache_destroy(kmem_cache_t *);
64extern int kmem_cache_shrink(kmem_cache_t *); 64extern int kmem_cache_shrink(kmem_cache_t *);
65extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); 65extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t);
66extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); 66extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
67extern void kmem_cache_free(kmem_cache_t *, void *); 67extern void kmem_cache_free(kmem_cache_t *, void *);
68extern unsigned int kmem_cache_size(kmem_cache_t *); 68extern unsigned int kmem_cache_size(kmem_cache_t *);
69extern const char *kmem_cache_name(kmem_cache_t *); 69extern const char *kmem_cache_name(kmem_cache_t *);
70extern kmem_cache_t *kmem_find_general_cachep(size_t size, gfp_t gfpflags);
71 70
72/* Size description struct for general caches. */ 71/* Size description struct for general caches. */
73struct cache_sizes { 72struct cache_sizes {
@@ -203,7 +202,30 @@ extern int slab_is_available(void);
203 202
204#ifdef CONFIG_NUMA 203#ifdef CONFIG_NUMA
205extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); 204extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
206extern void *kmalloc_node(size_t size, gfp_t flags, int node); 205extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
206
207static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
208{
209 if (__builtin_constant_p(size)) {
210 int i = 0;
211#define CACHE(x) \
212 if (size <= x) \
213 goto found; \
214 else \
215 i++;
216#include "kmalloc_sizes.h"
217#undef CACHE
218 {
219 extern void __you_cannot_kmalloc_that_much(void);
220 __you_cannot_kmalloc_that_much();
221 }
222found:
223 return kmem_cache_alloc_node((flags & GFP_DMA) ?
224 malloc_sizes[i].cs_dmacachep :
225 malloc_sizes[i].cs_cachep, flags, node);
226 }
227 return __kmalloc_node(size, flags, node);
228}
207#else 229#else
208static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node) 230static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node)
209{ 231{
@@ -223,12 +245,11 @@ extern int FASTCALL(kmem_ptr_validate(kmem_cache_t *cachep, void *ptr));
223/* SLOB allocator routines */ 245/* SLOB allocator routines */
224 246
225void kmem_cache_init(void); 247void kmem_cache_init(void);
226struct kmem_cache *kmem_find_general_cachep(size_t, gfp_t gfpflags);
227struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t, 248struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t,
228 unsigned long, 249 unsigned long,
229 void (*)(void *, struct kmem_cache *, unsigned long), 250 void (*)(void *, struct kmem_cache *, unsigned long),
230 void (*)(void *, struct kmem_cache *, unsigned long)); 251 void (*)(void *, struct kmem_cache *, unsigned long));
231int kmem_cache_destroy(struct kmem_cache *c); 252void kmem_cache_destroy(struct kmem_cache *c);
232void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); 253void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags);
233void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); 254void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
234void kmem_cache_free(struct kmem_cache *c, void *b); 255void kmem_cache_free(struct kmem_cache *c, void *b);
@@ -263,8 +284,6 @@ extern kmem_cache_t *fs_cachep;
263extern kmem_cache_t *sighand_cachep; 284extern kmem_cache_t *sighand_cachep;
264extern kmem_cache_t *bio_cachep; 285extern kmem_cache_t *bio_cachep;
265 286
266extern atomic_t slab_reclaim_pages;
267
268#endif /* __KERNEL__ */ 287#endif /* __KERNEL__ */
269 288
270#endif /* _LINUX_SLAB_H */ 289#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/smb.h b/include/linux/smb.h
index b0162208c963..f098dff93f6b 100644
--- a/include/linux/smb.h
+++ b/include/linux/smb.h
@@ -10,6 +10,7 @@
10#define _LINUX_SMB_H 10#define _LINUX_SMB_H
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/magic.h>
13 14
14enum smb_protocol { 15enum smb_protocol {
15 SMB_PROTOCOL_NONE, 16 SMB_PROTOCOL_NONE,
@@ -88,7 +89,6 @@ struct smb_fattr {
88 struct timespec f_atime; 89 struct timespec f_atime;
89 struct timespec f_mtime; 90 struct timespec f_mtime;
90 struct timespec f_ctime; 91 struct timespec f_ctime;
91 unsigned long f_blksize;
92 unsigned long f_blocks; 92 unsigned long f_blocks;
93 int f_unix; 93 int f_unix;
94}; 94};
@@ -101,8 +101,6 @@ enum smb_conn_state {
101 CONN_RETRYING /* Currently trying to reconnect */ 101 CONN_RETRYING /* Currently trying to reconnect */
102}; 102};
103 103
104#define SMB_SUPER_MAGIC 0x517B
105
106#define SMB_HEADER_LEN 37 /* includes everything up to, but not 104#define SMB_HEADER_LEN 37 /* includes everything up to, but not
107 * including smb_bcc */ 105 * including smb_bcc */
108 106
diff --git a/include/linux/smp.h b/include/linux/smp.h
index c93c3fe4308c..51649987f691 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -53,6 +53,9 @@ extern void smp_cpus_done(unsigned int max_cpus);
53 */ 53 */
54int smp_call_function(void(*func)(void *info), void *info, int retry, int wait); 54int smp_call_function(void(*func)(void *info), void *info, int retry, int wait);
55 55
56int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
57 int retry, int wait);
58
56/* 59/*
57 * Call a function on all processors 60 * Call a function on all processors
58 */ 61 */
@@ -125,4 +128,6 @@ static inline void smp_send_reschedule(int cpu) { }
125#define put_cpu() preempt_enable() 128#define put_cpu() preempt_enable()
126#define put_cpu_no_resched() preempt_enable_no_resched() 129#define put_cpu_no_resched() preempt_enable_no_resched()
127 130
131void smp_setup_processor_id(void);
132
128#endif /* __LINUX_SMP_H */ 133#endif /* __LINUX_SMP_H */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 4db25d5c7cd1..854aa6b543f1 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -155,42 +155,11 @@ enum
155 UDP_MIB_NOPORTS, /* NoPorts */ 155 UDP_MIB_NOPORTS, /* NoPorts */
156 UDP_MIB_INERRORS, /* InErrors */ 156 UDP_MIB_INERRORS, /* InErrors */
157 UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */ 157 UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */
158 UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */
159 UDP_MIB_SNDBUFERRORS, /* SndbufErrors */
158 __UDP_MIB_MAX 160 __UDP_MIB_MAX
159}; 161};
160 162
161/* sctp mib definitions */
162/*
163 * draft-ietf-sigtran-sctp-mib-07.txt
164 */
165enum
166{
167 SCTP_MIB_NUM = 0,
168 SCTP_MIB_CURRESTAB, /* CurrEstab */
169 SCTP_MIB_ACTIVEESTABS, /* ActiveEstabs */
170 SCTP_MIB_PASSIVEESTABS, /* PassiveEstabs */
171 SCTP_MIB_ABORTEDS, /* Aborteds */
172 SCTP_MIB_SHUTDOWNS, /* Shutdowns */
173 SCTP_MIB_OUTOFBLUES, /* OutOfBlues */
174 SCTP_MIB_CHECKSUMERRORS, /* ChecksumErrors */
175 SCTP_MIB_OUTCTRLCHUNKS, /* OutCtrlChunks */
176 SCTP_MIB_OUTORDERCHUNKS, /* OutOrderChunks */
177 SCTP_MIB_OUTUNORDERCHUNKS, /* OutUnorderChunks */
178 SCTP_MIB_INCTRLCHUNKS, /* InCtrlChunks */
179 SCTP_MIB_INORDERCHUNKS, /* InOrderChunks */
180 SCTP_MIB_INUNORDERCHUNKS, /* InUnorderChunks */
181 SCTP_MIB_FRAGUSRMSGS, /* FragUsrMsgs */
182 SCTP_MIB_REASMUSRMSGS, /* ReasmUsrMsgs */
183 SCTP_MIB_OUTSCTPPACKS, /* OutSCTPPacks */
184 SCTP_MIB_INSCTPPACKS, /* InSCTPPacks */
185 SCTP_MIB_RTOALGORITHM, /* RtoAlgorithm */
186 SCTP_MIB_RTOMIN, /* RtoMin */
187 SCTP_MIB_RTOMAX, /* RtoMax */
188 SCTP_MIB_RTOINITIAL, /* RtoInitial */
189 SCTP_MIB_VALCOOKIELIFE, /* ValCookieLife */
190 SCTP_MIB_MAXINITRETR, /* MaxInitRetr */
191 __SCTP_MIB_MAX
192};
193
194/* linux mib definitions */ 163/* linux mib definitions */
195enum 164enum
196{ 165{
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index e928c0dcc297..c8bb68099eb9 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -642,10 +642,14 @@ struct spi_board_info {
642 u16 bus_num; 642 u16 bus_num;
643 u16 chip_select; 643 u16 chip_select;
644 644
645 /* mode becomes spi_device.mode, and is essential for chips
646 * where the default of SPI_CS_HIGH = 0 is wrong.
647 */
648 u8 mode;
649
645 /* ... may need additional spi_device chip config data here. 650 /* ... may need additional spi_device chip config data here.
646 * avoid stuff protocol drivers can set; but include stuff 651 * avoid stuff protocol drivers can set; but include stuff
647 * needed to behave without being bound to a driver: 652 * needed to behave without being bound to a driver:
648 * - chipselect polarity
649 * - quirks like clock rate mattering when not selected 653 * - quirks like clock rate mattering when not selected
650 */ 654 */
651}; 655};
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index ae23beef9cc9..b800d2d68b32 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -82,14 +82,40 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
82/* 82/*
83 * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them): 83 * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them):
84 */ 84 */
85#if defined(CONFIG_SMP) 85#ifdef CONFIG_SMP
86# include <asm/spinlock.h> 86# include <asm/spinlock.h>
87#else 87#else
88# include <linux/spinlock_up.h> 88# include <linux/spinlock_up.h>
89#endif 89#endif
90 90
91#define spin_lock_init(lock) do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0) 91#ifdef CONFIG_DEBUG_SPINLOCK
92#define rwlock_init(lock) do { *(lock) = RW_LOCK_UNLOCKED; } while (0) 92 extern void __spin_lock_init(spinlock_t *lock, const char *name,
93 struct lock_class_key *key);
94# define spin_lock_init(lock) \
95do { \
96 static struct lock_class_key __key; \
97 \
98 __spin_lock_init((lock), #lock, &__key); \
99} while (0)
100
101#else
102# define spin_lock_init(lock) \
103 do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0)
104#endif
105
106#ifdef CONFIG_DEBUG_SPINLOCK
107 extern void __rwlock_init(rwlock_t *lock, const char *name,
108 struct lock_class_key *key);
109# define rwlock_init(lock) \
110do { \
111 static struct lock_class_key __key; \
112 \
113 __rwlock_init((lock), #lock, &__key); \
114} while (0)
115#else
116# define rwlock_init(lock) \
117 do { *(lock) = RW_LOCK_UNLOCKED; } while (0)
118#endif
93 119
94#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock) 120#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock)
95 121
@@ -113,7 +139,6 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
113#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 139#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
114 extern int _raw_spin_trylock(spinlock_t *lock); 140 extern int _raw_spin_trylock(spinlock_t *lock);
115 extern void _raw_spin_unlock(spinlock_t *lock); 141 extern void _raw_spin_unlock(spinlock_t *lock);
116
117 extern void _raw_read_lock(rwlock_t *lock); 142 extern void _raw_read_lock(rwlock_t *lock);
118 extern int _raw_read_trylock(rwlock_t *lock); 143 extern int _raw_read_trylock(rwlock_t *lock);
119 extern void _raw_read_unlock(rwlock_t *lock); 144 extern void _raw_read_unlock(rwlock_t *lock);
@@ -121,17 +146,17 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
121 extern int _raw_write_trylock(rwlock_t *lock); 146 extern int _raw_write_trylock(rwlock_t *lock);
122 extern void _raw_write_unlock(rwlock_t *lock); 147 extern void _raw_write_unlock(rwlock_t *lock);
123#else 148#else
124# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
125# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock)
126# define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock) 149# define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock)
127# define _raw_spin_lock_flags(lock, flags) \ 150# define _raw_spin_lock_flags(lock, flags) \
128 __raw_spin_lock_flags(&(lock)->raw_lock, *(flags)) 151 __raw_spin_lock_flags(&(lock)->raw_lock, *(flags))
152# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock)
153# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
129# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) 154# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock)
130# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock)
131# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock)
132# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock)
133# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) 155# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock)
156# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock)
157# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock)
134# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) 158# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock)
159# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock)
135#endif 160#endif
136 161
137#define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock) 162#define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock)
@@ -142,11 +167,18 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
142 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various 167 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various
143 * methods are defined as nops in the case they are not required. 168 * methods are defined as nops in the case they are not required.
144 */ 169 */
145#define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) 170#define spin_trylock(lock) __cond_lock(lock, _spin_trylock(lock))
146#define read_trylock(lock) __cond_lock(_read_trylock(lock)) 171#define read_trylock(lock) __cond_lock(lock, _read_trylock(lock))
147#define write_trylock(lock) __cond_lock(_write_trylock(lock)) 172#define write_trylock(lock) __cond_lock(lock, _write_trylock(lock))
148 173
149#define spin_lock(lock) _spin_lock(lock) 174#define spin_lock(lock) _spin_lock(lock)
175
176#ifdef CONFIG_DEBUG_LOCK_ALLOC
177# define spin_lock_nested(lock, subclass) _spin_lock_nested(lock, subclass)
178#else
179# define spin_lock_nested(lock, subclass) _spin_lock(lock)
180#endif
181
150#define write_lock(lock) _write_lock(lock) 182#define write_lock(lock) _write_lock(lock)
151#define read_lock(lock) _read_lock(lock) 183#define read_lock(lock) _read_lock(lock)
152 184
@@ -172,21 +204,18 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
172/* 204/*
173 * We inline the unlock functions in the nondebug case: 205 * We inline the unlock functions in the nondebug case:
174 */ 206 */
175#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || !defined(CONFIG_SMP) 207#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || \
208 !defined(CONFIG_SMP)
176# define spin_unlock(lock) _spin_unlock(lock) 209# define spin_unlock(lock) _spin_unlock(lock)
177# define read_unlock(lock) _read_unlock(lock) 210# define read_unlock(lock) _read_unlock(lock)
178# define write_unlock(lock) _write_unlock(lock) 211# define write_unlock(lock) _write_unlock(lock)
179#else
180# define spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
181# define read_unlock(lock) __raw_read_unlock(&(lock)->raw_lock)
182# define write_unlock(lock) __raw_write_unlock(&(lock)->raw_lock)
183#endif
184
185#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || !defined(CONFIG_SMP)
186# define spin_unlock_irq(lock) _spin_unlock_irq(lock) 212# define spin_unlock_irq(lock) _spin_unlock_irq(lock)
187# define read_unlock_irq(lock) _read_unlock_irq(lock) 213# define read_unlock_irq(lock) _read_unlock_irq(lock)
188# define write_unlock_irq(lock) _write_unlock_irq(lock) 214# define write_unlock_irq(lock) _write_unlock_irq(lock)
189#else 215#else
216# define spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
217# define read_unlock(lock) __raw_read_unlock(&(lock)->raw_lock)
218# define write_unlock(lock) __raw_write_unlock(&(lock)->raw_lock)
190# define spin_unlock_irq(lock) \ 219# define spin_unlock_irq(lock) \
191 do { __raw_spin_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0) 220 do { __raw_spin_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0)
192# define read_unlock_irq(lock) \ 221# define read_unlock_irq(lock) \
@@ -207,19 +236,19 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
207 _write_unlock_irqrestore(lock, flags) 236 _write_unlock_irqrestore(lock, flags)
208#define write_unlock_bh(lock) _write_unlock_bh(lock) 237#define write_unlock_bh(lock) _write_unlock_bh(lock)
209 238
210#define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) 239#define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock))
211 240
212#define spin_trylock_irq(lock) \ 241#define spin_trylock_irq(lock) \
213({ \ 242({ \
214 local_irq_disable(); \ 243 local_irq_disable(); \
215 _spin_trylock(lock) ? \ 244 spin_trylock(lock) ? \
216 1 : ({ local_irq_enable(); 0; }); \ 245 1 : ({ local_irq_enable(); 0; }); \
217}) 246})
218 247
219#define spin_trylock_irqsave(lock, flags) \ 248#define spin_trylock_irqsave(lock, flags) \
220({ \ 249({ \
221 local_irq_save(flags); \ 250 local_irq_save(flags); \
222 _spin_trylock(lock) ? \ 251 spin_trylock(lock) ? \
223 1 : ({ local_irq_restore(flags); 0; }); \ 252 1 : ({ local_irq_restore(flags); 0; }); \
224}) 253})
225 254
@@ -235,7 +264,7 @@ extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
235 */ 264 */
236extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); 265extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
237#define atomic_dec_and_lock(atomic, lock) \ 266#define atomic_dec_and_lock(atomic, lock) \
238 __cond_lock(_atomic_dec_and_lock(atomic, lock)) 267 __cond_lock(lock, _atomic_dec_and_lock(atomic, lock))
239 268
240/** 269/**
241 * spin_can_lock - would spin_trylock() succeed? 270 * spin_can_lock - would spin_trylock() succeed?
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 78e6989ffb54..8828b8155e9c 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -19,39 +19,41 @@ int in_lock_functions(unsigned long addr);
19 19
20#define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) 20#define assert_spin_locked(x) BUG_ON(!spin_is_locked(x))
21 21
22void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t); 22void __lockfunc _spin_lock(spinlock_t *lock) __acquires(lock);
23void __lockfunc _read_lock(rwlock_t *lock) __acquires(rwlock_t); 23void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass)
24void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t); 24 __acquires(lock);
25void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t); 25void __lockfunc _read_lock(rwlock_t *lock) __acquires(lock);
26void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t); 26void __lockfunc _write_lock(rwlock_t *lock) __acquires(lock);
27void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t); 27void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(lock);
28void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t); 28void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(lock);
29void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t); 29void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(lock);
30void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t); 30void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(lock);
31void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(lock);
32void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock);
31unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) 33unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
32 __acquires(spinlock_t); 34 __acquires(lock);
33unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) 35unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
34 __acquires(rwlock_t); 36 __acquires(lock);
35unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) 37unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
36 __acquires(rwlock_t); 38 __acquires(lock);
37int __lockfunc _spin_trylock(spinlock_t *lock); 39int __lockfunc _spin_trylock(spinlock_t *lock);
38int __lockfunc _read_trylock(rwlock_t *lock); 40int __lockfunc _read_trylock(rwlock_t *lock);
39int __lockfunc _write_trylock(rwlock_t *lock); 41int __lockfunc _write_trylock(rwlock_t *lock);
40int __lockfunc _spin_trylock_bh(spinlock_t *lock); 42int __lockfunc _spin_trylock_bh(spinlock_t *lock);
41void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t); 43void __lockfunc _spin_unlock(spinlock_t *lock) __releases(lock);
42void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t); 44void __lockfunc _read_unlock(rwlock_t *lock) __releases(lock);
43void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t); 45void __lockfunc _write_unlock(rwlock_t *lock) __releases(lock);
44void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t); 46void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(lock);
45void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t); 47void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(lock);
46void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t); 48void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(lock);
47void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t); 49void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(lock);
48void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t); 50void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(lock);
49void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t); 51void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(lock);
50void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) 52void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
51 __releases(spinlock_t); 53 __releases(lock);
52void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 54void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
53 __releases(rwlock_t); 55 __releases(lock);
54void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 56void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
55 __releases(rwlock_t); 57 __releases(lock);
56 58
57#endif /* __LINUX_SPINLOCK_API_SMP_H */ 59#endif /* __LINUX_SPINLOCK_API_SMP_H */
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h
index cd81cee566f4..67faa044c5f5 100644
--- a/include/linux/spinlock_api_up.h
+++ b/include/linux/spinlock_api_up.h
@@ -49,6 +49,7 @@
49 do { local_irq_restore(flags); __UNLOCK(lock); } while (0) 49 do { local_irq_restore(flags); __UNLOCK(lock); } while (0)
50 50
51#define _spin_lock(lock) __LOCK(lock) 51#define _spin_lock(lock) __LOCK(lock)
52#define _spin_lock_nested(lock, subclass) __LOCK(lock)
52#define _read_lock(lock) __LOCK(lock) 53#define _read_lock(lock) __LOCK(lock)
53#define _write_lock(lock) __LOCK(lock) 54#define _write_lock(lock) __LOCK(lock)
54#define _spin_lock_bh(lock) __LOCK_BH(lock) 55#define _spin_lock_bh(lock) __LOCK_BH(lock)
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index 9cb51e070390..dc5fb69e4de9 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -9,6 +9,8 @@
9 * Released under the General Public License (GPL). 9 * Released under the General Public License (GPL).
10 */ 10 */
11 11
12#include <linux/lockdep.h>
13
12#if defined(CONFIG_SMP) 14#if defined(CONFIG_SMP)
13# include <asm/spinlock_types.h> 15# include <asm/spinlock_types.h>
14#else 16#else
@@ -24,6 +26,9 @@ typedef struct {
24 unsigned int magic, owner_cpu; 26 unsigned int magic, owner_cpu;
25 void *owner; 27 void *owner;
26#endif 28#endif
29#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 struct lockdep_map dep_map;
31#endif
27} spinlock_t; 32} spinlock_t;
28 33
29#define SPINLOCK_MAGIC 0xdead4ead 34#define SPINLOCK_MAGIC 0xdead4ead
@@ -37,31 +42,53 @@ typedef struct {
37 unsigned int magic, owner_cpu; 42 unsigned int magic, owner_cpu;
38 void *owner; 43 void *owner;
39#endif 44#endif
45#ifdef CONFIG_DEBUG_LOCK_ALLOC
46 struct lockdep_map dep_map;
47#endif
40} rwlock_t; 48} rwlock_t;
41 49
42#define RWLOCK_MAGIC 0xdeaf1eed 50#define RWLOCK_MAGIC 0xdeaf1eed
43 51
44#define SPINLOCK_OWNER_INIT ((void *)-1L) 52#define SPINLOCK_OWNER_INIT ((void *)-1L)
45 53
54#ifdef CONFIG_DEBUG_LOCK_ALLOC
55# define SPIN_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }
56#else
57# define SPIN_DEP_MAP_INIT(lockname)
58#endif
59
60#ifdef CONFIG_DEBUG_LOCK_ALLOC
61# define RW_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }
62#else
63# define RW_DEP_MAP_INIT(lockname)
64#endif
65
46#ifdef CONFIG_DEBUG_SPINLOCK 66#ifdef CONFIG_DEBUG_SPINLOCK
47# define SPIN_LOCK_UNLOCKED \ 67# define __SPIN_LOCK_UNLOCKED(lockname) \
48 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ 68 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \
49 .magic = SPINLOCK_MAGIC, \ 69 .magic = SPINLOCK_MAGIC, \
50 .owner = SPINLOCK_OWNER_INIT, \ 70 .owner = SPINLOCK_OWNER_INIT, \
51 .owner_cpu = -1 } 71 .owner_cpu = -1, \
52#define RW_LOCK_UNLOCKED \ 72 SPIN_DEP_MAP_INIT(lockname) }
73#define __RW_LOCK_UNLOCKED(lockname) \
53 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ 74 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \
54 .magic = RWLOCK_MAGIC, \ 75 .magic = RWLOCK_MAGIC, \
55 .owner = SPINLOCK_OWNER_INIT, \ 76 .owner = SPINLOCK_OWNER_INIT, \
56 .owner_cpu = -1 } 77 .owner_cpu = -1, \
78 RW_DEP_MAP_INIT(lockname) }
57#else 79#else
58# define SPIN_LOCK_UNLOCKED \ 80# define __SPIN_LOCK_UNLOCKED(lockname) \
59 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED } 81 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \
60#define RW_LOCK_UNLOCKED \ 82 SPIN_DEP_MAP_INIT(lockname) }
61 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED } 83#define __RW_LOCK_UNLOCKED(lockname) \
84 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \
85 RW_DEP_MAP_INIT(lockname) }
62#endif 86#endif
63 87
64#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED 88#define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init)
65#define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED 89#define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init)
90
91#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
92#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x)
66 93
67#endif /* __LINUX_SPINLOCK_TYPES_H */ 94#endif /* __LINUX_SPINLOCK_TYPES_H */
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h
index 04135b0e198e..27644af20b7c 100644
--- a/include/linux/spinlock_types_up.h
+++ b/include/linux/spinlock_types_up.h
@@ -12,10 +12,14 @@
12 * Released under the General Public License (GPL). 12 * Released under the General Public License (GPL).
13 */ 13 */
14 14
15#ifdef CONFIG_DEBUG_SPINLOCK 15#if defined(CONFIG_DEBUG_SPINLOCK) || \
16 defined(CONFIG_DEBUG_LOCK_ALLOC)
16 17
17typedef struct { 18typedef struct {
18 volatile unsigned int slock; 19 volatile unsigned int slock;
20#ifdef CONFIG_DEBUG_LOCK_ALLOC
21 struct lockdep_map dep_map;
22#endif
19} raw_spinlock_t; 23} raw_spinlock_t;
20 24
21#define __RAW_SPIN_LOCK_UNLOCKED { 1 } 25#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
@@ -30,6 +34,9 @@ typedef struct { } raw_spinlock_t;
30 34
31typedef struct { 35typedef struct {
32 /* no debug version on UP */ 36 /* no debug version on UP */
37#ifdef CONFIG_DEBUG_LOCK_ALLOC
38 struct lockdep_map dep_map;
39#endif
33} raw_rwlock_t; 40} raw_rwlock_t;
34 41
35#define __RAW_RW_LOCK_UNLOCKED { } 42#define __RAW_RW_LOCK_UNLOCKED { }
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index 31accf2f0b13..ea54c4c9a4ec 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -18,7 +18,6 @@
18 */ 18 */
19 19
20#ifdef CONFIG_DEBUG_SPINLOCK 20#ifdef CONFIG_DEBUG_SPINLOCK
21
22#define __raw_spin_is_locked(x) ((x)->slock == 0) 21#define __raw_spin_is_locked(x) ((x)->slock == 0)
23 22
24static inline void __raw_spin_lock(raw_spinlock_t *lock) 23static inline void __raw_spin_lock(raw_spinlock_t *lock)
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
new file mode 100644
index 000000000000..50e2b01e517c
--- /dev/null
+++ b/include/linux/stacktrace.h
@@ -0,0 +1,21 @@
1#ifndef __LINUX_STACKTRACE_H
2#define __LINUX_STACKTRACE_H
3
4#ifdef CONFIG_STACKTRACE
5struct stack_trace {
6 unsigned int nr_entries, max_entries;
7 unsigned long *entries;
8 int skip; /* input argument: How many entries to skip */
9 int all_contexts; /* input argument: if true do than one stack */
10};
11
12extern void save_stack_trace(struct stack_trace *trace,
13 struct task_struct *task);
14
15extern void print_stack_trace(struct stack_trace *trace, int spaces);
16#else
17# define save_stack_trace(trace, task) do { } while (0)
18# define print_stack_trace(trace) do { } while (0)
19#endif
20
21#endif
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index b3a2cadf90f2..ea65dfb60cd8 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -10,11 +10,13 @@
10#define NULL ((void *)0) 10#define NULL ((void *)0)
11#endif 11#endif
12 12
13#ifdef __KERNEL__
13#undef offsetof 14#undef offsetof
14#ifdef __compiler_offsetof 15#ifdef __compiler_offsetof
15#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER) 16#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
16#else 17#else
17#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 18#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
18#endif 19#endif
20#endif /* __KERNEL__ */
19 21
20#endif 22#endif
diff --git a/include/linux/sunrpc/Kbuild b/include/linux/sunrpc/Kbuild
new file mode 100644
index 000000000000..fb438f158eee
--- /dev/null
+++ b/include/linux/sunrpc/Kbuild
@@ -0,0 +1 @@
unifdef-y += debug.h
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index a6de332e57d4..862c0d8c8381 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -109,13 +109,13 @@ struct rpc_credops {
109 void (*crdestroy)(struct rpc_cred *); 109 void (*crdestroy)(struct rpc_cred *);
110 110
111 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); 111 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
112 u32 * (*crmarshal)(struct rpc_task *, u32 *); 112 __be32 * (*crmarshal)(struct rpc_task *, __be32 *);
113 int (*crrefresh)(struct rpc_task *); 113 int (*crrefresh)(struct rpc_task *);
114 u32 * (*crvalidate)(struct rpc_task *, u32 *); 114 __be32 * (*crvalidate)(struct rpc_task *, __be32 *);
115 int (*crwrap_req)(struct rpc_task *, kxdrproc_t, 115 int (*crwrap_req)(struct rpc_task *, kxdrproc_t,
116 void *, u32 *, void *); 116 void *, __be32 *, void *);
117 int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t, 117 int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t,
118 void *, u32 *, void *); 118 void *, __be32 *, void *);
119}; 119};
120 120
121extern struct rpc_authops authunix_ops; 121extern struct rpc_authops authunix_ops;
@@ -134,10 +134,10 @@ struct rpc_cred * rpcauth_bindcred(struct rpc_task *);
134void rpcauth_holdcred(struct rpc_task *); 134void rpcauth_holdcred(struct rpc_task *);
135void put_rpccred(struct rpc_cred *); 135void put_rpccred(struct rpc_cred *);
136void rpcauth_unbindcred(struct rpc_task *); 136void rpcauth_unbindcred(struct rpc_task *);
137u32 * rpcauth_marshcred(struct rpc_task *, u32 *); 137__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
138u32 * rpcauth_checkverf(struct rpc_task *, u32 *); 138__be32 * rpcauth_checkverf(struct rpc_task *, __be32 *);
139int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, u32 *data, void *obj); 139int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, __be32 *data, void *obj);
140int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, u32 *data, void *obj); 140int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, __be32 *data, void *obj);
141int rpcauth_refreshcred(struct rpc_task *); 141int rpcauth_refreshcred(struct rpc_task *);
142void rpcauth_invalcred(struct rpc_task *); 142void rpcauth_invalcred(struct rpc_task *);
143int rpcauth_uptodatecred(struct rpc_task *); 143int rpcauth_uptodatecred(struct rpc_task *);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 8fe9f35eba31..f6d1d646ce05 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -18,18 +18,6 @@
18#include <linux/sunrpc/timer.h> 18#include <linux/sunrpc/timer.h>
19#include <asm/signal.h> 19#include <asm/signal.h>
20 20
21/*
22 * This defines an RPC port mapping
23 */
24struct rpc_portmap {
25 __u32 pm_prog;
26 __u32 pm_vers;
27 __u32 pm_prot;
28 __u16 pm_port;
29 unsigned char pm_binding : 1; /* doing a getport() */
30 struct rpc_wait_queue pm_bindwait; /* waiting on getport() */
31};
32
33struct rpc_inode; 21struct rpc_inode;
34 22
35/* 23/*
@@ -40,7 +28,9 @@ struct rpc_clnt {
40 atomic_t cl_users; /* number of references */ 28 atomic_t cl_users; /* number of references */
41 struct rpc_xprt * cl_xprt; /* transport */ 29 struct rpc_xprt * cl_xprt; /* transport */
42 struct rpc_procinfo * cl_procinfo; /* procedure info */ 30 struct rpc_procinfo * cl_procinfo; /* procedure info */
43 u32 cl_maxproc; /* max procedure number */ 31 u32 cl_prog, /* RPC program number */
32 cl_vers, /* RPC version number */
33 cl_maxproc; /* max procedure number */
44 34
45 char * cl_server; /* server machine name */ 35 char * cl_server; /* server machine name */
46 char * cl_protname; /* protocol name */ 36 char * cl_protname; /* protocol name */
@@ -55,7 +45,6 @@ struct rpc_clnt {
55 cl_dead : 1;/* abandoned */ 45 cl_dead : 1;/* abandoned */
56 46
57 struct rpc_rtt * cl_rtt; /* RTO estimator data */ 47 struct rpc_rtt * cl_rtt; /* RTO estimator data */
58 struct rpc_portmap * cl_pmap; /* port mapping */
59 48
60 int cl_nodelen; /* nodename length */ 49 int cl_nodelen; /* nodename length */
61 char cl_nodename[UNX_MAXNODENAME]; 50 char cl_nodename[UNX_MAXNODENAME];
@@ -64,14 +53,8 @@ struct rpc_clnt {
64 struct dentry * cl_dentry; /* inode */ 53 struct dentry * cl_dentry; /* inode */
65 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 54 struct rpc_clnt * cl_parent; /* Points to parent of clones */
66 struct rpc_rtt cl_rtt_default; 55 struct rpc_rtt cl_rtt_default;
67 struct rpc_portmap cl_pmap_default;
68 char cl_inline_name[32]; 56 char cl_inline_name[32];
69}; 57};
70#define cl_timeout cl_xprt->timeout
71#define cl_prog cl_pmap->pm_prog
72#define cl_vers cl_pmap->pm_vers
73#define cl_port cl_pmap->pm_port
74#define cl_prot cl_pmap->pm_prot
75 58
76/* 59/*
77 * General RPC program info 60 * General RPC program info
@@ -106,24 +89,36 @@ struct rpc_procinfo {
106 char * p_name; /* name of procedure */ 89 char * p_name; /* name of procedure */
107}; 90};
108 91
109#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt))
110#define RPC_PEERADDR(clnt) (&(clnt)->cl_xprt->addr)
111
112#ifdef __KERNEL__ 92#ifdef __KERNEL__
113 93
114struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname, 94struct rpc_create_args {
115 struct rpc_program *info, 95 int protocol;
116 u32 version, rpc_authflavor_t authflavor); 96 struct sockaddr *address;
117struct rpc_clnt *rpc_new_client(struct rpc_xprt *xprt, char *servname, 97 size_t addrsize;
118 struct rpc_program *info, 98 struct rpc_timeout *timeout;
119 u32 version, rpc_authflavor_t authflavor); 99 char *servername;
100 struct rpc_program *program;
101 u32 version;
102 rpc_authflavor_t authflavor;
103 unsigned long flags;
104};
105
106/* Values for "flags" field */
107#define RPC_CLNT_CREATE_HARDRTRY (1UL << 0)
108#define RPC_CLNT_CREATE_INTR (1UL << 1)
109#define RPC_CLNT_CREATE_AUTOBIND (1UL << 2)
110#define RPC_CLNT_CREATE_ONESHOT (1UL << 3)
111#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 4)
112#define RPC_CLNT_CREATE_NOPING (1UL << 5)
113
114struct rpc_clnt *rpc_create(struct rpc_create_args *args);
120struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 115struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
121 struct rpc_program *, int); 116 struct rpc_program *, int);
122struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 117struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
123int rpc_shutdown_client(struct rpc_clnt *); 118int rpc_shutdown_client(struct rpc_clnt *);
124int rpc_destroy_client(struct rpc_clnt *); 119int rpc_destroy_client(struct rpc_clnt *);
125void rpc_release_client(struct rpc_clnt *); 120void rpc_release_client(struct rpc_clnt *);
126void rpc_getport(struct rpc_task *, struct rpc_clnt *); 121void rpc_getport(struct rpc_task *);
127int rpc_register(u32, u32, int, unsigned short, int *); 122int rpc_register(u32, u32, int, unsigned short, int *);
128 123
129void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 124void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
@@ -140,6 +135,8 @@ void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
140size_t rpc_max_payload(struct rpc_clnt *); 135size_t rpc_max_payload(struct rpc_clnt *);
141void rpc_force_rebind(struct rpc_clnt *); 136void rpc_force_rebind(struct rpc_clnt *);
142int rpc_ping(struct rpc_clnt *clnt, int flags); 137int rpc_ping(struct rpc_clnt *clnt, int flags);
138size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
139char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
143 140
144/* 141/*
145 * Helper function for NFSroot support 142 * Helper function for NFSroot support
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 9b8bcf125c18..6e112cc5cdda 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -126,7 +126,7 @@ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
126/* Just increments the mechanism's reference count and returns its input: */ 126/* Just increments the mechanism's reference count and returns its input: */
127struct gss_api_mech * gss_mech_get(struct gss_api_mech *); 127struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
128 128
129/* For every succesful gss_mech_get or gss_mech_get_by_* call there must be a 129/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
130 * corresponding call to gss_mech_put. */ 130 * corresponding call to gss_mech_put. */
131void gss_mech_put(struct gss_api_mech *); 131void gss_mech_put(struct gss_api_mech *);
132 132
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index 1279280d7196..e30ba201910a 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -46,8 +46,8 @@ struct krb5_ctx {
46 unsigned char seed[16]; 46 unsigned char seed[16];
47 int signalg; 47 int signalg;
48 int sealalg; 48 int sealalg;
49 struct crypto_tfm *enc; 49 struct crypto_blkcipher *enc;
50 struct crypto_tfm *seq; 50 struct crypto_blkcipher *seq;
51 s32 endtime; 51 s32 endtime;
52 u32 seq_send; 52 u32 seq_send;
53 struct xdr_netobj mech_used; 53 struct xdr_netobj mech_used;
@@ -136,26 +136,27 @@ gss_unwrap_kerberos(struct gss_ctx *ctx_id, int offset,
136 136
137 137
138u32 138u32
139krb5_encrypt(struct crypto_tfm * key, 139krb5_encrypt(struct crypto_blkcipher *key,
140 void *iv, void *in, void *out, int length); 140 void *iv, void *in, void *out, int length);
141 141
142u32 142u32
143krb5_decrypt(struct crypto_tfm * key, 143krb5_decrypt(struct crypto_blkcipher *key,
144 void *iv, void *in, void *out, int length); 144 void *iv, void *in, void *out, int length);
145 145
146int 146int
147gss_encrypt_xdr_buf(struct crypto_tfm *tfm, struct xdr_buf *outbuf, int offset, 147gss_encrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *outbuf,
148 struct page **pages); 148 int offset, struct page **pages);
149 149
150int 150int
151gss_decrypt_xdr_buf(struct crypto_tfm *tfm, struct xdr_buf *inbuf, int offset); 151gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *inbuf,
152 int offset);
152 153
153s32 154s32
154krb5_make_seq_num(struct crypto_tfm * key, 155krb5_make_seq_num(struct crypto_blkcipher *key,
155 int direction, 156 int direction,
156 s32 seqnum, unsigned char *cksum, unsigned char *buf); 157 s32 seqnum, unsigned char *cksum, unsigned char *buf);
157 158
158s32 159s32
159krb5_get_seq_num(struct crypto_tfm * key, 160krb5_get_seq_num(struct crypto_blkcipher *key,
160 unsigned char *cksum, 161 unsigned char *cksum,
161 unsigned char *buf, int *direction, s32 * seqnum); 162 unsigned char *buf, int *direction, s32 * seqnum);
diff --git a/include/linux/sunrpc/gss_spkm3.h b/include/linux/sunrpc/gss_spkm3.h
index 336e218c2782..2cf3fbb40b4f 100644
--- a/include/linux/sunrpc/gss_spkm3.h
+++ b/include/linux/sunrpc/gss_spkm3.h
@@ -19,9 +19,9 @@ struct spkm3_ctx {
19 unsigned int req_flags ; 19 unsigned int req_flags ;
20 struct xdr_netobj share_key; 20 struct xdr_netobj share_key;
21 int conf_alg; 21 int conf_alg;
22 struct crypto_tfm* derived_conf_key; 22 struct crypto_blkcipher *derived_conf_key;
23 int intg_alg; 23 int intg_alg;
24 struct crypto_tfm* derived_integ_key; 24 struct crypto_blkcipher *derived_integ_key;
25 int keyestb_alg; /* alg used to get share_key */ 25 int keyestb_alg; /* alg used to get share_key */
26 int owf_alg; /* one way function */ 26 int owf_alg; /* one way function */
27}; 27};
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index f43f237360ae..d9f5934ac9fe 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -95,7 +95,7 @@ enum rpc_auth_stat {
95 * 2GB. 95 * 2GB.
96 */ 96 */
97 97
98typedef u32 rpc_fraghdr; 98typedef __be32 rpc_fraghdr;
99 99
100#define RPC_LAST_STREAM_FRAGMENT (1U << 31) 100#define RPC_LAST_STREAM_FRAGMENT (1U << 31)
101#define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT) 101#define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT)
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 2c2189cb30aa..a2eb9b4a9de3 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -42,9 +42,9 @@ RPC_I(struct inode *inode)
42extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); 42extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
43 43
44extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); 44extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *);
45extern int rpc_rmdir(char *); 45extern int rpc_rmdir(struct dentry *);
46extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags); 46extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, struct rpc_pipe_ops *, int flags);
47extern int rpc_unlink(char *); 47extern int rpc_unlink(struct dentry *);
48extern struct vfsmount *rpc_get_mount(void); 48extern struct vfsmount *rpc_get_mount(void);
49extern void rpc_put_mount(void); 49extern void rpc_put_mount(void);
50 50
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 82a91bb22362..f399c138f79d 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -127,7 +127,6 @@ struct rpc_call_ops {
127 */ 127 */
128#define RPC_TASK_ASYNC 0x0001 /* is an async task */ 128#define RPC_TASK_ASYNC 0x0001 /* is an async task */
129#define RPC_TASK_SWAPPER 0x0002 /* is swapping in/out */ 129#define RPC_TASK_SWAPPER 0x0002 /* is swapping in/out */
130#define RPC_TASK_CHILD 0x0008 /* is child of other task */
131#define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */ 130#define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */
132#define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */ 131#define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */
133#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ 132#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */
@@ -136,7 +135,6 @@ struct rpc_call_ops {
136#define RPC_TASK_NOINTR 0x0400 /* uninterruptible task */ 135#define RPC_TASK_NOINTR 0x0400 /* uninterruptible task */
137 136
138#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 137#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
139#define RPC_IS_CHILD(t) ((t)->tk_flags & RPC_TASK_CHILD)
140#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 138#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
141#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) 139#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS)
142#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) 140#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
@@ -253,7 +251,6 @@ struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags,
253 const struct rpc_call_ops *ops, void *data); 251 const struct rpc_call_ops *ops, void *data);
254struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags, 252struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
255 const struct rpc_call_ops *ops, void *data); 253 const struct rpc_call_ops *ops, void *data);
256struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent);
257void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, 254void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
258 int flags, const struct rpc_call_ops *ops, 255 int flags, const struct rpc_call_ops *ops,
259 void *data); 256 void *data);
@@ -261,8 +258,6 @@ void rpc_release_task(struct rpc_task *);
261void rpc_exit_task(struct rpc_task *); 258void rpc_exit_task(struct rpc_task *);
262void rpc_killall_tasks(struct rpc_clnt *); 259void rpc_killall_tasks(struct rpc_clnt *);
263int rpc_execute(struct rpc_task *); 260int rpc_execute(struct rpc_task *);
264void rpc_run_child(struct rpc_task *parent, struct rpc_task *child,
265 rpc_action action);
266void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); 261void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
267void rpc_init_wait_queue(struct rpc_wait_queue *, const char *); 262void rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
268void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, 263void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *,
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 503564384545..73140ee5c638 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -78,28 +78,45 @@ struct svc_serv {
78 */ 78 */
79#define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2) 79#define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2)
80 80
81static inline u32 svc_getu32(struct kvec *iov) 81static inline u32 svc_getnl(struct kvec *iov)
82{ 82{
83 u32 val, *vp; 83 __be32 val, *vp;
84 vp = iov->iov_base; 84 vp = iov->iov_base;
85 val = *vp++; 85 val = *vp++;
86 iov->iov_base = (void*)vp; 86 iov->iov_base = (void*)vp;
87 iov->iov_len -= sizeof(u32); 87 iov->iov_len -= sizeof(__be32);
88 return ntohl(val);
89}
90
91static inline void svc_putnl(struct kvec *iov, u32 val)
92{
93 __be32 *vp = iov->iov_base + iov->iov_len;
94 *vp = htonl(val);
95 iov->iov_len += sizeof(__be32);
96}
97
98static inline __be32 svc_getu32(struct kvec *iov)
99{
100 __be32 val, *vp;
101 vp = iov->iov_base;
102 val = *vp++;
103 iov->iov_base = (void*)vp;
104 iov->iov_len -= sizeof(__be32);
88 return val; 105 return val;
89} 106}
90 107
91static inline void svc_ungetu32(struct kvec *iov) 108static inline void svc_ungetu32(struct kvec *iov)
92{ 109{
93 u32 *vp = (u32 *)iov->iov_base; 110 __be32 *vp = (__be32 *)iov->iov_base;
94 iov->iov_base = (void *)(vp - 1); 111 iov->iov_base = (void *)(vp - 1);
95 iov->iov_len += sizeof(*vp); 112 iov->iov_len += sizeof(*vp);
96} 113}
97 114
98static inline void svc_putu32(struct kvec *iov, u32 val) 115static inline void svc_putu32(struct kvec *iov, __be32 val)
99{ 116{
100 u32 *vp = iov->iov_base + iov->iov_len; 117 __be32 *vp = iov->iov_base + iov->iov_len;
101 *vp = val; 118 *vp = val;
102 iov->iov_len += sizeof(u32); 119 iov->iov_len += sizeof(__be32);
103} 120}
104 121
105 122
@@ -130,7 +147,7 @@ struct svc_rqst {
130 short rq_arghi; /* pages available in argument page list */ 147 short rq_arghi; /* pages available in argument page list */
131 short rq_resused; /* pages used for result */ 148 short rq_resused; /* pages used for result */
132 149
133 u32 rq_xid; /* transmission id */ 150 __be32 rq_xid; /* transmission id */
134 u32 rq_prog; /* program number */ 151 u32 rq_prog; /* program number */
135 u32 rq_vers; /* program version */ 152 u32 rq_vers; /* program version */
136 u32 rq_proc; /* procedure number */ 153 u32 rq_proc; /* procedure number */
@@ -139,7 +156,7 @@ struct svc_rqst {
139 rq_secure : 1; /* secure port */ 156 rq_secure : 1; /* secure port */
140 157
141 158
142 __u32 rq_daddr; /* dest addr of request - reply from here */ 159 __be32 rq_daddr; /* dest addr of request - reply from here */
143 160
144 void * rq_argp; /* decoded arguments */ 161 void * rq_argp; /* decoded arguments */
145 void * rq_resp; /* xdr'd results */ 162 void * rq_resp; /* xdr'd results */
@@ -159,7 +176,9 @@ struct svc_rqst {
159 * determine what device number 176 * determine what device number
160 * to report (real or virtual) 177 * to report (real or virtual)
161 */ 178 */
162 179 int rq_sendfile_ok; /* turned off in gss privacy
180 * to prevent encrypting page
181 * cache pages */
163 wait_queue_head_t rq_wait; /* synchronization */ 182 wait_queue_head_t rq_wait; /* synchronization */
164}; 183};
165 184
@@ -167,7 +186,7 @@ struct svc_rqst {
167 * Check buffer bounds after decoding arguments 186 * Check buffer bounds after decoding arguments
168 */ 187 */
169static inline int 188static inline int
170xdr_argsize_check(struct svc_rqst *rqstp, u32 *p) 189xdr_argsize_check(struct svc_rqst *rqstp, __be32 *p)
171{ 190{
172 char *cp = (char *)p; 191 char *cp = (char *)p;
173 struct kvec *vec = &rqstp->rq_arg.head[0]; 192 struct kvec *vec = &rqstp->rq_arg.head[0];
@@ -176,7 +195,7 @@ xdr_argsize_check(struct svc_rqst *rqstp, u32 *p)
176} 195}
177 196
178static inline int 197static inline int
179xdr_ressize_check(struct svc_rqst *rqstp, u32 *p) 198xdr_ressize_check(struct svc_rqst *rqstp, __be32 *p)
180{ 199{
181 struct kvec *vec = &rqstp->rq_res.head[0]; 200 struct kvec *vec = &rqstp->rq_res.head[0];
182 char *cp = (char*)p; 201 char *cp = (char*)p;
@@ -247,10 +266,10 @@ struct svc_deferred_req {
247 u32 prot; /* protocol (UDP or TCP) */ 266 u32 prot; /* protocol (UDP or TCP) */
248 struct sockaddr_in addr; 267 struct sockaddr_in addr;
249 struct svc_sock *svsk; /* where reply must go */ 268 struct svc_sock *svsk; /* where reply must go */
250 u32 daddr; /* where reply must come from */ 269 __be32 daddr; /* where reply must come from */
251 struct cache_deferred_req handle; 270 struct cache_deferred_req handle;
252 int argslen; 271 int argslen;
253 u32 args[0]; 272 __be32 args[0];
254}; 273};
255 274
256/* 275/*
@@ -282,7 +301,7 @@ struct svc_version {
282 * A return value of 0 means drop the request. 301 * A return value of 0 means drop the request.
283 * vs_dispatch == NULL means use default dispatcher. 302 * vs_dispatch == NULL means use default dispatcher.
284 */ 303 */
285 int (*vs_dispatch)(struct svc_rqst *, u32 *); 304 int (*vs_dispatch)(struct svc_rqst *, __be32 *);
286}; 305};
287 306
288/* 307/*
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index 2fe2087edd66..a6601650deeb 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -95,7 +95,7 @@ struct auth_ops {
95 char * name; 95 char * name;
96 struct module *owner; 96 struct module *owner;
97 int flavour; 97 int flavour;
98 int (*accept)(struct svc_rqst *rq, u32 *authp); 98 int (*accept)(struct svc_rqst *rq, __be32 *authp);
99 int (*release)(struct svc_rqst *rq); 99 int (*release)(struct svc_rqst *rq);
100 void (*domain_release)(struct auth_domain *); 100 void (*domain_release)(struct auth_domain *);
101 int (*set_client)(struct svc_rqst *rq); 101 int (*set_client)(struct svc_rqst *rq);
@@ -112,7 +112,7 @@ struct auth_ops {
112#define SVC_COMPLETE 9 112#define SVC_COMPLETE 9
113 113
114 114
115extern int svc_authenticate(struct svc_rqst *rqstp, u32 *authp); 115extern int svc_authenticate(struct svc_rqst *rqstp, __be32 *authp);
116extern int svc_authorise(struct svc_rqst *rqstp); 116extern int svc_authorise(struct svc_rqst *rqstp);
117extern int svc_set_client(struct svc_rqst *rqstp); 117extern int svc_set_client(struct svc_rqst *rqstp);
118extern int svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops); 118extern int svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops);
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 84c35d42d250..953723b09bc6 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -32,7 +32,7 @@ struct xdr_netobj {
32 * side) or svc_rqst pointer (server side). 32 * side) or svc_rqst pointer (server side).
33 * Encode functions always assume there's enough room in the buffer. 33 * Encode functions always assume there's enough room in the buffer.
34 */ 34 */
35typedef int (*kxdrproc_t)(void *rqstp, u32 *data, void *obj); 35typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
36 36
37/* 37/*
38 * Basic structure for transmission/reception of a client XDR message. 38 * Basic structure for transmission/reception of a client XDR message.
@@ -88,19 +88,19 @@ struct xdr_buf {
88/* 88/*
89 * Miscellaneous XDR helper functions 89 * Miscellaneous XDR helper functions
90 */ 90 */
91u32 * xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int len); 91__be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len);
92u32 * xdr_encode_opaque(u32 *p, const void *ptr, unsigned int len); 92__be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len);
93u32 * xdr_encode_string(u32 *p, const char *s); 93__be32 *xdr_encode_string(__be32 *p, const char *s);
94u32 * xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen); 94__be32 *xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen);
95u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *); 95__be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *);
96u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *); 96__be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *);
97 97
98void xdr_encode_pages(struct xdr_buf *, struct page **, unsigned int, 98void xdr_encode_pages(struct xdr_buf *, struct page **, unsigned int,
99 unsigned int); 99 unsigned int);
100void xdr_inline_pages(struct xdr_buf *, unsigned int, 100void xdr_inline_pages(struct xdr_buf *, unsigned int,
101 struct page **, unsigned int, unsigned int); 101 struct page **, unsigned int, unsigned int);
102 102
103static inline u32 *xdr_encode_array(u32 *p, const void *s, unsigned int len) 103static inline __be32 *xdr_encode_array(__be32 *p, const void *s, unsigned int len)
104{ 104{
105 return xdr_encode_opaque(p, s, len); 105 return xdr_encode_opaque(p, s, len);
106} 106}
@@ -108,16 +108,16 @@ static inline u32 *xdr_encode_array(u32 *p, const void *s, unsigned int len)
108/* 108/*
109 * Decode 64bit quantities (NFSv3 support) 109 * Decode 64bit quantities (NFSv3 support)
110 */ 110 */
111static inline u32 * 111static inline __be32 *
112xdr_encode_hyper(u32 *p, __u64 val) 112xdr_encode_hyper(__be32 *p, __u64 val)
113{ 113{
114 *p++ = htonl(val >> 32); 114 *p++ = htonl(val >> 32);
115 *p++ = htonl(val & 0xFFFFFFFF); 115 *p++ = htonl(val & 0xFFFFFFFF);
116 return p; 116 return p;
117} 117}
118 118
119static inline u32 * 119static inline __be32 *
120xdr_decode_hyper(u32 *p, __u64 *valp) 120xdr_decode_hyper(__be32 *p, __u64 *valp)
121{ 121{
122 *valp = ((__u64) ntohl(*p++)) << 32; 122 *valp = ((__u64) ntohl(*p++)) << 32;
123 *valp |= ntohl(*p++); 123 *valp |= ntohl(*p++);
@@ -128,7 +128,7 @@ xdr_decode_hyper(u32 *p, __u64 *valp)
128 * Adjust kvec to reflect end of xdr'ed data (RPC client XDR) 128 * Adjust kvec to reflect end of xdr'ed data (RPC client XDR)
129 */ 129 */
130static inline int 130static inline int
131xdr_adjust_iovec(struct kvec *iov, u32 *p) 131xdr_adjust_iovec(struct kvec *iov, __be32 *p)
132{ 132{
133 return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base); 133 return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base);
134} 134}
@@ -180,20 +180,21 @@ extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
180 * Provide some simple tools for XDR buffer overflow-checking etc. 180 * Provide some simple tools for XDR buffer overflow-checking etc.
181 */ 181 */
182struct xdr_stream { 182struct xdr_stream {
183 uint32_t *p; /* start of available buffer */ 183 __be32 *p; /* start of available buffer */
184 struct xdr_buf *buf; /* XDR buffer to read/write */ 184 struct xdr_buf *buf; /* XDR buffer to read/write */
185 185
186 uint32_t *end; /* end of available buffer space */ 186 __be32 *end; /* end of available buffer space */
187 struct kvec *iov; /* pointer to the current kvec */ 187 struct kvec *iov; /* pointer to the current kvec */
188}; 188};
189 189
190extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p); 190extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
191extern uint32_t *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); 191extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
192extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, 192extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages,
193 unsigned int base, unsigned int len); 193 unsigned int base, unsigned int len);
194extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p); 194extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
195extern uint32_t *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes); 195extern __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes);
196extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len); 196extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len);
197extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len);
197 198
198#endif /* __KERNEL__ */ 199#endif /* __KERNEL__ */
199 200
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index e8bbe8118de8..6cf626580752 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -12,6 +12,7 @@
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <linux/socket.h> 13#include <linux/socket.h>
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/kref.h>
15#include <linux/sunrpc/sched.h> 16#include <linux/sunrpc/sched.h>
16#include <linux/sunrpc/xdr.h> 17#include <linux/sunrpc/xdr.h>
17 18
@@ -37,7 +38,7 @@ extern unsigned int xprt_max_resvport;
37 38
38#define RPC_MIN_RESVPORT (1U) 39#define RPC_MIN_RESVPORT (1U)
39#define RPC_MAX_RESVPORT (65535U) 40#define RPC_MAX_RESVPORT (65535U)
40#define RPC_DEF_MIN_RESVPORT (650U) 41#define RPC_DEF_MIN_RESVPORT (665U)
41#define RPC_DEF_MAX_RESVPORT (1023U) 42#define RPC_DEF_MAX_RESVPORT (1023U)
42 43
43/* 44/*
@@ -51,6 +52,14 @@ struct rpc_timeout {
51 unsigned char to_exponential; 52 unsigned char to_exponential;
52}; 53};
53 54
55enum rpc_display_format_t {
56 RPC_DISPLAY_ADDR = 0,
57 RPC_DISPLAY_PORT,
58 RPC_DISPLAY_PROTO,
59 RPC_DISPLAY_ALL,
60 RPC_DISPLAY_MAX,
61};
62
54struct rpc_task; 63struct rpc_task;
55struct rpc_xprt; 64struct rpc_xprt;
56struct seq_file; 65struct seq_file;
@@ -70,7 +79,7 @@ struct rpc_rqst {
70 * This is the private part 79 * This is the private part
71 */ 80 */
72 struct rpc_task * rq_task; /* RPC task data */ 81 struct rpc_task * rq_task; /* RPC task data */
73 __u32 rq_xid; /* request XID */ 82 __be32 rq_xid; /* request XID */
74 int rq_cong; /* has incremented xprt->cong */ 83 int rq_cong; /* has incremented xprt->cong */
75 int rq_received; /* receive completed */ 84 int rq_received; /* receive completed */
76 u32 rq_seqno; /* gss seq no. used on req. */ 85 u32 rq_seqno; /* gss seq no. used on req. */
@@ -103,8 +112,10 @@ struct rpc_rqst {
103 112
104struct rpc_xprt_ops { 113struct rpc_xprt_ops {
105 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); 114 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);
115 char * (*print_addr)(struct rpc_xprt *xprt, enum rpc_display_format_t format);
106 int (*reserve_xprt)(struct rpc_task *task); 116 int (*reserve_xprt)(struct rpc_task *task);
107 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); 117 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
118 void (*rpcbind)(struct rpc_task *task);
108 void (*set_port)(struct rpc_xprt *xprt, unsigned short port); 119 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
109 void (*connect)(struct rpc_task *task); 120 void (*connect)(struct rpc_task *task);
110 void * (*buf_alloc)(struct rpc_task *task, size_t size); 121 void * (*buf_alloc)(struct rpc_task *task, size_t size);
@@ -119,12 +130,14 @@ struct rpc_xprt_ops {
119}; 130};
120 131
121struct rpc_xprt { 132struct rpc_xprt {
133 struct kref kref; /* Reference count */
122 struct rpc_xprt_ops * ops; /* transport methods */ 134 struct rpc_xprt_ops * ops; /* transport methods */
123 struct socket * sock; /* BSD socket layer */ 135 struct socket * sock; /* BSD socket layer */
124 struct sock * inet; /* INET layer */ 136 struct sock * inet; /* INET layer */
125 137
126 struct rpc_timeout timeout; /* timeout parms */ 138 struct rpc_timeout timeout; /* timeout parms */
127 struct sockaddr_in addr; /* server address */ 139 struct sockaddr_storage addr; /* server address */
140 size_t addrlen; /* size of server address */
128 int prot; /* IP protocol */ 141 int prot; /* IP protocol */
129 142
130 unsigned long cong; /* current congestion */ 143 unsigned long cong; /* current congestion */
@@ -138,6 +151,7 @@ struct rpc_xprt {
138 unsigned int tsh_size; /* size of transport specific 151 unsigned int tsh_size; /* size of transport specific
139 header */ 152 header */
140 153
154 struct rpc_wait_queue binding; /* requests waiting on rpcbind */
141 struct rpc_wait_queue sending; /* requests waiting to send */ 155 struct rpc_wait_queue sending; /* requests waiting to send */
142 struct rpc_wait_queue resend; /* requests waiting to resend */ 156 struct rpc_wait_queue resend; /* requests waiting to resend */
143 struct rpc_wait_queue pending; /* requests in flight */ 157 struct rpc_wait_queue pending; /* requests in flight */
@@ -157,9 +171,9 @@ struct rpc_xprt {
157 /* 171 /*
158 * State of TCP reply receive stuff 172 * State of TCP reply receive stuff
159 */ 173 */
160 u32 tcp_recm, /* Fragment header */ 174 __be32 tcp_recm, /* Fragment header */
161 tcp_xid, /* Current XID */ 175 tcp_xid; /* Current XID */
162 tcp_reclen, /* fragment length */ 176 u32 tcp_reclen, /* fragment length */
163 tcp_offset; /* fragment offset */ 177 tcp_offset; /* fragment offset */
164 unsigned long tcp_copied, /* copied to request */ 178 unsigned long tcp_copied, /* copied to request */
165 tcp_flags; 179 tcp_flags;
@@ -205,6 +219,8 @@ struct rpc_xprt {
205 void (*old_data_ready)(struct sock *, int); 219 void (*old_data_ready)(struct sock *, int);
206 void (*old_state_change)(struct sock *); 220 void (*old_state_change)(struct sock *);
207 void (*old_write_space)(struct sock *); 221 void (*old_write_space)(struct sock *);
222
223 char * address_strings[RPC_DISPLAY_MAX];
208}; 224};
209 225
210#define XPRT_LAST_FRAG (1 << 0) 226#define XPRT_LAST_FRAG (1 << 0)
@@ -217,26 +233,27 @@ struct rpc_xprt {
217/* 233/*
218 * Transport operations used by ULPs 234 * Transport operations used by ULPs
219 */ 235 */
220struct rpc_xprt * xprt_create_proto(int proto, struct sockaddr_in *addr, struct rpc_timeout *to);
221void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr); 236void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr);
222 237
223/* 238/*
224 * Generic internal transport functions 239 * Generic internal transport functions
225 */ 240 */
241struct rpc_xprt * xprt_create_transport(int proto, struct sockaddr *addr, size_t size, struct rpc_timeout *toparms);
226void xprt_connect(struct rpc_task *task); 242void xprt_connect(struct rpc_task *task);
227void xprt_reserve(struct rpc_task *task); 243void xprt_reserve(struct rpc_task *task);
228int xprt_reserve_xprt(struct rpc_task *task); 244int xprt_reserve_xprt(struct rpc_task *task);
229int xprt_reserve_xprt_cong(struct rpc_task *task); 245int xprt_reserve_xprt_cong(struct rpc_task *task);
230int xprt_prepare_transmit(struct rpc_task *task); 246int xprt_prepare_transmit(struct rpc_task *task);
231void xprt_transmit(struct rpc_task *task); 247void xprt_transmit(struct rpc_task *task);
232void xprt_abort_transmit(struct rpc_task *task); 248void xprt_end_transmit(struct rpc_task *task);
233int xprt_adjust_timeout(struct rpc_rqst *req); 249int xprt_adjust_timeout(struct rpc_rqst *req);
234void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task); 250void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
235void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); 251void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
236void xprt_release(struct rpc_task *task); 252void xprt_release(struct rpc_task *task);
237int xprt_destroy(struct rpc_xprt *xprt); 253struct rpc_xprt * xprt_get(struct rpc_xprt *xprt);
254void xprt_put(struct rpc_xprt *xprt);
238 255
239static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p) 256static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p)
240{ 257{
241 return p + xprt->tsh_size; 258 return p + xprt->tsh_size;
242} 259}
@@ -251,7 +268,7 @@ void xprt_wait_for_buffer_space(struct rpc_task *task);
251void xprt_write_space(struct rpc_xprt *xprt); 268void xprt_write_space(struct rpc_xprt *xprt);
252void xprt_update_rtt(struct rpc_task *task); 269void xprt_update_rtt(struct rpc_task *task);
253void xprt_adjust_cwnd(struct rpc_task *task, int result); 270void xprt_adjust_cwnd(struct rpc_task *task, int result);
254struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid); 271struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
255void xprt_complete_rqst(struct rpc_task *task, int copied); 272void xprt_complete_rqst(struct rpc_task *task, int copied);
256void xprt_release_rqst_cong(struct rpc_task *task); 273void xprt_release_rqst_cong(struct rpc_task *task);
257void xprt_disconnect(struct rpc_xprt *xprt); 274void xprt_disconnect(struct rpc_xprt *xprt);
@@ -269,6 +286,8 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to);
269#define XPRT_CONNECTED (1) 286#define XPRT_CONNECTED (1)
270#define XPRT_CONNECTING (2) 287#define XPRT_CONNECTING (2)
271#define XPRT_CLOSE_WAIT (3) 288#define XPRT_CLOSE_WAIT (3)
289#define XPRT_BOUND (4)
290#define XPRT_BINDING (5)
272 291
273static inline void xprt_set_connected(struct rpc_xprt *xprt) 292static inline void xprt_set_connected(struct rpc_xprt *xprt)
274{ 293{
@@ -312,6 +331,33 @@ static inline int xprt_test_and_set_connecting(struct rpc_xprt *xprt)
312 return test_and_set_bit(XPRT_CONNECTING, &xprt->state); 331 return test_and_set_bit(XPRT_CONNECTING, &xprt->state);
313} 332}
314 333
334static inline void xprt_set_bound(struct rpc_xprt *xprt)
335{
336 test_and_set_bit(XPRT_BOUND, &xprt->state);
337}
338
339static inline int xprt_bound(struct rpc_xprt *xprt)
340{
341 return test_bit(XPRT_BOUND, &xprt->state);
342}
343
344static inline void xprt_clear_bound(struct rpc_xprt *xprt)
345{
346 clear_bit(XPRT_BOUND, &xprt->state);
347}
348
349static inline void xprt_clear_binding(struct rpc_xprt *xprt)
350{
351 smp_mb__before_clear_bit();
352 clear_bit(XPRT_BINDING, &xprt->state);
353 smp_mb__after_clear_bit();
354}
355
356static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt)
357{
358 return test_and_set_bit(XPRT_BINDING, &xprt->state);
359}
360
315#endif /* __KERNEL__*/ 361#endif /* __KERNEL__*/
316 362
317#endif /* _LINUX_SUNRPC_XPRT_H */ 363#endif /* _LINUX_SUNRPC_XPRT_H */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index e82cb10fb3ea..b1237f16ecde 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -10,29 +10,11 @@
10#include <linux/pm.h> 10#include <linux/pm.h>
11 11
12/* page backup entry */ 12/* page backup entry */
13typedef struct pbe { 13struct pbe {
14 unsigned long address; /* address of the copy */ 14 unsigned long address; /* address of the copy */
15 unsigned long orig_address; /* original address of page */ 15 unsigned long orig_address; /* original address of page */
16 struct pbe *next; 16 struct pbe *next;
17} suspend_pagedir_t; 17};
18
19#define for_each_pbe(pbe, pblist) \
20 for (pbe = pblist ; pbe ; pbe = pbe->next)
21
22#define PBES_PER_PAGE (PAGE_SIZE/sizeof(struct pbe))
23#define PB_PAGE_SKIP (PBES_PER_PAGE-1)
24
25#define for_each_pb_page(pbe, pblist) \
26 for (pbe = pblist ; pbe ; pbe = (pbe+PB_PAGE_SKIP)->next)
27
28
29#define SWAP_FILENAME_MAXLENGTH 32
30
31
32extern dev_t swsusp_resume_device;
33
34/* mm/vmscan.c */
35extern int shrink_mem(void);
36 18
37/* mm/page_alloc.c */ 19/* mm/page_alloc.c */
38extern void drain_local_pages(void); 20extern void drain_local_pages(void);
@@ -53,25 +35,16 @@ static inline void pm_restore_console(void) {}
53static inline int software_suspend(void) 35static inline int software_suspend(void)
54{ 36{
55 printk("Warning: fake suspend called\n"); 37 printk("Warning: fake suspend called\n");
56 return -EPERM; 38 return -ENOSYS;
57} 39}
58#endif /* CONFIG_PM */ 40#endif /* CONFIG_PM */
59 41
60#ifdef CONFIG_SUSPEND_SMP
61extern void disable_nonboot_cpus(void);
62extern void enable_nonboot_cpus(void);
63#else
64static inline void disable_nonboot_cpus(void) {}
65static inline void enable_nonboot_cpus(void) {}
66#endif
67
68void save_processor_state(void); 42void save_processor_state(void);
69void restore_processor_state(void); 43void restore_processor_state(void);
70struct saved_context; 44struct saved_context;
71void __save_processor_state(struct saved_context *ctxt); 45void __save_processor_state(struct saved_context *ctxt);
72void __restore_processor_state(struct saved_context *ctxt); 46void __restore_processor_state(struct saved_context *ctxt);
73unsigned long get_safe_page(gfp_t gfp_mask); 47unsigned long get_safe_page(gfp_t gfp_mask);
74int swsusp_add_arch_pages(unsigned long start, unsigned long end);
75 48
76/* 49/*
77 * XXX: We try to keep some more pages free so that I/O operations succeed 50 * XXX: We try to keep some more pages free so that I/O operations succeed
diff --git a/include/linux/swap.h b/include/linux/swap.h
index dc3f3aa0c83e..e7c36ba2a2db 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -10,6 +10,10 @@
10#include <asm/atomic.h> 10#include <asm/atomic.h>
11#include <asm/page.h> 11#include <asm/page.h>
12 12
13struct notifier_block;
14
15struct bio;
16
13#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ 17#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */
14#define SWAP_FLAG_PRIO_MASK 0x7fff 18#define SWAP_FLAG_PRIO_MASK 0x7fff
15#define SWAP_FLAG_PRIO_SHIFT 0 19#define SWAP_FLAG_PRIO_SHIFT 0
@@ -156,13 +160,14 @@ struct swap_list_t {
156 160
157/* linux/mm/oom_kill.c */ 161/* linux/mm/oom_kill.c */
158extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); 162extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
163extern int register_oom_notifier(struct notifier_block *nb);
164extern int unregister_oom_notifier(struct notifier_block *nb);
159 165
160/* linux/mm/memory.c */ 166/* linux/mm/memory.c */
161extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); 167extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
162 168
163/* linux/mm/page_alloc.c */ 169/* linux/mm/page_alloc.c */
164extern unsigned long totalram_pages; 170extern unsigned long totalram_pages;
165extern unsigned long totalhigh_pages;
166extern unsigned long totalreserve_pages; 171extern unsigned long totalreserve_pages;
167extern long nr_swap_pages; 172extern long nr_swap_pages;
168extern unsigned int nr_free_pages(void); 173extern unsigned int nr_free_pages(void);
@@ -189,7 +194,8 @@ extern long vm_total_pages;
189 194
190#ifdef CONFIG_NUMA 195#ifdef CONFIG_NUMA
191extern int zone_reclaim_mode; 196extern int zone_reclaim_mode;
192extern int zone_reclaim_interval; 197extern int sysctl_min_unmapped_ratio;
198extern int sysctl_min_slab_ratio;
193extern int zone_reclaim(struct zone *, gfp_t, unsigned int); 199extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
194#else 200#else
195#define zone_reclaim_mode 0 201#define zone_reclaim_mode 0
@@ -199,6 +205,8 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
199} 205}
200#endif 206#endif
201 207
208extern int kswapd_run(int nid);
209
202#ifdef CONFIG_MMU 210#ifdef CONFIG_MMU
203/* linux/mm/shmem.c */ 211/* linux/mm/shmem.c */
204extern int shmem_unuse(swp_entry_t entry, struct page *page); 212extern int shmem_unuse(swp_entry_t entry, struct page *page);
@@ -210,7 +218,9 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
210/* linux/mm/page_io.c */ 218/* linux/mm/page_io.c */
211extern int swap_readpage(struct file *, struct page *); 219extern int swap_readpage(struct file *, struct page *);
212extern int swap_writepage(struct page *page, struct writeback_control *wbc); 220extern int swap_writepage(struct page *page, struct writeback_control *wbc);
213extern int rw_swap_page_sync(int, swp_entry_t, struct page *); 221extern int rw_swap_page_sync(int rw, swp_entry_t entry, struct page *page,
222 struct bio **bio_chain);
223extern int end_swap_bio_read(struct bio *bio, unsigned int bytes_done, int err);
214 224
215/* linux/mm/swap_state.c */ 225/* linux/mm/swap_state.c */
216extern struct address_space swapper_space; 226extern struct address_space swapper_space;
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 2993302f7923..0577f5284cbc 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * SyncLink Multiprotocol Serial Adapter Driver 2 * SyncLink Multiprotocol Serial Adapter Driver
3 * 3 *
4 * $Id: synclink.h,v 3.11 2006/02/06 21:20:29 paulkf Exp $ 4 * $Id: synclink.h,v 3.13 2006/05/23 18:25:06 paulkf Exp $
5 * 5 *
6 * Copyright (C) 1998-2000 by Microgate Corporation 6 * Copyright (C) 1998-2000 by Microgate Corporation
7 * 7 *
@@ -97,6 +97,8 @@
97#define HDLC_TXIDLE_ALT_MARK_SPACE 4 97#define HDLC_TXIDLE_ALT_MARK_SPACE 4
98#define HDLC_TXIDLE_SPACE 5 98#define HDLC_TXIDLE_SPACE 5
99#define HDLC_TXIDLE_MARK 6 99#define HDLC_TXIDLE_MARK 6
100#define HDLC_TXIDLE_CUSTOM_8 0x10000000
101#define HDLC_TXIDLE_CUSTOM_16 0x20000000
100 102
101#define HDLC_ENCODING_NRZ 0 103#define HDLC_ENCODING_NRZ 0
102#define HDLC_ENCODING_NRZB 1 104#define HDLC_ENCODING_NRZB 1
@@ -170,6 +172,7 @@ typedef struct _MGSL_PARAMS
170#define SYNCLINK_GT_DEVICE_ID 0x0070 172#define SYNCLINK_GT_DEVICE_ID 0x0070
171#define SYNCLINK_GT4_DEVICE_ID 0x0080 173#define SYNCLINK_GT4_DEVICE_ID 0x0080
172#define SYNCLINK_AC_DEVICE_ID 0x0090 174#define SYNCLINK_AC_DEVICE_ID 0x0090
175#define SYNCLINK_GT2_DEVICE_ID 0x00A0
173#define MGSL_MAX_SERIAL_NUMBER 30 176#define MGSL_MAX_SERIAL_NUMBER 30
174 177
175/* 178/*
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 33785b79d548..2d1c3d5c83ac 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -53,6 +53,7 @@ struct mq_attr;
53struct compat_stat; 53struct compat_stat;
54struct compat_timeval; 54struct compat_timeval;
55struct robust_list_head; 55struct robust_list_head;
56struct getcpu_cache;
56 57
57#include <linux/types.h> 58#include <linux/types.h>
58#include <linux/aio_abi.h> 59#include <linux/aio_abi.h>
@@ -174,9 +175,9 @@ asmlinkage long sys_waitid(int which, pid_t pid,
174 int options, struct rusage __user *ru); 175 int options, struct rusage __user *ru);
175asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options); 176asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options);
176asmlinkage long sys_set_tid_address(int __user *tidptr); 177asmlinkage long sys_set_tid_address(int __user *tidptr);
177asmlinkage long sys_futex(u32 __user *uaddr, int op, int val, 178asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
178 struct timespec __user *utime, u32 __user *uaddr2, 179 struct timespec __user *utime, u32 __user *uaddr2,
179 int val3); 180 u32 val3);
180 181
181asmlinkage long sys_init_module(void __user *umod, unsigned long len, 182asmlinkage long sys_init_module(void __user *umod, unsigned long len,
182 const char __user *uargs); 183 const char __user *uargs);
@@ -596,5 +597,6 @@ asmlinkage long sys_get_robust_list(int pid,
596 size_t __user *len_ptr); 597 size_t __user *len_ptr);
597asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, 598asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
598 size_t len); 599 size_t len);
600asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
599 601
600#endif 602#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index c7132029af0f..1b24bd45e080 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -55,7 +55,7 @@ enum
55 CTL_KERN=1, /* General kernel info and control */ 55 CTL_KERN=1, /* General kernel info and control */
56 CTL_VM=2, /* VM management */ 56 CTL_VM=2, /* VM management */
57 CTL_NET=3, /* Networking */ 57 CTL_NET=3, /* Networking */
58 CTL_PROC=4, /* Process info */ 58 /* was CTL_PROC */
59 CTL_FS=5, /* Filesystems */ 59 CTL_FS=5, /* Filesystems */
60 CTL_DEBUG=6, /* Debugging */ 60 CTL_DEBUG=6, /* Debugging */
61 CTL_DEV=7, /* Devices */ 61 CTL_DEV=7, /* Devices */
@@ -148,9 +148,14 @@ enum
148 KERN_SPIN_RETRY=70, /* int: number of spinlock retries */ 148 KERN_SPIN_RETRY=70, /* int: number of spinlock retries */
149 KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */ 149 KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
150 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ 150 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
151 KERN_COMPAT_LOG=73, /* int: print compat layer messages */
152 KERN_MAX_LOCK_DEPTH=74,
153 KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
154 KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
151}; 155};
152 156
153 157
158
154/* CTL_VM names: */ 159/* CTL_VM names: */
155enum 160enum
156{ 161{
@@ -185,8 +190,10 @@ enum
185 VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */ 190 VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */
186 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */ 191 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
187 VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */ 192 VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */
188 VM_ZONE_RECLAIM_INTERVAL=32, /* time period to wait after reclaim failure */ 193 VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */
189 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ 194 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
195 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */
196 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */
190}; 197};
191 198
192 199
@@ -407,6 +414,10 @@ enum
407 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115, 414 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115,
408 NET_TCP_DMA_COPYBREAK=116, 415 NET_TCP_DMA_COPYBREAK=116,
409 NET_TCP_SLOW_START_AFTER_IDLE=117, 416 NET_TCP_SLOW_START_AFTER_IDLE=117,
417 NET_CIPSOV4_CACHE_ENABLE=118,
418 NET_CIPSOV4_CACHE_BUCKET_SIZE=119,
419 NET_CIPSOV4_RBM_OPTFMT=120,
420 NET_CIPSOV4_RBM_STRICTVALID=121,
410}; 421};
411 422
412enum { 423enum {
@@ -548,6 +559,7 @@ enum {
548 NET_IPV6_ACCEPT_RA_RTR_PREF=20, 559 NET_IPV6_ACCEPT_RA_RTR_PREF=20,
549 NET_IPV6_RTR_PROBE_INTERVAL=21, 560 NET_IPV6_RTR_PROBE_INTERVAL=21,
550 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, 561 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
562 NET_IPV6_PROXY_NDP=23,
551 __NET_IPV6_MAX 563 __NET_IPV6_MAX
552}; 564};
553 565
@@ -767,8 +779,6 @@ enum {
767 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, 779 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
768}; 780};
769 781
770/* CTL_PROC names: */
771
772/* CTL_FS names: */ 782/* CTL_FS names: */
773enum 783enum
774{ 784{
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 1ea5d3cda6ae..6d5c43d31dec 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -10,6 +10,7 @@
10#ifndef _SYSFS_H_ 10#ifndef _SYSFS_H_
11#define _SYSFS_H_ 11#define _SYSFS_H_
12 12
13#include <linux/compiler.h>
13#include <asm/atomic.h> 14#include <asm/atomic.h>
14 15
15struct kobject; 16struct kobject;
@@ -86,40 +87,44 @@ struct sysfs_dirent {
86 87
87#ifdef CONFIG_SYSFS 88#ifdef CONFIG_SYSFS
88 89
89extern int 90extern int __must_check
90sysfs_create_dir(struct kobject *); 91sysfs_create_dir(struct kobject *);
91 92
92extern void 93extern void
93sysfs_remove_dir(struct kobject *); 94sysfs_remove_dir(struct kobject *);
94 95
95extern int 96extern int __must_check
96sysfs_rename_dir(struct kobject *, const char *new_name); 97sysfs_rename_dir(struct kobject *, const char *new_name);
97 98
98extern int 99extern int __must_check
99sysfs_create_file(struct kobject *, const struct attribute *); 100sysfs_create_file(struct kobject *, const struct attribute *);
100 101
101extern int 102extern int __must_check
102sysfs_update_file(struct kobject *, const struct attribute *); 103sysfs_update_file(struct kobject *, const struct attribute *);
103 104
104extern int 105extern int __must_check
105sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); 106sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode);
106 107
107extern void 108extern void
108sysfs_remove_file(struct kobject *, const struct attribute *); 109sysfs_remove_file(struct kobject *, const struct attribute *);
109 110
110extern int 111extern int __must_check
111sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name); 112sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name);
112 113
113extern void 114extern void
114sysfs_remove_link(struct kobject *, const char * name); 115sysfs_remove_link(struct kobject *, const char * name);
115 116
116int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); 117int __must_check sysfs_create_bin_file(struct kobject *kobj,
117int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); 118 struct bin_attribute *attr);
119void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr);
118 120
119int sysfs_create_group(struct kobject *, const struct attribute_group *); 121int __must_check sysfs_create_group(struct kobject *,
122 const struct attribute_group *);
120void sysfs_remove_group(struct kobject *, const struct attribute_group *); 123void sysfs_remove_group(struct kobject *, const struct attribute_group *);
121void sysfs_notify(struct kobject * k, char *dir, char *attr); 124void sysfs_notify(struct kobject * k, char *dir, char *attr);
122 125
126extern int __must_check sysfs_init(void);
127
123#else /* CONFIG_SYSFS */ 128#else /* CONFIG_SYSFS */
124 129
125static inline int sysfs_create_dir(struct kobject * k) 130static inline int sysfs_create_dir(struct kobject * k)
@@ -191,6 +196,11 @@ static inline void sysfs_notify(struct kobject * k, char *dir, char *attr)
191{ 196{
192} 197}
193 198
199static inline int __must_check sysfs_init(void)
200{
201 return 0;
202}
203
194#endif /* CONFIG_SYSFS */ 204#endif /* CONFIG_SYSFS */
195 205
196#endif /* _SYSFS_H_ */ 206#endif /* _SYSFS_H_ */
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h
new file mode 100644
index 000000000000..f1cb6cddd19d
--- /dev/null
+++ b/include/linux/taskstats.h
@@ -0,0 +1,137 @@
1/* taskstats.h - exporting per-task statistics
2 *
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 * (C) Balbir Singh, IBM Corp. 2006
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2.1 of the GNU Lesser General Public License
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it would be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 */
14
15#ifndef _LINUX_TASKSTATS_H
16#define _LINUX_TASKSTATS_H
17
18/* Format for per-task data returned to userland when
19 * - a task exits
20 * - listener requests stats for a task
21 *
22 * The struct is versioned. Newer versions should only add fields to
23 * the bottom of the struct to maintain backward compatibility.
24 *
25 *
26 * To add new fields
27 * a) bump up TASKSTATS_VERSION
28 * b) add comment indicating new version number at end of struct
29 * c) add new fields after version comment; maintain 64-bit alignment
30 */
31
32#define TASKSTATS_VERSION 1
33
34struct taskstats {
35
36 /* Version 1 */
37 __u16 version;
38 __u16 padding[3]; /* Userspace should not interpret the padding
39 * field which can be replaced by useful
40 * fields if struct taskstats is extended.
41 */
42
43 /* Delay accounting fields start
44 *
45 * All values, until comment "Delay accounting fields end" are
46 * available only if delay accounting is enabled, even though the last
47 * few fields are not delays
48 *
49 * xxx_count is the number of delay values recorded
50 * xxx_delay_total is the corresponding cumulative delay in nanoseconds
51 *
52 * xxx_delay_total wraps around to zero on overflow
53 * xxx_count incremented regardless of overflow
54 */
55
56 /* Delay waiting for cpu, while runnable
57 * count, delay_total NOT updated atomically
58 */
59 __u64 cpu_count;
60 __u64 cpu_delay_total;
61
62 /* Following four fields atomically updated using task->delays->lock */
63
64 /* Delay waiting for synchronous block I/O to complete
65 * does not account for delays in I/O submission
66 */
67 __u64 blkio_count;
68 __u64 blkio_delay_total;
69
70 /* Delay waiting for page fault I/O (swap in only) */
71 __u64 swapin_count;
72 __u64 swapin_delay_total;
73
74 /* cpu "wall-clock" running time
75 * On some architectures, value will adjust for cpu time stolen
76 * from the kernel in involuntary waits due to virtualization.
77 * Value is cumulative, in nanoseconds, without a corresponding count
78 * and wraps around to zero silently on overflow
79 */
80 __u64 cpu_run_real_total;
81
82 /* cpu "virtual" running time
83 * Uses time intervals seen by the kernel i.e. no adjustment
84 * for kernel's involuntary waits due to virtualization.
85 * Value is cumulative, in nanoseconds, without a corresponding count
86 * and wraps around to zero silently on overflow
87 */
88 __u64 cpu_run_virtual_total;
89 /* Delay accounting fields end */
90 /* version 1 ends here */
91};
92
93
94/*
95 * Commands sent from userspace
96 * Not versioned. New commands should only be inserted at the enum's end
97 * prior to __TASKSTATS_CMD_MAX
98 */
99
100enum {
101 TASKSTATS_CMD_UNSPEC = 0, /* Reserved */
102 TASKSTATS_CMD_GET, /* user->kernel request/get-response */
103 TASKSTATS_CMD_NEW, /* kernel->user event */
104 __TASKSTATS_CMD_MAX,
105};
106
107#define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1)
108
109enum {
110 TASKSTATS_TYPE_UNSPEC = 0, /* Reserved */
111 TASKSTATS_TYPE_PID, /* Process id */
112 TASKSTATS_TYPE_TGID, /* Thread group id */
113 TASKSTATS_TYPE_STATS, /* taskstats structure */
114 TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */
115 TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */
116 __TASKSTATS_TYPE_MAX,
117};
118
119#define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1)
120
121enum {
122 TASKSTATS_CMD_ATTR_UNSPEC = 0,
123 TASKSTATS_CMD_ATTR_PID,
124 TASKSTATS_CMD_ATTR_TGID,
125 TASKSTATS_CMD_ATTR_REGISTER_CPUMASK,
126 TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK,
127 __TASKSTATS_CMD_ATTR_MAX,
128};
129
130#define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1)
131
132/* NETLINK_GENERIC related info */
133
134#define TASKSTATS_GENL_NAME "TASKSTATS"
135#define TASKSTATS_GENL_VERSION 0x1
136
137#endif /* _LINUX_TASKSTATS_H */
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
new file mode 100644
index 000000000000..16894b7edcc8
--- /dev/null
+++ b/include/linux/taskstats_kern.h
@@ -0,0 +1,89 @@
1/* taskstats_kern.h - kernel header for per-task statistics interface
2 *
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 * (C) Balbir Singh, IBM Corp. 2006
5 */
6
7#ifndef _LINUX_TASKSTATS_KERN_H
8#define _LINUX_TASKSTATS_KERN_H
9
10#include <linux/taskstats.h>
11#include <linux/sched.h>
12#include <net/genetlink.h>
13
14#ifdef CONFIG_TASKSTATS
15extern kmem_cache_t *taskstats_cache;
16extern struct mutex taskstats_exit_mutex;
17
18static inline void taskstats_exit_free(struct taskstats *tidstats)
19{
20 if (tidstats)
21 kmem_cache_free(taskstats_cache, tidstats);
22}
23
24static inline void taskstats_tgid_init(struct signal_struct *sig)
25{
26 spin_lock_init(&sig->stats_lock);
27 sig->stats = NULL;
28}
29
30static inline void taskstats_tgid_alloc(struct signal_struct *sig)
31{
32 struct taskstats *stats;
33 unsigned long flags;
34
35 stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
36 if (!stats)
37 return;
38
39 spin_lock_irqsave(&sig->stats_lock, flags);
40 if (!sig->stats) {
41 sig->stats = stats;
42 stats = NULL;
43 }
44 spin_unlock_irqrestore(&sig->stats_lock, flags);
45
46 if (stats)
47 kmem_cache_free(taskstats_cache, stats);
48}
49
50static inline void taskstats_tgid_free(struct signal_struct *sig)
51{
52 struct taskstats *stats = NULL;
53 unsigned long flags;
54
55 spin_lock_irqsave(&sig->stats_lock, flags);
56 if (sig->stats) {
57 stats = sig->stats;
58 sig->stats = NULL;
59 }
60 spin_unlock_irqrestore(&sig->stats_lock, flags);
61 if (stats)
62 kmem_cache_free(taskstats_cache, stats);
63}
64
65extern void taskstats_exit_alloc(struct taskstats **, unsigned int *);
66extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int);
67extern void taskstats_init_early(void);
68extern void taskstats_tgid_alloc(struct signal_struct *);
69#else
70static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu)
71{}
72static inline void taskstats_exit_free(struct taskstats *ptidstats)
73{}
74static inline void taskstats_exit_send(struct task_struct *tsk,
75 struct taskstats *tidstats,
76 int group_dead, unsigned int cpu)
77{}
78static inline void taskstats_tgid_init(struct signal_struct *sig)
79{}
80static inline void taskstats_tgid_alloc(struct signal_struct *sig)
81{}
82static inline void taskstats_tgid_free(struct signal_struct *sig)
83{}
84static inline void taskstats_init_early(void)
85{}
86#endif /* CONFIG_TASKSTATS */
87
88#endif
89
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild
new file mode 100644
index 000000000000..78dfbac36375
--- /dev/null
+++ b/include/linux/tc_act/Kbuild
@@ -0,0 +1,4 @@
1header-y += tc_gact.h
2header-y += tc_ipt.h
3header-y += tc_mirred.h
4header-y += tc_pedit.h
diff --git a/include/linux/tc_ematch/Kbuild b/include/linux/tc_ematch/Kbuild
new file mode 100644
index 000000000000..4a58a1c32a00
--- /dev/null
+++ b/include/linux/tc_ematch/Kbuild
@@ -0,0 +1,4 @@
1header-y += tc_em_cmp.h
2header-y += tc_em_meta.h
3header-y += tc_em_nbyte.h
4header-y += tc_em_text.h
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 8ebf497907f8..0e058a2d1c6d 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -21,10 +21,10 @@
21#include <asm/byteorder.h> 21#include <asm/byteorder.h>
22 22
23struct tcphdr { 23struct tcphdr {
24 __u16 source; 24 __be16 source;
25 __u16 dest; 25 __be16 dest;
26 __u32 seq; 26 __be32 seq;
27 __u32 ack_seq; 27 __be32 ack_seq;
28#if defined(__LITTLE_ENDIAN_BITFIELD) 28#if defined(__LITTLE_ENDIAN_BITFIELD)
29 __u16 res1:4, 29 __u16 res1:4,
30 doff:4, 30 doff:4,
@@ -50,9 +50,9 @@ struct tcphdr {
50#else 50#else
51#error "Adjust your <asm/byteorder.h> defines" 51#error "Adjust your <asm/byteorder.h> defines"
52#endif 52#endif
53 __u16 window; 53 __be16 window;
54 __u16 check; 54 __be16 check;
55 __u16 urg_ptr; 55 __be16 urg_ptr;
56}; 56};
57 57
58/* 58/*
@@ -62,7 +62,7 @@ struct tcphdr {
62 */ 62 */
63union tcp_word_hdr { 63union tcp_word_hdr {
64 struct tcphdr hdr; 64 struct tcphdr hdr;
65 __u32 words[5]; 65 __be32 words[5];
66}; 66};
67 67
68#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) 68#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
@@ -166,6 +166,11 @@ struct tcp_info
166#include <net/inet_timewait_sock.h> 166#include <net/inet_timewait_sock.h>
167 167
168/* This defines a selective acknowledgement block. */ 168/* This defines a selective acknowledgement block. */
169struct tcp_sack_block_wire {
170 __be32 start_seq;
171 __be32 end_seq;
172};
173
169struct tcp_sack_block { 174struct tcp_sack_block {
170 __u32 start_seq; 175 __u32 start_seq;
171 __u32 end_seq; 176 __u32 end_seq;
@@ -211,7 +216,7 @@ struct tcp_sock {
211 * Header prediction flags 216 * Header prediction flags
212 * 0x5?10 << 16 + snd_wnd in net byte order 217 * 0x5?10 << 16 + snd_wnd in net byte order
213 */ 218 */
214 __u32 pred_flags; 219 __be32 pred_flags;
215 220
216/* 221/*
217 * RFC793 variables by their proper names. This means you can 222 * RFC793 variables by their proper names. This means you can
diff --git a/include/linux/time.h b/include/linux/time.h
index 0cd696cee998..a5b739967b74 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -28,10 +28,13 @@ struct timezone {
28#ifdef __KERNEL__ 28#ifdef __KERNEL__
29 29
30/* Parameters used to convert the timespec values: */ 30/* Parameters used to convert the timespec values: */
31#define MSEC_PER_SEC 1000L 31#define MSEC_PER_SEC 1000L
32#define USEC_PER_SEC 1000000L 32#define USEC_PER_MSEC 1000L
33#define NSEC_PER_SEC 1000000000L 33#define NSEC_PER_USEC 1000L
34#define NSEC_PER_USEC 1000L 34#define NSEC_PER_MSEC 1000000L
35#define USEC_PER_SEC 1000000L
36#define NSEC_PER_SEC 1000000000L
37#define FSEC_PER_SEC 1000000000000000L
35 38
36static inline int timespec_equal(struct timespec *a, struct timespec *b) 39static inline int timespec_equal(struct timespec *a, struct timespec *b)
37{ 40{
@@ -68,6 +71,18 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon,
68extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); 71extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
69 72
70/* 73/*
74 * sub = lhs - rhs, in normalized form
75 */
76static inline struct timespec timespec_sub(struct timespec lhs,
77 struct timespec rhs)
78{
79 struct timespec ts_delta;
80 set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec,
81 lhs.tv_nsec - rhs.tv_nsec);
82 return ts_delta;
83}
84
85/*
71 * Returns true if the timespec is norm, false if denorm: 86 * Returns true if the timespec is norm, false if denorm:
72 */ 87 */
73#define timespec_valid(ts) \ 88#define timespec_valid(ts) \
@@ -77,6 +92,8 @@ extern struct timespec xtime;
77extern struct timespec wall_to_monotonic; 92extern struct timespec wall_to_monotonic;
78extern seqlock_t xtime_lock; 93extern seqlock_t xtime_lock;
79 94
95void timekeeping_init(void);
96
80static inline unsigned long get_seconds(void) 97static inline unsigned long get_seconds(void)
81{ 98{
82 return xtime.tv_sec; 99 return xtime.tv_sec;
@@ -100,6 +117,7 @@ extern int do_getitimer(int which, struct itimerval *value);
100extern void getnstimeofday(struct timespec *tv); 117extern void getnstimeofday(struct timespec *tv);
101 118
102extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 119extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
120extern int timekeeping_is_continuous(void);
103 121
104/** 122/**
105 * timespec_to_ns - Convert timespec to nanoseconds 123 * timespec_to_ns - Convert timespec to nanoseconds
@@ -142,6 +160,20 @@ extern struct timespec ns_to_timespec(const s64 nsec);
142 */ 160 */
143extern struct timeval ns_to_timeval(const s64 nsec); 161extern struct timeval ns_to_timeval(const s64 nsec);
144 162
163/**
164 * timespec_add_ns - Adds nanoseconds to a timespec
165 * @a: pointer to timespec to be incremented
166 * @ns: unsigned nanoseconds value to be added
167 */
168static inline void timespec_add_ns(struct timespec *a, u64 ns)
169{
170 ns += a->tv_nsec;
171 while(unlikely(ns >= NSEC_PER_SEC)) {
172 ns -= NSEC_PER_SEC;
173 a->tv_sec++;
174 }
175 a->tv_nsec = ns;
176}
145#endif /* __KERNEL__ */ 177#endif /* __KERNEL__ */
146 178
147#define NFDBITS __NFDBITS 179#define NFDBITS __NFDBITS
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 34d3ccff7bbb..d543d3871e38 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -57,7 +57,6 @@
57#include <linux/time.h> 57#include <linux/time.h>
58 58
59#include <asm/param.h> 59#include <asm/param.h>
60#include <asm/timex.h>
61 60
62/* 61/*
63 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen 62 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen
@@ -191,6 +190,8 @@ struct timex {
191#define TIME_BAD TIME_ERROR /* bw compat */ 190#define TIME_BAD TIME_ERROR /* bw compat */
192 191
193#ifdef __KERNEL__ 192#ifdef __KERNEL__
193#include <asm/timex.h>
194
194/* 195/*
195 * kernel variables 196 * kernel variables
196 * Note: maximum error = NTP synch distance = dispersion + delay / 2; 197 * Note: maximum error = NTP synch distance = dispersion + delay / 2;
@@ -303,6 +304,8 @@ time_interpolator_reset(void)
303 304
304#endif /* !CONFIG_TIME_INTERPOLATION */ 305#endif /* !CONFIG_TIME_INTERPOLATION */
305 306
307#define TICK_LENGTH_SHIFT 32
308
306/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 309/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
307extern u64 current_tick_length(void); 310extern u64 current_tick_length(void);
308 311
diff --git a/include/linux/topology.h b/include/linux/topology.h
index a305ae2e44b6..ec1eca85290a 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -134,7 +134,8 @@
134 .flags = SD_LOAD_BALANCE \ 134 .flags = SD_LOAD_BALANCE \
135 | SD_BALANCE_NEWIDLE \ 135 | SD_BALANCE_NEWIDLE \
136 | SD_BALANCE_EXEC \ 136 | SD_BALANCE_EXEC \
137 | SD_WAKE_AFFINE, \ 137 | SD_WAKE_AFFINE \
138 | BALANCE_FOR_POWER, \
138 .last_balance = jiffies, \ 139 .last_balance = jiffies, \
139 .balance_interval = 1, \ 140 .balance_interval = 1, \
140 .nr_balance_failed = 0, \ 141 .nr_balance_failed = 0, \
diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h
index 99e02ef54c47..bfc84a7aecc5 100644
--- a/include/linux/trdevice.h
+++ b/include/linux/trdevice.h
@@ -28,7 +28,7 @@
28#include <linux/if_tr.h> 28#include <linux/if_tr.h>
29 29
30#ifdef __KERNEL__ 30#ifdef __KERNEL__
31extern unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev); 31extern __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev);
32extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev); 32extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev);
33extern struct net_device *alloc_trdev(int sizeof_priv); 33extern struct net_device *alloc_trdev(int sizeof_priv);
34 34
diff --git a/include/linux/tty.h b/include/linux/tty.h
index cb35ca50a0a6..ea4c2605f8da 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -5,16 +5,6 @@
5 * 'tty.h' defines some structures used by tty_io.c and some defines. 5 * 'tty.h' defines some structures used by tty_io.c and some defines.
6 */ 6 */
7 7
8/*
9 * These constants are also useful for user-level apps (e.g., VC
10 * resizing).
11 */
12#define MIN_NR_CONSOLES 1 /* must be at least 1 */
13#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */
14#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */
15 /* Note: the ioctl VT_GETSTATE does not work for
16 consoles 16 and higher (since it returns a short) */
17
18#ifdef __KERNEL__ 8#ifdef __KERNEL__
19#include <linux/fs.h> 9#include <linux/fs.h>
20#include <linux/major.h> 10#include <linux/major.h>
@@ -22,7 +12,6 @@
22#include <linux/workqueue.h> 12#include <linux/workqueue.h>
23#include <linux/tty_driver.h> 13#include <linux/tty_driver.h>
24#include <linux/tty_ldisc.h> 14#include <linux/tty_ldisc.h>
25#include <linux/screen_info.h>
26#include <linux/mutex.h> 15#include <linux/mutex.h>
27 16
28#include <asm/system.h> 17#include <asm/system.h>
@@ -57,7 +46,6 @@ struct tty_buffer {
57 unsigned char *flag_buf_ptr; 46 unsigned char *flag_buf_ptr;
58 int used; 47 int used;
59 int size; 48 int size;
60 int active;
61 int commit; 49 int commit;
62 int read; 50 int read;
63 /* Data points here */ 51 /* Data points here */
@@ -71,6 +59,7 @@ struct tty_bufhead {
71 struct tty_buffer *head; /* Queue head */ 59 struct tty_buffer *head; /* Queue head */
72 struct tty_buffer *tail; /* Active buffer */ 60 struct tty_buffer *tail; /* Active buffer */
73 struct tty_buffer *free; /* Free queue head */ 61 struct tty_buffer *free; /* Free queue head */
62 int memory_used; /* Buffer space used excluding free queue */
74}; 63};
75/* 64/*
76 * The pty uses char_buf and flag_buf as a contiguous buffer 65 * The pty uses char_buf and flag_buf as a contiguous buffer
@@ -185,7 +174,7 @@ struct tty_struct {
185 struct tty_driver *driver; 174 struct tty_driver *driver;
186 int index; 175 int index;
187 struct tty_ldisc ldisc; 176 struct tty_ldisc ldisc;
188 struct semaphore termios_sem; 177 struct mutex termios_mutex;
189 struct termios *termios, *termios_locked; 178 struct termios *termios, *termios_locked;
190 char name[64]; 179 char name[64];
191 int pgrp; 180 int pgrp;
@@ -201,7 +190,6 @@ struct tty_struct {
201 struct tty_struct *link; 190 struct tty_struct *link;
202 struct fasync_struct *fasync; 191 struct fasync_struct *fasync;
203 struct tty_bufhead buf; 192 struct tty_bufhead buf;
204 int max_flip_cnt;
205 int alt_speed; /* For magic substitution of 38400 bps */ 193 int alt_speed; /* For magic substitution of 38400 bps */
206 wait_queue_head_t write_wait; 194 wait_queue_head_t write_wait;
207 wait_queue_head_t read_wait; 195 wait_queue_head_t read_wait;
@@ -259,7 +247,6 @@ struct tty_struct {
259#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ 247#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */
260#define TTY_PUSH 6 /* n_tty private */ 248#define TTY_PUSH 6 /* n_tty private */
261#define TTY_CLOSING 7 /* ->close() in progress */ 249#define TTY_CLOSING 7 /* ->close() in progress */
262#define TTY_DONT_FLIP 8 /* Defer buffer flip */
263#define TTY_LDISC 9 /* Line discipline attached */ 250#define TTY_LDISC 9 /* Line discipline attached */
264#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */ 251#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */
265#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */ 252#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */
@@ -272,7 +259,6 @@ struct tty_struct {
272extern void tty_write_flush(struct tty_struct *); 259extern void tty_write_flush(struct tty_struct *);
273 260
274extern struct termios tty_std_termios; 261extern struct termios tty_std_termios;
275extern int fg_console, last_console, want_console;
276 262
277extern int kmsg_redirect; 263extern int kmsg_redirect;
278 264
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index b368b296d035..58c961c9e170 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -157,7 +157,6 @@ struct tty_driver {
157 struct cdev cdev; 157 struct cdev cdev;
158 struct module *owner; 158 struct module *owner;
159 const char *driver_name; 159 const char *driver_name;
160 const char *devfs_name;
161 const char *name; 160 const char *name;
162 int name_base; /* offset of printed name */ 161 int name_base; /* offset of printed name */
163 int major; /* major device number */ 162 int major; /* major device number */
@@ -242,8 +241,15 @@ void tty_set_operations(struct tty_driver *driver, struct tty_operations *op);
242 * is also a promise, if the above case is true, not to signal 241 * is also a promise, if the above case is true, not to signal
243 * overruns, either.) 242 * overruns, either.)
244 * 243 *
245 * TTY_DRIVER_NO_DEVFS --- if set, do not create devfs entries. This 244 * TTY_DRIVER_DYNAMIC_DEV --- if set, the individual tty devices need
246 * is only used by tty_register_driver(). 245 * to be registered with a call to tty_register_driver() when the
246 * device is found in the system and unregistered with a call to
247 * tty_unregister_device() so the devices will be show up
248 * properly in sysfs. If not set, driver->num entries will be
249 * created by the tty core in sysfs when tty_register_driver() is
250 * called. This is to be used by drivers that have tty devices
251 * that can appear and disappear while the main tty driver is
252 * registered with the tty core.
247 * 253 *
248 * TTY_DRIVER_DEVPTS_MEM -- don't use the standard arrays, instead 254 * TTY_DRIVER_DEVPTS_MEM -- don't use the standard arrays, instead
249 * use dynamic memory keyed through the devpts filesystem. This 255 * use dynamic memory keyed through the devpts filesystem. This
@@ -252,7 +258,7 @@ void tty_set_operations(struct tty_driver *driver, struct tty_operations *op);
252#define TTY_DRIVER_INSTALLED 0x0001 258#define TTY_DRIVER_INSTALLED 0x0001
253#define TTY_DRIVER_RESET_TERMIOS 0x0002 259#define TTY_DRIVER_RESET_TERMIOS 0x0002
254#define TTY_DRIVER_REAL_RAW 0x0004 260#define TTY_DRIVER_REAL_RAW 0x0004
255#define TTY_DRIVER_NO_DEVFS 0x0008 261#define TTY_DRIVER_DYNAMIC_DEV 0x0008
256#define TTY_DRIVER_DEVPTS_MEM 0x0010 262#define TTY_DRIVER_DEVPTS_MEM 0x0010
257 263
258/* tty driver types */ 264/* tty driver types */
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 31548303ee37..eb677cf56106 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -12,7 +12,7 @@ static inline int tty_insert_flip_char(struct tty_struct *tty,
12 unsigned char ch, char flag) 12 unsigned char ch, char flag)
13{ 13{
14 struct tty_buffer *tb = tty->buf.tail; 14 struct tty_buffer *tb = tty->buf.tail;
15 if (tb && tb->active && tb->used < tb->size) { 15 if (tb && tb->used < tb->size) {
16 tb->flag_buf_ptr[tb->used] = flag; 16 tb->flag_buf_ptr[tb->used] = flag;
17 tb->char_buf_ptr[tb->used++] = ch; 17 tb->char_buf_ptr[tb->used++] = ch;
18 return 1; 18 return 1;
diff --git a/include/linux/types.h b/include/linux/types.h
index a5e46e783ffa..3f235660a3cd 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -177,8 +177,15 @@ typedef __u64 __bitwise __be64;
177 177
178#ifdef __KERNEL__ 178#ifdef __KERNEL__
179typedef unsigned __bitwise__ gfp_t; 179typedef unsigned __bitwise__ gfp_t;
180
181#ifdef CONFIG_RESOURCES_64BIT
182typedef u64 resource_size_t;
183#else
184typedef u32 resource_size_t;
180#endif 185#endif
181 186
187#endif /* __KERNEL__ */
188
182struct ustat { 189struct ustat {
183 __kernel_daddr_t f_tfree; 190 __kernel_daddr_t f_tfree;
184 __kernel_ino_t f_tinode; 191 __kernel_ino_t f_tinode;
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 391e7ed1eb3f..a48d7f11c7be 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -19,4 +19,26 @@ static inline unsigned long __copy_from_user_nocache(void *to,
19 19
20#endif /* ARCH_HAS_NOCACHE_UACCESS */ 20#endif /* ARCH_HAS_NOCACHE_UACCESS */
21 21
22/**
23 * probe_kernel_address(): safely attempt to read from a location
24 * @addr: address to read from - its type is type typeof(retval)*
25 * @retval: read into this variable
26 *
27 * Safely read from address @addr into variable @revtal. If a kernel fault
28 * happens, handle that and return -EFAULT.
29 * We ensure that the __get_user() is executed in atomic context so that
30 * do_page_fault() doesn't attempt to take mmap_sem. This makes
31 * probe_kernel_address() suitable for use within regions where the caller
32 * already holds mmap_sem, or other locks which nest inside mmap_sem.
33 */
34#define probe_kernel_address(addr, retval) \
35 ({ \
36 long ret; \
37 \
38 inc_preempt_count(); \
39 ret = __get_user(retval, addr); \
40 dec_preempt_count(); \
41 ret; \
42 })
43
22#endif /* __LINUX_UACCESS_H__ */ 44#endif /* __LINUX_UACCESS_H__ */
diff --git a/include/linux/udp.h b/include/linux/udp.h
index bdd39be09406..014b41d1e308 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -20,10 +20,10 @@
20#include <linux/types.h> 20#include <linux/types.h>
21 21
22struct udphdr { 22struct udphdr {
23 __u16 source; 23 __be16 source;
24 __u16 dest; 24 __be16 dest;
25 __u16 len; 25 __be16 len;
26 __u16 check; 26 __be16 check;
27}; 27};
28 28
29/* UDP socket options */ 29/* UDP socket options */
@@ -46,7 +46,7 @@ struct udp_sock {
46 unsigned int corkflag; /* Cork is required */ 46 unsigned int corkflag; /* Cork is required */
47 __u16 encap_type; /* Is this an Encapsulation socket? */ 47 __u16 encap_type; /* Is this an Encapsulation socket? */
48 /* 48 /*
49 * Following member retains the infomation to create a UDP header 49 * Following member retains the information to create a UDP header
50 * when the socket is uncorked. 50 * when the socket is uncorked.
51 */ 51 */
52 __u16 len; /* total length of pending frames */ 52 __u16 len; /* total length of pending frames */
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index 86b5b4271b5a..fc62887c5206 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -220,6 +220,19 @@ typedef __u16 __bitwise __fs16;
220 */ 220 */
221#define UFS_MINFREE 5 221#define UFS_MINFREE 5
222#define UFS_DEFAULTOPT UFS_OPTTIME 222#define UFS_DEFAULTOPT UFS_OPTTIME
223
224/*
225 * Debug code
226 */
227#ifdef CONFIG_UFS_DEBUG
228# define UFSD(f, a...) { \
229 printk ("UFSD (%s, %d): %s:", \
230 __FILE__, __LINE__, __FUNCTION__); \
231 printk (f, ## a); \
232 }
233#else
234# define UFSD(f, a...) /**/
235#endif
223 236
224/* 237/*
225 * Turn file system block numbers into disk block addresses. 238 * Turn file system block numbers into disk block addresses.
@@ -339,7 +352,22 @@ struct ufs2_csum_total {
339}; 352};
340 353
341/* 354/*
355 * File system flags
356 */
357#define UFS_UNCLEAN 0x01 /* file system not clean at mount (unused) */
358#define UFS_DOSOFTDEP 0x02 /* file system using soft dependencies */
359#define UFS_NEEDSFSCK 0x04 /* needs sync fsck (FreeBSD compat, unused) */
360#define UFS_INDEXDIRS 0x08 /* kernel supports indexed directories */
361#define UFS_ACLS 0x10 /* file system has ACLs enabled */
362#define UFS_MULTILABEL 0x20 /* file system is MAC multi-label */
363#define UFS_FLAGS_UPDATED 0x80 /* flags have been moved to new location */
364
365#if 0
366/*
342 * This is the actual superblock, as it is laid out on the disk. 367 * This is the actual superblock, as it is laid out on the disk.
368 * Do NOT use this structure, because of sizeof(ufs_super_block) > 512 and
369 * it may occupy several blocks, use
370 * struct ufs_super_block_(first,second,third) instead.
343 */ 371 */
344struct ufs_super_block { 372struct ufs_super_block {
345 __fs32 fs_link; /* UNUSED */ 373 __fs32 fs_link; /* UNUSED */
@@ -416,7 +444,7 @@ struct ufs_super_block {
416 __s8 fs_fmod; /* super block modified flag */ 444 __s8 fs_fmod; /* super block modified flag */
417 __s8 fs_clean; /* file system is clean flag */ 445 __s8 fs_clean; /* file system is clean flag */
418 __s8 fs_ronly; /* mounted read-only flag */ 446 __s8 fs_ronly; /* mounted read-only flag */
419 __s8 fs_flags; /* currently unused flag */ 447 __s8 fs_flags;
420 union { 448 union {
421 struct { 449 struct {
422 __s8 fs_fsmnt[UFS_MAXMNTLEN];/* name mounted on */ 450 __s8 fs_fsmnt[UFS_MAXMNTLEN];/* name mounted on */
@@ -485,6 +513,7 @@ struct ufs_super_block {
485 __fs32 fs_magic; /* magic number */ 513 __fs32 fs_magic; /* magic number */
486 __u8 fs_space[1]; /* list of blocks for each rotation */ 514 __u8 fs_space[1]; /* list of blocks for each rotation */
487}; 515};
516#endif/*struct ufs_super_block*/
488 517
489/* 518/*
490 * Preference for optimization. 519 * Preference for optimization.
@@ -666,7 +695,7 @@ struct ufs_buffer_head {
666}; 695};
667 696
668struct ufs_cg_private_info { 697struct ufs_cg_private_info {
669 struct ufs_cylinder_group ucg; 698 struct ufs_buffer_head c_ubh;
670 __u32 c_cgx; /* number of cylidner group */ 699 __u32 c_cgx; /* number of cylidner group */
671 __u16 c_ncyl; /* number of cyl's this cg */ 700 __u16 c_ncyl; /* number of cyl's this cg */
672 __u16 c_niblk; /* number of inode blocks this cg */ 701 __u16 c_niblk; /* number of inode blocks this cg */
@@ -686,6 +715,7 @@ struct ufs_cg_private_info {
686 715
687struct ufs_sb_private_info { 716struct ufs_sb_private_info {
688 struct ufs_buffer_head s_ubh; /* buffer containing super block */ 717 struct ufs_buffer_head s_ubh; /* buffer containing super block */
718 struct ufs2_csum_total cs_total;
689 __u32 s_sblkno; /* offset of super-blocks in filesys */ 719 __u32 s_sblkno; /* offset of super-blocks in filesys */
690 __u32 s_cblkno; /* offset of cg-block in filesys */ 720 __u32 s_cblkno; /* offset of cg-block in filesys */
691 __u32 s_iblkno; /* offset of inode-blocks in filesys */ 721 __u32 s_iblkno; /* offset of inode-blocks in filesys */
@@ -824,16 +854,54 @@ struct ufs_super_block_first {
824}; 854};
825 855
826struct ufs_super_block_second { 856struct ufs_super_block_second {
827 __s8 fs_fsmnt[212]; 857 union {
828 __fs32 fs_cgrotor; 858 struct {
829 __fs32 fs_csp[UFS_MAXCSBUFS]; 859 __s8 fs_fsmnt[212];
830 __fs32 fs_maxcluster; 860 __fs32 fs_cgrotor;
831 __fs32 fs_cpc; 861 __fs32 fs_csp[UFS_MAXCSBUFS];
832 __fs16 fs_opostbl[82]; 862 __fs32 fs_maxcluster;
833}; 863 __fs32 fs_cpc;
864 __fs16 fs_opostbl[82];
865 } fs_u1;
866 struct {
867 __s8 fs_fsmnt[UFS2_MAXMNTLEN - UFS_MAXMNTLEN + 212];
868 __u8 fs_volname[UFS2_MAXVOLLEN];
869 __fs64 fs_swuid;
870 __fs32 fs_pad;
871 __fs32 fs_cgrotor;
872 __fs32 fs_ocsp[UFS2_NOCSPTRS];
873 __fs32 fs_contigdirs;
874 __fs32 fs_csp;
875 __fs32 fs_maxcluster;
876 __fs32 fs_active;
877 __fs32 fs_old_cpc;
878 __fs32 fs_maxbsize;
879 __fs64 fs_sparecon64[17];
880 __fs64 fs_sblockloc;
881 __fs64 cs_ndir;
882 __fs64 cs_nbfree;
883 } fs_u2;
884 } fs_un;
885};
834 886
835struct ufs_super_block_third { 887struct ufs_super_block_third {
836 __fs16 fs_opostbl[46]; 888 union {
889 struct {
890 __fs16 fs_opostbl[46];
891 } fs_u1;
892 struct {
893 __fs64 cs_nifree; /* number of free inodes */
894 __fs64 cs_nffree; /* number of free frags */
895 __fs64 cs_numclusters; /* number of free clusters */
896 __fs64 cs_spare[3]; /* future expansion */
897 struct ufs_timeval fs_time; /* last time written */
898 __fs64 fs_size; /* number of blocks in fs */
899 __fs64 fs_dsize; /* number of data blocks in fs */
900 __fs64 fs_csaddr; /* blk addr of cyl grp summary area */
901 __fs64 fs_pendingblocks;/* blocks in process of being freed */
902 __fs32 fs_pendinginodes;/*inodes in process of being freed */
903 } fs_u2;
904 } fs_un1;
837 union { 905 union {
838 struct { 906 struct {
839 __fs32 fs_sparecon[53];/* reserved for future constants */ 907 __fs32 fs_sparecon[53];/* reserved for future constants */
@@ -861,7 +929,7 @@ struct ufs_super_block_third {
861 __fs32 fs_qfmask[2]; /* ~usb_fmask */ 929 __fs32 fs_qfmask[2]; /* ~usb_fmask */
862 __fs32 fs_state; /* file system state time stamp */ 930 __fs32 fs_state; /* file system state time stamp */
863 } fs_44; 931 } fs_44;
864 } fs_u2; 932 } fs_un2;
865 __fs32 fs_postblformat; 933 __fs32 fs_postblformat;
866 __fs32 fs_nrpos; 934 __fs32 fs_nrpos;
867 __fs32 fs_postbloff; 935 __fs32 fs_postbloff;
@@ -875,7 +943,8 @@ struct ufs_super_block_third {
875/* balloc.c */ 943/* balloc.c */
876extern void ufs_free_fragments (struct inode *, unsigned, unsigned); 944extern void ufs_free_fragments (struct inode *, unsigned, unsigned);
877extern void ufs_free_blocks (struct inode *, unsigned, unsigned); 945extern void ufs_free_blocks (struct inode *, unsigned, unsigned);
878extern unsigned ufs_new_fragments (struct inode *, __fs32 *, unsigned, unsigned, unsigned, int *); 946extern unsigned ufs_new_fragments(struct inode *, __fs32 *, unsigned, unsigned,
947 unsigned, int *, struct page *);
879 948
880/* cylinder.c */ 949/* cylinder.c */
881extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned); 950extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
@@ -886,30 +955,29 @@ extern struct inode_operations ufs_dir_inode_operations;
886extern int ufs_add_link (struct dentry *, struct inode *); 955extern int ufs_add_link (struct dentry *, struct inode *);
887extern ino_t ufs_inode_by_name(struct inode *, struct dentry *); 956extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
888extern int ufs_make_empty(struct inode *, struct inode *); 957extern int ufs_make_empty(struct inode *, struct inode *);
889extern struct ufs_dir_entry * ufs_find_entry (struct dentry *, struct buffer_head **); 958extern struct ufs_dir_entry *ufs_find_entry(struct inode *, struct dentry *, struct page **);
890extern int ufs_delete_entry (struct inode *, struct ufs_dir_entry *, struct buffer_head *); 959extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
891extern int ufs_empty_dir (struct inode *); 960extern int ufs_empty_dir (struct inode *);
892extern struct ufs_dir_entry * ufs_dotdot (struct inode *, struct buffer_head **); 961extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
893extern void ufs_set_link(struct inode *, struct ufs_dir_entry *, struct buffer_head *, struct inode *); 962extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
963 struct page *page, struct inode *inode);
894 964
895/* file.c */ 965/* file.c */
896extern struct inode_operations ufs_file_inode_operations; 966extern struct inode_operations ufs_file_inode_operations;
897extern const struct file_operations ufs_file_operations; 967extern const struct file_operations ufs_file_operations;
898 968
899extern struct address_space_operations ufs_aops; 969extern const struct address_space_operations ufs_aops;
900 970
901/* ialloc.c */ 971/* ialloc.c */
902extern void ufs_free_inode (struct inode *inode); 972extern void ufs_free_inode (struct inode *inode);
903extern struct inode * ufs_new_inode (struct inode *, int); 973extern struct inode * ufs_new_inode (struct inode *, int);
904 974
905/* inode.c */ 975/* inode.c */
906extern u64 ufs_frag_map (struct inode *, sector_t);
907extern void ufs_read_inode (struct inode *); 976extern void ufs_read_inode (struct inode *);
908extern void ufs_put_inode (struct inode *); 977extern void ufs_put_inode (struct inode *);
909extern int ufs_write_inode (struct inode *, int); 978extern int ufs_write_inode (struct inode *, int);
910extern int ufs_sync_inode (struct inode *); 979extern int ufs_sync_inode (struct inode *);
911extern void ufs_delete_inode (struct inode *); 980extern void ufs_delete_inode (struct inode *);
912extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *);
913extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *); 981extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
914extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create); 982extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
915 983
@@ -925,7 +993,7 @@ extern void ufs_panic (struct super_block *, const char *, const char *, ...) __
925extern struct inode_operations ufs_fast_symlink_inode_operations; 993extern struct inode_operations ufs_fast_symlink_inode_operations;
926 994
927/* truncate.c */ 995/* truncate.c */
928extern void ufs_truncate (struct inode *); 996extern int ufs_truncate (struct inode *, loff_t);
929 997
930static inline struct ufs_sb_info *UFS_SB(struct super_block *sb) 998static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
931{ 999{
diff --git a/include/linux/ufs_fs_i.h b/include/linux/ufs_fs_i.h
index 21665a953978..f50ce3b0cd52 100644
--- a/include/linux/ufs_fs_i.h
+++ b/include/linux/ufs_fs_i.h
@@ -27,6 +27,7 @@ struct ufs_inode_info {
27 __u32 i_oeftflag; 27 __u32 i_oeftflag;
28 __u16 i_osync; 28 __u16 i_osync;
29 __u32 i_lastfrag; 29 __u32 i_lastfrag;
30 __u32 i_dir_start_lookup;
30 struct inode vfs_inode; 31 struct inode vfs_inode;
31}; 32};
32 33
diff --git a/include/linux/unwind.h b/include/linux/unwind.h
new file mode 100644
index 000000000000..ce48e2cd37a2
--- /dev/null
+++ b/include/linux/unwind.h
@@ -0,0 +1,127 @@
1#ifndef _LINUX_UNWIND_H
2#define _LINUX_UNWIND_H
3
4/*
5 * Copyright (C) 2002-2006 Novell, Inc.
6 * Jan Beulich <jbeulich@novell.com>
7 * This code is released under version 2 of the GNU GPL.
8 *
9 * A simple API for unwinding kernel stacks. This is used for
10 * debugging and error reporting purposes. The kernel doesn't need
11 * full-blown stack unwinding with all the bells and whistles, so there
12 * is not much point in implementing the full Dwarf2 unwind API.
13 */
14
15#include <linux/config.h>
16
17struct module;
18
19#ifdef CONFIG_STACK_UNWIND
20
21#include <asm/unwind.h>
22
23#ifndef ARCH_UNWIND_SECTION_NAME
24#define ARCH_UNWIND_SECTION_NAME ".eh_frame"
25#endif
26
27/*
28 * Initialize unwind support.
29 */
30extern void unwind_init(void);
31
32#ifdef CONFIG_MODULES
33
34extern void *unwind_add_table(struct module *,
35 const void *table_start,
36 unsigned long table_size);
37
38extern void unwind_remove_table(void *handle, int init_only);
39
40#endif
41
42extern int unwind_init_frame_info(struct unwind_frame_info *,
43 struct task_struct *,
44 /*const*/ struct pt_regs *);
45
46/*
47 * Prepare to unwind a blocked task.
48 */
49extern int unwind_init_blocked(struct unwind_frame_info *,
50 struct task_struct *);
51
52/*
53 * Prepare to unwind the currently running thread.
54 */
55extern int unwind_init_running(struct unwind_frame_info *,
56 asmlinkage int (*callback)(struct unwind_frame_info *,
57 void *arg),
58 void *arg);
59
60/*
61 * Unwind to previous to frame. Returns 0 if successful, negative
62 * number in case of an error.
63 */
64extern int unwind(struct unwind_frame_info *);
65
66/*
67 * Unwind until the return pointer is in user-land (or until an error
68 * occurs). Returns 0 if successful, negative number in case of
69 * error.
70 */
71extern int unwind_to_user(struct unwind_frame_info *);
72
73#else
74
75struct unwind_frame_info {};
76
77static inline void unwind_init(void) {}
78
79#ifdef CONFIG_MODULES
80
81static inline void *unwind_add_table(struct module *mod,
82 const void *table_start,
83 unsigned long table_size)
84{
85 return NULL;
86}
87
88#endif
89
90static inline void unwind_remove_table(void *handle, int init_only)
91{
92}
93
94static inline int unwind_init_frame_info(struct unwind_frame_info *info,
95 struct task_struct *tsk,
96 const struct pt_regs *regs)
97{
98 return -ENOSYS;
99}
100
101static inline int unwind_init_blocked(struct unwind_frame_info *info,
102 struct task_struct *tsk)
103{
104 return -ENOSYS;
105}
106
107static inline int unwind_init_running(struct unwind_frame_info *info,
108 asmlinkage int (*cb)(struct unwind_frame_info *,
109 void *arg),
110 void *arg)
111{
112 return -ENOSYS;
113}
114
115static inline int unwind(struct unwind_frame_info *info)
116{
117 return -ENOSYS;
118}
119
120static inline int unwind_to_user(struct unwind_frame_info *info)
121{
122 return -ENOSYS;
123}
124
125#endif
126
127#endif /* _LINUX_UNWIND_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 8dead32e7ebf..190cc1b78fe2 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -19,6 +19,7 @@
19#include <linux/fs.h> /* for struct file_operations */ 19#include <linux/fs.h> /* for struct file_operations */
20#include <linux/completion.h> /* for struct completion */ 20#include <linux/completion.h> /* for struct completion */
21#include <linux/sched.h> /* for current && schedule_timeout */ 21#include <linux/sched.h> /* for current && schedule_timeout */
22#include <linux/mutex.h> /* for struct mutex */
22 23
23struct usb_device; 24struct usb_device;
24struct usb_driver; 25struct usb_driver;
@@ -48,7 +49,7 @@ struct ep_device;
48 * @urb_list: urbs queued to this endpoint; maintained by usbcore 49 * @urb_list: urbs queued to this endpoint; maintained by usbcore
49 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) 50 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
50 * with one or more transfer descriptors (TDs) per urb 51 * with one or more transfer descriptors (TDs) per urb
51 * @kobj: kobject for sysfs info 52 * @ep_dev: ep_device for sysfs info
52 * @extra: descriptors following this endpoint in the configuration 53 * @extra: descriptors following this endpoint in the configuration
53 * @extralen: how many bytes of "extra" are valid 54 * @extralen: how many bytes of "extra" are valid
54 * 55 *
@@ -102,9 +103,13 @@ enum usb_interface_condition {
102 * number from the USB core by calling usb_register_dev(). 103 * number from the USB core by calling usb_register_dev().
103 * @condition: binding state of the interface: not bound, binding 104 * @condition: binding state of the interface: not bound, binding
104 * (in probe()), bound to a driver, or unbinding (in disconnect()) 105 * (in probe()), bound to a driver, or unbinding (in disconnect())
106 * @is_active: flag set when the interface is bound and not suspended.
107 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
108 * capability during autosuspend.
105 * @dev: driver model's view of this device 109 * @dev: driver model's view of this device
106 * @usb_dev: if an interface is bound to the USB major, this will point 110 * @class_dev: driver model's class view of this device.
107 * to the sysfs representation for that device. 111 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not
112 * allowed unless the counter is 0.
108 * 113 *
109 * USB device drivers attach to interfaces on a physical device. Each 114 * USB device drivers attach to interfaces on a physical device. Each
110 * interface encapsulates a single high level function, such as feeding 115 * interface encapsulates a single high level function, such as feeding
@@ -143,8 +148,12 @@ struct usb_interface {
143 int minor; /* minor number this interface is 148 int minor; /* minor number this interface is
144 * bound to */ 149 * bound to */
145 enum usb_interface_condition condition; /* state of binding */ 150 enum usb_interface_condition condition; /* state of binding */
151 unsigned is_active:1; /* the interface is not suspended */
152 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
153
146 struct device dev; /* interface specific device info */ 154 struct device dev; /* interface specific device info */
147 struct device *usb_dev; /* pointer to the usb class's device, if any */ 155 struct class_device *class_dev;
156 int pm_usage_cnt; /* usage counter for autosuspend */
148}; 157};
149#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 158#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
150#define interface_to_usbdev(intf) \ 159#define interface_to_usbdev(intf) \
@@ -255,8 +264,6 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
255 264
256/* ----------------------------------------------------------------------- */ 265/* ----------------------------------------------------------------------- */
257 266
258struct usb_operations;
259
260/* USB device number allocation bitmap */ 267/* USB device number allocation bitmap */
261struct usb_devmap { 268struct usb_devmap {
262 unsigned long devicemap[128 / (8*sizeof(unsigned long))]; 269 unsigned long devicemap[128 / (8*sizeof(unsigned long))];
@@ -269,6 +276,7 @@ struct usb_bus {
269 struct device *controller; /* host/master side hardware */ 276 struct device *controller; /* host/master side hardware */
270 int busnum; /* Bus number (in order of reg) */ 277 int busnum; /* Bus number (in order of reg) */
271 char *bus_name; /* stable id (PCI slot_name etc) */ 278 char *bus_name; /* stable id (PCI slot_name etc) */
279 u8 uses_dma; /* Does the host controller use DMA? */
272 u8 otg_port; /* 0, or number of OTG/HNP port */ 280 u8 otg_port; /* 0, or number of OTG/HNP port */
273 unsigned is_b_host:1; /* true during some HNP roleswitches */ 281 unsigned is_b_host:1; /* true during some HNP roleswitches */
274 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ 282 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
@@ -277,10 +285,8 @@ struct usb_bus {
277 * round-robin allocation */ 285 * round-robin allocation */
278 286
279 struct usb_devmap devmap; /* device address allocation map */ 287 struct usb_devmap devmap; /* device address allocation map */
280 struct usb_operations *op; /* Operations (specific to the HC) */
281 struct usb_device *root_hub; /* Root hub */ 288 struct usb_device *root_hub; /* Root hub */
282 struct list_head bus_list; /* list of busses */ 289 struct list_head bus_list; /* list of busses */
283 void *hcpriv; /* Host Controller private data */
284 290
285 int bandwidth_allocated; /* on this bus: how much of the time 291 int bandwidth_allocated; /* on this bus: how much of the time
286 * reserved for periodic (intr/iso) 292 * reserved for periodic (intr/iso)
@@ -295,8 +301,6 @@ struct usb_bus {
295 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 301 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
296 302
297 struct class_device *class_dev; /* class device for this bus */ 303 struct class_device *class_dev; /* class device for this bus */
298 struct kref kref; /* reference counting for this bus */
299 void (*release)(struct usb_bus *bus);
300 304
301#if defined(CONFIG_USB_MON) 305#if defined(CONFIG_USB_MON)
302 struct mon_bus *mon_bus; /* non-null when associated */ 306 struct mon_bus *mon_bus; /* non-null when associated */
@@ -351,6 +355,7 @@ struct usb_device {
351 355
352 unsigned short bus_mA; /* Current available from the bus */ 356 unsigned short bus_mA; /* Current available from the bus */
353 u8 portnum; /* Parent port number (origin 1) */ 357 u8 portnum; /* Parent port number (origin 1) */
358 u8 level; /* Number of USB hub ancestors */
354 359
355 int have_langid; /* whether string_langid is valid */ 360 int have_langid; /* whether string_langid is valid */
356 int string_langid; /* language ID for strings */ 361 int string_langid; /* language ID for strings */
@@ -361,7 +366,7 @@ struct usb_device {
361 char *serial; /* iSerialNumber string, if present */ 366 char *serial; /* iSerialNumber string, if present */
362 367
363 struct list_head filelist; 368 struct list_head filelist;
364 struct device *usbfs_dev; 369 struct class_device *class_dev;
365 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 370 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
366 371
367 /* 372 /*
@@ -374,6 +379,15 @@ struct usb_device {
374 379
375 int maxchild; /* Number of ports if hub */ 380 int maxchild; /* Number of ports if hub */
376 struct usb_device *children[USB_MAXCHILDREN]; 381 struct usb_device *children[USB_MAXCHILDREN];
382
383 int pm_usage_cnt; /* usage counter for autosuspend */
384#ifdef CONFIG_PM
385 struct work_struct autosuspend; /* for delayed autosuspends */
386 struct mutex pm_mutex; /* protects PM operations */
387
388 unsigned auto_pm:1; /* autosuspend/resume in progress */
389 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */
390#endif
377}; 391};
378#define to_usb_device(d) container_of(d, struct usb_device, dev) 392#define to_usb_device(d) container_of(d, struct usb_device, dev)
379 393
@@ -385,7 +399,7 @@ extern void usb_put_dev(struct usb_device *dev);
385#define usb_unlock_device(udev) up(&(udev)->dev.sem) 399#define usb_unlock_device(udev) up(&(udev)->dev.sem)
386#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) 400#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem)
387extern int usb_lock_device_for_reset(struct usb_device *udev, 401extern int usb_lock_device_for_reset(struct usb_device *udev,
388 struct usb_interface *iface); 402 const struct usb_interface *iface);
389 403
390/* USB port reset for device reinitialization */ 404/* USB port reset for device reinitialization */
391extern int usb_reset_device(struct usb_device *dev); 405extern int usb_reset_device(struct usb_device *dev);
@@ -394,6 +408,17 @@ extern int usb_reset_composite_device(struct usb_device *dev,
394 408
395extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); 409extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
396 410
411/* USB autosuspend and autoresume */
412#ifdef CONFIG_USB_SUSPEND
413extern int usb_autopm_get_interface(struct usb_interface *intf);
414extern void usb_autopm_put_interface(struct usb_interface *intf);
415
416#else
417#define usb_autopm_get_interface(intf) 0
418#define usb_autopm_put_interface(intf) do {} while (0)
419#endif
420
421
397/*-------------------------------------------------------------------------*/ 422/*-------------------------------------------------------------------------*/
398 423
399/* for drivers using iso endpoints */ 424/* for drivers using iso endpoints */
@@ -424,10 +449,10 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface,
424 449
425extern struct usb_interface *usb_find_interface(struct usb_driver *drv, 450extern struct usb_interface *usb_find_interface(struct usb_driver *drv,
426 int minor); 451 int minor);
427extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, 452extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev,
428 unsigned ifnum); 453 unsigned ifnum);
429extern struct usb_host_interface *usb_altnum_to_altsetting( 454extern struct usb_host_interface *usb_altnum_to_altsetting(
430 struct usb_interface *intf, unsigned int altnum); 455 const struct usb_interface *intf, unsigned int altnum);
431 456
432 457
433/** 458/**
@@ -465,6 +490,20 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
465 490
466/*-------------------------------------------------------------------------*/ 491/*-------------------------------------------------------------------------*/
467 492
493extern int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd);
494extern int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd);
495extern int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd);
496extern int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd);
497extern int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd);
498extern int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd);
499extern int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd);
500extern int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd);
501extern int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd);
502extern int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd);
503extern int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd);
504
505/*-------------------------------------------------------------------------*/
506
468#define USB_DEVICE_ID_MATCH_DEVICE \ 507#define USB_DEVICE_ID_MATCH_DEVICE \
469 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) 508 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
470#define USB_DEVICE_ID_MATCH_DEV_RANGE \ 509#define USB_DEVICE_ID_MATCH_DEV_RANGE \
@@ -541,7 +580,17 @@ struct usb_dynids {
541}; 580};
542 581
543/** 582/**
544 * struct usb_driver - identifies USB driver to usbcore 583 * struct usbdrv_wrap - wrapper for driver-model structure
584 * @driver: The driver-model core driver structure.
585 * @for_devices: Non-zero for device drivers, 0 for interface drivers.
586 */
587struct usbdrv_wrap {
588 struct device_driver driver;
589 int for_devices;
590};
591
592/**
593 * struct usb_driver - identifies USB interface driver to usbcore
545 * @name: The driver name should be unique among USB drivers, 594 * @name: The driver name should be unique among USB drivers,
546 * and should normally be the same as the module name. 595 * and should normally be the same as the module name.
547 * @probe: Called to see if the driver is willing to manage a particular 596 * @probe: Called to see if the driver is willing to manage a particular
@@ -568,12 +617,14 @@ struct usb_dynids {
568 * or your driver's probe function will never get called. 617 * or your driver's probe function will never get called.
569 * @dynids: used internally to hold the list of dynamically added device 618 * @dynids: used internally to hold the list of dynamically added device
570 * ids for this driver. 619 * ids for this driver.
571 * @driver: the driver model core driver structure. 620 * @drvwrap: Driver-model core structure wrapper.
572 * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be 621 * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be
573 * added to this driver by preventing the sysfs file from being created. 622 * added to this driver by preventing the sysfs file from being created.
623 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
624 * for interfaces bound to this driver.
574 * 625 *
575 * USB drivers must provide a name, probe() and disconnect() methods, 626 * USB interface drivers must provide a name, probe() and disconnect()
576 * and an id_table. Other driver fields are optional. 627 * methods, and an id_table. Other driver fields are optional.
577 * 628 *
578 * The id_table is used in hotplugging. It holds a set of descriptors, 629 * The id_table is used in hotplugging. It holds a set of descriptors,
579 * and specialized data may be associated with each entry. That table 630 * and specialized data may be associated with each entry. That table
@@ -607,10 +658,44 @@ struct usb_driver {
607 const struct usb_device_id *id_table; 658 const struct usb_device_id *id_table;
608 659
609 struct usb_dynids dynids; 660 struct usb_dynids dynids;
610 struct device_driver driver; 661 struct usbdrv_wrap drvwrap;
611 unsigned int no_dynamic_id:1; 662 unsigned int no_dynamic_id:1;
663 unsigned int supports_autosuspend:1;
612}; 664};
613#define to_usb_driver(d) container_of(d, struct usb_driver, driver) 665#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver)
666
667/**
668 * struct usb_device_driver - identifies USB device driver to usbcore
669 * @name: The driver name should be unique among USB drivers,
670 * and should normally be the same as the module name.
671 * @probe: Called to see if the driver is willing to manage a particular
672 * device. If it is, probe returns zero and uses dev_set_drvdata()
673 * to associate driver-specific data with the device. If unwilling
674 * to manage the device, return a negative errno value.
675 * @disconnect: Called when the device is no longer accessible, usually
676 * because it has been (or is being) disconnected or the driver's
677 * module is being unloaded.
678 * @suspend: Called when the device is going to be suspended by the system.
679 * @resume: Called when the device is being resumed by the system.
680 * @drvwrap: Driver-model core structure wrapper.
681 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
682 * for devices bound to this driver.
683 *
684 * USB drivers must provide all the fields listed above except drvwrap.
685 */
686struct usb_device_driver {
687 const char *name;
688
689 int (*probe) (struct usb_device *udev);
690 void (*disconnect) (struct usb_device *udev);
691
692 int (*suspend) (struct usb_device *udev, pm_message_t message);
693 int (*resume) (struct usb_device *udev);
694 struct usbdrv_wrap drvwrap;
695 unsigned int supports_autosuspend:1;
696};
697#define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \
698 drvwrap.driver)
614 699
615extern struct bus_type usb_bus_type; 700extern struct bus_type usb_bus_type;
616 701
@@ -634,13 +719,17 @@ struct usb_class_driver {
634 * use these in module_init()/module_exit() 719 * use these in module_init()/module_exit()
635 * and don't forget MODULE_DEVICE_TABLE(usb, ...) 720 * and don't forget MODULE_DEVICE_TABLE(usb, ...)
636 */ 721 */
637int usb_register_driver(struct usb_driver *, struct module *); 722extern int usb_register_driver(struct usb_driver *, struct module *);
638static inline int usb_register(struct usb_driver *driver) 723static inline int usb_register(struct usb_driver *driver)
639{ 724{
640 return usb_register_driver(driver, THIS_MODULE); 725 return usb_register_driver(driver, THIS_MODULE);
641} 726}
642extern void usb_deregister(struct usb_driver *); 727extern void usb_deregister(struct usb_driver *);
643 728
729extern int usb_register_device_driver(struct usb_device_driver *,
730 struct module *);
731extern void usb_deregister_device_driver(struct usb_device_driver *);
732
644extern int usb_register_dev(struct usb_interface *intf, 733extern int usb_register_dev(struct usb_interface *intf,
645 struct usb_class_driver *class_driver); 734 struct usb_class_driver *class_driver);
646extern void usb_deregister_dev(struct usb_interface *intf, 735extern void usb_deregister_dev(struct usb_interface *intf,
@@ -886,7 +975,7 @@ struct urb
886 * @setup_packet: pointer to the setup_packet buffer 975 * @setup_packet: pointer to the setup_packet buffer
887 * @transfer_buffer: pointer to the transfer buffer 976 * @transfer_buffer: pointer to the transfer buffer
888 * @buffer_length: length of the transfer buffer 977 * @buffer_length: length of the transfer buffer
889 * @complete: pointer to the usb_complete_t function 978 * @complete_fn: pointer to the usb_complete_t function
890 * @context: what to set the urb context to. 979 * @context: what to set the urb context to.
891 * 980 *
892 * Initializes a control urb with the proper information needed to submit 981 * Initializes a control urb with the proper information needed to submit
@@ -898,7 +987,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
898 unsigned char *setup_packet, 987 unsigned char *setup_packet,
899 void *transfer_buffer, 988 void *transfer_buffer,
900 int buffer_length, 989 int buffer_length,
901 usb_complete_t complete, 990 usb_complete_t complete_fn,
902 void *context) 991 void *context)
903{ 992{
904 spin_lock_init(&urb->lock); 993 spin_lock_init(&urb->lock);
@@ -907,7 +996,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
907 urb->setup_packet = setup_packet; 996 urb->setup_packet = setup_packet;
908 urb->transfer_buffer = transfer_buffer; 997 urb->transfer_buffer = transfer_buffer;
909 urb->transfer_buffer_length = buffer_length; 998 urb->transfer_buffer_length = buffer_length;
910 urb->complete = complete; 999 urb->complete = complete_fn;
911 urb->context = context; 1000 urb->context = context;
912} 1001}
913 1002
@@ -918,7 +1007,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
918 * @pipe: the endpoint pipe 1007 * @pipe: the endpoint pipe
919 * @transfer_buffer: pointer to the transfer buffer 1008 * @transfer_buffer: pointer to the transfer buffer
920 * @buffer_length: length of the transfer buffer 1009 * @buffer_length: length of the transfer buffer
921 * @complete: pointer to the usb_complete_t function 1010 * @complete_fn: pointer to the usb_complete_t function
922 * @context: what to set the urb context to. 1011 * @context: what to set the urb context to.
923 * 1012 *
924 * Initializes a bulk urb with the proper information needed to submit it 1013 * Initializes a bulk urb with the proper information needed to submit it
@@ -929,7 +1018,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
929 unsigned int pipe, 1018 unsigned int pipe,
930 void *transfer_buffer, 1019 void *transfer_buffer,
931 int buffer_length, 1020 int buffer_length,
932 usb_complete_t complete, 1021 usb_complete_t complete_fn,
933 void *context) 1022 void *context)
934{ 1023{
935 spin_lock_init(&urb->lock); 1024 spin_lock_init(&urb->lock);
@@ -937,7 +1026,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
937 urb->pipe = pipe; 1026 urb->pipe = pipe;
938 urb->transfer_buffer = transfer_buffer; 1027 urb->transfer_buffer = transfer_buffer;
939 urb->transfer_buffer_length = buffer_length; 1028 urb->transfer_buffer_length = buffer_length;
940 urb->complete = complete; 1029 urb->complete = complete_fn;
941 urb->context = context; 1030 urb->context = context;
942} 1031}
943 1032
@@ -948,7 +1037,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
948 * @pipe: the endpoint pipe 1037 * @pipe: the endpoint pipe
949 * @transfer_buffer: pointer to the transfer buffer 1038 * @transfer_buffer: pointer to the transfer buffer
950 * @buffer_length: length of the transfer buffer 1039 * @buffer_length: length of the transfer buffer
951 * @complete: pointer to the usb_complete_t function 1040 * @complete_fn: pointer to the usb_complete_t function
952 * @context: what to set the urb context to. 1041 * @context: what to set the urb context to.
953 * @interval: what to set the urb interval to, encoded like 1042 * @interval: what to set the urb interval to, encoded like
954 * the endpoint descriptor's bInterval value. 1043 * the endpoint descriptor's bInterval value.
@@ -964,7 +1053,7 @@ static inline void usb_fill_int_urb (struct urb *urb,
964 unsigned int pipe, 1053 unsigned int pipe,
965 void *transfer_buffer, 1054 void *transfer_buffer,
966 int buffer_length, 1055 int buffer_length,
967 usb_complete_t complete, 1056 usb_complete_t complete_fn,
968 void *context, 1057 void *context,
969 int interval) 1058 int interval)
970{ 1059{
@@ -973,7 +1062,7 @@ static inline void usb_fill_int_urb (struct urb *urb,
973 urb->pipe = pipe; 1062 urb->pipe = pipe;
974 urb->transfer_buffer = transfer_buffer; 1063 urb->transfer_buffer = transfer_buffer;
975 urb->transfer_buffer_length = buffer_length; 1064 urb->transfer_buffer_length = buffer_length;
976 urb->complete = complete; 1065 urb->complete = complete_fn;
977 urb->context = context; 1066 urb->context = context;
978 if (dev->speed == USB_SPEED_HIGH) 1067 if (dev->speed == USB_SPEED_HIGH)
979 urb->interval = 1 << (interval - 1); 1068 urb->interval = 1 << (interval - 1);
@@ -991,7 +1080,6 @@ extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
991extern int usb_unlink_urb(struct urb *urb); 1080extern int usb_unlink_urb(struct urb *urb);
992extern void usb_kill_urb(struct urb *urb); 1081extern void usb_kill_urb(struct urb *urb);
993 1082
994#define HAVE_USB_BUFFERS
995void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1083void *usb_buffer_alloc (struct usb_device *dev, size_t size,
996 gfp_t mem_flags, dma_addr_t *dma); 1084 gfp_t mem_flags, dma_addr_t *dma);
997void usb_buffer_free (struct usb_device *dev, size_t size, 1085void usb_buffer_free (struct usb_device *dev, size_t size,
@@ -1004,14 +1092,14 @@ void usb_buffer_unmap (struct urb *urb);
1004#endif 1092#endif
1005 1093
1006struct scatterlist; 1094struct scatterlist;
1007int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe, 1095int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe,
1008 struct scatterlist *sg, int nents); 1096 struct scatterlist *sg, int nents);
1009#if 0 1097#if 0
1010void usb_buffer_dmasync_sg (struct usb_device *dev, unsigned pipe, 1098void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe,
1011 struct scatterlist *sg, int n_hw_ents); 1099 struct scatterlist *sg, int n_hw_ents);
1012#endif 1100#endif
1013void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, 1101void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe,
1014 struct scatterlist *sg, int n_hw_ents); 1102 struct scatterlist *sg, int n_hw_ents);
1015 1103
1016/*-------------------------------------------------------------------* 1104/*-------------------------------------------------------------------*
1017 * SYNCHRONOUS CALL SUPPORT * 1105 * SYNCHRONOUS CALL SUPPORT *
@@ -1039,6 +1127,9 @@ extern int usb_clear_halt(struct usb_device *dev, int pipe);
1039extern int usb_reset_configuration(struct usb_device *dev); 1127extern int usb_reset_configuration(struct usb_device *dev);
1040extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); 1128extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate);
1041 1129
1130/* this request isn't really synchronous, but it belongs with the others */
1131extern int usb_driver_set_configuration(struct usb_device *udev, int config);
1132
1042/* 1133/*
1043 * timeouts, in milliseconds, used for sending/receiving control messages 1134 * timeouts, in milliseconds, used for sending/receiving control messages
1044 * they typically complete within a few frames (msec) after they're issued 1135 * they typically complete within a few frames (msec) after they're issued
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
new file mode 100644
index 000000000000..6bd235994dc2
--- /dev/null
+++ b/include/linux/usb/audio.h
@@ -0,0 +1,53 @@
1/*
2 * <linux/usb/audio.h> -- USB Audio definitions.
3 *
4 * Copyright (C) 2006 Thumtronics Pty Ltd.
5 * Developed for Thumtronics by Grey Innovation
6 * Ben Williamson <ben.williamson@greyinnovation.com>
7 *
8 * This software is distributed under the terms of the GNU General Public
9 * License ("GPL") version 2, as published by the Free Software Foundation.
10 *
11 * This file holds USB constants and structures defined
12 * by the USB Device Class Definition for Audio Devices.
13 * Comments below reference relevant sections of that document:
14 *
15 * http://www.usb.org/developers/devclass_docs/audio10.pdf
16 */
17
18#ifndef __LINUX_USB_AUDIO_H
19#define __LINUX_USB_AUDIO_H
20
21#include <linux/types.h>
22
23/* A.2 Audio Interface Subclass Codes */
24#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03
27
28/* 4.3.2 Class-Specific AC Interface Descriptor */
29struct usb_ac_header_descriptor {
30 __u8 bLength; // 8+n
31 __u8 bDescriptorType; // USB_DT_CS_INTERFACE
32 __u8 bDescriptorSubtype; // USB_MS_HEADER
33 __le16 bcdADC; // 0x0100
34 __le16 wTotalLength; // includes Unit and Terminal desc.
35 __u8 bInCollection; // n
36 __u8 baInterfaceNr[]; // [n]
37} __attribute__ ((packed));
38
39#define USB_DT_AC_HEADER_SIZE(n) (8+(n))
40
41/* As above, but more useful for defining your own descriptors: */
42#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \
43struct usb_ac_header_descriptor_##n { \
44 __u8 bLength; \
45 __u8 bDescriptorType; \
46 __u8 bDescriptorSubtype; \
47 __le16 bcdADC; \
48 __le16 wTotalLength; \
49 __u8 bInCollection; \
50 __u8 baInterfaceNr[n]; \
51} __attribute__ ((packed))
52
53#endif
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h
new file mode 100644
index 000000000000..11a97d5ffd34
--- /dev/null
+++ b/include/linux/usb/midi.h
@@ -0,0 +1,112 @@
1/*
2 * <linux/usb/midi.h> -- USB MIDI definitions.
3 *
4 * Copyright (C) 2006 Thumtronics Pty Ltd.
5 * Developed for Thumtronics by Grey Innovation
6 * Ben Williamson <ben.williamson@greyinnovation.com>
7 *
8 * This software is distributed under the terms of the GNU General Public
9 * License ("GPL") version 2, as published by the Free Software Foundation.
10 *
11 * This file holds USB constants and structures defined
12 * by the USB Device Class Definition for MIDI Devices.
13 * Comments below reference relevant sections of that document:
14 *
15 * http://www.usb.org/developers/devclass_docs/midi10.pdf
16 */
17
18#ifndef __LINUX_USB_MIDI_H
19#define __LINUX_USB_MIDI_H
20
21#include <linux/types.h>
22
23/* A.1 MS Class-Specific Interface Descriptor Subtypes */
24#define USB_MS_HEADER 0x01
25#define USB_MS_MIDI_IN_JACK 0x02
26#define USB_MS_MIDI_OUT_JACK 0x03
27#define USB_MS_ELEMENT 0x04
28
29/* A.2 MS Class-Specific Endpoint Descriptor Subtypes */
30#define USB_MS_GENERAL 0x01
31
32/* A.3 MS MIDI IN and OUT Jack Types */
33#define USB_MS_EMBEDDED 0x01
34#define USB_MS_EXTERNAL 0x02
35
36/* 6.1.2.1 Class-Specific MS Interface Header Descriptor */
37struct usb_ms_header_descriptor {
38 __u8 bLength;
39 __u8 bDescriptorType;
40 __u8 bDescriptorSubtype;
41 __le16 bcdMSC;
42 __le16 wTotalLength;
43} __attribute__ ((packed));
44
45#define USB_DT_MS_HEADER_SIZE 7
46
47/* 6.1.2.2 MIDI IN Jack Descriptor */
48struct usb_midi_in_jack_descriptor {
49 __u8 bLength;
50 __u8 bDescriptorType; // USB_DT_CS_INTERFACE
51 __u8 bDescriptorSubtype; // USB_MS_MIDI_IN_JACK
52 __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
53 __u8 bJackID;
54 __u8 iJack;
55} __attribute__ ((packed));
56
57#define USB_DT_MIDI_IN_SIZE 6
58
59struct usb_midi_source_pin {
60 __u8 baSourceID;
61 __u8 baSourcePin;
62} __attribute__ ((packed));
63
64/* 6.1.2.3 MIDI OUT Jack Descriptor */
65struct usb_midi_out_jack_descriptor {
66 __u8 bLength;
67 __u8 bDescriptorType; // USB_DT_CS_INTERFACE
68 __u8 bDescriptorSubtype; // USB_MS_MIDI_OUT_JACK
69 __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
70 __u8 bJackID;
71 __u8 bNrInputPins; // p
72 struct usb_midi_source_pin pins[]; // [p]
73 /*__u8 iJack; -- ommitted due to variable-sized pins[] */
74} __attribute__ ((packed));
75
76#define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p))
77
78/* As above, but more useful for defining your own descriptors: */
79#define DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(p) \
80struct usb_midi_out_jack_descriptor_##p { \
81 __u8 bLength; \
82 __u8 bDescriptorType; \
83 __u8 bDescriptorSubtype; \
84 __u8 bJackType; \
85 __u8 bJackID; \
86 __u8 bNrInputPins; \
87 struct usb_midi_source_pin pins[p]; \
88 __u8 iJack; \
89} __attribute__ ((packed))
90
91/* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */
92struct usb_ms_endpoint_descriptor {
93 __u8 bLength; // 4+n
94 __u8 bDescriptorType; // USB_DT_CS_ENDPOINT
95 __u8 bDescriptorSubtype; // USB_MS_GENERAL
96 __u8 bNumEmbMIDIJack; // n
97 __u8 baAssocJackID[]; // [n]
98} __attribute__ ((packed));
99
100#define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n))
101
102/* As above, but more useful for defining your own descriptors: */
103#define DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(n) \
104struct usb_ms_endpoint_descriptor_##n { \
105 __u8 bLength; \
106 __u8 bDescriptorType; \
107 __u8 bDescriptorSubtype; \
108 __u8 bNumEmbMIDIJack; \
109 __u8 baAssocJackID[n]; \
110} __attribute__ ((packed))
111
112#endif
diff --git a/include/linux/usb_otg.h b/include/linux/usb/otg.h
index f827f6e203c2..9897f7a818c5 100644
--- a/include/linux/usb_otg.h
+++ b/include/linux/usb/otg.h
@@ -1,4 +1,4 @@
1// include/linux/usb_otg.h 1// include/linux/usb/otg.h
2 2
3/* 3/*
4 * These APIs may be used between USB controllers. USB device drivers 4 * These APIs may be used between USB controllers. USB device drivers
@@ -52,7 +52,7 @@ struct otg_transceiver {
52 u16 port_change; 52 u16 port_change;
53 53
54 /* bind/unbind the host controller */ 54 /* bind/unbind the host controller */
55 int (*set_host)(struct otg_transceiver *otg, 55 int (*set_host)(struct otg_transceiver *otg,
56 struct usb_bus *host); 56 struct usb_bus *host);
57 57
58 /* bind/unbind the peripheral controller */ 58 /* bind/unbind the peripheral controller */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
new file mode 100644
index 000000000000..91c983eef899
--- /dev/null
+++ b/include/linux/usb/serial.h
@@ -0,0 +1,300 @@
1/*
2 * USB Serial Converter stuff
3 *
4 * Copyright (C) 1999 - 2005
5 * Greg Kroah-Hartman (greg@kroah.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 */
12
13
14#ifndef __LINUX_USB_SERIAL_H
15#define __LINUX_USB_SERIAL_H
16
17#include <linux/kref.h>
18#include <linux/mutex.h>
19
20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
21#define SERIAL_TTY_MINORS 255 /* loads of devices :) */
22
23#define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */
24
25/* parity check flag */
26#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
27
28/**
29 * usb_serial_port: structure for the specific ports of a device.
30 * @serial: pointer back to the struct usb_serial owner of this port.
31 * @tty: pointer to the corresponding tty for this port.
32 * @lock: spinlock to grab when updating portions of this structure.
33 * @mutex: mutex used to synchronize serial_open() and serial_close()
34 * access for this port.
35 * @number: the number of the port (the minor number).
36 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
37 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
38 * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe
39 * for this port.
40 * @interrupt_out_buffer: pointer to the interrupt out buffer for this port.
41 * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes.
42 * @interrupt_out_urb: pointer to the interrupt out struct urb for this port.
43 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe
44 * for this port.
45 * @bulk_in_buffer: pointer to the bulk in buffer for this port.
46 * @read_urb: pointer to the bulk in struct urb for this port.
47 * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this
48 * port.
49 * @bulk_out_buffer: pointer to the bulk out buffer for this port.
50 * @bulk_out_size: the size of the bulk_out_buffer, in bytes.
51 * @write_urb: pointer to the bulk out struct urb for this port.
52 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
53 * port.
54 * @write_wait: a wait_queue_head_t used by the port.
55 * @work: work queue entry for the line discipline waking up.
56 * @open_count: number of times this port has been opened.
57 *
58 * This structure is used by the usb-serial core and drivers for the specific
59 * ports of a device.
60 */
61struct usb_serial_port {
62 struct usb_serial * serial;
63 struct tty_struct * tty;
64 spinlock_t lock;
65 struct mutex mutex;
66 unsigned char number;
67
68 unsigned char * interrupt_in_buffer;
69 struct urb * interrupt_in_urb;
70 __u8 interrupt_in_endpointAddress;
71
72 unsigned char * interrupt_out_buffer;
73 int interrupt_out_size;
74 struct urb * interrupt_out_urb;
75 __u8 interrupt_out_endpointAddress;
76
77 unsigned char * bulk_in_buffer;
78 int bulk_in_size;
79 struct urb * read_urb;
80 __u8 bulk_in_endpointAddress;
81
82 unsigned char * bulk_out_buffer;
83 int bulk_out_size;
84 struct urb * write_urb;
85 int write_urb_busy;
86 __u8 bulk_out_endpointAddress;
87
88 wait_queue_head_t write_wait;
89 struct work_struct work;
90 int open_count;
91 struct device dev;
92};
93#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
94
95/* get and set the port private data pointer helper functions */
96static inline void *usb_get_serial_port_data (struct usb_serial_port *port)
97{
98 return dev_get_drvdata(&port->dev);
99}
100
101static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data)
102{
103 dev_set_drvdata(&port->dev, data);
104}
105
106/**
107 * usb_serial - structure used by the usb-serial core for a device
108 * @dev: pointer to the struct usb_device for this device
109 * @type: pointer to the struct usb_serial_driver for this device
110 * @interface: pointer to the struct usb_interface for this device
111 * @minor: the starting minor number for this device
112 * @num_ports: the number of ports this device has
113 * @num_interrupt_in: number of interrupt in endpoints we have
114 * @num_interrupt_out: number of interrupt out endpoints we have
115 * @num_bulk_in: number of bulk in endpoints we have
116 * @num_bulk_out: number of bulk out endpoints we have
117 * @port: array of struct usb_serial_port structures for the different ports.
118 * @private: place to put any driver specific information that is needed. The
119 * usb-serial driver is required to manage this data, the usb-serial core
120 * will not touch this. Use usb_get_serial_data() and
121 * usb_set_serial_data() to access this.
122 */
123struct usb_serial {
124 struct usb_device * dev;
125 struct usb_serial_driver * type;
126 struct usb_interface * interface;
127 unsigned char minor;
128 unsigned char num_ports;
129 unsigned char num_port_pointers;
130 char num_interrupt_in;
131 char num_interrupt_out;
132 char num_bulk_in;
133 char num_bulk_out;
134 struct usb_serial_port * port[MAX_NUM_PORTS];
135 struct kref kref;
136 void * private;
137};
138#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
139
140#define NUM_DONT_CARE (-1)
141
142/* get and set the serial private data pointer helper functions */
143static inline void *usb_get_serial_data (struct usb_serial *serial)
144{
145 return serial->private;
146}
147
148static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
149{
150 serial->private = data;
151}
152
153/**
154 * usb_serial_driver - describes a usb serial driver
155 * @description: pointer to a string that describes this driver. This string used
156 * in the syslog messages when a device is inserted or removed.
157 * @id_table: pointer to a list of usb_device_id structures that define all
158 * of the devices this structure can support.
159 * @num_interrupt_in: the number of interrupt in endpoints this device will
160 * have.
161 * @num_interrupt_out: the number of interrupt out endpoints this device will
162 * have.
163 * @num_bulk_in: the number of bulk in endpoints this device will have.
164 * @num_bulk_out: the number of bulk out endpoints this device will have.
165 * @num_ports: the number of different ports this device will have.
166 * @calc_num_ports: pointer to a function to determine how many ports this
167 * device has dynamically. It will be called after the probe()
168 * callback is called, but before attach()
169 * @probe: pointer to the driver's probe function.
170 * This will be called when the device is inserted into the system,
171 * but before the device has been fully initialized by the usb_serial
172 * subsystem. Use this function to download any firmware to the device,
173 * or any other early initialization that might be needed.
174 * Return 0 to continue on with the initialization sequence. Anything
175 * else will abort it.
176 * @attach: pointer to the driver's attach function.
177 * This will be called when the struct usb_serial structure is fully set
178 * set up. Do any local initialization of the device, or any private
179 * memory structure allocation at this point in time.
180 * @shutdown: pointer to the driver's shutdown function. This will be
181 * called when the device is removed from the system.
182 *
183 * This structure is defines a USB Serial driver. It provides all of
184 * the information that the USB serial core code needs. If the function
185 * pointers are defined, then the USB serial core code will call them when
186 * the corresponding tty port functions are called. If they are not
187 * called, the generic serial function will be used instead.
188 *
189 * The driver.owner field should be set to the module owner of this driver.
190 * The driver.name field should be set to the name of this driver (remember
191 * it will show up in sysfs, so it needs to be short and to the point.
192 * Useing the module name is a good idea.)
193 */
194struct usb_serial_driver {
195 const char *description;
196 const struct usb_device_id *id_table;
197 char num_interrupt_in;
198 char num_interrupt_out;
199 char num_bulk_in;
200 char num_bulk_out;
201 char num_ports;
202
203 struct list_head driver_list;
204 struct device_driver driver;
205
206 int (*probe) (struct usb_serial *serial, const struct usb_device_id *id);
207 int (*attach) (struct usb_serial *serial);
208 int (*calc_num_ports) (struct usb_serial *serial);
209
210 void (*shutdown) (struct usb_serial *serial);
211
212 int (*port_probe) (struct usb_serial_port *port);
213 int (*port_remove) (struct usb_serial_port *port);
214
215 /* serial function calls */
216 int (*open) (struct usb_serial_port *port, struct file * filp);
217 void (*close) (struct usb_serial_port *port, struct file * filp);
218 int (*write) (struct usb_serial_port *port, const unsigned char *buf, int count);
219 int (*write_room) (struct usb_serial_port *port);
220 int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
221 void (*set_termios) (struct usb_serial_port *port, struct termios * old);
222 void (*break_ctl) (struct usb_serial_port *port, int break_state);
223 int (*chars_in_buffer) (struct usb_serial_port *port);
224 void (*throttle) (struct usb_serial_port *port);
225 void (*unthrottle) (struct usb_serial_port *port);
226 int (*tiocmget) (struct usb_serial_port *port, struct file *file);
227 int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear);
228
229 void (*read_int_callback)(struct urb *urb, struct pt_regs *regs);
230 void (*write_int_callback)(struct urb *urb, struct pt_regs *regs);
231 void (*read_bulk_callback)(struct urb *urb, struct pt_regs *regs);
232 void (*write_bulk_callback)(struct urb *urb, struct pt_regs *regs);
233};
234#define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver)
235
236extern int usb_serial_register(struct usb_serial_driver *driver);
237extern void usb_serial_deregister(struct usb_serial_driver *driver);
238extern void usb_serial_port_softint(struct usb_serial_port *port);
239
240extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id);
241extern void usb_serial_disconnect(struct usb_interface *iface);
242
243extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest);
244extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit);
245
246/* USB Serial console functions */
247#ifdef CONFIG_USB_SERIAL_CONSOLE
248extern void usb_serial_console_init (int debug, int minor);
249extern void usb_serial_console_exit (void);
250extern void usb_serial_console_disconnect(struct usb_serial *serial);
251#else
252static inline void usb_serial_console_init (int debug, int minor) { }
253static inline void usb_serial_console_exit (void) { }
254static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
255#endif
256
257/* Functions needed by other parts of the usbserial core */
258extern struct usb_serial *usb_serial_get_by_index (unsigned int minor);
259extern void usb_serial_put(struct usb_serial *serial);
260extern int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp);
261extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count);
262extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp);
263extern int usb_serial_generic_write_room (struct usb_serial_port *port);
264extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port);
265extern void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *regs);
266extern void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs);
267extern void usb_serial_generic_shutdown (struct usb_serial *serial);
268extern int usb_serial_generic_register (int debug);
269extern void usb_serial_generic_deregister (void);
270
271extern int usb_serial_bus_register (struct usb_serial_driver *device);
272extern void usb_serial_bus_deregister (struct usb_serial_driver *device);
273
274extern struct usb_serial_driver usb_serial_generic_device;
275extern struct bus_type usb_serial_bus_type;
276extern struct tty_driver *usb_serial_tty_driver;
277
278static inline void usb_serial_debug_data(int debug,
279 struct device *dev,
280 const char *function, int size,
281 const unsigned char *data)
282{
283 int i;
284
285 if (debug) {
286 dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size);
287 for (i = 0; i < size; ++i)
288 printk ("%.2x ", data[i]);
289 printk ("\n");
290 }
291}
292
293/* Use our own dbg macro */
294#undef dbg
295#define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0)
296
297
298
299#endif /* ifdef __LINUX_USB_SERIAL_H */
300
diff --git a/include/linux/usb_ch9.h b/include/linux/usb_ch9.h
index a2aacfc7af2f..c720d107ff29 100644
--- a/include/linux/usb_ch9.h
+++ b/include/linux/usb_ch9.h
@@ -51,6 +51,9 @@
51#define USB_RECIP_INTERFACE 0x01 51#define USB_RECIP_INTERFACE 0x01
52#define USB_RECIP_ENDPOINT 0x02 52#define USB_RECIP_ENDPOINT 0x02
53#define USB_RECIP_OTHER 0x03 53#define USB_RECIP_OTHER 0x03
54/* From Wireless USB 1.0 */
55#define USB_RECIP_PORT 0x04
56#define USB_RECIP_RPIPE 0x05
54 57
55/* 58/*
56 * Standard requests, for the bRequest field of a SETUP packet. 59 * Standard requests, for the bRequest field of a SETUP packet.
@@ -73,7 +76,9 @@
73 76
74#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ 77#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
75#define USB_REQ_GET_ENCRYPTION 0x0E 78#define USB_REQ_GET_ENCRYPTION 0x0E
79#define USB_REQ_RPIPE_ABORT 0x0E
76#define USB_REQ_SET_HANDSHAKE 0x0F 80#define USB_REQ_SET_HANDSHAKE 0x0F
81#define USB_REQ_RPIPE_RESET 0x0F
77#define USB_REQ_GET_HANDSHAKE 0x10 82#define USB_REQ_GET_HANDSHAKE 0x10
78#define USB_REQ_SET_CONNECTION 0x11 83#define USB_REQ_SET_CONNECTION 0x11
79#define USB_REQ_SET_SECURITY_DATA 0x12 84#define USB_REQ_SET_SECURITY_DATA 0x12
@@ -159,6 +164,8 @@ struct usb_ctrlrequest {
159#define USB_DT_BOS 0x0f 164#define USB_DT_BOS 0x0f
160#define USB_DT_DEVICE_CAPABILITY 0x10 165#define USB_DT_DEVICE_CAPABILITY 0x10
161#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 166#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
167#define USB_DT_WIRE_ADAPTER 0x21
168#define USB_DT_RPIPE 0x22
162 169
163/* conventional codes for class-specific descriptors */ 170/* conventional codes for class-specific descriptors */
164#define USB_DT_CS_DEVICE 0x21 171#define USB_DT_CS_DEVICE 0x21
diff --git a/include/linux/usb_gadget.h b/include/linux/usb_gadget.h
index 1d78870ed8af..e17186dbcdca 100644
--- a/include/linux/usb_gadget.h
+++ b/include/linux/usb_gadget.h
@@ -872,9 +872,9 @@ int usb_gadget_config_buf(const struct usb_config_descriptor *config,
872/* utility wrapping a simple endpoint selection policy */ 872/* utility wrapping a simple endpoint selection policy */
873 873
874extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *, 874extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *,
875 struct usb_endpoint_descriptor *) __init; 875 struct usb_endpoint_descriptor *) __devinit;
876 876
877extern void usb_ep_autoconfig_reset (struct usb_gadget *) __init; 877extern void usb_ep_autoconfig_reset (struct usb_gadget *) __devinit;
878 878
879#endif /* __KERNEL__ */ 879#endif /* __KERNEL__ */
880 880
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 608487a62c98..2ae76fe52ff7 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -43,6 +43,10 @@
43 /* Need delay after Command phase */ \ 43 /* Need delay after Command phase */ \
44 US_FLAG(NO_WP_DETECT, 0x00000200) \ 44 US_FLAG(NO_WP_DETECT, 0x00000200) \
45 /* Don't check for write-protect */ \ 45 /* Don't check for write-protect */ \
46 US_FLAG(MAX_SECTORS_64, 0x00000400) \
47 /* Sets max_sectors to 64 */ \
48 US_FLAG(IGNORE_DEVICE, 0x00000800) \
49 /* Don't claim device */
46 50
47#define US_FLAG(name, value) US_FL_##name = value , 51#define US_FLAG(name, value) US_FL_##name = value ,
48enum { US_DO_ALL_FLAGS }; 52enum { US_DO_ALL_FLAGS };
@@ -104,6 +108,9 @@ enum { US_DO_ALL_FLAGS };
104#ifdef CONFIG_USB_STORAGE_ALAUDA 108#ifdef CONFIG_USB_STORAGE_ALAUDA
105#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */ 109#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
106#endif 110#endif
111#ifdef CONFIG_USB_STORAGE_KARMA
112#define US_PR_KARMA 0xf5 /* Rio Karma */
113#endif
107 114
108#define US_PR_DEVICE 0xff /* Use device's value */ 115#define US_PR_DEVICE 0xff /* Use device's value */
109 116
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 7b7aadb69092..617d8a1c59ae 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -32,11 +32,10 @@
32#define _LINUX_USBDEVICE_FS_H 32#define _LINUX_USBDEVICE_FS_H
33 33
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/magic.h>
35 36
36/* --------------------------------------------------------------------- */ 37/* --------------------------------------------------------------------- */
37 38
38#define USBDEVICE_SUPER_MAGIC 0x9fa2
39
40/* usbdevfs ioctl codes */ 39/* usbdevfs ioctl codes */
41 40
42struct usbdevfs_ctrltransfer { 41struct usbdevfs_ctrltransfer {
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
index dc7c621e4647..4d0909e53595 100644
--- a/include/linux/vermagic.h
+++ b/include/linux/vermagic.h
@@ -1,4 +1,4 @@
1#include <linux/version.h> 1#include <linux/utsrelease.h>
2#include <linux/module.h> 2#include <linux/module.h>
3 3
4/* Simply sanity version stamp for modules. */ 4/* Simply sanity version stamp for modules. */
@@ -24,5 +24,5 @@
24#define VERMAGIC_STRING \ 24#define VERMAGIC_STRING \
25 UTS_RELEASE " " \ 25 UTS_RELEASE " " \
26 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ 26 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
27 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC \ 27 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC
28 "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) 28
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 91140091ced2..8dba97a291f6 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -1,48 +1,20 @@
1/*
2 * Video for Linux version 1 - OBSOLETE
3 *
4 * Header file for v4l1 drivers and applications, for
5 * Linux kernels 2.2.x or 2.4.x.
6 *
7 * Provides header for legacy drivers and applications
8 *
9 * See http://linuxtv.org for more info
10 *
11 */
1#ifndef __LINUX_VIDEODEV_H 12#ifndef __LINUX_VIDEODEV_H
2#define __LINUX_VIDEODEV_H 13#define __LINUX_VIDEODEV_H
3 14
4#include <linux/types.h>
5
6#define HAVE_V4L1 1
7
8#include <linux/videodev2.h> 15#include <linux/videodev2.h>
9 16
10#ifdef __KERNEL__ 17#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
11
12#include <linux/mm.h>
13
14extern struct video_device* video_devdata(struct file*);
15
16#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
17static inline void
18video_device_create_file(struct video_device *vfd,
19 struct class_device_attribute *attr)
20{
21 class_device_create_file(&vfd->class_dev, attr);
22}
23static inline void
24video_device_remove_file(struct video_device *vfd,
25 struct class_device_attribute *attr)
26{
27 class_device_remove_file(&vfd->class_dev, attr);
28}
29
30#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
31/* helper functions to access driver private data. */
32static inline void *video_get_drvdata(struct video_device *dev)
33{
34 return dev->priv;
35}
36
37static inline void video_set_drvdata(struct video_device *dev, void *data)
38{
39 dev->priv = data;
40}
41#endif
42
43extern int video_exclusive_open(struct inode *inode, struct file *file);
44extern int video_exclusive_release(struct inode *inode, struct file *file);
45#endif /* __KERNEL__ */
46 18
47struct video_capability 19struct video_capability
48{ 20{
@@ -363,6 +335,9 @@ struct video_code
363#define VID_HARDWARE_SAA7114H 37 335#define VID_HARDWARE_SAA7114H 37
364#define VID_HARDWARE_SN9C102 38 336#define VID_HARDWARE_SN9C102 38
365#define VID_HARDWARE_ARV 39 337#define VID_HARDWARE_ARV 39
338
339#endif /* CONFIG_VIDEO_V4L1_COMPAT */
340
366#endif /* __LINUX_VIDEODEV_H */ 341#endif /* __LINUX_VIDEODEV_H */
367 342
368/* 343/*
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index ad7fa9c86c10..e3715d774197 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1,35 +1,31 @@
1#ifndef __LINUX_VIDEODEV2_H
2#define __LINUX_VIDEODEV2_H
3/* 1/*
4 * Video for Linux Two 2 * Video for Linux Two
5 * 3 *
6 * Header file for v4l or V4L2 drivers and applications, for 4 * Header file for v4l or V4L2 drivers and applications
7 * Linux kernels 2.2.x or 2.4.x. 5 * with public API.
6 * All kernel-specific stuff were moved to media/v4l2-dev.h, so
7 * no #if __KERNEL tests are allowed here
8 * 8 *
9 * See http://bytesex.org/v4l/ for API specs and other 9 * See http://linuxtv.org for more info
10 * v4l2 documentation.
11 * 10 *
12 * Author: Bill Dirks <bdirks@pacbell.net> 11 * Author: Bill Dirks <bdirks@pacbell.net>
13 * Justin Schoeman 12 * Justin Schoeman
14 * et al. 13 * et al.
15 */ 14 */
15#ifndef __LINUX_VIDEODEV2_H
16#define __LINUX_VIDEODEV2_H
16#ifdef __KERNEL__ 17#ifdef __KERNEL__
17#include <linux/time.h> /* need struct timeval */ 18#include <linux/time.h> /* need struct timeval */
18#include <linux/poll.h>
19#include <linux/device.h>
20#include <linux/mutex.h>
21#endif
22#include <linux/compiler.h> /* need __user */ 19#include <linux/compiler.h> /* need __user */
23 20#else
24 21#define __user
25#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.17 */ 22#endif
26#define HAVE_V4L2 1 23#include <linux/types.h>
27 24
28/* 25/*
29 * Common stuff for both V4L1 and V4L2 26 * Common stuff for both V4L1 and V4L2
30 * Moved from videodev.h 27 * Moved from videodev.h
31 */ 28 */
32
33#define VIDEO_MAX_FRAME 32 29#define VIDEO_MAX_FRAME 32
34 30
35#define VID_TYPE_CAPTURE 1 /* Can capture */ 31#define VID_TYPE_CAPTURE 1 /* Can capture */
@@ -47,71 +43,6 @@
47#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ 43#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
48#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ 44#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
49 45
50#ifdef __KERNEL__
51
52/* Minor device allocation */
53#define MINOR_VFL_TYPE_GRABBER_MIN 0
54#define MINOR_VFL_TYPE_GRABBER_MAX 63
55#define MINOR_VFL_TYPE_RADIO_MIN 64
56#define MINOR_VFL_TYPE_RADIO_MAX 127
57#define MINOR_VFL_TYPE_VTX_MIN 192
58#define MINOR_VFL_TYPE_VTX_MAX 223
59#define MINOR_VFL_TYPE_VBI_MIN 224
60#define MINOR_VFL_TYPE_VBI_MAX 255
61
62#define VFL_TYPE_GRABBER 0
63#define VFL_TYPE_VBI 1
64#define VFL_TYPE_RADIO 2
65#define VFL_TYPE_VTX 3
66
67struct video_device
68{
69 /* device info */
70 struct device *dev;
71 char name[32];
72 int type; /* v4l1 */
73 int type2; /* v4l2 */
74 int hardware;
75 int minor;
76
77 /* device ops + callbacks */
78 const struct file_operations *fops;
79 void (*release)(struct video_device *vfd);
80
81
82#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
83 /* obsolete -- fops->owner is used instead */
84 struct module *owner;
85 /* dev->driver_data will be used instead some day.
86 * Use the video_{get|set}_drvdata() helper functions,
87 * so the switch over will be transparent for you.
88 * Or use {pci|usb}_{get|set}_drvdata() directly. */
89 void *priv;
90#endif
91
92 /* for videodev.c intenal usage -- please don't touch */
93 int users; /* video_exclusive_{open|close} ... */
94 struct mutex lock; /* ... helper function uses these */
95 char devfs_name[64]; /* devfs */
96 struct class_device class_dev; /* sysfs */
97};
98
99#define VIDEO_MAJOR 81
100
101extern int video_register_device(struct video_device *, int type, int nr);
102extern void video_unregister_device(struct video_device *);
103extern int video_usercopy(struct inode *inode, struct file *file,
104 unsigned int cmd, unsigned long arg,
105 int (*func)(struct inode *inode, struct file *file,
106 unsigned int cmd, void *arg));
107
108/* helper functions to alloc / release struct video_device, the
109 later can be used for video_device->release() */
110struct video_device *video_device_alloc(void);
111void video_device_release(struct video_device *vfd);
112
113#endif
114
115/* 46/*
116 * M I S C E L L A N E O U S 47 * M I S C E L L A N E O U S
117 */ 48 */
@@ -172,6 +103,8 @@ enum v4l2_ctrl_type {
172 V4L2_CTRL_TYPE_BOOLEAN = 2, 103 V4L2_CTRL_TYPE_BOOLEAN = 2,
173 V4L2_CTRL_TYPE_MENU = 3, 104 V4L2_CTRL_TYPE_MENU = 3,
174 V4L2_CTRL_TYPE_BUTTON = 4, 105 V4L2_CTRL_TYPE_BUTTON = 4,
106 V4L2_CTRL_TYPE_INTEGER64 = 5,
107 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
175}; 108};
176 109
177enum v4l2_tuner_type { 110enum v4l2_tuner_type {
@@ -270,7 +203,6 @@ struct v4l2_capability
270/* 203/*
271 * V I D E O I M A G E F O R M A T 204 * V I D E O I M A G E F O R M A T
272 */ 205 */
273
274struct v4l2_pix_format 206struct v4l2_pix_format
275{ 207{
276 __u32 width; 208 __u32 width;
@@ -283,7 +215,7 @@ struct v4l2_pix_format
283 __u32 priv; /* private data, depends on pixelformat */ 215 __u32 priv; /* private data, depends on pixelformat */
284}; 216};
285 217
286/* Pixel format FOURCC depth Description */ 218/* Pixel format FOURCC depth Description */
287#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ 219#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */
288#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ 220#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */
289#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ 221#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */
@@ -311,6 +243,7 @@ struct v4l2_pix_format
311#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ 243#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */
312#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ 244#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */
313#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ 245#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */
246#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:1:1 16x16 macroblocks */
314 247
315/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 248/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
316#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ 249#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */
@@ -319,7 +252,7 @@ struct v4l2_pix_format
319#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */ 252#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */
320#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */ 253#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */
321#define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */ 254#define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */
322#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG */ 255#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG-1/2/4 */
323 256
324/* Vendor-specific formats */ 257/* Vendor-specific formats */
325#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ 258#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */
@@ -343,7 +276,6 @@ struct v4l2_fmtdesc
343 276
344#define V4L2_FMT_FLAG_COMPRESSED 0x0001 277#define V4L2_FMT_FLAG_COMPRESSED 0x0001
345 278
346
347/* 279/*
348 * T I M E C O D E 280 * T I M E C O D E
349 */ 281 */
@@ -373,16 +305,15 @@ struct v4l2_timecode
373#define V4L2_TC_USERBITS_8BITCHARS 0x0008 305#define V4L2_TC_USERBITS_8BITCHARS 0x0008
374/* The above is based on SMPTE timecodes */ 306/* The above is based on SMPTE timecodes */
375 307
376 308#ifdef __KERNEL__
377/* 309/*
378 * M P E G C O M P R E S S I O N P A R A M E T E R S 310 * M P E G C O M P R E S S I O N P A R A M E T E R S
379 * 311 *
380 * ### WARNING: this is still work-in-progress right now, most likely 312 * ### WARNING: This experimental MPEG compression API is obsolete.
381 * ### there will be some incompatible changes. 313 * ### It is replaced by the MPEG controls API.
314 * ### This old API will disappear in the near future!
382 * 315 *
383 */ 316 */
384
385
386enum v4l2_bitrate_mode { 317enum v4l2_bitrate_mode {
387 V4L2_BITRATE_NONE = 0, /* not specified */ 318 V4L2_BITRATE_NONE = 0, /* not specified */
388 V4L2_BITRATE_CBR, /* constant bitrate */ 319 V4L2_BITRATE_CBR, /* constant bitrate */
@@ -460,6 +391,7 @@ struct v4l2_mpeg_compression {
460 /* I don't expect the above being perfect yet ;) */ 391 /* I don't expect the above being perfect yet ;) */
461 __u32 reserved_5[8]; 392 __u32 reserved_5[8];
462}; 393};
394#endif
463 395
464struct v4l2_jpegcompression 396struct v4l2_jpegcompression
465{ 397{
@@ -491,7 +423,6 @@ struct v4l2_jpegcompression
491 * allways use APP0 */ 423 * allways use APP0 */
492}; 424};
493 425
494
495/* 426/*
496 * M E M O R Y - M A P P I N G B U F F E R S 427 * M E M O R Y - M A P P I N G B U F F E R S
497 */ 428 */
@@ -573,7 +504,6 @@ struct v4l2_window
573 void __user *bitmap; 504 void __user *bitmap;
574}; 505};
575 506
576
577/* 507/*
578 * C A P T U R E P A R A M E T E R S 508 * C A P T U R E P A R A M E T E R S
579 */ 509 */
@@ -586,6 +516,7 @@ struct v4l2_captureparm
586 __u32 readbuffers; /* # of buffers for read */ 516 __u32 readbuffers; /* # of buffers for read */
587 __u32 reserved[4]; 517 __u32 reserved[4];
588}; 518};
519
589/* Flags for 'capability' and 'capturemode' fields */ 520/* Flags for 'capability' and 'capturemode' fields */
590#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ 521#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
591#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ 522#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
@@ -603,7 +534,6 @@ struct v4l2_outputparm
603/* 534/*
604 * I N P U T I M A G E C R O P P I N G 535 * I N P U T I M A G E C R O P P I N G
605 */ 536 */
606
607struct v4l2_cropcap { 537struct v4l2_cropcap {
608 enum v4l2_buf_type type; 538 enum v4l2_buf_type type;
609 struct v4l2_rect bounds; 539 struct v4l2_rect bounds;
@@ -710,7 +640,6 @@ struct v4l2_standard
710 __u32 reserved[4]; 640 __u32 reserved[4];
711}; 641};
712 642
713
714/* 643/*
715 * V I D E O I N P U T S 644 * V I D E O I N P U T S
716 */ 645 */
@@ -725,6 +654,7 @@ struct v4l2_input
725 __u32 status; 654 __u32 status;
726 __u32 reserved[4]; 655 __u32 reserved[4];
727}; 656};
657
728/* Values for the 'type' field */ 658/* Values for the 'type' field */
729#define V4L2_INPUT_TYPE_TUNER 1 659#define V4L2_INPUT_TYPE_TUNER 1
730#define V4L2_INPUT_TYPE_CAMERA 2 660#define V4L2_INPUT_TYPE_CAMERA 2
@@ -775,6 +705,34 @@ struct v4l2_control
775 __s32 value; 705 __s32 value;
776}; 706};
777 707
708struct v4l2_ext_control
709{
710 __u32 id;
711 __u32 reserved2[2];
712 union {
713 __s32 value;
714 __s64 value64;
715 void *reserved;
716 };
717} __attribute__ ((packed));
718
719struct v4l2_ext_controls
720{
721 __u32 ctrl_class;
722 __u32 count;
723 __u32 error_idx;
724 __u32 reserved[2];
725 struct v4l2_ext_control *controls;
726};
727
728/* Values for ctrl_class field */
729#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
730#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
731
732#define V4L2_CTRL_ID_MASK (0x0fffffff)
733#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
734#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
735
778/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 736/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
779struct v4l2_queryctrl 737struct v4l2_queryctrl
780{ 738{
@@ -801,12 +759,21 @@ struct v4l2_querymenu
801/* Control flags */ 759/* Control flags */
802#define V4L2_CTRL_FLAG_DISABLED 0x0001 760#define V4L2_CTRL_FLAG_DISABLED 0x0001
803#define V4L2_CTRL_FLAG_GRABBED 0x0002 761#define V4L2_CTRL_FLAG_GRABBED 0x0002
762#define V4L2_CTRL_FLAG_READ_ONLY 0x0004
763#define V4L2_CTRL_FLAG_UPDATE 0x0008
764#define V4L2_CTRL_FLAG_INACTIVE 0x0010
765#define V4L2_CTRL_FLAG_SLIDER 0x0020
766
767/* Query flag, to be ORed with the control ID */
768#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
804 769
805/* Control IDs defined by V4L2 */ 770/* User-class control IDs defined by V4L2 */
806#define V4L2_CID_BASE 0x00980900 771#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
772#define V4L2_CID_USER_BASE V4L2_CID_BASE
807/* IDs reserved for driver specific controls */ 773/* IDs reserved for driver specific controls */
808#define V4L2_CID_PRIVATE_BASE 0x08000000 774#define V4L2_CID_PRIVATE_BASE 0x08000000
809 775
776#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
810#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) 777#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
811#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) 778#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
812#define V4L2_CID_SATURATION (V4L2_CID_BASE+2) 779#define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
@@ -833,6 +800,188 @@ struct v4l2_querymenu
833#define V4L2_CID_VCENTER (V4L2_CID_BASE+23) 800#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
834#define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */ 801#define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */
835 802
803/* MPEG-class control IDs defined by V4L2 */
804#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
805#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
806
807/* MPEG streams */
808#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
809enum v4l2_mpeg_stream_type {
810 V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
811 V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */
812 V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */
813 V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */
814 V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
815 V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
816};
817#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
818#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
819#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
820#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
821#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
822#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
823#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
824enum v4l2_mpeg_stream_vbi_fmt {
825 V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
826 V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
827};
828
829/* MPEG audio */
830#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
831enum v4l2_mpeg_audio_sampling_freq {
832 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
833 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
834 V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
835};
836#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
837enum v4l2_mpeg_audio_encoding {
838 V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
839 V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
840 V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
841};
842#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
843enum v4l2_mpeg_audio_l1_bitrate {
844 V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
845 V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
846 V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2,
847 V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
848 V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
849 V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
850 V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
851 V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
852 V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
853 V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
854 V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
855 V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
856 V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
857 V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
858};
859#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103)
860enum v4l2_mpeg_audio_l2_bitrate {
861 V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
862 V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
863 V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2,
864 V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3,
865 V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4,
866 V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5,
867 V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
868 V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
869 V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
870 V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
871 V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
872 V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
873 V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
874 V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
875};
876#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
877enum v4l2_mpeg_audio_l3_bitrate {
878 V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
879 V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
880 V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2,
881 V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3,
882 V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4,
883 V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5,
884 V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6,
885 V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
886 V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
887 V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
888 V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
889 V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
890 V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
891 V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
892};
893#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
894enum v4l2_mpeg_audio_mode {
895 V4L2_MPEG_AUDIO_MODE_STEREO = 0,
896 V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
897 V4L2_MPEG_AUDIO_MODE_DUAL = 2,
898 V4L2_MPEG_AUDIO_MODE_MONO = 3,
899};
900#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
901enum v4l2_mpeg_audio_mode_extension {
902 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
903 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
904 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
905 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
906};
907#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
908enum v4l2_mpeg_audio_emphasis {
909 V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
910 V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
911 V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
912};
913#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
914enum v4l2_mpeg_audio_crc {
915 V4L2_MPEG_AUDIO_CRC_NONE = 0,
916 V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
917};
918
919/* MPEG video */
920#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
921enum v4l2_mpeg_video_encoding {
922 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
923 V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
924};
925#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
926enum v4l2_mpeg_video_aspect {
927 V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
928 V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
929 V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
930 V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
931};
932#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
933#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
934#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
935#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
936#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
937enum v4l2_mpeg_video_bitrate_mode {
938 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
939 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
940};
941#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
942#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
943#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
944
945/* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */
946#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
947#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
948enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
949 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
950 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
951};
952#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1)
953#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2)
954enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
955 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
956 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
957 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
958 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
959 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
960};
961#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3)
962enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
963 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
964 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
965};
966#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4)
967enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
968 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
969 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
970};
971#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5)
972#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6)
973enum v4l2_mpeg_cx2341x_video_median_filter_type {
974 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
975 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
976 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2,
977 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
978 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
979};
980#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7)
981#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
982#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
983#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
984
836/* 985/*
837 * T U N I N G 986 * T U N I N G
838 */ 987 */
@@ -904,6 +1053,7 @@ struct v4l2_audio
904 __u32 mode; 1053 __u32 mode;
905 __u32 reserved[2]; 1054 __u32 reserved[2];
906}; 1055};
1056
907/* Flags for the 'capability' field */ 1057/* Flags for the 'capability' field */
908#define V4L2_AUDCAP_STEREO 0x00001 1058#define V4L2_AUDCAP_STEREO 0x00001
909#define V4L2_AUDCAP_AVL 0x00002 1059#define V4L2_AUDCAP_AVL 0x00002
@@ -927,7 +1077,6 @@ struct v4l2_audioout
927 */ 1077 */
928 1078
929/* Raw VBI */ 1079/* Raw VBI */
930
931struct v4l2_vbi_format 1080struct v4l2_vbi_format
932{ 1081{
933 __u32 sampling_rate; /* in 1 Hz */ 1082 __u32 sampling_rate; /* in 1 Hz */
@@ -1034,8 +1183,6 @@ struct v4l2_streamparm
1034 } parm; 1183 } parm;
1035}; 1184};
1036 1185
1037
1038
1039/* 1186/*
1040 * I O C T L C O D E S F O R V I D E O D E V I C E S 1187 * I O C T L C O D E S F O R V I D E O D E V I C E S
1041 * 1188 *
@@ -1045,8 +1192,10 @@ struct v4l2_streamparm
1045#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) 1192#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc)
1046#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) 1193#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format)
1047#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) 1194#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format)
1195#ifdef __KERNEL__
1048#define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) 1196#define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression)
1049#define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) 1197#define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression)
1198#endif
1050#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) 1199#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers)
1051#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) 1200#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer)
1052#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) 1201#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer)
@@ -1096,7 +1245,11 @@ struct v4l2_streamparm
1096#define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap) 1245#define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap)
1097#endif 1246#endif
1098#define VIDIOC_LOG_STATUS _IO ('V', 70) 1247#define VIDIOC_LOG_STATUS _IO ('V', 70)
1248#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls)
1249#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls)
1250#define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls)
1099 1251
1252#ifdef __OLD_VIDIOC_
1100/* for compatibility, will go away some day */ 1253/* for compatibility, will go away some day */
1101#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) 1254#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int)
1102#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) 1255#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm)
@@ -1104,57 +1257,10 @@ struct v4l2_streamparm
1104#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) 1257#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio)
1105#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) 1258#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout)
1106#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) 1259#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap)
1107
1108#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1109
1110
1111#ifdef __KERNEL__
1112/*
1113 *
1114 * V 4 L 2 D R I V E R H E L P E R A P I
1115 *
1116 * Some commonly needed functions for drivers (v4l2-common.o module)
1117 */
1118#include <linux/fs.h>
1119
1120/* Video standard functions */
1121extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
1122extern int v4l2_video_std_construct(struct v4l2_standard *vs,
1123 int id, char *name);
1124
1125/* prority handling */
1126struct v4l2_prio_state {
1127 atomic_t prios[4];
1128};
1129int v4l2_prio_init(struct v4l2_prio_state *global);
1130int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
1131 enum v4l2_priority new);
1132int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
1133int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
1134enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
1135int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
1136
1137/* names for fancy debug output */
1138extern char *v4l2_field_names[];
1139extern char *v4l2_type_names[];
1140
1141/* Compatibility layer interface -- v4l1-compat module */
1142typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
1143 unsigned int cmd, void *arg);
1144
1145#ifdef CONFIG_VIDEO_V4L1_COMPAT
1146int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
1147 int cmd, void *arg, v4l2_kioctl driver_ioctl);
1148#else
1149#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL
1150#endif 1260#endif
1151 1261
1152/* 32 Bits compatibility layer for 64 bits processors */ 1262#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1153extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
1154 unsigned long arg);
1155
1156 1263
1157#endif /* __KERNEL__ */
1158#endif /* __LINUX_VIDEODEV2_H */ 1264#endif /* __LINUX_VIDEODEV2_H */
1159 1265
1160/* 1266/*
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index f6024ab4eff0..ce5f1482e6be 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -11,6 +11,7 @@ struct vm_area_struct;
11#define VM_ALLOC 0x00000002 /* vmalloc() */ 11#define VM_ALLOC 0x00000002 /* vmalloc() */
12#define VM_MAP 0x00000004 /* vmap()ed pages */ 12#define VM_MAP 0x00000004 /* vmap()ed pages */
13#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */ 13#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */
14#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
14/* bits [20..32] reserved for arch specific ioremap internals */ 15/* bits [20..32] reserved for arch specific ioremap internals */
15 16
16/* 17/*
@@ -43,8 +44,6 @@ extern void *vmalloc_32_user(unsigned long size);
43extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); 44extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
44extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, 45extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask,
45 pgprot_t prot); 46 pgprot_t prot);
46extern void *__vmalloc_node(unsigned long size, gfp_t gfp_mask,
47 pgprot_t prot, int node);
48extern void vfree(void *addr); 47extern void vfree(void *addr);
49 48
50extern void *vmap(struct page **pages, unsigned int count, 49extern void *vmap(struct page **pages, unsigned int count,
@@ -63,7 +62,6 @@ extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
63extern struct vm_struct *get_vm_area_node(unsigned long size, 62extern struct vm_struct *get_vm_area_node(unsigned long size,
64 unsigned long flags, int node); 63 unsigned long flags, int node);
65extern struct vm_struct *remove_vm_area(void *addr); 64extern struct vm_struct *remove_vm_area(void *addr);
66extern struct vm_struct *__remove_vm_area(void *addr);
67extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 65extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
68 struct page ***pages); 66 struct page ***pages);
69extern void unmap_vm_area(struct vm_struct *area); 67extern void unmap_vm_area(struct vm_struct *area);
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
new file mode 100644
index 000000000000..c89df55f6e03
--- /dev/null
+++ b/include/linux/vmstat.h
@@ -0,0 +1,229 @@
1#ifndef _LINUX_VMSTAT_H
2#define _LINUX_VMSTAT_H
3
4#include <linux/types.h>
5#include <linux/percpu.h>
6#include <linux/mmzone.h>
7#include <asm/atomic.h>
8
9#ifdef CONFIG_VM_EVENT_COUNTERS
10/*
11 * Light weight per cpu counter implementation.
12 *
13 * Counters should only be incremented and no critical kernel component
14 * should rely on the counter values.
15 *
16 * Counters are handled completely inline. On many platforms the code
17 * generated will simply be the increment of a global address.
18 */
19
20#ifdef CONFIG_ZONE_DMA32
21#define DMA32_ZONE(xx) xx##_DMA32,
22#else
23#define DMA32_ZONE(xx)
24#endif
25
26#ifdef CONFIG_HIGHMEM
27#define HIGHMEM_ZONE(xx) , xx##_HIGH
28#else
29#define HIGHMEM_ZONE(xx)
30#endif
31
32#define FOR_ALL_ZONES(xx) xx##_DMA, DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx)
33
34enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
35 FOR_ALL_ZONES(PGALLOC),
36 PGFREE, PGACTIVATE, PGDEACTIVATE,
37 PGFAULT, PGMAJFAULT,
38 FOR_ALL_ZONES(PGREFILL),
39 FOR_ALL_ZONES(PGSTEAL),
40 FOR_ALL_ZONES(PGSCAN_KSWAPD),
41 FOR_ALL_ZONES(PGSCAN_DIRECT),
42 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
43 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
44 NR_VM_EVENT_ITEMS
45};
46
47struct vm_event_state {
48 unsigned long event[NR_VM_EVENT_ITEMS];
49};
50
51DECLARE_PER_CPU(struct vm_event_state, vm_event_states);
52
53static inline void __count_vm_event(enum vm_event_item item)
54{
55 __get_cpu_var(vm_event_states).event[item]++;
56}
57
58static inline void count_vm_event(enum vm_event_item item)
59{
60 get_cpu_var(vm_event_states).event[item]++;
61 put_cpu();
62}
63
64static inline void __count_vm_events(enum vm_event_item item, long delta)
65{
66 __get_cpu_var(vm_event_states).event[item] += delta;
67}
68
69static inline void count_vm_events(enum vm_event_item item, long delta)
70{
71 get_cpu_var(vm_event_states).event[item] += delta;
72 put_cpu();
73}
74
75extern void all_vm_events(unsigned long *);
76extern void vm_events_fold_cpu(int cpu);
77
78#else
79
80/* Disable counters */
81#define get_cpu_vm_events(e) 0L
82#define count_vm_event(e) do { } while (0)
83#define count_vm_events(e,d) do { } while (0)
84#define __count_vm_event(e) do { } while (0)
85#define __count_vm_events(e,d) do { } while (0)
86#define vm_events_fold_cpu(x) do { } while (0)
87
88#endif /* CONFIG_VM_EVENT_COUNTERS */
89
90#define __count_zone_vm_events(item, zone, delta) \
91 __count_vm_events(item##_DMA + zone_idx(zone), delta)
92
93/*
94 * Zone based page accounting with per cpu differentials.
95 */
96extern atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
97
98static inline void zone_page_state_add(long x, struct zone *zone,
99 enum zone_stat_item item)
100{
101 atomic_long_add(x, &zone->vm_stat[item]);
102 atomic_long_add(x, &vm_stat[item]);
103}
104
105static inline unsigned long global_page_state(enum zone_stat_item item)
106{
107 long x = atomic_long_read(&vm_stat[item]);
108#ifdef CONFIG_SMP
109 if (x < 0)
110 x = 0;
111#endif
112 return x;
113}
114
115static inline unsigned long zone_page_state(struct zone *zone,
116 enum zone_stat_item item)
117{
118 long x = atomic_long_read(&zone->vm_stat[item]);
119#ifdef CONFIG_SMP
120 if (x < 0)
121 x = 0;
122#endif
123 return x;
124}
125
126#ifdef CONFIG_NUMA
127/*
128 * Determine the per node value of a stat item. This function
129 * is called frequently in a NUMA machine, so try to be as
130 * frugal as possible.
131 */
132static inline unsigned long node_page_state(int node,
133 enum zone_stat_item item)
134{
135 struct zone *zones = NODE_DATA(node)->node_zones;
136
137 return
138#ifdef CONFIG_ZONE_DMA32
139 zone_page_state(&zones[ZONE_DMA32], item) +
140#endif
141 zone_page_state(&zones[ZONE_NORMAL], item) +
142#ifdef CONFIG_HIGHMEM
143 zone_page_state(&zones[ZONE_HIGHMEM], item) +
144#endif
145 zone_page_state(&zones[ZONE_DMA], item);
146}
147
148extern void zone_statistics(struct zonelist *, struct zone *);
149
150#else
151
152#define node_page_state(node, item) global_page_state(item)
153#define zone_statistics(_zl,_z) do { } while (0)
154
155#endif /* CONFIG_NUMA */
156
157#define __add_zone_page_state(__z, __i, __d) \
158 __mod_zone_page_state(__z, __i, __d)
159#define __sub_zone_page_state(__z, __i, __d) \
160 __mod_zone_page_state(__z, __i,-(__d))
161
162#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d)
163#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d))
164
165static inline void zap_zone_vm_stats(struct zone *zone)
166{
167 memset(zone->vm_stat, 0, sizeof(zone->vm_stat));
168}
169
170extern void inc_zone_state(struct zone *, enum zone_stat_item);
171
172#ifdef CONFIG_SMP
173void __mod_zone_page_state(struct zone *, enum zone_stat_item item, int);
174void __inc_zone_page_state(struct page *, enum zone_stat_item);
175void __dec_zone_page_state(struct page *, enum zone_stat_item);
176
177void mod_zone_page_state(struct zone *, enum zone_stat_item, int);
178void inc_zone_page_state(struct page *, enum zone_stat_item);
179void dec_zone_page_state(struct page *, enum zone_stat_item);
180
181extern void inc_zone_state(struct zone *, enum zone_stat_item);
182
183void refresh_cpu_vm_stats(int);
184void refresh_vm_stats(void);
185
186#else /* CONFIG_SMP */
187
188/*
189 * We do not maintain differentials in a single processor configuration.
190 * The functions directly modify the zone and global counters.
191 */
192static inline void __mod_zone_page_state(struct zone *zone,
193 enum zone_stat_item item, int delta)
194{
195 zone_page_state_add(delta, zone, item);
196}
197
198static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item)
199{
200 atomic_long_inc(&zone->vm_stat[item]);
201 atomic_long_inc(&vm_stat[item]);
202}
203
204static inline void __inc_zone_page_state(struct page *page,
205 enum zone_stat_item item)
206{
207 __inc_zone_state(page_zone(page), item);
208}
209
210static inline void __dec_zone_page_state(struct page *page,
211 enum zone_stat_item item)
212{
213 atomic_long_dec(&page_zone(page)->vm_stat[item]);
214 atomic_long_dec(&vm_stat[item]);
215}
216
217/*
218 * We only use atomic operations to update counters. So there is no need to
219 * disable interrupts.
220 */
221#define inc_zone_page_state __inc_zone_page_state
222#define dec_zone_page_state __dec_zone_page_state
223#define mod_zone_page_state __mod_zone_page_state
224
225static inline void refresh_cpu_vm_stats(int cpu) { }
226static inline void refresh_vm_stats(void) { }
227#endif
228
229#endif /* _LINUX_VMSTAT_H */
diff --git a/include/linux/vt.h b/include/linux/vt.h
index 9f95b0bea5b3..ba806e8711be 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -1,6 +1,16 @@
1#ifndef _LINUX_VT_H 1#ifndef _LINUX_VT_H
2#define _LINUX_VT_H 2#define _LINUX_VT_H
3 3
4/*
5 * These constants are also useful for user-level apps (e.g., VC
6 * resizing).
7 */
8#define MIN_NR_CONSOLES 1 /* must be at least 1 */
9#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */
10#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */
11 /* Note: the ioctl VT_GETSTATE does not work for
12 consoles 16 and higher (since it returns a short) */
13
4/* 0x56 is 'V', to avoid collision with termios and kd */ 14/* 0x56 is 'V', to avoid collision with termios and kd */
5 15
6#define VT_OPENQRY 0x5600 /* find available vt */ 16#define VT_OPENQRY 0x5600 /* find available vt */
@@ -50,5 +60,6 @@ struct vt_consize {
50#define VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */ 60#define VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */
51#define VT_LOCKSWITCH 0x560B /* disallow vt switching */ 61#define VT_LOCKSWITCH 0x560B /* disallow vt switching */
52#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */ 62#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */
63#define VT_GETHIFONTMASK 0x560D /* return hi font mask */
53 64
54#endif /* _LINUX_VT_H */ 65#endif /* _LINUX_VT_H */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 940d0261a545..1009d3fe1fc2 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -26,13 +26,15 @@
26 26
27extern void kd_mksound(unsigned int hz, unsigned int ticks); 27extern void kd_mksound(unsigned int hz, unsigned int ticks);
28extern int kbd_rate(struct kbd_repeat *rep); 28extern int kbd_rate(struct kbd_repeat *rep);
29extern int fg_console, last_console, want_console;
29 30
30/* console.c */ 31/* console.c */
31 32
32int vc_allocate(unsigned int console); 33int vc_allocate(unsigned int console);
33int vc_cons_allocated(unsigned int console); 34int vc_cons_allocated(unsigned int console);
34int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines); 35int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
35void vc_disallocate(unsigned int console); 36int vc_lock_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
37void vc_deallocate(unsigned int console);
36void reset_palette(struct vc_data *vc); 38void reset_palette(struct vc_data *vc);
37void do_blank_screen(int entering_gfx); 39void do_blank_screen(int entering_gfx);
38void do_unblank_screen(int leaving_gfx); 40void do_unblank_screen(int leaving_gfx);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 544e855c7c02..b3b9048421d8 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -68,7 +68,7 @@ struct task_struct;
68 wait_queue_t name = __WAITQUEUE_INITIALIZER(name, tsk) 68 wait_queue_t name = __WAITQUEUE_INITIALIZER(name, tsk)
69 69
70#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \ 70#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \
71 .lock = SPIN_LOCK_UNLOCKED, \ 71 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
72 .task_list = { &(name).task_list, &(name).task_list } } 72 .task_list = { &(name).task_list, &(name).task_list } }
73 73
74#define DECLARE_WAIT_QUEUE_HEAD(name) \ 74#define DECLARE_WAIT_QUEUE_HEAD(name) \
@@ -77,11 +77,7 @@ struct task_struct;
77#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ 77#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
78 { .flags = word, .bit_nr = bit, } 78 { .flags = word, .bit_nr = bit, }
79 79
80static inline void init_waitqueue_head(wait_queue_head_t *q) 80extern void init_waitqueue_head(wait_queue_head_t *q);
81{
82 spin_lock_init(&q->lock);
83 INIT_LIST_HEAD(&q->task_list);
84}
85 81
86static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) 82static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p)
87{ 83{
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 1192ed8f4fe8..011bcfeb9f09 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -28,6 +28,9 @@ struct watchdog_info {
28#define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int) 28#define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int)
29#define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int) 29#define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int)
30#define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int) 30#define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int)
31#define WDIOC_SETPRETIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 8, int)
32#define WDIOC_GETPRETIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 9, int)
33#define WDIOC_GETTIMELEFT _IOR(WATCHDOG_IOCTL_BASE, 10, int)
31 34
32#define WDIOF_UNKNOWN -1 /* Unknown flag error */ 35#define WDIOF_UNKNOWN -1 /* Unknown flag error */
33#define WDIOS_UNKNOWN -1 /* Unknown status error */ 36#define WDIOS_UNKNOWN -1 /* Unknown status error */
@@ -38,9 +41,10 @@ struct watchdog_info {
38#define WDIOF_EXTERN2 0x0008 /* External relay 2 */ 41#define WDIOF_EXTERN2 0x0008 /* External relay 2 */
39#define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */ 42#define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */
40#define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */ 43#define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */
41#define WDIOF_POWEROVER 0x0040 /* Power over voltage */ 44#define WDIOF_POWEROVER 0x0040 /* Power over voltage */
42#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */ 45#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */
43#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */ 46#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */
47#define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */
44#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */ 48#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */
45 49
46#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */ 50#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 13588564b42b..a50a0130fd9e 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * This file define a set of standard wireless extensions 2 * This file define a set of standard wireless extensions
3 * 3 *
4 * Version : 20 17.2.06 4 * Version : 21 14.3.06
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved.
@@ -69,9 +69,14 @@
69 69
70/***************************** INCLUDES *****************************/ 70/***************************** INCLUDES *****************************/
71 71
72/* This header is used in user-space, therefore need to be sanitised
73 * for that purpose. Those includes are usually not compatible with glibc.
74 * To know which includes to use in user-space, check iwlib.h. */
75#ifdef __KERNEL__
72#include <linux/types.h> /* for "caddr_t" et al */ 76#include <linux/types.h> /* for "caddr_t" et al */
73#include <linux/socket.h> /* for "struct sockaddr" et al */ 77#include <linux/socket.h> /* for "struct sockaddr" et al */
74#include <linux/if.h> /* for IFNAMSIZ and co... */ 78#include <linux/if.h> /* for IFNAMSIZ and co... */
79#endif /* __KERNEL__ */
75 80
76/***************************** VERSION *****************************/ 81/***************************** VERSION *****************************/
77/* 82/*
@@ -80,7 +85,7 @@
80 * (there is some stuff that will be added in the future...) 85 * (there is some stuff that will be added in the future...)
81 * I just plan to increment with each new version. 86 * I just plan to increment with each new version.
82 */ 87 */
83#define WIRELESS_EXT 20 88#define WIRELESS_EXT 21
84 89
85/* 90/*
86 * Changes : 91 * Changes :
@@ -208,6 +213,14 @@
208 * V19 to V20 213 * V19 to V20
209 * ---------- 214 * ----------
210 * - RtNetlink requests support (SET/GET) 215 * - RtNetlink requests support (SET/GET)
216 *
217 * V20 to V21
218 * ----------
219 * - Remove (struct net_device *)->get_wireless_stats()
220 * - Change length in ESSID and NICK to strlen() instead of strlen()+1
221 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
222 * - Power/Retry relative values no longer * 100000
223 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI
211 */ 224 */
212 225
213/**************************** CONSTANTS ****************************/ 226/**************************** CONSTANTS ****************************/
@@ -448,6 +461,7 @@
448#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ 461#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */
449#define IW_QUAL_LEVEL_INVALID 0x20 462#define IW_QUAL_LEVEL_INVALID 0x20
450#define IW_QUAL_NOISE_INVALID 0x40 463#define IW_QUAL_NOISE_INVALID 0x40
464#define IW_QUAL_RCPI 0x80 /* Level + Noise are 802.11k RCPI */
451#define IW_QUAL_ALL_INVALID 0x70 465#define IW_QUAL_ALL_INVALID 0x70
452 466
453/* Frequency flags */ 467/* Frequency flags */
@@ -500,10 +514,12 @@
500#define IW_RETRY_TYPE 0xF000 /* Type of parameter */ 514#define IW_RETRY_TYPE 0xF000 /* Type of parameter */
501#define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/ 515#define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/
502#define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */ 516#define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */
503#define IW_RETRY_MODIFIER 0x000F /* Modify a parameter */ 517#define IW_RETRY_MODIFIER 0x00FF /* Modify a parameter */
504#define IW_RETRY_MIN 0x0001 /* Value is a minimum */ 518#define IW_RETRY_MIN 0x0001 /* Value is a minimum */
505#define IW_RETRY_MAX 0x0002 /* Value is a maximum */ 519#define IW_RETRY_MAX 0x0002 /* Value is a maximum */
506#define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ 520#define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */
521#define IW_RETRY_SHORT 0x0010 /* Value is for short packets */
522#define IW_RETRY_LONG 0x0020 /* Value is for long packets */
507 523
508/* Scanning request flags */ 524/* Scanning request flags */
509#define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */ 525#define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */
@@ -1017,7 +1033,7 @@ struct iw_range
1017 /* Note : this frequency list doesn't need to fit channel numbers, 1033 /* Note : this frequency list doesn't need to fit channel numbers,
1018 * because each entry contain its channel index */ 1034 * because each entry contain its channel index */
1019 1035
1020 __u32 enc_capa; /* IW_ENC_CAPA_* bit field */ 1036 __u32 enc_capa; /* IW_ENC_CAPA_* bit field */
1021}; 1037};
1022 1038
1023/* 1039/*
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 957c21c16d62..9bca3539a1e5 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -63,6 +63,8 @@ extern void destroy_workqueue(struct workqueue_struct *wq);
63 63
64extern int FASTCALL(queue_work(struct workqueue_struct *wq, struct work_struct *work)); 64extern int FASTCALL(queue_work(struct workqueue_struct *wq, struct work_struct *work));
65extern int FASTCALL(queue_delayed_work(struct workqueue_struct *wq, struct work_struct *work, unsigned long delay)); 65extern int FASTCALL(queue_delayed_work(struct workqueue_struct *wq, struct work_struct *work, unsigned long delay));
66extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
67 struct work_struct *work, unsigned long delay);
66extern void FASTCALL(flush_workqueue(struct workqueue_struct *wq)); 68extern void FASTCALL(flush_workqueue(struct workqueue_struct *wq));
67 69
68extern int FASTCALL(schedule_work(struct work_struct *work)); 70extern int FASTCALL(schedule_work(struct work_struct *work));
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 9e38b566d0e7..9d4074ecd0cd 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -85,6 +85,7 @@ int wakeup_pdflush(long nr_pages);
85void laptop_io_completion(void); 85void laptop_io_completion(void);
86void laptop_sync_completion(void); 86void laptop_sync_completion(void);
87void throttle_vm_writeout(void); 87void throttle_vm_writeout(void);
88void writeback_congestion_end(void);
88 89
89/* These are exported to sysctl. */ 90/* These are exported to sysctl. */
90extern int dirty_background_ratio; 91extern int dirty_background_ratio;
@@ -115,6 +116,8 @@ int sync_page_range(struct inode *inode, struct address_space *mapping,
115 loff_t pos, loff_t count); 116 loff_t pos, loff_t count);
116int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, 117int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
117 loff_t pos, loff_t count); 118 loff_t pos, loff_t count);
119void set_page_dirty_balance(struct page *page);
120void writeback_set_ratelimit(void);
118 121
119/* pdflush.c */ 122/* pdflush.c */
120extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 123extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 46a15c7a1a13..430afd058269 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -12,8 +12,8 @@
12 */ 12 */
13typedef union 13typedef union
14{ 14{
15 __u32 a4; 15 __be32 a4;
16 __u32 a6[4]; 16 __be32 a6[4];
17} xfrm_address_t; 17} xfrm_address_t;
18 18
19/* Ident of a specific xfrm_state. It is used on input to lookup 19/* Ident of a specific xfrm_state. It is used on input to lookup
@@ -23,7 +23,7 @@ typedef union
23struct xfrm_id 23struct xfrm_id
24{ 24{
25 xfrm_address_t daddr; 25 xfrm_address_t daddr;
26 __u32 spi; 26 __be32 spi;
27 __u8 proto; 27 __u8 proto;
28}; 28};
29 29
@@ -49,10 +49,10 @@ struct xfrm_selector
49{ 49{
50 xfrm_address_t daddr; 50 xfrm_address_t daddr;
51 xfrm_address_t saddr; 51 xfrm_address_t saddr;
52 __u16 dport; 52 __be16 dport;
53 __u16 dport_mask; 53 __be16 dport_mask;
54 __u16 sport; 54 __be16 sport;
55 __u16 sport_mask; 55 __be16 sport_mask;
56 __u16 family; 56 __u16 family;
57 __u8 prefixlen_d; 57 __u8 prefixlen_d;
58 __u8 prefixlen_s; 58 __u8 prefixlen_s;
@@ -104,6 +104,13 @@ struct xfrm_stats {
104 104
105enum 105enum
106{ 106{
107 XFRM_POLICY_TYPE_MAIN = 0,
108 XFRM_POLICY_TYPE_SUB = 1,
109 XFRM_POLICY_TYPE_MAX = 2
110};
111
112enum
113{
107 XFRM_POLICY_IN = 0, 114 XFRM_POLICY_IN = 0,
108 XFRM_POLICY_OUT = 1, 115 XFRM_POLICY_OUT = 1,
109 XFRM_POLICY_FWD = 2, 116 XFRM_POLICY_FWD = 2,
@@ -120,7 +127,9 @@ enum
120 127
121#define XFRM_MODE_TRANSPORT 0 128#define XFRM_MODE_TRANSPORT 0
122#define XFRM_MODE_TUNNEL 1 129#define XFRM_MODE_TUNNEL 1
123#define XFRM_MODE_MAX 2 130#define XFRM_MODE_ROUTEOPTIMIZATION 2
131#define XFRM_MODE_IN_TRIGGER 3
132#define XFRM_MODE_MAX 4
124 133
125/* Netlink configuration messages. */ 134/* Netlink configuration messages. */
126enum { 135enum {
@@ -164,6 +173,10 @@ enum {
164#define XFRM_MSG_NEWAE XFRM_MSG_NEWAE 173#define XFRM_MSG_NEWAE XFRM_MSG_NEWAE
165 XFRM_MSG_GETAE, 174 XFRM_MSG_GETAE,
166#define XFRM_MSG_GETAE XFRM_MSG_GETAE 175#define XFRM_MSG_GETAE XFRM_MSG_GETAE
176
177 XFRM_MSG_REPORT,
178#define XFRM_MSG_REPORT XFRM_MSG_REPORT
179
167 __XFRM_MSG_MAX 180 __XFRM_MSG_MAX
168}; 181};
169#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 182#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -217,6 +230,12 @@ enum xfrm_ae_ftype_t {
217#define XFRM_AE_MAX (__XFRM_AE_MAX - 1) 230#define XFRM_AE_MAX (__XFRM_AE_MAX - 1)
218}; 231};
219 232
233struct xfrm_userpolicy_type {
234 __u8 type;
235 __u16 reserved1;
236 __u8 reserved2;
237};
238
220/* Netlink message attributes. */ 239/* Netlink message attributes. */
221enum xfrm_attr_type_t { 240enum xfrm_attr_type_t {
222 XFRMA_UNSPEC, 241 XFRMA_UNSPEC,
@@ -232,6 +251,10 @@ enum xfrm_attr_type_t {
232 XFRMA_REPLAY_VAL, 251 XFRMA_REPLAY_VAL,
233 XFRMA_REPLAY_THRESH, 252 XFRMA_REPLAY_THRESH,
234 XFRMA_ETIMER_THRESH, 253 XFRMA_ETIMER_THRESH,
254 XFRMA_SRCADDR, /* xfrm_address_t */
255 XFRMA_COADDR, /* xfrm_address_t */
256 XFRMA_LASTUSED,
257 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */
235 __XFRMA_MAX 258 __XFRMA_MAX
236 259
237#define XFRMA_MAX (__XFRMA_MAX - 1) 260#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -247,17 +270,18 @@ struct xfrm_usersa_info {
247 __u32 seq; 270 __u32 seq;
248 __u32 reqid; 271 __u32 reqid;
249 __u16 family; 272 __u16 family;
250 __u8 mode; /* 0=transport,1=tunnel */ 273 __u8 mode; /* XFRM_MODE_xxx */
251 __u8 replay_window; 274 __u8 replay_window;
252 __u8 flags; 275 __u8 flags;
253#define XFRM_STATE_NOECN 1 276#define XFRM_STATE_NOECN 1
254#define XFRM_STATE_DECAP_DSCP 2 277#define XFRM_STATE_DECAP_DSCP 2
255#define XFRM_STATE_NOPMTUDISC 4 278#define XFRM_STATE_NOPMTUDISC 4
279#define XFRM_STATE_WILDRECV 8
256}; 280};
257 281
258struct xfrm_usersa_id { 282struct xfrm_usersa_id {
259 xfrm_address_t daddr; 283 xfrm_address_t daddr;
260 __u32 spi; 284 __be32 spi;
261 __u16 family; 285 __u16 family;
262 __u8 proto; 286 __u8 proto;
263}; 287};
@@ -319,12 +343,18 @@ struct xfrm_usersa_flush {
319 __u8 proto; 343 __u8 proto;
320}; 344};
321 345
346struct xfrm_user_report {
347 __u8 proto;
348 struct xfrm_selector sel;
349};
350
322#ifndef __KERNEL__ 351#ifndef __KERNEL__
323/* backwards compatibility for userspace */ 352/* backwards compatibility for userspace */
324#define XFRMGRP_ACQUIRE 1 353#define XFRMGRP_ACQUIRE 1
325#define XFRMGRP_EXPIRE 2 354#define XFRMGRP_EXPIRE 2
326#define XFRMGRP_SA 4 355#define XFRMGRP_SA 4
327#define XFRMGRP_POLICY 8 356#define XFRMGRP_POLICY 8
357#define XFRMGRP_REPORT 0x10
328#endif 358#endif
329 359
330enum xfrm_nlgroups { 360enum xfrm_nlgroups {
@@ -340,6 +370,8 @@ enum xfrm_nlgroups {
340#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY 370#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY
341 XFRMNLGRP_AEVENTS, 371 XFRMNLGRP_AEVENTS,
342#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS 372#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS
373 XFRMNLGRP_REPORT,
374#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT
343 __XFRMNLGRP_MAX 375 __XFRMNLGRP_MAX
344}; 376};
345#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) 377#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)