aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild21
-rw-r--r--include/linux/acpi.h5
-rw-r--r--include/linux/aer.h5
-rw-r--r--include/linux/agp_backend.h3
-rw-r--r--include/linux/aio.h19
-rw-r--r--include/linux/arcdevice.h4
-rw-r--r--include/linux/ata_platform.h3
-rw-r--r--include/linux/atalk.h2
-rw-r--r--include/linux/atmel_tc.h252
-rw-r--r--include/linux/attribute_container.h30
-rw-r--r--include/linux/audit.h57
-rw-r--r--include/linux/backing-dev.h102
-rw-r--r--include/linux/binfmts.h4
-rw-r--r--include/linux/bio.h4
-rw-r--r--include/linux/bitmap.h7
-rw-r--r--include/linux/bitops.h51
-rw-r--r--include/linux/blkdev.h60
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/bsg.h16
-rw-r--r--include/linux/buffer_head.h1
-rw-r--r--include/linux/byteorder/Kbuild6
-rw-r--r--include/linux/byteorder/big_endian.h2
-rw-r--r--include/linux/byteorder/generic.h8
-rw-r--r--include/linux/byteorder/little_endian.h2
-rw-r--r--include/linux/cache.h4
-rw-r--r--include/linux/calc64.h49
-rw-r--r--include/linux/capability.h15
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/cdrom.h5
-rw-r--r--include/linux/cgroup.h80
-rw-r--r--include/linux/cgroup_subsys.h6
-rw-r--r--include/linux/clocksource.h3
-rw-r--r--include/linux/coda_fs_i.h2
-rw-r--r--include/linux/coda_linux.h3
-rw-r--r--include/linux/compat.h3
-rw-r--r--include/linux/compiler-gcc.h14
-rw-r--r--include/linux/concap.h3
-rw-r--r--include/linux/configfs.h4
-rw-r--r--include/linux/console.h4
-rw-r--r--include/linux/console_struct.h1
-rw-r--r--include/linux/cpu.h3
-rw-r--r--include/linux/cpufreq.h6
-rw-r--r--include/linux/cpumask.h47
-rw-r--r--include/linux/cpuset.h17
-rw-r--r--include/linux/crc-ccitt.h2
-rw-r--r--include/linux/crypto.h7
-rw-r--r--include/linux/dcache.h7
-rw-r--r--include/linux/debugobjects.h90
-rw-r--r--include/linux/device-mapper.h97
-rw-r--r--include/linux/device.h134
-rw-r--r--include/linux/device_cgroup.h12
-rw-r--r--include/linux/devpts_fs.h4
-rw-r--r--include/linux/dlm.h7
-rw-r--r--include/linux/dlm_device.h11
-rw-r--r--include/linux/dlm_plock.h50
-rw-r--r--include/linux/dlmconstants.h4
-rw-r--r--include/linux/dm-dirty-log.h131
-rw-r--r--include/linux/dm-io.h85
-rw-r--r--include/linux/dm-kcopyd.h47
-rw-r--r--include/linux/dma-attrs.h74
-rw-r--r--include/linux/dma-mapping.h17
-rw-r--r--include/linux/dmaengine.h38
-rw-r--r--include/linux/dmi.h1
-rw-r--r--include/linux/dvb/dmx.h3
-rw-r--r--include/linux/edac.h14
-rw-r--r--include/linux/efi.h7
-rw-r--r--include/linux/elf.h2
-rw-r--r--include/linux/enclosure.h11
-rw-r--r--include/linux/eventfd.h5
-rw-r--r--include/linux/exportfs.h2
-rw-r--r--include/linux/ext4_fs.h1207
-rw-r--r--include/linux/ext4_fs_extents.h232
-rw-r--r--include/linux/ext4_fs_i.h167
-rw-r--r--include/linux/ext4_fs_sb.h148
-rw-r--r--include/linux/ext4_jbd2.h231
-rw-r--r--include/linux/fb.h44
-rw-r--r--include/linux/file.h4
-rw-r--r--include/linux/filter.h35
-rw-r--r--include/linux/fs.h75
-rw-r--r--include/linux/fsl_devices.h4
-rw-r--r--include/linux/fsnotify.h4
-rw-r--r--include/linux/generic_serial.h2
-rw-r--r--include/linux/gfp.h50
-rw-r--r--include/linux/hdreg.h4
-rw-r--r--include/linux/hdsmart.h126
-rw-r--r--include/linux/hid.h21
-rw-r--r--include/linux/hidraw.h1
-rw-r--r--include/linux/hil_mlc.h2
-rw-r--r--include/linux/hrtimer.h17
-rw-r--r--include/linux/hugetlb.h46
-rw-r--r--include/linux/hw_random.h14
-rw-r--r--include/linux/i2c-algo-pca.h37
-rw-r--r--include/linux/i2c-id.h4
-rw-r--r--include/linux/i2c-pca-platform.h12
-rw-r--r--include/linux/i2c.h17
-rw-r--r--include/linux/i2c/tps65010.h30
-rw-r--r--include/linux/i2o.h10
-rw-r--r--include/linux/icmpv6.h11
-rw-r--r--include/linux/ide.h393
-rw-r--r--include/linux/idr.h3
-rw-r--r--include/linux/ieee80211.h41
-rw-r--r--include/linux/if_arp.h6
-rw-r--r--include/linux/if_macvlan.h3
-rw-r--r--include/linux/if_pppox.h1
-rw-r--r--include/linux/if_tunnel.h22
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/if_wanpipe.h124
-rw-r--r--include/linux/igmp.h38
-rw-r--r--include/linux/in6.h34
-rw-r--r--include/linux/inet.h2
-rw-r--r--include/linux/inetdevice.h8
-rw-r--r--include/linux/init.h2
-rw-r--r--include/linux/init_task.h6
-rw-r--r--include/linux/input.h8
-rw-r--r--include/linux/interrupt.h20
-rw-r--r--include/linux/io.h4
-rw-r--r--include/linux/ioport.h5
-rw-r--r--include/linux/ipc_namespace.h24
-rw-r--r--include/linux/ipmi.h85
-rw-r--r--include/linux/ipmi_smi.h10
-rw-r--r--include/linux/ipv6.h48
-rw-r--r--include/linux/irq.h10
-rw-r--r--include/linux/irqflags.h6
-rw-r--r--include/linux/isapnp.h10
-rw-r--r--include/linux/iscsi_ibft.h50
-rw-r--r--include/linux/isdn.h6
-rw-r--r--include/linux/isicom.h7
-rw-r--r--include/linux/jbd.h2
-rw-r--r--include/linux/jbd2.h2
-rw-r--r--include/linux/jiffies.h20
-rw-r--r--include/linux/kbuild.h15
-rw-r--r--include/linux/kernel.h102
-rw-r--r--include/linux/kernelcapi.h1
-rw-r--r--include/linux/key.h30
-rw-r--r--include/linux/keyboard.h1
-rw-r--r--include/linux/keyctl.h1
-rw-r--r--include/linux/kfifo.h5
-rw-r--r--include/linux/kgdb.h281
-rw-r--r--include/linux/klist.h40
-rw-r--r--include/linux/kobj_map.h4
-rw-r--r--include/linux/kobject.h3
-rw-r--r--include/linux/kprobes.h34
-rw-r--r--include/linux/kref.h3
-rw-r--r--include/linux/ktime.h6
-rw-r--r--include/linux/kvm.h130
-rw-r--r--include/linux/kvm_host.h59
-rw-r--r--include/linux/kvm_para.h11
-rw-r--r--include/linux/kvm_types.h2
-rw-r--r--include/linux/leds.h16
-rw-r--r--include/linux/libata.h733
-rw-r--r--include/linux/list.h67
-rw-r--r--include/linux/lm_interface.h10
-rw-r--r--include/linux/lmb.h87
-rw-r--r--include/linux/lock_dlm_plock.h41
-rw-r--r--include/linux/lockd/lockd.h26
-rw-r--r--include/linux/lockd/sm_inter.h1
-rw-r--r--include/linux/math64.h84
-rw-r--r--include/linux/mbus.h36
-rw-r--r--include/linux/mca-legacy.h1
-rw-r--r--include/linux/memcontrol.h16
-rw-r--r--include/linux/memory.h12
-rw-r--r--include/linux/memory_hotplug.h33
-rw-r--r--include/linux/mempolicy.h156
-rw-r--r--include/linux/memstick.h2
-rw-r--r--include/linux/meye.h2
-rw-r--r--include/linux/mfd/htc-egpio.h57
-rw-r--r--include/linux/mfd/htc-pasic3.h55
-rw-r--r--include/linux/miscdevice.h10
-rw-r--r--include/linux/mlx4/cmd.h2
-rw-r--r--include/linux/mlx4/cq.h19
-rw-r--r--include/linux/mlx4/device.h44
-rw-r--r--include/linux/mlx4/driver.h3
-rw-r--r--include/linux/mlx4/qp.h19
-rw-r--r--include/linux/mm.h73
-rw-r--r--include/linux/mm_types.h20
-rw-r--r--include/linux/mmzone.h187
-rw-r--r--include/linux/mnt_namespace.h12
-rw-r--r--include/linux/mod_devicetable.h11
-rw-r--r--include/linux/module.h19
-rw-r--r--include/linux/mount.h17
-rw-r--r--include/linux/mroute.h25
-rw-r--r--include/linux/mroute6.h228
-rw-r--r--include/linux/msdos_fs.h10
-rw-r--r--include/linux/msg.h14
-rw-r--r--include/linux/msi.h1
-rw-r--r--include/linux/mtd/inftl.h5
-rw-r--r--include/linux/mtd/jedec.h66
-rw-r--r--include/linux/mtd/mtd.h6
-rw-r--r--include/linux/mtd/nftl.h5
-rw-r--r--include/linux/mtd/onenand.h3
-rw-r--r--include/linux/mtd/plat-ram.h5
-rw-r--r--include/linux/mtd/pmc551.h5
-rw-r--r--include/linux/mtio.h1
-rw-r--r--include/linux/nbd.h10
-rw-r--r--include/linux/ncp_fs.h7
-rw-r--r--include/linux/ncp_fs_i.h4
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdevice.h36
-rw-r--r--include/linux/netfilter.h85
-rw-r--r--include/linux/netfilter/nf_conntrack_dccp.h40
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h185
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h8
-rw-r--r--include/linux/netfilter/x_tables.h4
-rw-r--r--include/linux/netfilter/xt_sctp.h84
-rw-r--r--include/linux/netfilter_arp/arp_tables.h17
-rw-r--r--include/linux/netfilter_bridge/ebt_nflog.h21
-rw-r--r--include/linux/netfilter_ipv4.h2
-rw-r--r--include/linux/netlink.h1
-rw-r--r--include/linux/nfs3.h2
-rw-r--r--include/linux/nfs_fs.h5
-rw-r--r--include/linux/nfs_fs_sb.h10
-rw-r--r--include/linux/nfs_xdr.h10
-rw-r--r--include/linux/nfsd/Kbuild4
-rw-r--r--include/linux/nfsd/cache.h2
-rw-r--r--include/linux/nfsd/nfsd.h13
-rw-r--r--include/linux/nl80211.h218
-rw-r--r--include/linux/nodemask.h22
-rw-r--r--include/linux/notifier.h5
-rw-r--r--include/linux/of.h1
-rw-r--r--include/linux/of_device.h2
-rw-r--r--include/linux/of_gpio.h69
-rw-r--r--include/linux/of_i2c.h24
-rw-r--r--include/linux/oom.h4
-rw-r--r--include/linux/page-flags.h319
-rw-r--r--include/linux/parport.h2
-rw-r--r--include/linux/pci-aspm.h56
-rw-r--r--include/linux/pci.h47
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/pci_regs.h8
-rw-r--r--include/linux/pcounter.h74
-rw-r--r--include/linux/percpu.h1
-rw-r--r--include/linux/personality.h4
-rw-r--r--include/linux/phantom.h11
-rw-r--r--include/linux/phy.h85
-rw-r--r--include/linux/pid.h8
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/pim.h45
-rw-r--r--include/linux/pm.h47
-rw-r--r--include/linux/pm_wakeup.h90
-rw-r--r--include/linux/pnp.h212
-rw-r--r--include/linux/pnpbios.h151
-rw-r--r--include/linux/poison.h7
-rw-r--r--include/linux/prctl.h15
-rw-r--r--include/linux/proc_fs.h61
-rw-r--r--include/linux/profile.h4
-rw-r--r--include/linux/proportions.h13
-rw-r--r--include/linux/ptrace.h4
-rw-r--r--include/linux/quota.h32
-rw-r--r--include/linux/quotaops.h137
-rw-r--r--include/linux/raid/md.h2
-rw-r--r--include/linux/raid/md_k.h4
-rw-r--r--include/linux/raid/raid5.h7
-rw-r--r--include/linux/raid_class.h12
-rw-r--r--include/linux/rcuclassic.h3
-rw-r--r--include/linux/rcupdate.h3
-rw-r--r--include/linux/rcupreempt.h3
-rw-r--r--include/linux/rcupreempt_trace.h2
-rw-r--r--include/linux/reiserfs_fs.h1
-rw-r--r--include/linux/reiserfs_fs_sb.h1
-rw-r--r--include/linux/res_counter.h29
-rw-r--r--include/linux/resource.h1
-rw-r--r--include/linux/rio.h41
-rw-r--r--include/linux/rio_drv.h3
-rw-r--r--include/linux/rtnetlink.h4
-rw-r--r--include/linux/rwsem.h3
-rw-r--r--include/linux/scatterlist.h5
-rw-r--r--include/linux/sched.h95
-rw-r--r--include/linux/securebits.h25
-rw-r--r--include/linux/security.h1149
-rw-r--r--include/linux/selinux.h134
-rw-r--r--include/linux/semaphore.h51
-rw-r--r--include/linux/seq_file.h21
-rw-r--r--include/linux/seq_file_net.h27
-rw-r--r--include/linux/seqlock.h46
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/serial_core.h10
-rw-r--r--include/linux/serio.h1
-rw-r--r--include/linux/shmem_fs.h3
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/skbuff.h207
-rw-r--r--include/linux/slab.h10
-rw-r--r--include/linux/slub_def.h18
-rw-r--r--include/linux/smb.h1
-rw-r--r--include/linux/smb_fs_i.h2
-rw-r--r--include/linux/smb_fs_sb.h4
-rw-r--r--include/linux/smc91x.h13
-rw-r--r--include/linux/spi/ads7846.h3
-rw-r--r--include/linux/spinlock.h37
-rw-r--r--include/linux/ssb/ssb.h50
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h7
-rw-r--r--include/linux/ssb/ssb_driver_gige.h174
-rw-r--r--include/linux/ssb/ssb_driver_pci.h19
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/sunrpc/auth.h17
-rw-r--r--include/linux/sunrpc/auth_gss.h1
-rw-r--r--include/linux/sunrpc/cache.h1
-rw-r--r--include/linux/sunrpc/clnt.h9
-rw-r--r--include/linux/sunrpc/gss_krb5.h6
-rw-r--r--include/linux/sunrpc/sched.h41
-rw-r--r--include/linux/sunrpc/svc.h1
-rw-r--r--include/linux/sunrpc/svcauth.h5
-rw-r--r--include/linux/sunrpc/svcsock.h4
-rw-r--r--include/linux/sunrpc/xprt.h10
-rw-r--r--include/linux/suspend.h15
-rw-r--r--include/linux/svga.h3
-rw-r--r--include/linux/swap.h4
-rw-r--r--include/linux/synclink.h4
-rw-r--r--include/linux/syscalls.h31
-rw-r--r--include/linux/sysctl.h14
-rw-r--r--include/linux/sysdev.h17
-rw-r--r--include/linux/sysfs.h25
-rw-r--r--include/linux/sysv_fs.h6
-rw-r--r--include/linux/tcp.h7
-rw-r--r--include/linux/textsearch.h4
-rw-r--r--include/linux/thermal.h39
-rw-r--r--include/linux/thread_info.h39
-rw-r--r--include/linux/timer.h23
-rw-r--r--include/linux/timex.h46
-rw-r--r--include/linux/topology.h46
-rw-r--r--include/linux/transport_class.h11
-rw-r--r--include/linux/tty.h34
-rw-r--r--include/linux/tty_driver.h108
-rw-r--r--include/linux/uaccess.h22
-rw-r--r--include/linux/udf_fs.h51
-rw-r--r--include/linux/udf_fs_i.h31
-rw-r--r--include/linux/udf_fs_sb.h117
-rw-r--r--include/linux/udp.h19
-rw-r--r--include/linux/unaligned/access_ok.h67
-rw-r--r--include/linux/unaligned/be_byteshift.h70
-rw-r--r--include/linux/unaligned/be_memmove.h36
-rw-r--r--include/linux/unaligned/be_struct.h36
-rw-r--r--include/linux/unaligned/generic.h68
-rw-r--r--include/linux/unaligned/le_byteshift.h70
-rw-r--r--include/linux/unaligned/le_memmove.h36
-rw-r--r--include/linux/unaligned/le_struct.h36
-rw-r--r--include/linux/unaligned/memmove.h45
-rw-r--r--include/linux/unaligned/packed_struct.h46
-rw-r--r--include/linux/usb.h196
-rw-r--r--include/linux/usb/atmel_usba_udc.h22
-rw-r--r--include/linux/usb/audio.h2
-rw-r--r--include/linux/usb/cdc.h4
-rw-r--r--include/linux/usb/ch9.h17
-rw-r--r--include/linux/usb/g_printer.h4
-rw-r--r--include/linux/usb/gadget.h2
-rw-r--r--include/linux/usb/gadgetfs.h16
-rw-r--r--include/linux/usb/input.h8
-rw-r--r--include/linux/usb/iowarrior.h6
-rw-r--r--include/linux/usb/isp116x.h6
-rw-r--r--include/linux/usb/midi.h2
-rw-r--r--include/linux/usb/net2280.h9
-rw-r--r--include/linux/usb/otg.h6
-rw-r--r--include/linux/usb/quirks.h5
-rw-r--r--include/linux/usb/rndis_host.h9
-rw-r--r--include/linux/usb/serial.h21
-rw-r--r--include/linux/usb/sl811.h5
-rw-r--r--include/linux/usb/usbnet.h8
-rw-r--r--include/linux/usb_usual.h1
-rw-r--r--include/linux/usbdevice_fs.h7
-rw-r--r--include/linux/videodev2.h55
-rw-r--r--include/linux/vmalloc.h5
-rw-r--r--include/linux/vmstat.h6
-rw-r--r--include/linux/wireless.h1
-rw-r--r--include/linux/wm97xx.h314
-rw-r--r--include/linux/writeback.h3
-rw-r--r--include/linux/xattr.h6
-rw-r--r--include/linux/xfrm.h11
366 files changed, 8722 insertions, 6261 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index cedbbd806bf6..78fade0a1e35 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -20,6 +20,7 @@ header-y += affs_hardblocks.h
20header-y += aio_abi.h 20header-y += aio_abi.h
21header-y += arcfb.h 21header-y += arcfb.h
22header-y += atmapi.h 22header-y += atmapi.h
23header-y += atmarp.h
23header-y += atmbr2684.h 24header-y += atmbr2684.h
24header-y += atmclip.h 25header-y += atmclip.h
25header-y += atm_eni.h 26header-y += atm_eni.h
@@ -48,6 +49,7 @@ header-y += coff.h
48header-y += comstats.h 49header-y += comstats.h
49header-y += const.h 50header-y += const.h
50header-y += cgroupstats.h 51header-y += cgroupstats.h
52header-y += cramfs_fs.h
51header-y += cycx_cfm.h 53header-y += cycx_cfm.h
52header-y += dlmconstants.h 54header-y += dlmconstants.h
53header-y += dlm_device.h 55header-y += dlm_device.h
@@ -70,10 +72,12 @@ header-y += firewire-constants.h
70header-y += fuse.h 72header-y += fuse.h
71header-y += genetlink.h 73header-y += genetlink.h
72header-y += gen_stats.h 74header-y += gen_stats.h
75header-y += gfs2_ondisk.h
73header-y += gigaset_dev.h 76header-y += gigaset_dev.h
74header-y += hysdn_if.h 77header-y += hysdn_if.h
75header-y += i2o-dev.h 78header-y += i2o-dev.h
76header-y += i8k.h 79header-y += i8k.h
80header-y += if_addrlabel.h
77header-y += if_arcnet.h 81header-y += if_arcnet.h
78header-y += if_bonding.h 82header-y += if_bonding.h
79header-y += if_cablemodem.h 83header-y += if_cablemodem.h
@@ -91,6 +95,7 @@ header-y += if_tunnel.h
91header-y += in6.h 95header-y += in6.h
92header-y += in_route.h 96header-y += in_route.h
93header-y += ioctl.h 97header-y += ioctl.h
98header-y += ip6_tunnel.h
94header-y += ipmi_msgdefs.h 99header-y += ipmi_msgdefs.h
95header-y += ipsec.h 100header-y += ipsec.h
96header-y += ipx.h 101header-y += ipx.h
@@ -100,7 +105,7 @@ header-y += ixjuser.h
100header-y += jffs2.h 105header-y += jffs2.h
101header-y += keyctl.h 106header-y += keyctl.h
102header-y += limits.h 107header-y += limits.h
103header-y += lock_dlm_plock.h 108header-y += dlm_plock.h
104header-y += magic.h 109header-y += magic.h
105header-y += major.h 110header-y += major.h
106header-y += matroxfb.h 111header-y += matroxfb.h
@@ -117,7 +122,6 @@ header-y += nfs2.h
117header-y += nfs4_mount.h 122header-y += nfs4_mount.h
118header-y += nfs_mount.h 123header-y += nfs_mount.h
119header-y += nl80211.h 124header-y += nl80211.h
120header-y += oom.h
121header-y += param.h 125header-y += param.h
122header-y += pci_regs.h 126header-y += pci_regs.h
123header-y += pfkeyv2.h 127header-y += pfkeyv2.h
@@ -150,6 +154,7 @@ header-y += tiocl.h
150header-y += tipc.h 154header-y += tipc.h
151header-y += tipc_config.h 155header-y += tipc_config.h
152header-y += toshiba.h 156header-y += toshiba.h
157header-y += udf_fs_i.h
153header-y += ultrasound.h 158header-y += ultrasound.h
154header-y += un.h 159header-y += un.h
155header-y += utime.h 160header-y += utime.h
@@ -165,7 +170,6 @@ unifdef-y += adfs_fs.h
165unifdef-y += agpgart.h 170unifdef-y += agpgart.h
166unifdef-y += apm_bios.h 171unifdef-y += apm_bios.h
167unifdef-y += atalk.h 172unifdef-y += atalk.h
168unifdef-y += atmarp.h
169unifdef-y += atmdev.h 173unifdef-y += atmdev.h
170unifdef-y += atm.h 174unifdef-y += atm.h
171unifdef-y += atm_tcp.h 175unifdef-y += atm_tcp.h
@@ -181,7 +185,6 @@ unifdef-y += cm4000_cs.h
181unifdef-y += cn_proc.h 185unifdef-y += cn_proc.h
182unifdef-y += coda.h 186unifdef-y += coda.h
183unifdef-y += connector.h 187unifdef-y += connector.h
184unifdef-y += cramfs_fs.h
185unifdef-y += cuda.h 188unifdef-y += cuda.h
186unifdef-y += cyclades.h 189unifdef-y += cyclades.h
187unifdef-y += dccp.h 190unifdef-y += dccp.h
@@ -204,20 +207,19 @@ unifdef-y += futex.h
204unifdef-y += fs.h 207unifdef-y += fs.h
205unifdef-y += gameport.h 208unifdef-y += gameport.h
206unifdef-y += generic_serial.h 209unifdef-y += generic_serial.h
207unifdef-y += gfs2_ondisk.h
208unifdef-y += hayesesp.h 210unifdef-y += hayesesp.h
209unifdef-y += hdlcdrv.h 211unifdef-y += hdlcdrv.h
210unifdef-y += hdlc.h 212unifdef-y += hdlc.h
211unifdef-y += hdreg.h 213unifdef-y += hdreg.h
212unifdef-y += hdsmart.h 214unifdef-y += hid.h
213unifdef-y += hiddev.h 215unifdef-y += hiddev.h
216unifdef-y += hidraw.h
214unifdef-y += hpet.h 217unifdef-y += hpet.h
215unifdef-y += i2c.h 218unifdef-y += i2c.h
216unifdef-y += i2c-dev.h 219unifdef-y += i2c-dev.h
217unifdef-y += icmp.h 220unifdef-y += icmp.h
218unifdef-y += icmpv6.h 221unifdef-y += icmpv6.h
219unifdef-y += if_addr.h 222unifdef-y += if_addr.h
220unifdef-y += if_addrlabel.h
221unifdef-y += if_arp.h 223unifdef-y += if_arp.h
222unifdef-y += if_bridge.h 224unifdef-y += if_bridge.h
223unifdef-y += if_ec.h 225unifdef-y += if_ec.h
@@ -231,7 +233,6 @@ unifdef-y += if_pppol2tp.h
231unifdef-y += if_pppox.h 233unifdef-y += if_pppox.h
232unifdef-y += if_tr.h 234unifdef-y += if_tr.h
233unifdef-y += if_vlan.h 235unifdef-y += if_vlan.h
234unifdef-y += if_wanpipe.h
235unifdef-y += igmp.h 236unifdef-y += igmp.h
236unifdef-y += inet_diag.h 237unifdef-y += inet_diag.h
237unifdef-y += in.h 238unifdef-y += in.h
@@ -242,7 +243,6 @@ unifdef-y += ipc.h
242unifdef-y += ipmi.h 243unifdef-y += ipmi.h
243unifdef-y += ipv6.h 244unifdef-y += ipv6.h
244unifdef-y += ipv6_route.h 245unifdef-y += ipv6_route.h
245unifdef-y += ip6_tunnel.h
246unifdef-y += isdn.h 246unifdef-y += isdn.h
247unifdef-y += isdnif.h 247unifdef-y += isdnif.h
248unifdef-y += isdn_divertif.h 248unifdef-y += isdn_divertif.h
@@ -261,6 +261,7 @@ unifdef-y += mempolicy.h
261unifdef-y += mii.h 261unifdef-y += mii.h
262unifdef-y += mman.h 262unifdef-y += mman.h
263unifdef-y += mroute.h 263unifdef-y += mroute.h
264unifdef-y += mroute6.h
264unifdef-y += msdos_fs.h 265unifdef-y += msdos_fs.h
265unifdef-y += msg.h 266unifdef-y += msg.h
266unifdef-y += nbd.h 267unifdef-y += nbd.h
@@ -289,6 +290,7 @@ unifdef-y += parport.h
289unifdef-y += patchkey.h 290unifdef-y += patchkey.h
290unifdef-y += pci.h 291unifdef-y += pci.h
291unifdef-y += personality.h 292unifdef-y += personality.h
293unifdef-y += pim.h
292unifdef-y += pktcdvd.h 294unifdef-y += pktcdvd.h
293unifdef-y += pmu.h 295unifdef-y += pmu.h
294unifdef-y += poll.h 296unifdef-y += poll.h
@@ -333,7 +335,6 @@ unifdef-y += time.h
333unifdef-y += timex.h 335unifdef-y += timex.h
334unifdef-y += tty.h 336unifdef-y += tty.h
335unifdef-y += types.h 337unifdef-y += types.h
336unifdef-y += udf_fs_i.h
337unifdef-y += udp.h 338unifdef-y += udp.h
338unifdef-y += uinput.h 339unifdef-y += uinput.h
339unifdef-y += uio.h 340unifdef-y += uio.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 2c7e003356ac..41f7ce7edd7a 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -79,6 +79,7 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table);
79typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); 79typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
80 80
81char * __acpi_map_table (unsigned long phys_addr, unsigned long size); 81char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
82int early_acpi_boot_init(void);
82int acpi_boot_init (void); 83int acpi_boot_init (void);
83int acpi_boot_table_init (void); 84int acpi_boot_table_init (void);
84int acpi_numa_init (void); 85int acpi_numa_init (void);
@@ -235,6 +236,10 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n,
235 236
236#else /* CONFIG_ACPI */ 237#else /* CONFIG_ACPI */
237 238
239static inline int early_acpi_boot_init(void)
240{
241 return 0;
242}
238static inline int acpi_boot_init(void) 243static inline int acpi_boot_init(void)
239{ 244{
240 return 0; 245 return 0;
diff --git a/include/linux/aer.h b/include/linux/aer.h
index bcf236d825e8..f2518141de88 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -13,7 +13,6 @@ extern int pci_enable_pcie_error_reporting(struct pci_dev *dev);
13extern int pci_find_aer_capability(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); 14extern int pci_disable_pcie_error_reporting(struct pci_dev *dev);
15extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); 15extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
16extern int pci_cleanup_aer_correct_error_status(struct pci_dev *dev);
17#else 16#else
18static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) 17static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev)
19{ 18{
@@ -31,10 +30,6 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
31{ 30{
32 return -EINVAL; 31 return -EINVAL;
33} 32}
34static inline int pci_cleanup_aer_correct_error_status(struct pci_dev *dev)
35{
36 return -EINVAL;
37}
38#endif 33#endif
39 34
40#endif //_AER_H_ 35#endif //_AER_H_
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 03e34547d489..661d90d6cf7c 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -30,8 +30,6 @@
30#ifndef _AGP_BACKEND_H 30#ifndef _AGP_BACKEND_H
31#define _AGP_BACKEND_H 1 31#define _AGP_BACKEND_H 1
32 32
33#ifdef __KERNEL__
34
35#ifndef TRUE 33#ifndef TRUE
36#define TRUE 1 34#define TRUE 1
37#endif 35#endif
@@ -111,5 +109,4 @@ extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
111extern void agp_backend_release(struct agp_bridge_data *); 109extern void agp_backend_release(struct agp_bridge_data *);
112extern void agp_flush_chipset(struct agp_bridge_data *); 110extern void agp_flush_chipset(struct agp_bridge_data *);
113 111
114#endif /* __KERNEL__ */
115#endif /* _AGP_BACKEND_H */ 112#endif /* _AGP_BACKEND_H */
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 0d0b7f629bd3..b51ddd28444e 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -209,27 +209,8 @@ extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
209extern int aio_put_req(struct kiocb *iocb); 209extern int aio_put_req(struct kiocb *iocb);
210extern void kick_iocb(struct kiocb *iocb); 210extern void kick_iocb(struct kiocb *iocb);
211extern int aio_complete(struct kiocb *iocb, long res, long res2); 211extern int aio_complete(struct kiocb *iocb, long res, long res2);
212extern void __put_ioctx(struct kioctx *ctx);
213struct mm_struct; 212struct mm_struct;
214extern void exit_aio(struct mm_struct *mm); 213extern void exit_aio(struct mm_struct *mm);
215extern struct kioctx *lookup_ioctx(unsigned long ctx_id);
216extern int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
217 struct iocb *iocb);
218
219/* semi private, but used by the 32bit emulations: */
220struct kioctx *lookup_ioctx(unsigned long ctx_id);
221int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
222 struct iocb *iocb);
223
224#define get_ioctx(kioctx) do { \
225 BUG_ON(atomic_read(&(kioctx)->users) <= 0); \
226 atomic_inc(&(kioctx)->users); \
227} while (0)
228#define put_ioctx(kioctx) do { \
229 BUG_ON(atomic_read(&(kioctx)->users) <= 0); \
230 if (unlikely(atomic_dec_and_test(&(kioctx)->users))) \
231 __put_ioctx(kioctx); \
232} while (0)
233 214
234#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) 215#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
235 216
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index fde675872c56..a1916078fd08 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -283,8 +283,8 @@ struct arcnet_local {
283 int next_buf, first_free_buf; 283 int next_buf, first_free_buf;
284 284
285 /* network "reconfiguration" handling */ 285 /* network "reconfiguration" handling */
286 time_t first_recon, /* time of "first" RECON message to count */ 286 unsigned long first_recon; /* time of "first" RECON message to count */
287 last_recon; /* time of most recent RECON */ 287 unsigned long last_recon; /* time of most recent RECON */
288 int num_recons; /* number of RECONs between first and last. */ 288 int num_recons; /* number of RECONs between first and last. */
289 bool network_down; /* do we think the network is down? */ 289 bool network_down; /* do we think the network is down? */
290 290
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index b856a2a590d9..9a26c83a2c9e 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -27,7 +27,10 @@ extern int __devexit __pata_platform_remove(struct device *dev);
27/* 27/*
28 * Marvell SATA private data 28 * Marvell SATA private data
29 */ 29 */
30struct mbus_dram_target_info;
31
30struct mv_sata_platform_data { 32struct mv_sata_platform_data {
33 struct mbus_dram_target_info *dram;
31 int n_ports; /* number of sata ports */ 34 int n_ports; /* number of sata ports */
32}; 35};
33 36
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index ced8a1ed080c..e9ebac2e2ecc 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -85,8 +85,6 @@ static inline struct atalk_sock *at_sk(struct sock *sk)
85 return (struct atalk_sock *)sk; 85 return (struct atalk_sock *)sk;
86} 86}
87 87
88#include <asm/byteorder.h>
89
90struct ddpehdr { 88struct ddpehdr {
91 __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */ 89 __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */
92 __be16 deh_sum; 90 __be16 deh_sum;
diff --git a/include/linux/atmel_tc.h b/include/linux/atmel_tc.h
new file mode 100644
index 000000000000..53ba65e30caa
--- /dev/null
+++ b/include/linux/atmel_tc.h
@@ -0,0 +1,252 @@
1/*
2 * Timer/Counter Unit (TC) registers.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10#ifndef ATMEL_TC_H
11#define ATMEL_TC_H
12
13#include <linux/compiler.h>
14#include <linux/list.h>
15
16/*
17 * Many 32-bit Atmel SOCs include one or more TC blocks, each of which holds
18 * three general-purpose 16-bit timers. These timers share one register bank.
19 * Depending on the SOC, each timer may have its own clock and IRQ, or those
20 * may be shared by the whole TC block.
21 *
22 * These TC blocks may have up to nine external pins: TCLK0..2 signals for
23 * clocks or clock gates, and per-timer TIOA and TIOB signals used for PWM
24 * or triggering. Those pins need to be set up for use with the TC block,
25 * else they will be used as GPIOs or for a different controller.
26 *
27 * Although we expect each TC block to have a platform_device node, those
28 * nodes are not what drivers bind to. Instead, they ask for a specific
29 * TC block, by number ... which is a common approach on systems with many
30 * timers. Then they use clk_get() and platform_get_irq() to get clock and
31 * IRQ resources.
32 */
33
34struct clk;
35
36/**
37 * struct atmel_tc - information about a Timer/Counter Block
38 * @pdev: physical device
39 * @iomem: resource associated with the I/O register
40 * @regs: mapping through which the I/O registers can be accessed
41 * @irq: irq for each of the three channels
42 * @clk: internal clock source for each of the three channels
43 * @node: list node, for tclib internal use
44 *
45 * On some platforms, each TC channel has its own clocks and IRQs,
46 * while on others, all TC channels share the same clock and IRQ.
47 * Drivers should clk_enable() all the clocks they need even though
48 * all the entries in @clk may point to the same physical clock.
49 * Likewise, drivers should request irqs independently for each
50 * channel, but they must use IRQF_SHARED in case some of the entries
51 * in @irq are actually the same IRQ.
52 */
53struct atmel_tc {
54 struct platform_device *pdev;
55 struct resource *iomem;
56 void __iomem *regs;
57 int irq[3];
58 struct clk *clk[3];
59 struct list_head node;
60};
61
62extern struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name);
63extern void atmel_tc_free(struct atmel_tc *tc);
64
65/* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */
66extern const u8 atmel_tc_divisors[5];
67
68
69/*
70 * Two registers have block-wide controls. These are: configuring the three
71 * "external" clocks (or event sources) used by the timer channels; and
72 * synchronizing the timers by resetting them all at once.
73 *
74 * "External" can mean "external to chip" using the TCLK0, TCLK1, or TCLK2
75 * signals. Or, it can mean "external to timer", using the TIOA output from
76 * one of the other two timers that's being run in waveform mode.
77 */
78
79#define ATMEL_TC_BCR 0xc0 /* TC Block Control Register */
80#define ATMEL_TC_SYNC (1 << 0) /* synchronize timers */
81
82#define ATMEL_TC_BMR 0xc4 /* TC Block Mode Register */
83#define ATMEL_TC_TC0XC0S (3 << 0) /* external clock 0 source */
84#define ATMEL_TC_TC0XC0S_TCLK0 (0 << 0)
85#define ATMEL_TC_TC0XC0S_NONE (1 << 0)
86#define ATMEL_TC_TC0XC0S_TIOA1 (2 << 0)
87#define ATMEL_TC_TC0XC0S_TIOA2 (3 << 0)
88#define ATMEL_TC_TC1XC1S (3 << 2) /* external clock 1 source */
89#define ATMEL_TC_TC1XC1S_TCLK1 (0 << 2)
90#define ATMEL_TC_TC1XC1S_NONE (1 << 2)
91#define ATMEL_TC_TC1XC1S_TIOA0 (2 << 2)
92#define ATMEL_TC_TC1XC1S_TIOA2 (3 << 2)
93#define ATMEL_TC_TC2XC2S (3 << 4) /* external clock 2 source */
94#define ATMEL_TC_TC2XC2S_TCLK2 (0 << 4)
95#define ATMEL_TC_TC2XC2S_NONE (1 << 4)
96#define ATMEL_TC_TC2XC2S_TIOA0 (2 << 4)
97#define ATMEL_TC_TC2XC2S_TIOA1 (3 << 4)
98
99
100/*
101 * Each TC block has three "channels", each with one counter and controls.
102 *
103 * Note that the semantics of ATMEL_TC_TIMER_CLOCKx (input clock selection
104 * when it's not "external") is silicon-specific. AT91 platforms use one
105 * set of definitions; AVR32 platforms use a different set. Don't hard-wire
106 * such knowledge into your code, use the global "atmel_tc_divisors" ...
107 * where index N is the divisor for clock N+1, else zero to indicate it uses
108 * the 32 KiHz clock.
109 *
110 * The timers can be chained in various ways, and operated in "waveform"
111 * generation mode (including PWM) or "capture" mode (to time events). In
112 * both modes, behavior can be configured in many ways.
113 *
114 * Each timer has two I/O pins, TIOA and TIOB. Waveform mode uses TIOA as a
115 * PWM output, and TIOB as either another PWM or as a trigger. Capture mode
116 * uses them only as inputs.
117 */
118#define ATMEL_TC_CHAN(idx) ((idx)*0x40)
119#define ATMEL_TC_REG(idx, reg) (ATMEL_TC_CHAN(idx) + ATMEL_TC_ ## reg)
120
121#define ATMEL_TC_CCR 0x00 /* Channel Control Register */
122#define ATMEL_TC_CLKEN (1 << 0) /* clock enable */
123#define ATMEL_TC_CLKDIS (1 << 1) /* clock disable */
124#define ATMEL_TC_SWTRG (1 << 2) /* software trigger */
125
126#define ATMEL_TC_CMR 0x04 /* Channel Mode Register */
127
128/* Both modes share some CMR bits */
129#define ATMEL_TC_TCCLKS (7 << 0) /* clock source */
130#define ATMEL_TC_TIMER_CLOCK1 (0 << 0)
131#define ATMEL_TC_TIMER_CLOCK2 (1 << 0)
132#define ATMEL_TC_TIMER_CLOCK3 (2 << 0)
133#define ATMEL_TC_TIMER_CLOCK4 (3 << 0)
134#define ATMEL_TC_TIMER_CLOCK5 (4 << 0)
135#define ATMEL_TC_XC0 (5 << 0)
136#define ATMEL_TC_XC1 (6 << 0)
137#define ATMEL_TC_XC2 (7 << 0)
138#define ATMEL_TC_CLKI (1 << 3) /* clock invert */
139#define ATMEL_TC_BURST (3 << 4) /* clock gating */
140#define ATMEL_TC_GATE_NONE (0 << 4)
141#define ATMEL_TC_GATE_XC0 (1 << 4)
142#define ATMEL_TC_GATE_XC1 (2 << 4)
143#define ATMEL_TC_GATE_XC2 (3 << 4)
144#define ATMEL_TC_WAVE (1 << 15) /* true = Waveform mode */
145
146/* CAPTURE mode CMR bits */
147#define ATMEL_TC_LDBSTOP (1 << 6) /* counter stops on RB load */
148#define ATMEL_TC_LDBDIS (1 << 7) /* counter disable on RB load */
149#define ATMEL_TC_ETRGEDG (3 << 8) /* external trigger edge */
150#define ATMEL_TC_ETRGEDG_NONE (0 << 8)
151#define ATMEL_TC_ETRGEDG_RISING (1 << 8)
152#define ATMEL_TC_ETRGEDG_FALLING (2 << 8)
153#define ATMEL_TC_ETRGEDG_BOTH (3 << 8)
154#define ATMEL_TC_ABETRG (1 << 10) /* external trigger is TIOA? */
155#define ATMEL_TC_CPCTRG (1 << 14) /* RC compare trigger enable */
156#define ATMEL_TC_LDRA (3 << 16) /* RA loading edge (of TIOA) */
157#define ATMEL_TC_LDRA_NONE (0 << 16)
158#define ATMEL_TC_LDRA_RISING (1 << 16)
159#define ATMEL_TC_LDRA_FALLING (2 << 16)
160#define ATMEL_TC_LDRA_BOTH (3 << 16)
161#define ATMEL_TC_LDRB (3 << 18) /* RB loading edge (of TIOA) */
162#define ATMEL_TC_LDRB_NONE (0 << 18)
163#define ATMEL_TC_LDRB_RISING (1 << 18)
164#define ATMEL_TC_LDRB_FALLING (2 << 18)
165#define ATMEL_TC_LDRB_BOTH (3 << 18)
166
167/* WAVEFORM mode CMR bits */
168#define ATMEL_TC_CPCSTOP (1 << 6) /* RC compare stops counter */
169#define ATMEL_TC_CPCDIS (1 << 7) /* RC compare disables counter */
170#define ATMEL_TC_EEVTEDG (3 << 8) /* external event edge */
171#define ATMEL_TC_EEVTEDG_NONE (0 << 8)
172#define ATMEL_TC_EEVTEDG_RISING (1 << 8)
173#define ATMEL_TC_EEVTEDG_FALLING (2 << 8)
174#define ATMEL_TC_EEVTEDG_BOTH (3 << 8)
175#define ATMEL_TC_EEVT (3 << 10) /* external event source */
176#define ATMEL_TC_EEVT_TIOB (0 << 10)
177#define ATMEL_TC_EEVT_XC0 (1 << 10)
178#define ATMEL_TC_EEVT_XC1 (2 << 10)
179#define ATMEL_TC_EEVT_XC2 (3 << 10)
180#define ATMEL_TC_ENETRG (1 << 12) /* external event is trigger */
181#define ATMEL_TC_WAVESEL (3 << 13) /* waveform type */
182#define ATMEL_TC_WAVESEL_UP (0 << 13)
183#define ATMEL_TC_WAVESEL_UPDOWN (1 << 13)
184#define ATMEL_TC_WAVESEL_UP_AUTO (2 << 13)
185#define ATMEL_TC_WAVESEL_UPDOWN_AUTO (3 << 13)
186#define ATMEL_TC_ACPA (3 << 16) /* RA compare changes TIOA */
187#define ATMEL_TC_ACPA_NONE (0 << 16)
188#define ATMEL_TC_ACPA_SET (1 << 16)
189#define ATMEL_TC_ACPA_CLEAR (2 << 16)
190#define ATMEL_TC_ACPA_TOGGLE (3 << 16)
191#define ATMEL_TC_ACPC (3 << 18) /* RC compare changes TIOA */
192#define ATMEL_TC_ACPC_NONE (0 << 18)
193#define ATMEL_TC_ACPC_SET (1 << 18)
194#define ATMEL_TC_ACPC_CLEAR (2 << 18)
195#define ATMEL_TC_ACPC_TOGGLE (3 << 18)
196#define ATMEL_TC_AEEVT (3 << 20) /* external event changes TIOA */
197#define ATMEL_TC_AEEVT_NONE (0 << 20)
198#define ATMEL_TC_AEEVT_SET (1 << 20)
199#define ATMEL_TC_AEEVT_CLEAR (2 << 20)
200#define ATMEL_TC_AEEVT_TOGGLE (3 << 20)
201#define ATMEL_TC_ASWTRG (3 << 22) /* software trigger changes TIOA */
202#define ATMEL_TC_ASWTRG_NONE (0 << 22)
203#define ATMEL_TC_ASWTRG_SET (1 << 22)
204#define ATMEL_TC_ASWTRG_CLEAR (2 << 22)
205#define ATMEL_TC_ASWTRG_TOGGLE (3 << 22)
206#define ATMEL_TC_BCPB (3 << 24) /* RB compare changes TIOB */
207#define ATMEL_TC_BCPB_NONE (0 << 24)
208#define ATMEL_TC_BCPB_SET (1 << 24)
209#define ATMEL_TC_BCPB_CLEAR (2 << 24)
210#define ATMEL_TC_BCPB_TOGGLE (3 << 24)
211#define ATMEL_TC_BCPC (3 << 26) /* RC compare changes TIOB */
212#define ATMEL_TC_BCPC_NONE (0 << 26)
213#define ATMEL_TC_BCPC_SET (1 << 26)
214#define ATMEL_TC_BCPC_CLEAR (2 << 26)
215#define ATMEL_TC_BCPC_TOGGLE (3 << 26)
216#define ATMEL_TC_BEEVT (3 << 28) /* external event changes TIOB */
217#define ATMEL_TC_BEEVT_NONE (0 << 28)
218#define ATMEL_TC_BEEVT_SET (1 << 28)
219#define ATMEL_TC_BEEVT_CLEAR (2 << 28)
220#define ATMEL_TC_BEEVT_TOGGLE (3 << 28)
221#define ATMEL_TC_BSWTRG (3 << 30) /* software trigger changes TIOB */
222#define ATMEL_TC_BSWTRG_NONE (0 << 30)
223#define ATMEL_TC_BSWTRG_SET (1 << 30)
224#define ATMEL_TC_BSWTRG_CLEAR (2 << 30)
225#define ATMEL_TC_BSWTRG_TOGGLE (3 << 30)
226
227#define ATMEL_TC_CV 0x10 /* counter Value */
228#define ATMEL_TC_RA 0x14 /* register A */
229#define ATMEL_TC_RB 0x18 /* register B */
230#define ATMEL_TC_RC 0x1c /* register C */
231
232#define ATMEL_TC_SR 0x20 /* status (read-only) */
233/* Status-only flags */
234#define ATMEL_TC_CLKSTA (1 << 16) /* clock enabled */
235#define ATMEL_TC_MTIOA (1 << 17) /* TIOA mirror */
236#define ATMEL_TC_MTIOB (1 << 18) /* TIOB mirror */
237
238#define ATMEL_TC_IER 0x24 /* interrupt enable (write-only) */
239#define ATMEL_TC_IDR 0x28 /* interrupt disable (write-only) */
240#define ATMEL_TC_IMR 0x2c /* interrupt mask (read-only) */
241
242/* Status and IRQ flags */
243#define ATMEL_TC_COVFS (1 << 0) /* counter overflow */
244#define ATMEL_TC_LOVRS (1 << 1) /* load overrun */
245#define ATMEL_TC_CPAS (1 << 2) /* RA compare */
246#define ATMEL_TC_CPBS (1 << 3) /* RB compare */
247#define ATMEL_TC_CPCS (1 << 4) /* RC compare */
248#define ATMEL_TC_LDRAS (1 << 5) /* RA loading */
249#define ATMEL_TC_LDRBS (1 << 6) /* RB loading */
250#define ATMEL_TC_ETRGS (1 << 7) /* external trigger */
251
252#endif
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index f5582332af04..794ad74b1d61 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * class_container.h - a generic container for all classes 2 * attribute_container.h - a generic container for all classes
3 * 3 *
4 * Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com> 4 * Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com>
5 * 5 *
@@ -18,7 +18,7 @@ struct attribute_container {
18 struct klist containers; 18 struct klist containers;
19 struct class *class; 19 struct class *class;
20 struct attribute_group *grp; 20 struct attribute_group *grp;
21 struct class_device_attribute **attrs; 21 struct device_attribute **attrs;
22 int (*match)(struct attribute_container *, struct device *); 22 int (*match)(struct attribute_container *, struct device *);
23#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01 23#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
24 unsigned long flags; 24 unsigned long flags;
@@ -37,35 +37,35 @@ attribute_container_set_no_classdevs(struct attribute_container *atc)
37} 37}
38 38
39int attribute_container_register(struct attribute_container *cont); 39int attribute_container_register(struct attribute_container *cont);
40int attribute_container_unregister(struct attribute_container *cont); 40int __must_check attribute_container_unregister(struct attribute_container *cont);
41void attribute_container_create_device(struct device *dev, 41void attribute_container_create_device(struct device *dev,
42 int (*fn)(struct attribute_container *, 42 int (*fn)(struct attribute_container *,
43 struct device *, 43 struct device *,
44 struct class_device *)); 44 struct device *));
45void attribute_container_add_device(struct device *dev, 45void attribute_container_add_device(struct device *dev,
46 int (*fn)(struct attribute_container *, 46 int (*fn)(struct attribute_container *,
47 struct device *, 47 struct device *,
48 struct class_device *)); 48 struct device *));
49void attribute_container_remove_device(struct device *dev, 49void attribute_container_remove_device(struct device *dev,
50 void (*fn)(struct attribute_container *, 50 void (*fn)(struct attribute_container *,
51 struct device *, 51 struct device *,
52 struct class_device *)); 52 struct device *));
53void attribute_container_device_trigger(struct device *dev, 53void attribute_container_device_trigger(struct device *dev,
54 int (*fn)(struct attribute_container *, 54 int (*fn)(struct attribute_container *,
55 struct device *, 55 struct device *,
56 struct class_device *)); 56 struct device *));
57void attribute_container_trigger(struct device *dev, 57void attribute_container_trigger(struct device *dev,
58 int (*fn)(struct attribute_container *, 58 int (*fn)(struct attribute_container *,
59 struct device *)); 59 struct device *));
60int attribute_container_add_attrs(struct class_device *classdev); 60int attribute_container_add_attrs(struct device *classdev);
61int attribute_container_add_class_device(struct class_device *classdev); 61int attribute_container_add_class_device(struct device *classdev);
62int attribute_container_add_class_device_adapter(struct attribute_container *cont, 62int attribute_container_add_class_device_adapter(struct attribute_container *cont,
63 struct device *dev, 63 struct device *dev,
64 struct class_device *classdev); 64 struct device *classdev);
65void attribute_container_remove_attrs(struct class_device *classdev); 65void attribute_container_remove_attrs(struct device *classdev);
66void attribute_container_class_device_del(struct class_device *classdev); 66void attribute_container_class_device_del(struct device *classdev);
67struct attribute_container *attribute_container_classdev_to_container(struct class_device *); 67struct attribute_container *attribute_container_classdev_to_container(struct device *);
68struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *); 68struct device *attribute_container_find_class_device(struct attribute_container *, struct device *);
69struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev); 69struct device_attribute **attribute_container_classdev_to_attrs(const struct device *classdev);
70 70
71#endif 71#endif
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 2af9ec025015..63c3bb98558f 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -146,7 +146,7 @@
146/* Rule structure sizes -- if these change, different AUDIT_ADD and 146/* Rule structure sizes -- if these change, different AUDIT_ADD and
147 * AUDIT_LIST commands must be implemented. */ 147 * AUDIT_LIST commands must be implemented. */
148#define AUDIT_MAX_FIELDS 64 148#define AUDIT_MAX_FIELDS 64
149#define AUDIT_MAX_KEY_LEN 32 149#define AUDIT_MAX_KEY_LEN 256
150#define AUDIT_BITMASK_SIZE 64 150#define AUDIT_BITMASK_SIZE 64
151#define AUDIT_WORD(nr) ((__u32)((nr)/32)) 151#define AUDIT_WORD(nr) ((__u32)((nr)/32))
152#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) 152#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32))
@@ -209,6 +209,7 @@
209#define AUDIT_WATCH 105 209#define AUDIT_WATCH 105
210#define AUDIT_PERM 106 210#define AUDIT_PERM 106
211#define AUDIT_DIR 107 211#define AUDIT_DIR 107
212#define AUDIT_FILETYPE 108
212 213
213#define AUDIT_ARG0 200 214#define AUDIT_ARG0 200
214#define AUDIT_ARG1 (AUDIT_ARG0+1) 215#define AUDIT_ARG1 (AUDIT_ARG0+1)
@@ -353,6 +354,33 @@ struct netlink_skb_parms;
353struct linux_binprm; 354struct linux_binprm;
354struct mq_attr; 355struct mq_attr;
355struct mqstat; 356struct mqstat;
357struct audit_watch;
358struct audit_tree;
359
360struct audit_krule {
361 int vers_ops;
362 u32 flags;
363 u32 listnr;
364 u32 action;
365 u32 mask[AUDIT_BITMASK_SIZE];
366 u32 buflen; /* for data alloc on list rules */
367 u32 field_count;
368 char *filterkey; /* ties events to rules */
369 struct audit_field *fields;
370 struct audit_field *arch_f; /* quick access to arch field */
371 struct audit_field *inode_f; /* quick access to an inode field */
372 struct audit_watch *watch; /* associated watch */
373 struct audit_tree *tree; /* associated watched tree */
374 struct list_head rlist; /* entry in audit_{watch,tree}.rules list */
375};
376
377struct audit_field {
378 u32 type;
379 u32 val;
380 u32 op;
381 char *lsm_str;
382 void *lsm_rule;
383};
356 384
357#define AUDITSC_INVALID 0 385#define AUDITSC_INVALID 0
358#define AUDITSC_SUCCESS 1 386#define AUDITSC_SUCCESS 1
@@ -522,25 +550,32 @@ extern void audit_log_format(struct audit_buffer *ab,
522 const char *fmt, ...) 550 const char *fmt, ...)
523 __attribute__((format(printf,2,3))); 551 __attribute__((format(printf,2,3)));
524extern void audit_log_end(struct audit_buffer *ab); 552extern void audit_log_end(struct audit_buffer *ab);
525extern void audit_log_hex(struct audit_buffer *ab,
526 const unsigned char *buf,
527 size_t len);
528extern int audit_string_contains_control(const char *string, 553extern int audit_string_contains_control(const char *string,
529 size_t len); 554 size_t len);
555extern void audit_log_n_hex(struct audit_buffer *ab,
556 const unsigned char *buf,
557 size_t len);
558extern void audit_log_n_string(struct audit_buffer *ab,
559 const char *buf,
560 size_t n);
561#define audit_log_string(a,b) audit_log_n_string(a, b, strlen(b));
562extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
563 const char *string,
564 size_t n);
530extern void audit_log_untrustedstring(struct audit_buffer *ab, 565extern void audit_log_untrustedstring(struct audit_buffer *ab,
531 const char *string); 566 const char *string);
532extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
533 size_t n,
534 const char *string);
535extern void audit_log_d_path(struct audit_buffer *ab, 567extern void audit_log_d_path(struct audit_buffer *ab,
536 const char *prefix, 568 const char *prefix,
537 struct path *path); 569 struct path *path);
538extern void audit_log_lost(const char *message); 570extern void audit_log_lost(const char *message);
571extern int audit_update_lsm_rules(void);
572
539 /* Private API (for audit.c only) */ 573 /* Private API (for audit.c only) */
540extern int audit_filter_user(struct netlink_skb_parms *cb, int type); 574extern int audit_filter_user(struct netlink_skb_parms *cb, int type);
541extern int audit_filter_type(int type); 575extern int audit_filter_type(int type);
542extern int audit_receive_filter(int type, int pid, int uid, int seq, 576extern int audit_receive_filter(int type, int pid, int uid, int seq,
543 void *data, size_t datasz, uid_t loginuid, u32 sid); 577 void *data, size_t datasz, uid_t loginuid,
578 u32 sessionid, u32 sid);
544extern int audit_enabled; 579extern int audit_enabled;
545#else 580#else
546#define audit_log(c,g,t,f,...) do { ; } while (0) 581#define audit_log(c,g,t,f,...) do { ; } while (0)
@@ -548,9 +583,11 @@ extern int audit_enabled;
548#define audit_log_vformat(b,f,a) do { ; } while (0) 583#define audit_log_vformat(b,f,a) do { ; } while (0)
549#define audit_log_format(b,f,...) do { ; } while (0) 584#define audit_log_format(b,f,...) do { ; } while (0)
550#define audit_log_end(b) do { ; } while (0) 585#define audit_log_end(b) do { ; } while (0)
551#define audit_log_hex(a,b,l) do { ; } while (0) 586#define audit_log_n_hex(a,b,l) do { ; } while (0)
552#define audit_log_untrustedstring(a,s) do { ; } while (0) 587#define audit_log_n_string(a,c,l) do { ; } while (0)
588#define audit_log_string(a,c) do { ; } while (0)
553#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0) 589#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0)
590#define audit_log_untrustedstring(a,s) do { ; } while (0)
554#define audit_log_d_path(b, p, d) do { ; } while (0) 591#define audit_log_d_path(b, p, d) do { ; } while (0)
555#define audit_enabled 0 592#define audit_enabled 0
556#endif 593#endif
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 48a62baace58..0a24d5550eb3 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -11,9 +11,13 @@
11#include <linux/percpu_counter.h> 11#include <linux/percpu_counter.h>
12#include <linux/log2.h> 12#include <linux/log2.h>
13#include <linux/proportions.h> 13#include <linux/proportions.h>
14#include <linux/kernel.h>
15#include <linux/fs.h>
14#include <asm/atomic.h> 16#include <asm/atomic.h>
15 17
16struct page; 18struct page;
19struct device;
20struct dentry;
17 21
18/* 22/*
19 * Bits in backing_dev_info.state 23 * Bits in backing_dev_info.state
@@ -48,11 +52,26 @@ struct backing_dev_info {
48 52
49 struct prop_local_percpu completions; 53 struct prop_local_percpu completions;
50 int dirty_exceeded; 54 int dirty_exceeded;
55
56 unsigned int min_ratio;
57 unsigned int max_ratio, max_prop_frac;
58
59 struct device *dev;
60
61#ifdef CONFIG_DEBUG_FS
62 struct dentry *debug_dir;
63 struct dentry *debug_stats;
64#endif
51}; 65};
52 66
53int bdi_init(struct backing_dev_info *bdi); 67int bdi_init(struct backing_dev_info *bdi);
54void bdi_destroy(struct backing_dev_info *bdi); 68void bdi_destroy(struct backing_dev_info *bdi);
55 69
70int bdi_register(struct backing_dev_info *bdi, struct device *parent,
71 const char *fmt, ...);
72int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
73void bdi_unregister(struct backing_dev_info *bdi);
74
56static inline void __add_bdi_stat(struct backing_dev_info *bdi, 75static inline void __add_bdi_stat(struct backing_dev_info *bdi,
57 enum bdi_stat_item item, s64 amount) 76 enum bdi_stat_item item, s64 amount)
58{ 77{
@@ -116,6 +135,8 @@ static inline s64 bdi_stat_sum(struct backing_dev_info *bdi,
116 return sum; 135 return sum;
117} 136}
118 137
138extern void bdi_writeout_inc(struct backing_dev_info *bdi);
139
119/* 140/*
120 * maximal error of a stat counter. 141 * maximal error of a stat counter.
121 */ 142 */
@@ -128,24 +149,48 @@ static inline unsigned long bdi_stat_error(struct backing_dev_info *bdi)
128#endif 149#endif
129} 150}
130 151
152int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio);
153int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
154
131/* 155/*
132 * Flags in backing_dev_info::capability 156 * Flags in backing_dev_info::capability
133 * - The first two flags control whether dirty pages will contribute to the 157 *
134 * VM's accounting and whether writepages() should be called for dirty pages 158 * The first three flags control whether dirty pages will contribute to the
135 * (something that would not, for example, be appropriate for ramfs) 159 * VM's accounting and whether writepages() should be called for dirty pages
136 * - These flags let !MMU mmap() govern direct device mapping vs immediate 160 * (something that would not, for example, be appropriate for ramfs)
137 * copying more easily for MAP_PRIVATE, especially for ROM filesystems 161 *
162 * WARNING: these flags are closely related and should not normally be
163 * used separately. The BDI_CAP_NO_ACCT_AND_WRITEBACK combines these
164 * three flags into a single convenience macro.
165 *
166 * BDI_CAP_NO_ACCT_DIRTY: Dirty pages shouldn't contribute to accounting
167 * BDI_CAP_NO_WRITEBACK: Don't write pages back
168 * BDI_CAP_NO_ACCT_WB: Don't automatically account writeback pages
169 *
170 * These flags let !MMU mmap() govern direct device mapping vs immediate
171 * copying more easily for MAP_PRIVATE, especially for ROM filesystems.
172 *
173 * BDI_CAP_MAP_COPY: Copy can be mapped (MAP_PRIVATE)
174 * BDI_CAP_MAP_DIRECT: Can be mapped directly (MAP_SHARED)
175 * BDI_CAP_READ_MAP: Can be mapped for reading
176 * BDI_CAP_WRITE_MAP: Can be mapped for writing
177 * BDI_CAP_EXEC_MAP: Can be mapped for execution
138 */ 178 */
139#define BDI_CAP_NO_ACCT_DIRTY 0x00000001 /* Dirty pages shouldn't contribute to accounting */ 179#define BDI_CAP_NO_ACCT_DIRTY 0x00000001
140#define BDI_CAP_NO_WRITEBACK 0x00000002 /* Don't write pages back */ 180#define BDI_CAP_NO_WRITEBACK 0x00000002
141#define BDI_CAP_MAP_COPY 0x00000004 /* Copy can be mapped (MAP_PRIVATE) */ 181#define BDI_CAP_MAP_COPY 0x00000004
142#define BDI_CAP_MAP_DIRECT 0x00000008 /* Can be mapped directly (MAP_SHARED) */ 182#define BDI_CAP_MAP_DIRECT 0x00000008
143#define BDI_CAP_READ_MAP 0x00000010 /* Can be mapped for reading */ 183#define BDI_CAP_READ_MAP 0x00000010
144#define BDI_CAP_WRITE_MAP 0x00000020 /* Can be mapped for writing */ 184#define BDI_CAP_WRITE_MAP 0x00000020
145#define BDI_CAP_EXEC_MAP 0x00000040 /* Can be mapped for execution */ 185#define BDI_CAP_EXEC_MAP 0x00000040
186#define BDI_CAP_NO_ACCT_WB 0x00000080
187
146#define BDI_CAP_VMFLAGS \ 188#define BDI_CAP_VMFLAGS \
147 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) 189 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
148 190
191#define BDI_CAP_NO_ACCT_AND_WRITEBACK \
192 (BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_ACCT_WB)
193
149#if defined(VM_MAYREAD) && \ 194#if defined(VM_MAYREAD) && \
150 (BDI_CAP_READ_MAP != VM_MAYREAD || \ 195 (BDI_CAP_READ_MAP != VM_MAYREAD || \
151 BDI_CAP_WRITE_MAP != VM_MAYWRITE || \ 196 BDI_CAP_WRITE_MAP != VM_MAYWRITE || \
@@ -156,9 +201,7 @@ static inline unsigned long bdi_stat_error(struct backing_dev_info *bdi)
156extern struct backing_dev_info default_backing_dev_info; 201extern struct backing_dev_info default_backing_dev_info;
157void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); 202void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);
158 203
159int writeback_acquire(struct backing_dev_info *bdi);
160int writeback_in_progress(struct backing_dev_info *bdi); 204int writeback_in_progress(struct backing_dev_info *bdi);
161void writeback_release(struct backing_dev_info *bdi);
162 205
163static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits) 206static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits)
164{ 207{
@@ -187,17 +230,32 @@ void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
187void set_bdi_congested(struct backing_dev_info *bdi, int rw); 230void set_bdi_congested(struct backing_dev_info *bdi, int rw);
188long congestion_wait(int rw, long timeout); 231long congestion_wait(int rw, long timeout);
189 232
190#define bdi_cap_writeback_dirty(bdi) \
191 (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK))
192 233
193#define bdi_cap_account_dirty(bdi) \ 234static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi)
194 (!((bdi)->capabilities & BDI_CAP_NO_ACCT_DIRTY)) 235{
236 return !(bdi->capabilities & BDI_CAP_NO_WRITEBACK);
237}
238
239static inline bool bdi_cap_account_dirty(struct backing_dev_info *bdi)
240{
241 return !(bdi->capabilities & BDI_CAP_NO_ACCT_DIRTY);
242}
195 243
196#define mapping_cap_writeback_dirty(mapping) \ 244static inline bool bdi_cap_account_writeback(struct backing_dev_info *bdi)
197 bdi_cap_writeback_dirty((mapping)->backing_dev_info) 245{
246 /* Paranoia: BDI_CAP_NO_WRITEBACK implies BDI_CAP_NO_ACCT_WB */
247 return !(bdi->capabilities & (BDI_CAP_NO_ACCT_WB |
248 BDI_CAP_NO_WRITEBACK));
249}
198 250
199#define mapping_cap_account_dirty(mapping) \ 251static inline bool mapping_cap_writeback_dirty(struct address_space *mapping)
200 bdi_cap_account_dirty((mapping)->backing_dev_info) 252{
253 return bdi_cap_writeback_dirty(mapping->backing_dev_info);
254}
201 255
256static inline bool mapping_cap_account_dirty(struct address_space *mapping)
257{
258 return bdi_cap_account_dirty(mapping->backing_dev_info);
259}
202 260
203#endif /* _LINUX_BACKING_DEV_H */ 261#endif /* _LINUX_BACKING_DEV_H */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index b7fc55ec8d48..b512e48f6d8e 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -34,7 +34,8 @@ struct linux_binprm{
34#endif 34#endif
35 struct mm_struct *mm; 35 struct mm_struct *mm;
36 unsigned long p; /* current top of mem */ 36 unsigned long p; /* current top of mem */
37 int sh_bang; 37 unsigned int sh_bang:1,
38 misc_bang:1;
38 struct file * file; 39 struct file * file;
39 int e_uid, e_gid; 40 int e_uid, e_gid;
40 kernel_cap_t cap_inheritable, cap_permitted; 41 kernel_cap_t cap_inheritable, cap_permitted;
@@ -48,7 +49,6 @@ struct linux_binprm{
48 unsigned interp_flags; 49 unsigned interp_flags;
49 unsigned interp_data; 50 unsigned interp_data;
50 unsigned long loader, exec; 51 unsigned long loader, exec;
51 unsigned long argv_len;
52}; 52};
53 53
54#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 54#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4c59bdccd3ee..61c15eaf3fb3 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -324,9 +324,13 @@ extern struct bio *bio_map_user_iov(struct request_queue *,
324extern void bio_unmap_user(struct bio *); 324extern void bio_unmap_user(struct bio *);
325extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, 325extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
326 gfp_t); 326 gfp_t);
327extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int,
328 gfp_t, int);
327extern void bio_set_pages_dirty(struct bio *bio); 329extern void bio_set_pages_dirty(struct bio *bio);
328extern void bio_check_pages_dirty(struct bio *bio); 330extern void bio_check_pages_dirty(struct bio *bio);
329extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); 331extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int);
332extern struct bio *bio_copy_user_iov(struct request_queue *, struct sg_iovec *,
333 int, int);
330extern int bio_uncopy_user(struct bio *); 334extern int bio_uncopy_user(struct bio *);
331void zero_fill_bio(struct bio *bio); 335void zero_fill_bio(struct bio *bio);
332 336
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index acad1105d942..43b406def35f 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -46,6 +46,8 @@
46 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n 46 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
47 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) 47 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src)
48 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit) 48 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit)
49 * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap
50 * bitmap_fold(dst, orig, sz, nbits) dst bits = orig bits mod sz
49 * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf 51 * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf
50 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf 52 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf
51 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf 53 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
@@ -108,6 +110,7 @@ extern int __bitmap_weight(const unsigned long *bitmap, int bits);
108 110
109extern int bitmap_scnprintf(char *buf, unsigned int len, 111extern int bitmap_scnprintf(char *buf, unsigned int len,
110 const unsigned long *src, int nbits); 112 const unsigned long *src, int nbits);
113extern int bitmap_scnprintf_len(unsigned int len);
111extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, 114extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user,
112 unsigned long *dst, int nbits); 115 unsigned long *dst, int nbits);
113extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, 116extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen,
@@ -120,6 +123,10 @@ extern void bitmap_remap(unsigned long *dst, const unsigned long *src,
120 const unsigned long *old, const unsigned long *new, int bits); 123 const unsigned long *old, const unsigned long *new, int bits);
121extern int bitmap_bitremap(int oldbit, 124extern int bitmap_bitremap(int oldbit,
122 const unsigned long *old, const unsigned long *new, int bits); 125 const unsigned long *old, const unsigned long *new, int bits);
126extern void bitmap_onto(unsigned long *dst, const unsigned long *orig,
127 const unsigned long *relmap, int bits);
128extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
129 int sz, int bits);
123extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); 130extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order);
124extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); 131extern void bitmap_release_region(unsigned long *bitmap, int pos, int order);
125extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); 132extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 40d54731de7e..024f2b027244 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -6,8 +6,8 @@
6#define BIT(nr) (1UL << (nr)) 6#define BIT(nr) (1UL << (nr))
7#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) 7#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
8#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) 8#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
9#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
10#define BITS_PER_BYTE 8 9#define BITS_PER_BYTE 8
10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
11#endif 11#endif
12 12
13/* 13/*
@@ -112,4 +112,53 @@ static inline unsigned fls_long(unsigned long l)
112 return fls64(l); 112 return fls64(l);
113} 113}
114 114
115#ifdef __KERNEL__
116#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
117
118/**
119 * find_first_bit - find the first set bit in a memory region
120 * @addr: The address to start the search at
121 * @size: The maximum size to search
122 *
123 * Returns the bit number of the first set bit.
124 */
125extern unsigned long find_first_bit(const unsigned long *addr,
126 unsigned long size);
127
128/**
129 * find_first_zero_bit - find the first cleared bit in a memory region
130 * @addr: The address to start the search at
131 * @size: The maximum size to search
132 *
133 * Returns the bit number of the first cleared bit.
134 */
135extern unsigned long find_first_zero_bit(const unsigned long *addr,
136 unsigned long size);
137
138#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
139
140#ifdef CONFIG_GENERIC_FIND_NEXT_BIT
141
142/**
143 * find_next_bit - find the next set bit in a memory region
144 * @addr: The address to base the search on
145 * @offset: The bitnumber to start searching at
146 * @size: The bitmap size in bits
147 */
148extern unsigned long find_next_bit(const unsigned long *addr,
149 unsigned long size, unsigned long offset);
150
151/**
152 * find_next_zero_bit - find the next cleared bit in a memory region
153 * @addr: The address to base the search on
154 * @offset: The bitnumber to start searching at
155 * @size: The bitmap size in bits
156 */
157
158extern unsigned long find_next_zero_bit(const unsigned long *addr,
159 unsigned long size,
160 unsigned long offset);
161
162#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */
163#endif /* __KERNEL__ */
115#endif 164#endif
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 6f79d40dd3c0..d2a1b71e93c3 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -112,6 +112,7 @@ enum rq_flag_bits {
112 __REQ_RW_SYNC, /* request is sync (O_DIRECT) */ 112 __REQ_RW_SYNC, /* request is sync (O_DIRECT) */
113 __REQ_ALLOCED, /* request came from our alloc pool */ 113 __REQ_ALLOCED, /* request came from our alloc pool */
114 __REQ_RW_META, /* metadata io request */ 114 __REQ_RW_META, /* metadata io request */
115 __REQ_COPY_USER, /* contains copies of user pages */
115 __REQ_NR_BITS, /* stops here */ 116 __REQ_NR_BITS, /* stops here */
116}; 117};
117 118
@@ -133,6 +134,7 @@ enum rq_flag_bits {
133#define REQ_RW_SYNC (1 << __REQ_RW_SYNC) 134#define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
134#define REQ_ALLOCED (1 << __REQ_ALLOCED) 135#define REQ_ALLOCED (1 << __REQ_ALLOCED)
135#define REQ_RW_META (1 << __REQ_RW_META) 136#define REQ_RW_META (1 << __REQ_RW_META)
137#define REQ_COPY_USER (1 << __REQ_COPY_USER)
136 138
137#define BLK_MAX_CDB 16 139#define BLK_MAX_CDB 16
138 140
@@ -213,8 +215,9 @@ struct request {
213 /* 215 /*
214 * when request is used as a packet command carrier 216 * when request is used as a packet command carrier
215 */ 217 */
216 unsigned int cmd_len; 218 unsigned short cmd_len;
217 unsigned char cmd[BLK_MAX_CDB]; 219 unsigned char __cmd[BLK_MAX_CDB];
220 unsigned char *cmd;
218 221
219 unsigned int data_len; 222 unsigned int data_len;
220 unsigned int extra_len; /* length of alignment and padding */ 223 unsigned int extra_len; /* length of alignment and padding */
@@ -405,6 +408,41 @@ struct request_queue
405#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 408#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
406#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ 409#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */
407#define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ 410#define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */
411#define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */
412
413static inline int queue_is_locked(struct request_queue *q)
414{
415#ifdef CONFIG_SMP
416 spinlock_t *lock = q->queue_lock;
417 return lock && spin_is_locked(lock);
418#else
419 return 1;
420#endif
421}
422
423static inline void queue_flag_set_unlocked(unsigned int flag,
424 struct request_queue *q)
425{
426 __set_bit(flag, &q->queue_flags);
427}
428
429static inline void queue_flag_set(unsigned int flag, struct request_queue *q)
430{
431 WARN_ON_ONCE(!queue_is_locked(q));
432 __set_bit(flag, &q->queue_flags);
433}
434
435static inline void queue_flag_clear_unlocked(unsigned int flag,
436 struct request_queue *q)
437{
438 __clear_bit(flag, &q->queue_flags);
439}
440
441static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
442{
443 WARN_ON_ONCE(!queue_is_locked(q));
444 __clear_bit(flag, &q->queue_flags);
445}
408 446
409enum { 447enum {
410 /* 448 /*
@@ -449,6 +487,7 @@ enum {
449#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) 487#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
450#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 488#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
451#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 489#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
490#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
452#define blk_queue_flushing(q) ((q)->ordseq) 491#define blk_queue_flushing(q) ((q)->ordseq)
453 492
454#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) 493#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
@@ -494,17 +533,17 @@ static inline int blk_queue_full(struct request_queue *q, int rw)
494static inline void blk_set_queue_full(struct request_queue *q, int rw) 533static inline void blk_set_queue_full(struct request_queue *q, int rw)
495{ 534{
496 if (rw == READ) 535 if (rw == READ)
497 set_bit(QUEUE_FLAG_READFULL, &q->queue_flags); 536 queue_flag_set(QUEUE_FLAG_READFULL, q);
498 else 537 else
499 set_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags); 538 queue_flag_set(QUEUE_FLAG_WRITEFULL, q);
500} 539}
501 540
502static inline void blk_clear_queue_full(struct request_queue *q, int rw) 541static inline void blk_clear_queue_full(struct request_queue *q, int rw)
503{ 542{
504 if (rw == READ) 543 if (rw == READ)
505 clear_bit(QUEUE_FLAG_READFULL, &q->queue_flags); 544 queue_flag_clear(QUEUE_FLAG_READFULL, q);
506 else 545 else
507 clear_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags); 546 queue_flag_clear(QUEUE_FLAG_WRITEFULL, q);
508} 547}
509 548
510 549
@@ -533,8 +572,13 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn;
533 * BLK_BOUNCE_ANY : don't bounce anything 572 * BLK_BOUNCE_ANY : don't bounce anything
534 * BLK_BOUNCE_ISA : bounce pages above ISA DMA boundary 573 * BLK_BOUNCE_ISA : bounce pages above ISA DMA boundary
535 */ 574 */
575
576#if BITS_PER_LONG == 32
536#define BLK_BOUNCE_HIGH ((u64)blk_max_low_pfn << PAGE_SHIFT) 577#define BLK_BOUNCE_HIGH ((u64)blk_max_low_pfn << PAGE_SHIFT)
537#define BLK_BOUNCE_ANY ((u64)blk_max_pfn << PAGE_SHIFT) 578#else
579#define BLK_BOUNCE_HIGH -1ULL
580#endif
581#define BLK_BOUNCE_ANY (-1ULL)
538#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) 582#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD)
539 583
540/* 584/*
@@ -576,6 +620,7 @@ extern int blk_register_queue(struct gendisk *disk);
576extern void blk_unregister_queue(struct gendisk *disk); 620extern void blk_unregister_queue(struct gendisk *disk);
577extern void register_disk(struct gendisk *dev); 621extern void register_disk(struct gendisk *dev);
578extern void generic_make_request(struct bio *bio); 622extern void generic_make_request(struct bio *bio);
623extern void blk_rq_init(struct request_queue *q, struct request *rq);
579extern void blk_put_request(struct request *); 624extern void blk_put_request(struct request *);
580extern void __blk_put_request(struct request_queue *, struct request *); 625extern void __blk_put_request(struct request_queue *, struct request *);
581extern void blk_end_sync_rq(struct request *rq, int error); 626extern void blk_end_sync_rq(struct request *rq, int error);
@@ -619,6 +664,7 @@ extern void blk_start_queue(struct request_queue *q);
619extern void blk_stop_queue(struct request_queue *q); 664extern void blk_stop_queue(struct request_queue *q);
620extern void blk_sync_queue(struct request_queue *q); 665extern void blk_sync_queue(struct request_queue *q);
621extern void __blk_stop_queue(struct request_queue *q); 666extern void __blk_stop_queue(struct request_queue *q);
667extern void __blk_run_queue(struct request_queue *);
622extern void blk_run_queue(struct request_queue *); 668extern void blk_run_queue(struct request_queue *);
623extern void blk_start_queueing(struct request_queue *); 669extern void blk_start_queueing(struct request_queue *);
624extern int blk_rq_map_user(struct request_queue *, struct request *, void __user *, unsigned long); 670extern int blk_rq_map_user(struct request_queue *, struct request *, void __user *, unsigned long);
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 4e4e340592fb..6a5dbdc8a7dc 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -101,6 +101,8 @@ extern void reserve_bootmem_node(pg_data_t *pgdat,
101extern void free_bootmem_node(pg_data_t *pgdat, 101extern void free_bootmem_node(pg_data_t *pgdat,
102 unsigned long addr, 102 unsigned long addr,
103 unsigned long size); 103 unsigned long size);
104extern void *alloc_bootmem_section(unsigned long size,
105 unsigned long section_nr);
104 106
105#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 107#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
106#define alloc_bootmem_node(pgdat, x) \ 108#define alloc_bootmem_node(pgdat, x) \
diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index 60e377b520f8..cf0303a60611 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -55,20 +55,26 @@ struct sg_io_v4 {
55 55
56#if defined(CONFIG_BLK_DEV_BSG) 56#if defined(CONFIG_BLK_DEV_BSG)
57struct bsg_class_device { 57struct bsg_class_device {
58 struct class_device *class_dev; 58 struct device *class_dev;
59 struct device *dev; 59 struct device *parent;
60 int minor; 60 int minor;
61 struct request_queue *queue; 61 struct request_queue *queue;
62 struct kref ref;
63 void (*release)(struct device *);
62}; 64};
63 65
64extern int bsg_register_queue(struct request_queue *, struct device *, const char *); 66extern int bsg_register_queue(struct request_queue *q,
67 struct device *parent, const char *name,
68 void (*release)(struct device *));
65extern void bsg_unregister_queue(struct request_queue *); 69extern void bsg_unregister_queue(struct request_queue *);
66#else 70#else
67static inline int bsg_register_queue(struct request_queue * rq, struct device *dev, const char *name) 71static inline int bsg_register_queue(struct request_queue *q,
72 struct device *parent, const char *name,
73 void (*release)(struct device *))
68{ 74{
69 return 0; 75 return 0;
70} 76}
71static inline void bsg_unregister_queue(struct request_queue *rq) 77static inline void bsg_unregister_queue(struct request_queue *q)
72{ 78{
73} 79}
74#endif 80#endif
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 932eb02a2753..82aa36c53ea7 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -225,7 +225,6 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct page *page,
225 get_block_t get_block); 225 get_block_t get_block);
226void block_sync_page(struct page *); 226void block_sync_page(struct page *);
227sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 227sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
228int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
229int block_truncate_page(struct address_space *, loff_t, get_block_t *); 228int block_truncate_page(struct address_space *, loff_t, get_block_t *);
230int file_fsync(struct file *, struct dentry *, int); 229int file_fsync(struct file *, struct dentry *, int);
231int nobh_write_begin(struct file *, struct address_space *, 230int nobh_write_begin(struct file *, struct address_space *,
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
index 79bedddfd9ca..1133d5f9d818 100644
--- a/include/linux/byteorder/Kbuild
+++ b/include/linux/byteorder/Kbuild
@@ -1,5 +1,3 @@
1header-y += big_endian.h 1unifdef-y += big_endian.h
2header-y += little_endian.h 2unifdef-y += little_endian.h
3
4unifdef-y += generic.h
5unifdef-y += swab.h 3unifdef-y += swab.h
diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h
index bef87891cb24..961ed4b48d8e 100644
--- a/include/linux/byteorder/big_endian.h
+++ b/include/linux/byteorder/big_endian.h
@@ -101,6 +101,8 @@ static inline __u16 __be16_to_cpup(const __be16 *p)
101#define __cpu_to_be16s(x) do {} while (0) 101#define __cpu_to_be16s(x) do {} while (0)
102#define __be16_to_cpus(x) do {} while (0) 102#define __be16_to_cpus(x) do {} while (0)
103 103
104#ifdef __KERNEL__
104#include <linux/byteorder/generic.h> 105#include <linux/byteorder/generic.h>
106#endif
105 107
106#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ 108#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index d3771551fdd9..0846e6b931ce 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -82,12 +82,6 @@
82 * 82 *
83 */ 83 */
84 84
85
86#if defined(__KERNEL__)
87/*
88 * inside the kernel, we can use nicknames;
89 * outside of it, we must avoid POSIX namespace pollution...
90 */
91#define cpu_to_le64 __cpu_to_le64 85#define cpu_to_le64 __cpu_to_le64
92#define le64_to_cpu __le64_to_cpu 86#define le64_to_cpu __le64_to_cpu
93#define cpu_to_le32 __cpu_to_le32 87#define cpu_to_le32 __cpu_to_le32
@@ -176,6 +170,4 @@ static inline void be64_add_cpu(__be64 *var, u64 val)
176 *var = cpu_to_be64(be64_to_cpu(*var) + val); 170 *var = cpu_to_be64(be64_to_cpu(*var) + val);
177} 171}
178 172
179#endif /* KERNEL */
180
181#endif /* _LINUX_BYTEORDER_GENERIC_H */ 173#endif /* _LINUX_BYTEORDER_GENERIC_H */
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h
index 86e62b750176..05dc7c35b3b2 100644
--- a/include/linux/byteorder/little_endian.h
+++ b/include/linux/byteorder/little_endian.h
@@ -101,6 +101,8 @@ static inline __u16 __be16_to_cpup(const __be16 *p)
101#define __cpu_to_be16s(x) __swab16s((x)) 101#define __cpu_to_be16s(x) __swab16s((x))
102#define __be16_to_cpus(x) __swab16s((x)) 102#define __be16_to_cpus(x) __swab16s((x))
103 103
104#ifdef __KERNEL__
104#include <linux/byteorder/generic.h> 105#include <linux/byteorder/generic.h>
106#endif
105 107
106#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ 108#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 4552504c0228..97e24881c4c6 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -60,4 +60,8 @@
60#endif 60#endif
61#endif 61#endif
62 62
63#ifndef CONFIG_ARCH_HAS_CACHE_LINE_SIZE
64#define cache_line_size() L1_CACHE_BYTES
65#endif
66
63#endif /* __LINUX_CACHE_H */ 67#endif /* __LINUX_CACHE_H */
diff --git a/include/linux/calc64.h b/include/linux/calc64.h
deleted file mode 100644
index ebf4b8f38d88..000000000000
--- a/include/linux/calc64.h
+++ /dev/null
@@ -1,49 +0,0 @@
1#ifndef _LINUX_CALC64_H
2#define _LINUX_CALC64_H
3
4#include <linux/types.h>
5#include <asm/div64.h>
6
7/*
8 * This is a generic macro which is used when the architecture
9 * specific div64.h does not provide a optimized one.
10 *
11 * The 64bit dividend is divided by the divisor (data type long), the
12 * result is returned and the remainder stored in the variable
13 * referenced by remainder (data type long *). In contrast to the
14 * do_div macro the dividend is kept intact.
15 */
16#ifndef div_long_long_rem
17#define div_long_long_rem(dividend, divisor, remainder) \
18 do_div_llr((dividend), divisor, remainder)
19
20static inline unsigned long do_div_llr(const long long dividend,
21 const long divisor, long *remainder)
22{
23 u64 result = dividend;
24
25 *(remainder) = do_div(result, divisor);
26 return (unsigned long) result;
27}
28#endif
29
30/*
31 * Sign aware variation of the above. On some architectures a
32 * negative dividend leads to an divide overflow exception, which
33 * is avoided by the sign check.
34 */
35static inline long div_long_long_rem_signed(const long long dividend,
36 const long divisor, long *remainder)
37{
38 long res;
39
40 if (unlikely(dividend < 0)) {
41 res = -div_long_long_rem(-dividend, divisor, remainder);
42 *remainder = -(*remainder);
43 } else
44 res = div_long_long_rem(dividend, divisor, remainder);
45
46 return res;
47}
48
49#endif
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 7d50ff6d269f..f4ea0dd9a618 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -155,6 +155,7 @@ typedef struct kernel_cap_struct {
155 * Add any capability from current's capability bounding set 155 * Add any capability from current's capability bounding set
156 * to the current process' inheritable set 156 * to the current process' inheritable set
157 * Allow taking bits out of capability bounding set 157 * Allow taking bits out of capability bounding set
158 * Allow modification of the securebits for a process
158 */ 159 */
159 160
160#define CAP_SETPCAP 8 161#define CAP_SETPCAP 8
@@ -364,12 +365,12 @@ typedef struct kernel_cap_struct {
364# error Fix up hand-coded capability macro initializers 365# error Fix up hand-coded capability macro initializers
365#else /* HAND-CODED capability initializers */ 366#else /* HAND-CODED capability initializers */
366 367
367# define CAP_EMPTY_SET {{ 0, 0 }} 368# define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }})
368# define CAP_FULL_SET {{ ~0, ~0 }} 369# define CAP_FULL_SET ((kernel_cap_t){{ ~0, ~0 }})
369# define CAP_INIT_EFF_SET {{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }} 370# define CAP_INIT_EFF_SET ((kernel_cap_t){{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }})
370# define CAP_FS_SET {{ CAP_FS_MASK_B0, CAP_FS_MASK_B1 } } 371# define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0, CAP_FS_MASK_B1 } })
371# define CAP_NFSD_SET {{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \ 372# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \
372 CAP_FS_MASK_B1 } } 373 CAP_FS_MASK_B1 } })
373 374
374#endif /* _LINUX_CAPABILITY_U32S != 2 */ 375#endif /* _LINUX_CAPABILITY_U32S != 2 */
375 376
@@ -490,8 +491,6 @@ extern const kernel_cap_t __cap_init_eff_set;
490int capable(int cap); 491int capable(int cap);
491int __capable(struct task_struct *t, int cap); 492int __capable(struct task_struct *t, int cap);
492 493
493extern long cap_prctl_drop(unsigned long cap);
494
495#endif /* __KERNEL__ */ 494#endif /* __KERNEL__ */
496 495
497#endif /* !_LINUX_CAPABILITY_H */ 496#endif /* !_LINUX_CAPABILITY_H */
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 1e29b13d0062..fb4591977b03 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -1,6 +1,5 @@
1#ifndef _LINUX_CDEV_H 1#ifndef _LINUX_CDEV_H
2#define _LINUX_CDEV_H 2#define _LINUX_CDEV_H
3#ifdef __KERNEL__
4 3
5#include <linux/kobject.h> 4#include <linux/kobject.h>
6#include <linux/kdev_t.h> 5#include <linux/kdev_t.h>
@@ -34,4 +33,3 @@ void cd_forget(struct inode *);
34extern struct backing_dev_info directly_mappable_cdev_bdi; 33extern struct backing_dev_info directly_mappable_cdev_bdi;
35 34
36#endif 35#endif
37#endif
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index a5cd2047624e..5db265ea60f6 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -910,6 +910,7 @@ struct mode_page_header {
910#ifdef __KERNEL__ 910#ifdef __KERNEL__
911#include <linux/fs.h> /* not really needed, later.. */ 911#include <linux/fs.h> /* not really needed, later.. */
912#include <linux/device.h> 912#include <linux/device.h>
913#include <linux/list.h>
913 914
914struct packet_command 915struct packet_command
915{ 916{
@@ -934,7 +935,7 @@ struct packet_command
934/* Uniform cdrom data structures for cdrom.c */ 935/* Uniform cdrom data structures for cdrom.c */
935struct cdrom_device_info { 936struct cdrom_device_info {
936 struct cdrom_device_ops *ops; /* link to device_ops */ 937 struct cdrom_device_ops *ops; /* link to device_ops */
937 struct cdrom_device_info *next; /* next device_info for this major */ 938 struct list_head list; /* linked list of all device_info */
938 struct gendisk *disk; /* matching block layer disk */ 939 struct gendisk *disk; /* matching block layer disk */
939 void *handle; /* driver-dependent data */ 940 void *handle; /* driver-dependent data */
940/* specifications */ 941/* specifications */
@@ -994,7 +995,7 @@ extern int cdrom_ioctl(struct file *file, struct cdrom_device_info *cdi,
994extern int cdrom_media_changed(struct cdrom_device_info *); 995extern int cdrom_media_changed(struct cdrom_device_info *);
995 996
996extern int register_cdrom(struct cdrom_device_info *cdi); 997extern int register_cdrom(struct cdrom_device_info *cdi);
997extern int unregister_cdrom(struct cdrom_device_info *cdi); 998extern void unregister_cdrom(struct cdrom_device_info *cdi);
998 999
999typedef struct { 1000typedef struct {
1000 int data; 1001 int data;
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index a6a6035a4e1e..e155aa78d859 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -88,6 +88,17 @@ static inline void css_put(struct cgroup_subsys_state *css)
88 __css_put(css); 88 __css_put(css);
89} 89}
90 90
91/* bits in struct cgroup flags field */
92enum {
93 /* Control Group is dead */
94 CGRP_REMOVED,
95 /* Control Group has previously had a child cgroup or a task,
96 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */
97 CGRP_RELEASABLE,
98 /* Control Group requires release notifications to userspace */
99 CGRP_NOTIFY_ON_RELEASE,
100};
101
91struct cgroup { 102struct cgroup {
92 unsigned long flags; /* "unsigned long" so bitops work */ 103 unsigned long flags; /* "unsigned long" so bitops work */
93 104
@@ -139,10 +150,10 @@ struct css_set {
139 struct kref ref; 150 struct kref ref;
140 151
141 /* 152 /*
142 * List running through all cgroup groups. Protected by 153 * List running through all cgroup groups in the same hash
143 * css_set_lock 154 * slot. Protected by css_set_lock
144 */ 155 */
145 struct list_head list; 156 struct hlist_node hlist;
146 157
147 /* 158 /*
148 * List running through all tasks using this cgroup 159 * List running through all tasks using this cgroup
@@ -163,7 +174,16 @@ struct css_set {
163 * during subsystem registration (at boot time). 174 * during subsystem registration (at boot time).
164 */ 175 */
165 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 176 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
177};
178
179/*
180 * cgroup_map_cb is an abstract callback API for reporting map-valued
181 * control files
182 */
166 183
184struct cgroup_map_cb {
185 int (*fill)(struct cgroup_map_cb *cb, const char *key, u64 value);
186 void *state;
167}; 187};
168 188
169/* struct cftype: 189/* struct cftype:
@@ -190,20 +210,51 @@ struct cftype {
190 struct file *file, 210 struct file *file,
191 char __user *buf, size_t nbytes, loff_t *ppos); 211 char __user *buf, size_t nbytes, loff_t *ppos);
192 /* 212 /*
193 * read_uint() is a shortcut for the common case of returning a 213 * read_u64() is a shortcut for the common case of returning a
194 * single integer. Use it in place of read() 214 * single integer. Use it in place of read()
195 */ 215 */
196 u64 (*read_uint) (struct cgroup *cgrp, struct cftype *cft); 216 u64 (*read_u64) (struct cgroup *cgrp, struct cftype *cft);
217 /*
218 * read_s64() is a signed version of read_u64()
219 */
220 s64 (*read_s64) (struct cgroup *cgrp, struct cftype *cft);
221 /*
222 * read_map() is used for defining a map of key/value
223 * pairs. It should call cb->fill(cb, key, value) for each
224 * entry. The key/value pairs (and their ordering) should not
225 * change between reboots.
226 */
227 int (*read_map) (struct cgroup *cont, struct cftype *cft,
228 struct cgroup_map_cb *cb);
229 /*
230 * read_seq_string() is used for outputting a simple sequence
231 * using seqfile.
232 */
233 int (*read_seq_string) (struct cgroup *cont, struct cftype *cft,
234 struct seq_file *m);
235
197 ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft, 236 ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft,
198 struct file *file, 237 struct file *file,
199 const char __user *buf, size_t nbytes, loff_t *ppos); 238 const char __user *buf, size_t nbytes, loff_t *ppos);
200 239
201 /* 240 /*
202 * write_uint() is a shortcut for the common case of accepting 241 * write_u64() is a shortcut for the common case of accepting
203 * a single integer (as parsed by simple_strtoull) from 242 * a single integer (as parsed by simple_strtoull) from
204 * userspace. Use in place of write(); return 0 or error. 243 * userspace. Use in place of write(); return 0 or error.
205 */ 244 */
206 int (*write_uint) (struct cgroup *cgrp, struct cftype *cft, u64 val); 245 int (*write_u64) (struct cgroup *cgrp, struct cftype *cft, u64 val);
246 /*
247 * write_s64() is a signed version of write_u64()
248 */
249 int (*write_s64) (struct cgroup *cgrp, struct cftype *cft, s64 val);
250
251 /*
252 * trigger() callback can be used to get some kick from the
253 * userspace, when the actual string written is not important
254 * at all. The private field can be used to determine the
255 * kick type for multiplexing.
256 */
257 int (*trigger)(struct cgroup *cgrp, unsigned int event);
207 258
208 int (*release) (struct inode *inode, struct file *file); 259 int (*release) (struct inode *inode, struct file *file);
209}; 260};
@@ -254,6 +305,12 @@ struct cgroup_subsys {
254 struct cgroup *cgrp); 305 struct cgroup *cgrp);
255 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); 306 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
256 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); 307 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
308 /*
309 * This routine is called with the task_lock of mm->owner held
310 */
311 void (*mm_owner_changed)(struct cgroup_subsys *ss,
312 struct cgroup *old,
313 struct cgroup *new);
257 int subsys_id; 314 int subsys_id;
258 int active; 315 int active;
259 int disabled; 316 int disabled;
@@ -339,4 +396,13 @@ static inline int cgroupstats_build(struct cgroupstats *stats,
339 396
340#endif /* !CONFIG_CGROUPS */ 397#endif /* !CONFIG_CGROUPS */
341 398
399#ifdef CONFIG_MM_OWNER
400extern void
401cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new);
402#else /* !CONFIG_MM_OWNER */
403static inline void
404cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new)
405{
406}
407#endif /* CONFIG_MM_OWNER */
342#endif /* _LINUX_CGROUP_H */ 408#endif /* _LINUX_CGROUP_H */
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 1ddebfc52565..e2877454ec82 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -42,3 +42,9 @@ SUBSYS(mem_cgroup)
42#endif 42#endif
43 43
44/* */ 44/* */
45
46#ifdef CONFIG_CGROUP_DEVICE
47SUBSYS(devices)
48#endif
49
50/* */
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 85778a4b1209..55e434feec99 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -93,6 +93,8 @@ struct clocksource {
93#endif 93#endif
94}; 94};
95 95
96extern struct clocksource *clock; /* current clocksource */
97
96/* 98/*
97 * Clock source flags bits:: 99 * Clock source flags bits::
98 */ 100 */
@@ -216,6 +218,7 @@ static inline void clocksource_calculate_interval(struct clocksource *c,
216/* used to install a new clocksource */ 218/* used to install a new clocksource */
217extern int clocksource_register(struct clocksource*); 219extern int clocksource_register(struct clocksource*);
218extern void clocksource_unregister(struct clocksource*); 220extern void clocksource_unregister(struct clocksource*);
221extern void clocksource_touch_watchdog(void);
219extern struct clocksource* clocksource_get_next(void); 222extern struct clocksource* clocksource_get_next(void);
220extern void clocksource_change_rating(struct clocksource *cs, int rating); 223extern void clocksource_change_rating(struct clocksource *cs, int rating);
221extern void clocksource_resume(void); 224extern void clocksource_resume(void);
diff --git a/include/linux/coda_fs_i.h b/include/linux/coda_fs_i.h
index 424fe9cf02c4..b3ef0c461578 100644
--- a/include/linux/coda_fs_i.h
+++ b/include/linux/coda_fs_i.h
@@ -8,7 +8,6 @@
8#ifndef _LINUX_CODA_FS_I 8#ifndef _LINUX_CODA_FS_I
9#define _LINUX_CODA_FS_I 9#define _LINUX_CODA_FS_I
10 10
11#ifdef __KERNEL__
12#include <linux/types.h> 11#include <linux/types.h>
13#include <linux/list.h> 12#include <linux/list.h>
14#include <linux/coda.h> 13#include <linux/coda.h>
@@ -52,4 +51,3 @@ struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb);
52void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); 51void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *);
53 52
54#endif 53#endif
55#endif
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index 1c47a34aa794..31b75311e2ca 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -43,9 +43,6 @@ int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
43int coda_setattr(struct dentry *, struct iattr *); 43int coda_setattr(struct dentry *, struct iattr *);
44 44
45/* this file: heloers */ 45/* this file: heloers */
46static __inline__ struct CodaFid *coda_i2f(struct inode *);
47static __inline__ char *coda_i2s(struct inode *);
48static __inline__ void coda_flag_inode(struct inode *, int flag);
49char *coda_f2s(struct CodaFid *f); 46char *coda_f2s(struct CodaFid *f);
50int coda_isroot(struct inode *i); 47int coda_isroot(struct inode *i);
51int coda_iscontrol(const char *name, size_t length); 48int coda_iscontrol(const char *name, size_t length);
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 8fa7857e153b..cf8d11cad5ae 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -65,10 +65,11 @@ struct compat_timex {
65 compat_long_t calcnt; 65 compat_long_t calcnt;
66 compat_long_t errcnt; 66 compat_long_t errcnt;
67 compat_long_t stbcnt; 67 compat_long_t stbcnt;
68 compat_int_t tai;
68 69
69 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; 70 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
70 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; 71 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
71 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; 72 compat_int_t :32; compat_int_t :32; compat_int_t :32;
72}; 73};
73 74
74#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) 75#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index fe23792f05c1..5c8351b859f0 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -28,9 +28,17 @@
28#define __must_be_array(a) \ 28#define __must_be_array(a) \
29 BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) 29 BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
30 30
31#define inline inline __attribute__((always_inline)) 31/*
32#define __inline__ __inline__ __attribute__((always_inline)) 32 * Force always-inline if the user requests it so via the .config,
33#define __inline __inline __attribute__((always_inline)) 33 * or if gcc is too old:
34 */
35#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
36 !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
37# define inline inline __attribute__((always_inline))
38# define __inline__ __inline__ __attribute__((always_inline))
39# define __inline __inline __attribute__((always_inline))
40#endif
41
34#define __deprecated __attribute__((deprecated)) 42#define __deprecated __attribute__((deprecated))
35#define __packed __attribute__((packed)) 43#define __packed __attribute__((packed))
36#define __weak __attribute__((weak)) 44#define __weak __attribute__((weak))
diff --git a/include/linux/concap.h b/include/linux/concap.h
index 27304651d700..977acb3d1fb2 100644
--- a/include/linux/concap.h
+++ b/include/linux/concap.h
@@ -8,7 +8,7 @@
8 8
9#ifndef _LINUX_CONCAP_H 9#ifndef _LINUX_CONCAP_H
10#define _LINUX_CONCAP_H 10#define _LINUX_CONCAP_H
11#ifdef __KERNEL__ 11
12#include <linux/skbuff.h> 12#include <linux/skbuff.h>
13#include <linux/netdevice.h> 13#include <linux/netdevice.h>
14 14
@@ -110,4 +110,3 @@ extern int concap_nop(struct concap_proto *cprot);
110 */ 110 */
111extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb); 111extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb);
112#endif 112#endif
113#endif
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 4b287ad9371a..3ae65b1bf90f 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -35,8 +35,6 @@
35#ifndef _CONFIGFS_H_ 35#ifndef _CONFIGFS_H_
36#define _CONFIGFS_H_ 36#define _CONFIGFS_H_
37 37
38#ifdef __KERNEL__
39
40#include <linux/kernel.h> 38#include <linux/kernel.h>
41#include <linux/types.h> 39#include <linux/types.h>
42#include <linux/list.h> 40#include <linux/list.h>
@@ -194,6 +192,4 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
194int configfs_depend_item(struct configfs_subsystem *subsys, struct config_item *target); 192int configfs_depend_item(struct configfs_subsystem *subsys, struct config_item *target);
195void configfs_undepend_item(struct configfs_subsystem *subsys, struct config_item *target); 193void configfs_undepend_item(struct configfs_subsystem *subsys, struct config_item *target);
196 194
197#endif /* __KERNEL__ */
198
199#endif /* _CONFIGFS_H_ */ 195#endif /* _CONFIGFS_H_ */
diff --git a/include/linux/console.h b/include/linux/console.h
index a5f88a6a259d..a4f27fbdf549 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -91,6 +91,7 @@ void give_up_console(const struct consw *sw);
91#define CON_ENABLED (4) 91#define CON_ENABLED (4)
92#define CON_BOOT (8) 92#define CON_BOOT (8)
93#define CON_ANYTIME (16) /* Safe to call when cpu is offline */ 93#define CON_ANYTIME (16) /* Safe to call when cpu is offline */
94#define CON_BRL (32) /* Used for a braille device */
94 95
95struct console { 96struct console {
96 char name[16]; 97 char name[16];
@@ -121,6 +122,9 @@ extern struct tty_driver *console_device(int *);
121extern void console_stop(struct console *); 122extern void console_stop(struct console *);
122extern void console_start(struct console *); 123extern void console_start(struct console *);
123extern int is_console_locked(void); 124extern int is_console_locked(void);
125extern int braille_register_console(struct console *, int index,
126 char *console_options, char *braille_options);
127extern int braille_unregister_console(struct console *);
124 128
125extern int console_suspend_enabled; 129extern int console_suspend_enabled;
126 130
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index d71f7c0f931b..b03f80a078be 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -53,6 +53,7 @@ struct vc_data {
53 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ 53 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */
54 struct console_font vc_font; /* Current VC font set */ 54 struct console_font vc_font; /* Current VC font set */
55 unsigned short vc_video_erase_char; /* Background erase character */ 55 unsigned short vc_video_erase_char; /* Background erase character */
56 unsigned short vc_scrl_erase_char; /* Erase character for scroll */
56 /* VT terminal data */ 57 /* VT terminal data */
57 unsigned int vc_state; /* Escape sequence parser state */ 58 unsigned int vc_state; /* Escape sequence parser state */
58 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ 59 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 0be8d65bc3c8..7464ba3b4333 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -23,7 +23,6 @@
23#include <linux/node.h> 23#include <linux/node.h>
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/cpumask.h> 25#include <linux/cpumask.h>
26#include <asm/semaphore.h>
27#include <linux/mutex.h> 26#include <linux/mutex.h>
28 27
29struct cpu { 28struct cpu {
@@ -109,7 +108,7 @@ static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
109extern void get_online_cpus(void); 108extern void get_online_cpus(void);
110extern void put_online_cpus(void); 109extern void put_online_cpus(void);
111#define hotcpu_notifier(fn, pri) { \ 110#define hotcpu_notifier(fn, pri) { \
112 static struct notifier_block fn##_nb = \ 111 static struct notifier_block fn##_nb __cpuinitdata = \
113 { .notifier_call = fn, .priority = pri }; \ 112 { .notifier_call = fn, .priority = pri }; \
114 register_cpu_notifier(&fn##_nb); \ 113 register_cpu_notifier(&fn##_nb); \
115} 114}
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index ddd8652fc3f3..e7e91dbfde0f 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -83,7 +83,8 @@ struct cpufreq_real_policy {
83}; 83};
84 84
85struct cpufreq_policy { 85struct cpufreq_policy {
86 cpumask_t cpus; /* affected CPUs */ 86 cpumask_t cpus; /* CPUs requiring sw coordination */
87 cpumask_t related_cpus; /* CPUs with any coordination */
87 unsigned int shared_type; /* ANY or ALL affected CPUs 88 unsigned int shared_type; /* ANY or ALL affected CPUs
88 should set cpufreq */ 89 should set cpufreq */
89 unsigned int cpu; /* cpu nr of registered CPU */ 90 unsigned int cpu; /* cpu nr of registered CPU */
@@ -307,6 +308,9 @@ extern struct cpufreq_governor cpufreq_gov_performance;
307#endif 308#endif
308#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE 309#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
309#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance) 310#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance)
311#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE)
312extern struct cpufreq_governor cpufreq_gov_powersave;
313#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_powersave)
310#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) 314#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE)
311extern struct cpufreq_governor cpufreq_gov_userspace; 315extern struct cpufreq_governor cpufreq_gov_userspace;
312#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace) 316#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 7047f58306a7..9650806fe2ea 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -14,6 +14,8 @@
14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. 14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
15 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c 15 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c
16 * For details of cpus_remap(), see bitmap_remap in lib/bitmap.c. 16 * For details of cpus_remap(), see bitmap_remap in lib/bitmap.c.
17 * For details of cpus_onto(), see bitmap_onto in lib/bitmap.c.
18 * For details of cpus_fold(), see bitmap_fold in lib/bitmap.c.
17 * 19 *
18 * The available cpumask operations are: 20 * The available cpumask operations are:
19 * 21 *
@@ -53,7 +55,9 @@
53 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing 55 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
54 * int cpulist_parse(buf, map) Parse ascii string as cpulist 56 * int cpulist_parse(buf, map) Parse ascii string as cpulist
55 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit) 57 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
56 * int cpus_remap(dst, src, old, new) *dst = map(old, new)(src) 58 * void cpus_remap(dst, src, old, new) *dst = map(old, new)(src)
59 * void cpus_onto(dst, orig, relmap) *dst = orig relative to relmap
60 * void cpus_fold(dst, orig, sz) dst bits = orig bits mod sz
57 * 61 *
58 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask 62 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask
59 * 63 *
@@ -222,8 +226,13 @@ int __next_cpu(int n, const cpumask_t *srcp);
222#define next_cpu(n, src) ({ (void)(src); 1; }) 226#define next_cpu(n, src) ({ (void)(src); 1; })
223#endif 227#endif
224 228
229#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
230extern cpumask_t *cpumask_of_cpu_map;
231#define cpumask_of_cpu(cpu) (cpumask_of_cpu_map[cpu])
232
233#else
225#define cpumask_of_cpu(cpu) \ 234#define cpumask_of_cpu(cpu) \
226({ \ 235(*({ \
227 typeof(_unused_cpumask_arg_) m; \ 236 typeof(_unused_cpumask_arg_) m; \
228 if (sizeof(m) == sizeof(unsigned long)) { \ 237 if (sizeof(m) == sizeof(unsigned long)) { \
229 m.bits[0] = 1UL<<(cpu); \ 238 m.bits[0] = 1UL<<(cpu); \
@@ -231,8 +240,9 @@ int __next_cpu(int n, const cpumask_t *srcp);
231 cpus_clear(m); \ 240 cpus_clear(m); \
232 cpu_set((cpu), m); \ 241 cpu_set((cpu), m); \
233 } \ 242 } \
234 m; \ 243 &m; \
235}) 244}))
245#endif
236 246
237#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) 247#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
238 248
@@ -243,6 +253,8 @@ int __next_cpu(int n, const cpumask_t *srcp);
243 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ 253 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
244} } 254} }
245 255
256#define CPU_MASK_ALL_PTR (&CPU_MASK_ALL)
257
246#else 258#else
247 259
248#define CPU_MASK_ALL \ 260#define CPU_MASK_ALL \
@@ -251,6 +263,10 @@ int __next_cpu(int n, const cpumask_t *srcp);
251 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ 263 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
252} } 264} }
253 265
266/* cpu_mask_all is in init/main.c */
267extern cpumask_t cpu_mask_all;
268#define CPU_MASK_ALL_PTR (&cpu_mask_all)
269
254#endif 270#endif
255 271
256#define CPU_MASK_NONE \ 272#define CPU_MASK_NONE \
@@ -273,6 +289,13 @@ static inline int __cpumask_scnprintf(char *buf, int len,
273 return bitmap_scnprintf(buf, len, srcp->bits, nbits); 289 return bitmap_scnprintf(buf, len, srcp->bits, nbits);
274} 290}
275 291
292#define cpumask_scnprintf_len(len) \
293 __cpumask_scnprintf_len((len))
294static inline int __cpumask_scnprintf_len(int len)
295{
296 return bitmap_scnprintf_len(len);
297}
298
276#define cpumask_parse_user(ubuf, ulen, dst) \ 299#define cpumask_parse_user(ubuf, ulen, dst) \
277 __cpumask_parse_user((ubuf), (ulen), &(dst), NR_CPUS) 300 __cpumask_parse_user((ubuf), (ulen), &(dst), NR_CPUS)
278static inline int __cpumask_parse_user(const char __user *buf, int len, 301static inline int __cpumask_parse_user(const char __user *buf, int len,
@@ -311,6 +334,22 @@ static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
311 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); 334 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits);
312} 335}
313 336
337#define cpus_onto(dst, orig, relmap) \
338 __cpus_onto(&(dst), &(orig), &(relmap), NR_CPUS)
339static inline void __cpus_onto(cpumask_t *dstp, const cpumask_t *origp,
340 const cpumask_t *relmapp, int nbits)
341{
342 bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits);
343}
344
345#define cpus_fold(dst, orig, sz) \
346 __cpus_fold(&(dst), &(orig), sz, NR_CPUS)
347static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp,
348 int sz, int nbits)
349{
350 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
351}
352
314#if NR_CPUS > 1 353#if NR_CPUS > 1
315#define for_each_cpu_mask(cpu, mask) \ 354#define for_each_cpu_mask(cpu, mask) \
316 for ((cpu) = first_cpu(mask); \ 355 for ((cpu) = first_cpu(mask); \
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 0a26be353cb3..038578362b47 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -20,13 +20,13 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */
20extern int cpuset_init_early(void); 20extern int cpuset_init_early(void);
21extern int cpuset_init(void); 21extern int cpuset_init(void);
22extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
23extern cpumask_t cpuset_cpus_allowed(struct task_struct *p); 23extern void cpuset_cpus_allowed(struct task_struct *p, cpumask_t *mask);
24extern cpumask_t cpuset_cpus_allowed_locked(struct task_struct *p); 24extern void cpuset_cpus_allowed_locked(struct task_struct *p, cpumask_t *mask);
25extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 25extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
26#define cpuset_current_mems_allowed (current->mems_allowed) 26#define cpuset_current_mems_allowed (current->mems_allowed)
27void cpuset_init_current_mems_allowed(void); 27void cpuset_init_current_mems_allowed(void);
28void cpuset_update_task_memory_state(void); 28void cpuset_update_task_memory_state(void);
29int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); 29int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
30 30
31extern int __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask); 31extern int __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask);
32extern int __cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask); 32extern int __cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask);
@@ -84,13 +84,14 @@ static inline int cpuset_init_early(void) { return 0; }
84static inline int cpuset_init(void) { return 0; } 84static inline int cpuset_init(void) { return 0; }
85static inline void cpuset_init_smp(void) {} 85static inline void cpuset_init_smp(void) {}
86 86
87static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p) 87static inline void cpuset_cpus_allowed(struct task_struct *p, cpumask_t *mask)
88{ 88{
89 return cpu_possible_map; 89 *mask = cpu_possible_map;
90} 90}
91static inline cpumask_t cpuset_cpus_allowed_locked(struct task_struct *p) 91static inline void cpuset_cpus_allowed_locked(struct task_struct *p,
92 cpumask_t *mask)
92{ 93{
93 return cpu_possible_map; 94 *mask = cpu_possible_map;
94} 95}
95 96
96static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) 97static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
@@ -102,7 +103,7 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
102static inline void cpuset_init_current_mems_allowed(void) {} 103static inline void cpuset_init_current_mems_allowed(void) {}
103static inline void cpuset_update_task_memory_state(void) {} 104static inline void cpuset_update_task_memory_state(void) {}
104 105
105static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) 106static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
106{ 107{
107 return 1; 108 return 1;
108} 109}
diff --git a/include/linux/crc-ccitt.h b/include/linux/crc-ccitt.h
index 90037617da8f..f52696a1ff0d 100644
--- a/include/linux/crc-ccitt.h
+++ b/include/linux/crc-ccitt.h
@@ -1,6 +1,5 @@
1#ifndef _LINUX_CRC_CCITT_H 1#ifndef _LINUX_CRC_CCITT_H
2#define _LINUX_CRC_CCITT_H 2#define _LINUX_CRC_CCITT_H
3#ifdef __KERNEL__
4 3
5#include <linux/types.h> 4#include <linux/types.h>
6 5
@@ -13,5 +12,4 @@ static inline u16 crc_ccitt_byte(u16 crc, const u8 c)
13 return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff]; 12 return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff];
14} 13}
15 14
16#endif /* __KERNEL__ */
17#endif /* _LINUX_CRC_CCITT_H */ 15#endif /* _LINUX_CRC_CCITT_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 5e02d1b46370..425824bd49f3 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -317,14 +317,7 @@ int crypto_unregister_alg(struct crypto_alg *alg);
317/* 317/*
318 * Algorithm query interface. 318 * Algorithm query interface.
319 */ 319 */
320#ifdef CONFIG_CRYPTO
321int crypto_has_alg(const char *name, u32 type, u32 mask); 320int crypto_has_alg(const char *name, u32 type, u32 mask);
322#else
323static inline int crypto_has_alg(const char *name, u32 type, u32 mask)
324{
325 return 0;
326}
327#endif
328 321
329/* 322/*
330 * Transforms: user-instantiated objects which encapsulate algorithms 323 * Transforms: user-instantiated objects which encapsulate algorithms
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 6bd646096fa6..2a6639407c80 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -1,8 +1,6 @@
1#ifndef __LINUX_DCACHE_H 1#ifndef __LINUX_DCACHE_H
2#define __LINUX_DCACHE_H 2#define __LINUX_DCACHE_H
3 3
4#ifdef __KERNEL__
5
6#include <asm/atomic.h> 4#include <asm/atomic.h>
7#include <linux/list.h> 5#include <linux/list.h>
8#include <linux/spinlock.h> 6#include <linux/spinlock.h>
@@ -301,7 +299,9 @@ extern int d_validate(struct dentry *, struct dentry *);
301 */ 299 */
302extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); 300extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
303 301
302extern char *__d_path(const struct path *path, struct path *root, char *, int);
304extern char *d_path(struct path *, char *, int); 303extern char *d_path(struct path *, char *, int);
304extern char *dentry_path(struct dentry *, char *, int);
305 305
306/* Allocation counts.. */ 306/* Allocation counts.. */
307 307
@@ -359,11 +359,8 @@ static inline int d_mountpoint(struct dentry *dentry)
359} 359}
360 360
361extern struct vfsmount *lookup_mnt(struct vfsmount *, struct dentry *); 361extern struct vfsmount *lookup_mnt(struct vfsmount *, struct dentry *);
362extern struct vfsmount *__lookup_mnt(struct vfsmount *, struct dentry *, int);
363extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); 362extern struct dentry *lookup_create(struct nameidata *nd, int is_dir);
364 363
365extern int sysctl_vfs_cache_pressure; 364extern int sysctl_vfs_cache_pressure;
366 365
367#endif /* __KERNEL__ */
368
369#endif /* __LINUX_DCACHE_H */ 366#endif /* __LINUX_DCACHE_H */
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
new file mode 100644
index 000000000000..8c243aaa86a7
--- /dev/null
+++ b/include/linux/debugobjects.h
@@ -0,0 +1,90 @@
1#ifndef _LINUX_DEBUGOBJECTS_H
2#define _LINUX_DEBUGOBJECTS_H
3
4#include <linux/list.h>
5#include <linux/spinlock.h>
6
7enum debug_obj_state {
8 ODEBUG_STATE_NONE,
9 ODEBUG_STATE_INIT,
10 ODEBUG_STATE_INACTIVE,
11 ODEBUG_STATE_ACTIVE,
12 ODEBUG_STATE_DESTROYED,
13 ODEBUG_STATE_NOTAVAILABLE,
14 ODEBUG_STATE_MAX,
15};
16
17struct debug_obj_descr;
18
19/**
20 * struct debug_obj - representaion of an tracked object
21 * @node: hlist node to link the object into the tracker list
22 * @state: tracked object state
23 * @object: pointer to the real object
24 * @descr: pointer to an object type specific debug description structure
25 */
26struct debug_obj {
27 struct hlist_node node;
28 enum debug_obj_state state;
29 void *object;
30 struct debug_obj_descr *descr;
31};
32
33/**
34 * struct debug_obj_descr - object type specific debug description structure
35 * @name: name of the object typee
36 * @fixup_init: fixup function, which is called when the init check
37 * fails
38 * @fixup_activate: fixup function, which is called when the activate check
39 * fails
40 * @fixup_destroy: fixup function, which is called when the destroy check
41 * fails
42 * @fixup_free: fixup function, which is called when the free check
43 * fails
44 */
45struct debug_obj_descr {
46 const char *name;
47
48 int (*fixup_init) (void *addr, enum debug_obj_state state);
49 int (*fixup_activate) (void *addr, enum debug_obj_state state);
50 int (*fixup_destroy) (void *addr, enum debug_obj_state state);
51 int (*fixup_free) (void *addr, enum debug_obj_state state);
52};
53
54#ifdef CONFIG_DEBUG_OBJECTS
55extern void debug_object_init (void *addr, struct debug_obj_descr *descr);
56extern void
57debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr);
58extern void debug_object_activate (void *addr, struct debug_obj_descr *descr);
59extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
60extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
61extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
62
63extern void debug_objects_early_init(void);
64extern void debug_objects_mem_init(void);
65#else
66static inline void
67debug_object_init (void *addr, struct debug_obj_descr *descr) { }
68static inline void
69debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr) { }
70static inline void
71debug_object_activate (void *addr, struct debug_obj_descr *descr) { }
72static inline void
73debug_object_deactivate(void *addr, struct debug_obj_descr *descr) { }
74static inline void
75debug_object_destroy (void *addr, struct debug_obj_descr *descr) { }
76static inline void
77debug_object_free (void *addr, struct debug_obj_descr *descr) { }
78
79static inline void debug_objects_early_init(void) { }
80static inline void debug_objects_mem_init(void) { }
81#endif
82
83#ifdef CONFIG_DEBUG_OBJECTS_FREE
84extern void debug_check_no_obj_freed(const void *address, unsigned long size);
85#else
86static inline void
87debug_check_no_obj_freed(const void *address, unsigned long size) { }
88#endif
89
90#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index cb784579956b..0d8d419d191a 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2001 Sistina Software (UK) Limited. 2 * Copyright (C) 2001 Sistina Software (UK) Limited.
3 * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 * 4 *
5 * This file is released under the LGPL. 5 * This file is released under the LGPL.
6 */ 6 */
@@ -8,7 +8,7 @@
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__ 11#include <linux/bio.h>
12 12
13struct dm_target; 13struct dm_target;
14struct dm_table; 14struct dm_table;
@@ -250,11 +250,96 @@ void dm_table_event(struct dm_table *t);
250 */ 250 */
251int dm_swap_table(struct mapped_device *md, struct dm_table *t); 251int dm_swap_table(struct mapped_device *md, struct dm_table *t);
252 252
253/*-----------------------------------------------------------------
254 * Macros.
255 *---------------------------------------------------------------*/
256#define DM_NAME "device-mapper"
257
258#define DMERR(f, arg...) \
259 printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
260#define DMERR_LIMIT(f, arg...) \
261 do { \
262 if (printk_ratelimit()) \
263 printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " \
264 f "\n", ## arg); \
265 } while (0)
266
267#define DMWARN(f, arg...) \
268 printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
269#define DMWARN_LIMIT(f, arg...) \
270 do { \
271 if (printk_ratelimit()) \
272 printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " \
273 f "\n", ## arg); \
274 } while (0)
275
276#define DMINFO(f, arg...) \
277 printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
278#define DMINFO_LIMIT(f, arg...) \
279 do { \
280 if (printk_ratelimit()) \
281 printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f \
282 "\n", ## arg); \
283 } while (0)
284
285#ifdef CONFIG_DM_DEBUG
286# define DMDEBUG(f, arg...) \
287 printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX " DEBUG: " f "\n", ## arg)
288# define DMDEBUG_LIMIT(f, arg...) \
289 do { \
290 if (printk_ratelimit()) \
291 printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX ": " f \
292 "\n", ## arg); \
293 } while (0)
294#else
295# define DMDEBUG(f, arg...) do {} while (0)
296# define DMDEBUG_LIMIT(f, arg...) do {} while (0)
297#endif
298
299#define DMEMIT(x...) sz += ((sz >= maxlen) ? \
300 0 : scnprintf(result + sz, maxlen - sz, x))
301
302#define SECTOR_SHIFT 9
303
304/*
305 * Definitions of return values from target end_io function.
306 */
307#define DM_ENDIO_INCOMPLETE 1
308#define DM_ENDIO_REQUEUE 2
309
253/* 310/*
254 * Prepare a table for a device that will error all I/O. 311 * Definitions of return values from target map function.
255 * To make it active, call dm_suspend(), dm_swap_table() then dm_resume().
256 */ 312 */
257int dm_create_error_table(struct dm_table **result, struct mapped_device *md); 313#define DM_MAPIO_SUBMITTED 0
314#define DM_MAPIO_REMAPPED 1
315#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE
316
317/*
318 * Ceiling(n / sz)
319 */
320#define dm_div_up(n, sz) (((n) + (sz) - 1) / (sz))
321
322#define dm_sector_div_up(n, sz) ( \
323{ \
324 sector_t _r = ((n) + (sz) - 1); \
325 sector_div(_r, (sz)); \
326 _r; \
327} \
328)
329
330/*
331 * ceiling(n / size) * size
332 */
333#define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz))
334
335static inline sector_t to_sector(unsigned long n)
336{
337 return (n >> SECTOR_SHIFT);
338}
339
340static inline unsigned long to_bytes(sector_t n)
341{
342 return (n << SECTOR_SHIFT);
343}
258 344
259#endif /* __KERNEL__ */
260#endif /* _LINUX_DEVICE_MAPPER_H */ 345#endif /* _LINUX_DEVICE_MAPPER_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index 2258d89bf523..832fb0eb2933 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -20,7 +20,7 @@
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/pm.h> 22#include <linux/pm.h>
23#include <asm/semaphore.h> 23#include <linux/semaphore.h>
24#include <asm/atomic.h> 24#include <asm/atomic.h>
25#include <asm/device.h> 25#include <asm/device.h>
26 26
@@ -35,7 +35,6 @@ struct device;
35struct device_driver; 35struct device_driver;
36struct driver_private; 36struct driver_private;
37struct class; 37struct class;
38struct class_device;
39struct bus_type; 38struct bus_type;
40struct bus_type_private; 39struct bus_type_private;
41 40
@@ -190,13 +189,10 @@ struct class {
190 struct kset class_dirs; 189 struct kset class_dirs;
191 struct semaphore sem; /* locks children, devices, interfaces */ 190 struct semaphore sem; /* locks children, devices, interfaces */
192 struct class_attribute *class_attrs; 191 struct class_attribute *class_attrs;
193 struct class_device_attribute *class_dev_attrs;
194 struct device_attribute *dev_attrs; 192 struct device_attribute *dev_attrs;
195 193
196 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
197 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 194 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
198 195
199 void (*release)(struct class_device *dev);
200 void (*class_release)(struct class *class); 196 void (*class_release)(struct class *class);
201 void (*dev_release)(struct device *dev); 197 void (*dev_release)(struct device *dev);
202 198
@@ -210,9 +206,6 @@ extern int class_for_each_device(struct class *class, void *data,
210 int (*fn)(struct device *dev, void *data)); 206 int (*fn)(struct device *dev, void *data));
211extern struct device *class_find_device(struct class *class, void *data, 207extern struct device *class_find_device(struct class *class, void *data,
212 int (*match)(struct device *, void *)); 208 int (*match)(struct device *, void *));
213extern struct class_device *class_find_child(struct class *class, void *data,
214 int (*match)(struct class_device *, void *));
215
216 209
217struct class_attribute { 210struct class_attribute {
218 struct attribute attr; 211 struct attribute attr;
@@ -228,92 +221,10 @@ extern int __must_check class_create_file(struct class *class,
228extern void class_remove_file(struct class *class, 221extern void class_remove_file(struct class *class,
229 const struct class_attribute *attr); 222 const struct class_attribute *attr);
230 223
231struct class_device_attribute {
232 struct attribute attr;
233 ssize_t (*show)(struct class_device *, char *buf);
234 ssize_t (*store)(struct class_device *, const char *buf, size_t count);
235};
236
237#define CLASS_DEVICE_ATTR(_name, _mode, _show, _store) \
238struct class_device_attribute class_device_attr_##_name = \
239 __ATTR(_name, _mode, _show, _store)
240
241extern int __must_check class_device_create_file(struct class_device *,
242 const struct class_device_attribute *);
243
244/**
245 * struct class_device - class devices
246 * @class: pointer to the parent class for this class device. This is required.
247 * @devt: for internal use by the driver core only.
248 * @node: for internal use by the driver core only.
249 * @kobj: for internal use by the driver core only.
250 * @groups: optional additional groups to be created
251 * @dev: if set, a symlink to the struct device is created in the sysfs
252 * directory for this struct class device.
253 * @class_data: pointer to whatever you want to store here for this struct
254 * class_device. Use class_get_devdata() and class_set_devdata() to get and
255 * set this pointer.
256 * @parent: pointer to a struct class_device that is the parent of this struct
257 * class_device. If NULL, this class_device will show up at the root of the
258 * struct class in sysfs (which is probably what you want to have happen.)
259 * @release: pointer to a release function for this struct class_device. If
260 * set, this will be called instead of the class specific release function.
261 * Only use this if you want to override the default release function, like
262 * when you are nesting class_device structures.
263 * @uevent: pointer to a uevent function for this struct class_device. If
264 * set, this will be called instead of the class specific uevent function.
265 * Only use this if you want to override the default uevent function, like
266 * when you are nesting class_device structures.
267 */
268struct class_device {
269 struct list_head node;
270
271 struct kobject kobj;
272 struct class *class;
273 dev_t devt;
274 struct device *dev;
275 void *class_data;
276 struct class_device *parent;
277 struct attribute_group **groups;
278
279 void (*release)(struct class_device *dev);
280 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
281 char class_id[BUS_ID_SIZE];
282};
283
284static inline void *class_get_devdata(struct class_device *dev)
285{
286 return dev->class_data;
287}
288
289static inline void class_set_devdata(struct class_device *dev, void *data)
290{
291 dev->class_data = data;
292}
293
294
295extern int __must_check class_device_register(struct class_device *);
296extern void class_device_unregister(struct class_device *);
297extern void class_device_initialize(struct class_device *);
298extern int __must_check class_device_add(struct class_device *);
299extern void class_device_del(struct class_device *);
300
301extern struct class_device *class_device_get(struct class_device *);
302extern void class_device_put(struct class_device *);
303
304extern void class_device_remove_file(struct class_device *,
305 const struct class_device_attribute *);
306extern int __must_check class_device_create_bin_file(struct class_device *,
307 struct bin_attribute *);
308extern void class_device_remove_bin_file(struct class_device *,
309 struct bin_attribute *);
310
311struct class_interface { 224struct class_interface {
312 struct list_head node; 225 struct list_head node;
313 struct class *class; 226 struct class *class;
314 227
315 int (*add) (struct class_device *, struct class_interface *);
316 void (*remove) (struct class_device *, struct class_interface *);
317 int (*add_dev) (struct device *, struct class_interface *); 228 int (*add_dev) (struct device *, struct class_interface *);
318 void (*remove_dev) (struct device *, struct class_interface *); 229 void (*remove_dev) (struct device *, struct class_interface *);
319}; 230};
@@ -323,13 +234,6 @@ extern void class_interface_unregister(struct class_interface *);
323 234
324extern struct class *class_create(struct module *owner, const char *name); 235extern struct class *class_create(struct module *owner, const char *name);
325extern void class_destroy(struct class *cls); 236extern void class_destroy(struct class *cls);
326extern struct class_device *class_device_create(struct class *cls,
327 struct class_device *parent,
328 dev_t devt,
329 struct device *device,
330 const char *fmt, ...)
331 __attribute__((format(printf, 5, 6)));
332extern void class_device_destroy(struct class *cls, dev_t devt);
333 237
334/* 238/*
335 * The type of device, "struct device" is embedded in. A class 239 * The type of device, "struct device" is embedded in. A class
@@ -429,7 +333,6 @@ struct device {
429 struct kobject kobj; 333 struct kobject kobj;
430 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 334 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
431 struct device_type *type; 335 struct device_type *type;
432 unsigned is_registered:1;
433 unsigned uevent_suppress:1; 336 unsigned uevent_suppress:1;
434 337
435 struct semaphore sem; /* semaphore to synchronize calls to 338 struct semaphore sem; /* semaphore to synchronize calls to
@@ -466,7 +369,6 @@ struct device {
466 spinlock_t devres_lock; 369 spinlock_t devres_lock;
467 struct list_head devres_head; 370 struct list_head devres_head;
468 371
469 /* class_device migration path */
470 struct list_head node; 372 struct list_head node;
471 struct class *class; 373 struct class *class;
472 dev_t devt; /* dev_t, creates the sysfs "dev" */ 374 dev_t devt; /* dev_t, creates the sysfs "dev" */
@@ -475,6 +377,9 @@ struct device {
475 void (*release)(struct device *dev); 377 void (*release)(struct device *dev);
476}; 378};
477 379
380/* Get the wakeup routines, which depend on struct device */
381#include <linux/pm_wakeup.h>
382
478#ifdef CONFIG_NUMA 383#ifdef CONFIG_NUMA
479static inline int dev_to_node(struct device *dev) 384static inline int dev_to_node(struct device *dev)
480{ 385{
@@ -506,7 +411,7 @@ static inline void dev_set_drvdata(struct device *dev, void *data)
506 411
507static inline int device_is_registered(struct device *dev) 412static inline int device_is_registered(struct device *dev)
508{ 413{
509 return dev->is_registered; 414 return dev->kobj.state_in_sysfs;
510} 415}
511 416
512void driver_init(void); 417void driver_init(void);
@@ -543,20 +448,6 @@ extern struct device *device_create(struct class *cls, struct device *parent,
543 dev_t devt, const char *fmt, ...) 448 dev_t devt, const char *fmt, ...)
544 __attribute__((format(printf, 4, 5))); 449 __attribute__((format(printf, 4, 5)));
545extern void device_destroy(struct class *cls, dev_t devt); 450extern void device_destroy(struct class *cls, dev_t devt);
546#ifdef CONFIG_PM_SLEEP
547extern void destroy_suspended_device(struct class *cls, dev_t devt);
548extern void device_pm_schedule_removal(struct device *);
549#else /* !CONFIG_PM_SLEEP */
550static inline void destroy_suspended_device(struct class *cls, dev_t devt)
551{
552 device_destroy(cls, devt);
553}
554
555static inline void device_pm_schedule_removal(struct device *dev)
556{
557 device_unregister(dev);
558}
559#endif /* !CONFIG_PM_SLEEP */
560 451
561/* 452/*
562 * Platform "fixup" functions - allow the platform to have their say 453 * Platform "fixup" functions - allow the platform to have their say
@@ -608,21 +499,16 @@ extern const char *dev_driver_string(struct device *dev);
608#define dev_dbg(dev, format, arg...) \ 499#define dev_dbg(dev, format, arg...) \
609 dev_printk(KERN_DEBUG , dev , format , ## arg) 500 dev_printk(KERN_DEBUG , dev , format , ## arg)
610#else 501#else
611static inline int __attribute__ ((format (printf, 2, 3))) 502#define dev_dbg(dev, format, arg...) \
612dev_dbg(struct device *dev, const char *fmt, ...) 503 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
613{
614 return 0;
615}
616#endif 504#endif
617 505
618#ifdef VERBOSE_DEBUG 506#ifdef VERBOSE_DEBUG
619#define dev_vdbg dev_dbg 507#define dev_vdbg dev_dbg
620#else 508#else
621static inline int __attribute__ ((format (printf, 2, 3))) 509
622dev_vdbg(struct device *dev, const char *fmt, ...) 510#define dev_vdbg(dev, format, arg...) \
623{ 511 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
624 return 0;
625}
626#endif 512#endif
627 513
628/* Create alias, so I can be autoloaded. */ 514/* Create alias, so I can be autoloaded. */
diff --git a/include/linux/device_cgroup.h b/include/linux/device_cgroup.h
new file mode 100644
index 000000000000..0b0d9c39ed67
--- /dev/null
+++ b/include/linux/device_cgroup.h
@@ -0,0 +1,12 @@
1#include <linux/module.h>
2#include <linux/fs.h>
3
4#ifdef CONFIG_CGROUP_DEVICE
5extern int devcgroup_inode_permission(struct inode *inode, int mask);
6extern int devcgroup_inode_mknod(int mode, dev_t dev);
7#else
8static inline int devcgroup_inode_permission(struct inode *inode, int mask)
9{ return 0; }
10static inline int devcgroup_inode_mknod(int mode, dev_t dev)
11{ return 0; }
12#endif
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h
index b672ddc00735..154769cad3f3 100644
--- a/include/linux/devpts_fs.h
+++ b/include/linux/devpts_fs.h
@@ -17,6 +17,8 @@
17 17
18#ifdef CONFIG_UNIX98_PTYS 18#ifdef CONFIG_UNIX98_PTYS
19 19
20int devpts_new_index(void);
21void devpts_kill_index(int idx);
20int devpts_pty_new(struct tty_struct *tty); /* mknod in devpts */ 22int devpts_pty_new(struct tty_struct *tty); /* mknod in devpts */
21struct tty_struct *devpts_get_tty(int number); /* get tty structure */ 23struct tty_struct *devpts_get_tty(int number); /* get tty structure */
22void devpts_pty_kill(int number); /* unlink */ 24void devpts_pty_kill(int number); /* unlink */
@@ -24,6 +26,8 @@ void devpts_pty_kill(int number); /* unlink */
24#else 26#else
25 27
26/* Dummy stubs in the no-pty case */ 28/* Dummy stubs in the no-pty case */
29static inline int devpts_new_index(void) { return -EINVAL; }
30static inline void devpts_kill_index(int idx) { }
27static inline int devpts_pty_new(struct tty_struct *tty) { return -EINVAL; } 31static inline int devpts_pty_new(struct tty_struct *tty) { return -EINVAL; }
28static inline struct tty_struct *devpts_get_tty(int number) { return NULL; } 32static inline struct tty_struct *devpts_get_tty(int number) { return NULL; }
29static inline void devpts_pty_kill(int number) { } 33static inline void devpts_pty_kill(int number) { }
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index c743fbc769db..203a025e30e5 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -21,10 +21,7 @@
21 21
22/* Lock levels and flags are here */ 22/* Lock levels and flags are here */
23#include <linux/dlmconstants.h> 23#include <linux/dlmconstants.h>
24 24#include <linux/types.h>
25
26#define DLM_RESNAME_MAXLEN 64
27
28 25
29typedef void dlm_lockspace_t; 26typedef void dlm_lockspace_t;
30 27
@@ -63,7 +60,7 @@ typedef void dlm_lockspace_t;
63 60
64struct dlm_lksb { 61struct dlm_lksb {
65 int sb_status; 62 int sb_status;
66 uint32_t sb_lkid; 63 __u32 sb_lkid;
67 char sb_flags; 64 char sb_flags;
68 char * sb_lvbptr; 65 char * sb_lvbptr;
69}; 66};
diff --git a/include/linux/dlm_device.h b/include/linux/dlm_device.h
index 9642277a152a..c6034508fed9 100644
--- a/include/linux/dlm_device.h
+++ b/include/linux/dlm_device.h
@@ -11,10 +11,16 @@
11******************************************************************************* 11*******************************************************************************
12******************************************************************************/ 12******************************************************************************/
13 13
14#ifndef _LINUX_DLM_DEVICE_H
15#define _LINUX_DLM_DEVICE_H
16
14/* This is the device interface for dlm, most users will use a library 17/* This is the device interface for dlm, most users will use a library
15 * interface. 18 * interface.
16 */ 19 */
17 20
21#include <linux/dlm.h>
22#include <linux/types.h>
23
18#define DLM_USER_LVB_LEN 32 24#define DLM_USER_LVB_LEN 32
19 25
20/* Version of the device interface */ 26/* Version of the device interface */
@@ -94,10 +100,9 @@ struct dlm_lock_result {
94#define DLM_USER_PURGE 6 100#define DLM_USER_PURGE 6
95#define DLM_USER_DEADLOCK 7 101#define DLM_USER_DEADLOCK 7
96 102
97/* Arbitrary length restriction */
98#define MAX_LS_NAME_LEN 64
99
100/* Lockspace flags */ 103/* Lockspace flags */
101#define DLM_USER_LSFLG_AUTOFREE 1 104#define DLM_USER_LSFLG_AUTOFREE 1
102#define DLM_USER_LSFLG_FORCEFREE 2 105#define DLM_USER_LSFLG_FORCEFREE 2
103 106
107#endif
108
diff --git a/include/linux/dlm_plock.h b/include/linux/dlm_plock.h
new file mode 100644
index 000000000000..18d5fdbceb74
--- /dev/null
+++ b/include/linux/dlm_plock.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
3 *
4 * This copyrighted material is made available to anyone wishing to use,
5 * modify, copy, or redistribute it subject to the terms and conditions
6 * of the GNU General Public License v.2.
7 */
8
9#ifndef __DLM_PLOCK_DOT_H__
10#define __DLM_PLOCK_DOT_H__
11
12#define DLM_PLOCK_MISC_NAME "dlm_plock"
13
14#define DLM_PLOCK_VERSION_MAJOR 1
15#define DLM_PLOCK_VERSION_MINOR 1
16#define DLM_PLOCK_VERSION_PATCH 0
17
18enum {
19 DLM_PLOCK_OP_LOCK = 1,
20 DLM_PLOCK_OP_UNLOCK,
21 DLM_PLOCK_OP_GET,
22};
23
24struct dlm_plock_info {
25 __u32 version[3];
26 __u8 optype;
27 __u8 ex;
28 __u8 wait;
29 __u8 pad;
30 __u32 pid;
31 __s32 nodeid;
32 __s32 rv;
33 __u32 fsid;
34 __u64 number;
35 __u64 start;
36 __u64 end;
37 __u64 owner;
38};
39
40#ifdef __KERNEL__
41int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
42 int cmd, struct file_lock *fl);
43int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
44 struct file_lock *fl);
45int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
46 struct file_lock *fl);
47#endif /* __KERNEL__ */
48
49#endif
50
diff --git a/include/linux/dlmconstants.h b/include/linux/dlmconstants.h
index fddb3d3ff321..47bf08dc7566 100644
--- a/include/linux/dlmconstants.h
+++ b/include/linux/dlmconstants.h
@@ -18,6 +18,10 @@
18 * Constants used by DLM interface. 18 * Constants used by DLM interface.
19 */ 19 */
20 20
21#define DLM_LOCKSPACE_LEN 64
22#define DLM_RESNAME_MAXLEN 64
23
24
21/* 25/*
22 * Lock Modes 26 * Lock Modes
23 */ 27 */
diff --git a/include/linux/dm-dirty-log.h b/include/linux/dm-dirty-log.h
new file mode 100644
index 000000000000..600c5fb2daad
--- /dev/null
+++ b/include/linux/dm-dirty-log.h
@@ -0,0 +1,131 @@
1/*
2 * Copyright (C) 2003 Sistina Software
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 *
5 * Device-Mapper dirty region log.
6 *
7 * This file is released under the LGPL.
8 */
9
10#ifndef _LINUX_DM_DIRTY_LOG
11#define _LINUX_DM_DIRTY_LOG
12
13#ifdef __KERNEL__
14
15#include <linux/types.h>
16#include <linux/device-mapper.h>
17
18typedef sector_t region_t;
19
20struct dm_dirty_log_type;
21
22struct dm_dirty_log {
23 struct dm_dirty_log_type *type;
24 void *context;
25};
26
27struct dm_dirty_log_type {
28 const char *name;
29 struct module *module;
30
31 int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti,
32 unsigned argc, char **argv);
33 void (*dtr)(struct dm_dirty_log *log);
34
35 /*
36 * There are times when we don't want the log to touch
37 * the disk.
38 */
39 int (*presuspend)(struct dm_dirty_log *log);
40 int (*postsuspend)(struct dm_dirty_log *log);
41 int (*resume)(struct dm_dirty_log *log);
42
43 /*
44 * Retrieves the smallest size of region that the log can
45 * deal with.
46 */
47 uint32_t (*get_region_size)(struct dm_dirty_log *log);
48
49 /*
50 * A predicate to say whether a region is clean or not.
51 * May block.
52 */
53 int (*is_clean)(struct dm_dirty_log *log, region_t region);
54
55 /*
56 * Returns: 0, 1, -EWOULDBLOCK, < 0
57 *
58 * A predicate function to check the area given by
59 * [sector, sector + len) is in sync.
60 *
61 * If -EWOULDBLOCK is returned the state of the region is
62 * unknown, typically this will result in a read being
63 * passed to a daemon to deal with, since a daemon is
64 * allowed to block.
65 */
66 int (*in_sync)(struct dm_dirty_log *log, region_t region,
67 int can_block);
68
69 /*
70 * Flush the current log state (eg, to disk). This
71 * function may block.
72 */
73 int (*flush)(struct dm_dirty_log *log);
74
75 /*
76 * Mark an area as clean or dirty. These functions may
77 * block, though for performance reasons blocking should
78 * be extremely rare (eg, allocating another chunk of
79 * memory for some reason).
80 */
81 void (*mark_region)(struct dm_dirty_log *log, region_t region);
82 void (*clear_region)(struct dm_dirty_log *log, region_t region);
83
84 /*
85 * Returns: <0 (error), 0 (no region), 1 (region)
86 *
87 * The mirrord will need perform recovery on regions of
88 * the mirror that are in the NOSYNC state. This
89 * function asks the log to tell the caller about the
90 * next region that this machine should recover.
91 *
92 * Do not confuse this function with 'in_sync()', one
93 * tells you if an area is synchronised, the other
94 * assigns recovery work.
95 */
96 int (*get_resync_work)(struct dm_dirty_log *log, region_t *region);
97
98 /*
99 * This notifies the log that the resync status of a region
100 * has changed. It also clears the region from the recovering
101 * list (if present).
102 */
103 void (*set_region_sync)(struct dm_dirty_log *log,
104 region_t region, int in_sync);
105
106 /*
107 * Returns the number of regions that are in sync.
108 */
109 region_t (*get_sync_count)(struct dm_dirty_log *log);
110
111 /*
112 * Support function for mirror status requests.
113 */
114 int (*status)(struct dm_dirty_log *log, status_type_t status_type,
115 char *result, unsigned maxlen);
116};
117
118int dm_dirty_log_type_register(struct dm_dirty_log_type *type);
119int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type);
120
121/*
122 * Make sure you use these two functions, rather than calling
123 * type->constructor/destructor() directly.
124 */
125struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
126 struct dm_target *ti,
127 unsigned argc, char **argv);
128void dm_dirty_log_destroy(struct dm_dirty_log *log);
129
130#endif /* __KERNEL__ */
131#endif /* _LINUX_DM_DIRTY_LOG_H */
diff --git a/include/linux/dm-io.h b/include/linux/dm-io.h
new file mode 100644
index 000000000000..b6bf17ee2f61
--- /dev/null
+++ b/include/linux/dm-io.h
@@ -0,0 +1,85 @@
1/*
2 * Copyright (C) 2003 Sistina Software
3 * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved.
4 *
5 * Device-Mapper low-level I/O.
6 *
7 * This file is released under the GPL.
8 */
9
10#ifndef _LINUX_DM_IO_H
11#define _LINUX_DM_IO_H
12
13#ifdef __KERNEL__
14
15#include <linux/types.h>
16
17struct dm_io_region {
18 struct block_device *bdev;
19 sector_t sector;
20 sector_t count; /* If this is zero the region is ignored. */
21};
22
23struct page_list {
24 struct page_list *next;
25 struct page *page;
26};
27
28typedef void (*io_notify_fn)(unsigned long error, void *context);
29
30enum dm_io_mem_type {
31 DM_IO_PAGE_LIST,/* Page list */
32 DM_IO_BVEC, /* Bio vector */
33 DM_IO_VMA, /* Virtual memory area */
34 DM_IO_KMEM, /* Kernel memory */
35};
36
37struct dm_io_memory {
38 enum dm_io_mem_type type;
39
40 union {
41 struct page_list *pl;
42 struct bio_vec *bvec;
43 void *vma;
44 void *addr;
45 } ptr;
46
47 unsigned offset;
48};
49
50struct dm_io_notify {
51 io_notify_fn fn; /* Callback for asynchronous requests */
52 void *context; /* Passed to callback */
53};
54
55/*
56 * IO request structure
57 */
58struct dm_io_client;
59struct dm_io_request {
60 int bi_rw; /* READ|WRITE - not READA */
61 struct dm_io_memory mem; /* Memory to use for io */
62 struct dm_io_notify notify; /* Synchronous if notify.fn is NULL */
63 struct dm_io_client *client; /* Client memory handler */
64};
65
66/*
67 * For async io calls, users can alternatively use the dm_io() function below
68 * and dm_io_client_create() to create private mempools for the client.
69 *
70 * Create/destroy may block.
71 */
72struct dm_io_client *dm_io_client_create(unsigned num_pages);
73int dm_io_client_resize(unsigned num_pages, struct dm_io_client *client);
74void dm_io_client_destroy(struct dm_io_client *client);
75
76/*
77 * IO interface using private per-client pools.
78 * Each bit in the optional 'sync_error_bits' bitset indicates whether an
79 * error occurred doing io to the corresponding region.
80 */
81int dm_io(struct dm_io_request *io_req, unsigned num_regions,
82 struct dm_io_region *region, unsigned long *sync_error_bits);
83
84#endif /* __KERNEL__ */
85#endif /* _LINUX_DM_IO_H */
diff --git a/include/linux/dm-kcopyd.h b/include/linux/dm-kcopyd.h
new file mode 100644
index 000000000000..5db216311695
--- /dev/null
+++ b/include/linux/dm-kcopyd.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2001 - 2003 Sistina Software
3 * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved.
4 *
5 * kcopyd provides a simple interface for copying an area of one
6 * block-device to one or more other block-devices, either synchronous
7 * or with an asynchronous completion notification.
8 *
9 * This file is released under the GPL.
10 */
11
12#ifndef _LINUX_DM_KCOPYD_H
13#define _LINUX_DM_KCOPYD_H
14
15#ifdef __KERNEL__
16
17#include <linux/dm-io.h>
18
19/* FIXME: make this configurable */
20#define DM_KCOPYD_MAX_REGIONS 8
21
22#define DM_KCOPYD_IGNORE_ERROR 1
23
24/*
25 * To use kcopyd you must first create a dm_kcopyd_client object.
26 */
27struct dm_kcopyd_client;
28int dm_kcopyd_client_create(unsigned num_pages,
29 struct dm_kcopyd_client **result);
30void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);
31
32/*
33 * Submit a copy job to kcopyd. This is built on top of the
34 * previous three fns.
35 *
36 * read_err is a boolean,
37 * write_err is a bitset, with 1 bit for each destination region
38 */
39typedef void (*dm_kcopyd_notify_fn)(int read_err, unsigned long write_err,
40 void *context);
41
42int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
43 unsigned num_dests, struct dm_io_region *dests,
44 unsigned flags, dm_kcopyd_notify_fn fn, void *context);
45
46#endif /* __KERNEL__ */
47#endif /* _LINUX_DM_KCOPYD_H */
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
new file mode 100644
index 000000000000..1677e2bfa00c
--- /dev/null
+++ b/include/linux/dma-attrs.h
@@ -0,0 +1,74 @@
1#ifndef _DMA_ATTR_H
2#define _DMA_ATTR_H
3
4#include <linux/bitmap.h>
5#include <linux/bitops.h>
6#include <linux/bug.h>
7
8/**
9 * an enum dma_attr represents an attribute associated with a DMA
10 * mapping. The semantics of each attribute should be defined in
11 * Documentation/DMA-attributes.txt.
12 */
13enum dma_attr {
14 DMA_ATTR_WRITE_BARRIER,
15 DMA_ATTR_MAX,
16};
17
18#define __DMA_ATTRS_LONGS BITS_TO_LONGS(DMA_ATTR_MAX)
19
20/**
21 * struct dma_attrs - an opaque container for DMA attributes
22 * @flags - bitmask representing a collection of enum dma_attr
23 */
24struct dma_attrs {
25 unsigned long flags[__DMA_ATTRS_LONGS];
26};
27
28#define DEFINE_DMA_ATTRS(x) \
29 struct dma_attrs x = { \
30 .flags = { [0 ... __DMA_ATTRS_LONGS-1] = 0 }, \
31 }
32
33static inline void init_dma_attrs(struct dma_attrs *attrs)
34{
35 bitmap_zero(attrs->flags, __DMA_ATTRS_LONGS);
36}
37
38#ifdef CONFIG_HAVE_DMA_ATTRS
39/**
40 * dma_set_attr - set a specific attribute
41 * @attr: attribute to set
42 * @attrs: struct dma_attrs (may be NULL)
43 */
44static inline void dma_set_attr(enum dma_attr attr, struct dma_attrs *attrs)
45{
46 if (attrs == NULL)
47 return;
48 BUG_ON(attr >= DMA_ATTR_MAX);
49 __set_bit(attr, attrs->flags);
50}
51
52/**
53 * dma_get_attr - check for a specific attribute
54 * @attr: attribute to set
55 * @attrs: struct dma_attrs (may be NULL)
56 */
57static inline int dma_get_attr(enum dma_attr attr, struct dma_attrs *attrs)
58{
59 if (attrs == NULL)
60 return 0;
61 BUG_ON(attr >= DMA_ATTR_MAX);
62 return test_bit(attr, attrs->flags);
63}
64#else /* !CONFIG_HAVE_DMA_ATTRS */
65static inline void dma_set_attr(enum dma_attr attr, struct dma_attrs *attrs)
66{
67}
68
69static inline int dma_get_attr(enum dma_attr attr, struct dma_attrs *attrs)
70{
71 return 0;
72}
73#endif /* CONFIG_HAVE_DMA_ATTRS */
74#endif /* _DMA_ATTR_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 332030709623..952e0f857ac9 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -146,4 +146,21 @@ static inline void dmam_release_declared_memory(struct device *dev)
146} 146}
147#endif /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */ 147#endif /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */
148 148
149#ifndef CONFIG_HAVE_DMA_ATTRS
150struct dma_attrs;
151
152#define dma_map_single_attrs(dev, cpu_addr, size, dir, attrs) \
153 dma_map_single(dev, cpu_addr, size, dir)
154
155#define dma_unmap_single_attrs(dev, dma_addr, size, dir, attrs) \
156 dma_unmap_single(dev, dma_addr, size, dir)
157
158#define dma_map_sg_attrs(dev, sgl, nents, dir, attrs) \
159 dma_map_sg(dev, sgl, nents, dir)
160
161#define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
162 dma_unmap_sg(dev, sgl, nents, dir)
163
164#endif /* CONFIG_HAVE_DMA_ATTRS */
165
149#endif 166#endif
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 34d440698293..d08a5c5eb928 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -95,12 +95,17 @@ enum dma_transaction_type {
95#define DMA_TX_TYPE_END (DMA_INTERRUPT + 1) 95#define DMA_TX_TYPE_END (DMA_INTERRUPT + 1)
96 96
97/** 97/**
98 * enum dma_prep_flags - DMA flags to augment operation preparation 98 * enum dma_ctrl_flags - DMA flags to augment operation preparation,
99 * control completion, and communicate status.
99 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of 100 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of
100 * this transaction 101 * this transaction
102 * @DMA_CTRL_ACK - the descriptor cannot be reused until the client
103 * acknowledges receipt, i.e. has has a chance to establish any
104 * dependency chains
101 */ 105 */
102enum dma_prep_flags { 106enum dma_ctrl_flags {
103 DMA_PREP_INTERRUPT = (1 << 0), 107 DMA_PREP_INTERRUPT = (1 << 0),
108 DMA_CTRL_ACK = (1 << 1),
104}; 109};
105 110
106/** 111/**
@@ -211,8 +216,8 @@ typedef void (*dma_async_tx_callback)(void *dma_async_param);
211 * ---dma generic offload fields--- 216 * ---dma generic offload fields---
212 * @cookie: tracking cookie for this transaction, set to -EBUSY if 217 * @cookie: tracking cookie for this transaction, set to -EBUSY if
213 * this tx is sitting on a dependency list 218 * this tx is sitting on a dependency list
214 * @ack: the descriptor can not be reused until the client acknowledges 219 * @flags: flags to augment operation preparation, control completion, and
215 * receipt, i.e. has has a chance to establish any dependency chains 220 * communicate status
216 * @phys: physical address of the descriptor 221 * @phys: physical address of the descriptor
217 * @tx_list: driver common field for operations that require multiple 222 * @tx_list: driver common field for operations that require multiple
218 * descriptors 223 * descriptors
@@ -221,23 +226,20 @@ typedef void (*dma_async_tx_callback)(void *dma_async_param);
221 * @callback: routine to call after this operation is complete 226 * @callback: routine to call after this operation is complete
222 * @callback_param: general parameter to pass to the callback routine 227 * @callback_param: general parameter to pass to the callback routine
223 * ---async_tx api specific fields--- 228 * ---async_tx api specific fields---
224 * @depend_list: at completion this list of transactions are submitted 229 * @next: at completion submit this descriptor
225 * @depend_node: allow this transaction to be executed after another
226 * transaction has completed, possibly on another channel
227 * @parent: pointer to the next level up in the dependency chain 230 * @parent: pointer to the next level up in the dependency chain
228 * @lock: protect the dependency list 231 * @lock: protect the parent and next pointers
229 */ 232 */
230struct dma_async_tx_descriptor { 233struct dma_async_tx_descriptor {
231 dma_cookie_t cookie; 234 dma_cookie_t cookie;
232 int ack; 235 enum dma_ctrl_flags flags; /* not a 'long' to pack with cookie */
233 dma_addr_t phys; 236 dma_addr_t phys;
234 struct list_head tx_list; 237 struct list_head tx_list;
235 struct dma_chan *chan; 238 struct dma_chan *chan;
236 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); 239 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
237 dma_async_tx_callback callback; 240 dma_async_tx_callback callback;
238 void *callback_param; 241 void *callback_param;
239 struct list_head depend_list; 242 struct dma_async_tx_descriptor *next;
240 struct list_head depend_node;
241 struct dma_async_tx_descriptor *parent; 243 struct dma_async_tx_descriptor *parent;
242 spinlock_t lock; 244 spinlock_t lock;
243}; 245};
@@ -261,7 +263,6 @@ struct dma_async_tx_descriptor {
261 * @device_prep_dma_zero_sum: prepares a zero_sum operation 263 * @device_prep_dma_zero_sum: prepares a zero_sum operation
262 * @device_prep_dma_memset: prepares a memset operation 264 * @device_prep_dma_memset: prepares a memset operation
263 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 265 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
264 * @device_dependency_added: async_tx notifies the channel about new deps
265 * @device_issue_pending: push pending transactions to hardware 266 * @device_issue_pending: push pending transactions to hardware
266 */ 267 */
267struct dma_device { 268struct dma_device {
@@ -294,9 +295,8 @@ struct dma_device {
294 struct dma_chan *chan, dma_addr_t dest, int value, size_t len, 295 struct dma_chan *chan, dma_addr_t dest, int value, size_t len,
295 unsigned long flags); 296 unsigned long flags);
296 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( 297 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
297 struct dma_chan *chan); 298 struct dma_chan *chan, unsigned long flags);
298 299
299 void (*device_dependency_added)(struct dma_chan *chan);
300 enum dma_status (*device_is_tx_complete)(struct dma_chan *chan, 300 enum dma_status (*device_is_tx_complete)(struct dma_chan *chan,
301 dma_cookie_t cookie, dma_cookie_t *last, 301 dma_cookie_t cookie, dma_cookie_t *last,
302 dma_cookie_t *used); 302 dma_cookie_t *used);
@@ -321,7 +321,13 @@ void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx,
321static inline void 321static inline void
322async_tx_ack(struct dma_async_tx_descriptor *tx) 322async_tx_ack(struct dma_async_tx_descriptor *tx)
323{ 323{
324 tx->ack = 1; 324 tx->flags |= DMA_CTRL_ACK;
325}
326
327static inline int
328async_tx_test_ack(struct dma_async_tx_descriptor *tx)
329{
330 return tx->flags & DMA_CTRL_ACK;
325} 331}
326 332
327#define first_dma_cap(mask) __first_dma_cap(&(mask)) 333#define first_dma_cap(mask) __first_dma_cap(&(mask))
@@ -398,7 +404,7 @@ static inline enum dma_status dma_async_is_tx_complete(struct dma_chan *chan,
398 * @last_used: last cookie value handed out 404 * @last_used: last cookie value handed out
399 * 405 *
400 * dma_async_is_complete() is used in dma_async_memcpy_complete() 406 * dma_async_is_complete() is used in dma_async_memcpy_complete()
401 * the test logic is seperated for lightweight testing of multiple cookies 407 * the test logic is separated for lightweight testing of multiple cookies
402 */ 408 */
403static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie, 409static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
404 dma_cookie_t last_complete, dma_cookie_t last_used) 410 dma_cookie_t last_complete, dma_cookie_t last_used)
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 325acdf5c462..2a063b64133f 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -90,6 +90,7 @@ static inline int dmi_check_system(const struct dmi_system_id *list) { return 0;
90static inline const char * dmi_get_system_info(int field) { return NULL; } 90static inline const char * dmi_get_system_info(int field) { return NULL; }
91static inline const struct dmi_device * dmi_find_device(int type, const char *name, 91static inline const struct dmi_device * dmi_find_device(int type, const char *name,
92 const struct dmi_device *from) { return NULL; } 92 const struct dmi_device *from) { return NULL; }
93static inline void dmi_scan_machine(void) { return; }
93static inline int dmi_get_year(int year) { return 0; } 94static inline int dmi_get_year(int year) { return 0; }
94static inline int dmi_name_in_vendors(const char *s) { return 0; } 95static inline int dmi_name_in_vendors(const char *s) { return 0; }
95#define dmi_available 0 96#define dmi_available 0
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
index c6a2353c4e68..402fb7a8d922 100644
--- a/include/linux/dvb/dmx.h
+++ b/include/linux/dvb/dmx.h
@@ -39,9 +39,10 @@ typedef enum
39 DMX_OUT_DECODER, /* Streaming directly to decoder. */ 39 DMX_OUT_DECODER, /* Streaming directly to decoder. */
40 DMX_OUT_TAP, /* Output going to a memory buffer */ 40 DMX_OUT_TAP, /* Output going to a memory buffer */
41 /* (to be retrieved via the read command).*/ 41 /* (to be retrieved via the read command).*/
42 DMX_OUT_TS_TAP /* Output multiplexed into a new TS */ 42 DMX_OUT_TS_TAP, /* Output multiplexed into a new TS */
43 /* (to be retrieved by reading from the */ 43 /* (to be retrieved by reading from the */
44 /* logical DVR device). */ 44 /* logical DVR device). */
45 DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */
45} dmx_output_t; 46} dmx_output_t;
46 47
47 48
diff --git a/include/linux/edac.h b/include/linux/edac.h
index eab451e69a91..7cf92e8a4196 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Author: Dave Jiang <djiang@mvista.com> 4 * Author: Dave Jiang <djiang@mvista.com>
5 * 5 *
6 * 2006-2007 (c) MontaVista Software, Inc. This file is licensed under 6 * 2006-2008 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program 7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express 8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied. 9 * or implied.
@@ -26,4 +26,16 @@ extern atomic_t edac_handlers;
26extern int edac_handler_set(void); 26extern int edac_handler_set(void);
27extern void edac_atomic_assert_error(void); 27extern void edac_atomic_assert_error(void);
28 28
29static inline void opstate_init(void)
30{
31 switch (edac_op_state) {
32 case EDAC_OPSTATE_POLL:
33 case EDAC_OPSTATE_NMI:
34 break;
35 default:
36 edac_op_state = EDAC_OPSTATE_POLL;
37 }
38 return;
39}
40
29#endif 41#endif
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 14813b595802..a5f359a7ad0e 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -18,6 +18,7 @@
18#include <linux/proc_fs.h> 18#include <linux/proc_fs.h>
19#include <linux/rtc.h> 19#include <linux/rtc.h>
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/pfn.h>
21 22
22#include <asm/page.h> 23#include <asm/page.h>
23#include <asm/system.h> 24#include <asm/system.h>
@@ -394,4 +395,10 @@ struct efi_generic_dev_path {
394 u16 length; 395 u16 length;
395} __attribute ((packed)); 396} __attribute ((packed));
396 397
398static inline void memrange_efi_to_native(u64 *addr, u64 *npages)
399{
400 *npages = PFN_UP(*addr + (*npages<<EFI_PAGE_SHIFT)) - PFN_DOWN(*addr);
401 *addr &= PAGE_MASK;
402}
403
397#endif /* _LINUX_EFI_H */ 404#endif /* _LINUX_EFI_H */
diff --git a/include/linux/elf.h b/include/linux/elf.h
index bad1b16ec49a..ff9fbed90123 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -208,7 +208,7 @@ typedef struct elf32_hdr{
208} Elf32_Ehdr; 208} Elf32_Ehdr;
209 209
210typedef struct elf64_hdr { 210typedef struct elf64_hdr {
211 unsigned char e_ident[16]; /* ELF "magic number" */ 211 unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
212 Elf64_Half e_type; 212 Elf64_Half e_type;
213 Elf64_Half e_machine; 213 Elf64_Half e_machine;
214 Elf64_Word e_version; 214 Elf64_Word e_version;
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h
index a5978f18ca40..4332442b1b57 100644
--- a/include/linux/enclosure.h
+++ b/include/linux/enclosure.h
@@ -82,7 +82,8 @@ struct enclosure_component_callbacks {
82 82
83struct enclosure_component { 83struct enclosure_component {
84 void *scratch; 84 void *scratch;
85 struct class_device cdev; 85 struct device cdev;
86 struct device *dev;
86 enum enclosure_component_type type; 87 enum enclosure_component_type type;
87 int number; 88 int number;
88 int fault; 89 int fault;
@@ -94,20 +95,20 @@ struct enclosure_component {
94struct enclosure_device { 95struct enclosure_device {
95 void *scratch; 96 void *scratch;
96 struct list_head node; 97 struct list_head node;
97 struct class_device cdev; 98 struct device edev;
98 struct enclosure_component_callbacks *cb; 99 struct enclosure_component_callbacks *cb;
99 int components; 100 int components;
100 struct enclosure_component component[0]; 101 struct enclosure_component component[0];
101}; 102};
102 103
103static inline struct enclosure_device * 104static inline struct enclosure_device *
104to_enclosure_device(struct class_device *dev) 105to_enclosure_device(struct device *dev)
105{ 106{
106 return container_of(dev, struct enclosure_device, cdev); 107 return container_of(dev, struct enclosure_device, edev);
107} 108}
108 109
109static inline struct enclosure_component * 110static inline struct enclosure_component *
110to_enclosure_component(struct class_device *dev) 111to_enclosure_component(struct device *dev)
111{ 112{
112 return container_of(dev, struct enclosure_component, cdev); 113 return container_of(dev, struct enclosure_component, cdev);
113} 114}
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index b489fc6d0b62..a701399b7fed 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -8,9 +8,6 @@
8#ifndef _LINUX_EVENTFD_H 8#ifndef _LINUX_EVENTFD_H
9#define _LINUX_EVENTFD_H 9#define _LINUX_EVENTFD_H
10 10
11
12#ifdef __KERNEL__
13
14#ifdef CONFIG_EVENTFD 11#ifdef CONFIG_EVENTFD
15 12
16struct file *eventfd_fget(int fd); 13struct file *eventfd_fget(int fd);
@@ -24,7 +21,5 @@ static inline int eventfd_signal(struct file *file, int n)
24 21
25#endif /* CONFIG_EVENTFD */ 22#endif /* CONFIG_EVENTFD */
26 23
27#endif /* __KERNEL__ */
28
29#endif /* _LINUX_EVENTFD_H */ 24#endif /* _LINUX_EVENTFD_H */
30 25
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index adcbb05b120b..de8387b7ceb6 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -43,7 +43,7 @@ struct fid {
43 u32 parent_ino; 43 u32 parent_ino;
44 u32 parent_gen; 44 u32 parent_gen;
45 } i32; 45 } i32;
46 __u32 raw[6]; 46 __u32 raw[0];
47 }; 47 };
48}; 48};
49 49
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
deleted file mode 100644
index 250032548597..000000000000
--- a/include/linux/ext4_fs.h
+++ /dev/null
@@ -1,1207 +0,0 @@
1/*
2 * linux/include/linux/ext4_fs.h
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *
9 * from
10 *
11 * linux/include/linux/minix_fs.h
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 */
15
16#ifndef _LINUX_EXT4_FS_H
17#define _LINUX_EXT4_FS_H
18
19#include <linux/types.h>
20#include <linux/blkdev.h>
21#include <linux/magic.h>
22
23#include <linux/ext4_fs_i.h>
24
25/*
26 * The second extended filesystem constants/structures
27 */
28
29/*
30 * Define EXT4FS_DEBUG to produce debug messages
31 */
32#undef EXT4FS_DEBUG
33
34/*
35 * Define EXT4_RESERVATION to reserve data blocks for expanding files
36 */
37#define EXT4_DEFAULT_RESERVE_BLOCKS 8
38/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
39#define EXT4_MAX_RESERVE_BLOCKS 1027
40#define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0
41
42/*
43 * Debug code
44 */
45#ifdef EXT4FS_DEBUG
46#define ext4_debug(f, a...) \
47 do { \
48 printk (KERN_DEBUG "EXT4-fs DEBUG (%s, %d): %s:", \
49 __FILE__, __LINE__, __FUNCTION__); \
50 printk (KERN_DEBUG f, ## a); \
51 } while (0)
52#else
53#define ext4_debug(f, a...) do {} while (0)
54#endif
55
56#define EXT4_MULTIBLOCK_ALLOCATOR 1
57
58/* prefer goal again. length */
59#define EXT4_MB_HINT_MERGE 1
60/* blocks already reserved */
61#define EXT4_MB_HINT_RESERVED 2
62/* metadata is being allocated */
63#define EXT4_MB_HINT_METADATA 4
64/* first blocks in the file */
65#define EXT4_MB_HINT_FIRST 8
66/* search for the best chunk */
67#define EXT4_MB_HINT_BEST 16
68/* data is being allocated */
69#define EXT4_MB_HINT_DATA 32
70/* don't preallocate (for tails) */
71#define EXT4_MB_HINT_NOPREALLOC 64
72/* allocate for locality group */
73#define EXT4_MB_HINT_GROUP_ALLOC 128
74/* allocate goal blocks or none */
75#define EXT4_MB_HINT_GOAL_ONLY 256
76/* goal is meaningful */
77#define EXT4_MB_HINT_TRY_GOAL 512
78
79struct ext4_allocation_request {
80 /* target inode for block we're allocating */
81 struct inode *inode;
82 /* logical block in target inode */
83 ext4_lblk_t logical;
84 /* phys. target (a hint) */
85 ext4_fsblk_t goal;
86 /* the closest logical allocated block to the left */
87 ext4_lblk_t lleft;
88 /* phys. block for ^^^ */
89 ext4_fsblk_t pleft;
90 /* the closest logical allocated block to the right */
91 ext4_lblk_t lright;
92 /* phys. block for ^^^ */
93 ext4_fsblk_t pright;
94 /* how many blocks we want to allocate */
95 unsigned long len;
96 /* flags. see above EXT4_MB_HINT_* */
97 unsigned long flags;
98};
99
100/*
101 * Special inodes numbers
102 */
103#define EXT4_BAD_INO 1 /* Bad blocks inode */
104#define EXT4_ROOT_INO 2 /* Root inode */
105#define EXT4_BOOT_LOADER_INO 5 /* Boot loader inode */
106#define EXT4_UNDEL_DIR_INO 6 /* Undelete directory inode */
107#define EXT4_RESIZE_INO 7 /* Reserved group descriptors inode */
108#define EXT4_JOURNAL_INO 8 /* Journal inode */
109
110/* First non-reserved inode for old ext4 filesystems */
111#define EXT4_GOOD_OLD_FIRST_INO 11
112
113/*
114 * Maximal count of links to a file
115 */
116#define EXT4_LINK_MAX 65000
117
118/*
119 * Macro-instructions used to manage several block sizes
120 */
121#define EXT4_MIN_BLOCK_SIZE 1024
122#define EXT4_MAX_BLOCK_SIZE 65536
123#define EXT4_MIN_BLOCK_LOG_SIZE 10
124#ifdef __KERNEL__
125# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize)
126#else
127# define EXT4_BLOCK_SIZE(s) (EXT4_MIN_BLOCK_SIZE << (s)->s_log_block_size)
128#endif
129#define EXT4_ADDR_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / sizeof (__u32))
130#ifdef __KERNEL__
131# define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
132#else
133# define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
134#endif
135#ifdef __KERNEL__
136#define EXT4_ADDR_PER_BLOCK_BITS(s) (EXT4_SB(s)->s_addr_per_block_bits)
137#define EXT4_INODE_SIZE(s) (EXT4_SB(s)->s_inode_size)
138#define EXT4_FIRST_INO(s) (EXT4_SB(s)->s_first_ino)
139#else
140#define EXT4_INODE_SIZE(s) (((s)->s_rev_level == EXT4_GOOD_OLD_REV) ? \
141 EXT4_GOOD_OLD_INODE_SIZE : \
142 (s)->s_inode_size)
143#define EXT4_FIRST_INO(s) (((s)->s_rev_level == EXT4_GOOD_OLD_REV) ? \
144 EXT4_GOOD_OLD_FIRST_INO : \
145 (s)->s_first_ino)
146#endif
147#define EXT4_BLOCK_ALIGN(size, blkbits) ALIGN((size), (1 << (blkbits)))
148
149/*
150 * Structure of a blocks group descriptor
151 */
152struct ext4_group_desc
153{
154 __le32 bg_block_bitmap_lo; /* Blocks bitmap block */
155 __le32 bg_inode_bitmap_lo; /* Inodes bitmap block */
156 __le32 bg_inode_table_lo; /* Inodes table block */
157 __le16 bg_free_blocks_count; /* Free blocks count */
158 __le16 bg_free_inodes_count; /* Free inodes count */
159 __le16 bg_used_dirs_count; /* Directories count */
160 __le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */
161 __u32 bg_reserved[2]; /* Likely block/inode bitmap checksum */
162 __le16 bg_itable_unused; /* Unused inodes count */
163 __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */
164 __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
165 __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
166 __le32 bg_inode_table_hi; /* Inodes table block MSB */
167 __le16 bg_free_blocks_count_hi;/* Free blocks count MSB */
168 __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */
169 __le16 bg_used_dirs_count_hi; /* Directories count MSB */
170 __le16 bg_itable_unused_hi; /* Unused inodes count MSB */
171 __u32 bg_reserved2[3];
172};
173
174#define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */
175#define EXT4_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */
176#define EXT4_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */
177
178#ifdef __KERNEL__
179#include <linux/ext4_fs_i.h>
180#include <linux/ext4_fs_sb.h>
181#endif
182/*
183 * Macro-instructions used to manage group descriptors
184 */
185#define EXT4_MIN_DESC_SIZE 32
186#define EXT4_MIN_DESC_SIZE_64BIT 64
187#define EXT4_MAX_DESC_SIZE EXT4_MIN_BLOCK_SIZE
188#define EXT4_DESC_SIZE(s) (EXT4_SB(s)->s_desc_size)
189#ifdef __KERNEL__
190# define EXT4_BLOCKS_PER_GROUP(s) (EXT4_SB(s)->s_blocks_per_group)
191# define EXT4_DESC_PER_BLOCK(s) (EXT4_SB(s)->s_desc_per_block)
192# define EXT4_INODES_PER_GROUP(s) (EXT4_SB(s)->s_inodes_per_group)
193# define EXT4_DESC_PER_BLOCK_BITS(s) (EXT4_SB(s)->s_desc_per_block_bits)
194#else
195# define EXT4_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
196# define EXT4_DESC_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / EXT4_DESC_SIZE(s))
197# define EXT4_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
198#endif
199
200/*
201 * Constants relative to the data blocks
202 */
203#define EXT4_NDIR_BLOCKS 12
204#define EXT4_IND_BLOCK EXT4_NDIR_BLOCKS
205#define EXT4_DIND_BLOCK (EXT4_IND_BLOCK + 1)
206#define EXT4_TIND_BLOCK (EXT4_DIND_BLOCK + 1)
207#define EXT4_N_BLOCKS (EXT4_TIND_BLOCK + 1)
208
209/*
210 * Inode flags
211 */
212#define EXT4_SECRM_FL 0x00000001 /* Secure deletion */
213#define EXT4_UNRM_FL 0x00000002 /* Undelete */
214#define EXT4_COMPR_FL 0x00000004 /* Compress file */
215#define EXT4_SYNC_FL 0x00000008 /* Synchronous updates */
216#define EXT4_IMMUTABLE_FL 0x00000010 /* Immutable file */
217#define EXT4_APPEND_FL 0x00000020 /* writes to file may only append */
218#define EXT4_NODUMP_FL 0x00000040 /* do not dump file */
219#define EXT4_NOATIME_FL 0x00000080 /* do not update atime */
220/* Reserved for compression usage... */
221#define EXT4_DIRTY_FL 0x00000100
222#define EXT4_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
223#define EXT4_NOCOMPR_FL 0x00000400 /* Don't compress */
224#define EXT4_ECOMPR_FL 0x00000800 /* Compression error */
225/* End compression flags --- maybe not all used */
226#define EXT4_INDEX_FL 0x00001000 /* hash-indexed directory */
227#define EXT4_IMAGIC_FL 0x00002000 /* AFS directory */
228#define EXT4_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
229#define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */
230#define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
231#define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
232#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
233#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
234#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
235
236#define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */
237#define EXT4_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
238
239/*
240 * Inode dynamic state flags
241 */
242#define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */
243#define EXT4_STATE_NEW 0x00000002 /* inode is newly created */
244#define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */
245#define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */
246
247/* Used to pass group descriptor data when online resize is done */
248struct ext4_new_group_input {
249 __u32 group; /* Group number for this data */
250 __u64 block_bitmap; /* Absolute block number of block bitmap */
251 __u64 inode_bitmap; /* Absolute block number of inode bitmap */
252 __u64 inode_table; /* Absolute block number of inode table start */
253 __u32 blocks_count; /* Total number of blocks in this group */
254 __u16 reserved_blocks; /* Number of reserved blocks in this group */
255 __u16 unused;
256};
257
258/* The struct ext4_new_group_input in kernel space, with free_blocks_count */
259struct ext4_new_group_data {
260 __u32 group;
261 __u64 block_bitmap;
262 __u64 inode_bitmap;
263 __u64 inode_table;
264 __u32 blocks_count;
265 __u16 reserved_blocks;
266 __u16 unused;
267 __u32 free_blocks_count;
268};
269
270/*
271 * Following is used by preallocation code to tell get_blocks() that we
272 * want uninitialzed extents.
273 */
274#define EXT4_CREATE_UNINITIALIZED_EXT 2
275
276/*
277 * ioctl commands
278 */
279#define EXT4_IOC_GETFLAGS FS_IOC_GETFLAGS
280#define EXT4_IOC_SETFLAGS FS_IOC_SETFLAGS
281#define EXT4_IOC_GETVERSION _IOR('f', 3, long)
282#define EXT4_IOC_SETVERSION _IOW('f', 4, long)
283#define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
284#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input)
285#define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION
286#define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION
287#ifdef CONFIG_JBD2_DEBUG
288#define EXT4_IOC_WAIT_FOR_READONLY _IOR('f', 99, long)
289#endif
290#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long)
291#define EXT4_IOC_SETRSVSZ _IOW('f', 6, long)
292#define EXT4_IOC_MIGRATE _IO('f', 7)
293
294/*
295 * ioctl commands in 32 bit emulation
296 */
297#define EXT4_IOC32_GETFLAGS FS_IOC32_GETFLAGS
298#define EXT4_IOC32_SETFLAGS FS_IOC32_SETFLAGS
299#define EXT4_IOC32_GETVERSION _IOR('f', 3, int)
300#define EXT4_IOC32_SETVERSION _IOW('f', 4, int)
301#define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int)
302#define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int)
303#define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
304#ifdef CONFIG_JBD2_DEBUG
305#define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
306#endif
307#define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
308#define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
309
310
311/*
312 * Mount options
313 */
314struct ext4_mount_options {
315 unsigned long s_mount_opt;
316 uid_t s_resuid;
317 gid_t s_resgid;
318 unsigned long s_commit_interval;
319#ifdef CONFIG_QUOTA
320 int s_jquota_fmt;
321 char *s_qf_names[MAXQUOTAS];
322#endif
323};
324
325/*
326 * Structure of an inode on the disk
327 */
328struct ext4_inode {
329 __le16 i_mode; /* File mode */
330 __le16 i_uid; /* Low 16 bits of Owner Uid */
331 __le32 i_size_lo; /* Size in bytes */
332 __le32 i_atime; /* Access time */
333 __le32 i_ctime; /* Inode Change time */
334 __le32 i_mtime; /* Modification time */
335 __le32 i_dtime; /* Deletion Time */
336 __le16 i_gid; /* Low 16 bits of Group Id */
337 __le16 i_links_count; /* Links count */
338 __le32 i_blocks_lo; /* Blocks count */
339 __le32 i_flags; /* File flags */
340 union {
341 struct {
342 __le32 l_i_version;
343 } linux1;
344 struct {
345 __u32 h_i_translator;
346 } hurd1;
347 struct {
348 __u32 m_i_reserved1;
349 } masix1;
350 } osd1; /* OS dependent 1 */
351 __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */
352 __le32 i_generation; /* File version (for NFS) */
353 __le32 i_file_acl_lo; /* File ACL */
354 __le32 i_size_high;
355 __le32 i_obso_faddr; /* Obsoleted fragment address */
356 union {
357 struct {
358 __le16 l_i_blocks_high; /* were l_i_reserved1 */
359 __le16 l_i_file_acl_high;
360 __le16 l_i_uid_high; /* these 2 fields */
361 __le16 l_i_gid_high; /* were reserved2[0] */
362 __u32 l_i_reserved2;
363 } linux2;
364 struct {
365 __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
366 __u16 h_i_mode_high;
367 __u16 h_i_uid_high;
368 __u16 h_i_gid_high;
369 __u32 h_i_author;
370 } hurd2;
371 struct {
372 __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
373 __le16 m_i_file_acl_high;
374 __u32 m_i_reserved2[2];
375 } masix2;
376 } osd2; /* OS dependent 2 */
377 __le16 i_extra_isize;
378 __le16 i_pad1;
379 __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
380 __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
381 __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
382 __le32 i_crtime; /* File Creation time */
383 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
384 __le32 i_version_hi; /* high 32 bits for 64-bit version */
385};
386
387
388#define EXT4_EPOCH_BITS 2
389#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
390#define EXT4_NSEC_MASK (~0UL << EXT4_EPOCH_BITS)
391
392/*
393 * Extended fields will fit into an inode if the filesystem was formatted
394 * with large inodes (-I 256 or larger) and there are not currently any EAs
395 * consuming all of the available space. For new inodes we always reserve
396 * enough space for the kernel's known extended fields, but for inodes
397 * created with an old kernel this might not have been the case. None of
398 * the extended inode fields is critical for correct filesystem operation.
399 * This macro checks if a certain field fits in the inode. Note that
400 * inode-size = GOOD_OLD_INODE_SIZE + i_extra_isize
401 */
402#define EXT4_FITS_IN_INODE(ext4_inode, einode, field) \
403 ((offsetof(typeof(*ext4_inode), field) + \
404 sizeof((ext4_inode)->field)) \
405 <= (EXT4_GOOD_OLD_INODE_SIZE + \
406 (einode)->i_extra_isize)) \
407
408static inline __le32 ext4_encode_extra_time(struct timespec *time)
409{
410 return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
411 time->tv_sec >> 32 : 0) |
412 ((time->tv_nsec << 2) & EXT4_NSEC_MASK));
413}
414
415static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra)
416{
417 if (sizeof(time->tv_sec) > 4)
418 time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK)
419 << 32;
420 time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> 2;
421}
422
423#define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \
424do { \
425 (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
426 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \
427 (raw_inode)->xtime ## _extra = \
428 ext4_encode_extra_time(&(inode)->xtime); \
429} while (0)
430
431#define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \
432do { \
433 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
434 (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \
435 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
436 (raw_inode)->xtime ## _extra = \
437 ext4_encode_extra_time(&(einode)->xtime); \
438} while (0)
439
440#define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode) \
441do { \
442 (inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime); \
443 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \
444 ext4_decode_extra_time(&(inode)->xtime, \
445 raw_inode->xtime ## _extra); \
446} while (0)
447
448#define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \
449do { \
450 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
451 (einode)->xtime.tv_sec = \
452 (signed)le32_to_cpu((raw_inode)->xtime); \
453 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
454 ext4_decode_extra_time(&(einode)->xtime, \
455 raw_inode->xtime ## _extra); \
456} while (0)
457
458#define i_disk_version osd1.linux1.l_i_version
459
460#if defined(__KERNEL__) || defined(__linux__)
461#define i_reserved1 osd1.linux1.l_i_reserved1
462#define i_file_acl_high osd2.linux2.l_i_file_acl_high
463#define i_blocks_high osd2.linux2.l_i_blocks_high
464#define i_uid_low i_uid
465#define i_gid_low i_gid
466#define i_uid_high osd2.linux2.l_i_uid_high
467#define i_gid_high osd2.linux2.l_i_gid_high
468#define i_reserved2 osd2.linux2.l_i_reserved2
469
470#elif defined(__GNU__)
471
472#define i_translator osd1.hurd1.h_i_translator
473#define i_uid_high osd2.hurd2.h_i_uid_high
474#define i_gid_high osd2.hurd2.h_i_gid_high
475#define i_author osd2.hurd2.h_i_author
476
477#elif defined(__masix__)
478
479#define i_reserved1 osd1.masix1.m_i_reserved1
480#define i_file_acl_high osd2.masix2.m_i_file_acl_high
481#define i_reserved2 osd2.masix2.m_i_reserved2
482
483#endif /* defined(__KERNEL__) || defined(__linux__) */
484
485/*
486 * File system states
487 */
488#define EXT4_VALID_FS 0x0001 /* Unmounted cleanly */
489#define EXT4_ERROR_FS 0x0002 /* Errors detected */
490#define EXT4_ORPHAN_FS 0x0004 /* Orphans being recovered */
491
492/*
493 * Misc. filesystem flags
494 */
495#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
496#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
497#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */
498
499/*
500 * Mount flags
501 */
502#define EXT4_MOUNT_CHECK 0x00001 /* Do mount-time checks */
503#define EXT4_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */
504#define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */
505#define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */
506#define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
507#define EXT4_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */
508#define EXT4_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */
509#define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */
510#define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/
511#define EXT4_MOUNT_ABORT 0x00200 /* Fatal error detected */
512#define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */
513#define EXT4_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */
514#define EXT4_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */
515#define EXT4_MOUNT_WRITEBACK_DATA 0x00C00 /* No data ordering */
516#define EXT4_MOUNT_UPDATE_JOURNAL 0x01000 /* Update the journal format */
517#define EXT4_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */
518#define EXT4_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */
519#define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
520#define EXT4_MOUNT_RESERVATION 0x10000 /* Preallocation */
521#define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */
522#define EXT4_MOUNT_NOBH 0x40000 /* No bufferheads */
523#define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
524#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
525#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
526#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */
527#define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
528#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
529#define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
530#define EXT4_MOUNT_MBALLOC 0x4000000 /* Buddy allocation support */
531/* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */
532#ifndef _LINUX_EXT2_FS_H
533#define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt
534#define set_opt(o, opt) o |= EXT4_MOUNT_##opt
535#define test_opt(sb, opt) (EXT4_SB(sb)->s_mount_opt & \
536 EXT4_MOUNT_##opt)
537#else
538#define EXT2_MOUNT_NOLOAD EXT4_MOUNT_NOLOAD
539#define EXT2_MOUNT_ABORT EXT4_MOUNT_ABORT
540#define EXT2_MOUNT_DATA_FLAGS EXT4_MOUNT_DATA_FLAGS
541#endif
542
543#define ext4_set_bit ext2_set_bit
544#define ext4_set_bit_atomic ext2_set_bit_atomic
545#define ext4_clear_bit ext2_clear_bit
546#define ext4_clear_bit_atomic ext2_clear_bit_atomic
547#define ext4_test_bit ext2_test_bit
548#define ext4_find_first_zero_bit ext2_find_first_zero_bit
549#define ext4_find_next_zero_bit ext2_find_next_zero_bit
550#define ext4_find_next_bit ext2_find_next_bit
551
552/*
553 * Maximal mount counts between two filesystem checks
554 */
555#define EXT4_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
556#define EXT4_DFL_CHECKINTERVAL 0 /* Don't use interval check */
557
558/*
559 * Behaviour when detecting errors
560 */
561#define EXT4_ERRORS_CONTINUE 1 /* Continue execution */
562#define EXT4_ERRORS_RO 2 /* Remount fs read-only */
563#define EXT4_ERRORS_PANIC 3 /* Panic */
564#define EXT4_ERRORS_DEFAULT EXT4_ERRORS_CONTINUE
565
566/*
567 * Structure of the super block
568 */
569struct ext4_super_block {
570/*00*/ __le32 s_inodes_count; /* Inodes count */
571 __le32 s_blocks_count_lo; /* Blocks count */
572 __le32 s_r_blocks_count_lo; /* Reserved blocks count */
573 __le32 s_free_blocks_count_lo; /* Free blocks count */
574/*10*/ __le32 s_free_inodes_count; /* Free inodes count */
575 __le32 s_first_data_block; /* First Data Block */
576 __le32 s_log_block_size; /* Block size */
577 __le32 s_obso_log_frag_size; /* Obsoleted fragment size */
578/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */
579 __le32 s_obso_frags_per_group; /* Obsoleted fragments per group */
580 __le32 s_inodes_per_group; /* # Inodes per group */
581 __le32 s_mtime; /* Mount time */
582/*30*/ __le32 s_wtime; /* Write time */
583 __le16 s_mnt_count; /* Mount count */
584 __le16 s_max_mnt_count; /* Maximal mount count */
585 __le16 s_magic; /* Magic signature */
586 __le16 s_state; /* File system state */
587 __le16 s_errors; /* Behaviour when detecting errors */
588 __le16 s_minor_rev_level; /* minor revision level */
589/*40*/ __le32 s_lastcheck; /* time of last check */
590 __le32 s_checkinterval; /* max. time between checks */
591 __le32 s_creator_os; /* OS */
592 __le32 s_rev_level; /* Revision level */
593/*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */
594 __le16 s_def_resgid; /* Default gid for reserved blocks */
595 /*
596 * These fields are for EXT4_DYNAMIC_REV superblocks only.
597 *
598 * Note: the difference between the compatible feature set and
599 * the incompatible feature set is that if there is a bit set
600 * in the incompatible feature set that the kernel doesn't
601 * know about, it should refuse to mount the filesystem.
602 *
603 * e2fsck's requirements are more strict; if it doesn't know
604 * about a feature in either the compatible or incompatible
605 * feature set, it must abort and not try to meddle with
606 * things it doesn't understand...
607 */
608 __le32 s_first_ino; /* First non-reserved inode */
609 __le16 s_inode_size; /* size of inode structure */
610 __le16 s_block_group_nr; /* block group # of this superblock */
611 __le32 s_feature_compat; /* compatible feature set */
612/*60*/ __le32 s_feature_incompat; /* incompatible feature set */
613 __le32 s_feature_ro_compat; /* readonly-compatible feature set */
614/*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
615/*78*/ char s_volume_name[16]; /* volume name */
616/*88*/ char s_last_mounted[64]; /* directory where last mounted */
617/*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */
618 /*
619 * Performance hints. Directory preallocation should only
620 * happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
621 */
622 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
623 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
624 __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
625 /*
626 * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
627 */
628/*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
629/*E0*/ __le32 s_journal_inum; /* inode number of journal file */
630 __le32 s_journal_dev; /* device number of journal file */
631 __le32 s_last_orphan; /* start of list of inodes to delete */
632 __le32 s_hash_seed[4]; /* HTREE hash seed */
633 __u8 s_def_hash_version; /* Default hash version to use */
634 __u8 s_reserved_char_pad;
635 __le16 s_desc_size; /* size of group descriptor */
636/*100*/ __le32 s_default_mount_opts;
637 __le32 s_first_meta_bg; /* First metablock block group */
638 __le32 s_mkfs_time; /* When the filesystem was created */
639 __le32 s_jnl_blocks[17]; /* Backup of the journal inode */
640 /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
641/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
642 __le32 s_r_blocks_count_hi; /* Reserved blocks count */
643 __le32 s_free_blocks_count_hi; /* Free blocks count */
644 __le16 s_min_extra_isize; /* All inodes have at least # bytes */
645 __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
646 __le32 s_flags; /* Miscellaneous flags */
647 __le16 s_raid_stride; /* RAID stride */
648 __le16 s_mmp_interval; /* # seconds to wait in MMP checking */
649 __le64 s_mmp_block; /* Block for multi-mount protection */
650 __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
651 __u32 s_reserved[163]; /* Padding to the end of the block */
652};
653
654#ifdef __KERNEL__
655static inline struct ext4_sb_info * EXT4_SB(struct super_block *sb)
656{
657 return sb->s_fs_info;
658}
659static inline struct ext4_inode_info *EXT4_I(struct inode *inode)
660{
661 return container_of(inode, struct ext4_inode_info, vfs_inode);
662}
663
664static inline struct timespec ext4_current_time(struct inode *inode)
665{
666 return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
667 current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
668}
669
670
671static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
672{
673 return ino == EXT4_ROOT_INO ||
674 ino == EXT4_JOURNAL_INO ||
675 ino == EXT4_RESIZE_INO ||
676 (ino >= EXT4_FIRST_INO(sb) &&
677 ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count));
678}
679#else
680/* Assume that user mode programs are passing in an ext4fs superblock, not
681 * a kernel struct super_block. This will allow us to call the feature-test
682 * macros from user land. */
683#define EXT4_SB(sb) (sb)
684#endif
685
686#define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
687
688/*
689 * Codes for operating systems
690 */
691#define EXT4_OS_LINUX 0
692#define EXT4_OS_HURD 1
693#define EXT4_OS_MASIX 2
694#define EXT4_OS_FREEBSD 3
695#define EXT4_OS_LITES 4
696
697/*
698 * Revision levels
699 */
700#define EXT4_GOOD_OLD_REV 0 /* The good old (original) format */
701#define EXT4_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
702
703#define EXT4_CURRENT_REV EXT4_GOOD_OLD_REV
704#define EXT4_MAX_SUPP_REV EXT4_DYNAMIC_REV
705
706#define EXT4_GOOD_OLD_INODE_SIZE 128
707
708/*
709 * Feature set definitions
710 */
711
712#define EXT4_HAS_COMPAT_FEATURE(sb,mask) \
713 ( EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
714#define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \
715 ( EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
716#define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \
717 ( EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
718#define EXT4_SET_COMPAT_FEATURE(sb,mask) \
719 EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
720#define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \
721 EXT4_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
722#define EXT4_SET_INCOMPAT_FEATURE(sb,mask) \
723 EXT4_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
724#define EXT4_CLEAR_COMPAT_FEATURE(sb,mask) \
725 EXT4_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
726#define EXT4_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
727 EXT4_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
728#define EXT4_CLEAR_INCOMPAT_FEATURE(sb,mask) \
729 EXT4_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
730
731#define EXT4_FEATURE_COMPAT_DIR_PREALLOC 0x0001
732#define EXT4_FEATURE_COMPAT_IMAGIC_INODES 0x0002
733#define EXT4_FEATURE_COMPAT_HAS_JOURNAL 0x0004
734#define EXT4_FEATURE_COMPAT_EXT_ATTR 0x0008
735#define EXT4_FEATURE_COMPAT_RESIZE_INODE 0x0010
736#define EXT4_FEATURE_COMPAT_DIR_INDEX 0x0020
737
738#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
739#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
740#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
741#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
742#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
743#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
744#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
745
746#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001
747#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002
748#define EXT4_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
749#define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
750#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010
751#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
752#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
753#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
754#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
755
756#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
757#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \
758 EXT4_FEATURE_INCOMPAT_RECOVER| \
759 EXT4_FEATURE_INCOMPAT_META_BG| \
760 EXT4_FEATURE_INCOMPAT_EXTENTS| \
761 EXT4_FEATURE_INCOMPAT_64BIT| \
762 EXT4_FEATURE_INCOMPAT_FLEX_BG)
763#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
764 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
765 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
766 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
767 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
768 EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\
769 EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
770
771/*
772 * Default values for user and/or group using reserved blocks
773 */
774#define EXT4_DEF_RESUID 0
775#define EXT4_DEF_RESGID 0
776
777/*
778 * Default mount options
779 */
780#define EXT4_DEFM_DEBUG 0x0001
781#define EXT4_DEFM_BSDGROUPS 0x0002
782#define EXT4_DEFM_XATTR_USER 0x0004
783#define EXT4_DEFM_ACL 0x0008
784#define EXT4_DEFM_UID16 0x0010
785#define EXT4_DEFM_JMODE 0x0060
786#define EXT4_DEFM_JMODE_DATA 0x0020
787#define EXT4_DEFM_JMODE_ORDERED 0x0040
788#define EXT4_DEFM_JMODE_WBACK 0x0060
789
790/*
791 * Structure of a directory entry
792 */
793#define EXT4_NAME_LEN 255
794
795struct ext4_dir_entry {
796 __le32 inode; /* Inode number */
797 __le16 rec_len; /* Directory entry length */
798 __le16 name_len; /* Name length */
799 char name[EXT4_NAME_LEN]; /* File name */
800};
801
802/*
803 * The new version of the directory entry. Since EXT4 structures are
804 * stored in intel byte order, and the name_len field could never be
805 * bigger than 255 chars, it's safe to reclaim the extra byte for the
806 * file_type field.
807 */
808struct ext4_dir_entry_2 {
809 __le32 inode; /* Inode number */
810 __le16 rec_len; /* Directory entry length */
811 __u8 name_len; /* Name length */
812 __u8 file_type;
813 char name[EXT4_NAME_LEN]; /* File name */
814};
815
816/*
817 * Ext4 directory file types. Only the low 3 bits are used. The
818 * other bits are reserved for now.
819 */
820#define EXT4_FT_UNKNOWN 0
821#define EXT4_FT_REG_FILE 1
822#define EXT4_FT_DIR 2
823#define EXT4_FT_CHRDEV 3
824#define EXT4_FT_BLKDEV 4
825#define EXT4_FT_FIFO 5
826#define EXT4_FT_SOCK 6
827#define EXT4_FT_SYMLINK 7
828
829#define EXT4_FT_MAX 8
830
831/*
832 * EXT4_DIR_PAD defines the directory entries boundaries
833 *
834 * NOTE: It must be a multiple of 4
835 */
836#define EXT4_DIR_PAD 4
837#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1)
838#define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \
839 ~EXT4_DIR_ROUND)
840#define EXT4_MAX_REC_LEN ((1<<16)-1)
841
842static inline unsigned ext4_rec_len_from_disk(__le16 dlen)
843{
844 unsigned len = le16_to_cpu(dlen);
845
846 if (len == EXT4_MAX_REC_LEN)
847 return 1 << 16;
848 return len;
849}
850
851static inline __le16 ext4_rec_len_to_disk(unsigned len)
852{
853 if (len == (1 << 16))
854 return cpu_to_le16(EXT4_MAX_REC_LEN);
855 else if (len > (1 << 16))
856 BUG();
857 return cpu_to_le16(len);
858}
859
860/*
861 * Hash Tree Directory indexing
862 * (c) Daniel Phillips, 2001
863 */
864
865#define is_dx(dir) (EXT4_HAS_COMPAT_FEATURE(dir->i_sb, \
866 EXT4_FEATURE_COMPAT_DIR_INDEX) && \
867 (EXT4_I(dir)->i_flags & EXT4_INDEX_FL))
868#define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX)
869#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
870
871/* Legal values for the dx_root hash_version field: */
872
873#define DX_HASH_LEGACY 0
874#define DX_HASH_HALF_MD4 1
875#define DX_HASH_TEA 2
876
877#ifdef __KERNEL__
878
879/* hash info structure used by the directory hash */
880struct dx_hash_info
881{
882 u32 hash;
883 u32 minor_hash;
884 int hash_version;
885 u32 *seed;
886};
887
888#define EXT4_HTREE_EOF 0x7fffffff
889
890/*
891 * Control parameters used by ext4_htree_next_block
892 */
893#define HASH_NB_ALWAYS 1
894
895
896/*
897 * Describe an inode's exact location on disk and in memory
898 */
899struct ext4_iloc
900{
901 struct buffer_head *bh;
902 unsigned long offset;
903 ext4_group_t block_group;
904};
905
906static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc)
907{
908 return (struct ext4_inode *) (iloc->bh->b_data + iloc->offset);
909}
910
911/*
912 * This structure is stuffed into the struct file's private_data field
913 * for directories. It is where we put information so that we can do
914 * readdir operations in hash tree order.
915 */
916struct dir_private_info {
917 struct rb_root root;
918 struct rb_node *curr_node;
919 struct fname *extra_fname;
920 loff_t last_pos;
921 __u32 curr_hash;
922 __u32 curr_minor_hash;
923 __u32 next_hash;
924};
925
926/* calculate the first block number of the group */
927static inline ext4_fsblk_t
928ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no)
929{
930 return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) +
931 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
932}
933
934/*
935 * Special error return code only used by dx_probe() and its callers.
936 */
937#define ERR_BAD_DX_DIR -75000
938
939void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
940 unsigned long *blockgrpp, ext4_grpblk_t *offsetp);
941
942/*
943 * Function prototypes
944 */
945
946/*
947 * Ok, these declarations are also in <linux/kernel.h> but none of the
948 * ext4 source programs needs to include it so they are duplicated here.
949 */
950# define NORET_TYPE /**/
951# define ATTRIB_NORET __attribute__((noreturn))
952# define NORET_AND noreturn,
953
954/* balloc.c */
955extern unsigned int ext4_block_group(struct super_block *sb,
956 ext4_fsblk_t blocknr);
957extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb,
958 ext4_fsblk_t blocknr);
959extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group);
960extern unsigned long ext4_bg_num_gdb(struct super_block *sb,
961 ext4_group_t group);
962extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode,
963 ext4_fsblk_t goal, int *errp);
964extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode,
965 ext4_fsblk_t goal, unsigned long *count, int *errp);
966extern ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode,
967 ext4_fsblk_t goal, unsigned long *count, int *errp);
968extern void ext4_free_blocks (handle_t *handle, struct inode *inode,
969 ext4_fsblk_t block, unsigned long count, int metadata);
970extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb,
971 ext4_fsblk_t block, unsigned long count,
972 unsigned long *pdquot_freed_blocks);
973extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *);
974extern void ext4_check_blocks_bitmap (struct super_block *);
975extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
976 ext4_group_t block_group,
977 struct buffer_head ** bh);
978extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
979extern void ext4_init_block_alloc_info(struct inode *);
980extern void ext4_rsv_window_add(struct super_block *sb, struct ext4_reserve_window_node *rsv);
981
982/* dir.c */
983extern int ext4_check_dir_entry(const char *, struct inode *,
984 struct ext4_dir_entry_2 *,
985 struct buffer_head *, unsigned long);
986extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash,
987 __u32 minor_hash,
988 struct ext4_dir_entry_2 *dirent);
989extern void ext4_htree_free_dir_info(struct dir_private_info *p);
990
991/* fsync.c */
992extern int ext4_sync_file (struct file *, struct dentry *, int);
993
994/* hash.c */
995extern int ext4fs_dirhash(const char *name, int len, struct
996 dx_hash_info *hinfo);
997
998/* ialloc.c */
999extern struct inode * ext4_new_inode (handle_t *, struct inode *, int);
1000extern void ext4_free_inode (handle_t *, struct inode *);
1001extern struct inode * ext4_orphan_get (struct super_block *, unsigned long);
1002extern unsigned long ext4_count_free_inodes (struct super_block *);
1003extern unsigned long ext4_count_dirs (struct super_block *);
1004extern void ext4_check_inodes_bitmap (struct super_block *);
1005extern unsigned long ext4_count_free (struct buffer_head *, unsigned);
1006
1007/* mballoc.c */
1008extern long ext4_mb_stats;
1009extern long ext4_mb_max_to_scan;
1010extern int ext4_mb_init(struct super_block *, int);
1011extern int ext4_mb_release(struct super_block *);
1012extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
1013 struct ext4_allocation_request *, int *);
1014extern int ext4_mb_reserve_blocks(struct super_block *, int);
1015extern void ext4_mb_discard_inode_preallocations(struct inode *);
1016extern int __init init_ext4_mballoc(void);
1017extern void exit_ext4_mballoc(void);
1018extern void ext4_mb_free_blocks(handle_t *, struct inode *,
1019 unsigned long, unsigned long, int, unsigned long *);
1020
1021
1022/* inode.c */
1023int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
1024 struct buffer_head *bh, ext4_fsblk_t blocknr);
1025struct buffer_head *ext4_getblk(handle_t *, struct inode *,
1026 ext4_lblk_t, int, int *);
1027struct buffer_head *ext4_bread(handle_t *, struct inode *,
1028 ext4_lblk_t, int, int *);
1029int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
1030 ext4_lblk_t iblock, unsigned long maxblocks,
1031 struct buffer_head *bh_result,
1032 int create, int extend_disksize);
1033
1034extern struct inode *ext4_iget(struct super_block *, unsigned long);
1035extern int ext4_write_inode (struct inode *, int);
1036extern int ext4_setattr (struct dentry *, struct iattr *);
1037extern void ext4_delete_inode (struct inode *);
1038extern int ext4_sync_inode (handle_t *, struct inode *);
1039extern void ext4_discard_reservation (struct inode *);
1040extern void ext4_dirty_inode(struct inode *);
1041extern int ext4_change_inode_journal_flag(struct inode *, int);
1042extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
1043extern void ext4_truncate (struct inode *);
1044extern void ext4_set_inode_flags(struct inode *);
1045extern void ext4_get_inode_flags(struct ext4_inode_info *);
1046extern void ext4_set_aops(struct inode *inode);
1047extern int ext4_writepage_trans_blocks(struct inode *);
1048extern int ext4_block_truncate_page(handle_t *handle, struct page *page,
1049 struct address_space *mapping, loff_t from);
1050
1051/* ioctl.c */
1052extern int ext4_ioctl (struct inode *, struct file *, unsigned int,
1053 unsigned long);
1054extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long);
1055
1056/* migrate.c */
1057extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int,
1058 unsigned long);
1059/* namei.c */
1060extern int ext4_orphan_add(handle_t *, struct inode *);
1061extern int ext4_orphan_del(handle_t *, struct inode *);
1062extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
1063 __u32 start_minor_hash, __u32 *next_hash);
1064
1065/* resize.c */
1066extern int ext4_group_add(struct super_block *sb,
1067 struct ext4_new_group_data *input);
1068extern int ext4_group_extend(struct super_block *sb,
1069 struct ext4_super_block *es,
1070 ext4_fsblk_t n_blocks_count);
1071
1072/* super.c */
1073extern void ext4_error (struct super_block *, const char *, const char *, ...)
1074 __attribute__ ((format (printf, 3, 4)));
1075extern void __ext4_std_error (struct super_block *, const char *, int);
1076extern void ext4_abort (struct super_block *, const char *, const char *, ...)
1077 __attribute__ ((format (printf, 3, 4)));
1078extern void ext4_warning (struct super_block *, const char *, const char *, ...)
1079 __attribute__ ((format (printf, 3, 4)));
1080extern void ext4_update_dynamic_rev (struct super_block *sb);
1081extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb,
1082 __u32 compat);
1083extern int ext4_update_rocompat_feature(handle_t *handle,
1084 struct super_block *sb, __u32 rocompat);
1085extern int ext4_update_incompat_feature(handle_t *handle,
1086 struct super_block *sb, __u32 incompat);
1087extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
1088 struct ext4_group_desc *bg);
1089extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,
1090 struct ext4_group_desc *bg);
1091extern ext4_fsblk_t ext4_inode_table(struct super_block *sb,
1092 struct ext4_group_desc *bg);
1093extern void ext4_block_bitmap_set(struct super_block *sb,
1094 struct ext4_group_desc *bg, ext4_fsblk_t blk);
1095extern void ext4_inode_bitmap_set(struct super_block *sb,
1096 struct ext4_group_desc *bg, ext4_fsblk_t blk);
1097extern void ext4_inode_table_set(struct super_block *sb,
1098 struct ext4_group_desc *bg, ext4_fsblk_t blk);
1099
1100static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es)
1101{
1102 return ((ext4_fsblk_t)le32_to_cpu(es->s_blocks_count_hi) << 32) |
1103 le32_to_cpu(es->s_blocks_count_lo);
1104}
1105
1106static inline ext4_fsblk_t ext4_r_blocks_count(struct ext4_super_block *es)
1107{
1108 return ((ext4_fsblk_t)le32_to_cpu(es->s_r_blocks_count_hi) << 32) |
1109 le32_to_cpu(es->s_r_blocks_count_lo);
1110}
1111
1112static inline ext4_fsblk_t ext4_free_blocks_count(struct ext4_super_block *es)
1113{
1114 return ((ext4_fsblk_t)le32_to_cpu(es->s_free_blocks_count_hi) << 32) |
1115 le32_to_cpu(es->s_free_blocks_count_lo);
1116}
1117
1118static inline void ext4_blocks_count_set(struct ext4_super_block *es,
1119 ext4_fsblk_t blk)
1120{
1121 es->s_blocks_count_lo = cpu_to_le32((u32)blk);
1122 es->s_blocks_count_hi = cpu_to_le32(blk >> 32);
1123}
1124
1125static inline void ext4_free_blocks_count_set(struct ext4_super_block *es,
1126 ext4_fsblk_t blk)
1127{
1128 es->s_free_blocks_count_lo = cpu_to_le32((u32)blk);
1129 es->s_free_blocks_count_hi = cpu_to_le32(blk >> 32);
1130}
1131
1132static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
1133 ext4_fsblk_t blk)
1134{
1135 es->s_r_blocks_count_lo = cpu_to_le32((u32)blk);
1136 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
1137}
1138
1139static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
1140{
1141 return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
1142 le32_to_cpu(raw_inode->i_size_lo);
1143}
1144
1145static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
1146{
1147 raw_inode->i_size_lo = cpu_to_le32(i_size);
1148 raw_inode->i_size_high = cpu_to_le32(i_size >> 32);
1149}
1150
1151static inline
1152struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
1153 ext4_group_t group)
1154{
1155 struct ext4_group_info ***grp_info;
1156 long indexv, indexh;
1157 grp_info = EXT4_SB(sb)->s_group_info;
1158 indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
1159 indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
1160 return grp_info[indexv][indexh];
1161}
1162
1163
1164#define ext4_std_error(sb, errno) \
1165do { \
1166 if ((errno)) \
1167 __ext4_std_error((sb), __FUNCTION__, (errno)); \
1168} while (0)
1169
1170/*
1171 * Inodes and files operations
1172 */
1173
1174/* dir.c */
1175extern const struct file_operations ext4_dir_operations;
1176
1177/* file.c */
1178extern const struct inode_operations ext4_file_inode_operations;
1179extern const struct file_operations ext4_file_operations;
1180
1181/* namei.c */
1182extern const struct inode_operations ext4_dir_inode_operations;
1183extern const struct inode_operations ext4_special_inode_operations;
1184
1185/* symlink.c */
1186extern const struct inode_operations ext4_symlink_inode_operations;
1187extern const struct inode_operations ext4_fast_symlink_inode_operations;
1188
1189/* extents.c */
1190extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
1191extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
1192extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
1193 ext4_lblk_t iblock,
1194 unsigned long max_blocks, struct buffer_head *bh_result,
1195 int create, int extend_disksize);
1196extern void ext4_ext_truncate(struct inode *, struct page *);
1197extern void ext4_ext_init(struct super_block *);
1198extern void ext4_ext_release(struct super_block *);
1199extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset,
1200 loff_t len);
1201extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode,
1202 sector_t block, unsigned long max_blocks,
1203 struct buffer_head *bh, int create,
1204 int extend_disksize);
1205#endif /* __KERNEL__ */
1206
1207#endif /* _LINUX_EXT4_FS_H */
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
deleted file mode 100644
index 1285c583b2d8..000000000000
--- a/include/linux/ext4_fs_extents.h
+++ /dev/null
@@ -1,232 +0,0 @@
1/*
2 * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com
3 * Written by Alex Tomas <alex@clusterfs.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public Licens
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-
17 */
18
19#ifndef _LINUX_EXT4_EXTENTS
20#define _LINUX_EXT4_EXTENTS
21
22#include <linux/ext4_fs.h>
23
24/*
25 * With AGGRESSIVE_TEST defined, the capacity of index/leaf blocks
26 * becomes very small, so index split, in-depth growing and
27 * other hard changes happen much more often.
28 * This is for debug purposes only.
29 */
30#define AGGRESSIVE_TEST_
31
32/*
33 * With EXTENTS_STATS defined, the number of blocks and extents
34 * are collected in the truncate path. They'll be shown at
35 * umount time.
36 */
37#define EXTENTS_STATS__
38
39/*
40 * If CHECK_BINSEARCH is defined, then the results of the binary search
41 * will also be checked by linear search.
42 */
43#define CHECK_BINSEARCH__
44
45/*
46 * If EXT_DEBUG is defined you can use the 'extdebug' mount option
47 * to get lots of info about what's going on.
48 */
49#define EXT_DEBUG__
50#ifdef EXT_DEBUG
51#define ext_debug(a...) printk(a)
52#else
53#define ext_debug(a...)
54#endif
55
56/*
57 * If EXT_STATS is defined then stats numbers are collected.
58 * These number will be displayed at umount time.
59 */
60#define EXT_STATS_
61
62
63/*
64 * ext4_inode has i_block array (60 bytes total).
65 * The first 12 bytes store ext4_extent_header;
66 * the remainder stores an array of ext4_extent.
67 */
68
69/*
70 * This is the extent on-disk structure.
71 * It's used at the bottom of the tree.
72 */
73struct ext4_extent {
74 __le32 ee_block; /* first logical block extent covers */
75 __le16 ee_len; /* number of blocks covered by extent */
76 __le16 ee_start_hi; /* high 16 bits of physical block */
77 __le32 ee_start_lo; /* low 32 bits of physical block */
78};
79
80/*
81 * This is index on-disk structure.
82 * It's used at all the levels except the bottom.
83 */
84struct ext4_extent_idx {
85 __le32 ei_block; /* index covers logical blocks from 'block' */
86 __le32 ei_leaf_lo; /* pointer to the physical block of the next *
87 * level. leaf or next index could be there */
88 __le16 ei_leaf_hi; /* high 16 bits of physical block */
89 __u16 ei_unused;
90};
91
92/*
93 * Each block (leaves and indexes), even inode-stored has header.
94 */
95struct ext4_extent_header {
96 __le16 eh_magic; /* probably will support different formats */
97 __le16 eh_entries; /* number of valid entries */
98 __le16 eh_max; /* capacity of store in entries */
99 __le16 eh_depth; /* has tree real underlying blocks? */
100 __le32 eh_generation; /* generation of the tree */
101};
102
103#define EXT4_EXT_MAGIC cpu_to_le16(0xf30a)
104
105/*
106 * Array of ext4_ext_path contains path to some extent.
107 * Creation/lookup routines use it for traversal/splitting/etc.
108 * Truncate uses it to simulate recursive walking.
109 */
110struct ext4_ext_path {
111 ext4_fsblk_t p_block;
112 __u16 p_depth;
113 struct ext4_extent *p_ext;
114 struct ext4_extent_idx *p_idx;
115 struct ext4_extent_header *p_hdr;
116 struct buffer_head *p_bh;
117};
118
119/*
120 * structure for external API
121 */
122
123#define EXT4_EXT_CACHE_NO 0
124#define EXT4_EXT_CACHE_GAP 1
125#define EXT4_EXT_CACHE_EXTENT 2
126
127
128#define EXT_MAX_BLOCK 0xffffffff
129
130/*
131 * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
132 * initialized extent. This is 2^15 and not (2^16 - 1), since we use the
133 * MSB of ee_len field in the extent datastructure to signify if this
134 * particular extent is an initialized extent or an uninitialized (i.e.
135 * preallocated).
136 * EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an
137 * uninitialized extent.
138 * If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an
139 * uninitialized one. In other words, if MSB of ee_len is set, it is an
140 * uninitialized extent with only one special scenario when ee_len = 0x8000.
141 * In this case we can not have an uninitialized extent of zero length and
142 * thus we make it as a special case of initialized extent with 0x8000 length.
143 * This way we get better extent-to-group alignment for initialized extents.
144 * Hence, the maximum number of blocks we can have in an *initialized*
145 * extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767).
146 */
147#define EXT_INIT_MAX_LEN (1UL << 15)
148#define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1)
149
150
151#define EXT_FIRST_EXTENT(__hdr__) \
152 ((struct ext4_extent *) (((char *) (__hdr__)) + \
153 sizeof(struct ext4_extent_header)))
154#define EXT_FIRST_INDEX(__hdr__) \
155 ((struct ext4_extent_idx *) (((char *) (__hdr__)) + \
156 sizeof(struct ext4_extent_header)))
157#define EXT_HAS_FREE_INDEX(__path__) \
158 (le16_to_cpu((__path__)->p_hdr->eh_entries) \
159 < le16_to_cpu((__path__)->p_hdr->eh_max))
160#define EXT_LAST_EXTENT(__hdr__) \
161 (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1)
162#define EXT_LAST_INDEX(__hdr__) \
163 (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1)
164#define EXT_MAX_EXTENT(__hdr__) \
165 (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)
166#define EXT_MAX_INDEX(__hdr__) \
167 (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)
168
169static inline struct ext4_extent_header *ext_inode_hdr(struct inode *inode)
170{
171 return (struct ext4_extent_header *) EXT4_I(inode)->i_data;
172}
173
174static inline struct ext4_extent_header *ext_block_hdr(struct buffer_head *bh)
175{
176 return (struct ext4_extent_header *) bh->b_data;
177}
178
179static inline unsigned short ext_depth(struct inode *inode)
180{
181 return le16_to_cpu(ext_inode_hdr(inode)->eh_depth);
182}
183
184static inline void ext4_ext_tree_changed(struct inode *inode)
185{
186 EXT4_I(inode)->i_ext_generation++;
187}
188
189static inline void
190ext4_ext_invalidate_cache(struct inode *inode)
191{
192 EXT4_I(inode)->i_cached_extent.ec_type = EXT4_EXT_CACHE_NO;
193}
194
195static inline void ext4_ext_mark_uninitialized(struct ext4_extent *ext)
196{
197 /* We can not have an uninitialized extent of zero length! */
198 BUG_ON((le16_to_cpu(ext->ee_len) & ~EXT_INIT_MAX_LEN) == 0);
199 ext->ee_len |= cpu_to_le16(EXT_INIT_MAX_LEN);
200}
201
202static inline int ext4_ext_is_uninitialized(struct ext4_extent *ext)
203{
204 /* Extent with ee_len of 0x8000 is treated as an initialized extent */
205 return (le16_to_cpu(ext->ee_len) > EXT_INIT_MAX_LEN);
206}
207
208static inline int ext4_ext_get_actual_len(struct ext4_extent *ext)
209{
210 return (le16_to_cpu(ext->ee_len) <= EXT_INIT_MAX_LEN ?
211 le16_to_cpu(ext->ee_len) :
212 (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
213}
214
215extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
216extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
217extern int ext4_extent_tree_init(handle_t *, struct inode *);
218extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *);
219extern int ext4_ext_try_to_merge(struct inode *inode,
220 struct ext4_ext_path *path,
221 struct ext4_extent *);
222extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
223extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
224extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t,
225 struct ext4_ext_path *);
226extern int ext4_ext_search_left(struct inode *, struct ext4_ext_path *,
227 ext4_lblk_t *, ext4_fsblk_t *);
228extern int ext4_ext_search_right(struct inode *, struct ext4_ext_path *,
229 ext4_lblk_t *, ext4_fsblk_t *);
230extern void ext4_ext_drop_refs(struct ext4_ext_path *);
231#endif /* _LINUX_EXT4_EXTENTS */
232
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h
deleted file mode 100644
index d5508d3cf290..000000000000
--- a/include/linux/ext4_fs_i.h
+++ /dev/null
@@ -1,167 +0,0 @@
1/*
2 * linux/include/linux/ext4_fs_i.h
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *
9 * from
10 *
11 * linux/include/linux/minix_fs_i.h
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 */
15
16#ifndef _LINUX_EXT4_FS_I
17#define _LINUX_EXT4_FS_I
18
19#include <linux/rwsem.h>
20#include <linux/rbtree.h>
21#include <linux/seqlock.h>
22#include <linux/mutex.h>
23
24/* data type for block offset of block group */
25typedef int ext4_grpblk_t;
26
27/* data type for filesystem-wide blocks number */
28typedef unsigned long long ext4_fsblk_t;
29
30/* data type for file logical block number */
31typedef __u32 ext4_lblk_t;
32
33/* data type for block group number */
34typedef unsigned long ext4_group_t;
35
36struct ext4_reserve_window {
37 ext4_fsblk_t _rsv_start; /* First byte reserved */
38 ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */
39};
40
41struct ext4_reserve_window_node {
42 struct rb_node rsv_node;
43 __u32 rsv_goal_size;
44 __u32 rsv_alloc_hit;
45 struct ext4_reserve_window rsv_window;
46};
47
48struct ext4_block_alloc_info {
49 /* information about reservation window */
50 struct ext4_reserve_window_node rsv_window_node;
51 /*
52 * was i_next_alloc_block in ext4_inode_info
53 * is the logical (file-relative) number of the
54 * most-recently-allocated block in this file.
55 * We use this for detecting linearly ascending allocation requests.
56 */
57 ext4_lblk_t last_alloc_logical_block;
58 /*
59 * Was i_next_alloc_goal in ext4_inode_info
60 * is the *physical* companion to i_next_alloc_block.
61 * it the physical block number of the block which was most-recentl
62 * allocated to this file. This give us the goal (target) for the next
63 * allocation when we detect linearly ascending requests.
64 */
65 ext4_fsblk_t last_alloc_physical_block;
66};
67
68#define rsv_start rsv_window._rsv_start
69#define rsv_end rsv_window._rsv_end
70
71/*
72 * storage for cached extent
73 */
74struct ext4_ext_cache {
75 ext4_fsblk_t ec_start;
76 ext4_lblk_t ec_block;
77 __u32 ec_len; /* must be 32bit to return holes */
78 __u32 ec_type;
79};
80
81/*
82 * third extended file system inode data in memory
83 */
84struct ext4_inode_info {
85 __le32 i_data[15]; /* unconverted */
86 __u32 i_flags;
87 ext4_fsblk_t i_file_acl;
88 __u32 i_dtime;
89
90 /*
91 * i_block_group is the number of the block group which contains
92 * this file's inode. Constant across the lifetime of the inode,
93 * it is ued for making block allocation decisions - we try to
94 * place a file's data blocks near its inode block, and new inodes
95 * near to their parent directory's inode.
96 */
97 ext4_group_t i_block_group;
98 __u32 i_state; /* Dynamic state flags for ext4 */
99
100 /* block reservation info */
101 struct ext4_block_alloc_info *i_block_alloc_info;
102
103 ext4_lblk_t i_dir_start_lookup;
104#ifdef CONFIG_EXT4DEV_FS_XATTR
105 /*
106 * Extended attributes can be read independently of the main file
107 * data. Taking i_mutex even when reading would cause contention
108 * between readers of EAs and writers of regular file data, so
109 * instead we synchronize on xattr_sem when reading or changing
110 * EAs.
111 */
112 struct rw_semaphore xattr_sem;
113#endif
114#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL
115 struct posix_acl *i_acl;
116 struct posix_acl *i_default_acl;
117#endif
118
119 struct list_head i_orphan; /* unlinked but open inodes */
120
121 /*
122 * i_disksize keeps track of what the inode size is ON DISK, not
123 * in memory. During truncate, i_size is set to the new size by
124 * the VFS prior to calling ext4_truncate(), but the filesystem won't
125 * set i_disksize to 0 until the truncate is actually under way.
126 *
127 * The intent is that i_disksize always represents the blocks which
128 * are used by this file. This allows recovery to restart truncate
129 * on orphans if we crash during truncate. We actually write i_disksize
130 * into the on-disk inode when writing inodes out, instead of i_size.
131 *
132 * The only time when i_disksize and i_size may be different is when
133 * a truncate is in progress. The only things which change i_disksize
134 * are ext4_get_block (growth) and ext4_truncate (shrinkth).
135 */
136 loff_t i_disksize;
137
138 /* on-disk additional length */
139 __u16 i_extra_isize;
140
141 /*
142 * i_data_sem is for serialising ext4_truncate() against
143 * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's
144 * data tree are chopped off during truncate. We can't do that in
145 * ext4 because whenever we perform intermediate commits during
146 * truncate, the inode and all the metadata blocks *must* be in a
147 * consistent state which allows truncation of the orphans to restart
148 * during recovery. Hence we must fix the get_block-vs-truncate race
149 * by other means, so we have i_data_sem.
150 */
151 struct rw_semaphore i_data_sem;
152 struct inode vfs_inode;
153
154 unsigned long i_ext_generation;
155 struct ext4_ext_cache i_cached_extent;
156 /*
157 * File creation time. Its function is same as that of
158 * struct timespec i_{a,c,m}time in the generic inode.
159 */
160 struct timespec i_crtime;
161
162 /* mballoc */
163 struct list_head i_prealloc_list;
164 spinlock_t i_prealloc_lock;
165};
166
167#endif /* _LINUX_EXT4_FS_I */
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h
deleted file mode 100644
index abaae2c8cccf..000000000000
--- a/include/linux/ext4_fs_sb.h
+++ /dev/null
@@ -1,148 +0,0 @@
1/*
2 * linux/include/linux/ext4_fs_sb.h
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *
9 * from
10 *
11 * linux/include/linux/minix_fs_sb.h
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 */
15
16#ifndef _LINUX_EXT4_FS_SB
17#define _LINUX_EXT4_FS_SB
18
19#ifdef __KERNEL__
20#include <linux/timer.h>
21#include <linux/wait.h>
22#include <linux/blockgroup_lock.h>
23#include <linux/percpu_counter.h>
24#endif
25#include <linux/rbtree.h>
26
27/*
28 * third extended-fs super-block data in memory
29 */
30struct ext4_sb_info {
31 unsigned long s_desc_size; /* Size of a group descriptor in bytes */
32 unsigned long s_inodes_per_block;/* Number of inodes per block */
33 unsigned long s_blocks_per_group;/* Number of blocks in a group */
34 unsigned long s_inodes_per_group;/* Number of inodes in a group */
35 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
36 unsigned long s_gdb_count; /* Number of group descriptor blocks */
37 unsigned long s_desc_per_block; /* Number of group descriptors per block */
38 ext4_group_t s_groups_count; /* Number of groups in the fs */
39 unsigned long s_overhead_last; /* Last calculated overhead */
40 unsigned long s_blocks_last; /* Last seen block count */
41 loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
42 struct buffer_head * s_sbh; /* Buffer containing the super block */
43 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */
44 struct buffer_head ** s_group_desc;
45 unsigned long s_mount_opt;
46 ext4_fsblk_t s_sb_block;
47 uid_t s_resuid;
48 gid_t s_resgid;
49 unsigned short s_mount_state;
50 unsigned short s_pad;
51 int s_addr_per_block_bits;
52 int s_desc_per_block_bits;
53 int s_inode_size;
54 int s_first_ino;
55 spinlock_t s_next_gen_lock;
56 u32 s_next_generation;
57 u32 s_hash_seed[4];
58 int s_def_hash_version;
59 struct percpu_counter s_freeblocks_counter;
60 struct percpu_counter s_freeinodes_counter;
61 struct percpu_counter s_dirs_counter;
62 struct blockgroup_lock s_blockgroup_lock;
63
64 /* root of the per fs reservation window tree */
65 spinlock_t s_rsv_window_lock;
66 struct rb_root s_rsv_window_root;
67 struct ext4_reserve_window_node s_rsv_window_head;
68
69 /* Journaling */
70 struct inode * s_journal_inode;
71 struct journal_s * s_journal;
72 struct list_head s_orphan;
73 unsigned long s_commit_interval;
74 struct block_device *journal_bdev;
75#ifdef CONFIG_JBD2_DEBUG
76 struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
77 wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
78#endif
79#ifdef CONFIG_QUOTA
80 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
81 int s_jquota_fmt; /* Format of quota to use */
82#endif
83 unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
84
85#ifdef EXTENTS_STATS
86 /* ext4 extents stats */
87 unsigned long s_ext_min;
88 unsigned long s_ext_max;
89 unsigned long s_depth_max;
90 spinlock_t s_ext_stats_lock;
91 unsigned long s_ext_blocks;
92 unsigned long s_ext_extents;
93#endif
94
95 /* for buddy allocator */
96 struct ext4_group_info ***s_group_info;
97 struct inode *s_buddy_cache;
98 long s_blocks_reserved;
99 spinlock_t s_reserve_lock;
100 struct list_head s_active_transaction;
101 struct list_head s_closed_transaction;
102 struct list_head s_committed_transaction;
103 spinlock_t s_md_lock;
104 tid_t s_last_transaction;
105 unsigned short *s_mb_offsets, *s_mb_maxs;
106
107 /* tunables */
108 unsigned long s_stripe;
109 unsigned long s_mb_stream_request;
110 unsigned long s_mb_max_to_scan;
111 unsigned long s_mb_min_to_scan;
112 unsigned long s_mb_stats;
113 unsigned long s_mb_order2_reqs;
114 unsigned long s_mb_group_prealloc;
115 /* where last allocation was done - for stream allocation */
116 unsigned long s_mb_last_group;
117 unsigned long s_mb_last_start;
118
119 /* history to debug policy */
120 struct ext4_mb_history *s_mb_history;
121 int s_mb_history_cur;
122 int s_mb_history_max;
123 int s_mb_history_num;
124 struct proc_dir_entry *s_mb_proc;
125 spinlock_t s_mb_history_lock;
126 int s_mb_history_filter;
127
128 /* stats for buddy allocator */
129 spinlock_t s_mb_pa_lock;
130 atomic_t s_bal_reqs; /* number of reqs with len > 1 */
131 atomic_t s_bal_success; /* we found long enough chunks */
132 atomic_t s_bal_allocated; /* in blocks */
133 atomic_t s_bal_ex_scanned; /* total extents scanned */
134 atomic_t s_bal_goals; /* goal hits */
135 atomic_t s_bal_breaks; /* too long searches */
136 atomic_t s_bal_2orders; /* 2^order hits */
137 spinlock_t s_bal_lock;
138 unsigned long s_mb_buddies_generated;
139 unsigned long long s_mb_generation_time;
140 atomic_t s_mb_lost_chunks;
141 atomic_t s_mb_preallocated;
142 atomic_t s_mb_discarded;
143
144 /* locality groups */
145 struct ext4_locality_group *s_locality_groups;
146};
147
148#endif /* _LINUX_EXT4_FS_SB */
diff --git a/include/linux/ext4_jbd2.h b/include/linux/ext4_jbd2.h
deleted file mode 100644
index 38c71d3c8dbf..000000000000
--- a/include/linux/ext4_jbd2.h
+++ /dev/null
@@ -1,231 +0,0 @@
1/*
2 * linux/include/linux/ext4_jbd2.h
3 *
4 * Written by Stephen C. Tweedie <sct@redhat.com>, 1999
5 *
6 * Copyright 1998--1999 Red Hat corp --- All Rights Reserved
7 *
8 * This file is part of the Linux kernel and is made available under
9 * the terms of the GNU General Public License, version 2, or at your
10 * option, any later version, incorporated herein by reference.
11 *
12 * Ext4-specific journaling extensions.
13 */
14
15#ifndef _LINUX_EXT4_JBD2_H
16#define _LINUX_EXT4_JBD2_H
17
18#include <linux/fs.h>
19#include <linux/jbd2.h>
20#include <linux/ext4_fs.h>
21
22#define EXT4_JOURNAL(inode) (EXT4_SB((inode)->i_sb)->s_journal)
23
24/* Define the number of blocks we need to account to a transaction to
25 * modify one block of data.
26 *
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
29 * block to complete the transaction.
30 *
31 * For extents-enabled fs we may have to allocate and modify up to
32 * 5 levels of tree + root which are stored in the inode. */
33
34#define EXT4_SINGLEDATA_TRANS_BLOCKS(sb) \
35 (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
36 || test_opt(sb, EXTENTS) ? 27U : 8U)
37
38/* Extended attribute operations touch at most two data buffers,
39 * two bitmap buffers, and two group summaries, in addition to the inode
40 * and the superblock, which are already accounted for. */
41
42#define EXT4_XATTR_TRANS_BLOCKS 6U
43
44/* Define the minimum size for a transaction which modifies data. This
45 * needs to take into account the fact that we may end up modifying two
46 * quota files too (one for the group, one for the user quota). The
47 * superblock only gets updated once, of course, so don't bother
48 * counting that again for the quota updates. */
49
50#define EXT4_DATA_TRANS_BLOCKS(sb) (EXT4_SINGLEDATA_TRANS_BLOCKS(sb) + \
51 EXT4_XATTR_TRANS_BLOCKS - 2 + \
52 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
53
54/* Delete operations potentially hit one directory's namespace plus an
55 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be
56 * generous. We can grow the delete transaction later if necessary. */
57
58#define EXT4_DELETE_TRANS_BLOCKS(sb) (2 * EXT4_DATA_TRANS_BLOCKS(sb) + 64)
59
60/* Define an arbitrary limit for the amount of data we will anticipate
61 * writing to any given transaction. For unbounded transactions such as
62 * write(2) and truncate(2) we can write more than this, but we always
63 * start off at the maximum transaction size and grow the transaction
64 * optimistically as we go. */
65
66#define EXT4_MAX_TRANS_DATA 64U
67
68/* We break up a large truncate or write transaction once the handle's
69 * buffer credits gets this low, we need either to extend the
70 * transaction or to start a new one. Reserve enough space here for
71 * inode, bitmap, superblock, group and indirection updates for at least
72 * one block, plus two quota updates. Quota allocations are not
73 * needed. */
74
75#define EXT4_RESERVE_TRANS_BLOCKS 12U
76
77#define EXT4_INDEX_EXTRA_TRANS_BLOCKS 8
78
79#ifdef CONFIG_QUOTA
80/* Amount of blocks needed for quota update - we know that the structure was
81 * allocated so we need to update only inode+data */
82#define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0)
83/* Amount of blocks needed for quota insert/delete - we do some block writes
84 * but inode, sb and group updates are done only once */
85#define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
86 (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_INIT_REWRITE) : 0)
87#define EXT4_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
88 (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_DEL_REWRITE) : 0)
89#else
90#define EXT4_QUOTA_TRANS_BLOCKS(sb) 0
91#define EXT4_QUOTA_INIT_BLOCKS(sb) 0
92#define EXT4_QUOTA_DEL_BLOCKS(sb) 0
93#endif
94
95int
96ext4_mark_iloc_dirty(handle_t *handle,
97 struct inode *inode,
98 struct ext4_iloc *iloc);
99
100/*
101 * On success, We end up with an outstanding reference count against
102 * iloc->bh. This _must_ be cleaned up later.
103 */
104
105int ext4_reserve_inode_write(handle_t *handle, struct inode *inode,
106 struct ext4_iloc *iloc);
107
108int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode);
109
110/*
111 * Wrapper functions with which ext4 calls into JBD. The intent here is
112 * to allow these to be turned into appropriate stubs so ext4 can control
113 * ext2 filesystems, so ext2+ext4 systems only nee one fs. This work hasn't
114 * been done yet.
115 */
116
117static inline void ext4_journal_release_buffer(handle_t *handle,
118 struct buffer_head *bh)
119{
120 jbd2_journal_release_buffer(handle, bh);
121}
122
123void ext4_journal_abort_handle(const char *caller, const char *err_fn,
124 struct buffer_head *bh, handle_t *handle, int err);
125
126int __ext4_journal_get_undo_access(const char *where, handle_t *handle,
127 struct buffer_head *bh);
128
129int __ext4_journal_get_write_access(const char *where, handle_t *handle,
130 struct buffer_head *bh);
131
132int __ext4_journal_forget(const char *where, handle_t *handle,
133 struct buffer_head *bh);
134
135int __ext4_journal_revoke(const char *where, handle_t *handle,
136 ext4_fsblk_t blocknr, struct buffer_head *bh);
137
138int __ext4_journal_get_create_access(const char *where,
139 handle_t *handle, struct buffer_head *bh);
140
141int __ext4_journal_dirty_metadata(const char *where,
142 handle_t *handle, struct buffer_head *bh);
143
144#define ext4_journal_get_undo_access(handle, bh) \
145 __ext4_journal_get_undo_access(__FUNCTION__, (handle), (bh))
146#define ext4_journal_get_write_access(handle, bh) \
147 __ext4_journal_get_write_access(__FUNCTION__, (handle), (bh))
148#define ext4_journal_revoke(handle, blocknr, bh) \
149 __ext4_journal_revoke(__FUNCTION__, (handle), (blocknr), (bh))
150#define ext4_journal_get_create_access(handle, bh) \
151 __ext4_journal_get_create_access(__FUNCTION__, (handle), (bh))
152#define ext4_journal_dirty_metadata(handle, bh) \
153 __ext4_journal_dirty_metadata(__FUNCTION__, (handle), (bh))
154#define ext4_journal_forget(handle, bh) \
155 __ext4_journal_forget(__FUNCTION__, (handle), (bh))
156
157int ext4_journal_dirty_data(handle_t *handle, struct buffer_head *bh);
158
159handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks);
160int __ext4_journal_stop(const char *where, handle_t *handle);
161
162static inline handle_t *ext4_journal_start(struct inode *inode, int nblocks)
163{
164 return ext4_journal_start_sb(inode->i_sb, nblocks);
165}
166
167#define ext4_journal_stop(handle) \
168 __ext4_journal_stop(__FUNCTION__, (handle))
169
170static inline handle_t *ext4_journal_current_handle(void)
171{
172 return journal_current_handle();
173}
174
175static inline int ext4_journal_extend(handle_t *handle, int nblocks)
176{
177 return jbd2_journal_extend(handle, nblocks);
178}
179
180static inline int ext4_journal_restart(handle_t *handle, int nblocks)
181{
182 return jbd2_journal_restart(handle, nblocks);
183}
184
185static inline int ext4_journal_blocks_per_page(struct inode *inode)
186{
187 return jbd2_journal_blocks_per_page(inode);
188}
189
190static inline int ext4_journal_force_commit(journal_t *journal)
191{
192 return jbd2_journal_force_commit(journal);
193}
194
195/* super.c */
196int ext4_force_commit(struct super_block *sb);
197
198static inline int ext4_should_journal_data(struct inode *inode)
199{
200 if (!S_ISREG(inode->i_mode))
201 return 1;
202 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
203 return 1;
204 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
205 return 1;
206 return 0;
207}
208
209static inline int ext4_should_order_data(struct inode *inode)
210{
211 if (!S_ISREG(inode->i_mode))
212 return 0;
213 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
214 return 0;
215 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
216 return 1;
217 return 0;
218}
219
220static inline int ext4_should_writeback_data(struct inode *inode)
221{
222 if (!S_ISREG(inode->i_mode))
223 return 0;
224 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
225 return 0;
226 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
227 return 1;
228 return 0;
229}
230
231#endif /* _LINUX_EXT4_JBD2_H */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 58c57a33e5dd..72295b099228 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -791,6 +791,17 @@ struct fb_tile_ops {
791 */ 791 */
792#define FBINFO_MISC_ALWAYS_SETPAR 0x40000 792#define FBINFO_MISC_ALWAYS_SETPAR 0x40000
793 793
794/*
795 * Host and GPU endianness differ.
796 */
797#define FBINFO_FOREIGN_ENDIAN 0x100000
798/*
799 * Big endian math. This is the same flags as above, but with different
800 * meaning, it is set by the fb subsystem depending FOREIGN_ENDIAN flag
801 * and host endianness. Drivers should not use this flag.
802 */
803#define FBINFO_BE_MATH 0x100000
804
794struct fb_info { 805struct fb_info {
795 int node; 806 int node;
796 int flags; 807 int flags;
@@ -899,15 +910,11 @@ struct fb_info {
899 910
900#endif 911#endif
901 912
902#if defined (__BIG_ENDIAN) 913#define FB_LEFT_POS(p, bpp) (fb_be_math(p) ? (32 - (bpp)) : 0)
903#define FB_LEFT_POS(bpp) (32 - bpp) 914#define FB_SHIFT_HIGH(p, val, bits) (fb_be_math(p) ? (val) >> (bits) : \
904#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits)) 915 (val) << (bits))
905#define FB_SHIFT_LOW(val, bits) ((val) << (bits)) 916#define FB_SHIFT_LOW(p, val, bits) (fb_be_math(p) ? (val) << (bits) : \
906#else 917 (val) >> (bits))
907#define FB_LEFT_POS(bpp) (0)
908#define FB_SHIFT_HIGH(val, bits) ((val) << (bits))
909#define FB_SHIFT_LOW(val, bits) ((val) >> (bits))
910#endif
911 918
912 /* 919 /*
913 * `Generic' versions of the frame buffer device operations 920 * `Generic' versions of the frame buffer device operations
@@ -970,6 +977,25 @@ extern void fb_deferred_io_cleanup(struct fb_info *info);
970extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, 977extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
971 int datasync); 978 int datasync);
972 979
980static inline bool fb_be_math(struct fb_info *info)
981{
982#ifdef CONFIG_FB_FOREIGN_ENDIAN
983#if defined(CONFIG_FB_BOTH_ENDIAN)
984 return info->flags & FBINFO_BE_MATH;
985#elif defined(CONFIG_FB_BIG_ENDIAN)
986 return true;
987#elif defined(CONFIG_FB_LITTLE_ENDIAN)
988 return false;
989#endif /* CONFIG_FB_BOTH_ENDIAN */
990#else
991#ifdef __BIG_ENDIAN
992 return true;
993#else
994 return false;
995#endif /* __BIG_ENDIAN */
996#endif /* CONFIG_FB_FOREIGN_ENDIAN */
997}
998
973/* drivers/video/fbsysfs.c */ 999/* drivers/video/fbsysfs.c */
974extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); 1000extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
975extern void framebuffer_release(struct fb_info *info); 1001extern void framebuffer_release(struct fb_info *info);
diff --git a/include/linux/file.h b/include/linux/file.h
index 7239baac81a9..69baf5a4f0a5 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -61,6 +61,7 @@ extern struct kmem_cache *filp_cachep;
61 61
62extern void __fput(struct file *); 62extern void __fput(struct file *);
63extern void fput(struct file *); 63extern void fput(struct file *);
64extern void drop_file_write_access(struct file *file);
64 65
65struct file_operations; 66struct file_operations;
66struct vfsmount; 67struct vfsmount;
@@ -116,7 +117,8 @@ struct task_struct;
116 117
117struct files_struct *get_files_struct(struct task_struct *); 118struct files_struct *get_files_struct(struct task_struct *);
118void put_files_struct(struct files_struct *fs); 119void put_files_struct(struct files_struct *fs);
119void reset_files_struct(struct task_struct *, struct files_struct *); 120void reset_files_struct(struct files_struct *);
121int unshare_files(struct files_struct **);
120 122
121extern struct kmem_cache *files_cachep; 123extern struct kmem_cache *files_cachep;
122 124
diff --git a/include/linux/filter.h b/include/linux/filter.h
index ddfa0372a3b7..b6ea9aa9e853 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -37,21 +37,6 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */
37 struct sock_filter __user *filter; 37 struct sock_filter __user *filter;
38}; 38};
39 39
40#ifdef __KERNEL__
41struct sk_filter
42{
43 atomic_t refcnt;
44 unsigned int len; /* Number of filter blocks */
45 struct rcu_head rcu;
46 struct sock_filter insns[0];
47};
48
49static inline unsigned int sk_filter_len(struct sk_filter *fp)
50{
51 return fp->len*sizeof(struct sock_filter) + sizeof(*fp);
52}
53#endif
54
55/* 40/*
56 * Instruction classes 41 * Instruction classes
57 */ 42 */
@@ -136,15 +121,31 @@ static inline unsigned int sk_filter_len(struct sk_filter *fp)
136#define SKF_AD_PROTOCOL 0 121#define SKF_AD_PROTOCOL 0
137#define SKF_AD_PKTTYPE 4 122#define SKF_AD_PKTTYPE 4
138#define SKF_AD_IFINDEX 8 123#define SKF_AD_IFINDEX 8
139#define SKF_AD_MAX 12 124#define SKF_AD_NLATTR 12
125#define SKF_AD_MAX 16
140#define SKF_NET_OFF (-0x100000) 126#define SKF_NET_OFF (-0x100000)
141#define SKF_LL_OFF (-0x200000) 127#define SKF_LL_OFF (-0x200000)
142 128
143#ifdef __KERNEL__ 129#ifdef __KERNEL__
130struct sk_filter
131{
132 atomic_t refcnt;
133 unsigned int len; /* Number of filter blocks */
134 struct rcu_head rcu;
135 struct sock_filter insns[0];
136};
137
138static inline unsigned int sk_filter_len(const struct sk_filter *fp)
139{
140 return fp->len * sizeof(struct sock_filter) + sizeof(*fp);
141}
142
144struct sk_buff; 143struct sk_buff;
145struct sock; 144struct sock;
146 145
147extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen); 146extern int sk_filter(struct sock *sk, struct sk_buff *skb);
147extern unsigned int sk_run_filter(struct sk_buff *skb,
148 struct sock_filter *filter, int flen);
148extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 149extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
149extern int sk_detach_filter(struct sock *sk); 150extern int sk_detach_filter(struct sock *sk);
150extern int sk_chk_filter(struct sock_filter *filter, int flen); 151extern int sk_chk_filter(struct sock_filter *filter, int flen);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b84b848431f2..a1ba005d08e7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -287,9 +287,9 @@ extern int dir_notify_enable;
287#include <linux/pid.h> 287#include <linux/pid.h>
288#include <linux/mutex.h> 288#include <linux/mutex.h>
289#include <linux/capability.h> 289#include <linux/capability.h>
290#include <linux/semaphore.h>
290 291
291#include <asm/atomic.h> 292#include <asm/atomic.h>
292#include <asm/semaphore.h>
293#include <asm/byteorder.h> 293#include <asm/byteorder.h>
294 294
295struct export_operations; 295struct export_operations;
@@ -305,7 +305,6 @@ struct vfsmount;
305 305
306extern void __init inode_init(void); 306extern void __init inode_init(void);
307extern void __init inode_init_early(void); 307extern void __init inode_init_early(void);
308extern void __init mnt_init(void);
309extern void __init files_init(unsigned long); 308extern void __init files_init(unsigned long);
310 309
311struct buffer_head; 310struct buffer_head;
@@ -475,8 +474,8 @@ struct address_space_operations {
475 int (*releasepage) (struct page *, gfp_t); 474 int (*releasepage) (struct page *, gfp_t);
476 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 475 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
477 loff_t offset, unsigned long nr_segs); 476 loff_t offset, unsigned long nr_segs);
478 struct page* (*get_xip_page)(struct address_space *, sector_t, 477 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
479 int); 478 void **, unsigned long *);
480 /* migrate the contents of a page to the specified target */ 479 /* migrate the contents of a page to the specified target */
481 int (*migratepage) (struct address_space *, 480 int (*migratepage) (struct address_space *,
482 struct page *, struct page *); 481 struct page *, struct page *);
@@ -776,6 +775,9 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
776 index < ra->start + ra->size); 775 index < ra->start + ra->size);
777} 776}
778 777
778#define FILE_MNT_WRITE_TAKEN 1
779#define FILE_MNT_WRITE_RELEASED 2
780
779struct file { 781struct file {
780 /* 782 /*
781 * fu_list becomes invalid after file_free is called and queued via 783 * fu_list becomes invalid after file_free is called and queued via
@@ -810,6 +812,9 @@ struct file {
810 spinlock_t f_ep_lock; 812 spinlock_t f_ep_lock;
811#endif /* #ifdef CONFIG_EPOLL */ 813#endif /* #ifdef CONFIG_EPOLL */
812 struct address_space *f_mapping; 814 struct address_space *f_mapping;
815#ifdef CONFIG_DEBUG_WRITECOUNT
816 unsigned long f_mnt_write_state;
817#endif
813}; 818};
814extern spinlock_t files_lock; 819extern spinlock_t files_lock;
815#define file_list_lock() spin_lock(&files_lock); 820#define file_list_lock() spin_lock(&files_lock);
@@ -818,6 +823,49 @@ extern spinlock_t files_lock;
818#define get_file(x) atomic_inc(&(x)->f_count) 823#define get_file(x) atomic_inc(&(x)->f_count)
819#define file_count(x) atomic_read(&(x)->f_count) 824#define file_count(x) atomic_read(&(x)->f_count)
820 825
826#ifdef CONFIG_DEBUG_WRITECOUNT
827static inline void file_take_write(struct file *f)
828{
829 WARN_ON(f->f_mnt_write_state != 0);
830 f->f_mnt_write_state = FILE_MNT_WRITE_TAKEN;
831}
832static inline void file_release_write(struct file *f)
833{
834 f->f_mnt_write_state |= FILE_MNT_WRITE_RELEASED;
835}
836static inline void file_reset_write(struct file *f)
837{
838 f->f_mnt_write_state = 0;
839}
840static inline void file_check_state(struct file *f)
841{
842 /*
843 * At this point, either both or neither of these bits
844 * should be set.
845 */
846 WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN);
847 WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_RELEASED);
848}
849static inline int file_check_writeable(struct file *f)
850{
851 if (f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN)
852 return 0;
853 printk(KERN_WARNING "writeable file with no "
854 "mnt_want_write()\n");
855 WARN_ON(1);
856 return -EINVAL;
857}
858#else /* !CONFIG_DEBUG_WRITECOUNT */
859static inline void file_take_write(struct file *filp) {}
860static inline void file_release_write(struct file *filp) {}
861static inline void file_reset_write(struct file *filp) {}
862static inline void file_check_state(struct file *filp) {}
863static inline int file_check_writeable(struct file *filp)
864{
865 return 0;
866}
867#endif /* CONFIG_DEBUG_WRITECOUNT */
868
821#define MAX_NON_LFS ((1UL<<31) - 1) 869#define MAX_NON_LFS ((1UL<<31) - 1)
822 870
823/* Page cache limit. The filesystems should put that into their s_maxbytes 871/* Page cache limit. The filesystems should put that into their s_maxbytes
@@ -925,6 +973,7 @@ extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
925/* fs/locks.c */ 973/* fs/locks.c */
926extern void locks_init_lock(struct file_lock *); 974extern void locks_init_lock(struct file_lock *);
927extern void locks_copy_lock(struct file_lock *, struct file_lock *); 975extern void locks_copy_lock(struct file_lock *, struct file_lock *);
976extern void __locks_copy_lock(struct file_lock *, const struct file_lock *);
928extern void locks_remove_posix(struct file *, fl_owner_t); 977extern void locks_remove_posix(struct file *, fl_owner_t);
929extern void locks_remove_flock(struct file *); 978extern void locks_remove_flock(struct file *);
930extern void posix_test_lock(struct file *, struct file_lock *); 979extern void posix_test_lock(struct file *, struct file_lock *);
@@ -1129,7 +1178,8 @@ struct block_device_operations {
1129 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); 1178 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
1130 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); 1179 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
1131 long (*compat_ioctl) (struct file *, unsigned, unsigned long); 1180 long (*compat_ioctl) (struct file *, unsigned, unsigned long);
1132 int (*direct_access) (struct block_device *, sector_t, unsigned long *); 1181 int (*direct_access) (struct block_device *, sector_t,
1182 void **, unsigned long *);
1133 int (*media_changed) (struct gendisk *); 1183 int (*media_changed) (struct gendisk *);
1134 int (*revalidate_disk) (struct gendisk *); 1184 int (*revalidate_disk) (struct gendisk *);
1135 int (*getgeo)(struct block_device *, struct hd_geometry *); 1185 int (*getgeo)(struct block_device *, struct hd_geometry *);
@@ -1260,7 +1310,7 @@ struct super_operations {
1260 int (*statfs) (struct dentry *, struct kstatfs *); 1310 int (*statfs) (struct dentry *, struct kstatfs *);
1261 int (*remount_fs) (struct super_block *, int *, char *); 1311 int (*remount_fs) (struct super_block *, int *, char *);
1262 void (*clear_inode) (struct inode *); 1312 void (*clear_inode) (struct inode *);
1263 void (*umount_begin) (struct vfsmount *, int); 1313 void (*umount_begin) (struct super_block *);
1264 1314
1265 int (*show_options)(struct seq_file *, struct vfsmount *); 1315 int (*show_options)(struct seq_file *, struct vfsmount *);
1266 int (*show_stats)(struct seq_file *, struct vfsmount *); 1316 int (*show_stats)(struct seq_file *, struct vfsmount *);
@@ -1471,7 +1521,6 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
1471 const struct super_operations *ops, unsigned long, 1521 const struct super_operations *ops, unsigned long,
1472 struct vfsmount *mnt); 1522 struct vfsmount *mnt);
1473extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1523extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1474int __put_super(struct super_block *sb);
1475int __put_super_and_need_restart(struct super_block *sb); 1524int __put_super_and_need_restart(struct super_block *sb);
1476void unnamed_dev_init(void); 1525void unnamed_dev_init(void);
1477 1526
@@ -1487,12 +1536,7 @@ extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data);
1487#define kern_mount(type) kern_mount_data(type, NULL) 1536#define kern_mount(type) kern_mount_data(type, NULL)
1488extern int may_umount_tree(struct vfsmount *); 1537extern int may_umount_tree(struct vfsmount *);
1489extern int may_umount(struct vfsmount *); 1538extern int may_umount(struct vfsmount *);
1490extern void umount_tree(struct vfsmount *, int, struct list_head *);
1491extern void release_mounts(struct list_head *);
1492extern long do_mount(char *, char *, char *, unsigned long, void *); 1539extern long do_mount(char *, char *, char *, unsigned long, void *);
1493extern struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int);
1494extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
1495 struct vfsmount *);
1496extern struct vfsmount *collect_mounts(struct vfsmount *, struct dentry *); 1540extern struct vfsmount *collect_mounts(struct vfsmount *, struct dentry *);
1497extern void drop_collected_mounts(struct vfsmount *); 1541extern void drop_collected_mounts(struct vfsmount *);
1498 1542
@@ -1735,7 +1779,8 @@ extern struct file *create_read_pipe(struct file *f);
1735extern struct file *create_write_pipe(void); 1779extern struct file *create_write_pipe(void);
1736extern void free_write_pipe(struct file *); 1780extern void free_write_pipe(struct file *);
1737 1781
1738extern int open_namei(int dfd, const char *, int, int, struct nameidata *); 1782extern struct file *do_filp_open(int dfd, const char *pathname,
1783 int open_flag, int mode);
1739extern int may_open(struct nameidata *, int, int); 1784extern int may_open(struct nameidata *, int, int);
1740 1785
1741extern int kernel_read(struct file *, unsigned long, char *, unsigned long); 1786extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
@@ -1919,7 +1964,6 @@ extern int vfs_stat_fd(int dfd, char __user *, struct kstat *);
1919extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); 1964extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *);
1920extern int vfs_fstat(unsigned int, struct kstat *); 1965extern int vfs_fstat(unsigned int, struct kstat *);
1921 1966
1922extern long vfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
1923extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 1967extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
1924 unsigned long arg); 1968 unsigned long arg);
1925 1969
@@ -1989,9 +2033,6 @@ static inline ino_t parent_ino(struct dentry *dentry)
1989 return res; 2033 return res;
1990} 2034}
1991 2035
1992/* kernel/fork.c */
1993extern int unshare_files(void);
1994
1995/* Transaction based IO helpers */ 2036/* Transaction based IO helpers */
1996 2037
1997/* 2038/*
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 1831b196c70a..c415a496de3a 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -14,7 +14,6 @@
14 * option) any later version. 14 * option) any later version.
15 */ 15 */
16 16
17#ifdef __KERNEL__
18#ifndef _FSL_DEVICE_H_ 17#ifndef _FSL_DEVICE_H_
19#define _FSL_DEVICE_H_ 18#define _FSL_DEVICE_H_
20 19
@@ -50,7 +49,7 @@ struct gianfar_platform_data {
50 u32 device_flags; 49 u32 device_flags;
51 /* board specific information */ 50 /* board specific information */
52 u32 board_flags; 51 u32 board_flags;
53 u32 bus_id; 52 char bus_id[MII_BUS_ID_SIZE];
54 u32 phy_id; 53 u32 phy_id;
55 u8 mac_addr[6]; 54 u8 mac_addr[6];
56 phy_interface_t interface; 55 phy_interface_t interface;
@@ -127,4 +126,3 @@ struct mpc8xx_pcmcia_ops {
127}; 126};
128 127
129#endif /* _FSL_DEVICE_H_ */ 128#endif /* _FSL_DEVICE_H_ */
130#endif /* __KERNEL__ */
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index d4b7c4ac72e6..a89513188ce7 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -11,8 +11,6 @@
11 * (C) Copyright 2005 Robert Love 11 * (C) Copyright 2005 Robert Love
12 */ 12 */
13 13
14#ifdef __KERNEL__
15
16#include <linux/dnotify.h> 14#include <linux/dnotify.h>
17#include <linux/inotify.h> 15#include <linux/inotify.h>
18#include <linux/audit.h> 16#include <linux/audit.h>
@@ -296,6 +294,4 @@ static inline void fsnotify_oldname_free(const char *old_name)
296 294
297#endif /* ! CONFIG_INOTIFY */ 295#endif /* ! CONFIG_INOTIFY */
298 296
299#endif /* __KERNEL__ */
300
301#endif /* _LINUX_FS_NOTIFY_H */ 297#endif /* _LINUX_FS_NOTIFY_H */
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index 5412da28fa47..110833666e37 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -78,7 +78,7 @@ struct gs_port {
78#define GS_DEBUG_WRITE 0x00000040 78#define GS_DEBUG_WRITE 0x00000040
79 79
80#ifdef __KERNEL__ 80#ifdef __KERNEL__
81void gs_put_char(struct tty_struct *tty, unsigned char ch); 81int gs_put_char(struct tty_struct *tty, unsigned char ch);
82int gs_write(struct tty_struct *tty, 82int gs_write(struct tty_struct *tty,
83 const unsigned char *buf, int count); 83 const unsigned char *buf, int count);
84int gs_write_room(struct tty_struct *tty); 84int gs_write_room(struct tty_struct *tty);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 164be9da3c1b..b414be387180 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -40,9 +40,9 @@ struct vm_area_struct;
40#define __GFP_FS ((__force gfp_t)0x80u) /* Can call down to low-level FS? */ 40#define __GFP_FS ((__force gfp_t)0x80u) /* Can call down to low-level FS? */
41#define __GFP_COLD ((__force gfp_t)0x100u) /* Cache-cold page required */ 41#define __GFP_COLD ((__force gfp_t)0x100u) /* Cache-cold page required */
42#define __GFP_NOWARN ((__force gfp_t)0x200u) /* Suppress page allocation failure warning */ 42#define __GFP_NOWARN ((__force gfp_t)0x200u) /* Suppress page allocation failure warning */
43#define __GFP_REPEAT ((__force gfp_t)0x400u) /* Retry the allocation. Might fail */ 43#define __GFP_REPEAT ((__force gfp_t)0x400u) /* See above */
44#define __GFP_NOFAIL ((__force gfp_t)0x800u) /* Retry for ever. Cannot fail */ 44#define __GFP_NOFAIL ((__force gfp_t)0x800u) /* See above */
45#define __GFP_NORETRY ((__force gfp_t)0x1000u)/* Do not retry. Might fail */ 45#define __GFP_NORETRY ((__force gfp_t)0x1000u)/* See above */
46#define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */ 46#define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */
47#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ 47#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */
48#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ 48#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */
@@ -119,35 +119,22 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
119 119
120static inline enum zone_type gfp_zone(gfp_t flags) 120static inline enum zone_type gfp_zone(gfp_t flags)
121{ 121{
122 int base = 0;
123
124#ifdef CONFIG_NUMA
125 if (flags & __GFP_THISNODE)
126 base = MAX_NR_ZONES;
127#endif
128
129#ifdef CONFIG_ZONE_DMA 122#ifdef CONFIG_ZONE_DMA
130 if (flags & __GFP_DMA) 123 if (flags & __GFP_DMA)
131 return base + ZONE_DMA; 124 return ZONE_DMA;
132#endif 125#endif
133#ifdef CONFIG_ZONE_DMA32 126#ifdef CONFIG_ZONE_DMA32
134 if (flags & __GFP_DMA32) 127 if (flags & __GFP_DMA32)
135 return base + ZONE_DMA32; 128 return ZONE_DMA32;
136#endif 129#endif
137 if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) == 130 if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) ==
138 (__GFP_HIGHMEM | __GFP_MOVABLE)) 131 (__GFP_HIGHMEM | __GFP_MOVABLE))
139 return base + ZONE_MOVABLE; 132 return ZONE_MOVABLE;
140#ifdef CONFIG_HIGHMEM 133#ifdef CONFIG_HIGHMEM
141 if (flags & __GFP_HIGHMEM) 134 if (flags & __GFP_HIGHMEM)
142 return base + ZONE_HIGHMEM; 135 return ZONE_HIGHMEM;
143#endif 136#endif
144 return base + ZONE_NORMAL; 137 return ZONE_NORMAL;
145}
146
147static inline gfp_t set_migrateflags(gfp_t gfp, gfp_t migrate_flags)
148{
149 BUG_ON((gfp & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
150 return (gfp & ~(GFP_MOVABLE_MASK)) | migrate_flags;
151} 138}
152 139
153/* 140/*
@@ -157,13 +144,27 @@ static inline gfp_t set_migrateflags(gfp_t gfp, gfp_t migrate_flags)
157 * virtual kernel addresses to the allocated page(s). 144 * virtual kernel addresses to the allocated page(s).
158 */ 145 */
159 146
147static inline int gfp_zonelist(gfp_t flags)
148{
149 if (NUMA_BUILD && unlikely(flags & __GFP_THISNODE))
150 return 1;
151
152 return 0;
153}
154
160/* 155/*
161 * We get the zone list from the current node and the gfp_mask. 156 * We get the zone list from the current node and the gfp_mask.
162 * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones. 157 * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones.
158 * There are two zonelists per node, one for all zones with memory and
159 * one containing just zones from the node the zonelist belongs to.
163 * 160 *
164 * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets 161 * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets
165 * optimized to &contig_page_data at compile-time. 162 * optimized to &contig_page_data at compile-time.
166 */ 163 */
164static inline struct zonelist *node_zonelist(int nid, gfp_t flags)
165{
166 return NODE_DATA(nid)->node_zonelists + gfp_zonelist(flags);
167}
167 168
168#ifndef HAVE_ARCH_FREE_PAGE 169#ifndef HAVE_ARCH_FREE_PAGE
169static inline void arch_free_page(struct page *page, int order) { } 170static inline void arch_free_page(struct page *page, int order) { }
@@ -174,6 +175,10 @@ static inline void arch_alloc_page(struct page *page, int order) { }
174 175
175extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *); 176extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *);
176 177
178extern struct page *
179__alloc_pages_nodemask(gfp_t, unsigned int,
180 struct zonelist *, nodemask_t *nodemask);
181
177static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, 182static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
178 unsigned int order) 183 unsigned int order)
179{ 184{
@@ -184,8 +189,7 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
184 if (nid < 0) 189 if (nid < 0)
185 nid = numa_node_id(); 190 nid = numa_node_id();
186 191
187 return __alloc_pages(gfp_mask, order, 192 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
188 NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask));
189} 193}
190 194
191#ifdef CONFIG_NUMA 195#ifdef CONFIG_NUMA
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index e38e75967e74..c37e9241fae7 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -422,9 +422,11 @@ struct hd_geometry {
422#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 422#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
423#define HDIO_SET_DMA 0x0326 /* change use-dma flag */ 423#define HDIO_SET_DMA 0x0326 /* change use-dma flag */
424#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 424#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
425#ifndef __KERNEL__
425#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ 426#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */
426#define HDIO_SET_NICE 0x0329 /* set nice flags */
427#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ 427#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */
428#endif
429#define HDIO_SET_NICE 0x0329 /* set nice flags */
428#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ 430#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */
429#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ 431#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */
430#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ 432#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */
diff --git a/include/linux/hdsmart.h b/include/linux/hdsmart.h
deleted file mode 100644
index 4f4faf9d4238..000000000000
--- a/include/linux/hdsmart.h
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * linux/include/linux/hdsmart.h
3 *
4 * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
5 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
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; either version 2, or (at your option)
10 * any later version.
11 *
12 * You should have received a copy of the GNU General Public License
13 * (for example /usr/src/linux/COPYING); if not, write to the Free
14 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15 */
16
17#ifndef _LINUX_HDSMART_H
18#define _LINUX_HDSMART_H
19
20#ifndef __KERNEL__
21#define OFFLINE_FULL_SCAN 0
22#define SHORT_SELF_TEST 1
23#define EXTEND_SELF_TEST 2
24#define SHORT_CAPTIVE_SELF_TEST 129
25#define EXTEND_CAPTIVE_SELF_TEST 130
26
27/* smart_attribute is the vendor specific in SFF-8035 spec */
28typedef struct ata_smart_attribute_s {
29 unsigned char id;
30 unsigned short status_flag;
31 unsigned char normalized;
32 unsigned char worse_normal;
33 unsigned char raw[6];
34 unsigned char reserv;
35} __attribute__ ((packed)) ata_smart_attribute_t;
36
37/* smart_values is format of the read drive Atrribute command */
38typedef struct ata_smart_values_s {
39 unsigned short revnumber;
40 ata_smart_attribute_t vendor_attributes [30];
41 unsigned char offline_data_collection_status;
42 unsigned char self_test_exec_status;
43 unsigned short total_time_to_complete_off_line;
44 unsigned char vendor_specific_366;
45 unsigned char offline_data_collection_capability;
46 unsigned short smart_capability;
47 unsigned char errorlog_capability;
48 unsigned char vendor_specific_371;
49 unsigned char short_test_completion_time;
50 unsigned char extend_test_completion_time;
51 unsigned char reserved_374_385 [12];
52 unsigned char vendor_specific_386_509 [125];
53 unsigned char chksum;
54} __attribute__ ((packed)) ata_smart_values_t;
55
56/* Smart Threshold data structures */
57/* Vendor attribute of SMART Threshold */
58typedef struct ata_smart_threshold_entry_s {
59 unsigned char id;
60 unsigned char normalized_threshold;
61 unsigned char reserved[10];
62} __attribute__ ((packed)) ata_smart_threshold_entry_t;
63
64/* Format of Read SMART THreshold Command */
65typedef struct ata_smart_thresholds_s {
66 unsigned short revnumber;
67 ata_smart_threshold_entry_t thres_entries[30];
68 unsigned char reserved[149];
69 unsigned char chksum;
70} __attribute__ ((packed)) ata_smart_thresholds_t;
71
72typedef struct ata_smart_errorlog_command_struct_s {
73 unsigned char devicecontrolreg;
74 unsigned char featuresreg;
75 unsigned char sector_count;
76 unsigned char sector_number;
77 unsigned char cylinder_low;
78 unsigned char cylinder_high;
79 unsigned char drive_head;
80 unsigned char commandreg;
81 unsigned int timestamp;
82} __attribute__ ((packed)) ata_smart_errorlog_command_struct_t;
83
84typedef struct ata_smart_errorlog_error_struct_s {
85 unsigned char error_condition;
86 unsigned char extended_error[14];
87 unsigned char state;
88 unsigned short timestamp;
89} __attribute__ ((packed)) ata_smart_errorlog_error_struct_t;
90
91typedef struct ata_smart_errorlog_struct_s {
92 ata_smart_errorlog_command_struct_t commands[6];
93 ata_smart_errorlog_error_struct_t error_struct;
94} __attribute__ ((packed)) ata_smart_errorlog_struct_t;
95
96typedef struct ata_smart_errorlog_s {
97 unsigned char revnumber;
98 unsigned char error_log_pointer;
99 ata_smart_errorlog_struct_t errorlog_struct[5];
100 unsigned short ata_error_count;
101 unsigned short non_fatal_count;
102 unsigned short drive_timeout_count;
103 unsigned char reserved[53];
104 unsigned char chksum;
105} __attribute__ ((packed)) ata_smart_errorlog_t;
106
107typedef struct ata_smart_selftestlog_struct_s {
108 unsigned char selftestnumber;
109 unsigned char selfteststatus;
110 unsigned short timestamp;
111 unsigned char selftestfailurecheckpoint;
112 unsigned int lbafirstfailure;
113 unsigned char vendorspecific[15];
114} __attribute__ ((packed)) ata_smart_selftestlog_struct_t;
115
116typedef struct ata_smart_selftestlog_s {
117 unsigned short revnumber;
118 ata_smart_selftestlog_struct_t selftest_struct[21];
119 unsigned char vendorspecific[2];
120 unsigned char mostrecenttest;
121 unsigned char resevered[2];
122 unsigned char chksum;
123} __attribute__ ((packed)) ata_smart_selftestlog_t;
124#endif /* __KERNEL__ */
125
126#endif /* _LINUX_HDSMART_H */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 74ff57596eb1..4ce3b7a979ba 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -284,6 +284,7 @@ struct hid_item {
284#define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000 284#define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000
285#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000 285#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000
286#define HID_QUIRK_MICROSOFT_KEYS 0x08000000 286#define HID_QUIRK_MICROSOFT_KEYS 0x08000000
287#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
287 288
288/* 289/*
289 * Separate quirks for runtime report descriptor fixup 290 * Separate quirks for runtime report descriptor fixup
@@ -296,6 +297,8 @@ struct hid_item {
296#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010 297#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010
297#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020 298#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020
298#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040 299#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040
300#define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080
301#define HID_QUIRK_RDESC_SUNPLUS_WDESKTOP 0x00000100
299 302
300/* 303/*
301 * This is the global environment of the parser. This information is 304 * This is the global environment of the parser. This information is
@@ -320,7 +323,7 @@ struct hid_global {
320 * This is the local environment. It is persistent up the next main-item. 323 * This is the local environment. It is persistent up the next main-item.
321 */ 324 */
322 325
323#define HID_MAX_USAGES 8192 326#define HID_MAX_USAGES 12288
324#define HID_DEFAULT_NUM_COLLECTIONS 16 327#define HID_DEFAULT_NUM_COLLECTIONS 16
325 328
326struct hid_local { 329struct hid_local {
@@ -421,6 +424,7 @@ struct hid_control_fifo {
421#define HID_RESET_PENDING 4 424#define HID_RESET_PENDING 4
422#define HID_SUSPENDED 5 425#define HID_SUSPENDED 5
423#define HID_CLEAR_HALT 6 426#define HID_CLEAR_HALT 6
427#define HID_DISCONNECTED 7
424 428
425struct hid_input { 429struct hid_input {
426 struct list_head list; 430 struct list_head list;
@@ -452,8 +456,6 @@ struct hid_device { /* device report descriptor */
452 void *hidraw; 456 void *hidraw;
453 int minor; /* Hiddev minor number */ 457 int minor; /* Hiddev minor number */
454 458
455 wait_queue_head_t wait; /* For sleeping */
456
457 int open; /* is the device open by anyone? */ 459 int open; /* is the device open by anyone? */
458 char name[128]; /* Device name */ 460 char name[128]; /* Device name */
459 char phys[64]; /* Device physical location */ 461 char phys[64]; /* Device physical location */
@@ -496,13 +498,13 @@ struct hid_parser {
496 498
497struct hid_class_descriptor { 499struct hid_class_descriptor {
498 __u8 bDescriptorType; 500 __u8 bDescriptorType;
499 __u16 wDescriptorLength; 501 __le16 wDescriptorLength;
500} __attribute__ ((packed)); 502} __attribute__ ((packed));
501 503
502struct hid_descriptor { 504struct hid_descriptor {
503 __u8 bLength; 505 __u8 bLength;
504 __u8 bDescriptorType; 506 __u8 bDescriptorType;
505 __u16 bcdHID; 507 __le16 bcdHID;
506 __u8 bCountryCode; 508 __u8 bCountryCode;
507 __u8 bNumDescriptors; 509 __u8 bNumDescriptors;
508 510
@@ -530,14 +532,12 @@ int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int
530int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *); 532int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *);
531int hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); 533int hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
532int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32); 534int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32);
533void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt);
534void hid_output_report(struct hid_report *report, __u8 *data); 535void hid_output_report(struct hid_report *report, __u8 *data);
535void hid_free_device(struct hid_device *device); 536void hid_free_device(struct hid_device *device);
536struct hid_device *hid_parse_report(__u8 *start, unsigned size); 537struct hid_device *hid_parse_report(__u8 *start, unsigned size);
537 538
538/* HID quirks API */ 539/* HID quirks API */
539u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); 540u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);
540int usbhid_modify_dquirk(const u16 idVendor, const u16 idProduct, const u32 quirks);
541int usbhid_quirks_init(char **quirks_param); 541int usbhid_quirks_init(char **quirks_param);
542void usbhid_quirks_exit(void); 542void usbhid_quirks_exit(void);
543void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char **); 543void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char **);
@@ -546,6 +546,7 @@ void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char
546int hid_ff_init(struct hid_device *hid); 546int hid_ff_init(struct hid_device *hid);
547 547
548int hid_lgff_init(struct hid_device *hid); 548int hid_lgff_init(struct hid_device *hid);
549int hid_lg2ff_init(struct hid_device *hid);
549int hid_plff_init(struct hid_device *hid); 550int hid_plff_init(struct hid_device *hid);
550int hid_tmff_init(struct hid_device *hid); 551int hid_tmff_init(struct hid_device *hid);
551int hid_zpff_init(struct hid_device *hid); 552int hid_zpff_init(struct hid_device *hid);
@@ -566,7 +567,11 @@ static inline int hid_ff_init(struct hid_device *hid) { return -1; }
566#define dbg_hid_line(format, arg...) if (hid_debug) \ 567#define dbg_hid_line(format, arg...) if (hid_debug) \
567 printk(format, ## arg) 568 printk(format, ## arg)
568#else 569#else
569#define dbg_hid(format, arg...) do {} while (0) 570static inline int __attribute__((format(printf, 1, 2)))
571dbg_hid(const char *fmt, ...)
572{
573 return 0;
574}
570#define dbg_hid_line dbg_hid 575#define dbg_hid_line dbg_hid
571#endif 576#endif
572 577
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index 0536f299f7ff..dbb5c8c374f0 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -16,6 +16,7 @@
16 */ 16 */
17 17
18#include <linux/hid.h> 18#include <linux/hid.h>
19#include <linux/types.h>
19 20
20struct hidraw_report_descriptor { 21struct hidraw_report_descriptor {
21 __u32 size; 22 __u32 size;
diff --git a/include/linux/hil_mlc.h b/include/linux/hil_mlc.h
index 8df29ca48a13..394a8405dd74 100644
--- a/include/linux/hil_mlc.h
+++ b/include/linux/hil_mlc.h
@@ -34,7 +34,7 @@
34#include <linux/hil.h> 34#include <linux/hil.h>
35#include <linux/time.h> 35#include <linux/time.h>
36#include <linux/interrupt.h> 36#include <linux/interrupt.h>
37#include <asm/semaphore.h> 37#include <linux/semaphore.h>
38#include <linux/serio.h> 38#include <linux/serio.h>
39#include <linux/list.h> 39#include <linux/list.h>
40 40
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 1ad56a7b2f74..31a4d653389f 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -173,7 +173,6 @@ struct hrtimer_clock_base {
173 * struct hrtimer_cpu_base - the per cpu clock bases 173 * struct hrtimer_cpu_base - the per cpu clock bases
174 * @lock: lock protecting the base and associated clock bases 174 * @lock: lock protecting the base and associated clock bases
175 * and timers 175 * and timers
176 * @lock_key: the lock_class_key for use with lockdep
177 * @clock_base: array of clock bases for this cpu 176 * @clock_base: array of clock bases for this cpu
178 * @curr_timer: the timer which is executing a callback right now 177 * @curr_timer: the timer which is executing a callback right now
179 * @expires_next: absolute time of the next event which was scheduled 178 * @expires_next: absolute time of the next event which was scheduled
@@ -189,7 +188,6 @@ struct hrtimer_clock_base {
189 */ 188 */
190struct hrtimer_cpu_base { 189struct hrtimer_cpu_base {
191 spinlock_t lock; 190 spinlock_t lock;
192 struct lock_class_key lock_key;
193 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; 191 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
194 struct list_head cb_pending; 192 struct list_head cb_pending;
195#ifdef CONFIG_HIGH_RES_TIMERS 193#ifdef CONFIG_HIGH_RES_TIMERS
@@ -268,6 +266,21 @@ extern ktime_t ktime_get_real(void);
268extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, 266extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock,
269 enum hrtimer_mode mode); 267 enum hrtimer_mode mode);
270 268
269#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
270extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_clock,
271 enum hrtimer_mode mode);
272
273extern void destroy_hrtimer_on_stack(struct hrtimer *timer);
274#else
275static inline void hrtimer_init_on_stack(struct hrtimer *timer,
276 clockid_t which_clock,
277 enum hrtimer_mode mode)
278{
279 hrtimer_init(timer, which_clock, mode);
280}
281static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { }
282#endif
283
271/* Basic timer operations: */ 284/* Basic timer operations: */
272extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, 285extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
273 const enum hrtimer_mode mode); 286 const enum hrtimer_mode mode);
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index addca4cd4f11..a79e80b689d8 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -8,6 +8,7 @@
8#include <linux/mempolicy.h> 8#include <linux/mempolicy.h>
9#include <linux/shm.h> 9#include <linux/shm.h>
10#include <asm/tlbflush.h> 10#include <asm/tlbflush.h>
11#include <asm/hugetlb.h>
11 12
12struct ctl_table; 13struct ctl_table;
13 14
@@ -51,51 +52,6 @@ int pmd_huge(pmd_t pmd);
51void hugetlb_change_protection(struct vm_area_struct *vma, 52void hugetlb_change_protection(struct vm_area_struct *vma,
52 unsigned long address, unsigned long end, pgprot_t newprot); 53 unsigned long address, unsigned long end, pgprot_t newprot);
53 54
54#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE
55#define is_hugepage_only_range(mm, addr, len) 0
56#endif
57
58#ifndef ARCH_HAS_HUGETLB_FREE_PGD_RANGE
59#define hugetlb_free_pgd_range free_pgd_range
60#else
61void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
62 unsigned long end, unsigned long floor,
63 unsigned long ceiling);
64#endif
65
66#ifndef ARCH_HAS_PREPARE_HUGEPAGE_RANGE
67/*
68 * If the arch doesn't supply something else, assume that hugepage
69 * size aligned regions are ok without further preparation.
70 */
71static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
72{
73 if (len & ~HPAGE_MASK)
74 return -EINVAL;
75 if (addr & ~HPAGE_MASK)
76 return -EINVAL;
77 return 0;
78}
79#else
80int prepare_hugepage_range(unsigned long addr, unsigned long len);
81#endif
82
83#ifndef ARCH_HAS_SETCLEAR_HUGE_PTE
84#define set_huge_pte_at(mm, addr, ptep, pte) set_pte_at(mm, addr, ptep, pte)
85#define huge_ptep_get_and_clear(mm, addr, ptep) ptep_get_and_clear(mm, addr, ptep)
86#else
87void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
88 pte_t *ptep, pte_t pte);
89pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
90 pte_t *ptep);
91#endif
92
93#ifndef ARCH_HAS_HUGETLB_PREFAULT_HOOK
94#define hugetlb_prefault_arch_hook(mm) do { } while (0)
95#else
96void hugetlb_prefault_arch_hook(struct mm_struct *mm);
97#endif
98
99#else /* !CONFIG_HUGETLB_PAGE */ 55#else /* !CONFIG_HUGETLB_PAGE */
100 56
101static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 57static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 42131820bb89..7244456e7e65 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -11,7 +11,6 @@
11 11
12#ifndef LINUX_HWRANDOM_H_ 12#ifndef LINUX_HWRANDOM_H_
13#define LINUX_HWRANDOM_H_ 13#define LINUX_HWRANDOM_H_
14#ifdef __KERNEL__
15 14
16#include <linux/types.h> 15#include <linux/types.h>
17#include <linux/list.h> 16#include <linux/list.h>
@@ -44,15 +43,6 @@ struct hwrng {
44/** Register a new Hardware Random Number Generator driver. */ 43/** Register a new Hardware Random Number Generator driver. */
45extern int hwrng_register(struct hwrng *rng); 44extern int hwrng_register(struct hwrng *rng);
46/** Unregister a Hardware Random Number Generator driver. */ 45/** Unregister a Hardware Random Number Generator driver. */
47extern void __hwrng_unregister(struct hwrng *rng, bool suspended); 46extern void hwrng_unregister(struct hwrng *rng);
48static inline void hwrng_unregister(struct hwrng *rng) 47
49{
50 __hwrng_unregister(rng, false);
51}
52static inline void hwrng_unregister_suspended(struct hwrng *rng)
53{
54 __hwrng_unregister(rng, true);
55}
56
57#endif /* __KERNEL__ */
58#endif /* LINUX_HWRANDOM_H_ */ 48#endif /* LINUX_HWRANDOM_H_ */
diff --git a/include/linux/i2c-algo-pca.h b/include/linux/i2c-algo-pca.h
index fce47c051bb1..adcb3dc7ac26 100644
--- a/include/linux/i2c-algo-pca.h
+++ b/include/linux/i2c-algo-pca.h
@@ -1,14 +1,41 @@
1#ifndef _LINUX_I2C_ALGO_PCA_H 1#ifndef _LINUX_I2C_ALGO_PCA_H
2#define _LINUX_I2C_ALGO_PCA_H 2#define _LINUX_I2C_ALGO_PCA_H
3 3
4/* Clock speeds for the bus */
5#define I2C_PCA_CON_330kHz 0x00
6#define I2C_PCA_CON_288kHz 0x01
7#define I2C_PCA_CON_217kHz 0x02
8#define I2C_PCA_CON_146kHz 0x03
9#define I2C_PCA_CON_88kHz 0x04
10#define I2C_PCA_CON_59kHz 0x05
11#define I2C_PCA_CON_44kHz 0x06
12#define I2C_PCA_CON_36kHz 0x07
13
14/* PCA9564 registers */
15#define I2C_PCA_STA 0x00 /* STATUS Read Only */
16#define I2C_PCA_TO 0x00 /* TIMEOUT Write Only */
17#define I2C_PCA_DAT 0x01 /* DATA Read/Write */
18#define I2C_PCA_ADR 0x02 /* OWN ADR Read/Write */
19#define I2C_PCA_CON 0x03 /* CONTROL Read/Write */
20
21#define I2C_PCA_CON_AA 0x80 /* Assert Acknowledge */
22#define I2C_PCA_CON_ENSIO 0x40 /* Enable */
23#define I2C_PCA_CON_STA 0x20 /* Start */
24#define I2C_PCA_CON_STO 0x10 /* Stop */
25#define I2C_PCA_CON_SI 0x08 /* Serial Interrupt */
26#define I2C_PCA_CON_CR 0x07 /* Clock Rate (MASK) */
27
4struct i2c_algo_pca_data { 28struct i2c_algo_pca_data {
5 int (*get_own) (struct i2c_algo_pca_data *adap); /* Obtain own address */ 29 void *data; /* private low level data */
6 int (*get_clock) (struct i2c_algo_pca_data *adap); 30 void (*write_byte) (void *data, int reg, int val);
7 void (*write_byte) (struct i2c_algo_pca_data *adap, int reg, int val); 31 int (*read_byte) (void *data, int reg);
8 int (*read_byte) (struct i2c_algo_pca_data *adap, int reg); 32 int (*wait_for_completion) (void *data);
9 int (*wait_for_interrupt) (struct i2c_algo_pca_data *adap); 33 void (*reset_chip) (void *data);
34 /* i2c_clock values are defined in linux/i2c-algo-pca.h */
35 unsigned int i2c_clock;
10}; 36};
11 37
12int i2c_pca_add_bus(struct i2c_adapter *); 38int i2c_pca_add_bus(struct i2c_adapter *);
39int i2c_pca_add_numbered_bus(struct i2c_adapter *);
13 40
14#endif /* _LINUX_I2C_ALGO_PCA_H */ 41#endif /* _LINUX_I2C_ALGO_PCA_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index b979112f74e0..580acc93903e 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -79,12 +79,9 @@
79#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */ 79#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */
80#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */ 80#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */
81#define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */ 81#define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */
82#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */
83#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */
84#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */ 82#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */
85#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ 83#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
86#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ 84#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
87#define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */
88#define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */ 85#define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */
89#define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ 86#define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */
90#define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ 87#define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */
@@ -125,6 +122,7 @@
125#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ 122#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
126#define I2C_HW_B_INTELFB 0x010021 /* intel framebuffer driver */ 123#define I2C_HW_B_INTELFB 0x010021 /* intel framebuffer driver */
127#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */ 124#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */
125#define I2C_HW_B_AU0828 0x010023 /* auvitek au0828 usb bridge */
128 126
129/* --- PCF 8584 based algorithms */ 127/* --- PCF 8584 based algorithms */
130#define I2C_HW_P_ELEK 0x020002 /* Elektor ISA Bus inteface card */ 128#define I2C_HW_P_ELEK 0x020002 /* Elektor ISA Bus inteface card */
diff --git a/include/linux/i2c-pca-platform.h b/include/linux/i2c-pca-platform.h
new file mode 100644
index 000000000000..3d191873f2d1
--- /dev/null
+++ b/include/linux/i2c-pca-platform.h
@@ -0,0 +1,12 @@
1#ifndef I2C_PCA9564_PLATFORM_H
2#define I2C_PCA9564_PLATFORM_H
3
4struct i2c_pca9564_pf_platform_data {
5 int gpio; /* pin to reset chip. driver will work when
6 * not supplied (negative value), but it
7 * cannot exit some error conditions then */
8 int i2c_clock_speed; /* values are defined in linux/i2c-algo-pca.h */
9 int timeout; /* timeout = this value * 10us */
10};
11
12#endif /* I2C_PCA9564_PLATFORM_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 365e0df3646b..cb63da5c2139 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -126,7 +126,7 @@ struct i2c_driver {
126 * With the driver model, device enumeration is NEVER done by drivers; 126 * With the driver model, device enumeration is NEVER done by drivers;
127 * it's done by infrastructure. (NEW STYLE DRIVERS ONLY) 127 * it's done by infrastructure. (NEW STYLE DRIVERS ONLY)
128 */ 128 */
129 int (*probe)(struct i2c_client *); 129 int (*probe)(struct i2c_client *, const struct i2c_device_id *);
130 int (*remove)(struct i2c_client *); 130 int (*remove)(struct i2c_client *);
131 131
132 /* driver model interfaces that don't relate to enumeration */ 132 /* driver model interfaces that don't relate to enumeration */
@@ -140,11 +140,10 @@ struct i2c_driver {
140 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); 140 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg);
141 141
142 struct device_driver driver; 142 struct device_driver driver;
143 const struct i2c_device_id *id_table;
143}; 144};
144#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 145#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
145 146
146#define I2C_NAME_SIZE 20
147
148/** 147/**
149 * struct i2c_client - represent an I2C slave device 148 * struct i2c_client - represent an I2C slave device
150 * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address; 149 * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address;
@@ -230,17 +229,17 @@ struct i2c_board_info {
230}; 229};
231 230
232/** 231/**
233 * I2C_BOARD_INFO - macro used to list an i2c device and its driver 232 * I2C_BOARD_INFO - macro used to list an i2c device and its address
234 * @driver: identifies the driver to use with the device 233 * @dev_type: identifies the device type
235 * @dev_addr: the device's address on the bus. 234 * @dev_addr: the device's address on the bus.
236 * 235 *
237 * This macro initializes essential fields of a struct i2c_board_info, 236 * This macro initializes essential fields of a struct i2c_board_info,
238 * declaring what has been provided on a particular board. Optional 237 * declaring what has been provided on a particular board. Optional
239 * fields (such as the chip type, its associated irq, or device-specific 238 * fields (such as associated irq, or device-specific platform_data)
240 * platform_data) are provided using conventional syntax. 239 * are provided using conventional syntax.
241 */ 240 */
242#define I2C_BOARD_INFO(driver,dev_addr) \ 241#define I2C_BOARD_INFO(dev_type,dev_addr) \
243 .driver_name = (driver), .addr = (dev_addr) 242 .type = (dev_type), .addr = (dev_addr)
244 243
245 244
246/* Add-on boards should register/unregister their devices; e.g. a board 245/* Add-on boards should register/unregister their devices; e.g. a board
diff --git a/include/linux/i2c/tps65010.h b/include/linux/i2c/tps65010.h
index 7021635ed6a0..918c5354d9b8 100644
--- a/include/linux/i2c/tps65010.h
+++ b/include/linux/i2c/tps65010.h
@@ -152,5 +152,35 @@ extern int tps65010_config_vregs1(unsigned value);
152 */ 152 */
153extern int tps65013_set_low_pwr(unsigned mode); 153extern int tps65013_set_low_pwr(unsigned mode);
154 154
155
156struct i2c_client;
157
158/**
159 * struct tps65010_board - packages GPIO and LED lines
160 * @base: the GPIO number to assign to GPIO-1
161 * @outmask: bit (N-1) is set to allow GPIO-N to be used as an
162 * (open drain) output
163 * @setup: optional callback issued once the GPIOs are valid
164 * @teardown: optional callback issued before the GPIOs are invalidated
165 * @context: optional parameter passed to setup() and teardown()
166 *
167 * Board data may be used to package the GPIO (and LED) lines for use
168 * in by the generic GPIO and LED frameworks. The first four GPIOs
169 * starting at gpio_base are GPIO1..GPIO4. The next two are LED1/nPG
170 * and LED2 (with hardware blinking capability, not currently exposed).
171 *
172 * The @setup callback may be used with the kind of board-specific glue
173 * which hands the (now-valid) GPIOs to other drivers, or which puts
174 * devices in their initial states using these GPIOs.
175 */
176struct tps65010_board {
177 int base;
178 unsigned outmask;
179
180 int (*setup)(struct i2c_client *client, void *context);
181 int (*teardown)(struct i2c_client *client, void *context);
182 void *context;
183};
184
155#endif /* __LINUX_I2C_TPS65010_H */ 185#endif /* __LINUX_I2C_TPS65010_H */
156 186
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 7da5b98d90e6..7d51cbca49ab 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -18,8 +18,6 @@
18#ifndef _I2O_H 18#ifndef _I2O_H
19#define _I2O_H 19#define _I2O_H
20 20
21#ifdef __KERNEL__ /* This file to be included by kernel only */
22
23#include <linux/i2o-dev.h> 21#include <linux/i2o-dev.h>
24 22
25/* How many different OSM's are we allowing */ 23/* How many different OSM's are we allowing */
@@ -33,9 +31,9 @@
33#include <linux/mempool.h> 31#include <linux/mempool.h>
34#include <linux/mutex.h> 32#include <linux/mutex.h>
35#include <linux/scatterlist.h> 33#include <linux/scatterlist.h>
34#include <linux/semaphore.h> /* Needed for MUTEX init macros */
36 35
37#include <asm/io.h> 36#include <asm/io.h>
38#include <asm/semaphore.h> /* Needed for MUTEX init macros */
39 37
40/* message queue empty */ 38/* message queue empty */
41#define I2O_QUEUE_EMPTY 0xffffffff 39#define I2O_QUEUE_EMPTY 0xffffffff
@@ -613,14 +611,9 @@ struct i2o_sys_tbl {
613extern struct list_head i2o_controllers; 611extern struct list_head i2o_controllers;
614 612
615/* Message functions */ 613/* Message functions */
616static inline struct i2o_message *i2o_msg_get(struct i2o_controller *);
617extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int); 614extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int);
618static inline void i2o_msg_post(struct i2o_controller *, struct i2o_message *);
619static inline int i2o_msg_post_wait(struct i2o_controller *,
620 struct i2o_message *, unsigned long);
621extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *, 615extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *,
622 unsigned long, struct i2o_dma *); 616 unsigned long, struct i2o_dma *);
623static inline void i2o_flush_reply(struct i2o_controller *, u32);
624 617
625/* IOP functions */ 618/* IOP functions */
626extern int i2o_status_get(struct i2o_controller *); 619extern int i2o_status_get(struct i2o_controller *);
@@ -1260,5 +1253,4 @@ extern void i2o_dump_message(struct i2o_message *);
1260extern void i2o_dump_hrt(struct i2o_controller *c); 1253extern void i2o_dump_hrt(struct i2o_controller *c);
1261extern void i2o_debug_state(struct i2o_controller *c); 1254extern void i2o_debug_state(struct i2o_controller *c);
1262 1255
1263#endif /* __KERNEL__ */
1264#endif /* _I2O_H */ 1256#endif /* _I2O_H */
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 7c5e9817e998..03067443198a 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -176,12 +176,21 @@ extern void icmpv6_send(struct sk_buff *skb,
176 __u32 info, 176 __u32 info,
177 struct net_device *dev); 177 struct net_device *dev);
178 178
179extern int icmpv6_init(struct net_proto_family *ops); 179extern int icmpv6_init(void);
180extern int icmpv6_err_convert(int type, int code, 180extern int icmpv6_err_convert(int type, int code,
181 int *err); 181 int *err);
182extern void icmpv6_cleanup(void); 182extern void icmpv6_cleanup(void);
183extern void icmpv6_param_prob(struct sk_buff *skb, 183extern void icmpv6_param_prob(struct sk_buff *skb,
184 int code, int pos); 184 int code, int pos);
185
186struct flowi;
187struct in6_addr;
188extern void icmpv6_flow_init(struct sock *sk,
189 struct flowi *fl,
190 u8 type,
191 const struct in6_addr *saddr,
192 const struct in6_addr *daddr,
193 int oif);
185#endif 194#endif
186 195
187#endif 196#endif
diff --git a/include/linux/ide.h b/include/linux/ide.h
index bc26b2f27359..b0135b0c3a04 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -23,7 +23,6 @@
23#include <asm/byteorder.h> 23#include <asm/byteorder.h>
24#include <asm/system.h> 24#include <asm/system.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/semaphore.h>
27#include <asm/mutex.h> 26#include <asm/mutex.h>
28 27
29#if defined(CONFIG_CRIS) || defined(CONFIG_FRV) 28#if defined(CONFIG_CRIS) || defined(CONFIG_FRV)
@@ -49,13 +48,6 @@ typedef unsigned char byte; /* used everywhere */
49#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 48#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
50 49
51/* 50/*
52 * Tune flags
53 */
54#define IDE_TUNE_NOAUTO 2
55#define IDE_TUNE_AUTO 1
56#define IDE_TUNE_DEFAULT 0
57
58/*
59 * state flags 51 * state flags
60 */ 52 */
61 53
@@ -69,37 +61,30 @@ typedef unsigned char byte; /* used everywhere */
69 */ 61 */
70#define IDE_NR_PORTS (10) 62#define IDE_NR_PORTS (10)
71 63
72#define IDE_DATA_OFFSET (0) 64struct ide_io_ports {
73#define IDE_ERROR_OFFSET (1) 65 unsigned long data_addr;
74#define IDE_NSECTOR_OFFSET (2) 66
75#define IDE_SECTOR_OFFSET (3) 67 union {
76#define IDE_LCYL_OFFSET (4) 68 unsigned long error_addr; /* read: error */
77#define IDE_HCYL_OFFSET (5) 69 unsigned long feature_addr; /* write: feature */
78#define IDE_SELECT_OFFSET (6) 70 };
79#define IDE_STATUS_OFFSET (7) 71
80#define IDE_CONTROL_OFFSET (8) 72 unsigned long nsect_addr;
81#define IDE_IRQ_OFFSET (9) 73 unsigned long lbal_addr;
82 74 unsigned long lbam_addr;
83#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET 75 unsigned long lbah_addr;
84#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET 76
85 77 unsigned long device_addr;
86#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) 78
87#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) 79 union {
88#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) 80 unsigned long status_addr; /*  read: status  */
89#define IDE_SECTOR_REG (HWIF(drive)->io_ports[IDE_SECTOR_OFFSET]) 81 unsigned long command_addr; /* write: command */
90#define IDE_LCYL_REG (HWIF(drive)->io_ports[IDE_LCYL_OFFSET]) 82 };
91#define IDE_HCYL_REG (HWIF(drive)->io_ports[IDE_HCYL_OFFSET]) 83
92#define IDE_SELECT_REG (HWIF(drive)->io_ports[IDE_SELECT_OFFSET]) 84 unsigned long ctl_addr;
93#define IDE_STATUS_REG (HWIF(drive)->io_ports[IDE_STATUS_OFFSET]) 85
94#define IDE_CONTROL_REG (HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]) 86 unsigned long irq_addr;
95#define IDE_IRQ_REG (HWIF(drive)->io_ports[IDE_IRQ_OFFSET]) 87};
96
97#define IDE_FEATURE_REG IDE_ERROR_REG
98#define IDE_COMMAND_REG IDE_STATUS_REG
99#define IDE_ALTSTATUS_REG IDE_CONTROL_REG
100#define IDE_IREASON_REG IDE_NSECTOR_REG
101#define IDE_BCOUNTL_REG IDE_LCYL_REG
102#define IDE_BCOUNTH_REG IDE_HCYL_REG
103 88
104#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) 89#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good))
105#define BAD_R_STAT (BUSY_STAT | ERR_STAT) 90#define BAD_R_STAT (BUSY_STAT | ERR_STAT)
@@ -169,7 +154,7 @@ enum { ide_unknown, ide_generic, ide_pci,
169 ide_rz1000, ide_trm290, 154 ide_rz1000, ide_trm290,
170 ide_cmd646, ide_cy82c693, ide_4drives, 155 ide_cmd646, ide_cy82c693, ide_4drives,
171 ide_pmac, ide_etrax100, ide_acorn, 156 ide_pmac, ide_etrax100, ide_acorn,
172 ide_au1xxx, ide_palm3710, ide_forced 157 ide_au1xxx, ide_palm3710
173}; 158};
174 159
175typedef u8 hwif_chipset_t; 160typedef u8 hwif_chipset_t;
@@ -178,32 +163,30 @@ typedef u8 hwif_chipset_t;
178 * Structure to hold all information about the location of this port 163 * Structure to hold all information about the location of this port
179 */ 164 */
180typedef struct hw_regs_s { 165typedef struct hw_regs_s {
181 unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ 166 union {
167 struct ide_io_ports io_ports;
168 unsigned long io_ports_array[IDE_NR_PORTS];
169 };
170
182 int irq; /* our irq number */ 171 int irq; /* our irq number */
183 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ 172 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
184 hwif_chipset_t chipset; 173 hwif_chipset_t chipset;
185 struct device *dev; 174 struct device *dev;
186} hw_regs_t; 175} hw_regs_t;
187 176
188struct hwif_s * ide_find_port(unsigned long);
189struct hwif_s *ide_deprecated_find_port(unsigned long);
190void ide_init_port_data(struct hwif_s *, unsigned int); 177void ide_init_port_data(struct hwif_s *, unsigned int);
191void ide_init_port_hw(struct hwif_s *, hw_regs_t *); 178void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
192 179
193struct ide_drive_s;
194int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *),
195 struct hwif_s **);
196
197static inline void ide_std_init_ports(hw_regs_t *hw, 180static inline void ide_std_init_ports(hw_regs_t *hw,
198 unsigned long io_addr, 181 unsigned long io_addr,
199 unsigned long ctl_addr) 182 unsigned long ctl_addr)
200{ 183{
201 unsigned int i; 184 unsigned int i;
202 185
203 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) 186 for (i = 0; i <= 7; i++)
204 hw->io_ports[i] = io_addr++; 187 hw->io_ports_array[i] = io_addr++;
205 188
206 hw->io_ports[IDE_CONTROL_OFFSET] = ctl_addr; 189 hw->io_ports.ctl_addr = ctl_addr;
207} 190}
208 191
209#include <asm/ide.h> 192#include <asm/ide.h>
@@ -213,45 +196,6 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
213#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS 196#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS
214#endif 197#endif
215 198
216/* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */
217#ifndef IDE_ARCH_OBSOLETE_DEFAULTS
218# define ide_default_io_base(index) (0)
219# define ide_default_irq(base) (0)
220# define ide_init_default_irq(base) (0)
221#endif
222
223#ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT
224static inline void ide_init_hwif_ports(hw_regs_t *hw,
225 unsigned long io_addr,
226 unsigned long ctl_addr,
227 int *irq)
228{
229 if (!ctl_addr)
230 ide_std_init_ports(hw, io_addr, ide_default_io_ctl(io_addr));
231 else
232 ide_std_init_ports(hw, io_addr, ctl_addr);
233
234 if (irq)
235 *irq = 0;
236
237 hw->io_ports[IDE_IRQ_OFFSET] = 0;
238
239#ifdef CONFIG_PPC32
240 if (ppc_ide_md.ide_init_hwif)
241 ppc_ide_md.ide_init_hwif(hw, io_addr, ctl_addr, irq);
242#endif
243}
244#else
245static inline void ide_init_hwif_ports(hw_regs_t *hw,
246 unsigned long io_addr,
247 unsigned long ctl_addr,
248 int *irq)
249{
250 if (io_addr || ctl_addr)
251 printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__);
252}
253#endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */
254
255/* Currently only m68k, apus and m8xx need it */ 199/* Currently only m68k, apus and m8xx need it */
256#ifndef IDE_ARCH_ACK_INTR 200#ifndef IDE_ARCH_ACK_INTR
257# define ide_ack_intr(hwif) (1) 201# define ide_ack_intr(hwif) (1)
@@ -388,7 +332,6 @@ typedef struct ide_drive_s {
388 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ 332 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */
389 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ 333 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */
390 unsigned nodma : 1; /* disallow DMA */ 334 unsigned nodma : 1; /* disallow DMA */
391 unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */
392 unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ 335 unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */
393 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ 336 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */
394 unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */ 337 unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */
@@ -406,7 +349,7 @@ typedef struct ide_drive_s {
406 u8 wcache; /* status of write cache */ 349 u8 wcache; /* status of write cache */
407 u8 acoustic; /* acoustic management */ 350 u8 acoustic; /* acoustic management */
408 u8 media; /* disk, cdrom, tape, floppy, ... */ 351 u8 media; /* disk, cdrom, tape, floppy, ... */
409 u8 ctl; /* "normal" value for IDE_CONTROL_REG */ 352 u8 ctl; /* "normal" value for Control register */
410 u8 ready_stat; /* min status value for drive ready */ 353 u8 ready_stat; /* min status value for drive ready */
411 u8 mult_count; /* current multiple sector setting */ 354 u8 mult_count; /* current multiple sector setting */
412 u8 mult_req; /* requested multiple sector setting */ 355 u8 mult_req; /* requested multiple sector setting */
@@ -447,6 +390,45 @@ typedef struct ide_drive_s {
447 390
448struct ide_port_info; 391struct ide_port_info;
449 392
393struct ide_port_ops {
394 /* host specific initialization of devices on a port */
395 void (*port_init_devs)(struct hwif_s *);
396 /* routine to program host for PIO mode */
397 void (*set_pio_mode)(ide_drive_t *, const u8);
398 /* routine to program host for DMA mode */
399 void (*set_dma_mode)(ide_drive_t *, const u8);
400 /* tweaks hardware to select drive */
401 void (*selectproc)(ide_drive_t *);
402 /* chipset polling based on hba specifics */
403 int (*reset_poll)(ide_drive_t *);
404 /* chipset specific changes to default for device-hba resets */
405 void (*pre_reset)(ide_drive_t *);
406 /* routine to reset controller after a disk reset */
407 void (*resetproc)(ide_drive_t *);
408 /* special host masking for drive selection */
409 void (*maskproc)(ide_drive_t *, int);
410 /* check host's drive quirk list */
411 void (*quirkproc)(ide_drive_t *);
412
413 u8 (*mdma_filter)(ide_drive_t *);
414 u8 (*udma_filter)(ide_drive_t *);
415
416 u8 (*cable_detect)(struct hwif_s *);
417};
418
419struct ide_dma_ops {
420 void (*dma_host_set)(struct ide_drive_s *, int);
421 int (*dma_setup)(struct ide_drive_s *);
422 void (*dma_exec_cmd)(struct ide_drive_s *, u8);
423 void (*dma_start)(struct ide_drive_s *);
424 int (*dma_end)(struct ide_drive_s *);
425 int (*dma_test_irq)(struct ide_drive_s *);
426 void (*dma_lost_irq)(struct ide_drive_s *);
427 void (*dma_timeout)(struct ide_drive_s *);
428};
429
430struct ide_task_s;
431
450typedef struct hwif_s { 432typedef struct hwif_s {
451 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ 433 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
452 struct hwif_s *mate; /* other hwif from same PCI chip */ 434 struct hwif_s *mate; /* other hwif from same PCI chip */
@@ -455,8 +437,8 @@ typedef struct hwif_s {
455 437
456 char name[6]; /* name of interface, eg. "ide0" */ 438 char name[6]; /* name of interface, eg. "ide0" */
457 439
458 /* task file registers for pata and sata */ 440 struct ide_io_ports io_ports;
459 unsigned long io_ports[IDE_NR_PORTS]; 441
460 unsigned long sata_scr[SATA_NR_PORTS]; 442 unsigned long sata_scr[SATA_NR_PORTS];
461 443
462 ide_drive_t drives[MAX_DRIVES]; /* drive info */ 444 ide_drive_t drives[MAX_DRIVES]; /* drive info */
@@ -480,67 +462,25 @@ typedef struct hwif_s {
480 462
481 struct device *dev; 463 struct device *dev;
482 464
483 const struct ide_port_info *cds; /* chipset device struct */
484
485 ide_ack_intr_t *ack_intr; 465 ide_ack_intr_t *ack_intr;
486 466
487 void (*rw_disk)(ide_drive_t *, struct request *); 467 void (*rw_disk)(ide_drive_t *, struct request *);
488 468
489#if 0 469 const struct ide_port_ops *port_ops;
490 ide_hwif_ops_t *hwifops; 470 const struct ide_dma_ops *dma_ops;
491#else
492 /* host specific initialization of devices on a port */
493 void (*port_init_devs)(struct hwif_s *);
494 /* routine to program host for PIO mode */
495 void (*set_pio_mode)(ide_drive_t *, const u8);
496 /* routine to program host for DMA mode */
497 void (*set_dma_mode)(ide_drive_t *, const u8);
498 /* tweaks hardware to select drive */
499 void (*selectproc)(ide_drive_t *);
500 /* chipset polling based on hba specifics */
501 int (*reset_poll)(ide_drive_t *);
502 /* chipset specific changes to default for device-hba resets */
503 void (*pre_reset)(ide_drive_t *);
504 /* routine to reset controller after a disk reset */
505 void (*resetproc)(ide_drive_t *);
506 /* special host masking for drive selection */
507 void (*maskproc)(ide_drive_t *, int);
508 /* check host's drive quirk list */
509 void (*quirkproc)(ide_drive_t *);
510 /* driver soft-power interface */
511 int (*busproc)(ide_drive_t *, int);
512#endif
513 u8 (*mdma_filter)(ide_drive_t *);
514 u8 (*udma_filter)(ide_drive_t *);
515
516 u8 (*cable_detect)(struct hwif_s *);
517 471
518 void (*ata_input_data)(ide_drive_t *, void *, u32); 472 void (*tf_load)(ide_drive_t *, struct ide_task_s *);
519 void (*ata_output_data)(ide_drive_t *, void *, u32); 473 void (*tf_read)(ide_drive_t *, struct ide_task_s *);
520 474
521 void (*atapi_input_bytes)(ide_drive_t *, void *, u32); 475 void (*input_data)(ide_drive_t *, struct request *, void *, unsigned);
522 void (*atapi_output_bytes)(ide_drive_t *, void *, u32); 476 void (*output_data)(ide_drive_t *, struct request *, void *, unsigned);
523 477
524 void (*dma_host_set)(ide_drive_t *, int);
525 int (*dma_setup)(ide_drive_t *);
526 void (*dma_exec_cmd)(ide_drive_t *, u8);
527 void (*dma_start)(ide_drive_t *);
528 int (*ide_dma_end)(ide_drive_t *drive);
529 int (*ide_dma_test_irq)(ide_drive_t *drive);
530 void (*ide_dma_clear_irq)(ide_drive_t *drive); 478 void (*ide_dma_clear_irq)(ide_drive_t *drive);
531 void (*dma_lost_irq)(ide_drive_t *drive);
532 void (*dma_timeout)(ide_drive_t *drive);
533 479
534 void (*OUTB)(u8 addr, unsigned long port); 480 void (*OUTB)(u8 addr, unsigned long port);
535 void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); 481 void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port);
536 void (*OUTW)(u16 addr, unsigned long port);
537 void (*OUTSW)(unsigned long port, void *addr, u32 count);
538 void (*OUTSL)(unsigned long port, void *addr, u32 count);
539 482
540 u8 (*INB)(unsigned long port); 483 u8 (*INB)(unsigned long port);
541 u16 (*INW)(unsigned long port);
542 void (*INSW)(unsigned long port, void *addr, u32 count);
543 void (*INSL)(unsigned long port, void *addr, u32 count);
544 484
545 /* dma physical region descriptor table (cpu view) */ 485 /* dma physical region descriptor table (cpu view) */
546 unsigned int *dmatable_cpu; 486 unsigned int *dmatable_cpu;
@@ -565,10 +505,7 @@ typedef struct hwif_s {
565 505
566 unsigned long dma_base; /* base addr for dma ports */ 506 unsigned long dma_base; /* base addr for dma ports */
567 unsigned long dma_command; /* dma command register */ 507 unsigned long dma_command; /* dma command register */
568 unsigned long dma_vendor1; /* dma vendor 1 register */
569 unsigned long dma_status; /* dma status register */ 508 unsigned long dma_status; /* dma status register */
570 unsigned long dma_vendor3; /* dma vendor 3 register */
571 unsigned long dma_prdtable; /* actual prd table address */
572 509
573 unsigned long config_data; /* for use by chipset-specific code */ 510 unsigned long config_data; /* for use by chipset-specific code */
574 unsigned long select_data; /* for use by chipset-specific code */ 511 unsigned long select_data; /* for use by chipset-specific code */
@@ -576,17 +513,15 @@ typedef struct hwif_s {
576 unsigned long extra_base; /* extra addr for dma ports */ 513 unsigned long extra_base; /* extra addr for dma ports */
577 unsigned extra_ports; /* number of extra dma ports */ 514 unsigned extra_ports; /* number of extra dma ports */
578 515
579 unsigned noprobe : 1; /* don't probe for this interface */
580 unsigned present : 1; /* this interface exists */ 516 unsigned present : 1; /* this interface exists */
581 unsigned hold : 1; /* this interface is always present */
582 unsigned serialized : 1; /* serialized all channel operation */ 517 unsigned serialized : 1; /* serialized all channel operation */
583 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ 518 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
584 unsigned reset : 1; /* reset after probe */
585 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 519 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
586 unsigned mmio : 1; /* host uses MMIO */ 520 unsigned mmio : 1; /* host uses MMIO */
587 unsigned straight8 : 1; /* Alan's straight 8 check */
588 521
589 struct device gendev; 522 struct device gendev;
523 struct device *portdev;
524
590 struct completion gendev_rel_comp; /* To deal with device release() */ 525 struct completion gendev_rel_comp; /* To deal with device release() */
591 526
592 void *hwif_data; /* extra hwif data */ 527 void *hwif_data; /* extra hwif data */
@@ -605,7 +540,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
605typedef int (ide_expiry_t)(ide_drive_t *); 540typedef int (ide_expiry_t)(ide_drive_t *);
606 541
607/* used by ide-cd, ide-floppy, etc. */ 542/* used by ide-cd, ide-floppy, etc. */
608typedef void (xfer_func_t)(ide_drive_t *, void *, u32); 543typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned);
609 544
610typedef struct hwgroup_s { 545typedef struct hwgroup_s {
611 /* irq handler, if active */ 546 /* irq handler, if active */
@@ -647,6 +582,68 @@ int set_io_32bit(ide_drive_t *, int);
647int set_pio_mode(ide_drive_t *, int); 582int set_pio_mode(ide_drive_t *, int);
648int set_using_dma(ide_drive_t *, int); 583int set_using_dma(ide_drive_t *, int);
649 584
585/* ATAPI packet command flags */
586enum {
587 /* set when an error is considered normal - no retry (ide-tape) */
588 PC_FLAG_ABORT = (1 << 0),
589 PC_FLAG_SUPPRESS_ERROR = (1 << 1),
590 PC_FLAG_WAIT_FOR_DSC = (1 << 2),
591 PC_FLAG_DMA_OK = (1 << 3),
592 PC_FLAG_DMA_RECOMMENDED = (1 << 4),
593 PC_FLAG_DMA_IN_PROGRESS = (1 << 5),
594 PC_FLAG_DMA_ERROR = (1 << 6),
595 PC_FLAG_WRITING = (1 << 7),
596 /* command timed out */
597 PC_FLAG_TIMEDOUT = (1 << 8),
598};
599
600struct ide_atapi_pc {
601 /* actual packet bytes */
602 u8 c[12];
603 /* incremented on each retry */
604 int retries;
605 int error;
606
607 /* bytes to transfer */
608 int req_xfer;
609 /* bytes actually transferred */
610 int xferred;
611
612 /* data buffer */
613 u8 *buf;
614 /* current buffer position */
615 u8 *cur_pos;
616 int buf_size;
617 /* missing/available data on the current buffer */
618 int b_count;
619
620 /* the corresponding request */
621 struct request *rq;
622
623 unsigned long flags;
624
625 /*
626 * those are more or less driver-specific and some of them are subject
627 * to change/removal later.
628 */
629 u8 pc_buf[256];
630 void (*idefloppy_callback) (ide_drive_t *);
631 ide_startstop_t (*idetape_callback) (ide_drive_t *);
632
633 /* idetape only */
634 struct idetape_bh *bh;
635 char *b_data;
636
637 /* idescsi only for now */
638 struct scatterlist *sg;
639 unsigned int sg_cnt;
640
641 struct scsi_cmnd *scsi_cmd;
642 void (*done) (struct scsi_cmnd *);
643
644 unsigned long timeout;
645};
646
650#ifdef CONFIG_IDE_PROC_FS 647#ifdef CONFIG_IDE_PROC_FS
651/* 648/*
652 * configurable drive settings 649 * configurable drive settings
@@ -691,6 +688,7 @@ void proc_ide_create(void);
691void proc_ide_destroy(void); 688void proc_ide_destroy(void);
692void ide_proc_register_port(ide_hwif_t *); 689void ide_proc_register_port(ide_hwif_t *);
693void ide_proc_port_register_devices(ide_hwif_t *); 690void ide_proc_port_register_devices(ide_hwif_t *);
691void ide_proc_unregister_device(ide_drive_t *);
694void ide_proc_unregister_port(ide_hwif_t *); 692void ide_proc_unregister_port(ide_hwif_t *);
695void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 693void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
696void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 694void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
@@ -700,10 +698,6 @@ void ide_add_generic_settings(ide_drive_t *);
700read_proc_t proc_ide_read_capacity; 698read_proc_t proc_ide_read_capacity;
701read_proc_t proc_ide_read_geometry; 699read_proc_t proc_ide_read_geometry;
702 700
703#ifdef CONFIG_BLK_DEV_IDEPCI
704void ide_pci_create_host_proc(const char *, get_info_t *);
705#endif
706
707/* 701/*
708 * Standard exit stuff: 702 * Standard exit stuff:
709 */ 703 */
@@ -724,6 +718,7 @@ static inline void proc_ide_create(void) { ; }
724static inline void proc_ide_destroy(void) { ; } 718static inline void proc_ide_destroy(void) { ; }
725static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } 719static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
726static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } 720static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
721static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; }
727static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 722static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
728static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 723static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
729static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 724static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
@@ -803,8 +798,21 @@ int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsig
803#ifndef _IDE_C 798#ifndef _IDE_C
804extern ide_hwif_t ide_hwifs[]; /* master data repository */ 799extern ide_hwif_t ide_hwifs[]; /* master data repository */
805#endif 800#endif
801extern int ide_noacpi;
802extern int ide_acpigtf;
803extern int ide_acpionboot;
806extern int noautodma; 804extern int noautodma;
807 805
806extern int ide_vlb_clk;
807extern int ide_pci_clk;
808
809ide_hwif_t *ide_find_port_slot(const struct ide_port_info *);
810
811static inline ide_hwif_t *ide_find_port(void)
812{
813 return ide_find_port_slot(NULL);
814}
815
808extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); 816extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);
809int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, 817int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
810 int uptodate, int nr_sectors); 818 int uptodate, int nr_sectors);
@@ -814,6 +822,10 @@ extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigne
814void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, 822void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
815 ide_expiry_t *); 823 ide_expiry_t *);
816 824
825void ide_execute_pkt_cmd(ide_drive_t *);
826
827void ide_pad_transfer(ide_drive_t *, int, int);
828
817ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 829ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
818 830
819ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); 831ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
@@ -950,8 +962,7 @@ typedef struct ide_task_s {
950 void *special; /* valid_t generally */ 962 void *special; /* valid_t generally */
951} ide_task_t; 963} ide_task_t;
952 964
953void ide_tf_load(ide_drive_t *, ide_task_t *); 965void ide_tf_dump(const char *, struct ide_taskfile *);
954void ide_tf_read(ide_drive_t *, ide_task_t *);
955 966
956extern void SELECT_DRIVE(ide_drive_t *); 967extern void SELECT_DRIVE(ide_drive_t *);
957extern void SELECT_MASK(ide_drive_t *, int); 968extern void SELECT_MASK(ide_drive_t *, int);
@@ -990,7 +1001,6 @@ extern void do_ide_request(struct request_queue *);
990void ide_init_disk(struct gendisk *, ide_drive_t *); 1001void ide_init_disk(struct gendisk *, ide_drive_t *);
991 1002
992#ifdef CONFIG_IDEPCI_PCIBUS_ORDER 1003#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
993extern int ide_scan_direction;
994extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); 1004extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
995#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) 1005#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
996#else 1006#else
@@ -1001,10 +1011,15 @@ void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8
1001void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); 1011void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1002 1012
1003#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 1013#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
1004void ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); 1014int ide_pci_set_master(struct pci_dev *, const char *);
1015unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *);
1016int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *);
1005#else 1017#else
1006static inline void ide_hwif_setup_dma(ide_hwif_t *hwif, 1018static inline int ide_hwif_setup_dma(ide_hwif_t *hwif,
1007 const struct ide_port_info *d) { } 1019 const struct ide_port_info *d)
1020{
1021 return -EINVAL;
1022}
1008#endif 1023#endif
1009 1024
1010extern void default_hwif_iops(ide_hwif_t *); 1025extern void default_hwif_iops(ide_hwif_t *);
@@ -1024,8 +1039,8 @@ enum {
1024 IDE_HFLAG_SINGLE = (1 << 1), 1039 IDE_HFLAG_SINGLE = (1 << 1),
1025 /* don't use legacy PIO blacklist */ 1040 /* don't use legacy PIO blacklist */
1026 IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), 1041 IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2),
1027 /* don't use conservative PIO "downgrade" */ 1042 /* set for the second port of QD65xx */
1028 IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3), 1043 IDE_HFLAG_QD_2ND_PORT = (1 << 3),
1029 /* use PIO8/9 for prefetch off/on */ 1044 /* use PIO8/9 for prefetch off/on */
1030 IDE_HFLAG_ABUSE_PREFETCH = (1 << 4), 1045 IDE_HFLAG_ABUSE_PREFETCH = (1 << 4),
1031 /* use PIO6/7 for fast-devsel off/on */ 1046 /* use PIO6/7 for fast-devsel off/on */
@@ -1047,14 +1062,14 @@ enum {
1047 IDE_HFLAG_VDMA = (1 << 11), 1062 IDE_HFLAG_VDMA = (1 << 11),
1048 /* ATAPI DMA is unsupported */ 1063 /* ATAPI DMA is unsupported */
1049 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), 1064 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
1050 /* set if host is a "bootable" controller */ 1065 /* set if host is a "non-bootable" controller */
1051 IDE_HFLAG_BOOTABLE = (1 << 13), 1066 IDE_HFLAG_NON_BOOTABLE = (1 << 13),
1052 /* host doesn't support DMA */ 1067 /* host doesn't support DMA */
1053 IDE_HFLAG_NO_DMA = (1 << 14), 1068 IDE_HFLAG_NO_DMA = (1 << 14),
1054 /* check if host is PCI IDE device before allowing DMA */ 1069 /* check if host is PCI IDE device before allowing DMA */
1055 IDE_HFLAG_NO_AUTODMA = (1 << 15), 1070 IDE_HFLAG_NO_AUTODMA = (1 << 15),
1056 /* don't autotune PIO */ 1071 /* host uses MMIO */
1057 IDE_HFLAG_NO_AUTOTUNE = (1 << 16), 1072 IDE_HFLAG_MMIO = (1 << 16),
1058 /* host is CS5510/CS5520 */ 1073 /* host is CS5510/CS5520 */
1059 IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, 1074 IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA,
1060 /* no LBA48 */ 1075 /* no LBA48 */
@@ -1076,8 +1091,8 @@ enum {
1076 /* unmask IRQs */ 1091 /* unmask IRQs */
1077 IDE_HFLAG_UNMASK_IRQS = (1 << 25), 1092 IDE_HFLAG_UNMASK_IRQS = (1 << 25),
1078 IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), 1093 IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26),
1079 /* host is CY82C693 */ 1094 /* serialize ports if DMA is possible (for sl82c105) */
1080 IDE_HFLAG_CY82C693 = (1 << 27), 1095 IDE_HFLAG_SERIALIZE_DMA = (1 << 27),
1081 /* force host out of "simplex" mode */ 1096 /* force host out of "simplex" mode */
1082 IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), 1097 IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28),
1083 /* DSC overlap is unsupported */ 1098 /* DSC overlap is unsupported */
@@ -1089,9 +1104,9 @@ enum {
1089}; 1104};
1090 1105
1091#ifdef CONFIG_BLK_DEV_OFFBOARD 1106#ifdef CONFIG_BLK_DEV_OFFBOARD
1092# define IDE_HFLAG_OFF_BOARD IDE_HFLAG_BOOTABLE
1093#else
1094# define IDE_HFLAG_OFF_BOARD 0 1107# define IDE_HFLAG_OFF_BOARD 0
1108#else
1109# define IDE_HFLAG_OFF_BOARD IDE_HFLAG_NON_BOOTABLE
1095#endif 1110#endif
1096 1111
1097struct ide_port_info { 1112struct ide_port_info {
@@ -1099,10 +1114,14 @@ struct ide_port_info {
1099 unsigned int (*init_chipset)(struct pci_dev *, const char *); 1114 unsigned int (*init_chipset)(struct pci_dev *, const char *);
1100 void (*init_iops)(ide_hwif_t *); 1115 void (*init_iops)(ide_hwif_t *);
1101 void (*init_hwif)(ide_hwif_t *); 1116 void (*init_hwif)(ide_hwif_t *);
1102 void (*init_dma)(ide_hwif_t *, unsigned long); 1117 int (*init_dma)(ide_hwif_t *,
1118 const struct ide_port_info *);
1119
1120 const struct ide_port_ops *port_ops;
1121 const struct ide_dma_ops *dma_ops;
1122
1103 ide_pci_enablebit_t enablebits[2]; 1123 ide_pci_enablebit_t enablebits[2];
1104 hwif_chipset_t chipset; 1124 hwif_chipset_t chipset;
1105 u8 extra;
1106 u32 host_flags; 1125 u32 host_flags;
1107 u8 pio_mask; 1126 u8 pio_mask;
1108 u8 swdma_mask; 1127 u8 swdma_mask;
@@ -1149,13 +1168,16 @@ void ide_destroy_dmatable(ide_drive_t *);
1149 1168
1150#ifdef CONFIG_BLK_DEV_IDEDMA_SFF 1169#ifdef CONFIG_BLK_DEV_IDEDMA_SFF
1151extern int ide_build_dmatable(ide_drive_t *, struct request *); 1170extern int ide_build_dmatable(ide_drive_t *, struct request *);
1152extern int ide_release_dma(ide_hwif_t *); 1171int ide_allocate_dma_engine(ide_hwif_t *);
1153extern void ide_setup_dma(ide_hwif_t *, unsigned long); 1172void ide_release_dma_engine(ide_hwif_t *);
1173void ide_setup_dma(ide_hwif_t *, unsigned long);
1154 1174
1155void ide_dma_host_set(ide_drive_t *, int); 1175void ide_dma_host_set(ide_drive_t *, int);
1156extern int ide_dma_setup(ide_drive_t *); 1176extern int ide_dma_setup(ide_drive_t *);
1177void ide_dma_exec_cmd(ide_drive_t *, u8);
1157extern void ide_dma_start(ide_drive_t *); 1178extern void ide_dma_start(ide_drive_t *);
1158extern int __ide_dma_end(ide_drive_t *); 1179extern int __ide_dma_end(ide_drive_t *);
1180int ide_dma_test_irq(ide_drive_t *);
1159extern void ide_dma_lost_irq(ide_drive_t *); 1181extern void ide_dma_lost_irq(ide_drive_t *);
1160extern void ide_dma_timeout(ide_drive_t *); 1182extern void ide_dma_timeout(ide_drive_t *);
1161#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ 1183#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
@@ -1173,7 +1195,7 @@ static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1173#endif /* CONFIG_BLK_DEV_IDEDMA */ 1195#endif /* CONFIG_BLK_DEV_IDEDMA */
1174 1196
1175#ifndef CONFIG_BLK_DEV_IDEDMA_SFF 1197#ifndef CONFIG_BLK_DEV_IDEDMA_SFF
1176static inline void ide_release_dma(ide_hwif_t *drive) {;} 1198static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; }
1177#endif 1199#endif
1178 1200
1179#ifdef CONFIG_BLK_DEV_IDEACPI 1201#ifdef CONFIG_BLK_DEV_IDEACPI
@@ -1193,17 +1215,20 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1193#endif 1215#endif
1194 1216
1195void ide_remove_port_from_hwgroup(ide_hwif_t *); 1217void ide_remove_port_from_hwgroup(ide_hwif_t *);
1196extern int ide_hwif_request_regions(ide_hwif_t *hwif); 1218void ide_unregister(ide_hwif_t *);
1197extern void ide_hwif_release_regions(ide_hwif_t* hwif);
1198void ide_unregister(unsigned int, int, int);
1199 1219
1200void ide_register_region(struct gendisk *); 1220void ide_register_region(struct gendisk *);
1201void ide_unregister_region(struct gendisk *); 1221void ide_unregister_region(struct gendisk *);
1202 1222
1203void ide_undecoded_slave(ide_drive_t *); 1223void ide_undecoded_slave(ide_drive_t *);
1204 1224
1225void ide_port_apply_params(ide_hwif_t *);
1226
1205int ide_device_add_all(u8 *idx, const struct ide_port_info *); 1227int ide_device_add_all(u8 *idx, const struct ide_port_info *);
1206int ide_device_add(u8 idx[4], const struct ide_port_info *); 1228int ide_device_add(u8 idx[4], const struct ide_port_info *);
1229int ide_legacy_device_add(const struct ide_port_info *, unsigned long);
1230void ide_port_unregister_devices(ide_hwif_t *);
1231void ide_port_scan(ide_hwif_t *);
1207 1232
1208static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1233static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
1209{ 1234{
@@ -1279,6 +1304,7 @@ extern struct mutex ide_cfg_mtx;
1279#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) 1304#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0)
1280 1305
1281extern struct bus_type ide_bus_type; 1306extern struct bus_type ide_bus_type;
1307extern struct class *ide_port_class;
1282 1308
1283/* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ 1309/* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */
1284#define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) 1310#define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000)
@@ -1307,28 +1333,29 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
1307 1333
1308static inline void ide_set_irq(ide_drive_t *drive, int on) 1334static inline void ide_set_irq(ide_drive_t *drive, int on)
1309{ 1335{
1310 drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG); 1336 ide_hwif_t *hwif = drive->hwif;
1337
1338 hwif->OUTB(drive->ctl | (on ? 0 : 2), hwif->io_ports.ctl_addr);
1311} 1339}
1312 1340
1313static inline u8 ide_read_status(ide_drive_t *drive) 1341static inline u8 ide_read_status(ide_drive_t *drive)
1314{ 1342{
1315 ide_hwif_t *hwif = drive->hwif; 1343 ide_hwif_t *hwif = drive->hwif;
1316 1344
1317 return hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); 1345 return hwif->INB(hwif->io_ports.status_addr);
1318} 1346}
1319 1347
1320static inline u8 ide_read_altstatus(ide_drive_t *drive) 1348static inline u8 ide_read_altstatus(ide_drive_t *drive)
1321{ 1349{
1322 ide_hwif_t *hwif = drive->hwif; 1350 ide_hwif_t *hwif = drive->hwif;
1323 1351
1324 return hwif->INB(hwif->io_ports[IDE_CONTROL_OFFSET]); 1352 return hwif->INB(hwif->io_ports.ctl_addr);
1325} 1353}
1326 1354
1327static inline u8 ide_read_error(ide_drive_t *drive) 1355static inline u8 ide_read_error(ide_drive_t *drive)
1328{ 1356{
1329 ide_hwif_t *hwif = drive->hwif; 1357 ide_hwif_t *hwif = drive->hwif;
1330 1358
1331 return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]); 1359 return hwif->INB(hwif->io_ports.error_addr);
1332} 1360}
1333
1334#endif /* _IDE_H */ 1361#endif /* _IDE_H */
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 0edda411959c..9a2d762124de 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -14,6 +14,7 @@
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17#include <linux/init.h>
17 18
18#if BITS_PER_LONG == 32 19#if BITS_PER_LONG == 32
19# define IDR_BITS 5 20# define IDR_BITS 5
@@ -115,4 +116,6 @@ void ida_remove(struct ida *ida, int id);
115void ida_destroy(struct ida *ida); 116void ida_destroy(struct ida *ida);
116void ida_init(struct ida *ida); 117void ida_init(struct ida *ida);
117 118
119void __init idr_init_cache(void);
120
118#endif /* __IDR_H__ */ 121#endif /* __IDR_H__ */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index f577c8f1c66d..529f301d9372 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -97,6 +97,7 @@
97#define IEEE80211_MAX_FRAME_LEN 2352 97#define IEEE80211_MAX_FRAME_LEN 2352
98 98
99#define IEEE80211_MAX_SSID_LEN 32 99#define IEEE80211_MAX_SSID_LEN 32
100#define IEEE80211_MAX_MESH_ID_LEN 32
100 101
101struct ieee80211_hdr { 102struct ieee80211_hdr {
102 __le16 frame_control; 103 __le16 frame_control;
@@ -109,6 +110,16 @@ struct ieee80211_hdr {
109} __attribute__ ((packed)); 110} __attribute__ ((packed));
110 111
111 112
113struct ieee80211s_hdr {
114 u8 flags;
115 u8 ttl;
116 u8 seqnum[3];
117 u8 eaddr1[6];
118 u8 eaddr2[6];
119 u8 eaddr3[6];
120} __attribute__ ((packed));
121
122
112struct ieee80211_mgmt { 123struct ieee80211_mgmt {
113 __le16 frame_control; 124 __le16 frame_control;
114 __le16 duration; 125 __le16 duration;
@@ -206,6 +217,23 @@ struct ieee80211_mgmt {
206 __le16 params; 217 __le16 params;
207 __le16 reason_code; 218 __le16 reason_code;
208 } __attribute__((packed)) delba; 219 } __attribute__((packed)) delba;
220 struct{
221 u8 action_code;
222 /* capab_info for open and confirm,
223 * reason for close
224 */
225 __le16 aux;
226 /* Followed in plink_confirm by status
227 * code, AID and supported rates,
228 * and directly by supported rates in
229 * plink_open and plink_close
230 */
231 u8 variable[0];
232 } __attribute__((packed)) plink_action;
233 struct{
234 u8 action_code;
235 u8 variable[0];
236 } __attribute__((packed)) mesh_action;
209 } u; 237 } u;
210 } __attribute__ ((packed)) action; 238 } __attribute__ ((packed)) action;
211 } u; 239 } u;
@@ -437,6 +465,19 @@ enum ieee80211_eid {
437 WLAN_EID_TS_DELAY = 43, 465 WLAN_EID_TS_DELAY = 43,
438 WLAN_EID_TCLAS_PROCESSING = 44, 466 WLAN_EID_TCLAS_PROCESSING = 44,
439 WLAN_EID_QOS_CAPA = 46, 467 WLAN_EID_QOS_CAPA = 46,
468 /* 802.11s
469 *
470 * All mesh EID numbers are pending IEEE 802.11 ANA approval.
471 * The numbers have been incremented from those suggested in
472 * 802.11s/D2.0 so that MESH_CONFIG does not conflict with
473 * EXT_SUPP_RATES.
474 */
475 WLAN_EID_MESH_CONFIG = 51,
476 WLAN_EID_MESH_ID = 52,
477 WLAN_EID_PEER_LINK = 55,
478 WLAN_EID_PREQ = 68,
479 WLAN_EID_PREP = 69,
480 WLAN_EID_PERR = 70,
440 /* 802.11h */ 481 /* 802.11h */
441 WLAN_EID_PWR_CONSTRAINT = 32, 482 WLAN_EID_PWR_CONSTRAINT = 32,
442 WLAN_EID_PWR_CAPABILITY = 33, 483 WLAN_EID_PWR_CAPABILITY = 33,
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 296e8e86e91d..4d3401812e6c 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -156,6 +156,12 @@ static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
156{ 156{
157 return (struct arphdr *)skb_network_header(skb); 157 return (struct arphdr *)skb_network_header(skb);
158} 158}
159
160static inline int arp_hdr_len(struct net_device *dev)
161{
162 /* ARP header, plus 2 device addresses, plus 2 IP addresses. */
163 return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2;
164}
159#endif 165#endif
160 166
161#endif /* _LINUX_IF_ARP_H */ 167#endif /* _LINUX_IF_ARP_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 0d9d7ea2c1cc..5f200bac3749 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -1,9 +1,6 @@
1#ifndef _LINUX_IF_MACVLAN_H 1#ifndef _LINUX_IF_MACVLAN_H
2#define _LINUX_IF_MACVLAN_H 2#define _LINUX_IF_MACVLAN_H
3 3
4#ifdef __KERNEL__
5
6extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); 4extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *);
7 5
8#endif /* __KERNEL__ */
9#endif /* _LINUX_IF_MACVLAN_H */ 6#endif /* _LINUX_IF_MACVLAN_H */
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 40743e032845..6fb7f1788570 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -24,7 +24,6 @@
24#include <linux/if_ether.h> 24#include <linux/if_ether.h>
25#include <linux/if.h> 25#include <linux/if.h>
26#include <linux/netdevice.h> 26#include <linux/netdevice.h>
27#include <asm/semaphore.h>
28#include <linux/ppp_channel.h> 27#include <linux/ppp_channel.h>
29#endif /* __KERNEL__ */ 28#endif /* __KERNEL__ */
30#include <linux/if_pppol2tp.h> 29#include <linux/if_pppol2tp.h>
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 228eb4eb3129..f1fbe9c930d7 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -7,6 +7,10 @@
7#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) 7#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
8#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) 8#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2)
9#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) 9#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3)
10#define SIOCGETPRL (SIOCDEVPRIVATE + 4)
11#define SIOCADDPRL (SIOCDEVPRIVATE + 5)
12#define SIOCDELPRL (SIOCDEVPRIVATE + 6)
13#define SIOCCHGPRL (SIOCDEVPRIVATE + 7)
10 14
11#define GRE_CSUM __constant_htons(0x8000) 15#define GRE_CSUM __constant_htons(0x8000)
12#define GRE_ROUTING __constant_htons(0x4000) 16#define GRE_ROUTING __constant_htons(0x4000)
@@ -17,9 +21,6 @@
17#define GRE_FLAGS __constant_htons(0x00F8) 21#define GRE_FLAGS __constant_htons(0x00F8)
18#define GRE_VERSION __constant_htons(0x0007) 22#define GRE_VERSION __constant_htons(0x0007)
19 23
20/* i_flags values for SIT mode */
21#define SIT_ISATAP 0x0001
22
23struct ip_tunnel_parm 24struct ip_tunnel_parm
24{ 25{
25 char name[IFNAMSIZ]; 26 char name[IFNAMSIZ];
@@ -31,4 +32,19 @@ struct ip_tunnel_parm
31 struct iphdr iph; 32 struct iphdr iph;
32}; 33};
33 34
35/* SIT-mode i_flags */
36#define SIT_ISATAP 0x0001
37
38struct ip_tunnel_prl {
39 __be32 addr;
40 __u16 flags;
41 __u16 __reserved;
42 __u32 datalen;
43 __u32 __reserved2;
44 void __user *data;
45};
46
47/* PRL flags */
48#define PRL_DEFAULT 0x0001
49
34#endif /* _IF_TUNNEL_H_ */ 50#endif /* _IF_TUNNEL_H_ */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 79504b22a932..15ace02b7b24 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -81,7 +81,9 @@ extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
81#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS) 81#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS)
82 82
83struct vlan_group { 83struct vlan_group {
84 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ 84 struct net_device *real_dev; /* The ethernet(like) device
85 * the vlan is attached to.
86 */
85 unsigned int nr_vlans; 87 unsigned int nr_vlans;
86 struct hlist_node hlist; /* linked list */ 88 struct hlist_node hlist; /* linked list */
87 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; 89 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
@@ -93,7 +95,7 @@ static inline struct net_device *vlan_group_get_device(struct vlan_group *vg,
93{ 95{
94 struct net_device **array; 96 struct net_device **array;
95 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; 97 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
96 return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN]; 98 return array ? array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] : NULL;
97} 99}
98 100
99static inline void vlan_group_set_device(struct vlan_group *vg, 101static inline void vlan_group_set_device(struct vlan_group *vg,
diff --git a/include/linux/if_wanpipe.h b/include/linux/if_wanpipe.h
deleted file mode 100644
index e594ca6069e5..000000000000
--- a/include/linux/if_wanpipe.h
+++ /dev/null
@@ -1,124 +0,0 @@
1/*****************************************************************************
2* if_wanpipe.h Header file for the Sangoma AF_WANPIPE Socket
3*
4* Author: Nenad Corbic
5*
6* Copyright: (c) 2000 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13*
14* Jan 28, 2000 Nenad Corbic Initial Version
15*
16*****************************************************************************/
17
18#ifndef __LINUX_IF_WAN_PACKET_H
19#define __LINUX_IF_WAN_PACKET_H
20
21struct wan_sockaddr_ll
22{
23 unsigned short sll_family;
24 unsigned short sll_protocol;
25 int sll_ifindex;
26 unsigned short sll_hatype;
27 unsigned char sll_pkttype;
28 unsigned char sll_halen;
29 unsigned char sll_addr[8];
30 unsigned char sll_device[14];
31 unsigned char sll_card[14];
32};
33
34typedef struct
35{
36 unsigned char free;
37 unsigned char state_sk;
38 int rcvbuf;
39 int sndbuf;
40 int rmem;
41 int wmem;
42 int sk_count;
43 unsigned char bound;
44 char name[14];
45 unsigned char d_state;
46 unsigned char svc;
47 unsigned short lcn;
48 unsigned char mbox;
49 unsigned char cmd_busy;
50 unsigned char command;
51 unsigned poll;
52 unsigned poll_cnt;
53 int rblock;
54} wan_debug_hdr_t;
55
56#define MAX_NUM_DEBUG 10
57#define X25_PROT 0x16
58#define PVC_PROT 0x17
59
60typedef struct
61{
62 wan_debug_hdr_t debug[MAX_NUM_DEBUG];
63}wan_debug_t;
64
65#define SIOC_WANPIPE_GET_CALL_DATA (SIOCPROTOPRIVATE + 0)
66#define SIOC_WANPIPE_SET_CALL_DATA (SIOCPROTOPRIVATE + 1)
67#define SIOC_WANPIPE_ACCEPT_CALL (SIOCPROTOPRIVATE + 2)
68#define SIOC_WANPIPE_CLEAR_CALL (SIOCPROTOPRIVATE + 3)
69#define SIOC_WANPIPE_RESET_CALL (SIOCPROTOPRIVATE + 4)
70#define SIOC_WANPIPE_DEBUG (SIOCPROTOPRIVATE + 5)
71#define SIOC_WANPIPE_SET_NONBLOCK (SIOCPROTOPRIVATE + 6)
72#define SIOC_WANPIPE_CHECK_TX (SIOCPROTOPRIVATE + 7)
73#define SIOC_WANPIPE_SOCK_STATE (SIOCPROTOPRIVATE + 8)
74
75/* Packet types */
76
77#define WAN_PACKET_HOST 0 /* To us */
78#define WAN_PACKET_BROADCAST 1 /* To all */
79#define WAN_PACKET_MULTICAST 2 /* To group */
80#define WAN_PACKET_OTHERHOST 3 /* To someone else */
81#define WAN_PACKET_OUTGOING 4 /* Outgoing of any type */
82/* These ones are invisible by user level */
83#define WAN_PACKET_LOOPBACK 5 /* MC/BRD frame looped back */
84#define WAN_PACKET_FASTROUTE 6 /* Fastrouted frame */
85
86
87/* X25 specific */
88#define WAN_PACKET_DATA 7
89#define WAN_PACKET_CMD 8
90#define WAN_PACKET_ASYNC 9
91#define WAN_PACKET_ERR 10
92
93/* Packet socket options */
94
95#define WAN_PACKET_ADD_MEMBERSHIP 1
96#define WAN_PACKET_DROP_MEMBERSHIP 2
97
98#define WAN_PACKET_MR_MULTICAST 0
99#define WAN_PACKET_MR_PROMISC 1
100#define WAN_PACKET_MR_ALLMULTI 2
101
102#ifdef __KERNEL__
103
104/* Private wanpipe socket structures. */
105struct wanpipe_opt
106{
107 void *mbox; /* Mail box */
108 void *card; /* Card bouded to */
109 struct net_device *dev; /* Bounded device */
110 unsigned short lcn; /* Binded LCN */
111 unsigned char svc; /* 0=pvc, 1=svc */
112 unsigned char timer; /* flag for delayed transmit*/
113 struct timer_list tx_timer;
114 unsigned poll_cnt;
115 unsigned char force; /* Used to force sock release */
116 atomic_t packet_sent;
117 unsigned short num;
118};
119
120#define wp_sk(__sk) ((struct wanpipe_opt *)(__sk)->sk_protinfo)
121
122#endif
123
124#endif
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index f510e7e382a8..f5a1a0db2e8e 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -80,27 +80,6 @@ struct igmpv3_query {
80 __be32 srcs[0]; 80 __be32 srcs[0];
81}; 81};
82 82
83#ifdef __KERNEL__
84#include <linux/skbuff.h>
85
86static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
87{
88 return (struct igmphdr *)skb_transport_header(skb);
89}
90
91static inline struct igmpv3_report *
92 igmpv3_report_hdr(const struct sk_buff *skb)
93{
94 return (struct igmpv3_report *)skb_transport_header(skb);
95}
96
97static inline struct igmpv3_query *
98 igmpv3_query_hdr(const struct sk_buff *skb)
99{
100 return (struct igmpv3_query *)skb_transport_header(skb);
101}
102#endif
103
104#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ 83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
105#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ 84#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
106#define IGMP_DVMRP 0x13 /* DVMRP routing */ 85#define IGMP_DVMRP 0x13 /* DVMRP routing */
@@ -151,6 +130,23 @@ static inline struct igmpv3_query *
151#include <linux/timer.h> 130#include <linux/timer.h>
152#include <linux/in.h> 131#include <linux/in.h>
153 132
133static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
134{
135 return (struct igmphdr *)skb_transport_header(skb);
136}
137
138static inline struct igmpv3_report *
139 igmpv3_report_hdr(const struct sk_buff *skb)
140{
141 return (struct igmpv3_report *)skb_transport_header(skb);
142}
143
144static inline struct igmpv3_query *
145 igmpv3_query_hdr(const struct sk_buff *skb)
146{
147 return (struct igmpv3_query *)skb_transport_header(skb);
148}
149
154extern int sysctl_igmp_max_memberships; 150extern int sysctl_igmp_max_memberships;
155extern int sysctl_igmp_max_msf; 151extern int sysctl_igmp_max_msf;
156 152
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 2a61c82af115..bc492048c349 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -48,6 +48,14 @@ extern const struct in6_addr in6addr_any;
48#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } 48#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
49extern const struct in6_addr in6addr_loopback; 49extern const struct in6_addr in6addr_loopback;
50#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } 50#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
51#ifdef __KERNEL__
52extern const struct in6_addr in6addr_linklocal_allnodes;
53#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
54 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
55extern const struct in6_addr in6addr_linklocal_allrouters;
56#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
57 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
58#endif
51 59
52struct sockaddr_in6 { 60struct sockaddr_in6 {
53 unsigned short int sin6_family; /* AF_INET6 */ 61 unsigned short int sin6_family; /* AF_INET6 */
@@ -249,4 +257,30 @@ struct in6_flowlabel_req
249 * IP6T_SO_GET_REVISION_TARGET 69 257 * IP6T_SO_GET_REVISION_TARGET 69
250 */ 258 */
251 259
260/* RFC5014: Source address selection */
261#define IPV6_ADDR_PREFERENCES 72
262
263#define IPV6_PREFER_SRC_TMP 0x0001
264#define IPV6_PREFER_SRC_PUBLIC 0x0002
265#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
266#define IPV6_PREFER_SRC_COA 0x0004
267#define IPV6_PREFER_SRC_HOME 0x0400
268#define IPV6_PREFER_SRC_CGA 0x0008
269#define IPV6_PREFER_SRC_NONCGA 0x0800
270
271/*
272 * Multicast Routing:
273 * see include/linux/mroute6.h.
274 *
275 * MRT6_INIT 200
276 * MRT6_DONE 201
277 * MRT6_ADD_MIF 202
278 * MRT6_DEL_MIF 203
279 * MRT6_ADD_MFC 204
280 * MRT6_DEL_MFC 205
281 * MRT6_VERSION 206
282 * MRT6_ASSERT 207
283 * MRT6_PIM 208
284 * (reserved) 209
285 */
252#endif 286#endif
diff --git a/include/linux/inet.h b/include/linux/inet.h
index 675a7dbe86f8..1354080cf8cf 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -42,11 +42,9 @@
42#ifndef _LINUX_INET_H 42#ifndef _LINUX_INET_H
43#define _LINUX_INET_H 43#define _LINUX_INET_H
44 44
45#ifdef __KERNEL__
46#include <linux/types.h> 45#include <linux/types.h>
47 46
48extern __be32 in_aton(const char *str); 47extern __be32 in_aton(const char *str);
49extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); 48extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
50extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); 49extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
51#endif
52#endif /* _LINUX_INET_H */ 50#endif /* _LINUX_INET_H */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index fc4e3db649e8..7009b0cdd06f 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -70,13 +70,13 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
70 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) 70 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))
71 71
72#define IN_DEV_ANDCONF(in_dev, attr) \ 72#define IN_DEV_ANDCONF(in_dev, attr) \
73 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \ 73 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \
74 IN_DEV_CONF_GET((in_dev), attr)) 74 IN_DEV_CONF_GET((in_dev), attr))
75#define IN_DEV_ORCONF(in_dev, attr) \ 75#define IN_DEV_ORCONF(in_dev, attr) \
76 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \ 76 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) || \
77 IN_DEV_CONF_GET((in_dev), attr)) 77 IN_DEV_CONF_GET((in_dev), attr))
78#define IN_DEV_MAXCONF(in_dev, attr) \ 78#define IN_DEV_MAXCONF(in_dev, attr) \
79 (max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \ 79 (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \
80 IN_DEV_CONF_GET((in_dev), attr))) 80 IN_DEV_CONF_GET((in_dev), attr)))
81 81
82#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) 82#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
@@ -129,7 +129,7 @@ extern int unregister_inetaddr_notifier(struct notifier_block *nb);
129 129
130extern struct net_device *ip_dev_find(struct net *net, __be32 addr); 130extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
131extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 131extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
132extern int devinet_ioctl(unsigned int cmd, void __user *); 132extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
133extern void devinet_init(void); 133extern void devinet_init(void);
134extern struct in_device *inetdev_by_index(struct net *, int); 134extern struct in_device *inetdev_by_index(struct net *, int);
135extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); 135extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
diff --git a/include/linux/init.h b/include/linux/init.h
index fb58c0493cf2..21d658cdfa27 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -147,6 +147,8 @@ extern unsigned int reset_devices;
147void setup_arch(char **); 147void setup_arch(char **);
148void prepare_namespace(void); 148void prepare_namespace(void);
149 149
150extern void (*late_time_init)(void);
151
150#endif 152#endif
151 153
152#ifndef MODULE 154#ifndef MODULE
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 1f74e1d7415f..bf6b8a61f8db 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -9,6 +9,7 @@
9#include <linux/ipc.h> 9#include <linux/ipc.h>
10#include <linux/pid_namespace.h> 10#include <linux/pid_namespace.h>
11#include <linux/user_namespace.h> 11#include <linux/user_namespace.h>
12#include <linux/securebits.h>
12#include <net/net_namespace.h> 13#include <net/net_namespace.h>
13 14
14#define INIT_FDTABLE \ 15#define INIT_FDTABLE \
@@ -151,6 +152,9 @@ extern struct group_info init_groups;
151 .cpus_allowed = CPU_MASK_ALL, \ 152 .cpus_allowed = CPU_MASK_ALL, \
152 .mm = NULL, \ 153 .mm = NULL, \
153 .active_mm = &init_mm, \ 154 .active_mm = &init_mm, \
155 .se = { \
156 .group_node = LIST_HEAD_INIT(tsk.se.group_node), \
157 }, \
154 .rt = { \ 158 .rt = { \
155 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \ 159 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
156 .time_slice = HZ, \ 160 .time_slice = HZ, \
@@ -169,7 +173,7 @@ extern struct group_info init_groups;
169 .cap_inheritable = CAP_INIT_INH_SET, \ 173 .cap_inheritable = CAP_INIT_INH_SET, \
170 .cap_permitted = CAP_FULL_SET, \ 174 .cap_permitted = CAP_FULL_SET, \
171 .cap_bset = CAP_INIT_BSET, \ 175 .cap_bset = CAP_INIT_BSET, \
172 .keep_capabilities = 0, \ 176 .securebits = SECUREBITS_DEFAULT, \
173 .user = INIT_USER, \ 177 .user = INIT_USER, \
174 .comm = "swapper", \ 178 .comm = "swapper", \
175 .thread = INIT_THREAD, \ 179 .thread = INIT_THREAD, \
diff --git a/include/linux/input.h b/include/linux/input.h
index cae2c35d1206..28a094fcfe20 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1025,10 +1025,6 @@ struct ff_effect {
1025 * @node: used to place the device onto input_dev_list 1025 * @node: used to place the device onto input_dev_list
1026 */ 1026 */
1027struct input_dev { 1027struct input_dev {
1028 /* private: */
1029 void *private; /* do not use */
1030 /* public: */
1031
1032 const char *name; 1028 const char *name;
1033 const char *phys; 1029 const char *phys;
1034 const char *uniq; 1030 const char *uniq;
@@ -1238,12 +1234,12 @@ static inline void input_put_device(struct input_dev *dev)
1238 1234
1239static inline void *input_get_drvdata(struct input_dev *dev) 1235static inline void *input_get_drvdata(struct input_dev *dev)
1240{ 1236{
1241 return dev->private; 1237 return dev_get_drvdata(&dev->dev);
1242} 1238}
1243 1239
1244static inline void input_set_drvdata(struct input_dev *dev, void *data) 1240static inline void input_set_drvdata(struct input_dev *dev, void *data)
1245{ 1241{
1246 dev->private = data; 1242 dev_set_drvdata(&dev->dev, data);
1247} 1243}
1248 1244
1249int __must_check input_register_device(struct input_dev *); 1245int __must_check input_register_device(struct input_dev *);
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index f8ab4ce70564..f1fc7470d26c 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -102,6 +102,25 @@ extern void disable_irq_nosync(unsigned int irq);
102extern void disable_irq(unsigned int irq); 102extern void disable_irq(unsigned int irq);
103extern void enable_irq(unsigned int irq); 103extern void enable_irq(unsigned int irq);
104 104
105#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
106
107extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
108extern int irq_can_set_affinity(unsigned int irq);
109
110#else /* CONFIG_SMP */
111
112static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
113{
114 return -EINVAL;
115}
116
117static inline int irq_can_set_affinity(unsigned int irq)
118{
119 return 0;
120}
121
122#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */
123
105#ifdef CONFIG_GENERIC_HARDIRQS 124#ifdef CONFIG_GENERIC_HARDIRQS
106/* 125/*
107 * Special lockdep variants of irq disabling/enabling. 126 * Special lockdep variants of irq disabling/enabling.
@@ -270,6 +289,7 @@ struct softirq_action
270}; 289};
271 290
272asmlinkage void do_softirq(void); 291asmlinkage void do_softirq(void);
292asmlinkage void __do_softirq(void);
273extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); 293extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data);
274extern void softirq_init(void); 294extern void softirq_init(void);
275#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) 295#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
diff --git a/include/linux/io.h b/include/linux/io.h
index e3b2dda6c8eb..3a03a3604cce 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -58,9 +58,9 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
58} 58}
59#endif 59#endif
60 60
61void __iomem * devm_ioremap(struct device *dev, unsigned long offset, 61void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
62 unsigned long size); 62 unsigned long size);
63void __iomem * devm_ioremap_nocache(struct device *dev, unsigned long offset, 63void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
64 unsigned long size); 64 unsigned long size);
65void devm_iounmap(struct device *dev, void __iomem *addr); 65void devm_iounmap(struct device *dev, void __iomem *addr);
66int check_signature(const volatile void __iomem *io_addr, 66int check_signature(const volatile void __iomem *io_addr,
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 605d237364d2..d5d40a9f7929 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -44,7 +44,9 @@ struct resource_list {
44#define IORESOURCE_CACHEABLE 0x00004000 44#define IORESOURCE_CACHEABLE 0x00004000
45#define IORESOURCE_RANGELENGTH 0x00008000 45#define IORESOURCE_RANGELENGTH 0x00008000
46#define IORESOURCE_SHADOWABLE 0x00010000 46#define IORESOURCE_SHADOWABLE 0x00010000
47#define IORESOURCE_BUS_HAS_VGA 0x00080000 47
48#define IORESOURCE_SIZEALIGN 0x00020000 /* size indicates alignment */
49#define IORESOURCE_STARTALIGN 0x00040000 /* start field is alignment */
48 50
49#define IORESOURCE_DISABLED 0x10000000 51#define IORESOURCE_DISABLED 0x10000000
50#define IORESOURCE_UNSET 0x20000000 52#define IORESOURCE_UNSET 0x20000000
@@ -110,6 +112,7 @@ extern int allocate_resource(struct resource *root, struct resource *new,
110 void *alignf_data); 112 void *alignf_data);
111int adjust_resource(struct resource *res, resource_size_t start, 113int adjust_resource(struct resource *res, resource_size_t start,
112 resource_size_t size); 114 resource_size_t size);
115resource_size_t resource_alignment(struct resource *res);
113 116
114/* Convenience shorthand with allocation */ 117/* Convenience shorthand with allocation */
115#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) 118#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index e4451d1da753..ea6c18a8b0d4 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -4,6 +4,17 @@
4#include <linux/err.h> 4#include <linux/err.h>
5#include <linux/idr.h> 5#include <linux/idr.h>
6#include <linux/rwsem.h> 6#include <linux/rwsem.h>
7#include <linux/notifier.h>
8
9/*
10 * ipc namespace events
11 */
12#define IPCNS_MEMCHANGED 0x00000001 /* Notify lowmem size changed */
13#define IPCNS_CREATED 0x00000002 /* Notify new ipc namespace created */
14#define IPCNS_REMOVED 0x00000003 /* Notify ipc namespace removed */
15
16#define IPCNS_CALLBACK_PRI 0
17
7 18
8struct ipc_ids { 19struct ipc_ids {
9 int in_use; 20 int in_use;
@@ -30,15 +41,24 @@ struct ipc_namespace {
30 size_t shm_ctlall; 41 size_t shm_ctlall;
31 int shm_ctlmni; 42 int shm_ctlmni;
32 int shm_tot; 43 int shm_tot;
44
45 struct notifier_block ipcns_nb;
33}; 46};
34 47
35extern struct ipc_namespace init_ipc_ns; 48extern struct ipc_namespace init_ipc_ns;
49extern atomic_t nr_ipc_ns;
36 50
37#ifdef CONFIG_SYSVIPC 51#ifdef CONFIG_SYSVIPC
38#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, 52#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
39#else 53
54extern int register_ipcns_notifier(struct ipc_namespace *);
55extern int cond_register_ipcns_notifier(struct ipc_namespace *);
56extern int unregister_ipcns_notifier(struct ipc_namespace *);
57extern int ipcns_notify(unsigned long);
58
59#else /* CONFIG_SYSVIPC */
40#define INIT_IPC_NS(ns) 60#define INIT_IPC_NS(ns)
41#endif 61#endif /* CONFIG_SYSVIPC */
42 62
43#if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS) 63#if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS)
44extern void free_ipc_ns(struct kref *kref); 64extern void free_ipc_ns(struct kref *kref);
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index c5bd28b69aec..7ebdb4fb4e54 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -64,7 +64,7 @@
64 * applications and another for userland applications. The 64 * applications and another for userland applications. The
65 * capabilities are basically the same for both interface, although 65 * capabilities are basically the same for both interface, although
66 * the interfaces are somewhat different. The stuff in the 66 * the interfaces are somewhat different. The stuff in the
67 * #ifdef KERNEL below is the in-kernel interface. The userland 67 * #ifdef __KERNEL__ below is the in-kernel interface. The userland
68 * interface is defined later in the file. */ 68 * interface is defined later in the file. */
69 69
70 70
@@ -75,8 +75,7 @@
75 * work for sockets. 75 * work for sockets.
76 */ 76 */
77#define IPMI_MAX_ADDR_SIZE 32 77#define IPMI_MAX_ADDR_SIZE 32
78struct ipmi_addr 78struct ipmi_addr {
79{
80 /* Try to take these from the "Channel Medium Type" table 79 /* Try to take these from the "Channel Medium Type" table
81 in section 6.5 of the IPMI 1.5 manual. */ 80 in section 6.5 of the IPMI 1.5 manual. */
82 int addr_type; 81 int addr_type;
@@ -90,8 +89,7 @@ struct ipmi_addr
90 * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC. 89 * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC.
91 */ 90 */
92#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c 91#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c
93struct ipmi_system_interface_addr 92struct ipmi_system_interface_addr {
94{
95 int addr_type; 93 int addr_type;
96 short channel; 94 short channel;
97 unsigned char lun; 95 unsigned char lun;
@@ -100,10 +98,9 @@ struct ipmi_system_interface_addr
100/* An IPMB Address. */ 98/* An IPMB Address. */
101#define IPMI_IPMB_ADDR_TYPE 0x01 99#define IPMI_IPMB_ADDR_TYPE 0x01
102/* Used for broadcast get device id as described in section 17.9 of the 100/* Used for broadcast get device id as described in section 17.9 of the
103 IPMI 1.5 manual. */ 101 IPMI 1.5 manual. */
104#define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41 102#define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41
105struct ipmi_ipmb_addr 103struct ipmi_ipmb_addr {
106{
107 int addr_type; 104 int addr_type;
108 short channel; 105 short channel;
109 unsigned char slave_addr; 106 unsigned char slave_addr;
@@ -128,8 +125,7 @@ struct ipmi_ipmb_addr
128 * message is a little weird, but this is required. 125 * message is a little weird, but this is required.
129 */ 126 */
130#define IPMI_LAN_ADDR_TYPE 0x04 127#define IPMI_LAN_ADDR_TYPE 0x04
131struct ipmi_lan_addr 128struct ipmi_lan_addr {
132{
133 int addr_type; 129 int addr_type;
134 short channel; 130 short channel;
135 unsigned char privilege; 131 unsigned char privilege;
@@ -162,16 +158,14 @@ struct ipmi_lan_addr
162 * byte of data in the response (as the spec shows the messages laid 158 * byte of data in the response (as the spec shows the messages laid
163 * out). 159 * out).
164 */ 160 */
165struct ipmi_msg 161struct ipmi_msg {
166{
167 unsigned char netfn; 162 unsigned char netfn;
168 unsigned char cmd; 163 unsigned char cmd;
169 unsigned short data_len; 164 unsigned short data_len;
170 unsigned char __user *data; 165 unsigned char __user *data;
171}; 166};
172 167
173struct kernel_ipmi_msg 168struct kernel_ipmi_msg {
174{
175 unsigned char netfn; 169 unsigned char netfn;
176 unsigned char cmd; 170 unsigned char cmd;
177 unsigned short data_len; 171 unsigned short data_len;
@@ -239,12 +233,11 @@ typedef struct ipmi_user *ipmi_user_t;
239 * used after the message is delivered, so the upper layer may use the 233 * used after the message is delivered, so the upper layer may use the
240 * link to build a linked list, if it likes. 234 * link to build a linked list, if it likes.
241 */ 235 */
242struct ipmi_recv_msg 236struct ipmi_recv_msg {
243{
244 struct list_head link; 237 struct list_head link;
245 238
246 /* The type of message as defined in the "Receive Types" 239 /* The type of message as defined in the "Receive Types"
247 defines above. */ 240 defines above. */
248 int recv_type; 241 int recv_type;
249 242
250 ipmi_user_t user; 243 ipmi_user_t user;
@@ -271,9 +264,8 @@ struct ipmi_recv_msg
271/* Allocate and free the receive message. */ 264/* Allocate and free the receive message. */
272void ipmi_free_recv_msg(struct ipmi_recv_msg *msg); 265void ipmi_free_recv_msg(struct ipmi_recv_msg *msg);
273 266
274struct ipmi_user_hndl 267struct ipmi_user_hndl {
275{ 268 /* Routine type to call when a message needs to be routed to
276 /* Routine type to call when a message needs to be routed to
277 the upper layer. This will be called with some locks held, 269 the upper layer. This will be called with some locks held,
278 the only IPMI routines that can be called are ipmi_request 270 the only IPMI routines that can be called are ipmi_request
279 and the alloc/free operations. The handler_data is the 271 and the alloc/free operations. The handler_data is the
@@ -368,9 +360,8 @@ int ipmi_request_supply_msgs(ipmi_user_t user,
368 * Poll the IPMI interface for the user. This causes the IPMI code to 360 * Poll the IPMI interface for the user. This causes the IPMI code to
369 * do an immediate check for information from the driver and handle 361 * do an immediate check for information from the driver and handle
370 * anything that is immediately pending. This will not block in any 362 * anything that is immediately pending. This will not block in any
371 * way. This is useful if you need to implement polling from the user 363 * way. This is useful if you need to spin waiting for something to
372 * for things like modifying the watchdog timeout when a panic occurs 364 * happen in the IPMI driver.
373 * or disabling the watchdog timer on a reboot.
374 */ 365 */
375void ipmi_poll_interface(ipmi_user_t user); 366void ipmi_poll_interface(ipmi_user_t user);
376 367
@@ -422,12 +413,6 @@ int ipmi_get_maintenance_mode(ipmi_user_t user);
422int ipmi_set_maintenance_mode(ipmi_user_t user, int mode); 413int ipmi_set_maintenance_mode(ipmi_user_t user, int mode);
423 414
424/* 415/*
425 * Allow run-to-completion mode to be set for the interface of
426 * a specific user.
427 */
428void ipmi_user_set_run_to_completion(ipmi_user_t user, int val);
429
430/*
431 * When the user is created, it will not receive IPMI events by 416 * When the user is created, it will not receive IPMI events by
432 * default. The user must set this to TRUE to get incoming events. 417 * default. The user must set this to TRUE to get incoming events.
433 * The first user that sets this to TRUE will receive all events that 418 * The first user that sets this to TRUE will receive all events that
@@ -440,8 +425,7 @@ int ipmi_set_gets_events(ipmi_user_t user, int val);
440 * every existing interface when a new watcher is registered with 425 * every existing interface when a new watcher is registered with
441 * ipmi_smi_watcher_register(). 426 * ipmi_smi_watcher_register().
442 */ 427 */
443struct ipmi_smi_watcher 428struct ipmi_smi_watcher {
444{
445 struct list_head link; 429 struct list_head link;
446 430
447 /* You must set the owner to the current module, if you are in 431 /* You must set the owner to the current module, if you are in
@@ -512,8 +496,7 @@ int ipmi_validate_addr(struct ipmi_addr *addr, int len);
512 496
513 497
514/* Messages sent to the interface are this format. */ 498/* Messages sent to the interface are this format. */
515struct ipmi_req 499struct ipmi_req {
516{
517 unsigned char __user *addr; /* Address to send the message to. */ 500 unsigned char __user *addr; /* Address to send the message to. */
518 unsigned int addr_len; 501 unsigned int addr_len;
519 502
@@ -538,12 +521,11 @@ struct ipmi_req
538 521
539/* Messages sent to the interface with timing parameters are this 522/* Messages sent to the interface with timing parameters are this
540 format. */ 523 format. */
541struct ipmi_req_settime 524struct ipmi_req_settime {
542{
543 struct ipmi_req req; 525 struct ipmi_req req;
544 526
545 /* See ipmi_request_settime() above for details on these 527 /* See ipmi_request_settime() above for details on these
546 values. */ 528 values. */
547 int retries; 529 int retries;
548 unsigned int retry_time_ms; 530 unsigned int retry_time_ms;
549}; 531};
@@ -560,8 +542,7 @@ struct ipmi_req_settime
560 struct ipmi_req_settime) 542 struct ipmi_req_settime)
561 543
562/* Messages received from the interface are this format. */ 544/* Messages received from the interface are this format. */
563struct ipmi_recv 545struct ipmi_recv {
564{
565 int recv_type; /* Is this a command, response or an 546 int recv_type; /* Is this a command, response or an
566 asyncronous event. */ 547 asyncronous event. */
567 548
@@ -607,13 +588,12 @@ struct ipmi_recv
607 struct ipmi_recv) 588 struct ipmi_recv)
608 589
609/* Register to get commands from other entities on this interface. */ 590/* Register to get commands from other entities on this interface. */
610struct ipmi_cmdspec 591struct ipmi_cmdspec {
611{
612 unsigned char netfn; 592 unsigned char netfn;
613 unsigned char cmd; 593 unsigned char cmd;
614}; 594};
615 595
616/* 596/*
617 * Register to receive a specific command. error values: 597 * Register to receive a specific command. error values:
618 * - EFAULT - an address supplied was invalid. 598 * - EFAULT - an address supplied was invalid.
619 * - EBUSY - The netfn/cmd supplied was already in use. 599 * - EBUSY - The netfn/cmd supplied was already in use.
@@ -636,8 +616,7 @@ struct ipmi_cmdspec
636 * else. The chans field is a bitmask, (1 << channel) for each channel. 616 * else. The chans field is a bitmask, (1 << channel) for each channel.
637 * It may be IPMI_CHAN_ALL for all channels. 617 * It may be IPMI_CHAN_ALL for all channels.
638 */ 618 */
639struct ipmi_cmdspec_chans 619struct ipmi_cmdspec_chans {
640{
641 unsigned int netfn; 620 unsigned int netfn;
642 unsigned int cmd; 621 unsigned int cmd;
643 unsigned int chans; 622 unsigned int chans;
@@ -659,7 +638,7 @@ struct ipmi_cmdspec_chans
659#define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \ 638#define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \
660 struct ipmi_cmdspec_chans) 639 struct ipmi_cmdspec_chans)
661 640
662/* 641/*
663 * Set whether this interface receives events. Note that the first 642 * Set whether this interface receives events. Note that the first
664 * user registered for events will get all pending events for the 643 * user registered for events will get all pending events for the
665 * interface. error values: 644 * interface. error values:
@@ -675,15 +654,18 @@ struct ipmi_cmdspec_chans
675 * things it takes to determine your address (if not the BMC) and set 654 * things it takes to determine your address (if not the BMC) and set
676 * it for everyone else. You should probably leave the LUN alone. 655 * it for everyone else. You should probably leave the LUN alone.
677 */ 656 */
678struct ipmi_channel_lun_address_set 657struct ipmi_channel_lun_address_set {
679{
680 unsigned short channel; 658 unsigned short channel;
681 unsigned char value; 659 unsigned char value;
682}; 660};
683#define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set) 661#define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \
684#define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set) 662 _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
685#define IPMICTL_SET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set) 663#define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \
686#define IPMICTL_GET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set) 664 _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
665#define IPMICTL_SET_MY_CHANNEL_LUN_CMD \
666 _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
667#define IPMICTL_GET_MY_CHANNEL_LUN_CMD \
668 _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
687/* Legacy interfaces, these only set IPMB 0. */ 669/* Legacy interfaces, these only set IPMB 0. */
688#define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int) 670#define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int)
689#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int) 671#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int)
@@ -694,8 +676,7 @@ struct ipmi_channel_lun_address_set
694 * Get/set the default timing values for an interface. You shouldn't 676 * Get/set the default timing values for an interface. You shouldn't
695 * generally mess with these. 677 * generally mess with these.
696 */ 678 */
697struct ipmi_timing_parms 679struct ipmi_timing_parms {
698{
699 int retries; 680 int retries;
700 unsigned int retry_time_ms; 681 unsigned int retry_time_ms;
701}; 682};
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 6e8cec503380..62b73668b602 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -60,8 +60,7 @@ typedef struct ipmi_smi *ipmi_smi_t;
60 * asynchronous data and messages and request them from the 60 * asynchronous data and messages and request them from the
61 * interface. 61 * interface.
62 */ 62 */
63struct ipmi_smi_msg 63struct ipmi_smi_msg {
64{
65 struct list_head link; 64 struct list_head link;
66 65
67 long msgid; 66 long msgid;
@@ -74,12 +73,11 @@ struct ipmi_smi_msg
74 unsigned char rsp[IPMI_MAX_MSG_LENGTH]; 73 unsigned char rsp[IPMI_MAX_MSG_LENGTH];
75 74
76 /* Will be called when the system is done with the message 75 /* Will be called when the system is done with the message
77 (presumably to free it). */ 76 (presumably to free it). */
78 void (*done)(struct ipmi_smi_msg *msg); 77 void (*done)(struct ipmi_smi_msg *msg);
79}; 78};
80 79
81struct ipmi_smi_handlers 80struct ipmi_smi_handlers {
82{
83 struct module *owner; 81 struct module *owner;
84 82
85 /* The low-level interface cannot start sending messages to 83 /* The low-level interface cannot start sending messages to
@@ -231,7 +229,7 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg)
231 directory for this interface. Note that the entry will 229 directory for this interface. Note that the entry will
232 automatically be dstroyed when the interface is destroyed. */ 230 automatically be dstroyed when the interface is destroyed. */
233int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, 231int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
234 read_proc_t *read_proc, write_proc_t *write_proc, 232 read_proc_t *read_proc,
235 void *data, struct module *owner); 233 void *data, struct module *owner);
236 234
237#endif /* __LINUX_IPMI_SMI_H */ 235#endif /* __LINUX_IPMI_SMI_H */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 134c8e5cf07c..10b666b61add 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -160,6 +160,9 @@ struct ipv6_devconf {
160#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 160#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
161 __s32 optimistic_dad; 161 __s32 optimistic_dad;
162#endif 162#endif
163#ifdef CONFIG_IPV6_MROUTE
164 __s32 mc_forwarding;
165#endif
163 void *sysctl; 166 void *sysctl;
164}; 167};
165 168
@@ -190,6 +193,7 @@ enum {
190 DEVCONF_PROXY_NDP, 193 DEVCONF_PROXY_NDP,
191 DEVCONF_OPTIMISTIC_DAD, 194 DEVCONF_OPTIMISTIC_DAD,
192 DEVCONF_ACCEPT_SOURCE_ROUTE, 195 DEVCONF_ACCEPT_SOURCE_ROUTE,
196 DEVCONF_MC_FORWARDING,
193 DEVCONF_MAX 197 DEVCONF_MAX
194}; 198};
195 199
@@ -230,6 +234,7 @@ struct inet6_skb_parm {
230#endif 234#endif
231 235
232#define IP6SKB_XFRM_TRANSFORMED 1 236#define IP6SKB_XFRM_TRANSFORMED 1
237#define IP6SKB_FORWARDED 2
233}; 238};
234 239
235#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 240#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
@@ -274,8 +279,29 @@ struct ipv6_pinfo {
274 279
275 __be32 flow_label; 280 __be32 flow_label;
276 __u32 frag_size; 281 __u32 frag_size;
277 __s16 hop_limit; 282
278 __s16 mcast_hops; 283 /*
284 * Packed in 16bits.
285 * Omit one shift by by putting the signed field at MSB.
286 */
287#if defined(__BIG_ENDIAN_BITFIELD)
288 __s16 hop_limit:9;
289 __u16 __unused_1:7;
290#else
291 __u16 __unused_1:7;
292 __s16 hop_limit:9;
293#endif
294
295#if defined(__BIG_ENDIAN_BITFIELD)
296 /* Packed in 16bits. */
297 __s16 mcast_hops:9;
298 __u16 __unused_2:6,
299 mc_loop:1;
300#else
301 __u16 mc_loop:1,
302 __unused_2:6;
303 __s16 mcast_hops:9;
304#endif
279 int mcast_oif; 305 int mcast_oif;
280 306
281 /* pktoption flags */ 307 /* pktoption flags */
@@ -298,11 +324,14 @@ struct ipv6_pinfo {
298 } rxopt; 324 } rxopt;
299 325
300 /* sockopt flags */ 326 /* sockopt flags */
301 __u8 mc_loop:1, 327 __u8 recverr:1,
302 recverr:1,
303 sndflow:1, 328 sndflow:1,
304 pmtudisc:2, 329 pmtudisc:2,
305 ipv6only:1; 330 ipv6only:1,
331 srcprefs:3; /* 001: prefer temporary address
332 * 010: prefer public address
333 * 100: prefer care-of address
334 */
306 __u8 tclass; 335 __u8 tclass;
307 336
308 __u32 dst_cookie; 337 __u32 dst_cookie;
@@ -315,9 +344,8 @@ struct ipv6_pinfo {
315 struct sk_buff *pktoptions; 344 struct sk_buff *pktoptions;
316 struct { 345 struct {
317 struct ipv6_txoptions *opt; 346 struct ipv6_txoptions *opt;
318 struct rt6_info *rt; 347 u8 hop_limit;
319 int hop_limit; 348 u8 tclass;
320 int tclass;
321 } cork; 349 } cork;
322}; 350};
323 351
@@ -458,7 +486,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
458#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 486#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
459 487
460#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ 488#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
461 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ 489 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
462 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 490 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
463 ((__sk)->sk_family == AF_INET6) && \ 491 ((__sk)->sk_family == AF_INET6) && \
464 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 492 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
@@ -466,7 +494,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
466 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 494 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
467 495
468#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \ 496#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \
469 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ 497 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
470 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \ 498 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \
471 ((__sk)->sk_family == PF_INET6) && \ 499 ((__sk)->sk_family == PF_INET6) && \
472 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \ 500 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 176e5e790a44..1883a85625dd 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -228,21 +228,11 @@ static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
228 228
229#endif /* CONFIG_GENERIC_PENDING_IRQ */ 229#endif /* CONFIG_GENERIC_PENDING_IRQ */
230 230
231extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
232extern int irq_can_set_affinity(unsigned int irq);
233
234#else /* CONFIG_SMP */ 231#else /* CONFIG_SMP */
235 232
236#define move_native_irq(x) 233#define move_native_irq(x)
237#define move_masked_irq(x) 234#define move_masked_irq(x)
238 235
239static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
240{
241 return -EINVAL;
242}
243
244static inline int irq_can_set_affinity(unsigned int irq) { return 0; }
245
246#endif /* CONFIG_SMP */ 236#endif /* CONFIG_SMP */
247 237
248#ifdef CONFIG_IRQBALANCE 238#ifdef CONFIG_IRQBALANCE
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index 412e025bc5c7..e600c4e9b8c5 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -84,10 +84,10 @@
84 84
85#define irqs_disabled() \ 85#define irqs_disabled() \
86({ \ 86({ \
87 unsigned long flags; \ 87 unsigned long _flags; \
88 \ 88 \
89 raw_local_save_flags(flags); \ 89 raw_local_save_flags(_flags); \
90 raw_irqs_disabled_flags(flags); \ 90 raw_irqs_disabled_flags(_flags); \
91}) 91})
92 92
93#define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags) 93#define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags)
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h
index 1e8728a9ee8a..cd5a269fdb5e 100644
--- a/include/linux/isapnp.h
+++ b/include/linux/isapnp.h
@@ -26,16 +26,6 @@
26#include <linux/pnp.h> 26#include <linux/pnp.h>
27 27
28/* 28/*
29 * Configuration registers (TODO: change by specification)
30 */
31
32#define ISAPNP_CFG_ACTIVATE 0x30 /* byte */
33#define ISAPNP_CFG_MEM 0x40 /* 4 * dword */
34#define ISAPNP_CFG_PORT 0x60 /* 8 * word */
35#define ISAPNP_CFG_IRQ 0x70 /* 2 * word */
36#define ISAPNP_CFG_DMA 0x74 /* 2 * byte */
37
38/*
39 * 29 *
40 */ 30 */
41 31
diff --git a/include/linux/iscsi_ibft.h b/include/linux/iscsi_ibft.h
new file mode 100644
index 000000000000..6092487e2950
--- /dev/null
+++ b/include/linux/iscsi_ibft.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright 2007 Red Hat, Inc.
3 * by Peter Jones <pjones@redhat.com>
4 * Copyright 2007 IBM, Inc.
5 * by Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
6 * Copyright 2008
7 * by Konrad Rzeszutek <ketuzsezr@darnok.org>
8 *
9 * This code exposes the iSCSI Boot Format Table to userland via sysfs.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License v2.0 as published by
13 * the Free Software Foundation
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 */
20
21#ifndef ISCSI_IBFT_H
22#define ISCSI_IBFT_H
23
24struct ibft_table_header {
25 char signature[4];
26 u32 length;
27 u8 revision;
28 u8 checksum;
29 char oem_id[6];
30 char oem_table_id[8];
31 char reserved[24];
32} __attribute__((__packed__));
33
34/*
35 * Logical location of iSCSI Boot Format Table.
36 * If the value is NULL there is no iBFT on the machine.
37 */
38extern struct ibft_table_header *ibft_addr;
39
40/*
41 * Routine used to find and reserve the iSCSI Boot Format Table. The
42 * mapped address is set in the ibft_addr variable.
43 */
44#ifdef CONFIG_ISCSI_IBFT_FIND
45extern void __init reserve_ibft_region(void);
46#else
47static inline void reserve_ibft_region(void) { }
48#endif
49
50#endif /* ISCSI_IBFT_H */
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 9cb2855bb170..44cd663c53b6 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -16,14 +16,8 @@
16 16
17#include <linux/ioctl.h> 17#include <linux/ioctl.h>
18 18
19#ifdef CONFIG_COBALT_MICRO_SERVER
20/* Save memory */
21#define ISDN_MAX_DRIVERS 2
22#define ISDN_MAX_CHANNELS 8
23#else
24#define ISDN_MAX_DRIVERS 32 19#define ISDN_MAX_DRIVERS 32
25#define ISDN_MAX_CHANNELS 64 20#define ISDN_MAX_CHANNELS 64
26#endif
27 21
28/* New ioctl-codes */ 22/* New ioctl-codes */
29#define IIOCNETAIF _IO('I',1) 23#define IIOCNETAIF _IO('I',1)
diff --git a/include/linux/isicom.h b/include/linux/isicom.h
index 8f4c71759d73..bbd42197298f 100644
--- a/include/linux/isicom.h
+++ b/include/linux/isicom.h
@@ -1,11 +1,6 @@
1#ifndef _LINUX_ISICOM_H 1#ifndef _LINUX_ISICOM_H
2#define _LINUX_ISICOM_H 2#define _LINUX_ISICOM_H
3 3
4/*#define ISICOM_DEBUG*/
5/*#define ISICOM_DEBUG_DTR_RTS*/
6
7#ifdef __KERNEL__
8
9#define YES 1 4#define YES 1
10#define NO 0 5#define NO 0
11 6
@@ -85,6 +80,4 @@
85 80
86#define ISI_TXOK 0x0001 81#define ISI_TXOK 0x0001
87 82
88#endif /* __KERNEL__ */
89
90#endif /* ISICOM_H */ 83#endif /* ISICOM_H */
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 423f58272188..07a9b52a2654 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -32,8 +32,6 @@
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/lockdep.h> 33#include <linux/lockdep.h>
34 34
35#include <asm/semaphore.h>
36
37#define journal_oom_retry 1 35#define journal_oom_retry 1
38 36
39/* 37/*
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 2cbf6fdb1799..05e2b307161a 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -30,8 +30,6 @@
30#include <linux/bit_spinlock.h> 30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33
34#include <asm/semaphore.h>
35#endif 33#endif
36 34
37#define journal_oom_retry 1 35#define journal_oom_retry 1
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index e0b5b684d83f..abb6ac639e8e 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_JIFFIES_H 1#ifndef _LINUX_JIFFIES_H
2#define _LINUX_JIFFIES_H 2#define _LINUX_JIFFIES_H
3 3
4#include <linux/calc64.h> 4#include <linux/math64.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/time.h> 7#include <linux/time.h>
@@ -36,7 +36,7 @@
36#elif HZ >= 6144 && HZ < 12288 36#elif HZ >= 6144 && HZ < 12288
37# define SHIFT_HZ 13 37# define SHIFT_HZ 13
38#else 38#else
39# error You lose. 39# error Invalid value of HZ.
40#endif 40#endif
41 41
42/* LATCH is used in the interval timer and ftape setup. */ 42/* LATCH is used in the interval timer and ftape setup. */
@@ -135,6 +135,22 @@ static inline u64 get_jiffies_64(void)
135#define time_before_eq64(a,b) time_after_eq64(b,a) 135#define time_before_eq64(a,b) time_after_eq64(b,a)
136 136
137/* 137/*
138 * These four macros compare jiffies and 'a' for convenience.
139 */
140
141/* time_is_before_jiffies(a) return true if a is before jiffies */
142#define time_is_before_jiffies(a) time_after(jiffies, a)
143
144/* time_is_after_jiffies(a) return true if a is after jiffies */
145#define time_is_after_jiffies(a) time_before(jiffies, a)
146
147/* time_is_before_eq_jiffies(a) return true if a is before or equal to jiffies*/
148#define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a)
149
150/* time_is_after_eq_jiffies(a) return true if a is after or equal to jiffies*/
151#define time_is_after_eq_jiffies(a) time_before_eq(jiffies, a)
152
153/*
138 * Have the 32 bit jiffies value wrap 5 minutes after boot 154 * Have the 32 bit jiffies value wrap 5 minutes after boot
139 * so jiffies wrap bugs show up earlier. 155 * so jiffies wrap bugs show up earlier.
140 */ 156 */
diff --git a/include/linux/kbuild.h b/include/linux/kbuild.h
new file mode 100644
index 000000000000..22a72198c14b
--- /dev/null
+++ b/include/linux/kbuild.h
@@ -0,0 +1,15 @@
1#ifndef __LINUX_KBUILD_H
2#define __LINUX_KBUILD_H
3
4#define DEFINE(sym, val) \
5 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
6
7#define BLANK() asm volatile("\n->" : : )
8
9#define OFFSET(sym, str, mem) \
10 DEFINE(sym, offsetof(struct str, mem))
11
12#define COMMENT(x) \
13 asm volatile("\n->#" x)
14
15#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2df44e773270..4d46e299afb5 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -20,6 +20,9 @@
20extern const char linux_banner[]; 20extern const char linux_banner[];
21extern const char linux_proc_banner[]; 21extern const char linux_proc_banner[];
22 22
23#define USHORT_MAX ((u16)(~0U))
24#define SHORT_MAX ((s16)(USHORT_MAX>>1))
25#define SHORT_MIN (-SHORT_MAX - 1)
23#define INT_MAX ((int)(~0U>>1)) 26#define INT_MAX ((int)(~0U>>1))
24#define INT_MIN (-INT_MAX - 1) 27#define INT_MIN (-INT_MAX - 1)
25#define UINT_MAX (~0U) 28#define UINT_MAX (~0U)
@@ -188,6 +191,7 @@ extern int log_buf_copy(char *dest, int idx, int len);
188extern int printk_ratelimit_jiffies; 191extern int printk_ratelimit_jiffies;
189extern int printk_ratelimit_burst; 192extern int printk_ratelimit_burst;
190extern int printk_ratelimit(void); 193extern int printk_ratelimit(void);
194extern int __ratelimit(int ratelimit_jiffies, int ratelimit_burst);
191extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); 195extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst);
192extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, 196extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
193 unsigned int interval_msec); 197 unsigned int interval_msec);
@@ -255,6 +259,7 @@ extern enum system_states {
255#define TAINT_USER (1<<6) 259#define TAINT_USER (1<<6)
256#define TAINT_DIE (1<<7) 260#define TAINT_DIE (1<<7)
257#define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) 261#define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8)
262#define TAINT_WARN (1<<9)
258 263
259extern void dump_stack(void) __cold; 264extern void dump_stack(void) __cold;
260 265
@@ -293,10 +298,8 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
293#define pr_debug(fmt, arg...) \ 298#define pr_debug(fmt, arg...) \
294 printk(KERN_DEBUG fmt, ##arg) 299 printk(KERN_DEBUG fmt, ##arg)
295#else 300#else
296static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...) 301#define pr_debug(fmt, arg...) \
297{ 302 ({ if (0) printk(KERN_DEBUG fmt, ##arg); 0; })
298 return 0;
299}
300#endif 303#endif
301 304
302/* 305/*
@@ -335,33 +338,90 @@ static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char *
335#endif /* __LITTLE_ENDIAN */ 338#endif /* __LITTLE_ENDIAN */
336 339
337/* 340/*
338 * min()/max() macros that also do 341 * min()/max()/clamp() macros that also do
339 * strict type-checking.. See the 342 * strict type-checking.. See the
340 * "unnecessary" pointer comparison. 343 * "unnecessary" pointer comparison.
341 */ 344 */
342#define min(x,y) ({ \ 345#define min(x, y) ({ \
343 typeof(x) _x = (x); \ 346 typeof(x) _min1 = (x); \
344 typeof(y) _y = (y); \ 347 typeof(y) _min2 = (y); \
345 (void) (&_x == &_y); \ 348 (void) (&_min1 == &_min2); \
346 _x < _y ? _x : _y; }) 349 _min1 < _min2 ? _min1 : _min2; })
347 350
348#define max(x,y) ({ \ 351#define max(x, y) ({ \
349 typeof(x) _x = (x); \ 352 typeof(x) _max1 = (x); \
350 typeof(y) _y = (y); \ 353 typeof(y) _max2 = (y); \
351 (void) (&_x == &_y); \ 354 (void) (&_max1 == &_max2); \
352 _x > _y ? _x : _y; }) 355 _max1 > _max2 ? _max1 : _max2; })
356
357/**
358 * clamp - return a value clamped to a given range with strict typechecking
359 * @val: current value
360 * @min: minimum allowable value
361 * @max: maximum allowable value
362 *
363 * This macro does strict typechecking of min/max to make sure they are of the
364 * same type as val. See the unnecessary pointer comparisons.
365 */
366#define clamp(val, min, max) ({ \
367 typeof(val) __val = (val); \
368 typeof(min) __min = (min); \
369 typeof(max) __max = (max); \
370 (void) (&__val == &__min); \
371 (void) (&__val == &__max); \
372 __val = __val < __min ? __min: __val; \
373 __val > __max ? __max: __val; })
353 374
354/* 375/*
355 * ..and if you can't take the strict 376 * ..and if you can't take the strict
356 * types, you can specify one yourself. 377 * types, you can specify one yourself.
357 * 378 *
358 * Or not use min/max at all, of course. 379 * Or not use min/max/clamp at all, of course.
359 */ 380 */
360#define min_t(type,x,y) \ 381#define min_t(type, x, y) ({ \
361 ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) 382 type __min1 = (x); \
362#define max_t(type,x,y) \ 383 type __min2 = (y); \
363 ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) 384 __min1 < __min2 ? __min1: __min2; })
385
386#define max_t(type, x, y) ({ \
387 type __max1 = (x); \
388 type __max2 = (y); \
389 __max1 > __max2 ? __max1: __max2; })
364 390
391/**
392 * clamp_t - return a value clamped to a given range using a given type
393 * @type: the type of variable to use
394 * @val: current value
395 * @min: minimum allowable value
396 * @max: maximum allowable value
397 *
398 * This macro does no typechecking and uses temporary variables of type
399 * 'type' to make all the comparisons.
400 */
401#define clamp_t(type, val, min, max) ({ \
402 type __val = (val); \
403 type __min = (min); \
404 type __max = (max); \
405 __val = __val < __min ? __min: __val; \
406 __val > __max ? __max: __val; })
407
408/**
409 * clamp_val - return a value clamped to a given range using val's type
410 * @val: current value
411 * @min: minimum allowable value
412 * @max: maximum allowable value
413 *
414 * This macro does no typechecking and uses temporary variables of whatever
415 * type the input argument 'val' is. This is useful when val is an unsigned
416 * type and min and max are literals that will otherwise be assigned a signed
417 * integer type.
418 */
419#define clamp_val(val, min, max) ({ \
420 typeof(val) __val = (val); \
421 typeof(val) __min = (min); \
422 typeof(val) __max = (max); \
423 __val = __val < __min ? __min: __val; \
424 __val > __max ? __max: __val; })
365 425
366/** 426/**
367 * container_of - cast a member of a structure out to the containing structure 427 * container_of - cast a member of a structure out to the containing structure
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index 8c4350a9ed87..a53e932f80fb 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -48,7 +48,6 @@ typedef struct kcapi_carddef {
48#include <linux/list.h> 48#include <linux/list.h>
49#include <linux/skbuff.h> 49#include <linux/skbuff.h>
50#include <linux/workqueue.h> 50#include <linux/workqueue.h>
51#include <asm/semaphore.h>
52 51
53#define KCI_CONTRUP 0 /* arg: struct capi_profile */ 52#define KCI_CONTRUP 0 /* arg: struct capi_profile */
54#define KCI_CONTRDOWN 1 /* arg: NULL */ 53#define KCI_CONTRDOWN 1 /* arg: NULL */
diff --git a/include/linux/key.h b/include/linux/key.h
index a70b8a8f2005..c45c962d1cc5 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -19,6 +19,7 @@
19#include <linux/list.h> 19#include <linux/list.h>
20#include <linux/rbtree.h> 20#include <linux/rbtree.h>
21#include <linux/rcupdate.h> 21#include <linux/rcupdate.h>
22#include <linux/sysctl.h>
22#include <asm/atomic.h> 23#include <asm/atomic.h>
23 24
24#ifdef __KERNEL__ 25#ifdef __KERNEL__
@@ -67,6 +68,8 @@ struct key;
67#define KEY_OTH_SETATTR 0x00000020 68#define KEY_OTH_SETATTR 0x00000020
68#define KEY_OTH_ALL 0x0000003f 69#define KEY_OTH_ALL 0x0000003f
69 70
71#define KEY_PERM_UNDEF 0xffffffff
72
70struct seq_file; 73struct seq_file;
71struct user_struct; 74struct user_struct;
72struct signal_struct; 75struct signal_struct;
@@ -208,16 +211,19 @@ extern struct key *request_key(struct key_type *type,
208 211
209extern struct key *request_key_with_auxdata(struct key_type *type, 212extern struct key *request_key_with_auxdata(struct key_type *type,
210 const char *description, 213 const char *description,
211 const char *callout_info, 214 const void *callout_info,
215 size_t callout_len,
212 void *aux); 216 void *aux);
213 217
214extern struct key *request_key_async(struct key_type *type, 218extern struct key *request_key_async(struct key_type *type,
215 const char *description, 219 const char *description,
216 const char *callout_info); 220 const void *callout_info,
221 size_t callout_len);
217 222
218extern struct key *request_key_async_with_auxdata(struct key_type *type, 223extern struct key *request_key_async_with_auxdata(struct key_type *type,
219 const char *description, 224 const char *description,
220 const char *callout_info, 225 const void *callout_info,
226 size_t callout_len,
221 void *aux); 227 void *aux);
222 228
223extern int wait_for_key_construction(struct key *key, bool intr); 229extern int wait_for_key_construction(struct key *key, bool intr);
@@ -229,6 +235,7 @@ extern key_ref_t key_create_or_update(key_ref_t keyring,
229 const char *description, 235 const char *description,
230 const void *payload, 236 const void *payload,
231 size_t plen, 237 size_t plen,
238 key_perm_t perm,
232 unsigned long flags); 239 unsigned long flags);
233 240
234extern int key_update(key_ref_t key, 241extern int key_update(key_ref_t key,
@@ -257,14 +264,18 @@ extern int keyring_add_key(struct key *keyring,
257 264
258extern struct key *key_lookup(key_serial_t id); 265extern struct key *key_lookup(key_serial_t id);
259 266
260#define key_serial(key) ((key) ? (key)->serial : 0) 267static inline key_serial_t key_serial(struct key *key)
268{
269 return key ? key->serial : 0;
270}
271
272#ifdef CONFIG_SYSCTL
273extern ctl_table key_sysctls[];
274#endif
261 275
262/* 276/*
263 * the userspace interface 277 * the userspace interface
264 */ 278 */
265extern struct key root_user_keyring, root_session_keyring;
266extern int alloc_uid_keyring(struct user_struct *user,
267 struct task_struct *ctx);
268extern void switch_uid_keyring(struct user_struct *new_user); 279extern void switch_uid_keyring(struct user_struct *new_user);
269extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk); 280extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk);
270extern int copy_thread_group_keys(struct task_struct *tsk); 281extern int copy_thread_group_keys(struct task_struct *tsk);
@@ -293,7 +304,6 @@ extern void key_init(void);
293#define make_key_ref(k, p) ({ NULL; }) 304#define make_key_ref(k, p) ({ NULL; })
294#define key_ref_to_ptr(k) ({ NULL; }) 305#define key_ref_to_ptr(k) ({ NULL; })
295#define is_key_possessed(k) 0 306#define is_key_possessed(k) 0
296#define alloc_uid_keyring(u,c) 0
297#define switch_uid_keyring(u) do { } while(0) 307#define switch_uid_keyring(u) do { } while(0)
298#define __install_session_keyring(t, k) ({ NULL; }) 308#define __install_session_keyring(t, k) ({ NULL; })
299#define copy_keys(f,t) 0 309#define copy_keys(f,t) 0
@@ -306,10 +316,6 @@ extern void key_init(void);
306#define key_fsgid_changed(t) do { } while(0) 316#define key_fsgid_changed(t) do { } while(0)
307#define key_init() do { } while(0) 317#define key_init() do { } while(0)
308 318
309/* Initial keyrings */
310extern struct key root_user_keyring;
311extern struct key root_session_keyring;
312
313#endif /* CONFIG_KEYS */ 319#endif /* CONFIG_KEYS */
314#endif /* __KERNEL__ */ 320#endif /* __KERNEL__ */
315#endif /* _LINUX_KEY_H */ 321#endif /* _LINUX_KEY_H */
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h
index 65c2d70853e9..a3c984d780f0 100644
--- a/include/linux/keyboard.h
+++ b/include/linux/keyboard.h
@@ -33,6 +33,7 @@ struct keyboard_notifier_param {
33 struct vc_data *vc; /* VC on which the keyboard press was done */ 33 struct vc_data *vc; /* VC on which the keyboard press was done */
34 int down; /* Pressure of the key? */ 34 int down; /* Pressure of the key? */
35 int shift; /* Current shift mask */ 35 int shift; /* Current shift mask */
36 int ledstate; /* Current led state */
36 unsigned int value; /* keycode, unicode value or keysym */ 37 unsigned int value; /* keycode, unicode value or keysym */
37}; 38};
38 39
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index 3365945640c9..656ee6b77a4a 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -49,5 +49,6 @@
49#define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ 49#define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */
50#define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ 50#define KEYCTL_SET_TIMEOUT 15 /* set key timeout */
51#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ 51#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */
52#define KEYCTL_GET_SECURITY 17 /* get key security label */
52 53
53#endif /* _LINUX_KEYCTL_H */ 54#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 404f4464cb1a..29f62e1733ff 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -21,8 +21,6 @@
21#ifndef _LINUX_KFIFO_H 21#ifndef _LINUX_KFIFO_H
22#define _LINUX_KFIFO_H 22#define _LINUX_KFIFO_H
23 23
24#ifdef __KERNEL__
25
26#include <linux/kernel.h> 24#include <linux/kernel.h>
27#include <linux/spinlock.h> 25#include <linux/spinlock.h>
28 26
@@ -151,7 +149,4 @@ static inline unsigned int kfifo_len(struct kfifo *fifo)
151 return ret; 149 return ret;
152} 150}
153 151
154#else
155#warning "don't include kernel headers in userspace"
156#endif /* __KERNEL__ */
157#endif 152#endif
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
new file mode 100644
index 000000000000..9757b1a6d9dc
--- /dev/null
+++ b/include/linux/kgdb.h
@@ -0,0 +1,281 @@
1/*
2 * This provides the callbacks and functions that KGDB needs to share between
3 * the core, I/O and arch-specific portions.
4 *
5 * Author: Amit Kale <amitkale@linsyssoft.com> and
6 * Tom Rini <trini@kernel.crashing.org>
7 *
8 * 2001-2004 (c) Amit S. Kale and 2003-2005 (c) MontaVista Software, Inc.
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
12 */
13#ifndef _KGDB_H_
14#define _KGDB_H_
15
16#include <linux/serial_8250.h>
17#include <linux/linkage.h>
18#include <linux/init.h>
19
20#include <asm/atomic.h>
21#include <asm/kgdb.h>
22
23struct pt_regs;
24
25/**
26 * kgdb_skipexception - (optional) exit kgdb_handle_exception early
27 * @exception: Exception vector number
28 * @regs: Current &struct pt_regs.
29 *
30 * On some architectures it is required to skip a breakpoint
31 * exception when it occurs after a breakpoint has been removed.
32 * This can be implemented in the architecture specific portion of
33 * for kgdb.
34 */
35extern int kgdb_skipexception(int exception, struct pt_regs *regs);
36
37/**
38 * kgdb_post_primary_code - (optional) Save error vector/code numbers.
39 * @regs: Original pt_regs.
40 * @e_vector: Original error vector.
41 * @err_code: Original error code.
42 *
43 * This is usually needed on architectures which support SMP and
44 * KGDB. This function is called after all the secondary cpus have
45 * been put to a know spin state and the primary CPU has control over
46 * KGDB.
47 */
48extern void kgdb_post_primary_code(struct pt_regs *regs, int e_vector,
49 int err_code);
50
51/**
52 * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook
53 * @regs: Current &struct pt_regs.
54 *
55 * This function will be called if the particular architecture must
56 * disable hardware debugging while it is processing gdb packets or
57 * handling exception.
58 */
59extern void kgdb_disable_hw_debug(struct pt_regs *regs);
60
61struct tasklet_struct;
62struct task_struct;
63struct uart_port;
64
65/**
66 * kgdb_breakpoint - compiled in breakpoint
67 *
68 * This will be impelmented a static inline per architecture. This
69 * function is called by the kgdb core to execute an architecture
70 * specific trap to cause kgdb to enter the exception processing.
71 *
72 */
73void kgdb_breakpoint(void);
74
75extern int kgdb_connected;
76
77extern atomic_t kgdb_setting_breakpoint;
78extern atomic_t kgdb_cpu_doing_single_step;
79
80extern struct task_struct *kgdb_usethread;
81extern struct task_struct *kgdb_contthread;
82
83enum kgdb_bptype {
84 BP_BREAKPOINT = 0,
85 BP_HARDWARE_BREAKPOINT,
86 BP_WRITE_WATCHPOINT,
87 BP_READ_WATCHPOINT,
88 BP_ACCESS_WATCHPOINT
89};
90
91enum kgdb_bpstate {
92 BP_UNDEFINED = 0,
93 BP_REMOVED,
94 BP_SET,
95 BP_ACTIVE
96};
97
98struct kgdb_bkpt {
99 unsigned long bpt_addr;
100 unsigned char saved_instr[BREAK_INSTR_SIZE];
101 enum kgdb_bptype type;
102 enum kgdb_bpstate state;
103};
104
105#ifndef KGDB_MAX_BREAKPOINTS
106# define KGDB_MAX_BREAKPOINTS 1000
107#endif
108
109#define KGDB_HW_BREAKPOINT 1
110
111/*
112 * Functions each KGDB-supporting architecture must provide:
113 */
114
115/**
116 * kgdb_arch_init - Perform any architecture specific initalization.
117 *
118 * This function will handle the initalization of any architecture
119 * specific callbacks.
120 */
121extern int kgdb_arch_init(void);
122
123/**
124 * kgdb_arch_exit - Perform any architecture specific uninitalization.
125 *
126 * This function will handle the uninitalization of any architecture
127 * specific callbacks, for dynamic registration and unregistration.
128 */
129extern void kgdb_arch_exit(void);
130
131/**
132 * pt_regs_to_gdb_regs - Convert ptrace regs to GDB regs
133 * @gdb_regs: A pointer to hold the registers in the order GDB wants.
134 * @regs: The &struct pt_regs of the current process.
135 *
136 * Convert the pt_regs in @regs into the format for registers that
137 * GDB expects, stored in @gdb_regs.
138 */
139extern void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs);
140
141/**
142 * sleeping_thread_to_gdb_regs - Convert ptrace regs to GDB regs
143 * @gdb_regs: A pointer to hold the registers in the order GDB wants.
144 * @p: The &struct task_struct of the desired process.
145 *
146 * Convert the register values of the sleeping process in @p to
147 * the format that GDB expects.
148 * This function is called when kgdb does not have access to the
149 * &struct pt_regs and therefore it should fill the gdb registers
150 * @gdb_regs with what has been saved in &struct thread_struct
151 * thread field during switch_to.
152 */
153extern void
154sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p);
155
156/**
157 * gdb_regs_to_pt_regs - Convert GDB regs to ptrace regs.
158 * @gdb_regs: A pointer to hold the registers we've received from GDB.
159 * @regs: A pointer to a &struct pt_regs to hold these values in.
160 *
161 * Convert the GDB regs in @gdb_regs into the pt_regs, and store them
162 * in @regs.
163 */
164extern void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs);
165
166/**
167 * kgdb_arch_handle_exception - Handle architecture specific GDB packets.
168 * @vector: The error vector of the exception that happened.
169 * @signo: The signal number of the exception that happened.
170 * @err_code: The error code of the exception that happened.
171 * @remcom_in_buffer: The buffer of the packet we have read.
172 * @remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into.
173 * @regs: The &struct pt_regs of the current process.
174 *
175 * This function MUST handle the 'c' and 's' command packets,
176 * as well packets to set / remove a hardware breakpoint, if used.
177 * If there are additional packets which the hardware needs to handle,
178 * they are handled here. The code should return -1 if it wants to
179 * process more packets, and a %0 or %1 if it wants to exit from the
180 * kgdb callback.
181 */
182extern int
183kgdb_arch_handle_exception(int vector, int signo, int err_code,
184 char *remcom_in_buffer,
185 char *remcom_out_buffer,
186 struct pt_regs *regs);
187
188/**
189 * kgdb_roundup_cpus - Get other CPUs into a holding pattern
190 * @flags: Current IRQ state
191 *
192 * On SMP systems, we need to get the attention of the other CPUs
193 * and get them be in a known state. This should do what is needed
194 * to get the other CPUs to call kgdb_wait(). Note that on some arches,
195 * the NMI approach is not used for rounding up all the CPUs. For example,
196 * in case of MIPS, smp_call_function() is used to roundup CPUs. In
197 * this case, we have to make sure that interrupts are enabled before
198 * calling smp_call_function(). The argument to this function is
199 * the flags that will be used when restoring the interrupts. There is
200 * local_irq_save() call before kgdb_roundup_cpus().
201 *
202 * On non-SMP systems, this is not called.
203 */
204extern void kgdb_roundup_cpus(unsigned long flags);
205
206/* Optional functions. */
207extern int kgdb_validate_break_address(unsigned long addr);
208extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr);
209extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle);
210
211/**
212 * struct kgdb_arch - Describe architecture specific values.
213 * @gdb_bpt_instr: The instruction to trigger a breakpoint.
214 * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT.
215 * @set_breakpoint: Allow an architecture to specify how to set a software
216 * breakpoint.
217 * @remove_breakpoint: Allow an architecture to specify how to remove a
218 * software breakpoint.
219 * @set_hw_breakpoint: Allow an architecture to specify how to set a hardware
220 * breakpoint.
221 * @remove_hw_breakpoint: Allow an architecture to specify how to remove a
222 * hardware breakpoint.
223 * @remove_all_hw_break: Allow an architecture to specify how to remove all
224 * hardware breakpoints.
225 * @correct_hw_break: Allow an architecture to specify how to correct the
226 * hardware debug registers.
227 */
228struct kgdb_arch {
229 unsigned char gdb_bpt_instr[BREAK_INSTR_SIZE];
230 unsigned long flags;
231
232 int (*set_breakpoint)(unsigned long, char *);
233 int (*remove_breakpoint)(unsigned long, char *);
234 int (*set_hw_breakpoint)(unsigned long, int, enum kgdb_bptype);
235 int (*remove_hw_breakpoint)(unsigned long, int, enum kgdb_bptype);
236 void (*remove_all_hw_break)(void);
237 void (*correct_hw_break)(void);
238};
239
240/**
241 * struct kgdb_io - Describe the interface for an I/O driver to talk with KGDB.
242 * @name: Name of the I/O driver.
243 * @read_char: Pointer to a function that will return one char.
244 * @write_char: Pointer to a function that will write one char.
245 * @flush: Pointer to a function that will flush any pending writes.
246 * @init: Pointer to a function that will initialize the device.
247 * @pre_exception: Pointer to a function that will do any prep work for
248 * the I/O driver.
249 * @post_exception: Pointer to a function that will do any cleanup work
250 * for the I/O driver.
251 */
252struct kgdb_io {
253 const char *name;
254 int (*read_char) (void);
255 void (*write_char) (u8);
256 void (*flush) (void);
257 int (*init) (void);
258 void (*pre_exception) (void);
259 void (*post_exception) (void);
260};
261
262extern struct kgdb_arch arch_kgdb_ops;
263
264extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops);
265extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
266
267extern int kgdb_hex2long(char **ptr, long *long_val);
268extern int kgdb_mem2hex(char *mem, char *buf, int count);
269extern int kgdb_hex2mem(char *buf, char *mem, int count);
270
271extern int kgdb_isremovedbreak(unsigned long addr);
272
273extern int
274kgdb_handle_exception(int ex_vector, int signo, int err_code,
275 struct pt_regs *regs);
276extern int kgdb_nmicallback(int cpu, void *regs);
277
278extern int kgdb_single_step;
279extern atomic_t kgdb_active;
280
281#endif /* _KGDB_H_ */
diff --git a/include/linux/klist.h b/include/linux/klist.h
index 74071254c9d3..06c338ef7f1b 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -25,37 +25,47 @@ struct klist {
25 void (*put)(struct klist_node *); 25 void (*put)(struct klist_node *);
26}; 26};
27 27
28#define KLIST_INIT(_name, _get, _put) \
29 { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \
30 .k_list = LIST_HEAD_INIT(_name.k_list), \
31 .get = _get, \
32 .put = _put, }
28 33
29extern void klist_init(struct klist * k, void (*get)(struct klist_node *), 34#define DEFINE_KLIST(_name, _get, _put) \
35 struct klist _name = KLIST_INIT(_name, _get, _put)
36
37extern void klist_init(struct klist *k, void (*get)(struct klist_node *),
30 void (*put)(struct klist_node *)); 38 void (*put)(struct klist_node *));
31 39
32struct klist_node { 40struct klist_node {
33 struct klist * n_klist; 41 struct klist *n_klist;
34 struct list_head n_node; 42 struct list_head n_node;
35 struct kref n_ref; 43 struct kref n_ref;
36 struct completion n_removed; 44 struct completion n_removed;
37}; 45};
38 46
39extern void klist_add_tail(struct klist_node * n, struct klist * k); 47extern void klist_add_tail(struct klist_node *n, struct klist *k);
40extern void klist_add_head(struct klist_node * n, struct klist * k); 48extern void klist_add_head(struct klist_node *n, struct klist *k);
49extern void klist_add_after(struct klist_node *n, struct klist_node *pos);
50extern void klist_add_before(struct klist_node *n, struct klist_node *pos);
41 51
42extern void klist_del(struct klist_node * n); 52extern void klist_del(struct klist_node *n);
43extern void klist_remove(struct klist_node * n); 53extern void klist_remove(struct klist_node *n);
44 54
45extern int klist_node_attached(struct klist_node * n); 55extern int klist_node_attached(struct klist_node *n);
46 56
47 57
48struct klist_iter { 58struct klist_iter {
49 struct klist * i_klist; 59 struct klist *i_klist;
50 struct list_head * i_head; 60 struct list_head *i_head;
51 struct klist_node * i_cur; 61 struct klist_node *i_cur;
52}; 62};
53 63
54 64
55extern void klist_iter_init(struct klist * k, struct klist_iter * i); 65extern void klist_iter_init(struct klist *k, struct klist_iter *i);
56extern void klist_iter_init_node(struct klist * k, struct klist_iter * i, 66extern void klist_iter_init_node(struct klist *k, struct klist_iter *i,
57 struct klist_node * n); 67 struct klist_node *n);
58extern void klist_iter_exit(struct klist_iter * i); 68extern void klist_iter_exit(struct klist_iter *i);
59extern struct klist_node * klist_next(struct klist_iter * i); 69extern struct klist_node *klist_next(struct klist_iter *i);
60 70
61#endif 71#endif
diff --git a/include/linux/kobj_map.h b/include/linux/kobj_map.h
index bafe178a381f..73717ed9ea79 100644
--- a/include/linux/kobj_map.h
+++ b/include/linux/kobj_map.h
@@ -1,5 +1,3 @@
1#ifdef __KERNEL__
2
3#include <linux/mutex.h> 1#include <linux/mutex.h>
4 2
5typedef struct kobject *kobj_probe_t(dev_t, int *, void *); 3typedef struct kobject *kobj_probe_t(dev_t, int *, void *);
@@ -10,5 +8,3 @@ int kobj_map(struct kobj_map *, dev_t, unsigned long, struct module *,
10void kobj_unmap(struct kobj_map *, dev_t, unsigned long); 8void kobj_unmap(struct kobj_map *, dev_t, unsigned long);
11struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *); 9struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *);
12struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *); 10struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *);
13
14#endif
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index caa3f411f15d..39e709f88aa0 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -16,8 +16,6 @@
16#ifndef _KOBJECT_H_ 16#ifndef _KOBJECT_H_
17#define _KOBJECT_H_ 17#define _KOBJECT_H_
18 18
19#ifdef __KERNEL__
20
21#include <linux/types.h> 19#include <linux/types.h>
22#include <linux/list.h> 20#include <linux/list.h>
23#include <linux/sysfs.h> 21#include <linux/sysfs.h>
@@ -224,5 +222,4 @@ static inline int kobject_action_type(const char *buf, size_t count,
224{ return -EINVAL; } 222{ return -EINVAL; }
225#endif 223#endif
226 224
227#endif /* __KERNEL__ */
228#endif /* _KOBJECT_H_ */ 225#endif /* _KOBJECT_H_ */
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 0f28486f6360..1036631ff4fa 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -173,6 +173,13 @@ struct kretprobe_blackpoint {
173 const char *name; 173 const char *name;
174 void *addr; 174 void *addr;
175}; 175};
176
177struct kprobe_blackpoint {
178 const char *name;
179 unsigned long start_addr;
180 unsigned long range;
181};
182
176extern struct kretprobe_blackpoint kretprobe_blacklist[]; 183extern struct kretprobe_blackpoint kretprobe_blacklist[];
177 184
178static inline void kretprobe_assert(struct kretprobe_instance *ri, 185static inline void kretprobe_assert(struct kretprobe_instance *ri,
@@ -227,15 +234,21 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)
227 234
228int register_kprobe(struct kprobe *p); 235int register_kprobe(struct kprobe *p);
229void unregister_kprobe(struct kprobe *p); 236void unregister_kprobe(struct kprobe *p);
237int register_kprobes(struct kprobe **kps, int num);
238void unregister_kprobes(struct kprobe **kps, int num);
230int setjmp_pre_handler(struct kprobe *, struct pt_regs *); 239int setjmp_pre_handler(struct kprobe *, struct pt_regs *);
231int longjmp_break_handler(struct kprobe *, struct pt_regs *); 240int longjmp_break_handler(struct kprobe *, struct pt_regs *);
232int register_jprobe(struct jprobe *p); 241int register_jprobe(struct jprobe *p);
233void unregister_jprobe(struct jprobe *p); 242void unregister_jprobe(struct jprobe *p);
243int register_jprobes(struct jprobe **jps, int num);
244void unregister_jprobes(struct jprobe **jps, int num);
234void jprobe_return(void); 245void jprobe_return(void);
235unsigned long arch_deref_entry_point(void *); 246unsigned long arch_deref_entry_point(void *);
236 247
237int register_kretprobe(struct kretprobe *rp); 248int register_kretprobe(struct kretprobe *rp);
238void unregister_kretprobe(struct kretprobe *rp); 249void unregister_kretprobe(struct kretprobe *rp);
250int register_kretprobes(struct kretprobe **rps, int num);
251void unregister_kretprobes(struct kretprobe **rps, int num);
239 252
240void kprobe_flush_task(struct task_struct *tk); 253void kprobe_flush_task(struct task_struct *tk);
241void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); 254void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
@@ -254,16 +267,30 @@ static inline int register_kprobe(struct kprobe *p)
254{ 267{
255 return -ENOSYS; 268 return -ENOSYS;
256} 269}
270static inline int register_kprobes(struct kprobe **kps, int num)
271{
272 return -ENOSYS;
273}
257static inline void unregister_kprobe(struct kprobe *p) 274static inline void unregister_kprobe(struct kprobe *p)
258{ 275{
259} 276}
277static inline void unregister_kprobes(struct kprobe **kps, int num)
278{
279}
260static inline int register_jprobe(struct jprobe *p) 280static inline int register_jprobe(struct jprobe *p)
261{ 281{
262 return -ENOSYS; 282 return -ENOSYS;
263} 283}
284static inline int register_jprobes(struct jprobe **jps, int num)
285{
286 return -ENOSYS;
287}
264static inline void unregister_jprobe(struct jprobe *p) 288static inline void unregister_jprobe(struct jprobe *p)
265{ 289{
266} 290}
291static inline void unregister_jprobes(struct jprobe **jps, int num)
292{
293}
267static inline void jprobe_return(void) 294static inline void jprobe_return(void)
268{ 295{
269} 296}
@@ -271,9 +298,16 @@ static inline int register_kretprobe(struct kretprobe *rp)
271{ 298{
272 return -ENOSYS; 299 return -ENOSYS;
273} 300}
301static inline int register_kretprobes(struct kretprobe **rps, int num)
302{
303 return -ENOSYS;
304}
274static inline void unregister_kretprobe(struct kretprobe *rp) 305static inline void unregister_kretprobe(struct kretprobe *rp)
275{ 306{
276} 307}
308static inline void unregister_kretprobes(struct kretprobe **rps, int num)
309{
310}
277static inline void kprobe_flush_task(struct task_struct *tk) 311static inline void kprobe_flush_task(struct task_struct *tk)
278{ 312{
279} 313}
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 5d185635786e..0cef6badd6fb 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -15,8 +15,6 @@
15#ifndef _KREF_H_ 15#ifndef _KREF_H_
16#define _KREF_H_ 16#define _KREF_H_
17 17
18#ifdef __KERNEL__
19
20#include <linux/types.h> 18#include <linux/types.h>
21#include <asm/atomic.h> 19#include <asm/atomic.h>
22 20
@@ -29,5 +27,4 @@ void kref_init(struct kref *kref);
29void kref_get(struct kref *kref); 27void kref_get(struct kref *kref);
30int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 28int kref_put(struct kref *kref, void (*release) (struct kref *kref));
31 29
32#endif /* __KERNEL__ */
33#endif /* _KREF_H_ */ 30#endif /* _KREF_H_ */
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 2cd7fa73d1af..ce5983225be4 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -327,4 +327,10 @@ extern void ktime_get_ts(struct timespec *ts);
327/* Get the real (wall-) time in timespec format: */ 327/* Get the real (wall-) time in timespec format: */
328#define ktime_get_real_ts(ts) getnstimeofday(ts) 328#define ktime_get_real_ts(ts) getnstimeofday(ts)
329 329
330static inline ktime_t ns_to_ktime(u64 ns)
331{
332 static const ktime_t ktime_zero = { .tv64 = 0 };
333 return ktime_add_ns(ktime_zero, ns);
334}
335
330#endif 336#endif
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index c1ec04fd000d..a281afeddfbb 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -8,11 +8,18 @@
8 */ 8 */
9 9
10#include <asm/types.h> 10#include <asm/types.h>
11#include <linux/compiler.h>
11#include <linux/ioctl.h> 12#include <linux/ioctl.h>
12#include <asm/kvm.h> 13#include <asm/kvm.h>
13 14
14#define KVM_API_VERSION 12 15#define KVM_API_VERSION 12
15 16
17/* for KVM_TRACE_ENABLE */
18struct kvm_user_trace_setup {
19 __u32 buf_size; /* sub_buffer size of each per-cpu */
20 __u32 buf_nr; /* the number of sub_buffers of each per-cpu */
21};
22
16/* for KVM_CREATE_MEMORY_REGION */ 23/* for KVM_CREATE_MEMORY_REGION */
17struct kvm_memory_region { 24struct kvm_memory_region {
18 __u32 slot; 25 __u32 slot;
@@ -73,6 +80,9 @@ struct kvm_irqchip {
73#define KVM_EXIT_INTR 10 80#define KVM_EXIT_INTR 10
74#define KVM_EXIT_SET_TPR 11 81#define KVM_EXIT_SET_TPR 11
75#define KVM_EXIT_TPR_ACCESS 12 82#define KVM_EXIT_TPR_ACCESS 12
83#define KVM_EXIT_S390_SIEIC 13
84#define KVM_EXIT_S390_RESET 14
85#define KVM_EXIT_DCR 15
76 86
77/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 87/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
78struct kvm_run { 88struct kvm_run {
@@ -137,6 +147,27 @@ struct kvm_run {
137 __u32 is_write; 147 __u32 is_write;
138 __u32 pad; 148 __u32 pad;
139 } tpr_access; 149 } tpr_access;
150 /* KVM_EXIT_S390_SIEIC */
151 struct {
152 __u8 icptcode;
153 __u64 mask; /* psw upper half */
154 __u64 addr; /* psw lower half */
155 __u16 ipa;
156 __u32 ipb;
157 } s390_sieic;
158 /* KVM_EXIT_S390_RESET */
159#define KVM_S390_RESET_POR 1
160#define KVM_S390_RESET_CLEAR 2
161#define KVM_S390_RESET_SUBSYSTEM 4
162#define KVM_S390_RESET_CPU_INIT 8
163#define KVM_S390_RESET_IPL 16
164 __u64 s390_reset_flags;
165 /* KVM_EXIT_DCR */
166 struct {
167 __u32 dcrn;
168 __u32 data;
169 __u8 is_write;
170 } dcr;
140 /* Fix the size of the union. */ 171 /* Fix the size of the union. */
141 char padding[256]; 172 char padding[256];
142 }; 173 };
@@ -204,6 +235,74 @@ struct kvm_vapic_addr {
204 __u64 vapic_addr; 235 __u64 vapic_addr;
205}; 236};
206 237
238/* for KVM_SET_MPSTATE */
239
240#define KVM_MP_STATE_RUNNABLE 0
241#define KVM_MP_STATE_UNINITIALIZED 1
242#define KVM_MP_STATE_INIT_RECEIVED 2
243#define KVM_MP_STATE_HALTED 3
244#define KVM_MP_STATE_SIPI_RECEIVED 4
245
246struct kvm_mp_state {
247 __u32 mp_state;
248};
249
250struct kvm_s390_psw {
251 __u64 mask;
252 __u64 addr;
253};
254
255/* valid values for type in kvm_s390_interrupt */
256#define KVM_S390_SIGP_STOP 0xfffe0000u
257#define KVM_S390_PROGRAM_INT 0xfffe0001u
258#define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u
259#define KVM_S390_RESTART 0xfffe0003u
260#define KVM_S390_INT_VIRTIO 0xffff2603u
261#define KVM_S390_INT_SERVICE 0xffff2401u
262#define KVM_S390_INT_EMERGENCY 0xffff1201u
263
264struct kvm_s390_interrupt {
265 __u32 type;
266 __u32 parm;
267 __u64 parm64;
268};
269
270#define KVM_TRC_SHIFT 16
271/*
272 * kvm trace categories
273 */
274#define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT)
275#define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) /* only 12 bits */
276
277/*
278 * kvm trace action
279 */
280#define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01)
281#define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02)
282#define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01)
283
284#define KVM_TRC_HEAD_SIZE 12
285#define KVM_TRC_CYCLE_SIZE 8
286#define KVM_TRC_EXTRA_MAX 7
287
288/* This structure represents a single trace buffer record. */
289struct kvm_trace_rec {
290 __u32 event:28;
291 __u32 extra_u32:3;
292 __u32 cycle_in:1;
293 __u32 pid;
294 __u32 vcpu_id;
295 union {
296 struct {
297 __u32 cycle_lo, cycle_hi;
298 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
299 } cycle;
300 struct {
301 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
302 } nocycle;
303 } u;
304};
305
207#define KVMIO 0xAE 306#define KVMIO 0xAE
208 307
209/* 308/*
@@ -212,6 +311,8 @@ struct kvm_vapic_addr {
212#define KVM_GET_API_VERSION _IO(KVMIO, 0x00) 311#define KVM_GET_API_VERSION _IO(KVMIO, 0x00)
213#define KVM_CREATE_VM _IO(KVMIO, 0x01) /* returns a VM fd */ 312#define KVM_CREATE_VM _IO(KVMIO, 0x01) /* returns a VM fd */
214#define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list) 313#define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list)
314
315#define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06)
215/* 316/*
216 * Check if a kvm extension is available. Argument is extension number, 317 * Check if a kvm extension is available. Argument is extension number,
217 * return is 1 (yes) or 0 (no, sorry). 318 * return is 1 (yes) or 0 (no, sorry).
@@ -222,7 +323,12 @@ struct kvm_vapic_addr {
222 */ 323 */
223#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ 324#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */
224#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) 325#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2)
225 326/*
327 * ioctls for kvm trace
328 */
329#define KVM_TRACE_ENABLE _IOW(KVMIO, 0x06, struct kvm_user_trace_setup)
330#define KVM_TRACE_PAUSE _IO(KVMIO, 0x07)
331#define KVM_TRACE_DISABLE _IO(KVMIO, 0x08)
226/* 332/*
227 * Extension capability list. 333 * Extension capability list.
228 */ 334 */
@@ -233,6 +339,13 @@ struct kvm_vapic_addr {
233#define KVM_CAP_SET_TSS_ADDR 4 339#define KVM_CAP_SET_TSS_ADDR 4
234#define KVM_CAP_VAPIC 6 340#define KVM_CAP_VAPIC 6
235#define KVM_CAP_EXT_CPUID 7 341#define KVM_CAP_EXT_CPUID 7
342#define KVM_CAP_CLOCKSOURCE 8
343#define KVM_CAP_NR_VCPUS 9 /* returns max vcpus per vm */
344#define KVM_CAP_NR_MEMSLOTS 10 /* returns max memory slots per vm */
345#define KVM_CAP_PIT 11
346#define KVM_CAP_NOP_IO_DELAY 12
347#define KVM_CAP_PV_MMU 13
348#define KVM_CAP_MP_STATE 14
236 349
237/* 350/*
238 * ioctls for VM fds 351 * ioctls for VM fds
@@ -255,6 +368,9 @@ struct kvm_vapic_addr {
255#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) 368#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
256#define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) 369#define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip)
257#define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) 370#define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip)
371#define KVM_CREATE_PIT _IO(KVMIO, 0x64)
372#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state)
373#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state)
258 374
259/* 375/*
260 * ioctls for vcpu fds 376 * ioctls for vcpu fds
@@ -281,5 +397,17 @@ struct kvm_vapic_addr {
281#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl) 397#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl)
282/* Available with KVM_CAP_VAPIC */ 398/* Available with KVM_CAP_VAPIC */
283#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr) 399#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr)
400/* valid for virtual machine (for floating interrupt)_and_ vcpu */
401#define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt)
402/* store status for s390 */
403#define KVM_S390_STORE_STATUS_NOADDR (-1ul)
404#define KVM_S390_STORE_STATUS_PREFIXED (-2ul)
405#define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long)
406/* initial ipl psw for s390 */
407#define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw)
408/* initial reset for s390 */
409#define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97)
410#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state)
411#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
284 412
285#endif 413#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 928b0d59e9ba..398978972b7a 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -15,6 +15,7 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/preempt.h> 17#include <linux/preempt.h>
18#include <linux/marker.h>
18#include <asm/signal.h> 19#include <asm/signal.h>
19 20
20#include <linux/kvm.h> 21#include <linux/kvm.h>
@@ -24,29 +25,18 @@
24 25
25#include <asm/kvm_host.h> 26#include <asm/kvm_host.h>
26 27
27#define KVM_MAX_VCPUS 4
28#define KVM_MEMORY_SLOTS 8
29/* memory slots that does not exposed to userspace */
30#define KVM_PRIVATE_MEM_SLOTS 4
31
32#define KVM_PIO_PAGE_OFFSET 1
33
34/* 28/*
35 * vcpu->requests bit members 29 * vcpu->requests bit members
36 */ 30 */
37#define KVM_REQ_TLB_FLUSH 0 31#define KVM_REQ_TLB_FLUSH 0
38#define KVM_REQ_MIGRATE_TIMER 1 32#define KVM_REQ_MIGRATE_TIMER 1
39#define KVM_REQ_REPORT_TPR_ACCESS 2 33#define KVM_REQ_REPORT_TPR_ACCESS 2
34#define KVM_REQ_MMU_RELOAD 3
35#define KVM_REQ_TRIPLE_FAULT 4
40 36
41struct kvm_vcpu; 37struct kvm_vcpu;
42extern struct kmem_cache *kvm_vcpu_cache; 38extern struct kmem_cache *kvm_vcpu_cache;
43 39
44struct kvm_guest_debug {
45 int enabled;
46 unsigned long bp[4];
47 int singlestep;
48};
49
50/* 40/*
51 * It would be nice to use something smarter than a linear search, TBD... 41 * It would be nice to use something smarter than a linear search, TBD...
52 * Thankfully we dont expect many devices to register (famous last words :), 42 * Thankfully we dont expect many devices to register (famous last words :),
@@ -67,7 +57,9 @@ void kvm_io_bus_register_dev(struct kvm_io_bus *bus,
67 57
68struct kvm_vcpu { 58struct kvm_vcpu {
69 struct kvm *kvm; 59 struct kvm *kvm;
60#ifdef CONFIG_PREEMPT_NOTIFIERS
70 struct preempt_notifier preempt_notifier; 61 struct preempt_notifier preempt_notifier;
62#endif
71 int vcpu_id; 63 int vcpu_id;
72 struct mutex mutex; 64 struct mutex mutex;
73 int cpu; 65 int cpu;
@@ -100,6 +92,10 @@ struct kvm_memory_slot {
100 unsigned long flags; 92 unsigned long flags;
101 unsigned long *rmap; 93 unsigned long *rmap;
102 unsigned long *dirty_bitmap; 94 unsigned long *dirty_bitmap;
95 struct {
96 unsigned long rmap_pde;
97 int write_count;
98 } *lpage_info;
103 unsigned long userspace_addr; 99 unsigned long userspace_addr;
104 int user_alloc; 100 int user_alloc;
105}; 101};
@@ -114,11 +110,11 @@ struct kvm {
114 KVM_PRIVATE_MEM_SLOTS]; 110 KVM_PRIVATE_MEM_SLOTS];
115 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; 111 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
116 struct list_head vm_list; 112 struct list_head vm_list;
117 struct file *filp;
118 struct kvm_io_bus mmio_bus; 113 struct kvm_io_bus mmio_bus;
119 struct kvm_io_bus pio_bus; 114 struct kvm_io_bus pio_bus;
120 struct kvm_vm_stat stat; 115 struct kvm_vm_stat stat;
121 struct kvm_arch arch; 116 struct kvm_arch arch;
117 atomic_t users_count;
122}; 118};
123 119
124/* The guest did something we don't support. */ 120/* The guest did something we don't support. */
@@ -145,14 +141,19 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
145 struct module *module); 141 struct module *module);
146void kvm_exit(void); 142void kvm_exit(void);
147 143
144void kvm_get_kvm(struct kvm *kvm);
145void kvm_put_kvm(struct kvm *kvm);
146
148#define HPA_MSB ((sizeof(hpa_t) * 8) - 1) 147#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
149#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) 148#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
150static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } 149static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
151struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva); 150struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
152 151
153extern struct page *bad_page; 152extern struct page *bad_page;
153extern pfn_t bad_pfn;
154 154
155int is_error_page(struct page *page); 155int is_error_page(struct page *page);
156int is_error_pfn(pfn_t pfn);
156int kvm_is_error_hva(unsigned long addr); 157int kvm_is_error_hva(unsigned long addr);
157int kvm_set_memory_region(struct kvm *kvm, 158int kvm_set_memory_region(struct kvm *kvm,
158 struct kvm_userspace_memory_region *mem, 159 struct kvm_userspace_memory_region *mem,
@@ -166,8 +167,19 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
166 int user_alloc); 167 int user_alloc);
167gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); 168gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
168struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 169struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
170unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
169void kvm_release_page_clean(struct page *page); 171void kvm_release_page_clean(struct page *page);
170void kvm_release_page_dirty(struct page *page); 172void kvm_release_page_dirty(struct page *page);
173void kvm_set_page_dirty(struct page *page);
174void kvm_set_page_accessed(struct page *page);
175
176pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);
177void kvm_release_pfn_dirty(pfn_t);
178void kvm_release_pfn_clean(pfn_t pfn);
179void kvm_set_pfn_dirty(pfn_t pfn);
180void kvm_set_pfn_accessed(pfn_t pfn);
181void kvm_get_pfn(pfn_t pfn);
182
171int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset, 183int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset,
172 int len); 184 int len);
173int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data, 185int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data,
@@ -188,6 +200,7 @@ void kvm_resched(struct kvm_vcpu *vcpu);
188void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); 200void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
189void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); 201void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
190void kvm_flush_remote_tlbs(struct kvm *kvm); 202void kvm_flush_remote_tlbs(struct kvm *kvm);
203void kvm_reload_remote_mmus(struct kvm *kvm);
191 204
192long kvm_arch_dev_ioctl(struct file *filp, 205long kvm_arch_dev_ioctl(struct file *filp,
193 unsigned int ioctl, unsigned long arg); 206 unsigned int ioctl, unsigned long arg);
@@ -223,6 +236,10 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
223 struct kvm_sregs *sregs); 236 struct kvm_sregs *sregs);
224int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, 237int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
225 struct kvm_sregs *sregs); 238 struct kvm_sregs *sregs);
239int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
240 struct kvm_mp_state *mp_state);
241int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
242 struct kvm_mp_state *mp_state);
226int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, 243int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
227 struct kvm_debug_guest *dbg); 244 struct kvm_debug_guest *dbg);
228int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); 245int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
@@ -255,6 +272,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm);
255 272
256int kvm_cpu_get_interrupt(struct kvm_vcpu *v); 273int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
257int kvm_cpu_has_interrupt(struct kvm_vcpu *v); 274int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
275int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
258void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 276void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
259 277
260static inline void kvm_guest_enter(void) 278static inline void kvm_guest_enter(void)
@@ -296,5 +314,18 @@ struct kvm_stats_debugfs_item {
296 struct dentry *dentry; 314 struct dentry *dentry;
297}; 315};
298extern struct kvm_stats_debugfs_item debugfs_entries[]; 316extern struct kvm_stats_debugfs_item debugfs_entries[];
317extern struct dentry *kvm_debugfs_dir;
318
319#ifdef CONFIG_KVM_TRACE
320int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg);
321void kvm_trace_cleanup(void);
322#else
323static inline
324int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg)
325{
326 return -EINVAL;
327}
328#define kvm_trace_cleanup() ((void)0)
329#endif
299 330
300#endif 331#endif
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index 5497aac0d2f8..3ddce03766ca 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -11,8 +11,11 @@
11 11
12/* Return values for hypercalls */ 12/* Return values for hypercalls */
13#define KVM_ENOSYS 1000 13#define KVM_ENOSYS 1000
14#define KVM_EFAULT EFAULT
15#define KVM_E2BIG E2BIG
14 16
15#define KVM_HC_VAPIC_POLL_IRQ 1 17#define KVM_HC_VAPIC_POLL_IRQ 1
18#define KVM_HC_MMU_OP 2
16 19
17/* 20/*
18 * hypercalls use architecture specific 21 * hypercalls use architecture specific
@@ -20,6 +23,12 @@
20#include <asm/kvm_para.h> 23#include <asm/kvm_para.h>
21 24
22#ifdef __KERNEL__ 25#ifdef __KERNEL__
26#ifdef CONFIG_KVM_GUEST
27void __init kvm_guest_init(void);
28#else
29#define kvm_guest_init() do { } while (0)
30#endif
31
23static inline int kvm_para_has_feature(unsigned int feature) 32static inline int kvm_para_has_feature(unsigned int feature)
24{ 33{
25 if (kvm_arch_para_features() & (1UL << feature)) 34 if (kvm_arch_para_features() & (1UL << feature))
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index 1c4e46decb22..9b6f395c9625 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -38,6 +38,8 @@ typedef unsigned long hva_t;
38typedef u64 hpa_t; 38typedef u64 hpa_t;
39typedef unsigned long hfn_t; 39typedef unsigned long hfn_t;
40 40
41typedef hfn_t pfn_t;
42
41struct kvm_pio_request { 43struct kvm_pio_request {
42 unsigned long count; 44 unsigned long count;
43 int cur_count; 45 int cur_count;
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 0201f6f51cea..519df72e939d 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -35,8 +35,11 @@ struct led_classdev {
35#define LED_SUSPENDED (1 << 0) 35#define LED_SUSPENDED (1 << 0)
36 36
37 /* Set LED brightness level */ 37 /* Set LED brightness level */
38 /* Must not sleep, use a workqueue if needed */
38 void (*brightness_set)(struct led_classdev *led_cdev, 39 void (*brightness_set)(struct led_classdev *led_cdev,
39 enum led_brightness brightness); 40 enum led_brightness brightness);
41 /* Get LED brightness level */
42 enum led_brightness (*brightness_get)(struct led_classdev *led_cdev);
40 43
41 /* Activate hardware accelerated blink */ 44 /* Activate hardware accelerated blink */
42 int (*blink_set)(struct led_classdev *led_cdev, 45 int (*blink_set)(struct led_classdev *led_cdev,
@@ -59,15 +62,7 @@ struct led_classdev {
59 62
60extern int led_classdev_register(struct device *parent, 63extern int led_classdev_register(struct device *parent,
61 struct led_classdev *led_cdev); 64 struct led_classdev *led_cdev);
62extern void __led_classdev_unregister(struct led_classdev *led_cdev, bool sus); 65extern void led_classdev_unregister(struct led_classdev *lcd);
63static inline void led_classdev_unregister(struct led_classdev *lcd)
64{
65 __led_classdev_unregister(lcd, false);
66}
67static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
68{
69 __led_classdev_unregister(lcd, true);
70}
71extern void led_classdev_suspend(struct led_classdev *led_cdev); 66extern void led_classdev_suspend(struct led_classdev *led_cdev);
72extern void led_classdev_resume(struct led_classdev *led_cdev); 67extern void led_classdev_resume(struct led_classdev *led_cdev);
73 68
@@ -134,6 +129,9 @@ struct gpio_led {
134struct gpio_led_platform_data { 129struct gpio_led_platform_data {
135 int num_leds; 130 int num_leds;
136 struct gpio_led *leds; 131 struct gpio_led *leds;
132 int (*gpio_blink_set)(unsigned gpio,
133 unsigned long *delay_on,
134 unsigned long *delay_off);
137}; 135};
138 136
139 137
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 37ee881c42ac..d1dfe872ee30 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -122,6 +122,8 @@ enum {
122 122
123 ATAPI_MAX_DRAIN = 16 << 10, 123 ATAPI_MAX_DRAIN = 16 << 10,
124 124
125 ATA_ALL_DEVICES = (1 << ATA_MAX_DEVICES) - 1,
126
125 ATA_SHT_EMULATED = 1, 127 ATA_SHT_EMULATED = 1,
126 ATA_SHT_CMD_PER_LUN = 1, 128 ATA_SHT_CMD_PER_LUN = 1,
127 ATA_SHT_THIS_ID = -1, 129 ATA_SHT_THIS_ID = -1,
@@ -163,9 +165,6 @@ enum {
163 ATA_DEV_NONE = 9, /* no device */ 165 ATA_DEV_NONE = 9, /* no device */
164 166
165 /* struct ata_link flags */ 167 /* struct ata_link flags */
166 ATA_LFLAG_HRST_TO_RESUME = (1 << 0), /* hardreset to resume link */
167 ATA_LFLAG_SKIP_D2H_BSY = (1 << 1), /* can't wait for the first D2H
168 * Register FIS clearing BSY */
169 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ 168 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */
170 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ 169 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */
171 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */ 170 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */
@@ -225,6 +224,7 @@ enum {
225 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ 224 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */
226 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */ 225 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */
227 ATA_QCFLAG_QUIET = (1 << 6), /* don't report device error */ 226 ATA_QCFLAG_QUIET = (1 << 6), /* don't report device error */
227 ATA_QCFLAG_RETRY = (1 << 7), /* retry after failure */
228 228
229 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */ 229 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */
230 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */ 230 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */
@@ -249,6 +249,25 @@ enum {
249 */ 249 */
250 ATA_TMOUT_FF_WAIT = 4 * HZ / 5, 250 ATA_TMOUT_FF_WAIT = 4 * HZ / 5,
251 251
252 /* Spec mandates to wait for ">= 2ms" before checking status
253 * after reset. We wait 150ms, because that was the magic
254 * delay used for ATAPI devices in Hale Landis's ATADRVR, for
255 * the period of time between when the ATA command register is
256 * written, and then status is checked. Because waiting for
257 * "a while" before checking status is fine, post SRST, we
258 * perform this magic delay here as well.
259 *
260 * Old drivers/ide uses the 2mS rule and then waits for ready.
261 */
262 ATA_WAIT_AFTER_RESET_MSECS = 150,
263
264 /* If PMP is supported, we have to do follow-up SRST. As some
265 * PMPs don't send D2H Reg FIS after hardreset, LLDs are
266 * advised to wait only for the following duration before
267 * doing SRST.
268 */
269 ATA_TMOUT_PMP_SRST_WAIT = 1 * HZ,
270
252 /* ATA bus states */ 271 /* ATA bus states */
253 BUS_UNKNOWN = 0, 272 BUS_UNKNOWN = 0,
254 BUS_DMA = 1, 273 BUS_DMA = 1,
@@ -292,17 +311,16 @@ enum {
292 311
293 /* reset / recovery action types */ 312 /* reset / recovery action types */
294 ATA_EH_REVALIDATE = (1 << 0), 313 ATA_EH_REVALIDATE = (1 << 0),
295 ATA_EH_SOFTRESET = (1 << 1), 314 ATA_EH_SOFTRESET = (1 << 1), /* meaningful only in ->prereset */
296 ATA_EH_HARDRESET = (1 << 2), 315 ATA_EH_HARDRESET = (1 << 2), /* meaningful only in ->prereset */
316 ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
297 ATA_EH_ENABLE_LINK = (1 << 3), 317 ATA_EH_ENABLE_LINK = (1 << 3),
298 ATA_EH_LPM = (1 << 4), /* link power management action */ 318 ATA_EH_LPM = (1 << 4), /* link power management action */
299 319
300 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
301 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, 320 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE,
302 321
303 /* ata_eh_info->flags */ 322 /* ata_eh_info->flags */
304 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ 323 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */
305 ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */
306 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ 324 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */
307 ATA_EHI_QUIET = (1 << 3), /* be quiet */ 325 ATA_EHI_QUIET = (1 << 3), /* be quiet */
308 326
@@ -313,7 +331,6 @@ enum {
313 ATA_EHI_POST_SETMODE = (1 << 20), /* revaildating after setmode */ 331 ATA_EHI_POST_SETMODE = (1 << 20), /* revaildating after setmode */
314 332
315 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, 333 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
316 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
317 334
318 /* max tries if error condition is still set after ->error_handler */ 335 /* max tries if error condition is still set after ->error_handler */
319 ATA_EH_MAX_TRIES = 5, 336 ATA_EH_MAX_TRIES = 5,
@@ -352,6 +369,22 @@ enum {
352 ATAPI_READ_CD = 2, /* READ CD [MSF] */ 369 ATAPI_READ_CD = 2, /* READ CD [MSF] */
353 ATAPI_PASS_THRU = 3, /* SAT pass-thru */ 370 ATAPI_PASS_THRU = 3, /* SAT pass-thru */
354 ATAPI_MISC = 4, /* the rest */ 371 ATAPI_MISC = 4, /* the rest */
372
373 /* Timing constants */
374 ATA_TIMING_SETUP = (1 << 0),
375 ATA_TIMING_ACT8B = (1 << 1),
376 ATA_TIMING_REC8B = (1 << 2),
377 ATA_TIMING_CYC8B = (1 << 3),
378 ATA_TIMING_8BIT = ATA_TIMING_ACT8B | ATA_TIMING_REC8B |
379 ATA_TIMING_CYC8B,
380 ATA_TIMING_ACTIVE = (1 << 4),
381 ATA_TIMING_RECOVER = (1 << 5),
382 ATA_TIMING_CYCLE = (1 << 6),
383 ATA_TIMING_UDMA = (1 << 7),
384 ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B |
385 ATA_TIMING_REC8B | ATA_TIMING_CYC8B |
386 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER |
387 ATA_TIMING_CYCLE | ATA_TIMING_UDMA,
355}; 388};
356 389
357enum ata_xfer_mask { 390enum ata_xfer_mask {
@@ -410,8 +443,9 @@ enum link_pm {
410 MAX_PERFORMANCE, 443 MAX_PERFORMANCE,
411 MEDIUM_POWER, 444 MEDIUM_POWER,
412}; 445};
413extern struct class_device_attribute class_device_attr_link_power_management_policy; 446extern struct device_attribute dev_attr_link_power_management_policy;
414 447
448#ifdef CONFIG_ATA_SFF
415struct ata_ioports { 449struct ata_ioports {
416 void __iomem *cmd_addr; 450 void __iomem *cmd_addr;
417 void __iomem *data_addr; 451 void __iomem *data_addr;
@@ -429,6 +463,7 @@ struct ata_ioports {
429 void __iomem *bmdma_addr; 463 void __iomem *bmdma_addr;
430 void __iomem *scr_addr; 464 void __iomem *scr_addr;
431}; 465};
466#endif /* CONFIG_ATA_SFF */
432 467
433struct ata_host { 468struct ata_host {
434 spinlock_t lock; 469 spinlock_t lock;
@@ -436,7 +471,7 @@ struct ata_host {
436 void __iomem * const *iomap; 471 void __iomem * const *iomap;
437 unsigned int n_ports; 472 unsigned int n_ports;
438 void *private_data; 473 void *private_data;
439 const struct ata_port_operations *ops; 474 struct ata_port_operations *ops;
440 unsigned long flags; 475 unsigned long flags;
441#ifdef CONFIG_ATA_ACPI 476#ifdef CONFIG_ATA_ACPI
442 acpi_handle acpi_handle; 477 acpi_handle acpi_handle;
@@ -513,11 +548,6 @@ struct ata_device {
513 u64 n_sectors; /* size of device, if ATA */ 548 u64 n_sectors; /* size of device, if ATA */
514 unsigned int class; /* ATA_DEV_xxx */ 549 unsigned int class; /* ATA_DEV_xxx */
515 550
516 union {
517 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
518 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
519 };
520
521 u8 pio_mode; 551 u8 pio_mode;
522 u8 dma_mode; 552 u8 dma_mode;
523 u8 xfer_mode; 553 u8 xfer_mode;
@@ -539,8 +569,13 @@ struct ata_device {
539 u16 sectors; /* Number of sectors per track */ 569 u16 sectors; /* Number of sectors per track */
540 570
541 /* error history */ 571 /* error history */
542 struct ata_ering ering;
543 int spdn_cnt; 572 int spdn_cnt;
573 struct ata_ering ering;
574
575 union {
576 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
577 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
578 };
544}; 579};
545 580
546/* Offset into struct ata_device. Fields above it are maintained 581/* Offset into struct ata_device. Fields above it are maintained
@@ -605,7 +640,7 @@ struct ata_link {
605 640
606struct ata_port { 641struct ata_port {
607 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ 642 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
608 const struct ata_port_operations *ops; 643 struct ata_port_operations *ops;
609 spinlock_t *lock; 644 spinlock_t *lock;
610 unsigned long flags; /* ATA_FLAG_xxx */ 645 unsigned long flags; /* ATA_FLAG_xxx */
611 unsigned int pflags; /* ATA_PFLAG_xxx */ 646 unsigned int pflags; /* ATA_PFLAG_xxx */
@@ -615,7 +650,9 @@ struct ata_port {
615 struct ata_prd *prd; /* our SG list */ 650 struct ata_prd *prd; /* our SG list */
616 dma_addr_t prd_dma; /* and its DMA mapping */ 651 dma_addr_t prd_dma; /* and its DMA mapping */
617 652
653#ifdef CONFIG_ATA_SFF
618 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ 654 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */
655#endif /* CONFIG_ATA_SFF */
619 656
620 u8 ctl; /* cache of ATA control register */ 657 u8 ctl; /* cache of ATA control register */
621 u8 last_ctl; /* Cache last written value */ 658 u8 last_ctl; /* Cache last written value */
@@ -667,81 +704,108 @@ struct ata_port {
667 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ 704 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */
668}; 705};
669 706
670struct ata_port_operations { 707/* The following initializer overrides a method to NULL whether one of
671 void (*dev_config) (struct ata_device *); 708 * its parent has the method defined or not. This is equivalent to
672 709 * ERR_PTR(-ENOENT). Unfortunately, ERR_PTR doesn't render a constant
673 void (*set_piomode) (struct ata_port *, struct ata_device *); 710 * expression and thus can't be used as an initializer.
674 void (*set_dmamode) (struct ata_port *, struct ata_device *); 711 */
675 unsigned long (*mode_filter) (struct ata_device *, unsigned long); 712#define ATA_OP_NULL (void *)(unsigned long)(-ENOENT)
676
677 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf);
678 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
679
680 void (*exec_command)(struct ata_port *ap, const struct ata_taskfile *tf);
681 u8 (*check_status)(struct ata_port *ap);
682 u8 (*check_altstatus)(struct ata_port *ap);
683 void (*dev_select)(struct ata_port *ap, unsigned int device);
684
685 void (*phy_reset) (struct ata_port *ap); /* obsolete */
686 int (*set_mode) (struct ata_link *link, struct ata_device **r_failed_dev);
687
688 int (*cable_detect) (struct ata_port *ap);
689
690 int (*check_atapi_dma) (struct ata_queued_cmd *qc);
691
692 void (*bmdma_setup) (struct ata_queued_cmd *qc);
693 void (*bmdma_start) (struct ata_queued_cmd *qc);
694
695 unsigned int (*data_xfer) (struct ata_device *dev, unsigned char *buf,
696 unsigned int buflen, int rw);
697
698 int (*qc_defer) (struct ata_queued_cmd *qc);
699 void (*qc_prep) (struct ata_queued_cmd *qc);
700 unsigned int (*qc_issue) (struct ata_queued_cmd *qc);
701
702 /* port multiplier */
703 void (*pmp_attach) (struct ata_port *ap);
704 void (*pmp_detach) (struct ata_port *ap);
705 713
706 /* Error handlers. ->error_handler overrides ->eng_timeout and 714struct ata_port_operations {
707 * indicates that new-style EH is in place. 715 /*
716 * Command execution
708 */ 717 */
709 void (*eng_timeout) (struct ata_port *ap); /* obsolete */ 718 int (*qc_defer)(struct ata_queued_cmd *qc);
710 719 int (*check_atapi_dma)(struct ata_queued_cmd *qc);
711 void (*freeze) (struct ata_port *ap); 720 void (*qc_prep)(struct ata_queued_cmd *qc);
712 void (*thaw) (struct ata_port *ap); 721 unsigned int (*qc_issue)(struct ata_queued_cmd *qc);
713 void (*error_handler) (struct ata_port *ap); 722 bool (*qc_fill_rtf)(struct ata_queued_cmd *qc);
714 void (*post_internal_cmd) (struct ata_queued_cmd *qc); 723
715 724 /*
716 irq_handler_t irq_handler; 725 * Configuration and exception handling
717 void (*irq_clear) (struct ata_port *); 726 */
718 u8 (*irq_on) (struct ata_port *); 727 int (*cable_detect)(struct ata_port *ap);
719 728 unsigned long (*mode_filter)(struct ata_device *dev, unsigned long xfer_mask);
720 int (*scr_read) (struct ata_port *ap, unsigned int sc_reg, u32 *val); 729 void (*set_piomode)(struct ata_port *ap, struct ata_device *dev);
721 int (*scr_write) (struct ata_port *ap, unsigned int sc_reg, u32 val); 730 void (*set_dmamode)(struct ata_port *ap, struct ata_device *dev);
731 int (*set_mode)(struct ata_link *link, struct ata_device **r_failed_dev);
732
733 void (*dev_config)(struct ata_device *dev);
734
735 void (*freeze)(struct ata_port *ap);
736 void (*thaw)(struct ata_port *ap);
737 ata_prereset_fn_t prereset;
738 ata_reset_fn_t softreset;
739 ata_reset_fn_t hardreset;
740 ata_postreset_fn_t postreset;
741 ata_prereset_fn_t pmp_prereset;
742 ata_reset_fn_t pmp_softreset;
743 ata_reset_fn_t pmp_hardreset;
744 ata_postreset_fn_t pmp_postreset;
745 void (*error_handler)(struct ata_port *ap);
746 void (*post_internal_cmd)(struct ata_queued_cmd *qc);
747
748 /*
749 * Optional features
750 */
751 int (*scr_read)(struct ata_port *ap, unsigned int sc_reg, u32 *val);
752 int (*scr_write)(struct ata_port *ap, unsigned int sc_reg, u32 val);
753 void (*pmp_attach)(struct ata_port *ap);
754 void (*pmp_detach)(struct ata_port *ap);
755 int (*enable_pm)(struct ata_port *ap, enum link_pm policy);
756 void (*disable_pm)(struct ata_port *ap);
757
758 /*
759 * Start, stop, suspend and resume
760 */
761 int (*port_suspend)(struct ata_port *ap, pm_message_t mesg);
762 int (*port_resume)(struct ata_port *ap);
763 int (*port_start)(struct ata_port *ap);
764 void (*port_stop)(struct ata_port *ap);
765 void (*host_stop)(struct ata_host *host);
766
767#ifdef CONFIG_ATA_SFF
768 /*
769 * SFF / taskfile oriented ops
770 */
771 void (*sff_dev_select)(struct ata_port *ap, unsigned int device);
772 u8 (*sff_check_status)(struct ata_port *ap);
773 u8 (*sff_check_altstatus)(struct ata_port *ap);
774 void (*sff_tf_load)(struct ata_port *ap, const struct ata_taskfile *tf);
775 void (*sff_tf_read)(struct ata_port *ap, struct ata_taskfile *tf);
776 void (*sff_exec_command)(struct ata_port *ap,
777 const struct ata_taskfile *tf);
778 unsigned int (*sff_data_xfer)(struct ata_device *dev,
779 unsigned char *buf, unsigned int buflen, int rw);
780 u8 (*sff_irq_on)(struct ata_port *);
781 void (*sff_irq_clear)(struct ata_port *);
722 782
723 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg); 783 void (*bmdma_setup)(struct ata_queued_cmd *qc);
724 int (*port_resume) (struct ata_port *ap); 784 void (*bmdma_start)(struct ata_queued_cmd *qc);
725 int (*enable_pm) (struct ata_port *ap, enum link_pm policy); 785 void (*bmdma_stop)(struct ata_queued_cmd *qc);
726 void (*disable_pm) (struct ata_port *ap); 786 u8 (*bmdma_status)(struct ata_port *ap);
727 int (*port_start) (struct ata_port *ap); 787#endif /* CONFIG_ATA_SFF */
728 void (*port_stop) (struct ata_port *ap);
729 788
730 void (*host_stop) (struct ata_host *host); 789 /*
790 * Obsolete
791 */
792 void (*phy_reset)(struct ata_port *ap);
793 void (*eng_timeout)(struct ata_port *ap);
731 794
732 void (*bmdma_stop) (struct ata_queued_cmd *qc); 795 /*
733 u8 (*bmdma_status) (struct ata_port *ap); 796 * ->inherits must be the last field and all the preceding
797 * fields must be pointers.
798 */
799 const struct ata_port_operations *inherits;
734}; 800};
735 801
736struct ata_port_info { 802struct ata_port_info {
737 struct scsi_host_template *sht;
738 unsigned long flags; 803 unsigned long flags;
739 unsigned long link_flags; 804 unsigned long link_flags;
740 unsigned long pio_mask; 805 unsigned long pio_mask;
741 unsigned long mwdma_mask; 806 unsigned long mwdma_mask;
742 unsigned long udma_mask; 807 unsigned long udma_mask;
743 const struct ata_port_operations *port_ops; 808 struct ata_port_operations *port_ops;
744 irq_handler_t irq_handler;
745 void *private_data; 809 void *private_data;
746}; 810};
747 811
@@ -759,11 +823,14 @@ struct ata_timing {
759 823
760#define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin) 824#define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin)
761 825
826/*
827 * Core layer - drivers/ata/libata-core.c
828 */
762extern const unsigned long sata_deb_timing_normal[]; 829extern const unsigned long sata_deb_timing_normal[];
763extern const unsigned long sata_deb_timing_hotplug[]; 830extern const unsigned long sata_deb_timing_hotplug[];
764extern const unsigned long sata_deb_timing_long[]; 831extern const unsigned long sata_deb_timing_long[];
765 832
766extern const struct ata_port_operations ata_dummy_port_ops; 833extern struct ata_port_operations ata_dummy_port_ops;
767extern const struct ata_port_info ata_dummy_port_info; 834extern const struct ata_port_info ata_dummy_port_info;
768 835
769static inline const unsigned long * 836static inline const unsigned long *
@@ -780,24 +847,22 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
780 return ap->ops == &ata_dummy_port_ops; 847 return ap->ops == &ata_dummy_port_ops;
781} 848}
782 849
783extern void sata_print_link_status(struct ata_link *link);
784extern void ata_port_probe(struct ata_port *); 850extern void ata_port_probe(struct ata_port *);
785extern void ata_bus_reset(struct ata_port *ap);
786extern int sata_set_spd(struct ata_link *link); 851extern int sata_set_spd(struct ata_link *link);
852extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
853extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline,
854 int (*check_ready)(struct ata_link *link));
787extern int sata_link_debounce(struct ata_link *link, 855extern int sata_link_debounce(struct ata_link *link,
788 const unsigned long *params, unsigned long deadline); 856 const unsigned long *params, unsigned long deadline);
789extern int sata_link_resume(struct ata_link *link, const unsigned long *params, 857extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
790 unsigned long deadline); 858 unsigned long deadline);
791extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
792extern int ata_std_softreset(struct ata_link *link, unsigned int *classes,
793 unsigned long deadline);
794extern int sata_link_hardreset(struct ata_link *link, 859extern int sata_link_hardreset(struct ata_link *link,
795 const unsigned long *timing, unsigned long deadline); 860 const unsigned long *timing, unsigned long deadline,
861 bool *online, int (*check_ready)(struct ata_link *));
796extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, 862extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
797 unsigned long deadline); 863 unsigned long deadline);
798extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); 864extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
799extern void ata_port_disable(struct ata_port *); 865extern void ata_port_disable(struct ata_port *);
800extern void ata_std_ports(struct ata_ioports *ioaddr);
801 866
802extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 867extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
803extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 868extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
@@ -810,7 +875,7 @@ extern int ata_host_activate(struct ata_host *host, int irq,
810 struct scsi_host_template *sht); 875 struct scsi_host_template *sht);
811extern void ata_host_detach(struct ata_host *host); 876extern void ata_host_detach(struct ata_host *host);
812extern void ata_host_init(struct ata_host *, struct device *, 877extern void ata_host_init(struct ata_host *, struct device *,
813 unsigned long, const struct ata_port_operations *); 878 unsigned long, struct ata_port_operations *);
814extern int ata_scsi_detect(struct scsi_host_template *sht); 879extern int ata_scsi_detect(struct scsi_host_template *sht);
815extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 880extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
816extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 881extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
@@ -823,7 +888,6 @@ extern void ata_sas_port_stop(struct ata_port *ap);
823extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); 888extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
824extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), 889extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
825 struct ata_port *ap); 890 struct ata_port *ap);
826extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
827extern int sata_scr_valid(struct ata_link *link); 891extern int sata_scr_valid(struct ata_link *link);
828extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); 892extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
829extern int sata_scr_write(struct ata_link *link, int reg, u32 val); 893extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
@@ -835,21 +899,9 @@ extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
835extern void ata_host_resume(struct ata_host *host); 899extern void ata_host_resume(struct ata_host *host);
836#endif 900#endif
837extern int ata_ratelimit(void); 901extern int ata_ratelimit(void);
838extern int ata_busy_sleep(struct ata_port *ap,
839 unsigned long timeout_pat, unsigned long timeout);
840extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline);
841extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline);
842extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 902extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
843 unsigned long interval_msec, 903 unsigned long interval_msec,
844 unsigned long timeout_msec); 904 unsigned long timeout_msec);
845extern unsigned int ata_dev_try_classify(struct ata_device *dev, int present,
846 u8 *r_err);
847
848/*
849 * Default driver ops implementations
850 */
851extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
852extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
853extern int atapi_cmd_type(u8 opcode); 905extern int atapi_cmd_type(u8 opcode);
854extern void ata_tf_to_fis(const struct ata_taskfile *tf, 906extern void ata_tf_to_fis(const struct ata_taskfile *tf,
855 u8 pmp, int is_cmd, u8 *fis); 907 u8 pmp, int is_cmd, u8 *fis);
@@ -864,23 +916,9 @@ extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
864extern int ata_xfer_mode2shift(unsigned long xfer_mode); 916extern int ata_xfer_mode2shift(unsigned long xfer_mode);
865extern const char *ata_mode_string(unsigned long xfer_mask); 917extern const char *ata_mode_string(unsigned long xfer_mask);
866extern unsigned long ata_id_xfermask(const u16 *id); 918extern unsigned long ata_id_xfermask(const u16 *id);
867extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device);
868extern void ata_std_dev_select(struct ata_port *ap, unsigned int device);
869extern u8 ata_check_status(struct ata_port *ap);
870extern u8 ata_altstatus(struct ata_port *ap);
871extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
872extern int ata_port_start(struct ata_port *ap); 919extern int ata_port_start(struct ata_port *ap);
873extern int ata_sff_port_start(struct ata_port *ap);
874extern irqreturn_t ata_interrupt(int irq, void *dev_instance);
875extern unsigned int ata_data_xfer(struct ata_device *dev,
876 unsigned char *buf, unsigned int buflen, int rw);
877extern unsigned int ata_data_xfer_noirq(struct ata_device *dev,
878 unsigned char *buf, unsigned int buflen, int rw);
879extern int ata_std_qc_defer(struct ata_queued_cmd *qc); 920extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
880extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc);
881extern void ata_qc_prep(struct ata_queued_cmd *qc);
882extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 921extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
883extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
884extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 922extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
885 unsigned int n_elem); 923 unsigned int n_elem);
886extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); 924extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
@@ -889,24 +927,8 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
889 unsigned int ofs, unsigned int len); 927 unsigned int ofs, unsigned int len);
890extern void ata_id_c_string(const u16 *id, unsigned char *s, 928extern void ata_id_c_string(const u16 *id, unsigned char *s,
891 unsigned int ofs, unsigned int len); 929 unsigned int ofs, unsigned int len);
892extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
893extern void ata_bmdma_start(struct ata_queued_cmd *qc);
894extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
895extern u8 ata_bmdma_status(struct ata_port *ap);
896extern void ata_bmdma_irq_clear(struct ata_port *ap);
897extern void ata_bmdma_freeze(struct ata_port *ap);
898extern void ata_bmdma_thaw(struct ata_port *ap);
899extern void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
900 ata_reset_fn_t softreset,
901 ata_reset_fn_t hardreset,
902 ata_postreset_fn_t postreset);
903extern void ata_bmdma_error_handler(struct ata_port *ap);
904extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc);
905extern int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
906 u8 status, int in_wq);
907extern void ata_qc_complete(struct ata_queued_cmd *qc); 930extern void ata_qc_complete(struct ata_queued_cmd *qc);
908extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active, 931extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active);
909 void (*finish_qc)(struct ata_queued_cmd *));
910extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, 932extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
911 void (*done)(struct scsi_cmnd *)); 933 void (*done)(struct scsi_cmnd *));
912extern int ata_std_bios_param(struct scsi_device *sdev, 934extern int ata_std_bios_param(struct scsi_device *sdev,
@@ -918,7 +940,6 @@ extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
918 int queue_depth); 940 int queue_depth);
919extern struct ata_device *ata_dev_pair(struct ata_device *adev); 941extern struct ata_device *ata_dev_pair(struct ata_device *adev);
920extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); 942extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
921extern u8 ata_irq_on(struct ata_port *ap);
922 943
923extern int ata_cable_40wire(struct ata_port *ap); 944extern int ata_cable_40wire(struct ata_port *ap);
924extern int ata_cable_80wire(struct ata_port *ap); 945extern int ata_cable_80wire(struct ata_port *ap);
@@ -926,10 +947,7 @@ extern int ata_cable_sata(struct ata_port *ap);
926extern int ata_cable_ignore(struct ata_port *ap); 947extern int ata_cable_ignore(struct ata_port *ap);
927extern int ata_cable_unknown(struct ata_port *ap); 948extern int ata_cable_unknown(struct ata_port *ap);
928 949
929/* 950/* Timing helpers */
930 * Timing helpers
931 */
932
933extern unsigned int ata_pio_need_iordy(const struct ata_device *); 951extern unsigned int ata_pio_need_iordy(const struct ata_device *);
934extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); 952extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
935extern int ata_timing_compute(struct ata_device *, unsigned short, 953extern int ata_timing_compute(struct ata_device *, unsigned short,
@@ -939,24 +957,31 @@ extern void ata_timing_merge(const struct ata_timing *,
939 unsigned int); 957 unsigned int);
940extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle); 958extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle);
941 959
942enum { 960/* PCI */
943 ATA_TIMING_SETUP = (1 << 0), 961#ifdef CONFIG_PCI
944 ATA_TIMING_ACT8B = (1 << 1), 962struct pci_dev;
945 ATA_TIMING_REC8B = (1 << 2), 963
946 ATA_TIMING_CYC8B = (1 << 3), 964struct pci_bits {
947 ATA_TIMING_8BIT = ATA_TIMING_ACT8B | ATA_TIMING_REC8B | 965 unsigned int reg; /* PCI config register to read */
948 ATA_TIMING_CYC8B, 966 unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */
949 ATA_TIMING_ACTIVE = (1 << 4), 967 unsigned long mask;
950 ATA_TIMING_RECOVER = (1 << 5), 968 unsigned long val;
951 ATA_TIMING_CYCLE = (1 << 6),
952 ATA_TIMING_UDMA = (1 << 7),
953 ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B |
954 ATA_TIMING_REC8B | ATA_TIMING_CYC8B |
955 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER |
956 ATA_TIMING_CYCLE | ATA_TIMING_UDMA,
957}; 969};
958 970
959/* libata-acpi.c */ 971extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
972extern void ata_pci_remove_one(struct pci_dev *pdev);
973
974#ifdef CONFIG_PM
975extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
976extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
977extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
978extern int ata_pci_device_resume(struct pci_dev *pdev);
979#endif /* CONFIG_PM */
980#endif /* CONFIG_PCI */
981
982/*
983 * ACPI - drivers/ata/libata-acpi.c
984 */
960#ifdef CONFIG_ATA_ACPI 985#ifdef CONFIG_ATA_ACPI
961static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) 986static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
962{ 987{
@@ -1000,56 +1025,8 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap,
1000} 1025}
1001#endif 1026#endif
1002 1027
1003#ifdef CONFIG_PCI
1004struct pci_dev;
1005
1006extern int ata_pci_init_one(struct pci_dev *pdev,
1007 const struct ata_port_info * const * ppi);
1008extern void ata_pci_remove_one(struct pci_dev *pdev);
1009#ifdef CONFIG_PM
1010extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
1011extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
1012extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
1013extern int ata_pci_device_resume(struct pci_dev *pdev);
1014#endif
1015extern int ata_pci_clear_simplex(struct pci_dev *pdev);
1016
1017struct pci_bits {
1018 unsigned int reg; /* PCI config register to read */
1019 unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */
1020 unsigned long mask;
1021 unsigned long val;
1022};
1023
1024extern int ata_pci_init_sff_host(struct ata_host *host);
1025extern int ata_pci_init_bmdma(struct ata_host *host);
1026extern int ata_pci_prepare_sff_host(struct pci_dev *pdev,
1027 const struct ata_port_info * const * ppi,
1028 struct ata_host **r_host);
1029extern int ata_pci_activate_sff_host(struct ata_host *host,
1030 irq_handler_t irq_handler,
1031 struct scsi_host_template *sht);
1032extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
1033extern unsigned long ata_pci_default_filter(struct ata_device *dev,
1034 unsigned long xfer_mask);
1035#endif /* CONFIG_PCI */
1036
1037/* 1028/*
1038 * PMP 1029 * EH - drivers/ata/libata-eh.c
1039 */
1040extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc);
1041extern int sata_pmp_std_prereset(struct ata_link *link, unsigned long deadline);
1042extern int sata_pmp_std_hardreset(struct ata_link *link, unsigned int *class,
1043 unsigned long deadline);
1044extern void sata_pmp_std_postreset(struct ata_link *link, unsigned int *class);
1045extern void sata_pmp_do_eh(struct ata_port *ap,
1046 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
1047 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset,
1048 ata_prereset_fn_t pmp_prereset, ata_reset_fn_t pmp_softreset,
1049 ata_reset_fn_t pmp_hardreset, ata_postreset_fn_t pmp_postreset);
1050
1051/*
1052 * EH
1053 */ 1030 */
1054extern void ata_port_schedule_eh(struct ata_port *ap); 1031extern void ata_port_schedule_eh(struct ata_port *ap);
1055extern int ata_link_abort(struct ata_link *link); 1032extern int ata_link_abort(struct ata_link *link);
@@ -1066,6 +1043,92 @@ extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
1066extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, 1043extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
1067 ata_reset_fn_t softreset, ata_reset_fn_t hardreset, 1044 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
1068 ata_postreset_fn_t postreset); 1045 ata_postreset_fn_t postreset);
1046extern void ata_std_error_handler(struct ata_port *ap);
1047
1048/*
1049 * Base operations to inherit from and initializers for sht
1050 *
1051 * Operations
1052 *
1053 * base : Common to all libata drivers.
1054 * sata : SATA controllers w/ native interface.
1055 * pmp : SATA controllers w/ PMP support.
1056 * sff : SFF ATA controllers w/o BMDMA support.
1057 * bmdma : SFF ATA controllers w/ BMDMA support.
1058 *
1059 * sht initializers
1060 *
1061 * BASE : Common to all libata drivers. The user must set
1062 * sg_tablesize and dma_boundary.
1063 * PIO : SFF ATA controllers w/ only PIO support.
1064 * BMDMA : SFF ATA controllers w/ BMDMA support. sg_tablesize and
1065 * dma_boundary are set to BMDMA limits.
1066 * NCQ : SATA controllers supporting NCQ. The user must set
1067 * sg_tablesize, dma_boundary and can_queue.
1068 */
1069extern const struct ata_port_operations ata_base_port_ops;
1070extern const struct ata_port_operations sata_port_ops;
1071
1072#define ATA_BASE_SHT(drv_name) \
1073 .module = THIS_MODULE, \
1074 .name = drv_name, \
1075 .ioctl = ata_scsi_ioctl, \
1076 .queuecommand = ata_scsi_queuecmd, \
1077 .can_queue = ATA_DEF_QUEUE, \
1078 .this_id = ATA_SHT_THIS_ID, \
1079 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, \
1080 .emulated = ATA_SHT_EMULATED, \
1081 .use_clustering = ATA_SHT_USE_CLUSTERING, \
1082 .proc_name = drv_name, \
1083 .slave_configure = ata_scsi_slave_config, \
1084 .slave_destroy = ata_scsi_slave_destroy, \
1085 .bios_param = ata_std_bios_param
1086
1087#define ATA_NCQ_SHT(drv_name) \
1088 ATA_BASE_SHT(drv_name), \
1089 .change_queue_depth = ata_scsi_change_queue_depth
1090
1091/*
1092 * PMP helpers
1093 */
1094#ifdef CONFIG_SATA_PMP
1095static inline bool sata_pmp_supported(struct ata_port *ap)
1096{
1097 return ap->flags & ATA_FLAG_PMP;
1098}
1099
1100static inline bool sata_pmp_attached(struct ata_port *ap)
1101{
1102 return ap->nr_pmp_links != 0;
1103}
1104
1105static inline int ata_is_host_link(const struct ata_link *link)
1106{
1107 return link == &link->ap->link;
1108}
1109#else /* CONFIG_SATA_PMP */
1110static inline bool sata_pmp_supported(struct ata_port *ap)
1111{
1112 return false;
1113}
1114
1115static inline bool sata_pmp_attached(struct ata_port *ap)
1116{
1117 return false;
1118}
1119
1120static inline int ata_is_host_link(const struct ata_link *link)
1121{
1122 return 1;
1123}
1124#endif /* CONFIG_SATA_PMP */
1125
1126static inline int sata_srst_pmp(struct ata_link *link)
1127{
1128 if (sata_pmp_supported(link->ap) && ata_is_host_link(link))
1129 return SATA_PMP_CTRL_PORT;
1130 return link->pmp;
1131}
1069 1132
1070/* 1133/*
1071 * printk helpers 1134 * printk helpers
@@ -1074,7 +1137,7 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
1074 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) 1137 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)
1075 1138
1076#define ata_link_printk(link, lv, fmt, args...) do { \ 1139#define ata_link_printk(link, lv, fmt, args...) do { \
1077 if ((link)->ap->nr_pmp_links) \ 1140 if (sata_pmp_attached((link)->ap)) \
1078 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ 1141 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \
1079 (link)->pmp , ##args); \ 1142 (link)->pmp , ##args); \
1080 else \ 1143 else \
@@ -1094,18 +1157,11 @@ extern void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
1094 __attribute__ ((format (printf, 2, 3))); 1157 __attribute__ ((format (printf, 2, 3)));
1095extern void ata_ehi_clear_desc(struct ata_eh_info *ehi); 1158extern void ata_ehi_clear_desc(struct ata_eh_info *ehi);
1096 1159
1097static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi)
1098{
1099 ehi->flags |= ATA_EHI_RESUME_LINK;
1100 ehi->action |= ATA_EH_SOFTRESET;
1101 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
1102}
1103
1104static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi) 1160static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
1105{ 1161{
1106 ata_ehi_schedule_probe(ehi); 1162 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
1107 ehi->flags |= ATA_EHI_HOTPLUGGED; 1163 ehi->flags |= ATA_EHI_HOTPLUGGED;
1108 ehi->action |= ATA_EH_ENABLE_LINK; 1164 ehi->action |= ATA_EH_RESET | ATA_EH_ENABLE_LINK;
1109 ehi->err_mask |= AC_ERR_ATA_BUS; 1165 ehi->err_mask |= AC_ERR_ATA_BUS;
1110} 1166}
1111 1167
@@ -1126,7 +1182,7 @@ static inline unsigned int ata_tag_valid(unsigned int tag)
1126 1182
1127static inline unsigned int ata_tag_internal(unsigned int tag) 1183static inline unsigned int ata_tag_internal(unsigned int tag)
1128{ 1184{
1129 return tag == ATA_MAX_QUEUE - 1; 1185 return tag == ATA_TAG_INTERNAL;
1130} 1186}
1131 1187
1132/* 1188/*
@@ -1167,11 +1223,6 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev)
1167/* 1223/*
1168 * link helpers 1224 * link helpers
1169 */ 1225 */
1170static inline int ata_is_host_link(const struct ata_link *link)
1171{
1172 return link == &link->ap->link;
1173}
1174
1175static inline int ata_link_max_devices(const struct ata_link *link) 1226static inline int ata_link_max_devices(const struct ata_link *link)
1176{ 1227{
1177 if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS) 1228 if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS)
@@ -1186,7 +1237,7 @@ static inline int ata_link_active(struct ata_link *link)
1186 1237
1187static inline struct ata_link *ata_port_first_link(struct ata_port *ap) 1238static inline struct ata_link *ata_port_first_link(struct ata_port *ap)
1188{ 1239{
1189 if (ap->nr_pmp_links) 1240 if (sata_pmp_attached(ap))
1190 return ap->pmp_link; 1241 return ap->pmp_link;
1191 return &ap->link; 1242 return &ap->link;
1192} 1243}
@@ -1195,8 +1246,8 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link)
1195{ 1246{
1196 struct ata_port *ap = link->ap; 1247 struct ata_port *ap = link->ap;
1197 1248
1198 if (link == &ap->link) { 1249 if (ata_is_host_link(link)) {
1199 if (!ap->nr_pmp_links) 1250 if (!sata_pmp_attached(ap))
1200 return NULL; 1251 return NULL;
1201 return ap->pmp_link; 1252 return ap->pmp_link;
1202 } 1253 }
@@ -1222,11 +1273,6 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link)
1222 for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ 1273 for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \
1223 (dev) >= (link)->device || ((dev) = NULL); (dev)--) 1274 (dev) >= (link)->device || ((dev) = NULL); (dev)--)
1224 1275
1225static inline u8 ata_chk_status(struct ata_port *ap)
1226{
1227 return ap->ops->check_status(ap);
1228}
1229
1230/** 1276/**
1231 * ata_ncq_enabled - Test whether NCQ is enabled 1277 * ata_ncq_enabled - Test whether NCQ is enabled
1232 * @dev: ATA device to test for 1278 * @dev: ATA device to test for
@@ -1243,74 +1289,6 @@ static inline int ata_ncq_enabled(struct ata_device *dev)
1243 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; 1289 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ;
1244} 1290}
1245 1291
1246/**
1247 * ata_pause - Flush writes and pause 400 nanoseconds.
1248 * @ap: Port to wait for.
1249 *
1250 * LOCKING:
1251 * Inherited from caller.
1252 */
1253
1254static inline void ata_pause(struct ata_port *ap)
1255{
1256 ata_altstatus(ap);
1257 ndelay(400);
1258}
1259
1260
1261/**
1262 * ata_busy_wait - Wait for a port status register
1263 * @ap: Port to wait for.
1264 * @bits: bits that must be clear
1265 * @max: number of 10uS waits to perform
1266 *
1267 * Waits up to max*10 microseconds for the selected bits in the port's
1268 * status register to be cleared.
1269 * Returns final value of status register.
1270 *
1271 * LOCKING:
1272 * Inherited from caller.
1273 */
1274
1275static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
1276 unsigned int max)
1277{
1278 u8 status;
1279
1280 do {
1281 udelay(10);
1282 status = ata_chk_status(ap);
1283 max--;
1284 } while (status != 0xff && (status & bits) && (max > 0));
1285
1286 return status;
1287}
1288
1289
1290/**
1291 * ata_wait_idle - Wait for a port to be idle.
1292 * @ap: Port to wait for.
1293 *
1294 * Waits up to 10ms for port's BUSY and DRQ signals to clear.
1295 * Returns final value of status register.
1296 *
1297 * LOCKING:
1298 * Inherited from caller.
1299 */
1300
1301static inline u8 ata_wait_idle(struct ata_port *ap)
1302{
1303 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1304
1305#ifdef ATA_DEBUG
1306 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ)))
1307 ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n",
1308 status);
1309#endif
1310
1311 return status;
1312}
1313
1314static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) 1292static inline void ata_qc_set_polling(struct ata_queued_cmd *qc)
1315{ 1293{
1316 qc->tf.ctl |= ATA_NIEN; 1294 qc->tf.ctl |= ATA_NIEN;
@@ -1403,4 +1381,171 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
1403 return *(struct ata_port **)&host->hostdata[0]; 1381 return *(struct ata_port **)&host->hostdata[0];
1404} 1382}
1405 1383
1384
1385/**************************************************************************
1386 * PMP - drivers/ata/libata-pmp.c
1387 */
1388#ifdef CONFIG_SATA_PMP
1389
1390extern const struct ata_port_operations sata_pmp_port_ops;
1391
1392extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc);
1393extern void sata_pmp_error_handler(struct ata_port *ap);
1394
1395#else /* CONFIG_SATA_PMP */
1396
1397#define sata_pmp_port_ops sata_port_ops
1398#define sata_pmp_qc_defer_cmd_switch ata_std_qc_defer
1399#define sata_pmp_error_handler ata_std_error_handler
1400
1401#endif /* CONFIG_SATA_PMP */
1402
1403
1404/**************************************************************************
1405 * SFF - drivers/ata/libata-sff.c
1406 */
1407#ifdef CONFIG_ATA_SFF
1408
1409extern const struct ata_port_operations ata_sff_port_ops;
1410extern const struct ata_port_operations ata_bmdma_port_ops;
1411
1412/* PIO only, sg_tablesize and dma_boundary limits can be removed */
1413#define ATA_PIO_SHT(drv_name) \
1414 ATA_BASE_SHT(drv_name), \
1415 .sg_tablesize = LIBATA_MAX_PRD, \
1416 .dma_boundary = ATA_DMA_BOUNDARY
1417
1418#define ATA_BMDMA_SHT(drv_name) \
1419 ATA_BASE_SHT(drv_name), \
1420 .sg_tablesize = LIBATA_MAX_PRD, \
1421 .dma_boundary = ATA_DMA_BOUNDARY
1422
1423extern void ata_sff_qc_prep(struct ata_queued_cmd *qc);
1424extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc);
1425extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device);
1426extern u8 ata_sff_check_status(struct ata_port *ap);
1427extern u8 ata_sff_altstatus(struct ata_port *ap);
1428extern int ata_sff_busy_sleep(struct ata_port *ap,
1429 unsigned long timeout_pat, unsigned long timeout);
1430extern int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline);
1431extern void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
1432extern void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
1433extern void ata_sff_exec_command(struct ata_port *ap,
1434 const struct ata_taskfile *tf);
1435extern unsigned int ata_sff_data_xfer(struct ata_device *dev,
1436 unsigned char *buf, unsigned int buflen, int rw);
1437extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev,
1438 unsigned char *buf, unsigned int buflen, int rw);
1439extern u8 ata_sff_irq_on(struct ata_port *ap);
1440extern void ata_sff_irq_clear(struct ata_port *ap);
1441extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
1442 u8 status, int in_wq);
1443extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc);
1444extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
1445extern unsigned int ata_sff_host_intr(struct ata_port *ap,
1446 struct ata_queued_cmd *qc);
1447extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance);
1448extern void ata_sff_freeze(struct ata_port *ap);
1449extern void ata_sff_thaw(struct ata_port *ap);
1450extern int ata_sff_prereset(struct ata_link *link, unsigned long deadline);
1451extern unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
1452 u8 *r_err);
1453extern int ata_sff_wait_after_reset(struct ata_link *link, unsigned int devmask,
1454 unsigned long deadline);
1455extern int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
1456 unsigned long deadline);
1457extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
1458 unsigned long deadline);
1459extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes);
1460extern void ata_sff_error_handler(struct ata_port *ap);
1461extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc);
1462extern int ata_sff_port_start(struct ata_port *ap);
1463extern void ata_sff_std_ports(struct ata_ioports *ioaddr);
1464extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev,
1465 unsigned long xfer_mask);
1466extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
1467extern void ata_bmdma_start(struct ata_queued_cmd *qc);
1468extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
1469extern u8 ata_bmdma_status(struct ata_port *ap);
1470extern void ata_bus_reset(struct ata_port *ap);
1471
1472#ifdef CONFIG_PCI
1473extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev);
1474extern int ata_pci_bmdma_init(struct ata_host *host);
1475extern int ata_pci_sff_init_host(struct ata_host *host);
1476extern int ata_pci_sff_prepare_host(struct pci_dev *pdev,
1477 const struct ata_port_info * const * ppi,
1478 struct ata_host **r_host);
1479extern int ata_pci_sff_activate_host(struct ata_host *host,
1480 irq_handler_t irq_handler,
1481 struct scsi_host_template *sht);
1482extern int ata_pci_sff_init_one(struct pci_dev *pdev,
1483 const struct ata_port_info * const * ppi,
1484 struct scsi_host_template *sht, void *host_priv);
1485#endif /* CONFIG_PCI */
1486
1487/**
1488 * ata_sff_pause - Flush writes and pause 400 nanoseconds.
1489 * @ap: Port to wait for.
1490 *
1491 * LOCKING:
1492 * Inherited from caller.
1493 */
1494static inline void ata_sff_pause(struct ata_port *ap)
1495{
1496 ata_sff_altstatus(ap);
1497 ndelay(400);
1498}
1499
1500/**
1501 * ata_sff_busy_wait - Wait for a port status register
1502 * @ap: Port to wait for.
1503 * @bits: bits that must be clear
1504 * @max: number of 10uS waits to perform
1505 *
1506 * Waits up to max*10 microseconds for the selected bits in the port's
1507 * status register to be cleared.
1508 * Returns final value of status register.
1509 *
1510 * LOCKING:
1511 * Inherited from caller.
1512 */
1513static inline u8 ata_sff_busy_wait(struct ata_port *ap, unsigned int bits,
1514 unsigned int max)
1515{
1516 u8 status;
1517
1518 do {
1519 udelay(10);
1520 status = ap->ops->sff_check_status(ap);
1521 max--;
1522 } while (status != 0xff && (status & bits) && (max > 0));
1523
1524 return status;
1525}
1526
1527/**
1528 * ata_wait_idle - Wait for a port to be idle.
1529 * @ap: Port to wait for.
1530 *
1531 * Waits up to 10ms for port's BUSY and DRQ signals to clear.
1532 * Returns final value of status register.
1533 *
1534 * LOCKING:
1535 * Inherited from caller.
1536 */
1537static inline u8 ata_wait_idle(struct ata_port *ap)
1538{
1539 u8 status = ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1540
1541#ifdef ATA_DEBUG
1542 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ)))
1543 ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n",
1544 status);
1545#endif
1546
1547 return status;
1548}
1549#endif /* CONFIG_ATA_SFF */
1550
1406#endif /* __LINUX_LIBATA_H__ */ 1551#endif /* __LINUX_LIBATA_H__ */
diff --git a/include/linux/list.h b/include/linux/list.h
index 75ce2cb4ff6e..08cf4f651889 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -1,8 +1,6 @@
1#ifndef _LINUX_LIST_H 1#ifndef _LINUX_LIST_H
2#define _LINUX_LIST_H 2#define _LINUX_LIST_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/stddef.h> 4#include <linux/stddef.h>
7#include <linux/poison.h> 5#include <linux/poison.h>
8#include <linux/prefetch.h> 6#include <linux/prefetch.h>
@@ -319,7 +317,16 @@ static inline int list_empty_careful(const struct list_head *head)
319 return (next == head) && (next == head->prev); 317 return (next == head) && (next == head->prev);
320} 318}
321 319
322static inline void __list_splice(struct list_head *list, 320/**
321 * list_is_singular - tests whether a list has just one entry.
322 * @head: the list to test.
323 */
324static inline int list_is_singular(const struct list_head *head)
325{
326 return !list_empty(head) && (head->next == head->prev);
327}
328
329static inline void __list_splice(const struct list_head *list,
323 struct list_head *head) 330 struct list_head *head)
324{ 331{
325 struct list_head *first = list->next; 332 struct list_head *first = list->next;
@@ -338,7 +345,8 @@ static inline void __list_splice(struct list_head *list,
338 * @list: the new list to add. 345 * @list: the new list to add.
339 * @head: the place to add it in the first list. 346 * @head: the place to add it in the first list.
340 */ 347 */
341static inline void list_splice(struct list_head *list, struct list_head *head) 348static inline void list_splice(const struct list_head *list,
349 struct list_head *head)
342{ 350{
343 if (!list_empty(list)) 351 if (!list_empty(list))
344 __list_splice(list, head); 352 __list_splice(list, head);
@@ -631,31 +639,14 @@ static inline void list_splice_init_rcu(struct list_head *list,
631 * as long as the traversal is guarded by rcu_read_lock(). 639 * as long as the traversal is guarded by rcu_read_lock().
632 */ 640 */
633#define list_for_each_rcu(pos, head) \ 641#define list_for_each_rcu(pos, head) \
634 for (pos = (head)->next; \ 642 for (pos = rcu_dereference((head)->next); \
635 prefetch(rcu_dereference(pos)->next), pos != (head); \ 643 prefetch(pos->next), pos != (head); \
636 pos = pos->next) 644 pos = rcu_dereference(pos->next))
637 645
638#define __list_for_each_rcu(pos, head) \ 646#define __list_for_each_rcu(pos, head) \
639 for (pos = (head)->next; \ 647 for (pos = rcu_dereference((head)->next); \
640 rcu_dereference(pos) != (head); \ 648 pos != (head); \
641 pos = pos->next) 649 pos = rcu_dereference(pos->next))
642
643/**
644 * list_for_each_safe_rcu
645 * @pos: the &struct list_head to use as a loop cursor.
646 * @n: another &struct list_head to use as temporary storage
647 * @head: the head for your list.
648 *
649 * Iterate over an rcu-protected list, safe against removal of list entry.
650 *
651 * This list-traversal primitive may safely run concurrently with
652 * the _rcu list-mutation primitives such as list_add_rcu()
653 * as long as the traversal is guarded by rcu_read_lock().
654 */
655#define list_for_each_safe_rcu(pos, n, head) \
656 for (pos = (head)->next; \
657 n = rcu_dereference(pos)->next, pos != (head); \
658 pos = n)
659 650
660/** 651/**
661 * list_for_each_entry_rcu - iterate over rcu list of given type 652 * list_for_each_entry_rcu - iterate over rcu list of given type
@@ -668,10 +659,9 @@ static inline void list_splice_init_rcu(struct list_head *list,
668 * as long as the traversal is guarded by rcu_read_lock(). 659 * as long as the traversal is guarded by rcu_read_lock().
669 */ 660 */
670#define list_for_each_entry_rcu(pos, head, member) \ 661#define list_for_each_entry_rcu(pos, head, member) \
671 for (pos = list_entry((head)->next, typeof(*pos), member); \ 662 for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), member); \
672 prefetch(rcu_dereference(pos)->member.next), \ 663 prefetch(pos->member.next), &pos->member != (head); \
673 &pos->member != (head); \ 664 pos = list_entry(rcu_dereference(pos->member.next), typeof(*pos), member))
674 pos = list_entry(pos->member.next, typeof(*pos), member))
675 665
676 666
677/** 667/**
@@ -686,9 +676,9 @@ static inline void list_splice_init_rcu(struct list_head *list,
686 * as long as the traversal is guarded by rcu_read_lock(). 676 * as long as the traversal is guarded by rcu_read_lock().
687 */ 677 */
688#define list_for_each_continue_rcu(pos, head) \ 678#define list_for_each_continue_rcu(pos, head) \
689 for ((pos) = (pos)->next; \ 679 for ((pos) = rcu_dereference((pos)->next); \
690 prefetch(rcu_dereference((pos))->next), (pos) != (head); \ 680 prefetch((pos)->next), (pos) != (head); \
691 (pos) = (pos)->next) 681 (pos) = rcu_dereference((pos)->next))
692 682
693/* 683/*
694 * Double linked lists with a single pointer list head. 684 * Double linked lists with a single pointer list head.
@@ -986,12 +976,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
986 * as long as the traversal is guarded by rcu_read_lock(). 976 * as long as the traversal is guarded by rcu_read_lock().
987 */ 977 */
988#define hlist_for_each_entry_rcu(tpos, pos, head, member) \ 978#define hlist_for_each_entry_rcu(tpos, pos, head, member) \
989 for (pos = (head)->first; \ 979 for (pos = rcu_dereference((head)->first); \
990 rcu_dereference(pos) && ({ prefetch(pos->next); 1;}) && \ 980 pos && ({ prefetch(pos->next); 1;}) && \
991 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 981 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
992 pos = pos->next) 982 pos = rcu_dereference(pos->next))
993 983
994#else
995#warning "don't include kernel headers in userspace"
996#endif /* __KERNEL__ */
997#endif 984#endif
diff --git a/include/linux/lm_interface.h b/include/linux/lm_interface.h
index 1418fdc9ac02..f274997bc283 100644
--- a/include/linux/lm_interface.h
+++ b/include/linux/lm_interface.h
@@ -21,9 +21,15 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
21 * modify the filesystem. The lock module shouldn't assign a journal to the FS 21 * modify the filesystem. The lock module shouldn't assign a journal to the FS
22 * mount. It shouldn't send recovery callbacks to the FS mount. If the node 22 * mount. It shouldn't send recovery callbacks to the FS mount. If the node
23 * dies or withdraws, all locks can be wiped immediately. 23 * dies or withdraws, all locks can be wiped immediately.
24 *
25 * LM_MFLAG_CONV_NODROP
26 * Do not allow the dlm to internally resolve conversion deadlocks by demoting
27 * the lock to unlocked and then reacquiring it in the requested mode. Instead,
28 * it should cancel the request and return LM_OUT_CONV_DEADLK.
24 */ 29 */
25 30
26#define LM_MFLAG_SPECTATOR 0x00000001 31#define LM_MFLAG_SPECTATOR 0x00000001
32#define LM_MFLAG_CONV_NODROP 0x00000002
27 33
28/* 34/*
29 * lm_lockstruct flags 35 * lm_lockstruct flags
@@ -110,6 +116,9 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
110 * 116 *
111 * LM_OUT_ASYNC 117 * LM_OUT_ASYNC
112 * The result of the request will be returned in an LM_CB_ASYNC callback. 118 * The result of the request will be returned in an LM_CB_ASYNC callback.
119 *
120 * LM_OUT_CONV_DEADLK
121 * The lock request was canceled do to a conversion deadlock.
113 */ 122 */
114 123
115#define LM_OUT_ST_MASK 0x00000003 124#define LM_OUT_ST_MASK 0x00000003
@@ -117,6 +126,7 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
117#define LM_OUT_CANCELED 0x00000008 126#define LM_OUT_CANCELED 0x00000008
118#define LM_OUT_ASYNC 0x00000080 127#define LM_OUT_ASYNC 0x00000080
119#define LM_OUT_ERROR 0x00000100 128#define LM_OUT_ERROR 0x00000100
129#define LM_OUT_CONV_DEADLK 0x00000200
120 130
121/* 131/*
122 * lm_callback_t types 132 * lm_callback_t types
diff --git a/include/linux/lmb.h b/include/linux/lmb.h
new file mode 100644
index 000000000000..c46c89505dac
--- /dev/null
+++ b/include/linux/lmb.h
@@ -0,0 +1,87 @@
1#ifndef _LINUX_LMB_H
2#define _LINUX_LMB_H
3#ifdef __KERNEL__
4
5/*
6 * Logical memory blocks.
7 *
8 * Copyright (C) 2001 Peter Bergner, IBM Corp.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/mm.h>
18
19#define MAX_LMB_REGIONS 128
20
21struct lmb_property {
22 u64 base;
23 u64 size;
24};
25
26struct lmb_region {
27 unsigned long cnt;
28 u64 size;
29 struct lmb_property region[MAX_LMB_REGIONS+1];
30};
31
32struct lmb {
33 unsigned long debug;
34 u64 rmo_size;
35 struct lmb_region memory;
36 struct lmb_region reserved;
37};
38
39extern struct lmb lmb;
40
41extern void __init lmb_init(void);
42extern void __init lmb_analyze(void);
43extern long lmb_add(u64 base, u64 size);
44extern long lmb_remove(u64 base, u64 size);
45extern long __init lmb_reserve(u64 base, u64 size);
46extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid,
47 u64 (*nid_range)(u64, u64, int *));
48extern u64 __init lmb_alloc(u64 size, u64 align);
49extern u64 __init lmb_alloc_base(u64 size,
50 u64, u64 max_addr);
51extern u64 __init __lmb_alloc_base(u64 size,
52 u64 align, u64 max_addr);
53extern u64 __init lmb_phys_mem_size(void);
54extern u64 __init lmb_end_of_DRAM(void);
55extern void __init lmb_enforce_memory_limit(u64 memory_limit);
56extern int __init lmb_is_reserved(u64 addr);
57extern int lmb_find(struct lmb_property *res);
58
59extern void lmb_dump_all(void);
60
61static inline u64
62lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
63{
64 return type->region[region_nr].size;
65}
66static inline u64
67lmb_size_pages(struct lmb_region *type, unsigned long region_nr)
68{
69 return lmb_size_bytes(type, region_nr) >> PAGE_SHIFT;
70}
71static inline u64
72lmb_start_pfn(struct lmb_region *type, unsigned long region_nr)
73{
74 return type->region[region_nr].base >> PAGE_SHIFT;
75}
76static inline u64
77lmb_end_pfn(struct lmb_region *type, unsigned long region_nr)
78{
79 return lmb_start_pfn(type, region_nr) +
80 lmb_size_pages(type, region_nr);
81}
82
83#include <asm/lmb.h>
84
85#endif /* __KERNEL__ */
86
87#endif /* _LINUX_LMB_H */
diff --git a/include/linux/lock_dlm_plock.h b/include/linux/lock_dlm_plock.h
deleted file mode 100644
index fc3415113973..000000000000
--- a/include/linux/lock_dlm_plock.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright (C) 2005 Red Hat, Inc. All rights reserved.
3 *
4 * This copyrighted material is made available to anyone wishing to use,
5 * modify, copy, or redistribute it subject to the terms and conditions
6 * of the GNU General Public License v.2.
7 */
8
9#ifndef __LOCK_DLM_PLOCK_DOT_H__
10#define __LOCK_DLM_PLOCK_DOT_H__
11
12#define GDLM_PLOCK_MISC_NAME "lock_dlm_plock"
13
14#define GDLM_PLOCK_VERSION_MAJOR 1
15#define GDLM_PLOCK_VERSION_MINOR 1
16#define GDLM_PLOCK_VERSION_PATCH 0
17
18enum {
19 GDLM_PLOCK_OP_LOCK = 1,
20 GDLM_PLOCK_OP_UNLOCK,
21 GDLM_PLOCK_OP_GET,
22};
23
24struct gdlm_plock_info {
25 __u32 version[3];
26 __u8 optype;
27 __u8 ex;
28 __u8 wait;
29 __u8 pad;
30 __u32 pid;
31 __s32 nodeid;
32 __s32 rv;
33 __u32 fsid;
34 __u64 number;
35 __u64 start;
36 __u64 end;
37 __u64 owner;
38};
39
40#endif
41
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 4babb2a129ac..102d928f7206 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -91,6 +91,7 @@ struct nlm_wait;
91 */ 91 */
92#define NLMCLNT_OHSIZE ((__NEW_UTS_LEN) + 10u) 92#define NLMCLNT_OHSIZE ((__NEW_UTS_LEN) + 10u)
93struct nlm_rqst { 93struct nlm_rqst {
94 atomic_t a_count;
94 unsigned int a_flags; /* initial RPC task flags */ 95 unsigned int a_flags; /* initial RPC task flags */
95 struct nlm_host * a_host; /* host handle */ 96 struct nlm_host * a_host; /* host handle */
96 struct nlm_args a_args; /* arguments */ 97 struct nlm_args a_args; /* arguments */
@@ -173,8 +174,10 @@ void nlmclnt_next_cookie(struct nlm_cookie *);
173/* 174/*
174 * Host cache 175 * Host cache
175 */ 176 */
176struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *, int, int, 177struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin,
177 const char *, unsigned int); 178 int proto, u32 version,
179 const char *hostname,
180 unsigned int hostname_len);
178struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *, 181struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *,
179 unsigned int); 182 unsigned int);
180struct rpc_clnt * nlm_bind_host(struct nlm_host *); 183struct rpc_clnt * nlm_bind_host(struct nlm_host *);
@@ -191,7 +194,7 @@ void nsm_release(struct nsm_handle *);
191 * This is used in garbage collection and resource reclaim 194 * This is used in garbage collection and resource reclaim
192 * A return value != 0 means destroy the lock/block/share 195 * A return value != 0 means destroy the lock/block/share
193 */ 196 */
194typedef int (*nlm_host_match_fn_t)(struct nlm_host *cur, struct nlm_host *ref); 197typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
195 198
196/* 199/*
197 * Server-side lock handling 200 * Server-side lock handling
@@ -217,8 +220,13 @@ void nlmsvc_mark_resources(void);
217void nlmsvc_free_host_resources(struct nlm_host *); 220void nlmsvc_free_host_resources(struct nlm_host *);
218void nlmsvc_invalidate_all(void); 221void nlmsvc_invalidate_all(void);
219 222
220static __inline__ struct inode * 223/*
221nlmsvc_file_inode(struct nlm_file *file) 224 * Cluster failover support
225 */
226int nlmsvc_unlock_all_by_sb(struct super_block *sb);
227int nlmsvc_unlock_all_by_ip(__be32 server_addr);
228
229static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
222{ 230{
223 return file->f_file->f_path.dentry->d_inode; 231 return file->f_file->f_path.dentry->d_inode;
224} 232}
@@ -226,8 +234,8 @@ nlmsvc_file_inode(struct nlm_file *file)
226/* 234/*
227 * Compare two host addresses (needs modifying for ipv6) 235 * Compare two host addresses (needs modifying for ipv6)
228 */ 236 */
229static __inline__ int 237static inline int nlm_cmp_addr(const struct sockaddr_in *sin1,
230nlm_cmp_addr(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2) 238 const struct sockaddr_in *sin2)
231{ 239{
232 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; 240 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
233} 241}
@@ -236,8 +244,8 @@ nlm_cmp_addr(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
236 * Compare two NLM locks. 244 * Compare two NLM locks.
237 * When the second lock is of type F_UNLCK, this acts like a wildcard. 245 * When the second lock is of type F_UNLCK, this acts like a wildcard.
238 */ 246 */
239static __inline__ int 247static inline int nlm_compare_locks(const struct file_lock *fl1,
240nlm_compare_locks(const struct file_lock *fl1, const struct file_lock *fl2) 248 const struct file_lock *fl2)
241{ 249{
242 return fl1->fl_pid == fl2->fl_pid 250 return fl1->fl_pid == fl2->fl_pid
243 && fl1->fl_owner == fl2->fl_owner 251 && fl1->fl_owner == fl2->fl_owner
diff --git a/include/linux/lockd/sm_inter.h b/include/linux/lockd/sm_inter.h
index 22a645828f26..5a5448bdb17d 100644
--- a/include/linux/lockd/sm_inter.h
+++ b/include/linux/lockd/sm_inter.h
@@ -19,6 +19,7 @@
19#define SM_NOTIFY 6 19#define SM_NOTIFY 6
20 20
21#define SM_MAXSTRLEN 1024 21#define SM_MAXSTRLEN 1024
22#define SM_PRIV_SIZE 16
22 23
23/* 24/*
24 * Arguments for all calls to statd 25 * Arguments for all calls to statd
diff --git a/include/linux/math64.h b/include/linux/math64.h
new file mode 100644
index 000000000000..c1a5f81501ff
--- /dev/null
+++ b/include/linux/math64.h
@@ -0,0 +1,84 @@
1#ifndef _LINUX_MATH64_H
2#define _LINUX_MATH64_H
3
4#include <linux/types.h>
5#include <asm/div64.h>
6
7#if BITS_PER_LONG == 64
8
9/**
10 * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder
11 *
12 * This is commonly provided by 32bit archs to provide an optimized 64bit
13 * divide.
14 */
15static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
16{
17 *remainder = dividend % divisor;
18 return dividend / divisor;
19}
20
21/**
22 * div_s64_rem - signed 64bit divide with 32bit divisor with remainder
23 */
24static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
25{
26 *remainder = dividend % divisor;
27 return dividend / divisor;
28}
29
30/**
31 * div64_u64 - unsigned 64bit divide with 64bit divisor
32 */
33static inline u64 div64_u64(u64 dividend, u64 divisor)
34{
35 return dividend / divisor;
36}
37
38#elif BITS_PER_LONG == 32
39
40#ifndef div_u64_rem
41static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
42{
43 *remainder = do_div(dividend, divisor);
44 return dividend;
45}
46#endif
47
48#ifndef div_s64_rem
49extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
50#endif
51
52#ifndef div64_u64
53extern u64 div64_u64(u64 dividend, u64 divisor);
54#endif
55
56#endif /* BITS_PER_LONG */
57
58/**
59 * div_u64 - unsigned 64bit divide with 32bit divisor
60 *
61 * This is the most common 64bit divide and should be used if possible,
62 * as many 32bit archs can optimize this variant better than a full 64bit
63 * divide.
64 */
65#ifndef div_u64
66static inline u64 div_u64(u64 dividend, u32 divisor)
67{
68 u32 remainder;
69 return div_u64_rem(dividend, divisor, &remainder);
70}
71#endif
72
73/**
74 * div_s64 - signed 64bit divide with 32bit divisor
75 */
76#ifndef div_s64
77static inline s64 div_s64(s64 dividend, s32 divisor)
78{
79 s32 remainder;
80 return div_s64_rem(dividend, divisor, &remainder);
81}
82#endif
83
84#endif /* _LINUX_MATH64_H */
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
new file mode 100644
index 000000000000..c11ff2932549
--- /dev/null
+++ b/include/linux/mbus.h
@@ -0,0 +1,36 @@
1/*
2 * Marvell MBUS common definitions.
3 *
4 * Copyright (C) 2008 Marvell Semiconductor
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __LINUX_MBUS_H
12#define __LINUX_MBUS_H
13
14struct mbus_dram_target_info
15{
16 /*
17 * The 4-bit MBUS target ID of the DRAM controller.
18 */
19 u8 mbus_dram_target_id;
20
21 /*
22 * The base address, size, and MBUS attribute ID for each
23 * of the possible DRAM chip selects. Peripherals are
24 * required to support at least 4 decode windows.
25 */
26 int num_cs;
27 struct mbus_dram_window {
28 u8 cs_index;
29 u8 mbus_attr;
30 u32 base;
31 u32 size;
32 } cs[4];
33};
34
35
36#endif
diff --git a/include/linux/mca-legacy.h b/include/linux/mca-legacy.h
index f2bb770e530a..7a3aea845902 100644
--- a/include/linux/mca-legacy.h
+++ b/include/linux/mca-legacy.h
@@ -34,7 +34,6 @@
34extern int mca_find_adapter(int id, int start); 34extern int mca_find_adapter(int id, int start);
35extern int mca_find_unused_adapter(int id, int start); 35extern int mca_find_unused_adapter(int id, int start);
36 36
37extern int mca_is_adapter_used(int slot);
38extern int mca_mark_as_used(int slot); 37extern int mca_mark_as_used(int slot);
39extern void mca_mark_as_unused(int slot); 38extern void mca_mark_as_unused(int slot);
40 39
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 8b1c4295848b..e6608776bc96 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -27,9 +27,6 @@ struct mm_struct;
27 27
28#ifdef CONFIG_CGROUP_MEM_RES_CTLR 28#ifdef CONFIG_CGROUP_MEM_RES_CTLR
29 29
30extern void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p);
31extern void mm_free_cgroup(struct mm_struct *mm);
32
33#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0) 30#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0)
34 31
35extern struct page_cgroup *page_get_page_cgroup(struct page *page); 32extern struct page_cgroup *page_get_page_cgroup(struct page *page);
@@ -48,8 +45,10 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
48extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); 45extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask);
49int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); 46int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
50 47
48extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
49
51#define mm_match_cgroup(mm, cgroup) \ 50#define mm_match_cgroup(mm, cgroup) \
52 ((cgroup) == rcu_dereference((mm)->mem_cgroup)) 51 ((cgroup) == mem_cgroup_from_task((mm)->owner))
53 52
54extern int mem_cgroup_prepare_migration(struct page *page); 53extern int mem_cgroup_prepare_migration(struct page *page);
55extern void mem_cgroup_end_migration(struct page *page); 54extern void mem_cgroup_end_migration(struct page *page);
@@ -73,15 +72,6 @@ extern long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem,
73 struct zone *zone, int priority); 72 struct zone *zone, int priority);
74 73
75#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 74#else /* CONFIG_CGROUP_MEM_RES_CTLR */
76static inline void mm_init_cgroup(struct mm_struct *mm,
77 struct task_struct *p)
78{
79}
80
81static inline void mm_free_cgroup(struct mm_struct *mm)
82{
83}
84
85static inline void page_reset_bad_cgroup(struct page *page) 75static inline void page_reset_bad_cgroup(struct page *page)
86{ 76{
87} 77}
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 33f0ff0cf634..2f5f8a5ef2a0 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -18,8 +18,7 @@
18#include <linux/sysdev.h> 18#include <linux/sysdev.h>
19#include <linux/node.h> 19#include <linux/node.h>
20#include <linux/compiler.h> 20#include <linux/compiler.h>
21 21#include <linux/mutex.h>
22#include <asm/semaphore.h>
23 22
24struct memory_block { 23struct memory_block {
25 unsigned long phys_index; 24 unsigned long phys_index;
@@ -30,7 +29,7 @@ struct memory_block {
30 * created long after the critical areas during 29 * created long after the critical areas during
31 * initialization. 30 * initialization.
32 */ 31 */
33 struct semaphore state_sem; 32 struct mutex state_mutex;
34 int phys_device; /* to which fru does this belong? */ 33 int phys_device; /* to which fru does this belong? */
35 void *hw; /* optional pointer to fw/hw data */ 34 void *hw; /* optional pointer to fw/hw data */
36 int (*phys_callback)(struct memory_block *); 35 int (*phys_callback)(struct memory_block *);
@@ -54,6 +53,13 @@ struct memory_notify {
54struct notifier_block; 53struct notifier_block;
55struct mem_section; 54struct mem_section;
56 55
56/*
57 * Priorities for the hotplug memory callback routines (stored in decreasing
58 * order in the callback chain)
59 */
60#define SLAB_CALLBACK_PRI 1
61#define IPC_CALLBACK_PRI 10
62
57#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE 63#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE
58static inline int memory_dev_init(void) 64static inline int memory_dev_init(void)
59{ 65{
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 8fee7a45736b..73e358612eaf 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -8,8 +8,18 @@
8struct page; 8struct page;
9struct zone; 9struct zone;
10struct pglist_data; 10struct pglist_data;
11struct mem_section;
11 12
12#ifdef CONFIG_MEMORY_HOTPLUG 13#ifdef CONFIG_MEMORY_HOTPLUG
14
15/*
16 * Magic number for free bootmem.
17 * The normal smallest mapcount is -1. Here is smaller value than it.
18 */
19#define SECTION_INFO 0xfffffffe
20#define MIX_INFO 0xfffffffd
21#define NODE_INFO 0xfffffffc
22
13/* 23/*
14 * pgdat resizing functions 24 * pgdat resizing functions
15 */ 25 */
@@ -64,9 +74,11 @@ extern int offline_pages(unsigned long, unsigned long, unsigned long);
64/* reasonably generic interface to expand the physical pages in a zone */ 74/* reasonably generic interface to expand the physical pages in a zone */
65extern int __add_pages(struct zone *zone, unsigned long start_pfn, 75extern int __add_pages(struct zone *zone, unsigned long start_pfn,
66 unsigned long nr_pages); 76 unsigned long nr_pages);
77extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
78 unsigned long nr_pages);
67 79
68/* 80/*
69 * Walk thorugh all memory which is registered as resource. 81 * Walk through all memory which is registered as resource.
70 * arg is (start_pfn, nr_pages, private_arg_pointer) 82 * arg is (start_pfn, nr_pages, private_arg_pointer)
71 */ 83 */
72extern int walk_memory_resource(unsigned long start_pfn, 84extern int walk_memory_resource(unsigned long start_pfn,
@@ -142,6 +154,18 @@ static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
142#endif /* CONFIG_NUMA */ 154#endif /* CONFIG_NUMA */
143#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ 155#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
144 156
157#ifdef CONFIG_SPARSEMEM_VMEMMAP
158static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
159{
160}
161static inline void put_page_bootmem(struct page *page)
162{
163}
164#else
165extern void register_page_bootmem_info_node(struct pglist_data *pgdat);
166extern void put_page_bootmem(struct page *page);
167#endif
168
145#else /* ! CONFIG_MEMORY_HOTPLUG */ 169#else /* ! CONFIG_MEMORY_HOTPLUG */
146/* 170/*
147 * Stub functions for when hotplug is off 171 * Stub functions for when hotplug is off
@@ -169,6 +193,10 @@ static inline int mhp_notimplemented(const char *func)
169 return -ENOSYS; 193 return -ENOSYS;
170} 194}
171 195
196static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
197{
198}
199
172#endif /* ! CONFIG_MEMORY_HOTPLUG */ 200#endif /* ! CONFIG_MEMORY_HOTPLUG */
173 201
174extern int add_memory(int nid, u64 start, u64 size); 202extern int add_memory(int nid, u64 start, u64 size);
@@ -176,5 +204,8 @@ extern int arch_add_memory(int nid, u64 start, u64 size);
176extern int remove_memory(u64 start, u64 size); 204extern int remove_memory(u64 start, u64 size);
177extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, 205extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
178 int nr_pages); 206 int nr_pages);
207extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms);
208extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map,
209 unsigned long pnum);
179 210
180#endif /* __LINUX_MEMORY_HOTPLUG_H */ 211#endif /* __LINUX_MEMORY_HOTPLUG_H */
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 59c4865bc85f..3a39570b81b8 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -8,15 +8,32 @@
8 * Copyright 2003,2004 Andi Kleen SuSE Labs 8 * Copyright 2003,2004 Andi Kleen SuSE Labs
9 */ 9 */
10 10
11/*
12 * Both the MPOL_* mempolicy mode and the MPOL_F_* optional mode flags are
13 * passed by the user to either set_mempolicy() or mbind() in an 'int' actual.
14 * The MPOL_MODE_FLAGS macro determines the legal set of optional mode flags.
15 */
16
11/* Policies */ 17/* Policies */
12#define MPOL_DEFAULT 0 18enum {
13#define MPOL_PREFERRED 1 19 MPOL_DEFAULT,
14#define MPOL_BIND 2 20 MPOL_PREFERRED,
15#define MPOL_INTERLEAVE 3 21 MPOL_BIND,
22 MPOL_INTERLEAVE,
23 MPOL_MAX, /* always last member of enum */
24};
16 25
17#define MPOL_MAX MPOL_INTERLEAVE 26/* Flags for set_mempolicy */
27#define MPOL_F_STATIC_NODES (1 << 15)
28#define MPOL_F_RELATIVE_NODES (1 << 14)
18 29
19/* Flags for get_mem_policy */ 30/*
31 * MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to
32 * either set_mempolicy() or mbind().
33 */
34#define MPOL_MODE_FLAGS (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES)
35
36/* Flags for get_mempolicy */
20#define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */ 37#define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */
21#define MPOL_F_ADDR (1<<1) /* look up vma using address */ 38#define MPOL_F_ADDR (1<<1) /* look up vma using address */
22#define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */ 39#define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */
@@ -27,6 +44,14 @@
27#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */ 44#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */
28#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */ 45#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */
29 46
47/*
48 * Internal flags that share the struct mempolicy flags word with
49 * "mode flags". These flags are allocated from bit 0 up, as they
50 * are never OR'ed into the mode in mempolicy API arguments.
51 */
52#define MPOL_F_SHARED (1 << 0) /* identify shared policies */
53#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */
54
30#ifdef __KERNEL__ 55#ifdef __KERNEL__
31 56
32#include <linux/mmzone.h> 57#include <linux/mmzone.h>
@@ -35,7 +60,6 @@
35#include <linux/spinlock.h> 60#include <linux/spinlock.h>
36#include <linux/nodemask.h> 61#include <linux/nodemask.h>
37 62
38struct vm_area_struct;
39struct mm_struct; 63struct mm_struct;
40 64
41#ifdef CONFIG_NUMA 65#ifdef CONFIG_NUMA
@@ -54,22 +78,27 @@ struct mm_struct;
54 * mmap_sem. 78 * mmap_sem.
55 * 79 *
56 * Freeing policy: 80 * Freeing policy:
57 * When policy is MPOL_BIND v.zonelist is kmalloc'ed and must be kfree'd. 81 * Mempolicy objects are reference counted. A mempolicy will be freed when
58 * All other policies don't have any external state. mpol_free() handles this. 82 * mpol_put() decrements the reference count to zero.
59 * 83 *
60 * Copying policy objects: 84 * Duplicating policy objects:
61 * For MPOL_BIND the zonelist must be always duplicated. mpol_clone() does this. 85 * mpol_dup() allocates a new mempolicy and copies the specified mempolicy
86 * to the new storage. The reference count of the new object is initialized
87 * to 1, representing the caller of mpol_dup().
62 */ 88 */
63struct mempolicy { 89struct mempolicy {
64 atomic_t refcnt; 90 atomic_t refcnt;
65 short policy; /* See MPOL_* above */ 91 unsigned short mode; /* See MPOL_* above */
92 unsigned short flags; /* See set_mempolicy() MPOL_F_* above */
66 union { 93 union {
67 struct zonelist *zonelist; /* bind */
68 short preferred_node; /* preferred */ 94 short preferred_node; /* preferred */
69 nodemask_t nodes; /* interleave */ 95 nodemask_t nodes; /* interleave/bind */
70 /* undefined for default */ 96 /* undefined for default */
71 } v; 97 } v;
72 nodemask_t cpuset_mems_allowed; /* mempolicy relative to these nodes */ 98 union {
99 nodemask_t cpuset_mems_allowed; /* relative to these nodes */
100 nodemask_t user_nodemask; /* nodemask passed by user */
101 } w;
73}; 102};
74 103
75/* 104/*
@@ -77,18 +106,43 @@ struct mempolicy {
77 * The default fast path of a NULL MPOL_DEFAULT policy is always inlined. 106 * The default fast path of a NULL MPOL_DEFAULT policy is always inlined.
78 */ 107 */
79 108
80extern void __mpol_free(struct mempolicy *pol); 109extern void __mpol_put(struct mempolicy *pol);
81static inline void mpol_free(struct mempolicy *pol) 110static inline void mpol_put(struct mempolicy *pol)
82{ 111{
83 if (pol) 112 if (pol)
84 __mpol_free(pol); 113 __mpol_put(pol);
85} 114}
86 115
87extern struct mempolicy *__mpol_copy(struct mempolicy *pol); 116/*
88static inline struct mempolicy *mpol_copy(struct mempolicy *pol) 117 * Does mempolicy pol need explicit unref after use?
118 * Currently only needed for shared policies.
119 */
120static inline int mpol_needs_cond_ref(struct mempolicy *pol)
121{
122 return (pol && (pol->flags & MPOL_F_SHARED));
123}
124
125static inline void mpol_cond_put(struct mempolicy *pol)
126{
127 if (mpol_needs_cond_ref(pol))
128 __mpol_put(pol);
129}
130
131extern struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol,
132 struct mempolicy *frompol);
133static inline struct mempolicy *mpol_cond_copy(struct mempolicy *tompol,
134 struct mempolicy *frompol)
135{
136 if (!frompol)
137 return frompol;
138 return __mpol_cond_copy(tompol, frompol);
139}
140
141extern struct mempolicy *__mpol_dup(struct mempolicy *pol);
142static inline struct mempolicy *mpol_dup(struct mempolicy *pol)
89{ 143{
90 if (pol) 144 if (pol)
91 pol = __mpol_copy(pol); 145 pol = __mpol_dup(pol);
92 return pol; 146 return pol;
93} 147}
94 148
@@ -108,11 +162,6 @@ static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
108 return 1; 162 return 1;
109 return __mpol_equal(a, b); 163 return __mpol_equal(a, b);
110} 164}
111#define vma_mpol_equal(a,b) mpol_equal(vma_policy(a), vma_policy(b))
112
113/* Could later add inheritance of the process policy here. */
114
115#define mpol_set_vma_default(vma) ((vma)->vm_policy = NULL)
116 165
117/* 166/*
118 * Tree of shared policies for a shared memory region. 167 * Tree of shared policies for a shared memory region.
@@ -133,8 +182,7 @@ struct shared_policy {
133 spinlock_t lock; 182 spinlock_t lock;
134}; 183};
135 184
136void mpol_shared_policy_init(struct shared_policy *info, int policy, 185void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
137 nodemask_t *nodes);
138int mpol_set_shared_policy(struct shared_policy *info, 186int mpol_set_shared_policy(struct shared_policy *info,
139 struct vm_area_struct *vma, 187 struct vm_area_struct *vma,
140 struct mempolicy *new); 188 struct mempolicy *new);
@@ -149,9 +197,9 @@ extern void mpol_rebind_task(struct task_struct *tsk,
149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); 197extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
150extern void mpol_fix_fork_child_flag(struct task_struct *p); 198extern void mpol_fix_fork_child_flag(struct task_struct *p);
151 199
152extern struct mempolicy default_policy;
153extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 200extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
154 unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol); 201 unsigned long addr, gfp_t gfp_flags,
202 struct mempolicy **mpol, nodemask_t **nodemask);
155extern unsigned slab_node(struct mempolicy *policy); 203extern unsigned slab_node(struct mempolicy *policy);
156 204
157extern enum zone_type policy_zone; 205extern enum zone_type policy_zone;
@@ -165,6 +213,13 @@ static inline void check_highest_zone(enum zone_type k)
165int do_migrate_pages(struct mm_struct *mm, 213int do_migrate_pages(struct mm_struct *mm,
166 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags); 214 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags);
167 215
216
217#ifdef CONFIG_TMPFS
218extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context);
219
220extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
221 int no_context);
222#endif
168#else 223#else
169 224
170struct mempolicy {}; 225struct mempolicy {};
@@ -173,19 +228,26 @@ static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
173{ 228{
174 return 1; 229 return 1;
175} 230}
176#define vma_mpol_equal(a,b) 1
177 231
178#define mpol_set_vma_default(vma) do {} while(0) 232static inline void mpol_put(struct mempolicy *p)
233{
234}
235
236static inline void mpol_cond_put(struct mempolicy *pol)
237{
238}
179 239
180static inline void mpol_free(struct mempolicy *p) 240static inline struct mempolicy *mpol_cond_copy(struct mempolicy *to,
241 struct mempolicy *from)
181{ 242{
243 return from;
182} 244}
183 245
184static inline void mpol_get(struct mempolicy *pol) 246static inline void mpol_get(struct mempolicy *pol)
185{ 247{
186} 248}
187 249
188static inline struct mempolicy *mpol_copy(struct mempolicy *old) 250static inline struct mempolicy *mpol_dup(struct mempolicy *old)
189{ 251{
190 return NULL; 252 return NULL;
191} 253}
@@ -199,8 +261,8 @@ static inline int mpol_set_shared_policy(struct shared_policy *info,
199 return -EINVAL; 261 return -EINVAL;
200} 262}
201 263
202static inline void mpol_shared_policy_init(struct shared_policy *info, 264static inline void mpol_shared_policy_init(struct shared_policy *sp,
203 int policy, nodemask_t *nodes) 265 struct mempolicy *mpol)
204{ 266{
205} 267}
206 268
@@ -239,9 +301,12 @@ static inline void mpol_fix_fork_child_flag(struct task_struct *p)
239} 301}
240 302
241static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, 303static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
242 unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol) 304 unsigned long addr, gfp_t gfp_flags,
305 struct mempolicy **mpol, nodemask_t **nodemask)
243{ 306{
244 return NODE_DATA(0)->node_zonelists + gfp_zone(gfp_flags); 307 *mpol = NULL;
308 *nodemask = NULL;
309 return node_zonelist(0, gfp_flags);
245} 310}
246 311
247static inline int do_migrate_pages(struct mm_struct *mm, 312static inline int do_migrate_pages(struct mm_struct *mm,
@@ -254,6 +319,21 @@ static inline int do_migrate_pages(struct mm_struct *mm,
254static inline void check_highest_zone(int k) 319static inline void check_highest_zone(int k)
255{ 320{
256} 321}
322
323#ifdef CONFIG_TMPFS
324static inline int mpol_parse_str(char *str, struct mempolicy **mpol,
325 int no_context)
326{
327 return 1; /* error */
328}
329
330static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
331 int no_context)
332{
333 return 0;
334}
335#endif
336
257#endif /* CONFIG_NUMA */ 337#endif /* CONFIG_NUMA */
258#endif /* __KERNEL__ */ 338#endif /* __KERNEL__ */
259 339
diff --git a/include/linux/memstick.h b/include/linux/memstick.h
index 3e686ec6a967..37a5cdb03918 100644
--- a/include/linux/memstick.h
+++ b/include/linux/memstick.h
@@ -276,7 +276,7 @@ struct memstick_host {
276#define MEMSTICK_CAP_PAR8 4 276#define MEMSTICK_CAP_PAR8 4
277 277
278 struct work_struct media_checker; 278 struct work_struct media_checker;
279 struct class_device cdev; 279 struct device dev;
280 280
281 struct memstick_dev *card; 281 struct memstick_dev *card;
282 unsigned int retries; 282 unsigned int retries;
diff --git a/include/linux/meye.h b/include/linux/meye.h
index 39fd9c8ddd4b..12010ace1f04 100644
--- a/include/linux/meye.h
+++ b/include/linux/meye.h
@@ -58,7 +58,7 @@ struct meye_params {
58 58
59/* V4L2 private controls */ 59/* V4L2 private controls */
60#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE 60#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE
61#define V4L2_CID_SHARPNESS (V4L2_CID_PRIVATE_BASE + 1) 61#define V4L2_CID_MEYE_SHARPNESS (V4L2_CID_PRIVATE_BASE + 1)
62#define V4L2_CID_PICTURE (V4L2_CID_PRIVATE_BASE + 2) 62#define V4L2_CID_PICTURE (V4L2_CID_PRIVATE_BASE + 2)
63#define V4L2_CID_JPEGQUAL (V4L2_CID_PRIVATE_BASE + 3) 63#define V4L2_CID_JPEGQUAL (V4L2_CID_PRIVATE_BASE + 3)
64#define V4L2_CID_FRAMERATE (V4L2_CID_PRIVATE_BASE + 4) 64#define V4L2_CID_FRAMERATE (V4L2_CID_PRIVATE_BASE + 4)
diff --git a/include/linux/mfd/htc-egpio.h b/include/linux/mfd/htc-egpio.h
new file mode 100644
index 000000000000..b4201c971367
--- /dev/null
+++ b/include/linux/mfd/htc-egpio.h
@@ -0,0 +1,57 @@
1/*
2 * HTC simple EGPIO irq and gpio extender
3 */
4
5#ifndef __HTC_EGPIO_H__
6#define __HTC_EGPIO_H__
7
8#include <linux/gpio.h>
9
10/* Descriptive values for all-in or all-out htc_egpio_chip descriptors. */
11#define HTC_EGPIO_OUTPUT (~0)
12#define HTC_EGPIO_INPUT 0
13
14/**
15 * struct htc_egpio_chip - descriptor to create gpio_chip for register range
16 * @reg_start: index of first register
17 * @gpio_base: gpio number of first pin in this register range
18 * @num_gpios: number of gpios in this register range, max BITS_PER_LONG
19 * (number of registers = DIV_ROUND_UP(num_gpios, reg_width))
20 * @direction: bitfield, '0' = input, '1' = output,
21 */
22struct htc_egpio_chip {
23 int reg_start;
24 int gpio_base;
25 int num_gpios;
26 unsigned long direction;
27 unsigned long initial_values;
28};
29
30/**
31 * struct htc_egpio_platform_data - description provided by the arch
32 * @irq_base: beginning of available IRQs (eg, IRQ_BOARD_START)
33 * @num_irqs: number of irqs
34 * @reg_width: number of bits per register, either 8 or 16 bit
35 * @bus_width: alignment of the registers, either 16 or 32 bit
36 * @invert_acks: set if chip requires writing '0' to ack an irq, instead of '1'
37 * @ack_register: location of the irq/ack register
38 * @chip: pointer to array of htc_egpio_chip descriptors
39 * @num_chips: number of egpio chip descriptors
40 */
41struct htc_egpio_platform_data {
42 int bus_width;
43 int reg_width;
44
45 int irq_base;
46 int num_irqs;
47 int invert_acks;
48 int ack_register;
49
50 struct htc_egpio_chip *chip;
51 int num_chips;
52};
53
54/* Determine the wakeup irq, to be called during early resume */
55extern int htc_egpio_get_wakeup_irq(struct device *dev);
56
57#endif
diff --git a/include/linux/mfd/htc-pasic3.h b/include/linux/mfd/htc-pasic3.h
new file mode 100644
index 000000000000..b4294f12c4f8
--- /dev/null
+++ b/include/linux/mfd/htc-pasic3.h
@@ -0,0 +1,55 @@
1/*
2 * HTC PASIC3 driver - LEDs and DS1WM
3 *
4 * Copyright (c) 2007 Philipp Zabel <philipp.zabel@gmail.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
8 * more details.
9 *
10 */
11
12#ifndef __PASIC3_H
13#define __PASIC3_H
14
15#include <linux/platform_device.h>
16#include <linux/leds.h>
17
18extern void pasic3_write_register(struct device *dev, u32 reg, u8 val);
19extern u8 pasic3_read_register(struct device *dev, u32 reg);
20
21/*
22 * mask for registers 0x20,0x21,0x22
23 */
24#define PASIC3_MASK_LED0 0x04
25#define PASIC3_MASK_LED1 0x08
26#define PASIC3_MASK_LED2 0x40
27
28/*
29 * bits in register 0x06
30 */
31#define PASIC3_BIT2_LED0 0x08
32#define PASIC3_BIT2_LED1 0x10
33#define PASIC3_BIT2_LED2 0x20
34
35struct pasic3_led {
36 struct led_classdev led;
37 unsigned int hw_num;
38 unsigned int bit2;
39 unsigned int mask;
40 struct pasic3_leds_machinfo *pdata;
41};
42
43struct pasic3_leds_machinfo {
44 unsigned int num_leds;
45 unsigned int power_gpio;
46 struct pasic3_led *leds;
47};
48
49struct pasic3_platform_data {
50 struct pasic3_leds_machinfo *led_pdata;
51 unsigned int bus_shift;
52 unsigned int clock_rate;
53};
54
55#endif
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 24b30b9b4f8a..26433ec520b3 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -43,15 +43,7 @@ struct miscdevice {
43}; 43};
44 44
45extern int misc_register(struct miscdevice * misc); 45extern int misc_register(struct miscdevice * misc);
46extern int __misc_deregister(struct miscdevice *misc, bool suspended); 46extern int misc_deregister(struct miscdevice *misc);
47static inline int misc_deregister(struct miscdevice *misc)
48{
49 return __misc_deregister(misc, false);
50}
51static inline int misc_deregister_suspended(struct miscdevice *misc)
52{
53 return __misc_deregister(misc, true);
54}
55 47
56#define MODULE_ALIAS_MISCDEV(minor) \ 48#define MODULE_ALIAS_MISCDEV(minor) \
57 MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \ 49 MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 7d1eaa97de13..77323a72dd3c 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -81,7 +81,7 @@ enum {
81 MLX4_CMD_SW2HW_CQ = 0x16, 81 MLX4_CMD_SW2HW_CQ = 0x16,
82 MLX4_CMD_HW2SW_CQ = 0x17, 82 MLX4_CMD_HW2SW_CQ = 0x17,
83 MLX4_CMD_QUERY_CQ = 0x18, 83 MLX4_CMD_QUERY_CQ = 0x18,
84 MLX4_CMD_RESIZE_CQ = 0x2c, 84 MLX4_CMD_MODIFY_CQ = 0x2c,
85 85
86 /* SRQ commands */ 86 /* SRQ commands */
87 MLX4_CMD_SW2HW_SRQ = 0x35, 87 MLX4_CMD_SW2HW_SRQ = 0x35,
diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h
index 0181e0a57cbf..071cf96cf01f 100644
--- a/include/linux/mlx4/cq.h
+++ b/include/linux/mlx4/cq.h
@@ -45,11 +45,11 @@ struct mlx4_cqe {
45 u8 sl; 45 u8 sl;
46 u8 reserved1; 46 u8 reserved1;
47 __be16 rlid; 47 __be16 rlid;
48 u32 reserved2; 48 __be32 ipoib_status;
49 __be32 byte_cnt; 49 __be32 byte_cnt;
50 __be16 wqe_index; 50 __be16 wqe_index;
51 __be16 checksum; 51 __be16 checksum;
52 u8 reserved3[3]; 52 u8 reserved2[3];
53 u8 owner_sr_opcode; 53 u8 owner_sr_opcode;
54}; 54};
55 55
@@ -85,6 +85,16 @@ enum {
85 MLX4_CQE_SYNDROME_REMOTE_ABORTED_ERR = 0x22, 85 MLX4_CQE_SYNDROME_REMOTE_ABORTED_ERR = 0x22,
86}; 86};
87 87
88enum {
89 MLX4_CQE_IPOIB_STATUS_IPV4 = 1 << 22,
90 MLX4_CQE_IPOIB_STATUS_IPV4F = 1 << 23,
91 MLX4_CQE_IPOIB_STATUS_IPV6 = 1 << 24,
92 MLX4_CQE_IPOIB_STATUS_IPV4OPT = 1 << 25,
93 MLX4_CQE_IPOIB_STATUS_TCP = 1 << 26,
94 MLX4_CQE_IPOIB_STATUS_UDP = 1 << 27,
95 MLX4_CQE_IPOIB_STATUS_IPOK = 1 << 28,
96};
97
88static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd, 98static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd,
89 void __iomem *uar_page, 99 void __iomem *uar_page,
90 spinlock_t *doorbell_lock) 100 spinlock_t *doorbell_lock)
@@ -120,4 +130,9 @@ enum {
120 MLX4_CQ_DB_REQ_NOT = 2 << 24 130 MLX4_CQ_DB_REQ_NOT = 2 << 24
121}; 131};
122 132
133int mlx4_cq_modify(struct mlx4_dev *dev, struct mlx4_cq *cq,
134 u16 count, u16 period);
135int mlx4_cq_resize(struct mlx4_dev *dev, struct mlx4_cq *cq,
136 int entries, struct mlx4_mtt *mtt);
137
123#endif /* MLX4_CQ_H */ 138#endif /* MLX4_CQ_H */
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 6cdf813cd478..a744383d16e9 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -186,6 +186,7 @@ struct mlx4_caps {
186 u32 flags; 186 u32 flags;
187 u16 stat_rate_support; 187 u16 stat_rate_support;
188 u8 port_width_cap[MLX4_MAX_PORTS + 1]; 188 u8 port_width_cap[MLX4_MAX_PORTS + 1];
189 int max_gso_sz;
189}; 190};
190 191
191struct mlx4_buf_list { 192struct mlx4_buf_list {
@@ -207,6 +208,38 @@ struct mlx4_mtt {
207 int page_shift; 208 int page_shift;
208}; 209};
209 210
211enum {
212 MLX4_DB_PER_PAGE = PAGE_SIZE / 4
213};
214
215struct mlx4_db_pgdir {
216 struct list_head list;
217 DECLARE_BITMAP(order0, MLX4_DB_PER_PAGE);
218 DECLARE_BITMAP(order1, MLX4_DB_PER_PAGE / 2);
219 unsigned long *bits[2];
220 __be32 *db_page;
221 dma_addr_t db_dma;
222};
223
224struct mlx4_ib_user_db_page;
225
226struct mlx4_db {
227 __be32 *db;
228 union {
229 struct mlx4_db_pgdir *pgdir;
230 struct mlx4_ib_user_db_page *user_page;
231 } u;
232 dma_addr_t dma;
233 int index;
234 int order;
235};
236
237struct mlx4_hwq_resources {
238 struct mlx4_db db;
239 struct mlx4_mtt mtt;
240 struct mlx4_buf buf;
241};
242
210struct mlx4_mr { 243struct mlx4_mr {
211 struct mlx4_mtt mtt; 244 struct mlx4_mtt mtt;
212 u64 iova; 245 u64 iova;
@@ -340,8 +373,17 @@ int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
340int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 373int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
341 struct mlx4_buf *buf); 374 struct mlx4_buf *buf);
342 375
376int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order);
377void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db);
378
379int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres,
380 int size, int max_direct);
381void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres,
382 int size);
383
343int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, 384int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
344 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq); 385 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq,
386 int collapsed);
345void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); 387void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
346 388
347int mlx4_qp_alloc(struct mlx4_dev *dev, int sqpn, struct mlx4_qp *qp); 389int mlx4_qp_alloc(struct mlx4_dev *dev, int sqpn, struct mlx4_qp *qp);
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index 1b835ca49df1..53c5fdb6eac4 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -48,8 +48,7 @@ struct mlx4_interface {
48 void * (*add) (struct mlx4_dev *dev); 48 void * (*add) (struct mlx4_dev *dev);
49 void (*remove)(struct mlx4_dev *dev, void *context); 49 void (*remove)(struct mlx4_dev *dev, void *context);
50 void (*event) (struct mlx4_dev *dev, void *context, 50 void (*event) (struct mlx4_dev *dev, void *context,
51 enum mlx4_dev_event event, int subtype, 51 enum mlx4_dev_event event, int port);
52 int port);
53 struct list_head list; 52 struct list_head list;
54}; 53};
55 54
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 09a2230923f2..7f128b266faa 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -158,10 +158,12 @@ struct mlx4_qp_context {
158#define MLX4_FW_VER_WQE_CTRL_NEC mlx4_fw_ver(2, 2, 232) 158#define MLX4_FW_VER_WQE_CTRL_NEC mlx4_fw_ver(2, 2, 232)
159 159
160enum { 160enum {
161 MLX4_WQE_CTRL_NEC = 1 << 29, 161 MLX4_WQE_CTRL_NEC = 1 << 29,
162 MLX4_WQE_CTRL_FENCE = 1 << 6, 162 MLX4_WQE_CTRL_FENCE = 1 << 6,
163 MLX4_WQE_CTRL_CQ_UPDATE = 3 << 2, 163 MLX4_WQE_CTRL_CQ_UPDATE = 3 << 2,
164 MLX4_WQE_CTRL_SOLICITED = 1 << 1, 164 MLX4_WQE_CTRL_SOLICITED = 1 << 1,
165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4,
166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
165}; 167};
166 168
167struct mlx4_wqe_ctrl_seg { 169struct mlx4_wqe_ctrl_seg {
@@ -217,6 +219,11 @@ struct mlx4_wqe_datagram_seg {
217 __be32 reservd[2]; 219 __be32 reservd[2];
218}; 220};
219 221
222struct mlx4_lso_seg {
223 __be32 mss_hdr_size;
224 __be32 header[0];
225};
226
220struct mlx4_wqe_bind_seg { 227struct mlx4_wqe_bind_seg {
221 __be32 flags1; 228 __be32 flags1;
222 __be32 flags2; 229 __be32 flags2;
@@ -289,6 +296,10 @@ int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
289int mlx4_qp_query(struct mlx4_dev *dev, struct mlx4_qp *qp, 296int mlx4_qp_query(struct mlx4_dev *dev, struct mlx4_qp *qp,
290 struct mlx4_qp_context *context); 297 struct mlx4_qp_context *context);
291 298
299int mlx4_qp_to_ready(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
300 struct mlx4_qp_context *context,
301 struct mlx4_qp *qp, enum mlx4_qp_state *qp_state);
302
292static inline struct mlx4_qp *__mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn) 303static inline struct mlx4_qp *__mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn)
293{ 304{
294 return radix_tree_lookup(&dev->qp_table_tree, qpn & (dev->caps.num_qps - 1)); 305 return radix_tree_lookup(&dev->qp_table_tree, qpn & (dev->caps.num_qps - 1));
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b695875d63e3..c31a9cd2a30e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -107,6 +107,7 @@ extern unsigned int kobjsize(const void *objp);
107#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */ 107#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */
108 108
109#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ 109#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
110#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
110 111
111#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 112#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
112#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 113#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
@@ -164,8 +165,6 @@ struct vm_operations_struct {
164 void (*open)(struct vm_area_struct * area); 165 void (*open)(struct vm_area_struct * area);
165 void (*close)(struct vm_area_struct * area); 166 void (*close)(struct vm_area_struct * area);
166 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); 167 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
167 struct page *(*nopage)(struct vm_area_struct *area,
168 unsigned long address, int *type);
169 unsigned long (*nopfn)(struct vm_area_struct *area, 168 unsigned long (*nopfn)(struct vm_area_struct *area,
170 unsigned long address); 169 unsigned long address);
171 170
@@ -173,7 +172,25 @@ struct vm_operations_struct {
173 * writable, if an error is returned it will cause a SIGBUS */ 172 * writable, if an error is returned it will cause a SIGBUS */
174 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page); 173 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
175#ifdef CONFIG_NUMA 174#ifdef CONFIG_NUMA
175 /*
176 * set_policy() op must add a reference to any non-NULL @new mempolicy
177 * to hold the policy upon return. Caller should pass NULL @new to
178 * remove a policy and fall back to surrounding context--i.e. do not
179 * install a MPOL_DEFAULT policy, nor the task or system default
180 * mempolicy.
181 */
176 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new); 182 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
183
184 /*
185 * get_policy() op must add reference [mpol_get()] to any policy at
186 * (vma,addr) marked as MPOL_SHARED. The shared policy infrastructure
187 * in mm/mempolicy.c will do this automatically.
188 * get_policy() must NOT add a ref if the policy at (vma,addr) is not
189 * marked as MPOL_SHARED. vma policies are protected by the mmap_sem.
190 * If no [shared/vma] mempolicy exists at the addr, get_policy() op
191 * must return NULL--i.e., do not "fallback" to task or system default
192 * policy.
193 */
177 struct mempolicy *(*get_policy)(struct vm_area_struct *vma, 194 struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
178 unsigned long addr); 195 unsigned long addr);
179 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from, 196 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
@@ -397,11 +414,11 @@ static inline void set_compound_order(struct page *page, unsigned long order)
397 * we have run out of space and have to fall back to an 414 * we have run out of space and have to fall back to an
398 * alternate (slower) way of determining the node. 415 * alternate (slower) way of determining the node.
399 * 416 *
400 * No sparsemem: | NODE | ZONE | ... | FLAGS | 417 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS |
401 * with space for node: | SECTION | NODE | ZONE | ... | FLAGS | 418 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
402 * no space for node: | SECTION | ZONE | ... | FLAGS | 419 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS |
403 */ 420 */
404#ifdef CONFIG_SPARSEMEM 421#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
405#define SECTIONS_WIDTH SECTIONS_SHIFT 422#define SECTIONS_WIDTH SECTIONS_SHIFT
406#else 423#else
407#define SECTIONS_WIDTH 0 424#define SECTIONS_WIDTH 0
@@ -409,9 +426,12 @@ static inline void set_compound_order(struct page *page, unsigned long order)
409 426
410#define ZONES_WIDTH ZONES_SHIFT 427#define ZONES_WIDTH ZONES_SHIFT
411 428
412#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED 429#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
413#define NODES_WIDTH NODES_SHIFT 430#define NODES_WIDTH NODES_SHIFT
414#else 431#else
432#ifdef CONFIG_SPARSEMEM_VMEMMAP
433#error "Vmemmap: No space for nodes field in page flags"
434#endif
415#define NODES_WIDTH 0 435#define NODES_WIDTH 0
416#endif 436#endif
417 437
@@ -454,8 +474,8 @@ static inline void set_compound_order(struct page *page, unsigned long order)
454 474
455#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0)) 475#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0))
456 476
457#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 477#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
458#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 478#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
459#endif 479#endif
460 480
461#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 481#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
@@ -504,10 +524,12 @@ static inline struct zone *page_zone(struct page *page)
504 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; 524 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
505} 525}
506 526
527#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
507static inline unsigned long page_to_section(struct page *page) 528static inline unsigned long page_to_section(struct page *page)
508{ 529{
509 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; 530 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
510} 531}
532#endif
511 533
512static inline void set_page_zone(struct page *page, enum zone_type zone) 534static inline void set_page_zone(struct page *page, enum zone_type zone)
513{ 535{
@@ -602,9 +624,12 @@ static inline struct address_space *page_mapping(struct page *page)
602 struct address_space *mapping = page->mapping; 624 struct address_space *mapping = page->mapping;
603 625
604 VM_BUG_ON(PageSlab(page)); 626 VM_BUG_ON(PageSlab(page));
627#ifdef CONFIG_SWAP
605 if (unlikely(PageSwapCache(page))) 628 if (unlikely(PageSwapCache(page)))
606 mapping = &swapper_space; 629 mapping = &swapper_space;
607 else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON)) 630 else
631#endif
632 if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
608 mapping = NULL; 633 mapping = NULL;
609 return mapping; 634 return mapping;
610} 635}
@@ -649,12 +674,6 @@ static inline int page_mapped(struct page *page)
649} 674}
650 675
651/* 676/*
652 * Error return values for the *_nopage functions
653 */
654#define NOPAGE_SIGBUS (NULL)
655#define NOPAGE_OOM ((struct page *) (-1))
656
657/*
658 * Error return values for the *_nopfn functions 677 * Error return values for the *_nopfn functions
659 */ 678 */
660#define NOPFN_SIGBUS ((unsigned long) -1) 679#define NOPFN_SIGBUS ((unsigned long) -1)
@@ -720,7 +739,9 @@ struct zap_details {
720 unsigned long truncate_count; /* Compare vm_truncate_count */ 739 unsigned long truncate_count; /* Compare vm_truncate_count */
721}; 740};
722 741
723struct page *vm_normal_page(struct vm_area_struct *, unsigned long, pte_t); 742struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
743 pte_t pte);
744
724unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, 745unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
725 unsigned long size, struct zap_details *); 746 unsigned long size, struct zap_details *);
726unsigned long unmap_vmas(struct mmu_gather **tlb, 747unsigned long unmap_vmas(struct mmu_gather **tlb,
@@ -1045,6 +1066,19 @@ extern void unlink_file_vma(struct vm_area_struct *);
1045extern struct vm_area_struct *copy_vma(struct vm_area_struct **, 1066extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
1046 unsigned long addr, unsigned long len, pgoff_t pgoff); 1067 unsigned long addr, unsigned long len, pgoff_t pgoff);
1047extern void exit_mmap(struct mm_struct *); 1068extern void exit_mmap(struct mm_struct *);
1069
1070#ifdef CONFIG_PROC_FS
1071/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */
1072extern void added_exe_file_vma(struct mm_struct *mm);
1073extern void removed_exe_file_vma(struct mm_struct *mm);
1074#else
1075static inline void added_exe_file_vma(struct mm_struct *mm)
1076{}
1077
1078static inline void removed_exe_file_vma(struct mm_struct *mm)
1079{}
1080#endif /* CONFIG_PROC_FS */
1081
1048extern int may_expand_vm(struct mm_struct *mm, unsigned long npages); 1082extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
1049extern int install_special_mapping(struct mm_struct *mm, 1083extern int install_special_mapping(struct mm_struct *mm,
1050 unsigned long addr, unsigned long len, 1084 unsigned long addr, unsigned long len,
@@ -1149,6 +1183,8 @@ int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
1149int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); 1183int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);
1150int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, 1184int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
1151 unsigned long pfn); 1185 unsigned long pfn);
1186int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
1187 unsigned long pfn);
1152 1188
1153struct page *follow_page(struct vm_area_struct *, unsigned long address, 1189struct page *follow_page(struct vm_area_struct *, unsigned long address,
1154 unsigned int foll_flags); 1190 unsigned int foll_flags);
@@ -1207,8 +1243,6 @@ int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
1207 void __user *, size_t *, loff_t *); 1243 void __user *, size_t *, loff_t *);
1208unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, 1244unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
1209 unsigned long lru_pages); 1245 unsigned long lru_pages);
1210void drop_pagecache(void);
1211void drop_slab(void);
1212 1246
1213#ifndef CONFIG_MMU 1247#ifndef CONFIG_MMU
1214#define randomize_va_space 0 1248#define randomize_va_space 0
@@ -1229,6 +1263,7 @@ void vmemmap_verify(pte_t *, int, unsigned long, unsigned long);
1229int vmemmap_populate_basepages(struct page *start_page, 1263int vmemmap_populate_basepages(struct page *start_page,
1230 unsigned long pages, int node); 1264 unsigned long pages, int node);
1231int vmemmap_populate(struct page *start_page, unsigned long pages, int node); 1265int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
1266void vmemmap_populate_print_last(void);
1232 1267
1233#endif /* __KERNEL__ */ 1268#endif /* __KERNEL__ */
1234#endif /* _LINUX_MM_H */ 1269#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index af190ceab971..eb7c16cc9559 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -42,7 +42,10 @@ struct page {
42 * to show when page is mapped 42 * to show when page is mapped
43 * & limit reverse map searches. 43 * & limit reverse map searches.
44 */ 44 */
45 unsigned int inuse; /* SLUB: Nr of objects */ 45 struct { /* SLUB */
46 u16 inuse;
47 u16 objects;
48 };
46 }; 49 };
47 union { 50 union {
48 struct { 51 struct {
@@ -172,6 +175,7 @@ struct mm_struct {
172 atomic_t mm_users; /* How many users with user space? */ 175 atomic_t mm_users; /* How many users with user space? */
173 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 176 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
174 int map_count; /* number of VMAs */ 177 int map_count; /* number of VMAs */
178 int core_waiters;
175 struct rw_semaphore mmap_sem; 179 struct rw_semaphore mmap_sem;
176 spinlock_t page_table_lock; /* Protects page tables and some counters */ 180 spinlock_t page_table_lock; /* Protects page tables and some counters */
177 181
@@ -216,14 +220,20 @@ struct mm_struct {
216 unsigned long flags; /* Must use atomic bitops to access the bits */ 220 unsigned long flags; /* Must use atomic bitops to access the bits */
217 221
218 /* coredumping support */ 222 /* coredumping support */
219 int core_waiters;
220 struct completion *core_startup_done, core_done; 223 struct completion *core_startup_done, core_done;
221 224
222 /* aio bits */ 225 /* aio bits */
223 rwlock_t ioctx_list_lock; 226 rwlock_t ioctx_list_lock; /* aio lock */
224 struct kioctx *ioctx_list; 227 struct kioctx *ioctx_list;
225#ifdef CONFIG_CGROUP_MEM_RES_CTLR 228#ifdef CONFIG_MM_OWNER
226 struct mem_cgroup *mem_cgroup; 229 struct task_struct *owner; /* The thread group leader that */
230 /* owns the mm_struct. */
231#endif
232
233#ifdef CONFIG_PROC_FS
234 /* store ref to file /proc/<pid>/exe symlink points to */
235 struct file *exe_file;
236 unsigned long num_exe_file_vmas;
227#endif 237#endif
228}; 238};
229 239
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 8d8d1977736e..c463cd8a15a4 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1,8 +1,8 @@
1#ifndef _LINUX_MMZONE_H 1#ifndef _LINUX_MMZONE_H
2#define _LINUX_MMZONE_H 2#define _LINUX_MMZONE_H
3 3
4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5#ifndef __GENERATING_BOUNDS_H
6 6
7#include <linux/spinlock.h> 7#include <linux/spinlock.h>
8#include <linux/list.h> 8#include <linux/list.h>
@@ -15,6 +15,7 @@
15#include <linux/seqlock.h> 15#include <linux/seqlock.h>
16#include <linux/nodemask.h> 16#include <linux/nodemask.h>
17#include <linux/pageblock-flags.h> 17#include <linux/pageblock-flags.h>
18#include <linux/bounds.h>
18#include <asm/atomic.h> 19#include <asm/atomic.h>
19#include <asm/page.h> 20#include <asm/page.h>
20 21
@@ -95,6 +96,7 @@ enum zone_stat_item {
95 NR_UNSTABLE_NFS, /* NFS unstable pages */ 96 NR_UNSTABLE_NFS, /* NFS unstable pages */
96 NR_BOUNCE, 97 NR_BOUNCE,
97 NR_VMSCAN_WRITE, 98 NR_VMSCAN_WRITE,
99 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */
98#ifdef CONFIG_NUMA 100#ifdef CONFIG_NUMA
99 NUMA_HIT, /* allocated in intended node */ 101 NUMA_HIT, /* allocated in intended node */
100 NUMA_MISS, /* allocated in non intended node */ 102 NUMA_MISS, /* allocated in non intended node */
@@ -129,6 +131,8 @@ struct per_cpu_pageset {
129#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) 131#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
130#endif 132#endif
131 133
134#endif /* !__GENERATING_BOUNDS.H */
135
132enum zone_type { 136enum zone_type {
133#ifdef CONFIG_ZONE_DMA 137#ifdef CONFIG_ZONE_DMA
134 /* 138 /*
@@ -177,9 +181,11 @@ enum zone_type {
177 ZONE_HIGHMEM, 181 ZONE_HIGHMEM,
178#endif 182#endif
179 ZONE_MOVABLE, 183 ZONE_MOVABLE,
180 MAX_NR_ZONES 184 __MAX_NR_ZONES
181}; 185};
182 186
187#ifndef __GENERATING_BOUNDS_H
188
183/* 189/*
184 * When a memory allocation must conform to specific limitations (such 190 * When a memory allocation must conform to specific limitations (such
185 * as being suitable for DMA) the caller will pass in hints to the 191 * as being suitable for DMA) the caller will pass in hints to the
@@ -188,28 +194,15 @@ enum zone_type {
188 * match the requested limits. See gfp_zone() in include/linux/gfp.h 194 * match the requested limits. See gfp_zone() in include/linux/gfp.h
189 */ 195 */
190 196
191/* 197#if MAX_NR_ZONES < 2
192 * Count the active zones. Note that the use of defined(X) outside
193 * #if and family is not necessarily defined so ensure we cannot use
194 * it later. Use __ZONE_COUNT to work out how many shift bits we need.
195 */
196#define __ZONE_COUNT ( \
197 defined(CONFIG_ZONE_DMA) \
198 + defined(CONFIG_ZONE_DMA32) \
199 + 1 \
200 + defined(CONFIG_HIGHMEM) \
201 + 1 \
202)
203#if __ZONE_COUNT < 2
204#define ZONES_SHIFT 0 198#define ZONES_SHIFT 0
205#elif __ZONE_COUNT <= 2 199#elif MAX_NR_ZONES <= 2
206#define ZONES_SHIFT 1 200#define ZONES_SHIFT 1
207#elif __ZONE_COUNT <= 4 201#elif MAX_NR_ZONES <= 4
208#define ZONES_SHIFT 2 202#define ZONES_SHIFT 2
209#else 203#else
210#error ZONES_SHIFT -- too many zones configured adjust calculation 204#error ZONES_SHIFT -- too many zones configured adjust calculation
211#endif 205#endif
212#undef __ZONE_COUNT
213 206
214struct zone { 207struct zone {
215 /* Fields commonly accessed by the page allocator */ 208 /* Fields commonly accessed by the page allocator */
@@ -393,10 +386,10 @@ static inline int zone_is_oom_locked(const struct zone *zone)
393 * The NUMA zonelists are doubled becausse we need zonelists that restrict the 386 * The NUMA zonelists are doubled becausse we need zonelists that restrict the
394 * allocations to a single node for GFP_THISNODE. 387 * allocations to a single node for GFP_THISNODE.
395 * 388 *
396 * [0 .. MAX_NR_ZONES -1] : Zonelists with fallback 389 * [0] : Zonelist with fallback
397 * [MAZ_NR_ZONES ... MAZ_ZONELISTS -1] : No fallback (GFP_THISNODE) 390 * [1] : No fallback (GFP_THISNODE)
398 */ 391 */
399#define MAX_ZONELISTS (2 * MAX_NR_ZONES) 392#define MAX_ZONELISTS 2
400 393
401 394
402/* 395/*
@@ -464,11 +457,20 @@ struct zonelist_cache {
464 unsigned long last_full_zap; /* when last zap'd (jiffies) */ 457 unsigned long last_full_zap; /* when last zap'd (jiffies) */
465}; 458};
466#else 459#else
467#define MAX_ZONELISTS MAX_NR_ZONES 460#define MAX_ZONELISTS 1
468struct zonelist_cache; 461struct zonelist_cache;
469#endif 462#endif
470 463
471/* 464/*
465 * This struct contains information about a zone in a zonelist. It is stored
466 * here to avoid dereferences into large structures and lookups of tables
467 */
468struct zoneref {
469 struct zone *zone; /* Pointer to actual zone */
470 int zone_idx; /* zone_idx(zoneref->zone) */
471};
472
473/*
472 * One allocation request operates on a zonelist. A zonelist 474 * One allocation request operates on a zonelist. A zonelist
473 * is a list of zones, the first one is the 'goal' of the 475 * is a list of zones, the first one is the 'goal' of the
474 * allocation, the other zones are fallback zones, in decreasing 476 * allocation, the other zones are fallback zones, in decreasing
@@ -476,34 +478,23 @@ struct zonelist_cache;
476 * 478 *
477 * If zlcache_ptr is not NULL, then it is just the address of zlcache, 479 * If zlcache_ptr is not NULL, then it is just the address of zlcache,
478 * as explained above. If zlcache_ptr is NULL, there is no zlcache. 480 * as explained above. If zlcache_ptr is NULL, there is no zlcache.
481 * *
482 * To speed the reading of the zonelist, the zonerefs contain the zone index
483 * of the entry being read. Helper functions to access information given
484 * a struct zoneref are
485 *
486 * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
487 * zonelist_zone_idx() - Return the index of the zone for an entry
488 * zonelist_node_idx() - Return the index of the node for an entry
479 */ 489 */
480
481struct zonelist { 490struct zonelist {
482 struct zonelist_cache *zlcache_ptr; // NULL or &zlcache 491 struct zonelist_cache *zlcache_ptr; // NULL or &zlcache
483 struct zone *zones[MAX_ZONES_PER_ZONELIST + 1]; // NULL delimited 492 struct zoneref _zonerefs[MAX_ZONES_PER_ZONELIST + 1];
484#ifdef CONFIG_NUMA 493#ifdef CONFIG_NUMA
485 struct zonelist_cache zlcache; // optional ... 494 struct zonelist_cache zlcache; // optional ...
486#endif 495#endif
487}; 496};
488 497
489#ifdef CONFIG_NUMA
490/*
491 * Only custom zonelists like MPOL_BIND need to be filtered as part of
492 * policies. As described in the comment for struct zonelist_cache, these
493 * zonelists will not have a zlcache so zlcache_ptr will not be set. Use
494 * that to determine if the zonelists needs to be filtered or not.
495 */
496static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
497{
498 return !zonelist->zlcache_ptr;
499}
500#else
501static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
502{
503 return 0;
504}
505#endif /* CONFIG_NUMA */
506
507#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 498#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
508struct node_active_region { 499struct node_active_region {
509 unsigned long start_pfn; 500 unsigned long start_pfn;
@@ -637,9 +628,10 @@ static inline int is_normal_idx(enum zone_type idx)
637static inline int is_highmem(struct zone *zone) 628static inline int is_highmem(struct zone *zone)
638{ 629{
639#ifdef CONFIG_HIGHMEM 630#ifdef CONFIG_HIGHMEM
640 int zone_idx = zone - zone->zone_pgdat->node_zones; 631 int zone_off = (char *)zone - (char *)zone->zone_pgdat->node_zones;
641 return zone_idx == ZONE_HIGHMEM || 632 return zone_off == ZONE_HIGHMEM * sizeof(*zone) ||
642 (zone_idx == ZONE_MOVABLE && zone_movable_is_highmem()); 633 (zone_off == ZONE_MOVABLE * sizeof(*zone) &&
634 zone_movable_is_highmem());
643#else 635#else
644 return 0; 636 return 0;
645#endif 637#endif
@@ -699,7 +691,6 @@ extern char numa_zonelist_order[];
699extern struct pglist_data contig_page_data; 691extern struct pglist_data contig_page_data;
700#define NODE_DATA(nid) (&contig_page_data) 692#define NODE_DATA(nid) (&contig_page_data)
701#define NODE_MEM_MAP(nid) mem_map 693#define NODE_MEM_MAP(nid) mem_map
702#define MAX_NODES_SHIFT 1
703 694
704#else /* CONFIG_NEED_MULTIPLE_NODES */ 695#else /* CONFIG_NEED_MULTIPLE_NODES */
705 696
@@ -731,32 +722,103 @@ extern struct zone *next_zone(struct zone *zone);
731 zone; \ 722 zone; \
732 zone = next_zone(zone)) 723 zone = next_zone(zone))
733 724
734#ifdef CONFIG_SPARSEMEM 725static inline struct zone *zonelist_zone(struct zoneref *zoneref)
735#include <asm/sparsemem.h> 726{
736#endif 727 return zoneref->zone;
728}
737 729
738#if BITS_PER_LONG == 32 730static inline int zonelist_zone_idx(struct zoneref *zoneref)
739/* 731{
740 * with 32 bit page->flags field, we reserve 9 bits for node/zone info. 732 return zoneref->zone_idx;
741 * there are 4 zones (3 bits) and this leaves 9-3=6 bits for nodes. 733}
734
735static inline int zonelist_node_idx(struct zoneref *zoneref)
736{
737#ifdef CONFIG_NUMA
738 /* zone_to_nid not available in this context */
739 return zoneref->zone->node;
740#else
741 return 0;
742#endif /* CONFIG_NUMA */
743}
744
745/**
746 * next_zones_zonelist - Returns the next zone at or below highest_zoneidx within the allowed nodemask using a cursor within a zonelist as a starting point
747 * @z - The cursor used as a starting point for the search
748 * @highest_zoneidx - The zone index of the highest zone to return
749 * @nodes - An optional nodemask to filter the zonelist with
750 * @zone - The first suitable zone found is returned via this parameter
751 *
752 * This function returns the next zone at or below a given zone index that is
753 * within the allowed nodemask using a cursor as the starting point for the
754 * search. The zoneref returned is a cursor that is used as the next starting
755 * point for future calls to next_zones_zonelist().
742 */ 756 */
743#define FLAGS_RESERVED 9 757struct zoneref *next_zones_zonelist(struct zoneref *z,
758 enum zone_type highest_zoneidx,
759 nodemask_t *nodes,
760 struct zone **zone);
744 761
745#elif BITS_PER_LONG == 64 762/**
746/* 763 * first_zones_zonelist - Returns the first zone at or below highest_zoneidx within the allowed nodemask in a zonelist
747 * with 64 bit flags field, there's plenty of room. 764 * @zonelist - The zonelist to search for a suitable zone
765 * @highest_zoneidx - The zone index of the highest zone to return
766 * @nodes - An optional nodemask to filter the zonelist with
767 * @zone - The first suitable zone found is returned via this parameter
768 *
769 * This function returns the first zone at or below a given zone index that is
770 * within the allowed nodemask. The zoneref returned is a cursor that can be
771 * used to iterate the zonelist with next_zones_zonelist. The cursor should
772 * not be used by the caller as it does not match the value of the zone
773 * returned.
748 */ 774 */
749#define FLAGS_RESERVED 32 775static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
776 enum zone_type highest_zoneidx,
777 nodemask_t *nodes,
778 struct zone **zone)
779{
780 return next_zones_zonelist(zonelist->_zonerefs, highest_zoneidx, nodes,
781 zone);
782}
750 783
751#else 784/**
785 * for_each_zone_zonelist_nodemask - helper macro to iterate over valid zones in a zonelist at or below a given zone index and within a nodemask
786 * @zone - The current zone in the iterator
787 * @z - The current pointer within zonelist->zones being iterated
788 * @zlist - The zonelist being iterated
789 * @highidx - The zone index of the highest zone to return
790 * @nodemask - Nodemask allowed by the allocator
791 *
792 * This iterator iterates though all zones at or below a given zone index and
793 * within a given nodemask
794 */
795#define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \
796 for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone); \
797 zone; \
798 z = next_zones_zonelist(z, highidx, nodemask, &zone)) \
752 799
753#error BITS_PER_LONG not defined 800/**
801 * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index
802 * @zone - The current zone in the iterator
803 * @z - The current pointer within zonelist->zones being iterated
804 * @zlist - The zonelist being iterated
805 * @highidx - The zone index of the highest zone to return
806 *
807 * This iterator iterates though all zones at or below a given zone index.
808 */
809#define for_each_zone_zonelist(zone, z, zlist, highidx) \
810 for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, NULL)
754 811
812#ifdef CONFIG_SPARSEMEM
813#include <asm/sparsemem.h>
755#endif 814#endif
756 815
757#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \ 816#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
758 !defined(CONFIG_ARCH_POPULATES_NODE_MAP) 817 !defined(CONFIG_ARCH_POPULATES_NODE_MAP)
759#define early_pfn_to_nid(nid) (0UL) 818static inline unsigned long early_pfn_to_nid(unsigned long pfn)
819{
820 return 0;
821}
760#endif 822#endif
761 823
762#ifdef CONFIG_FLATMEM 824#ifdef CONFIG_FLATMEM
@@ -834,6 +896,7 @@ static inline struct mem_section *__nr_to_section(unsigned long nr)
834 return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; 896 return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
835} 897}
836extern int __section_nr(struct mem_section* ms); 898extern int __section_nr(struct mem_section* ms);
899extern unsigned long usemap_size(void);
837 900
838/* 901/*
839 * We use the lower bits of the mem_map pointer to store 902 * We use the lower bits of the mem_map pointer to store
@@ -939,6 +1002,6 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
939#define pfn_valid_within(pfn) (1) 1002#define pfn_valid_within(pfn) (1)
940#endif 1003#endif
941 1004
1005#endif /* !__GENERATING_BOUNDS.H */
942#endif /* !__ASSEMBLY__ */ 1006#endif /* !__ASSEMBLY__ */
943#endif /* __KERNEL__ */
944#endif /* _LINUX_MMZONE_H */ 1007#endif /* _LINUX_MMZONE_H */
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 8eed44f8ca73..830bbcd449d6 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -5,6 +5,7 @@
5#include <linux/mount.h> 5#include <linux/mount.h>
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/nsproxy.h> 7#include <linux/nsproxy.h>
8#include <linux/seq_file.h>
8 9
9struct mnt_namespace { 10struct mnt_namespace {
10 atomic_t count; 11 atomic_t count;
@@ -14,6 +15,13 @@ struct mnt_namespace {
14 int event; 15 int event;
15}; 16};
16 17
18struct proc_mounts {
19 struct seq_file m; /* must be the first element */
20 struct mnt_namespace *ns;
21 struct path root;
22 int event;
23};
24
17extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 25extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
18 struct fs_struct *); 26 struct fs_struct *);
19extern void __put_mnt_ns(struct mnt_namespace *ns); 27extern void __put_mnt_ns(struct mnt_namespace *ns);
@@ -37,5 +45,9 @@ static inline void get_mnt_ns(struct mnt_namespace *ns)
37 atomic_inc(&ns->count); 45 atomic_inc(&ns->count);
38} 46}
39 47
48extern const struct seq_operations mounts_op;
49extern const struct seq_operations mountinfo_op;
50extern const struct seq_operations mountstats_op;
51
40#endif 52#endif
41#endif 53#endif
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 139d49d2f078..d73eceaa7afb 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -368,4 +368,15 @@ struct virtio_device_id {
368}; 368};
369#define VIRTIO_DEV_ANY_ID 0xffffffff 369#define VIRTIO_DEV_ANY_ID 0xffffffff
370 370
371/* i2c */
372
373#define I2C_NAME_SIZE 20
374#define I2C_MODULE_PREFIX "i2c:"
375
376struct i2c_device_id {
377 char name[I2C_NAME_SIZE];
378 kernel_ulong_t driver_data; /* Data private to the driver */
379};
380
381
371#endif /* LINUX_MOD_DEVICETABLE_H */ 382#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 819c4e889bf1..3e03b1acbc94 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -190,7 +190,7 @@ void *__symbol_get_gpl(const char *symbol);
190 extern typeof(sym) sym; \ 190 extern typeof(sym) sym; \
191 __CRC_SYMBOL(sym, sec) \ 191 __CRC_SYMBOL(sym, sec) \
192 static const char __kstrtab_##sym[] \ 192 static const char __kstrtab_##sym[] \
193 __attribute__((section("__ksymtab_strings"))) \ 193 __attribute__((section("__ksymtab_strings"), aligned(1))) \
194 = MODULE_SYMBOL_PREFIX #sym; \ 194 = MODULE_SYMBOL_PREFIX #sym; \
195 static const struct kernel_symbol __ksymtab_##sym \ 195 static const struct kernel_symbol __ksymtab_##sym \
196 __used \ 196 __used \
@@ -229,23 +229,6 @@ enum module_state
229 MODULE_STATE_GOING, 229 MODULE_STATE_GOING,
230}; 230};
231 231
232/* Similar stuff for section attributes. */
233struct module_sect_attr
234{
235 struct module_attribute mattr;
236 char *name;
237 unsigned long address;
238};
239
240struct module_sect_attrs
241{
242 struct attribute_group grp;
243 int nsections;
244 struct module_sect_attr attrs[0];
245};
246
247struct module_param_attrs;
248
249struct module 232struct module
250{ 233{
251 enum module_state state; 234 enum module_state state;
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 5ee2df217cdf..4374d1adeb4b 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -10,10 +10,10 @@
10 */ 10 */
11#ifndef _LINUX_MOUNT_H 11#ifndef _LINUX_MOUNT_H
12#define _LINUX_MOUNT_H 12#define _LINUX_MOUNT_H
13#ifdef __KERNEL__
14 13
15#include <linux/types.h> 14#include <linux/types.h>
16#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/nodemask.h>
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <asm/atomic.h> 18#include <asm/atomic.h>
19 19
@@ -28,8 +28,10 @@ struct mnt_namespace;
28#define MNT_NOATIME 0x08 28#define MNT_NOATIME 0x08
29#define MNT_NODIRATIME 0x10 29#define MNT_NODIRATIME 0x10
30#define MNT_RELATIME 0x20 30#define MNT_RELATIME 0x20
31#define MNT_READONLY 0x40 /* does the user want this to be r/o? */
31 32
32#define MNT_SHRINKABLE 0x100 33#define MNT_SHRINKABLE 0x100
34#define MNT_IMBALANCED_WRITE_COUNT 0x200 /* just for debugging */
33 35
34#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ 36#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
35#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ 37#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
@@ -53,6 +55,8 @@ struct vfsmount {
53 struct list_head mnt_slave; /* slave list entry */ 55 struct list_head mnt_slave; /* slave list entry */
54 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */ 56 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
55 struct mnt_namespace *mnt_ns; /* containing namespace */ 57 struct mnt_namespace *mnt_ns; /* containing namespace */
58 int mnt_id; /* mount identifier */
59 int mnt_group_id; /* peer group identifier */
56 /* 60 /*
57 * We put mnt_count & mnt_expiry_mark at the end of struct vfsmount 61 * We put mnt_count & mnt_expiry_mark at the end of struct vfsmount
58 * to let these frequently modified fields in a separate cache line 62 * to let these frequently modified fields in a separate cache line
@@ -62,6 +66,11 @@ struct vfsmount {
62 int mnt_expiry_mark; /* true if marked for expiry */ 66 int mnt_expiry_mark; /* true if marked for expiry */
63 int mnt_pinned; 67 int mnt_pinned;
64 int mnt_ghosts; 68 int mnt_ghosts;
69 /*
70 * This value is not stable unless all of the mnt_writers[] spinlocks
71 * are held, and all mnt_writer[]s on this mount have 0 as their ->count
72 */
73 atomic_t __mnt_writers;
65}; 74};
66 75
67static inline struct vfsmount *mntget(struct vfsmount *mnt) 76static inline struct vfsmount *mntget(struct vfsmount *mnt)
@@ -71,9 +80,12 @@ static inline struct vfsmount *mntget(struct vfsmount *mnt)
71 return mnt; 80 return mnt;
72} 81}
73 82
83extern int mnt_want_write(struct vfsmount *mnt);
84extern void mnt_drop_write(struct vfsmount *mnt);
74extern void mntput_no_expire(struct vfsmount *mnt); 85extern void mntput_no_expire(struct vfsmount *mnt);
75extern void mnt_pin(struct vfsmount *mnt); 86extern void mnt_pin(struct vfsmount *mnt);
76extern void mnt_unpin(struct vfsmount *mnt); 87extern void mnt_unpin(struct vfsmount *mnt);
88extern int __mnt_is_readonly(struct vfsmount *mnt);
77 89
78static inline void mntput(struct vfsmount *mnt) 90static inline void mntput(struct vfsmount *mnt)
79{ 91{
@@ -83,8 +95,6 @@ static inline void mntput(struct vfsmount *mnt)
83 } 95 }
84} 96}
85 97
86extern void free_vfsmnt(struct vfsmount *mnt);
87extern struct vfsmount *alloc_vfsmnt(const char *name);
88extern struct vfsmount *do_kern_mount(const char *fstype, int flags, 98extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
89 const char *name, void *data); 99 const char *name, void *data);
90 100
@@ -103,5 +113,4 @@ extern void mark_mounts_for_expiry(struct list_head *mounts);
103extern spinlock_t vfsmount_lock; 113extern spinlock_t vfsmount_lock;
104extern dev_t name_to_dev_t(char *name); 114extern dev_t name_to_dev_t(char *name);
105 115
106#endif
107#endif /* _LINUX_MOUNT_H */ 116#endif /* _LINUX_MOUNT_H */
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 35a8277ec1bd..de4decfa1bfc 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -2,7 +2,11 @@
2#define __LINUX_MROUTE_H 2#define __LINUX_MROUTE_H
3 3
4#include <linux/sockios.h> 4#include <linux/sockios.h>
5#include <linux/types.h>
6#ifdef __KERNEL__
5#include <linux/in.h> 7#include <linux/in.h>
8#endif
9#include <linux/pim.h>
6 10
7/* 11/*
8 * Based on the MROUTING 3.5 defines primarily to keep 12 * Based on the MROUTING 3.5 defines primarily to keep
@@ -210,27 +214,6 @@ struct mfc_cache
210#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ 214#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */
211 215
212#ifdef __KERNEL__ 216#ifdef __KERNEL__
213
214#define PIM_V1_VERSION __constant_htonl(0x10000000)
215#define PIM_V1_REGISTER 1
216
217#define PIM_VERSION 2
218#define PIM_REGISTER 1
219
220#define PIM_NULL_REGISTER __constant_htonl(0x40000000)
221
222/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
223
224struct pimreghdr
225{
226 __u8 type;
227 __u8 reserved;
228 __be16 csum;
229 __be32 flags;
230};
231
232extern int pim_rcv_v1(struct sk_buff *);
233
234struct rtmsg; 217struct rtmsg;
235extern int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait); 218extern int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait);
236#endif 219#endif
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
new file mode 100644
index 000000000000..e7989593142b
--- /dev/null
+++ b/include/linux/mroute6.h
@@ -0,0 +1,228 @@
1#ifndef __LINUX_MROUTE6_H
2#define __LINUX_MROUTE6_H
3
4#include <linux/types.h>
5#include <linux/sockios.h>
6
7/*
8 * Based on the MROUTING 3.5 defines primarily to keep
9 * source compatibility with BSD.
10 *
11 * See the pim6sd code for the original history.
12 *
13 * Protocol Independent Multicast (PIM) data structures included
14 * Carlos Picoto (cap@di.fc.ul.pt)
15 *
16 */
17
18#define MRT6_BASE 200
19#define MRT6_INIT (MRT6_BASE) /* Activate the kernel mroute code */
20#define MRT6_DONE (MRT6_BASE+1) /* Shutdown the kernel mroute */
21#define MRT6_ADD_MIF (MRT6_BASE+2) /* Add a virtual interface */
22#define MRT6_DEL_MIF (MRT6_BASE+3) /* Delete a virtual interface */
23#define MRT6_ADD_MFC (MRT6_BASE+4) /* Add a multicast forwarding entry */
24#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */
25#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */
26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */
27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */
28
29#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */
30#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
31#define SIOCGETRPF (SIOCPROTOPRIVATE+2)
32
33#define MAXMIFS 32
34typedef unsigned long mifbitmap_t; /* User mode code depends on this lot */
35typedef unsigned short mifi_t;
36#define ALL_MIFS ((mifi_t)(-1))
37
38#ifndef IF_SETSIZE
39#define IF_SETSIZE 256
40#endif
41
42typedef __u32 if_mask;
43#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */
44
45#if !defined(__KERNEL__) && !defined(DIV_ROUND_UP)
46#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y))
47#endif
48
49typedef struct if_set {
50 if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)];
51} if_set;
52
53#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
54#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
55#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
56#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f)))
57#define IF_ZERO(p) bzero(p, sizeof(*(p)))
58
59/*
60 * Passed by mrouted for an MRT_ADD_MIF - again we use the
61 * mrouted 3.6 structures for compatibility
62 */
63
64struct mif6ctl {
65 mifi_t mif6c_mifi; /* Index of MIF */
66 unsigned char mif6c_flags; /* MIFF_ flags */
67 unsigned char vifc_threshold; /* ttl limit */
68 u_short mif6c_pifi; /* the index of the physical IF */
69 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */
70};
71
72#define MIFF_REGISTER 0x1 /* register vif */
73
74/*
75 * Cache manipulation structures for mrouted and PIMd
76 */
77
78struct mf6cctl
79{
80 struct sockaddr_in6 mf6cc_origin; /* Origin of mcast */
81 struct sockaddr_in6 mf6cc_mcastgrp; /* Group in question */
82 mifi_t mf6cc_parent; /* Where it arrived */
83 struct if_set mf6cc_ifset; /* Where it is going */
84};
85
86/*
87 * Group count retrieval for pim6sd
88 */
89
90struct sioc_sg_req6
91{
92 struct sockaddr_in6 src;
93 struct sockaddr_in6 grp;
94 unsigned long pktcnt;
95 unsigned long bytecnt;
96 unsigned long wrong_if;
97};
98
99/*
100 * To get vif packet counts
101 */
102
103struct sioc_mif_req6
104{
105 mifi_t mifi; /* Which iface */
106 unsigned long icount; /* In packets */
107 unsigned long ocount; /* Out packets */
108 unsigned long ibytes; /* In bytes */
109 unsigned long obytes; /* Out bytes */
110};
111
112/*
113 * That's all usermode folks
114 */
115
116#ifdef __KERNEL__
117
118#include <linux/skbuff.h> /* for struct sk_buff_head */
119
120#ifdef CONFIG_IPV6_MROUTE
121static inline int ip6_mroute_opt(int opt)
122{
123 return (opt >= MRT6_BASE) && (opt <= MRT6_BASE + 10);
124}
125#else
126static inline int ip6_mroute_opt(int opt)
127{
128 return 0;
129}
130#endif
131
132struct sock;
133
134extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int);
135extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
136extern int ip6_mr_input(struct sk_buff *skb);
137extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
138extern void ip6_mr_init(void);
139
140struct mif_device
141{
142 struct net_device *dev; /* Device we are using */
143 unsigned long bytes_in,bytes_out;
144 unsigned long pkt_in,pkt_out; /* Statistics */
145 unsigned long rate_limit; /* Traffic shaping (NI) */
146 unsigned char threshold; /* TTL threshold */
147 unsigned short flags; /* Control flags */
148 int link; /* Physical interface index */
149};
150
151#define VIFF_STATIC 0x8000
152
153struct mfc6_cache
154{
155 struct mfc6_cache *next; /* Next entry on cache line */
156 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */
157 struct in6_addr mf6c_origin; /* Source of packet */
158 mifi_t mf6c_parent; /* Source interface */
159 int mfc_flags; /* Flags on line */
160
161 union {
162 struct {
163 unsigned long expires;
164 struct sk_buff_head unresolved; /* Unresolved buffers */
165 } unres;
166 struct {
167 unsigned long last_assert;
168 int minvif;
169 int maxvif;
170 unsigned long bytes;
171 unsigned long pkt;
172 unsigned long wrong_if;
173 unsigned char ttls[MAXMIFS]; /* TTL thresholds */
174 } res;
175 } mfc_un;
176};
177
178#define MFC_STATIC 1
179#define MFC_NOTIFY 2
180
181#define MFC6_LINES 64
182
183#define MFC6_HASH(a, g) (((__force u32)(a)->s6_addr32[0] ^ \
184 (__force u32)(a)->s6_addr32[1] ^ \
185 (__force u32)(a)->s6_addr32[2] ^ \
186 (__force u32)(a)->s6_addr32[3] ^ \
187 (__force u32)(g)->s6_addr32[0] ^ \
188 (__force u32)(g)->s6_addr32[1] ^ \
189 (__force u32)(g)->s6_addr32[2] ^ \
190 (__force u32)(g)->s6_addr32[3]) % MFC6_LINES)
191
192#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */
193
194#endif
195
196#ifdef __KERNEL__
197struct rtmsg;
198extern int ip6mr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait);
199
200#ifdef CONFIG_IPV6_MROUTE
201extern struct sock *mroute6_socket;
202extern int ip6mr_sk_done(struct sock *sk);
203#else
204#define mroute6_socket NULL
205static inline int ip6mr_sk_done(struct sock *sk) { return 0; }
206#endif
207#endif
208
209/*
210 * Structure used to communicate from kernel to multicast router.
211 * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{}
212 * used for IPv4 implementation). This is because this structure will be passed via an
213 * IPv6 raw socket, on wich an application will only receiver the payload i.e the data after
214 * the IPv6 header and all the extension headers. (See section 3 of RFC 3542)
215 */
216
217struct mrt6msg {
218#define MRT6MSG_NOCACHE 1
219#define MRT6MSG_WRONGMIF 2
220#define MRT6MSG_WHOLEPKT 3 /* used for use level encap */
221 __u8 im6_mbz; /* must be zero */
222 __u8 im6_msgtype; /* what type of message */
223 __u16 im6_mif; /* mif rec'd on */
224 __u32 im6_pad; /* padding for 64 bit arch */
225 struct in6_addr im6_src, im6_dst;
226};
227
228#endif
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index f950921523f5..b03b27457413 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -58,7 +58,11 @@
58#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ 58#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
59 59
60/* media of boot sector */ 60/* media of boot sector */
61#define FAT_VALID_MEDIA(x) ((0xF8 <= (x) && (x) <= 0xFF) || (x) == 0xF0) 61static inline int fat_valid_media(u8 media)
62{
63 return 0xf8 <= media || media == 0xf0;
64}
65
62#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \ 66#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \
63 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) 67 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
64 68
@@ -195,6 +199,7 @@ struct fat_mount_options {
195 char *iocharset; /* Charset used for filename input/display */ 199 char *iocharset; /* Charset used for filename input/display */
196 unsigned short shortname; /* flags for shortname display/create rule */ 200 unsigned short shortname; /* flags for shortname display/create rule */
197 unsigned char name_check; /* r = relaxed, n = normal, s = strict */ 201 unsigned char name_check; /* r = relaxed, n = normal, s = strict */
202 unsigned short allow_utime;/* permission for setting the [am]time */
198 unsigned quiet:1, /* set = fake successful chmods and chowns */ 203 unsigned quiet:1, /* set = fake successful chmods and chowns */
199 showexec:1, /* set = only set x bit for com/exe/bat */ 204 showexec:1, /* set = only set x bit for com/exe/bat */
200 sys_immutable:1, /* set = system files are immutable */ 205 sys_immutable:1, /* set = system files are immutable */
@@ -232,6 +237,7 @@ struct msdos_sb_info {
232 struct mutex fat_lock; 237 struct mutex fat_lock;
233 unsigned int prev_free; /* previously allocated cluster number */ 238 unsigned int prev_free; /* previously allocated cluster number */
234 unsigned int free_clusters; /* -1 if undefined */ 239 unsigned int free_clusters; /* -1 if undefined */
240 unsigned int free_clus_valid; /* is free_clusters valid? */
235 struct fat_mount_options options; 241 struct fat_mount_options options;
236 struct nls_table *nls_disk; /* Codepage used on disk */ 242 struct nls_table *nls_disk; /* Codepage used on disk */
237 struct nls_table *nls_io; /* Charset used for input and display */ 243 struct nls_table *nls_io; /* Charset used for input and display */
@@ -401,7 +407,7 @@ extern int fat_generic_ioctl(struct inode *inode, struct file *filp,
401 unsigned int cmd, unsigned long arg); 407 unsigned int cmd, unsigned long arg);
402extern const struct file_operations fat_file_operations; 408extern const struct file_operations fat_file_operations;
403extern const struct inode_operations fat_file_inode_operations; 409extern const struct inode_operations fat_file_inode_operations;
404extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); 410extern int fat_setattr(struct dentry * dentry, struct iattr * attr);
405extern void fat_truncate(struct inode *inode); 411extern void fat_truncate(struct inode *inode);
406extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, 412extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry,
407 struct kstat *stat); 413 struct kstat *stat);
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 10a3d5a1abff..6f3b8e79a991 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -49,16 +49,26 @@ struct msginfo {
49 unsigned short msgseg; 49 unsigned short msgseg;
50}; 50};
51 51
52/*
53 * Scaling factor to compute msgmni:
54 * the memory dedicated to msg queues (msgmni * msgmnb) should occupy
55 * at most 1/MSG_MEM_SCALE of the lowmem (see the formula in ipc/msg.c):
56 * up to 8MB : msgmni = 16 (MSGMNI)
57 * 4 GB : msgmni = 8K
58 * more than 16 GB : msgmni = 32K (IPCMNI)
59 */
60#define MSG_MEM_SCALE 32
61
52#define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */ 62#define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */
53#define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */ 63#define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */
54#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ 64#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */
55 65
56/* unused */ 66/* unused */
57#define MSGPOOL (MSGMNI*MSGMNB/1024) /* size in kilobytes of message pool */ 67#define MSGPOOL (MSGMNI * MSGMNB) /* size in bytes of message pool */
58#define MSGTQL MSGMNB /* number of system message headers */ 68#define MSGTQL MSGMNB /* number of system message headers */
59#define MSGMAP MSGMNB /* number of entries in message map */ 69#define MSGMAP MSGMNB /* number of entries in message map */
60#define MSGSSZ 16 /* message segment size */ 70#define MSGSSZ 16 /* message segment size */
61#define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ) /* max no. of segments */ 71#define __MSGSEG (MSGPOOL / MSGSSZ) /* max no. of segments */
62#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff) 72#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
63 73
64#ifdef __KERNEL__ 74#ifdef __KERNEL__
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 94bb46d82efd..8f2939227207 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -22,6 +22,7 @@ struct msi_desc {
22 __u8 masked : 1; 22 __u8 masked : 1;
23 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 23 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
24 __u8 pos; /* Location of the msi capability */ 24 __u8 pos; /* Location of the msi capability */
25 __u32 maskbits_mask; /* mask bits mask */
25 __u16 entry_nr; /* specific enabled entry */ 26 __u16 entry_nr; /* specific enabled entry */
26 unsigned default_irq; /* default pre-assigned irq */ 27 unsigned default_irq; /* default pre-assigned irq */
27 }msi_attrib; 28 }msi_attrib;
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h
index 6977780e548f..85fd041d44ad 100644
--- a/include/linux/mtd/inftl.h
+++ b/include/linux/mtd/inftl.h
@@ -57,6 +57,11 @@ extern char inftlmountrev[];
57void INFTL_dumptables(struct INFTLrecord *s); 57void INFTL_dumptables(struct INFTLrecord *s);
58void INFTL_dumpVUchains(struct INFTLrecord *s); 58void INFTL_dumpVUchains(struct INFTLrecord *s);
59 59
60int inftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
61 size_t *retlen, uint8_t *buf);
62int inftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
63 size_t *retlen, uint8_t *buf);
64
60#endif /* __KERNEL__ */ 65#endif /* __KERNEL__ */
61 66
62#endif /* __MTD_INFTL_H__ */ 67#endif /* __MTD_INFTL_H__ */
diff --git a/include/linux/mtd/jedec.h b/include/linux/mtd/jedec.h
deleted file mode 100644
index 9006feb218b9..000000000000
--- a/include/linux/mtd/jedec.h
+++ /dev/null
@@ -1,66 +0,0 @@
1
2/* JEDEC Flash Interface.
3 * This is an older type of interface for self programming flash. It is
4 * commonly use in older AMD chips and is obsolete compared with CFI.
5 * It is called JEDEC because the JEDEC association distributes the ID codes
6 * for the chips.
7 *
8 * See the AMD flash databook for information on how to operate the interface.
9 *
10 * $Id: jedec.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $
11 */
12
13#ifndef __LINUX_MTD_JEDEC_H__
14#define __LINUX_MTD_JEDEC_H__
15
16#include <linux/types.h>
17
18#define MAX_JEDEC_CHIPS 16
19
20// Listing of all supported chips and their information
21struct JEDECTable
22{
23 __u16 jedec;
24 char *name;
25 unsigned long size;
26 unsigned long sectorsize;
27 __u32 capabilities;
28};
29
30// JEDEC being 0 is the end of the chip array
31struct jedec_flash_chip
32{
33 __u16 jedec;
34 unsigned long size;
35 unsigned long sectorsize;
36
37 // *(__u8*)(base + (adder << addrshift)) = data << datashift
38 // Address size = size << addrshift
39 unsigned long base; // Byte 0 of the flash, will be unaligned
40 unsigned int datashift; // Useful for 32bit/16bit accesses
41 unsigned int addrshift;
42 unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash
43
44 __u32 capabilities;
45
46 // These markers are filled in by the flash_chip_scan function
47 unsigned long start;
48 unsigned long length;
49};
50
51struct jedec_private
52{
53 unsigned long size; // Total size of all the devices
54
55 /* Bank handling. If sum(bank_fill) == size then this is linear flash.
56 Otherwise the mapping has holes in it. bank_fill may be used to
57 find the holes, but in the common symetric case
58 bank_fill[0] == bank_fill[*], thus addresses may be computed
59 mathmatically. bank_fill must be powers of two */
60 unsigned is_banked;
61 unsigned long bank_fill[MAX_JEDEC_CHIPS];
62
63 struct jedec_flash_chip chips[MAX_JEDEC_CHIPS];
64};
65
66#endif
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 0a13bb35f044..245f9098e171 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -143,10 +143,12 @@ struct mtd_info {
143 int (*erase) (struct mtd_info *mtd, struct erase_info *instr); 143 int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
144 144
145 /* This stuff for eXecute-In-Place */ 145 /* This stuff for eXecute-In-Place */
146 int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); 146 /* phys is optional and may be set to NULL */
147 int (*point) (struct mtd_info *mtd, loff_t from, size_t len,
148 size_t *retlen, void **virt, resource_size_t *phys);
147 149
148 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ 150 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
149 void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len); 151 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
150 152
151 153
152 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 154 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index bcf2fb3fa4a7..001eec50cac6 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -43,6 +43,11 @@ struct NFTLrecord {
43int NFTL_mount(struct NFTLrecord *s); 43int NFTL_mount(struct NFTLrecord *s);
44int NFTL_formatblock(struct NFTLrecord *s, int block); 44int NFTL_formatblock(struct NFTLrecord *s, int block);
45 45
46int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
47 size_t *retlen, uint8_t *buf);
48int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
49 size_t *retlen, uint8_t *buf);
50
46#ifndef NFTL_MAJOR 51#ifndef NFTL_MAJOR
47#define NFTL_MAJOR 93 52#define NFTL_MAJOR 93
48#endif 53#endif
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index fd0a260e070b..9aa2a9149b58 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -187,4 +187,7 @@ struct onenand_manufacturers {
187 char *name; 187 char *name;
188}; 188};
189 189
190int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,
191 struct mtd_oob_ops *ops);
192
190#endif /* __LINUX_MTD_ONENAND_H */ 193#endif /* __LINUX_MTD_ONENAND_H */
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h
index 9667863bd7e3..0e37ad07bce2 100644
--- a/include/linux/mtd/plat-ram.h
+++ b/include/linux/mtd/plat-ram.h
@@ -21,8 +21,9 @@
21#define PLATRAM_RW (1) 21#define PLATRAM_RW (1)
22 22
23struct platdata_mtd_ram { 23struct platdata_mtd_ram {
24 char *mapname; 24 const char *mapname;
25 char **probes; 25 const char **map_probes;
26 const char **probes;
26 struct mtd_partition *partitions; 27 struct mtd_partition *partitions;
27 int nr_partitions; 28 int nr_partitions;
28 int bankwidth; 29 int bankwidth;
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h
index a7f6d20ad407..5cc070c24d88 100644
--- a/include/linux/mtd/pmc551.h
+++ b/include/linux/mtd/pmc551.h
@@ -36,8 +36,9 @@ struct mypriv {
36 * Function Prototypes 36 * Function Prototypes
37 */ 37 */
38static int pmc551_erase(struct mtd_info *, struct erase_info *); 38static int pmc551_erase(struct mtd_info *, struct erase_info *);
39static void pmc551_unpoint(struct mtd_info *, u_char *, loff_t, size_t); 39static void pmc551_unpoint(struct mtd_info *, loff_t, size_t);
40static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); 40static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len,
41 size_t *retlen, void **virt, resource_size_t *phys);
41static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); 42static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *);
42static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 43static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
43 44
diff --git a/include/linux/mtio.h b/include/linux/mtio.h
index 6f8d2d45a8fb..ef01d6aa5934 100644
--- a/include/linux/mtio.h
+++ b/include/linux/mtio.h
@@ -192,6 +192,7 @@ struct mtpos {
192#define MT_ST_SCSI2LOGICAL 0x800 192#define MT_ST_SCSI2LOGICAL 0x800
193#define MT_ST_SYSV 0x1000 193#define MT_ST_SYSV 0x1000
194#define MT_ST_NOWAIT 0x2000 194#define MT_ST_NOWAIT 0x2000
195#define MT_ST_SILI 0x4000
195 196
196/* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ 197/* The mode parameters to be controlled. Parameter chosen with bits 20-28 */
197#define MT_ST_CLEAR_DEFAULT 0xfffff 198#define MT_ST_CLEAR_DEFAULT 0xfffff
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 986572081e19..155719dab813 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -56,9 +56,11 @@ struct nbd_device {
56 int magic; 56 int magic;
57 57
58 spinlock_t queue_lock; 58 spinlock_t queue_lock;
59 struct list_head queue_head;/* Requests are added here... */ 59 struct list_head queue_head; /* Requests waiting result */
60 struct request *active_req; 60 struct request *active_req;
61 wait_queue_head_t active_wq; 61 wait_queue_head_t active_wq;
62 struct list_head waiting_queue; /* Requests to be sent */
63 wait_queue_head_t waiting_wq;
62 64
63 struct mutex tx_lock; 65 struct mutex tx_lock;
64 struct gendisk *disk; 66 struct gendisk *disk;
@@ -86,11 +88,7 @@ struct nbd_request {
86 char handle[8]; 88 char handle[8];
87 __be64 from; 89 __be64 from;
88 __be32 len; 90 __be32 len;
89} 91} __attribute__ ((packed));
90#ifdef __GNUC__
91 __attribute__ ((packed))
92#endif
93;
94 92
95/* 93/*
96 * This is the reply packet that nbd-server sends back to the client after 94 * This is the reply packet that nbd-server sends back to the client after
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 88766e43e121..9f2d76347f19 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -204,6 +204,7 @@ void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
204/* linux/fs/ncpfs/dir.c */ 204/* linux/fs/ncpfs/dir.c */
205extern const struct inode_operations ncp_dir_inode_operations; 205extern const struct inode_operations ncp_dir_inode_operations;
206extern const struct file_operations ncp_dir_operations; 206extern const struct file_operations ncp_dir_operations;
207extern struct dentry_operations ncp_root_dentry_operations;
207int ncp_conn_logged_in(struct super_block *); 208int ncp_conn_logged_in(struct super_block *);
208int ncp_date_dos2unix(__le16 time, __le16 date); 209int ncp_date_dos2unix(__le16 time, __le16 date);
209void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
@@ -223,6 +224,12 @@ int ncp_disconnect(struct ncp_server *server);
223void ncp_lock_server(struct ncp_server *server); 224void ncp_lock_server(struct ncp_server *server);
224void ncp_unlock_server(struct ncp_server *server); 225void ncp_unlock_server(struct ncp_server *server);
225 226
227/* linux/fs/ncpfs/symlink.c */
228#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
229extern const struct address_space_operations ncp_symlink_aops;
230int ncp_symlink(struct inode*, struct dentry*, const char*);
231#endif
232
226/* linux/fs/ncpfs/file.c */ 233/* linux/fs/ncpfs/file.c */
227extern const struct inode_operations ncp_file_inode_operations; 234extern const struct inode_operations ncp_file_inode_operations;
228extern const struct file_operations ncp_file_operations; 235extern const struct file_operations ncp_file_operations;
diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h
index bdb4c8ae6924..4b0bec477846 100644
--- a/include/linux/ncp_fs_i.h
+++ b/include/linux/ncp_fs_i.h
@@ -8,8 +8,6 @@
8#ifndef _LINUX_NCP_FS_I 8#ifndef _LINUX_NCP_FS_I
9#define _LINUX_NCP_FS_I 9#define _LINUX_NCP_FS_I
10 10
11#ifdef __KERNEL__
12
13/* 11/*
14 * This is the ncpfs part of the inode structure. This must contain 12 * This is the ncpfs part of the inode structure. This must contain
15 * all the information we need to work with an inode after creation. 13 * all the information we need to work with an inode after creation.
@@ -28,6 +26,4 @@ struct ncp_inode_info {
28 struct inode vfs_inode; 26 struct inode vfs_inode;
29}; 27};
30 28
31#endif /* __KERNEL__ */
32
33#endif /* _LINUX_NCP_FS_I */ 29#endif /* _LINUX_NCP_FS_I */
diff --git a/include/linux/net.h b/include/linux/net.h
index c414d90e647b..71f7dd559285 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -19,6 +19,7 @@
19#define _LINUX_NET_H 19#define _LINUX_NET_H
20 20
21#include <linux/wait.h> 21#include <linux/wait.h>
22#include <linux/socket.h>
22#include <asm/socket.h> 23#include <asm/socket.h>
23 24
24struct poll_table_struct; 25struct poll_table_struct;
@@ -26,7 +27,7 @@ struct pipe_inode_info;
26struct inode; 27struct inode;
27struct net; 28struct net;
28 29
29#define NPROTO 34 /* should be enough for now.. */ 30#define NPROTO AF_MAX
30 31
31#define SYS_SOCKET 1 /* sys_socket(2) */ 32#define SYS_SOCKET 1 /* sys_socket(2) */
32#define SYS_BIND 2 /* sys_bind(2) */ 33#define SYS_BIND 2 /* sys_bind(2) */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ee81906b5164..7c1d4466583b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -710,8 +710,10 @@ struct net_device
710 void (*poll_controller)(struct net_device *dev); 710 void (*poll_controller)(struct net_device *dev);
711#endif 711#endif
712 712
713#ifdef CONFIG_NET_NS
713 /* Network namespace this network device is inside */ 714 /* Network namespace this network device is inside */
714 struct net *nd_net; 715 struct net *nd_net;
716#endif
715 717
716 /* bridge stuff */ 718 /* bridge stuff */
717 struct net_bridge_port *br_port; 719 struct net_bridge_port *br_port;
@@ -726,6 +728,10 @@ struct net_device
726 /* rtnetlink link ops */ 728 /* rtnetlink link ops */
727 const struct rtnl_link_ops *rtnl_link_ops; 729 const struct rtnl_link_ops *rtnl_link_ops;
728 730
731 /* for setting kernel sock attribute on TCP connection setup */
732#define GSO_MAX_SIZE 65536
733 unsigned int gso_max_size;
734
729 /* The TX queue control structures */ 735 /* The TX queue control structures */
730 unsigned int egress_subqueue_count; 736 unsigned int egress_subqueue_count;
731 struct net_device_subqueue egress_subqueue[1]; 737 struct net_device_subqueue egress_subqueue[1];
@@ -735,6 +741,28 @@ struct net_device
735#define NETDEV_ALIGN 32 741#define NETDEV_ALIGN 32
736#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) 742#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
737 743
744/*
745 * Net namespace inlines
746 */
747static inline
748struct net *dev_net(const struct net_device *dev)
749{
750#ifdef CONFIG_NET_NS
751 return dev->nd_net;
752#else
753 return &init_net;
754#endif
755}
756
757static inline
758void dev_net_set(struct net_device *dev, struct net *net)
759{
760#ifdef CONFIG_NET_NS
761 release_net(dev->nd_net);
762 dev->nd_net = hold_net(net);
763#endif
764}
765
738/** 766/**
739 * netdev_priv - access network device private data 767 * netdev_priv - access network device private data
740 * @dev: network device 768 * @dev: network device
@@ -811,7 +839,7 @@ static inline struct net_device *next_net_device(struct net_device *dev)
811 struct list_head *lh; 839 struct list_head *lh;
812 struct net *net; 840 struct net *net;
813 841
814 net = dev->nd_net; 842 net = dev_net(dev);
815 lh = dev->dev_list.next; 843 lh = dev->dev_list.next;
816 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 844 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
817} 845}
@@ -1479,6 +1507,12 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1479 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1507 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1480} 1508}
1481 1509
1510static inline void netif_set_gso_max_size(struct net_device *dev,
1511 unsigned int size)
1512{
1513 dev->gso_max_size = size;
1514}
1515
1482/* On bonding slaves other than the currently active slave, suppress 1516/* On bonding slaves other than the currently active slave, suppress
1483 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and 1517 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
1484 * ARP on active-backup slaves with arp_validate enabled. 1518 * ARP on active-backup slaves with arp_validate enabled.
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index f0680c2bee73..e4c66593b5c6 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -6,11 +6,13 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/skbuff.h> 7#include <linux/skbuff.h>
8#include <linux/net.h> 8#include <linux/net.h>
9#include <linux/netdevice.h>
9#include <linux/if.h> 10#include <linux/if.h>
10#include <linux/in.h> 11#include <linux/in.h>
11#include <linux/in6.h> 12#include <linux/in6.h>
12#include <linux/wait.h> 13#include <linux/wait.h>
13#include <linux/list.h> 14#include <linux/list.h>
15#include <net/net_namespace.h>
14#endif 16#endif
15#include <linux/compiler.h> 17#include <linux/compiler.h>
16 18
@@ -61,13 +63,21 @@ union nf_inet_addr {
61#ifdef __KERNEL__ 63#ifdef __KERNEL__
62#ifdef CONFIG_NETFILTER 64#ifdef CONFIG_NETFILTER
63 65
66static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1,
67 const union nf_inet_addr *a2)
68{
69 return a1->all[0] == a2->all[0] &&
70 a1->all[1] == a2->all[1] &&
71 a1->all[2] == a2->all[2] &&
72 a1->all[3] == a2->all[3];
73}
74
64extern void netfilter_init(void); 75extern void netfilter_init(void);
65 76
66/* Largest hook number + 1 */ 77/* Largest hook number + 1 */
67#define NF_MAX_HOOKS 8 78#define NF_MAX_HOOKS 8
68 79
69struct sk_buff; 80struct sk_buff;
70struct net_device;
71 81
72typedef unsigned int nf_hookfn(unsigned int hooknum, 82typedef unsigned int nf_hookfn(unsigned int hooknum,
73 struct sk_buff *skb, 83 struct sk_buff *skb,
@@ -224,6 +234,11 @@ struct nf_afinfo {
224 unsigned short family; 234 unsigned short family;
225 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, 235 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
226 unsigned int dataoff, u_int8_t protocol); 236 unsigned int dataoff, u_int8_t protocol);
237 __sum16 (*checksum_partial)(struct sk_buff *skb,
238 unsigned int hook,
239 unsigned int dataoff,
240 unsigned int len,
241 u_int8_t protocol);
227 int (*route)(struct dst_entry **dst, struct flowi *fl); 242 int (*route)(struct dst_entry **dst, struct flowi *fl);
228 void (*saveroute)(const struct sk_buff *skb, 243 void (*saveroute)(const struct sk_buff *skb,
229 struct nf_queue_entry *entry); 244 struct nf_queue_entry *entry);
@@ -253,6 +268,23 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
253 return csum; 268 return csum;
254} 269}
255 270
271static inline __sum16
272nf_checksum_partial(struct sk_buff *skb, unsigned int hook,
273 unsigned int dataoff, unsigned int len,
274 u_int8_t protocol, unsigned short family)
275{
276 const struct nf_afinfo *afinfo;
277 __sum16 csum = 0;
278
279 rcu_read_lock();
280 afinfo = nf_get_afinfo(family);
281 if (afinfo)
282 csum = afinfo->checksum_partial(skb, hook, dataoff, len,
283 protocol);
284 rcu_read_unlock();
285 return csum;
286}
287
256extern int nf_register_afinfo(const struct nf_afinfo *afinfo); 288extern int nf_register_afinfo(const struct nf_afinfo *afinfo);
257extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); 289extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
258 290
@@ -311,5 +343,56 @@ extern void (*nf_ct_destroy)(struct nf_conntrack *);
311static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 343static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
312#endif 344#endif
313 345
346static inline struct net *nf_pre_routing_net(const struct net_device *in,
347 const struct net_device *out)
348{
349#ifdef CONFIG_NET_NS
350 return in->nd_net;
351#else
352 return &init_net;
353#endif
354}
355
356static inline struct net *nf_local_in_net(const struct net_device *in,
357 const struct net_device *out)
358{
359#ifdef CONFIG_NET_NS
360 return in->nd_net;
361#else
362 return &init_net;
363#endif
364}
365
366static inline struct net *nf_forward_net(const struct net_device *in,
367 const struct net_device *out)
368{
369#ifdef CONFIG_NET_NS
370 BUG_ON(in->nd_net != out->nd_net);
371 return in->nd_net;
372#else
373 return &init_net;
374#endif
375}
376
377static inline struct net *nf_local_out_net(const struct net_device *in,
378 const struct net_device *out)
379{
380#ifdef CONFIG_NET_NS
381 return out->nd_net;
382#else
383 return &init_net;
384#endif
385}
386
387static inline struct net *nf_post_routing_net(const struct net_device *in,
388 const struct net_device *out)
389{
390#ifdef CONFIG_NET_NS
391 return out->nd_net;
392#else
393 return &init_net;
394#endif
395}
396
314#endif /*__KERNEL__*/ 397#endif /*__KERNEL__*/
315#endif /*__LINUX_NETFILTER_H*/ 398#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter/nf_conntrack_dccp.h b/include/linux/netfilter/nf_conntrack_dccp.h
new file mode 100644
index 000000000000..40dcc82058d1
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_dccp.h
@@ -0,0 +1,40 @@
1#ifndef _NF_CONNTRACK_DCCP_H
2#define _NF_CONNTRACK_DCCP_H
3
4/* Exposed to userspace over nfnetlink */
5enum ct_dccp_states {
6 CT_DCCP_NONE,
7 CT_DCCP_REQUEST,
8 CT_DCCP_RESPOND,
9 CT_DCCP_PARTOPEN,
10 CT_DCCP_OPEN,
11 CT_DCCP_CLOSEREQ,
12 CT_DCCP_CLOSING,
13 CT_DCCP_TIMEWAIT,
14 CT_DCCP_IGNORE,
15 CT_DCCP_INVALID,
16 __CT_DCCP_MAX
17};
18#define CT_DCCP_MAX (__CT_DCCP_MAX - 1)
19
20enum ct_dccp_roles {
21 CT_DCCP_ROLE_CLIENT,
22 CT_DCCP_ROLE_SERVER,
23 __CT_DCCP_ROLE_MAX
24};
25#define CT_DCCP_ROLE_MAX (__CT_DCCP_ROLE_MAX - 1)
26
27#ifdef __KERNEL__
28#include <net/netfilter/nf_conntrack_tuple.h>
29
30struct nf_ct_dccp {
31 u_int8_t role[IP_CT_DIR_MAX];
32 u_int8_t state;
33 u_int8_t last_pkt;
34 u_int8_t last_dir;
35 u_int64_t handshake_seq;
36};
37
38#endif /* __KERNEL__ */
39
40#endif /* _NF_CONNTRACK_DCCP_H */
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 8e5ce1ca7bfc..5da04e586a3f 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -5,37 +5,164 @@
5#define SIP_PORT 5060 5#define SIP_PORT 5060
6#define SIP_TIMEOUT 3600 6#define SIP_TIMEOUT 3600
7 7
8enum sip_header_pos { 8struct nf_ct_sip_master {
9 POS_REG_REQ_URI, 9 unsigned int register_cseq;
10 POS_REQ_URI, 10};
11 POS_FROM, 11
12 POS_TO, 12enum sip_expectation_classes {
13 POS_VIA, 13 SIP_EXPECT_SIGNALLING,
14 POS_CONTACT, 14 SIP_EXPECT_AUDIO,
15 POS_CONTENT, 15 SIP_EXPECT_VIDEO,
16 POS_MEDIA, 16 __SIP_EXPECT_MAX
17 POS_OWNER_IP4, 17};
18 POS_CONNECTION_IP4, 18#define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1)
19 POS_OWNER_IP6, 19
20 POS_CONNECTION_IP6, 20struct sdp_media_type {
21 POS_SDP_HEADER, 21 const char *name;
22 unsigned int len;
23 enum sip_expectation_classes class;
24};
25
26#define SDP_MEDIA_TYPE(__name, __class) \
27{ \
28 .name = (__name), \
29 .len = sizeof(__name) - 1, \
30 .class = (__class), \
31}
32
33struct sip_handler {
34 const char *method;
35 unsigned int len;
36 int (*request)(struct sk_buff *skb,
37 const char **dptr, unsigned int *datalen,
38 unsigned int cseq);
39 int (*response)(struct sk_buff *skb,
40 const char **dptr, unsigned int *datalen,
41 unsigned int cseq, unsigned int code);
42};
43
44#define SIP_HANDLER(__method, __request, __response) \
45{ \
46 .method = (__method), \
47 .len = sizeof(__method) - 1, \
48 .request = (__request), \
49 .response = (__response), \
50}
51
52struct sip_header {
53 const char *name;
54 const char *cname;
55 const char *search;
56 unsigned int len;
57 unsigned int clen;
58 unsigned int slen;
59 int (*match_len)(const struct nf_conn *ct,
60 const char *dptr, const char *limit,
61 int *shift);
62};
63
64#define __SIP_HDR(__name, __cname, __search, __match) \
65{ \
66 .name = (__name), \
67 .len = sizeof(__name) - 1, \
68 .cname = (__cname), \
69 .clen = (__cname) ? sizeof(__cname) - 1 : 0, \
70 .search = (__search), \
71 .slen = (__search) ? sizeof(__search) - 1 : 0, \
72 .match_len = (__match), \
73}
74
75#define SIP_HDR(__name, __cname, __search, __match) \
76 __SIP_HDR(__name, __cname, __search, __match)
77
78#define SDP_HDR(__name, __search, __match) \
79 __SIP_HDR(__name, NULL, __search, __match)
80
81enum sip_header_types {
82 SIP_HDR_CSEQ,
83 SIP_HDR_FROM,
84 SIP_HDR_TO,
85 SIP_HDR_CONTACT,
86 SIP_HDR_VIA,
87 SIP_HDR_EXPIRES,
88 SIP_HDR_CONTENT_LENGTH,
89};
90
91enum sdp_header_types {
92 SDP_HDR_UNSPEC,
93 SDP_HDR_VERSION,
94 SDP_HDR_OWNER_IP4,
95 SDP_HDR_CONNECTION_IP4,
96 SDP_HDR_OWNER_IP6,
97 SDP_HDR_CONNECTION_IP6,
98 SDP_HDR_MEDIA,
22}; 99};
23 100
24extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, 101extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb,
25 enum ip_conntrack_info ctinfo, 102 const char **dptr,
26 struct nf_conn *ct, 103 unsigned int *datalen);
27 const char **dptr); 104extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb,
28extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, 105 const char **dptr,
29 enum ip_conntrack_info ctinfo, 106 unsigned int *datalen,
30 struct nf_conntrack_expect *exp, 107 struct nf_conntrack_expect *exp,
31 const char *dptr); 108 unsigned int matchoff,
32 109 unsigned int matchlen);
33extern int ct_sip_get_info(const struct nf_conn *ct, const char *dptr, 110extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb,
34 size_t dlen, unsigned int *matchoff, 111 const char **dptr,
35 unsigned int *matchlen, enum sip_header_pos pos); 112 unsigned int dataoff,
36extern int ct_sip_lnlen(const char *line, const char *limit); 113 unsigned int *datalen,
37extern const char *ct_sip_search(const char *needle, const char *haystack, 114 enum sdp_header_types type,
38 size_t needle_len, size_t haystack_len, 115 enum sdp_header_types term,
39 int case_sensitive); 116 const union nf_inet_addr *addr);
117extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb,
118 const char **dptr,
119 unsigned int *datalen,
120 unsigned int matchoff,
121 unsigned int matchlen,
122 u_int16_t port);
123extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb,
124 const char **dptr,
125 unsigned int dataoff,
126 unsigned int *datalen,
127 const union nf_inet_addr *addr);
128extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb,
129 const char **dptr,
130 unsigned int *datalen,
131 struct nf_conntrack_expect *rtp_exp,
132 struct nf_conntrack_expect *rtcp_exp,
133 unsigned int mediaoff,
134 unsigned int medialen,
135 union nf_inet_addr *rtp_addr);
136
137extern int ct_sip_parse_request(const struct nf_conn *ct,
138 const char *dptr, unsigned int datalen,
139 unsigned int *matchoff, unsigned int *matchlen,
140 union nf_inet_addr *addr, __be16 *port);
141extern int ct_sip_get_header(const struct nf_conn *ct, const char *dptr,
142 unsigned int dataoff, unsigned int datalen,
143 enum sip_header_types type,
144 unsigned int *matchoff, unsigned int *matchlen);
145extern int ct_sip_parse_header_uri(const struct nf_conn *ct, const char *dptr,
146 unsigned int *dataoff, unsigned int datalen,
147 enum sip_header_types type, int *in_header,
148 unsigned int *matchoff, unsigned int *matchlen,
149 union nf_inet_addr *addr, __be16 *port);
150extern int ct_sip_parse_address_param(const struct nf_conn *ct, const char *dptr,
151 unsigned int dataoff, unsigned int datalen,
152 const char *name,
153 unsigned int *matchoff, unsigned int *matchlen,
154 union nf_inet_addr *addr);
155extern int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr,
156 unsigned int off, unsigned int datalen,
157 const char *name,
158 unsigned int *matchoff, unsigned int *matchen,
159 unsigned int *val);
160
161extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr,
162 unsigned int dataoff, unsigned int datalen,
163 enum sdp_header_types type,
164 enum sdp_header_types term,
165 unsigned int *matchoff, unsigned int *matchlen);
166
40#endif /* __KERNEL__ */ 167#endif /* __KERNEL__ */
41#endif /* __NF_CONNTRACK_SIP_H__ */ 168#endif /* __NF_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index e3e1533aba2d..0a383ac083cb 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -80,6 +80,7 @@ enum ctattr_l4proto {
80enum ctattr_protoinfo { 80enum ctattr_protoinfo {
81 CTA_PROTOINFO_UNSPEC, 81 CTA_PROTOINFO_UNSPEC,
82 CTA_PROTOINFO_TCP, 82 CTA_PROTOINFO_TCP,
83 CTA_PROTOINFO_DCCP,
83 __CTA_PROTOINFO_MAX 84 __CTA_PROTOINFO_MAX
84}; 85};
85#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) 86#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1)
@@ -95,6 +96,13 @@ enum ctattr_protoinfo_tcp {
95}; 96};
96#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) 97#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
97 98
99enum ctattr_protoinfo_dccp {
100 CTA_PROTOINFO_DCCP_UNSPEC,
101 CTA_PROTOINFO_DCCP_STATE,
102 __CTA_PROTOINFO_DCCP_MAX,
103};
104#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
105
98enum ctattr_counters { 106enum ctattr_counters {
99 CTA_COUNTERS_UNSPEC, 107 CTA_COUNTERS_UNSPEC,
100 CTA_COUNTERS_PACKETS, /* old 64bit counters */ 108 CTA_COUNTERS_PACKETS, /* old 64bit counters */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index b2c62cc618f5..2326296b6f25 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -430,13 +430,13 @@ extern int xt_compat_add_offset(int af, unsigned int offset, short delta);
430extern void xt_compat_flush_offsets(int af); 430extern void xt_compat_flush_offsets(int af);
431extern short xt_compat_calc_jump(int af, unsigned int offset); 431extern short xt_compat_calc_jump(int af, unsigned int offset);
432 432
433extern int xt_compat_match_offset(struct xt_match *match); 433extern int xt_compat_match_offset(const struct xt_match *match);
434extern int xt_compat_match_from_user(struct xt_entry_match *m, 434extern int xt_compat_match_from_user(struct xt_entry_match *m,
435 void **dstptr, unsigned int *size); 435 void **dstptr, unsigned int *size);
436extern int xt_compat_match_to_user(struct xt_entry_match *m, 436extern int xt_compat_match_to_user(struct xt_entry_match *m,
437 void __user **dstptr, unsigned int *size); 437 void __user **dstptr, unsigned int *size);
438 438
439extern int xt_compat_target_offset(struct xt_target *target); 439extern int xt_compat_target_offset(const struct xt_target *target);
440extern void xt_compat_target_from_user(struct xt_entry_target *t, 440extern void xt_compat_target_from_user(struct xt_entry_target *t,
441 void **dstptr, unsigned int *size); 441 void **dstptr, unsigned int *size);
442extern int xt_compat_target_to_user(struct xt_entry_target *t, 442extern int xt_compat_target_to_user(struct xt_entry_target *t,
diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h
index dd5a4fd4cfd3..32000ba6ecef 100644
--- a/include/linux/netfilter/xt_sctp.h
+++ b/include/linux/netfilter/xt_sctp.h
@@ -37,68 +37,54 @@ struct xt_sctp_info {
37 37
38#define SCTP_CHUNKMAP_SET(chunkmap, type) \ 38#define SCTP_CHUNKMAP_SET(chunkmap, type) \
39 do { \ 39 do { \
40 chunkmap[type / bytes(u_int32_t)] |= \ 40 (chunkmap)[type / bytes(u_int32_t)] |= \
41 1 << (type % bytes(u_int32_t)); \ 41 1 << (type % bytes(u_int32_t)); \
42 } while (0) 42 } while (0)
43 43
44#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ 44#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
45 do { \ 45 do { \
46 chunkmap[type / bytes(u_int32_t)] &= \ 46 (chunkmap)[type / bytes(u_int32_t)] &= \
47 ~(1 << (type % bytes(u_int32_t))); \ 47 ~(1 << (type % bytes(u_int32_t))); \
48 } while (0) 48 } while (0)
49 49
50#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ 50#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
51({ \ 51({ \
52 (chunkmap[type / bytes (u_int32_t)] & \ 52 ((chunkmap)[type / bytes (u_int32_t)] & \
53 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \ 53 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \
54}) 54})
55 55
56#define SCTP_CHUNKMAP_RESET(chunkmap) \ 56#define SCTP_CHUNKMAP_RESET(chunkmap) \
57 do { \ 57 memset((chunkmap), 0, sizeof(chunkmap))
58 int i; \ 58
59 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \ 59#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
60 chunkmap[i] = 0; \ 60 memset((chunkmap), ~0U, sizeof(chunkmap))
61 } while (0) 61
62 62#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
63#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ 63 memcpy((destmap), (srcmap), sizeof(srcmap))
64 do { \ 64
65 int i; \ 65#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
66 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \ 66 __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
67 chunkmap[i] = ~0; \ 67static inline bool
68 } while (0) 68__sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned int n)
69 69{
70#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ 70 unsigned int i;
71 do { \ 71 for (i = 0; i < n; ++i)
72 int i; \ 72 if (chunkmap[i])
73 for (i = 0; i < ARRAY_SIZE(srcmap); i++) \ 73 return false;
74 destmap[i] = srcmap[i]; \ 74 return true;
75 } while (0) 75}
76 76
77#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ 77#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
78({ \ 78 __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
79 int i; \ 79static inline bool
80 int flag = 1; \ 80__sctp_chunkmap_is_all_set(const u_int32_t *chunkmap, unsigned int n)
81 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \ 81{
82 if (chunkmap[i]) { \ 82 unsigned int i;
83 flag = 0; \ 83 for (i = 0; i < n; ++i)
84 break; \ 84 if (chunkmap[i] != ~0U)
85 } \ 85 return false;
86 } \ 86 return true;
87 flag; \ 87}
88})
89
90#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
91({ \
92 int i; \
93 int flag = 1; \
94 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
95 if (chunkmap[i] != ~0) { \
96 flag = 0; \
97 break; \
98 } \
99 } \
100 flag; \
101})
102 88
103#endif /* _XT_SCTP_H_ */ 89#endif /* _XT_SCTP_H_ */
104 90
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index db223ca92c8b..dd9c97f2d436 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -23,8 +23,6 @@
23 23
24#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN 24#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
25#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN 25#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
26#define arpt_target xt_target
27#define arpt_table xt_table
28 26
29#define ARPT_DEV_ADDR_LEN_MAX 16 27#define ARPT_DEV_ADDR_LEN_MAX 16
30 28
@@ -266,20 +264,15 @@ struct arpt_error
266 .target.errorname = "ERROR", \ 264 .target.errorname = "ERROR", \
267} 265}
268 266
269#define arpt_register_target(tgt) \ 267extern struct xt_table *arpt_register_table(struct net *net,
270({ (tgt)->family = NF_ARP; \ 268 struct xt_table *table,
271 xt_register_target(tgt); }) 269 const struct arpt_replace *repl);
272#define arpt_unregister_target(tgt) xt_unregister_target(tgt) 270extern void arpt_unregister_table(struct xt_table *table);
273
274extern struct arpt_table *arpt_register_table(struct net *net,
275 struct arpt_table *table,
276 const struct arpt_replace *repl);
277extern void arpt_unregister_table(struct arpt_table *table);
278extern unsigned int arpt_do_table(struct sk_buff *skb, 271extern unsigned int arpt_do_table(struct sk_buff *skb,
279 unsigned int hook, 272 unsigned int hook,
280 const struct net_device *in, 273 const struct net_device *in,
281 const struct net_device *out, 274 const struct net_device *out,
282 struct arpt_table *table); 275 struct xt_table *table);
283 276
284#define ARPT_ALIGN(s) XT_ALIGN(s) 277#define ARPT_ALIGN(s) XT_ALIGN(s)
285 278
diff --git a/include/linux/netfilter_bridge/ebt_nflog.h b/include/linux/netfilter_bridge/ebt_nflog.h
new file mode 100644
index 000000000000..052817849b83
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_nflog.h
@@ -0,0 +1,21 @@
1#ifndef __LINUX_BRIDGE_EBT_NFLOG_H
2#define __LINUX_BRIDGE_EBT_NFLOG_H
3
4#define EBT_NFLOG_MASK 0x0
5
6#define EBT_NFLOG_PREFIX_SIZE 64
7#define EBT_NFLOG_WATCHER "nflog"
8
9#define EBT_NFLOG_DEFAULT_GROUP 0x1
10#define EBT_NFLOG_DEFAULT_THRESHOLD 1
11
12struct ebt_nflog_info {
13 u_int32_t len;
14 u_int16_t group;
15 u_int16_t threshold;
16 u_int16_t flags;
17 u_int16_t pad;
18 char prefix[EBT_NFLOG_PREFIX_SIZE];
19};
20
21#endif /* __LINUX_BRIDGE_EBT_NFLOG_H */
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 9a10092e358c..650318b0c405 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -62,8 +62,6 @@ enum nf_ip_hook_priorities {
62 NF_IP_PRI_FILTER = 0, 62 NF_IP_PRI_FILTER = 0,
63 NF_IP_PRI_NAT_SRC = 100, 63 NF_IP_PRI_NAT_SRC = 100,
64 NF_IP_PRI_SELINUX_LAST = 225, 64 NF_IP_PRI_SELINUX_LAST = 225,
65 NF_IP_PRI_CONNTRACK_HELPER = INT_MAX - 2,
66 NF_IP_PRI_NAT_SEQ_ADJUST = INT_MAX - 1,
67 NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, 65 NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX,
68 NF_IP_PRI_LAST = INT_MAX, 66 NF_IP_PRI_LAST = INT_MAX,
69}; 67};
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index fb0713b6ffaf..bec1062a25a1 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -166,6 +166,7 @@ struct netlink_skb_parms
166 __u32 dst_group; 166 __u32 dst_group;
167 kernel_cap_t eff_cap; 167 kernel_cap_t eff_cap;
168 __u32 loginuid; /* Login (audit) uid */ 168 __u32 loginuid; /* Login (audit) uid */
169 __u32 sessionid; /* Session id (audit) */
169 __u32 sid; /* SELinux security id */ 170 __u32 sid; /* SELinux security id */
170}; 171};
171 172
diff --git a/include/linux/nfs3.h b/include/linux/nfs3.h
index 7f11fa589207..539f3b550eab 100644
--- a/include/linux/nfs3.h
+++ b/include/linux/nfs3.h
@@ -96,7 +96,7 @@ struct nfs3_fh {
96#define MOUNTPROC3_UMNTALL 4 96#define MOUNTPROC3_UMNTALL 4
97 97
98 98
99#if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES) 99#if defined(__KERNEL__)
100 100
101/* Number of 32bit words in post_op_attr */ 101/* Number of 32bit words in post_op_attr */
102#define NFS3_POST_OP_ATTR_WORDS 22 102#define NFS3_POST_OP_ATTR_WORDS 22
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index f4a0e4c218df..27d6a8d98cef 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -430,7 +430,6 @@ extern void nfs_unregister_sysctl(void);
430/* 430/*
431 * linux/fs/nfs/namespace.c 431 * linux/fs/nfs/namespace.c
432 */ 432 */
433extern struct list_head nfs_automount_list;
434extern const struct inode_operations nfs_mountpoint_inode_operations; 433extern const struct inode_operations nfs_mountpoint_inode_operations;
435extern const struct inode_operations nfs_referral_inode_operations; 434extern const struct inode_operations nfs_referral_inode_operations;
436extern int nfs_mountpoint_expiry_timeout; 435extern int nfs_mountpoint_expiry_timeout;
@@ -466,9 +465,9 @@ extern int nfs_wb_page(struct inode *inode, struct page* page);
466extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 465extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
467#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 466#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
468extern int nfs_commit_inode(struct inode *, int); 467extern int nfs_commit_inode(struct inode *, int);
469extern struct nfs_write_data *nfs_commit_alloc(void); 468extern struct nfs_write_data *nfs_commitdata_alloc(void);
470extern void nfs_commit_free(struct nfs_write_data *wdata); 469extern void nfs_commit_free(struct nfs_write_data *wdata);
471extern void nfs_commit_release(void *wdata); 470extern void nfs_commitdata_release(void *wdata);
472#else 471#else
473static inline int 472static inline int
474nfs_commit_inode(struct inode *inode, int how) 473nfs_commit_inode(struct inode *inode, int how)
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 3423c6761bf7..c9beacd16c00 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -32,6 +32,8 @@ struct nfs_client {
32 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */ 32 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */
33 int cl_proto; /* Network transport protocol */ 33 int cl_proto; /* Network transport protocol */
34 34
35 struct rpc_cred *cl_machine_cred;
36
35#ifdef CONFIG_NFS_V4 37#ifdef CONFIG_NFS_V4
36 u64 cl_clientid; /* constant */ 38 u64 cl_clientid; /* constant */
37 nfs4_verifier cl_confirm; 39 nfs4_verifier cl_confirm;
@@ -93,6 +95,7 @@ struct nfs_server {
93 unsigned int wpages; /* write size (in pages) */ 95 unsigned int wpages; /* write size (in pages) */
94 unsigned int wtmult; /* server disk block size */ 96 unsigned int wtmult; /* server disk block size */
95 unsigned int dtsize; /* readdir size */ 97 unsigned int dtsize; /* readdir size */
98 unsigned short port; /* "port=" setting */
96 unsigned int bsize; /* server block size */ 99 unsigned int bsize; /* server block size */
97 unsigned int acregmin; /* attr cache timeouts */ 100 unsigned int acregmin; /* attr cache timeouts */
98 unsigned int acregmax; 101 unsigned int acregmax;
@@ -117,6 +120,13 @@ struct nfs_server {
117 120
118 atomic_t active; /* Keep trace of any activity to this server */ 121 atomic_t active; /* Keep trace of any activity to this server */
119 wait_queue_head_t active_wq; /* Wait for any activity to stop */ 122 wait_queue_head_t active_wq; /* Wait for any activity to stop */
123
124 /* mountd-related mount options */
125 struct sockaddr_storage mountd_address;
126 size_t mountd_addrlen;
127 u32 mountd_version;
128 unsigned short mountd_port;
129 unsigned short mountd_protocol;
120}; 130};
121 131
122/* Server capabilities */ 132/* Server capabilities */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index f301d0b8babc..24263bb8e0be 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -140,6 +140,7 @@ struct nfs_openres {
140 __u32 rflags; 140 __u32 rflags;
141 struct nfs_fattr * f_attr; 141 struct nfs_fattr * f_attr;
142 struct nfs_fattr * dir_attr; 142 struct nfs_fattr * dir_attr;
143 struct nfs_seqid * seqid;
143 const struct nfs_server *server; 144 const struct nfs_server *server;
144 int delegation_type; 145 int delegation_type;
145 nfs4_stateid delegation; 146 nfs4_stateid delegation;
@@ -159,6 +160,7 @@ struct nfs_open_confirmargs {
159 160
160struct nfs_open_confirmres { 161struct nfs_open_confirmres {
161 nfs4_stateid stateid; 162 nfs4_stateid stateid;
163 struct nfs_seqid * seqid;
162}; 164};
163 165
164/* 166/*
@@ -175,6 +177,7 @@ struct nfs_closeargs {
175struct nfs_closeres { 177struct nfs_closeres {
176 nfs4_stateid stateid; 178 nfs4_stateid stateid;
177 struct nfs_fattr * fattr; 179 struct nfs_fattr * fattr;
180 struct nfs_seqid * seqid;
178 const struct nfs_server *server; 181 const struct nfs_server *server;
179}; 182};
180/* 183/*
@@ -199,7 +202,9 @@ struct nfs_lock_args {
199}; 202};
200 203
201struct nfs_lock_res { 204struct nfs_lock_res {
202 nfs4_stateid stateid; 205 nfs4_stateid stateid;
206 struct nfs_seqid * lock_seqid;
207 struct nfs_seqid * open_seqid;
203}; 208};
204 209
205struct nfs_locku_args { 210struct nfs_locku_args {
@@ -210,7 +215,8 @@ struct nfs_locku_args {
210}; 215};
211 216
212struct nfs_locku_res { 217struct nfs_locku_res {
213 nfs4_stateid stateid; 218 nfs4_stateid stateid;
219 struct nfs_seqid * seqid;
214}; 220};
215 221
216struct nfs_lockt_args { 222struct nfs_lockt_args {
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
index e726fc3a4375..fc972048e572 100644
--- a/include/linux/nfsd/Kbuild
+++ b/include/linux/nfsd/Kbuild
@@ -1,6 +1,6 @@
1unifdef-y += const.h 1unifdef-y += const.h
2unifdef-y += debug.h
2unifdef-y += export.h 3unifdef-y += export.h
4unifdef-y += nfsfh.h
3unifdef-y += stats.h 5unifdef-y += stats.h
4unifdef-y += syscall.h 6unifdef-y += syscall.h
5unifdef-y += nfsfh.h
6unifdef-y += debug.h
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
index 7b5d784cc858..04b355c801d8 100644
--- a/include/linux/nfsd/cache.h
+++ b/include/linux/nfsd/cache.h
@@ -10,7 +10,6 @@
10#ifndef NFSCACHE_H 10#ifndef NFSCACHE_H
11#define NFSCACHE_H 11#define NFSCACHE_H
12 12
13#ifdef __KERNEL__
14#include <linux/in.h> 13#include <linux/in.h>
15#include <linux/uio.h> 14#include <linux/uio.h>
16 15
@@ -77,5 +76,4 @@ void nfsd_reply_cache_shutdown(void);
77int nfsd_cache_lookup(struct svc_rqst *, int); 76int nfsd_cache_lookup(struct svc_rqst *, int);
78void nfsd_cache_update(struct svc_rqst *, int, __be32 *); 77void nfsd_cache_update(struct svc_rqst *, int, __be32 *);
79 78
80#endif /* __KERNEL__ */
81#endif /* NFSCACHE_H */ 79#endif /* NFSCACHE_H */
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 8caf4c4f64e6..41d30c9c9de6 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -27,7 +27,6 @@
27#define NFSD_VERSION "0.5" 27#define NFSD_VERSION "0.5"
28#define NFSD_SUPPORTED_MINOR_VERSION 0 28#define NFSD_SUPPORTED_MINOR_VERSION 0
29 29
30#ifdef __KERNEL__
31/* 30/*
32 * Special flags for nfsd_permission. These must be different from MAY_READ, 31 * Special flags for nfsd_permission. These must be different from MAY_READ,
33 * MAY_WRITE, and MAY_EXEC. 32 * MAY_WRITE, and MAY_EXEC.
@@ -56,12 +55,20 @@ extern struct svc_program nfsd_program;
56extern struct svc_version nfsd_version2, nfsd_version3, 55extern struct svc_version nfsd_version2, nfsd_version3,
57 nfsd_version4; 56 nfsd_version4;
58extern struct svc_serv *nfsd_serv; 57extern struct svc_serv *nfsd_serv;
58
59extern struct seq_operations nfs_exports_op;
60
59/* 61/*
60 * Function prototypes. 62 * Function prototypes.
61 */ 63 */
62int nfsd_svc(unsigned short port, int nrservs); 64int nfsd_svc(unsigned short port, int nrservs);
63int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp); 65int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp);
64 66
67int nfsd_nrthreads(void);
68int nfsd_nrpools(void);
69int nfsd_get_nrthreads(int n, int *);
70int nfsd_set_nrthreads(int n, int *);
71
65/* nfsd/vfs.c */ 72/* nfsd/vfs.c */
66int fh_lock_parent(struct svc_fh *, struct dentry *); 73int fh_lock_parent(struct svc_fh *, struct dentry *);
67int nfsd_racache_init(int); 74int nfsd_racache_init(int);
@@ -322,10 +329,8 @@ extern struct timeval nfssvc_boot;
322(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL ) 329(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL )
323#define NFSD_WRITEABLE_ATTRS_WORD1 \ 330#define NFSD_WRITEABLE_ATTRS_WORD1 \
324(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ 331(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \
325 | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_METADATA | FATTR4_WORD1_TIME_MODIFY_SET) 332 | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
326 333
327#endif /* CONFIG_NFSD_V4 */ 334#endif /* CONFIG_NFSD_V4 */
328 335
329#endif /* __KERNEL__ */
330
331#endif /* LINUX_NFSD_NFSD_H */ 336#endif /* LINUX_NFSD_NFSD_H */
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 9fecf902419c..ea6517e58b04 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -78,6 +78,18 @@
78 * or, if no MAC address given, all stations, on the interface identified 78 * or, if no MAC address given, all stations, on the interface identified
79 * by %NL80211_ATTR_IFINDEX. 79 * by %NL80211_ATTR_IFINDEX.
80 * 80 *
81 * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to
82 * destination %NL80211_ATTR_MAC on the interface identified by
83 * %NL80211_ATTR_IFINDEX.
84 * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to
85 * destination %NL80211_ATTR_MAC on the interface identified by
86 * %NL80211_ATTR_IFINDEX.
87 * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the
88 * the interface identified by %NL80211_ATTR_IFINDEX.
89 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC
90 * or, if no MAC address given, all mesh paths, on the interface identified
91 * by %NL80211_ATTR_IFINDEX.
92 *
81 * @NL80211_CMD_MAX: highest used command number 93 * @NL80211_CMD_MAX: highest used command number
82 * @__NL80211_CMD_AFTER_LAST: internal use 94 * @__NL80211_CMD_AFTER_LAST: internal use
83 */ 95 */
@@ -112,6 +124,11 @@ enum nl80211_commands {
112 124
113 /* add commands here */ 125 /* add commands here */
114 126
127 NL80211_CMD_GET_MPATH,
128 NL80211_CMD_SET_MPATH,
129 NL80211_CMD_NEW_MPATH,
130 NL80211_CMD_DEL_MPATH,
131
115 /* used to define NL80211_CMD_MAX below */ 132 /* used to define NL80211_CMD_MAX below */
116 __NL80211_CMD_AFTER_LAST, 133 __NL80211_CMD_AFTER_LAST,
117 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 134 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
@@ -157,9 +174,23 @@ enum nl80211_commands {
157 * restriction (at most %NL80211_MAX_SUPP_RATES). 174 * restriction (at most %NL80211_MAX_SUPP_RATES).
158 * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station 175 * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station
159 * to, or the AP interface the station was originally added to to. 176 * to, or the AP interface the station was originally added to to.
160 * @NL80211_ATTR_STA_STATS: statistics for a station, part of station info 177 * @NL80211_ATTR_STA_INFO: information about a station, part of station info
161 * given for %NL80211_CMD_GET_STATION, nested attribute containing 178 * given for %NL80211_CMD_GET_STATION, nested attribute containing
162 * info as possible, see &enum nl80211_sta_stats. 179 * info as possible, see &enum nl80211_sta_info.
180 *
181 * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands,
182 * consisting of a nested array.
183 *
184 * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes).
185 * @NL80211_ATTR_PLINK_ACTION: action to perform on the mesh peer link.
186 * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path.
187 * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path
188 * info given for %NL80211_CMD_GET_MPATH, nested attribute described at
189 * &enum nl80211_mpath_info.
190 *
191 *
192 * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of
193 * &enum nl80211_mntr_flags.
163 * 194 *
164 * @NL80211_ATTR_MAX: highest attribute number currently defined 195 * @NL80211_ATTR_MAX: highest attribute number currently defined
165 * @__NL80211_ATTR_AFTER_LAST: internal use 196 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -193,10 +224,19 @@ enum nl80211_attrs {
193 NL80211_ATTR_STA_LISTEN_INTERVAL, 224 NL80211_ATTR_STA_LISTEN_INTERVAL,
194 NL80211_ATTR_STA_SUPPORTED_RATES, 225 NL80211_ATTR_STA_SUPPORTED_RATES,
195 NL80211_ATTR_STA_VLAN, 226 NL80211_ATTR_STA_VLAN,
196 NL80211_ATTR_STA_STATS, 227 NL80211_ATTR_STA_INFO,
228
229 NL80211_ATTR_WIPHY_BANDS,
230
231 NL80211_ATTR_MNTR_FLAGS,
197 232
198 /* add attributes here, update the policy in nl80211.c */ 233 /* add attributes here, update the policy in nl80211.c */
199 234
235 NL80211_ATTR_MESH_ID,
236 NL80211_ATTR_STA_PLINK_ACTION,
237 NL80211_ATTR_MPATH_NEXT_HOP,
238 NL80211_ATTR_MPATH_INFO,
239
200 __NL80211_ATTR_AFTER_LAST, 240 __NL80211_ATTR_AFTER_LAST,
201 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 241 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
202}; 242};
@@ -213,6 +253,7 @@ enum nl80211_attrs {
213 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points 253 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
214 * @NL80211_IFTYPE_WDS: wireless distribution interface 254 * @NL80211_IFTYPE_WDS: wireless distribution interface
215 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames 255 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
256 * @NL80211_IFTYPE_MESH_POINT: mesh point
216 * @NL80211_IFTYPE_MAX: highest interface type number currently defined 257 * @NL80211_IFTYPE_MAX: highest interface type number currently defined
217 * @__NL80211_IFTYPE_AFTER_LAST: internal use 258 * @__NL80211_IFTYPE_AFTER_LAST: internal use
218 * 259 *
@@ -228,6 +269,7 @@ enum nl80211_iftype {
228 NL80211_IFTYPE_AP_VLAN, 269 NL80211_IFTYPE_AP_VLAN,
229 NL80211_IFTYPE_WDS, 270 NL80211_IFTYPE_WDS,
230 NL80211_IFTYPE_MONITOR, 271 NL80211_IFTYPE_MONITOR,
272 NL80211_IFTYPE_MESH_POINT,
231 273
232 /* keep last */ 274 /* keep last */
233 __NL80211_IFTYPE_AFTER_LAST, 275 __NL80211_IFTYPE_AFTER_LAST,
@@ -257,27 +299,167 @@ enum nl80211_sta_flags {
257}; 299};
258 300
259/** 301/**
260 * enum nl80211_sta_stats - station statistics 302 * enum nl80211_sta_info - station information
261 * 303 *
262 * These attribute types are used with %NL80211_ATTR_STA_STATS 304 * These attribute types are used with %NL80211_ATTR_STA_INFO
263 * when getting information about a station. 305 * when getting information about a station.
264 * 306 *
265 * @__NL80211_STA_STAT_INVALID: attribute number 0 is reserved 307 * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved
266 * @NL80211_STA_STAT_INACTIVE_TIME: time since last activity (u32, msecs) 308 * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs)
267 * @NL80211_STA_STAT_RX_BYTES: total received bytes (u32, from this station) 309 * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station)
268 * @NL80211_STA_STAT_TX_BYTES: total transmitted bytes (u32, to this station) 310 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
269 * @__NL80211_STA_STAT_AFTER_LAST: internal 311 * @__NL80211_STA_INFO_AFTER_LAST: internal
270 * @NL80211_STA_STAT_MAX: highest possible station stats attribute 312 * @NL80211_STA_INFO_MAX: highest possible station info attribute
313 */
314enum nl80211_sta_info {
315 __NL80211_STA_INFO_INVALID,
316 NL80211_STA_INFO_INACTIVE_TIME,
317 NL80211_STA_INFO_RX_BYTES,
318 NL80211_STA_INFO_TX_BYTES,
319 NL80211_STA_INFO_LLID,
320 NL80211_STA_INFO_PLID,
321 NL80211_STA_INFO_PLINK_STATE,
322
323 /* keep last */
324 __NL80211_STA_INFO_AFTER_LAST,
325 NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
326};
327
328/**
329 * enum nl80211_mpath_flags - nl80211 mesh path flags
330 *
331 * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active
332 * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running
333 * @NL80211_MPATH_FLAG_DSN_VALID: the mesh path contains a valid DSN
334 * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set
335 * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded
336 */
337enum nl80211_mpath_flags {
338 NL80211_MPATH_FLAG_ACTIVE = 1<<0,
339 NL80211_MPATH_FLAG_RESOLVING = 1<<1,
340 NL80211_MPATH_FLAG_DSN_VALID = 1<<2,
341 NL80211_MPATH_FLAG_FIXED = 1<<3,
342 NL80211_MPATH_FLAG_RESOLVED = 1<<4,
343};
344
345/**
346 * enum nl80211_mpath_info - mesh path information
347 *
348 * These attribute types are used with %NL80211_ATTR_MPATH_INFO when getting
349 * information about a mesh path.
350 *
351 * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved
352 * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination
353 * @NL80211_ATTR_MPATH_DSN: destination sequence number
354 * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path
355 * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now
356 * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in
357 * &enum nl80211_mpath_flags;
358 * @NL80211_ATTR_MPATH_DISCOVERY_TIMEOUT: total path discovery timeout, in msec
359 * @NL80211_ATTR_MPATH_DISCOVERY_RETRIES: mesh path discovery retries
360 */
361enum nl80211_mpath_info {
362 __NL80211_MPATH_INFO_INVALID,
363 NL80211_MPATH_INFO_FRAME_QLEN,
364 NL80211_MPATH_INFO_DSN,
365 NL80211_MPATH_INFO_METRIC,
366 NL80211_MPATH_INFO_EXPTIME,
367 NL80211_MPATH_INFO_FLAGS,
368 NL80211_MPATH_INFO_DISCOVERY_TIMEOUT,
369 NL80211_MPATH_INFO_DISCOVERY_RETRIES,
370
371 /* keep last */
372 __NL80211_MPATH_INFO_AFTER_LAST,
373 NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1
374};
375
376/**
377 * enum nl80211_band_attr - band attributes
378 * @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved
379 * @NL80211_BAND_ATTR_FREQS: supported frequencies in this band,
380 * an array of nested frequency attributes
381 * @NL80211_BAND_ATTR_RATES: supported bitrates in this band,
382 * an array of nested bitrate attributes
383 */
384enum nl80211_band_attr {
385 __NL80211_BAND_ATTR_INVALID,
386 NL80211_BAND_ATTR_FREQS,
387 NL80211_BAND_ATTR_RATES,
388
389 /* keep last */
390 __NL80211_BAND_ATTR_AFTER_LAST,
391 NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1
392};
393
394/**
395 * enum nl80211_frequency_attr - frequency attributes
396 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
397 * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current
398 * regulatory domain.
399 * @NL80211_FREQUENCY_ATTR_PASSIVE_SCAN: Only passive scanning is
400 * permitted on this channel in current regulatory domain.
401 * @NL80211_FREQUENCY_ATTR_NO_IBSS: IBSS networks are not permitted
402 * on this channel in current regulatory domain.
403 * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory
404 * on this channel in current regulatory domain.
405 */
406enum nl80211_frequency_attr {
407 __NL80211_FREQUENCY_ATTR_INVALID,
408 NL80211_FREQUENCY_ATTR_FREQ,
409 NL80211_FREQUENCY_ATTR_DISABLED,
410 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN,
411 NL80211_FREQUENCY_ATTR_NO_IBSS,
412 NL80211_FREQUENCY_ATTR_RADAR,
413
414 /* keep last */
415 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
416 NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
417};
418
419/**
420 * enum nl80211_bitrate_attr - bitrate attributes
421 * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps
422 * @NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE: Short preamble supported
423 * in 2.4 GHz band.
424 */
425enum nl80211_bitrate_attr {
426 __NL80211_BITRATE_ATTR_INVALID,
427 NL80211_BITRATE_ATTR_RATE,
428 NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE,
429
430 /* keep last */
431 __NL80211_BITRATE_ATTR_AFTER_LAST,
432 NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1
433};
434
435/**
436 * enum nl80211_mntr_flags - monitor configuration flags
437 *
438 * Monitor configuration flags.
439 *
440 * @__NL80211_MNTR_FLAG_INVALID: reserved
441 *
442 * @NL80211_MNTR_FLAG_FCSFAIL: pass frames with bad FCS
443 * @NL80211_MNTR_FLAG_PLCPFAIL: pass frames with bad PLCP
444 * @NL80211_MNTR_FLAG_CONTROL: pass control frames
445 * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering
446 * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing.
447 * overrides all other flags.
448 *
449 * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use
450 * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag
271 */ 451 */
272enum nl80211_sta_stats { 452enum nl80211_mntr_flags {
273 __NL80211_STA_STAT_INVALID, 453 __NL80211_MNTR_FLAG_INVALID,
274 NL80211_STA_STAT_INACTIVE_TIME, 454 NL80211_MNTR_FLAG_FCSFAIL,
275 NL80211_STA_STAT_RX_BYTES, 455 NL80211_MNTR_FLAG_PLCPFAIL,
276 NL80211_STA_STAT_TX_BYTES, 456 NL80211_MNTR_FLAG_CONTROL,
457 NL80211_MNTR_FLAG_OTHER_BSS,
458 NL80211_MNTR_FLAG_COOK_FRAMES,
277 459
278 /* keep last */ 460 /* keep last */
279 __NL80211_STA_STAT_AFTER_LAST, 461 __NL80211_MNTR_FLAG_AFTER_LAST,
280 NL80211_STA_STAT_MAX = __NL80211_STA_STAT_AFTER_LAST - 1 462 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1
281}; 463};
282 464
283#endif /* __LINUX_NL80211_H */ 465#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 905e18f4b412..848025cd7087 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -14,6 +14,8 @@
14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. 14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
15 * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c. 15 * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c.
16 * For details of nodes_remap(), see bitmap_remap in lib/bitmap.c. 16 * For details of nodes_remap(), see bitmap_remap in lib/bitmap.c.
17 * For details of nodes_onto(), see bitmap_onto in lib/bitmap.c.
18 * For details of nodes_fold(), see bitmap_fold in lib/bitmap.c.
17 * 19 *
18 * The available nodemask operations are: 20 * The available nodemask operations are:
19 * 21 *
@@ -55,7 +57,9 @@
55 * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing 57 * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing
56 * int nodelist_parse(buf, map) Parse ascii string as nodelist 58 * int nodelist_parse(buf, map) Parse ascii string as nodelist
57 * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit) 59 * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
58 * int nodes_remap(dst, src, old, new) *dst = map(old, new)(dst) 60 * void nodes_remap(dst, src, old, new) *dst = map(old, new)(src)
61 * void nodes_onto(dst, orig, relmap) *dst = orig relative to relmap
62 * void nodes_fold(dst, orig, sz) dst bits = orig bits mod sz
59 * 63 *
60 * for_each_node_mask(node, mask) for-loop node over mask 64 * for_each_node_mask(node, mask) for-loop node over mask
61 * 65 *
@@ -326,6 +330,22 @@ static inline void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp,
326 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); 330 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits);
327} 331}
328 332
333#define nodes_onto(dst, orig, relmap) \
334 __nodes_onto(&(dst), &(orig), &(relmap), MAX_NUMNODES)
335static inline void __nodes_onto(nodemask_t *dstp, const nodemask_t *origp,
336 const nodemask_t *relmapp, int nbits)
337{
338 bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits);
339}
340
341#define nodes_fold(dst, orig, sz) \
342 __nodes_fold(&(dst), &(orig), sz, MAX_NUMNODES)
343static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp,
344 int sz, int nbits)
345{
346 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
347}
348
329#if MAX_NUMNODES > 1 349#if MAX_NUMNODES > 1
330#define for_each_node_mask(node, mask) \ 350#define for_each_node_mask(node, mask) \
331 for ((node) = first_node(mask); \ 351 for ((node) = first_node(mask); \
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index f4df40038f0c..0ff6224d172a 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -121,6 +121,10 @@ extern int raw_notifier_chain_register(struct raw_notifier_head *nh,
121extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, 121extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh,
122 struct notifier_block *nb); 122 struct notifier_block *nb);
123 123
124extern int blocking_notifier_chain_cond_register(
125 struct blocking_notifier_head *nh,
126 struct notifier_block *nb);
127
124extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, 128extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,
125 struct notifier_block *nb); 129 struct notifier_block *nb);
126extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, 130extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh,
@@ -247,6 +251,7 @@ extern struct blocking_notifier_head reboot_notifier_list;
247#define VT_DEALLOCATE 0x0002 /* Console will be deallocated */ 251#define VT_DEALLOCATE 0x0002 /* Console will be deallocated */
248#define VT_WRITE 0x0003 /* A char got output */ 252#define VT_WRITE 0x0003 /* A char got output */
249#define VT_UPDATE 0x0004 /* A bigger update occurred */ 253#define VT_UPDATE 0x0004 /* A bigger update occurred */
254#define VT_PREWRITE 0x0005 /* A char is about to be written to the console */
250 255
251#endif /* __KERNEL__ */ 256#endif /* __KERNEL__ */
252#endif /* _LINUX_NOTIFIER_H */ 257#endif /* _LINUX_NOTIFIER_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index 6981016dcc25..59a61bdc98b6 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -62,6 +62,7 @@ extern struct property *of_find_property(const struct device_node *np,
62 int *lenp); 62 int *lenp);
63extern int of_device_is_compatible(const struct device_node *device, 63extern int of_device_is_compatible(const struct device_node *device,
64 const char *); 64 const char *);
65extern int of_device_is_available(const struct device_node *device);
65extern const void *of_get_property(const struct device_node *node, 66extern const void *of_get_property(const struct device_node *node,
66 const char *name, 67 const char *name,
67 int *lenp); 68 int *lenp);
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 6dc11959770c..afe338217d91 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -1,6 +1,5 @@
1#ifndef _LINUX_OF_DEVICE_H 1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H 2#define _LINUX_OF_DEVICE_H
3#ifdef __KERNEL__
4 3
5#include <linux/device.h> 4#include <linux/device.h>
6#include <linux/of.h> 5#include <linux/of.h>
@@ -25,5 +24,4 @@ static inline void of_device_free(struct of_device *dev)
25 of_release_dev(&dev->dev); 24 of_release_dev(&dev->dev);
26} 25}
27 26
28#endif /* __KERNEL__ */
29#endif /* _LINUX_OF_DEVICE_H */ 27#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
new file mode 100644
index 000000000000..2ee97e9877a7
--- /dev/null
+++ b/include/linux/of_gpio.h
@@ -0,0 +1,69 @@
1/*
2 * OF helpers for the GPIO API
3 *
4 * Copyright (c) 2007-2008 MontaVista Software, Inc.
5 *
6 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __LINUX_OF_GPIO_H
15#define __LINUX_OF_GPIO_H
16
17#include <linux/errno.h>
18#include <asm/gpio.h>
19
20#ifdef CONFIG_OF_GPIO
21
22/*
23 * Generic OF GPIO chip
24 */
25struct of_gpio_chip {
26 struct gpio_chip gc;
27 int gpio_cells;
28 int (*xlate)(struct of_gpio_chip *of_gc, struct device_node *np,
29 const void *gpio_spec);
30};
31
32static inline struct of_gpio_chip *to_of_gpio_chip(struct gpio_chip *gc)
33{
34 return container_of(gc, struct of_gpio_chip, gc);
35}
36
37/*
38 * OF GPIO chip for memory mapped banks
39 */
40struct of_mm_gpio_chip {
41 struct of_gpio_chip of_gc;
42 void (*save_regs)(struct of_mm_gpio_chip *mm_gc);
43 void __iomem *regs;
44};
45
46static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
47{
48 struct of_gpio_chip *of_gc = to_of_gpio_chip(gc);
49
50 return container_of(of_gc, struct of_mm_gpio_chip, of_gc);
51}
52
53extern int of_get_gpio(struct device_node *np, int index);
54extern int of_mm_gpiochip_add(struct device_node *np,
55 struct of_mm_gpio_chip *mm_gc);
56extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc,
57 struct device_node *np,
58 const void *gpio_spec);
59#else
60
61/* Drivers may not strictly depend on the GPIO support, so let them link. */
62static inline int of_get_gpio(struct device_node *np, int index)
63{
64 return -ENOSYS;
65}
66
67#endif /* CONFIG_OF_GPIO */
68
69#endif /* __LINUX_OF_GPIO_H */
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
new file mode 100644
index 000000000000..2e5a96732042
--- /dev/null
+++ b/include/linux/of_i2c.h
@@ -0,0 +1,24 @@
1/*
2 * Generic I2C API implementation for PowerPC.
3 *
4 * Copyright (c) 2008 Jochen Friedrich <jochen@scram.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __LINUX_OF_I2C_H
13#define __LINUX_OF_I2C_H
14
15#include <linux/i2c.h>
16
17#ifdef CONFIG_OF_I2C
18
19void of_register_i2c_devices(struct i2c_adapter *adap,
20 struct device_node *adap_node);
21
22#endif /* CONFIG_OF_I2C */
23
24#endif /* __LINUX_OF_I2C_H */
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 3852436b652a..a7979baf1e39 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -23,8 +23,8 @@ enum oom_constraint {
23 CONSTRAINT_MEMORY_POLICY, 23 CONSTRAINT_MEMORY_POLICY,
24}; 24};
25 25
26extern int try_set_zone_oom(struct zonelist *zonelist); 26extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags);
27extern void clear_zonelist_oom(struct zonelist *zonelist); 27extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
28 28
29extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); 29extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
30extern int register_oom_notifier(struct notifier_block *nb); 30extern int register_oom_notifier(struct notifier_block *nb);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b5b30f1c1e59..590cff32415d 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -6,7 +6,10 @@
6#define PAGE_FLAGS_H 6#define PAGE_FLAGS_H
7 7
8#include <linux/types.h> 8#include <linux/types.h>
9#ifndef __GENERATING_BOUNDS_H
9#include <linux/mm_types.h> 10#include <linux/mm_types.h>
11#include <linux/bounds.h>
12#endif /* !__GENERATING_BOUNDS_H */
10 13
11/* 14/*
12 * Various page->flags bits: 15 * Various page->flags bits:
@@ -59,77 +62,138 @@
59 * extends from the high bits downwards. 62 * extends from the high bits downwards.
60 * 63 *
61 * | FIELD | ... | FLAGS | 64 * | FIELD | ... | FLAGS |
62 * N-1 ^ 0 65 * N-1 ^ 0
63 * (N-FLAGS_RESERVED) 66 * (NR_PAGEFLAGS)
64 * 67 *
65 * The fields area is reserved for fields mapping zone, node and SPARSEMEM 68 * The fields area is reserved for fields mapping zone, node (for NUMA) and
66 * section. The boundry between these two areas is defined by 69 * SPARSEMEM section (for variants of SPARSEMEM that require section ids like
67 * FLAGS_RESERVED which defines the width of the fields section 70 * SPARSEMEM_EXTREME with !SPARSEMEM_VMEMMAP).
68 * (see linux/mmzone.h). New flags must _not_ overlap with this area.
69 */ 71 */
70#define PG_locked 0 /* Page is locked. Don't touch. */ 72enum pageflags {
71#define PG_error 1 73 PG_locked, /* Page is locked. Don't touch. */
72#define PG_referenced 2 74 PG_error,
73#define PG_uptodate 3 75 PG_referenced,
76 PG_uptodate,
77 PG_dirty,
78 PG_lru,
79 PG_active,
80 PG_slab,
81 PG_owner_priv_1, /* Owner use. If pagecache, fs may use*/
82 PG_arch_1,
83 PG_reserved,
84 PG_private, /* If pagecache, has fs-private data */
85 PG_writeback, /* Page is under writeback */
86#ifdef CONFIG_PAGEFLAGS_EXTENDED
87 PG_head, /* A head page */
88 PG_tail, /* A tail page */
89#else
90 PG_compound, /* A compound page */
91#endif
92 PG_swapcache, /* Swap page: swp_entry_t in private */
93 PG_mappedtodisk, /* Has blocks allocated on-disk */
94 PG_reclaim, /* To be reclaimed asap */
95 PG_buddy, /* Page is free, on buddy lists */
96#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
97 PG_uncached, /* Page has been mapped as uncached */
98#endif
99 __NR_PAGEFLAGS
100};
101
102#ifndef __GENERATING_BOUNDS_H
103
104/*
105 * Macros to create function definitions for page flags
106 */
107#define TESTPAGEFLAG(uname, lname) \
108static inline int Page##uname(struct page *page) \
109 { return test_bit(PG_##lname, &page->flags); }
74 110
75#define PG_dirty 4 111#define SETPAGEFLAG(uname, lname) \
76#define PG_lru 5 112static inline void SetPage##uname(struct page *page) \
77#define PG_active 6 113 { set_bit(PG_##lname, &page->flags); }
78#define PG_slab 7 /* slab debug (Suparna wants this) */
79 114
80#define PG_owner_priv_1 8 /* Owner use. If pagecache, fs may use*/ 115#define CLEARPAGEFLAG(uname, lname) \
81#define PG_arch_1 9 116static inline void ClearPage##uname(struct page *page) \
82#define PG_reserved 10 117 { clear_bit(PG_##lname, &page->flags); }
83#define PG_private 11 /* If pagecache, has fs-private data */
84 118
85#define PG_writeback 12 /* Page is under writeback */ 119#define __SETPAGEFLAG(uname, lname) \
86#define PG_compound 14 /* Part of a compound page */ 120static inline void __SetPage##uname(struct page *page) \
87#define PG_swapcache 15 /* Swap page: swp_entry_t in private */ 121 { __set_bit(PG_##lname, &page->flags); }
88 122
89#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */ 123#define __CLEARPAGEFLAG(uname, lname) \
90#define PG_reclaim 17 /* To be reclaimed asap */ 124static inline void __ClearPage##uname(struct page *page) \
91#define PG_buddy 19 /* Page is free, on buddy lists */ 125 { __clear_bit(PG_##lname, &page->flags); }
126
127#define TESTSETFLAG(uname, lname) \
128static inline int TestSetPage##uname(struct page *page) \
129 { return test_and_set_bit(PG_##lname, &page->flags); }
130
131#define TESTCLEARFLAG(uname, lname) \
132static inline int TestClearPage##uname(struct page *page) \
133 { return test_and_clear_bit(PG_##lname, &page->flags); }
92 134
93/* PG_readahead is only used for file reads; PG_reclaim is only for writes */
94#define PG_readahead PG_reclaim /* Reminder to do async read-ahead */
95 135
96/* PG_owner_priv_1 users should have descriptive aliases */ 136#define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
97#define PG_checked PG_owner_priv_1 /* Used by some filesystems */ 137 SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname)
98#define PG_pinned PG_owner_priv_1 /* Xen pinned pagetable */ 138
139#define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
140 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname)
141
142#define PAGEFLAG_FALSE(uname) \
143static inline int Page##uname(struct page *page) \
144 { return 0; }
145
146#define TESTSCFLAG(uname, lname) \
147 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname)
148
149struct page; /* forward declaration */
150
151PAGEFLAG(Locked, locked) TESTSCFLAG(Locked, locked)
152PAGEFLAG(Error, error)
153PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
154PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
155PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru)
156PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active)
157__PAGEFLAG(Slab, slab)
158PAGEFLAG(Checked, owner_priv_1) /* Used by some filesystems */
159PAGEFLAG(Pinned, owner_priv_1) TESTSCFLAG(Pinned, owner_priv_1) /* Xen */
160PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
161PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private)
162 __SETPAGEFLAG(Private, private)
99 163
100#if (BITS_PER_LONG > 32)
101/* 164/*
102 * 64-bit-only flags build down from bit 31 165 * Only test-and-set exist for PG_writeback. The unconditional operators are
103 * 166 * risky: they bypass page accounting.
104 * 32 bit -------------------------------| FIELDS | FLAGS |
105 * 64 bit | FIELDS | ?????? FLAGS |
106 * 63 32 0
107 */ 167 */
108#define PG_uncached 31 /* Page has been mapped as uncached */ 168TESTPAGEFLAG(Writeback, writeback) TESTSCFLAG(Writeback, writeback)
109#endif 169__PAGEFLAG(Buddy, buddy)
170PAGEFLAG(MappedToDisk, mappedtodisk)
110 171
172/* PG_readahead is only used for file reads; PG_reclaim is only for writes */
173PAGEFLAG(Reclaim, reclaim) TESTCLEARFLAG(Reclaim, reclaim)
174PAGEFLAG(Readahead, reclaim) /* Reminder to do async read-ahead */
175
176#ifdef CONFIG_HIGHMEM
111/* 177/*
112 * Manipulation of page state flags 178 * Must use a macro here due to header dependency issues. page_zone() is not
179 * available at this point.
113 */ 180 */
114#define PageLocked(page) \ 181#define PageHighMem(__p) is_highmem(page_zone(__p))
115 test_bit(PG_locked, &(page)->flags) 182#else
116#define SetPageLocked(page) \ 183PAGEFLAG_FALSE(HighMem)
117 set_bit(PG_locked, &(page)->flags) 184#endif
118#define TestSetPageLocked(page) \ 185
119 test_and_set_bit(PG_locked, &(page)->flags) 186#ifdef CONFIG_SWAP
120#define ClearPageLocked(page) \ 187PAGEFLAG(SwapCache, swapcache)
121 clear_bit(PG_locked, &(page)->flags) 188#else
122#define TestClearPageLocked(page) \ 189PAGEFLAG_FALSE(SwapCache)
123 test_and_clear_bit(PG_locked, &(page)->flags) 190#endif
124 191
125#define PageError(page) test_bit(PG_error, &(page)->flags) 192#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
126#define SetPageError(page) set_bit(PG_error, &(page)->flags) 193PAGEFLAG(Uncached, uncached)
127#define ClearPageError(page) clear_bit(PG_error, &(page)->flags) 194#else
128 195PAGEFLAG_FALSE(Uncached)
129#define PageReferenced(page) test_bit(PG_referenced, &(page)->flags) 196#endif
130#define SetPageReferenced(page) set_bit(PG_referenced, &(page)->flags)
131#define ClearPageReferenced(page) clear_bit(PG_referenced, &(page)->flags)
132#define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags)
133 197
134static inline int PageUptodate(struct page *page) 198static inline int PageUptodate(struct page *page)
135{ 199{
@@ -177,97 +241,59 @@ static inline void SetPageUptodate(struct page *page)
177#endif 241#endif
178} 242}
179 243
180#define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) 244CLEARPAGEFLAG(Uptodate, uptodate)
181
182#define PageDirty(page) test_bit(PG_dirty, &(page)->flags)
183#define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags)
184#define TestSetPageDirty(page) test_and_set_bit(PG_dirty, &(page)->flags)
185#define ClearPageDirty(page) clear_bit(PG_dirty, &(page)->flags)
186#define __ClearPageDirty(page) __clear_bit(PG_dirty, &(page)->flags)
187#define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags)
188
189#define PageLRU(page) test_bit(PG_lru, &(page)->flags)
190#define SetPageLRU(page) set_bit(PG_lru, &(page)->flags)
191#define ClearPageLRU(page) clear_bit(PG_lru, &(page)->flags)
192#define __ClearPageLRU(page) __clear_bit(PG_lru, &(page)->flags)
193
194#define PageActive(page) test_bit(PG_active, &(page)->flags)
195#define SetPageActive(page) set_bit(PG_active, &(page)->flags)
196#define ClearPageActive(page) clear_bit(PG_active, &(page)->flags)
197#define __ClearPageActive(page) __clear_bit(PG_active, &(page)->flags)
198
199#define PageSlab(page) test_bit(PG_slab, &(page)->flags)
200#define __SetPageSlab(page) __set_bit(PG_slab, &(page)->flags)
201#define __ClearPageSlab(page) __clear_bit(PG_slab, &(page)->flags)
202
203#ifdef CONFIG_HIGHMEM
204#define PageHighMem(page) is_highmem(page_zone(page))
205#else
206#define PageHighMem(page) 0 /* needed to optimize away at compile time */
207#endif
208 245
209#define PageChecked(page) test_bit(PG_checked, &(page)->flags) 246extern void cancel_dirty_page(struct page *page, unsigned int account_size);
210#define SetPageChecked(page) set_bit(PG_checked, &(page)->flags)
211#define ClearPageChecked(page) clear_bit(PG_checked, &(page)->flags)
212
213#define PagePinned(page) test_bit(PG_pinned, &(page)->flags)
214#define SetPagePinned(page) set_bit(PG_pinned, &(page)->flags)
215#define ClearPagePinned(page) clear_bit(PG_pinned, &(page)->flags)
216 247
217#define PageReserved(page) test_bit(PG_reserved, &(page)->flags) 248int test_clear_page_writeback(struct page *page);
218#define SetPageReserved(page) set_bit(PG_reserved, &(page)->flags) 249int test_set_page_writeback(struct page *page);
219#define ClearPageReserved(page) clear_bit(PG_reserved, &(page)->flags)
220#define __ClearPageReserved(page) __clear_bit(PG_reserved, &(page)->flags)
221 250
222#define SetPagePrivate(page) set_bit(PG_private, &(page)->flags) 251static inline void set_page_writeback(struct page *page)
223#define ClearPagePrivate(page) clear_bit(PG_private, &(page)->flags) 252{
224#define PagePrivate(page) test_bit(PG_private, &(page)->flags) 253 test_set_page_writeback(page);
225#define __SetPagePrivate(page) __set_bit(PG_private, &(page)->flags) 254}
226#define __ClearPagePrivate(page) __clear_bit(PG_private, &(page)->flags)
227 255
256#ifdef CONFIG_PAGEFLAGS_EXTENDED
228/* 257/*
229 * Only test-and-set exist for PG_writeback. The unconditional operators are 258 * System with lots of page flags available. This allows separate
230 * risky: they bypass page accounting. 259 * flags for PageHead() and PageTail() checks of compound pages so that bit
260 * tests can be used in performance sensitive paths. PageCompound is
261 * generally not used in hot code paths.
231 */ 262 */
232#define PageWriteback(page) test_bit(PG_writeback, &(page)->flags) 263__PAGEFLAG(Head, head)
233#define TestSetPageWriteback(page) test_and_set_bit(PG_writeback, \ 264__PAGEFLAG(Tail, tail)
234 &(page)->flags)
235#define TestClearPageWriteback(page) test_and_clear_bit(PG_writeback, \
236 &(page)->flags)
237 265
238#define PageBuddy(page) test_bit(PG_buddy, &(page)->flags) 266static inline int PageCompound(struct page *page)
239#define __SetPageBuddy(page) __set_bit(PG_buddy, &(page)->flags) 267{
240#define __ClearPageBuddy(page) __clear_bit(PG_buddy, &(page)->flags) 268 return page->flags & ((1L << PG_head) | (1L << PG_tail));
241
242#define PageMappedToDisk(page) test_bit(PG_mappedtodisk, &(page)->flags)
243#define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags)
244#define ClearPageMappedToDisk(page) clear_bit(PG_mappedtodisk, &(page)->flags)
245
246#define PageReadahead(page) test_bit(PG_readahead, &(page)->flags)
247#define SetPageReadahead(page) set_bit(PG_readahead, &(page)->flags)
248#define ClearPageReadahead(page) clear_bit(PG_readahead, &(page)->flags)
249
250#define PageReclaim(page) test_bit(PG_reclaim, &(page)->flags)
251#define SetPageReclaim(page) set_bit(PG_reclaim, &(page)->flags)
252#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags)
253#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags)
254 269
255#define PageCompound(page) test_bit(PG_compound, &(page)->flags) 270}
256#define __SetPageCompound(page) __set_bit(PG_compound, &(page)->flags) 271#else
257#define __ClearPageCompound(page) __clear_bit(PG_compound, &(page)->flags) 272/*
273 * Reduce page flag use as much as possible by overlapping
274 * compound page flags with the flags used for page cache pages. Possible
275 * because PageCompound is always set for compound pages and not for
276 * pages on the LRU and/or pagecache.
277 */
278TESTPAGEFLAG(Compound, compound)
279__PAGEFLAG(Head, compound)
258 280
259/* 281/*
260 * PG_reclaim is used in combination with PG_compound to mark the 282 * PG_reclaim is used in combination with PG_compound to mark the
261 * head and tail of a compound page 283 * head and tail of a compound page. This saves one page flag
284 * but makes it impossible to use compound pages for the page cache.
285 * The PG_reclaim bit would have to be used for reclaim or readahead
286 * if compound pages enter the page cache.
262 * 287 *
263 * PG_compound & PG_reclaim => Tail page 288 * PG_compound & PG_reclaim => Tail page
264 * PG_compound & ~PG_reclaim => Head page 289 * PG_compound & ~PG_reclaim => Head page
265 */ 290 */
266
267#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim)) 291#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim))
268 292
269#define PageTail(page) (((page)->flags & PG_head_tail_mask) \ 293static inline int PageTail(struct page *page)
270 == PG_head_tail_mask) 294{
295 return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask);
296}
271 297
272static inline void __SetPageTail(struct page *page) 298static inline void __SetPageTail(struct page *page)
273{ 299{
@@ -279,33 +305,6 @@ static inline void __ClearPageTail(struct page *page)
279 page->flags &= ~PG_head_tail_mask; 305 page->flags &= ~PG_head_tail_mask;
280} 306}
281 307
282#define PageHead(page) (((page)->flags & PG_head_tail_mask) \ 308#endif /* !PAGEFLAGS_EXTENDED */
283 == (1L << PG_compound)) 309#endif /* !__GENERATING_BOUNDS_H */
284#define __SetPageHead(page) __SetPageCompound(page)
285#define __ClearPageHead(page) __ClearPageCompound(page)
286
287#ifdef CONFIG_SWAP
288#define PageSwapCache(page) test_bit(PG_swapcache, &(page)->flags)
289#define SetPageSwapCache(page) set_bit(PG_swapcache, &(page)->flags)
290#define ClearPageSwapCache(page) clear_bit(PG_swapcache, &(page)->flags)
291#else
292#define PageSwapCache(page) 0
293#endif
294
295#define PageUncached(page) test_bit(PG_uncached, &(page)->flags)
296#define SetPageUncached(page) set_bit(PG_uncached, &(page)->flags)
297#define ClearPageUncached(page) clear_bit(PG_uncached, &(page)->flags)
298
299struct page; /* forward declaration */
300
301extern void cancel_dirty_page(struct page *page, unsigned int account_size);
302
303int test_clear_page_writeback(struct page *page);
304int test_set_page_writeback(struct page *page);
305
306static inline void set_page_writeback(struct page *page)
307{
308 test_set_page_writeback(page);
309}
310
311#endif /* PAGE_FLAGS_H */ 310#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index d1ad546c8c9e..dcb9e01a69ca 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -101,9 +101,9 @@ typedef enum {
101#include <linux/spinlock.h> 101#include <linux/spinlock.h>
102#include <linux/wait.h> 102#include <linux/wait.h>
103#include <linux/irqreturn.h> 103#include <linux/irqreturn.h>
104#include <linux/semaphore.h>
104#include <asm/system.h> 105#include <asm/system.h>
105#include <asm/ptrace.h> 106#include <asm/ptrace.h>
106#include <asm/semaphore.h>
107 107
108/* Define this later. */ 108/* Define this later. */
109struct parport; 109struct parport;
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
new file mode 100644
index 000000000000..a1a1e618e996
--- /dev/null
+++ b/include/linux/pci-aspm.h
@@ -0,0 +1,56 @@
1/*
2 * aspm.h
3 *
4 * PCI Express ASPM defines and function prototypes
5 *
6 * Copyright (C) 2007 Intel Corp.
7 * Zhang Yanmin (yanmin.zhang@intel.com)
8 * Shaohua Li (shaohua.li@intel.com)
9 *
10 * For more information, please consult the following manuals (look at
11 * http://www.pcisig.com/ for how to get them):
12 *
13 * PCI Express Specification
14 */
15
16#ifndef LINUX_ASPM_H
17#define LINUX_ASPM_H
18
19#include <linux/pci.h>
20
21#define PCIE_LINK_STATE_L0S 1
22#define PCIE_LINK_STATE_L1 2
23#define PCIE_LINK_STATE_CLKPM 4
24
25#ifdef CONFIG_PCIEASPM
26extern void pcie_aspm_init_link_state(struct pci_dev *pdev);
27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pci_disable_link_state(struct pci_dev *pdev, int state);
30#else
31static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
32{
33}
34static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev)
35{
36}
37static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev)
38{
39}
40static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
41{
42}
43#endif
44
45#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */
46extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev);
47extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev);
48#else
49static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev)
50{
51}
52static inline void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev)
53{
54}
55#endif
56#endif /* LINUX_ASPM_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ea760e519c46..96acd0dae241 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -128,11 +128,13 @@ struct pci_cap_saved_state {
128 u32 data[0]; 128 u32 data[0];
129}; 129};
130 130
131struct pcie_link_state;
132struct pci_vpd;
133
131/* 134/*
132 * The pci_dev structure is used to describe PCI devices. 135 * The pci_dev structure is used to describe PCI devices.
133 */ 136 */
134struct pci_dev { 137struct pci_dev {
135 struct list_head global_list; /* node in list of all PCI devices */
136 struct list_head bus_list; /* node in per-bus list */ 138 struct list_head bus_list; /* node in per-bus list */
137 struct pci_bus *bus; /* bus this device is on */ 139 struct pci_bus *bus; /* bus this device is on */
138 struct pci_bus *subordinate; /* bus this device bridges to */ 140 struct pci_bus *subordinate; /* bus this device bridges to */
@@ -165,6 +167,10 @@ struct pci_dev {
165 this is D0-D3, D0 being fully functional, 167 this is D0-D3, D0 being fully functional,
166 and D3 being off. */ 168 and D3 being off. */
167 169
170#ifdef CONFIG_PCIEASPM
171 struct pcie_link_state *link_state; /* ASPM link state. */
172#endif
173
168 pci_channel_state_t error_state; /* current connectivity state */ 174 pci_channel_state_t error_state; /* current connectivity state */
169 struct device dev; /* Generic device interface */ 175 struct device dev; /* Generic device interface */
170 176
@@ -181,6 +187,7 @@ struct pci_dev {
181 unsigned int transparent:1; /* Transparent PCI bridge */ 187 unsigned int transparent:1; /* Transparent PCI bridge */
182 unsigned int multifunction:1;/* Part of multi-function device */ 188 unsigned int multifunction:1;/* Part of multi-function device */
183 /* keep track of device state */ 189 /* keep track of device state */
190 unsigned int is_added:1;
184 unsigned int is_busmaster:1; /* device is busmaster */ 191 unsigned int is_busmaster:1; /* device is busmaster */
185 unsigned int no_msi:1; /* device may not use msi */ 192 unsigned int no_msi:1; /* device may not use msi */
186 unsigned int no_d1d2:1; /* only allow d0 or d3 */ 193 unsigned int no_d1d2:1; /* only allow d0 or d3 */
@@ -201,11 +208,11 @@ struct pci_dev {
201#ifdef CONFIG_PCI_MSI 208#ifdef CONFIG_PCI_MSI
202 struct list_head msi_list; 209 struct list_head msi_list;
203#endif 210#endif
211 struct pci_vpd *vpd;
204}; 212};
205 213
206extern struct pci_dev *alloc_pci_dev(void); 214extern struct pci_dev *alloc_pci_dev(void);
207 215
208#define pci_dev_g(n) list_entry(n, struct pci_dev, global_list)
209#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) 216#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
210#define to_pci_dev(n) container_of(n, struct pci_dev, dev) 217#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
211#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) 218#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
@@ -247,7 +254,7 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
247#define PCI_NUM_RESOURCES 11 254#define PCI_NUM_RESOURCES 11
248 255
249#ifndef PCI_BUS_NUM_RESOURCES 256#ifndef PCI_BUS_NUM_RESOURCES
250#define PCI_BUS_NUM_RESOURCES 8 257#define PCI_BUS_NUM_RESOURCES 16
251#endif 258#endif
252 259
253#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ 260#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */
@@ -449,7 +456,6 @@ extern struct bus_type pci_bus_type;
449/* Do NOT directly access these two variables, unless you are arch specific pci 456/* Do NOT directly access these two variables, unless you are arch specific pci
450 * code, or pci core code. */ 457 * code, or pci core code. */
451extern struct list_head pci_root_buses; /* list of all known PCI buses */ 458extern struct list_head pci_root_buses; /* list of all known PCI buses */
452extern struct list_head pci_devices; /* list of all devices */
453/* Some device drivers need know if pci is initiated */ 459/* Some device drivers need know if pci is initiated */
454extern int no_pci_devices(void); 460extern int no_pci_devices(void);
455 461
@@ -517,17 +523,13 @@ struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
517 523
518struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, 524struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
519 struct pci_dev *from); 525 struct pci_dev *from);
520struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device,
521 struct pci_dev *from);
522
523struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, 526struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
524 unsigned int ss_vendor, unsigned int ss_device, 527 unsigned int ss_vendor, unsigned int ss_device,
525 struct pci_dev *from); 528 const struct pci_dev *from);
526struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); 529struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
527struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); 530struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
528struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); 531struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
529int pci_dev_present(const struct pci_device_id *ids); 532int pci_dev_present(const struct pci_device_id *ids);
530const struct pci_device_id *pci_find_present(const struct pci_device_id *ids);
531 533
532int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, 534int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn,
533 int where, u8 *val); 535 int where, u8 *val);
@@ -601,7 +603,6 @@ int pcie_get_readrq(struct pci_dev *dev);
601int pcie_set_readrq(struct pci_dev *dev, int rq); 603int pcie_set_readrq(struct pci_dev *dev, int rq);
602void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 604void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
603int __must_check pci_assign_resource(struct pci_dev *dev, int i); 605int __must_check pci_assign_resource(struct pci_dev *dev, int i);
604int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
605int pci_select_bars(struct pci_dev *dev, unsigned long flags); 606int pci_select_bars(struct pci_dev *dev, unsigned long flags);
606 607
607/* ROM control related routines */ 608/* ROM control related routines */
@@ -626,6 +627,7 @@ int pci_claim_resource(struct pci_dev *, int);
626void pci_assign_unassigned_resources(void); 627void pci_assign_unassigned_resources(void);
627void pdev_enable_device(struct pci_dev *); 628void pdev_enable_device(struct pci_dev *);
628void pdev_sort_resources(struct pci_dev *, struct resource_list *); 629void pdev_sort_resources(struct pci_dev *, struct resource_list *);
630int pci_enable_resources(struct pci_dev *, int mask);
629void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 631void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
630 int (*)(struct pci_dev *, u8, u8)); 632 int (*)(struct pci_dev *, u8, u8));
631#define HAVE_PCI_REQ_REGIONS 2 633#define HAVE_PCI_REQ_REGIONS 2
@@ -664,6 +666,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
664 666
665void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 667void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
666 void *userdata); 668 void *userdata);
669int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix);
667int pci_cfg_space_size(struct pci_dev *dev); 670int pci_cfg_space_size(struct pci_dev *dev);
668unsigned char pci_bus_max_busnr(struct pci_bus *bus); 671unsigned char pci_bus_max_busnr(struct pci_bus *bus);
669 672
@@ -699,6 +702,8 @@ static inline int pci_enable_msi(struct pci_dev *dev)
699 return -1; 702 return -1;
700} 703}
701 704
705static inline void pci_msi_shutdown(struct pci_dev *dev)
706{ }
702static inline void pci_disable_msi(struct pci_dev *dev) 707static inline void pci_disable_msi(struct pci_dev *dev)
703{ } 708{ }
704 709
@@ -708,6 +713,8 @@ static inline int pci_enable_msix(struct pci_dev *dev,
708 return -1; 713 return -1;
709} 714}
710 715
716static inline void pci_msix_shutdown(struct pci_dev *dev)
717{ }
711static inline void pci_disable_msix(struct pci_dev *dev) 718static inline void pci_disable_msix(struct pci_dev *dev)
712{ } 719{ }
713 720
@@ -718,9 +725,11 @@ static inline void pci_restore_msi_state(struct pci_dev *dev)
718{ } 725{ }
719#else 726#else
720extern int pci_enable_msi(struct pci_dev *dev); 727extern int pci_enable_msi(struct pci_dev *dev);
728extern void pci_msi_shutdown(struct pci_dev *dev);
721extern void pci_disable_msi(struct pci_dev *dev); 729extern void pci_disable_msi(struct pci_dev *dev);
722extern int pci_enable_msix(struct pci_dev *dev, 730extern int pci_enable_msix(struct pci_dev *dev,
723 struct msix_entry *entries, int nvec); 731 struct msix_entry *entries, int nvec);
732extern void pci_msix_shutdown(struct pci_dev *dev);
724extern void pci_disable_msix(struct pci_dev *dev); 733extern void pci_disable_msix(struct pci_dev *dev);
725extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 734extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
726extern void pci_restore_msi_state(struct pci_dev *dev); 735extern void pci_restore_msi_state(struct pci_dev *dev);
@@ -793,18 +802,11 @@ static inline struct pci_dev *pci_get_device(unsigned int vendor,
793 return NULL; 802 return NULL;
794} 803}
795 804
796static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor,
797 unsigned int device,
798 struct pci_dev *from)
799{
800 return NULL;
801}
802
803static inline struct pci_dev *pci_get_subsys(unsigned int vendor, 805static inline struct pci_dev *pci_get_subsys(unsigned int vendor,
804 unsigned int device, 806 unsigned int device,
805 unsigned int ss_vendor, 807 unsigned int ss_vendor,
806 unsigned int ss_device, 808 unsigned int ss_device,
807 struct pci_dev *from) 809 const struct pci_dev *from)
808{ 810{
809 return NULL; 811 return NULL;
810} 812}
@@ -817,7 +819,6 @@ static inline struct pci_dev *pci_get_class(unsigned int class,
817 819
818#define pci_dev_present(ids) (0) 820#define pci_dev_present(ids) (0)
819#define no_pci_devices() (1) 821#define no_pci_devices() (1)
820#define pci_find_present(ids) (NULL)
821#define pci_dev_put(dev) do { } while (0) 822#define pci_dev_put(dev) do { } while (0)
822 823
823static inline void pci_set_master(struct pci_dev *dev) 824static inline void pci_set_master(struct pci_dev *dev)
@@ -1059,5 +1060,13 @@ extern unsigned long pci_cardbus_mem_size;
1059 1060
1060extern int pcibios_add_platform_entries(struct pci_dev *dev); 1061extern int pcibios_add_platform_entries(struct pci_dev *dev);
1061 1062
1063#ifdef CONFIG_PCI_MMCONFIG
1064extern void __init pci_mmcfg_early_init(void);
1065extern void __init pci_mmcfg_late_init(void);
1066#else
1067static inline void pci_mmcfg_early_init(void) { }
1068static inline void pci_mmcfg_late_init(void) { }
1069#endif
1070
1062#endif /* __KERNEL__ */ 1071#endif /* __KERNEL__ */
1063#endif /* LINUX_PCI_H */ 1072#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 70eb3c803d47..cf6dbd759395 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1429,6 +1429,7 @@
1429#define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 1429#define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9
1430#define PCI_DEVICE_ID_NEO_2RJ45 0x00CA 1430#define PCI_DEVICE_ID_NEO_2RJ45 0x00CA
1431#define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB 1431#define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB
1432#define PCIE_DEVICE_ID_NEO_4_IBM 0x00F4
1432 1433
1433#define PCI_VENDOR_ID_XIRCOM 0x115d 1434#define PCI_VENDOR_ID_XIRCOM 0x115d
1434#define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101 1435#define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101
@@ -2413,6 +2414,8 @@
2413#define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0 2414#define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0
2414#define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2 2415#define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2
2415#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 2416#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601
2417#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119
2418#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a
2416#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 2419#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4
2417#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 2420#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5
2418#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca 2421#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index c1914a8b94a9..c0c1223c9194 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -395,9 +395,17 @@
395#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ 395#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */
396#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ 396#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
397#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ 397#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
398#define PCI_EXP_LNKCAP_ASPMS 0xc00 /* ASPM Support */
399#define PCI_EXP_LNKCAP_L0SEL 0x7000 /* L0s Exit Latency */
400#define PCI_EXP_LNKCAP_L1EL 0x38000 /* L1 Exit Latency */
401#define PCI_EXP_LNKCAP_CLKPM 0x40000 /* L1 Clock Power Management */
398#define PCI_EXP_LNKCTL 16 /* Link Control */ 402#define PCI_EXP_LNKCTL 16 /* Link Control */
403#define PCI_EXP_LNKCTL_RL 0x20 /* Retrain Link */
404#define PCI_EXP_LNKCTL_CCC 0x40 /* Common Clock COnfiguration */
399#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ 405#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */
400#define PCI_EXP_LNKSTA 18 /* Link Status */ 406#define PCI_EXP_LNKSTA 18 /* Link Status */
407#define PCI_EXP_LNKSTA_LT 0x800 /* Link Training */
408#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
401#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ 409#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
402#define PCI_EXP_SLTCTL 24 /* Slot Control */ 410#define PCI_EXP_SLTCTL 24 /* Slot Control */
403#define PCI_EXP_SLTSTA 26 /* Slot Status */ 411#define PCI_EXP_SLTSTA 26 /* Slot Status */
diff --git a/include/linux/pcounter.h b/include/linux/pcounter.h
deleted file mode 100644
index a82d9f2628ca..000000000000
--- a/include/linux/pcounter.h
+++ /dev/null
@@ -1,74 +0,0 @@
1#ifndef __LINUX_PCOUNTER_H
2#define __LINUX_PCOUNTER_H
3/*
4 * Using a dynamic percpu 'int' variable has a cost :
5 * 1) Extra dereference
6 * Current per_cpu_ptr() implementation uses an array per 'percpu variable'.
7 * 2) memory cost of NR_CPUS*(32+sizeof(void *)) instead of num_possible_cpus()*4
8 *
9 * This pcounter implementation is an abstraction to be able to use
10 * either a static or a dynamic per cpu variable.
11 * One dynamic per cpu variable gets a fast & cheap implementation, we can
12 * change pcounter implementation too.
13 */
14struct pcounter {
15#ifdef CONFIG_SMP
16 void (*add)(struct pcounter *self, int inc);
17 int (*getval)(const struct pcounter *self, int cpu);
18 int *per_cpu_values;
19#else
20 int val;
21#endif
22};
23
24#ifdef CONFIG_SMP
25#include <linux/percpu.h>
26
27#define DEFINE_PCOUNTER(NAME) \
28static DEFINE_PER_CPU(int, NAME##_pcounter_values); \
29static void NAME##_pcounter_add(struct pcounter *self, int val) \
30{ \
31 __get_cpu_var(NAME##_pcounter_values) += val; \
32} \
33static int NAME##_pcounter_getval(const struct pcounter *self, int cpu) \
34{ \
35 return per_cpu(NAME##_pcounter_values, cpu); \
36} \
37
38#define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER) \
39 MEMBER = { \
40 .add = NAME##_pcounter_add, \
41 .getval = NAME##_pcounter_getval, \
42 }
43
44
45static inline void pcounter_add(struct pcounter *self, int inc)
46{
47 self->add(self, inc);
48}
49
50extern int pcounter_getval(const struct pcounter *self);
51extern int pcounter_alloc(struct pcounter *self);
52extern void pcounter_free(struct pcounter *self);
53
54
55#else /* CONFIG_SMP */
56
57static inline void pcounter_add(struct pcounter *self, int inc)
58{
59 self->val += inc;
60}
61
62static inline int pcounter_getval(const struct pcounter *self)
63{
64 return self->val;
65}
66
67#define DEFINE_PCOUNTER(NAME)
68#define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER)
69#define pcounter_alloc(self) 0
70#define pcounter_free(self)
71
72#endif /* CONFIG_SMP */
73
74#endif /* __LINUX_PCOUNTER_H */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 1ac969724bb2..d746a2abb322 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -4,7 +4,6 @@
4#include <linux/preempt.h> 4#include <linux/preempt.h>
5#include <linux/slab.h> /* For kmalloc() */ 5#include <linux/slab.h> /* For kmalloc() */
6#include <linux/smp.h> 6#include <linux/smp.h>
7#include <linux/string.h> /* For memset() */
8#include <linux/cpumask.h> 7#include <linux/cpumask.h>
9 8
10#include <asm/percpu.h> 9#include <asm/percpu.h>
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 012cd558189b..a84e9ff9b27e 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -105,10 +105,6 @@ struct exec_domain {
105 */ 105 */
106#define personality(pers) (pers & PER_MASK) 106#define personality(pers) (pers & PER_MASK)
107 107
108/*
109 * Personality of the currently running process.
110 */
111#define get_personality (current->personality)
112 108
113/* 109/*
114 * Change personality of the currently running process. 110 * Change personality of the currently running process.
diff --git a/include/linux/phantom.h b/include/linux/phantom.h
index 96f4048a6cc3..02268c54c250 100644
--- a/include/linux/phantom.h
+++ b/include/linux/phantom.h
@@ -27,14 +27,17 @@ struct phm_regs {
27 27
28#define PH_IOC_MAGIC 'p' 28#define PH_IOC_MAGIC 'p'
29#define PHN_GET_REG _IOWR(PH_IOC_MAGIC, 0, struct phm_reg *) 29#define PHN_GET_REG _IOWR(PH_IOC_MAGIC, 0, struct phm_reg *)
30#define PHN_SET_REG _IOW (PH_IOC_MAGIC, 1, struct phm_reg *) 30#define PHN_SET_REG _IOW(PH_IOC_MAGIC, 1, struct phm_reg *)
31#define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *) 31#define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *)
32#define PHN_SET_REGS _IOW (PH_IOC_MAGIC, 3, struct phm_regs *) 32#define PHN_SET_REGS _IOW(PH_IOC_MAGIC, 3, struct phm_regs *)
33/* this ioctl tells the driver, that the caller is not OpenHaptics and might 33/* this ioctl tells the driver, that the caller is not OpenHaptics and might
34 * use improved registers update (no more phantom switchoffs when using 34 * use improved registers update (no more phantom switchoffs when using
35 * libphantom) */ 35 * libphantom) */
36#define PHN_NOT_OH _IO (PH_IOC_MAGIC, 4) 36#define PHN_NOT_OH _IO(PH_IOC_MAGIC, 4)
37#define PH_IOC_MAXNR 4 37#define PHN_GETREG _IOWR(PH_IOC_MAGIC, 5, struct phm_reg)
38#define PHN_SETREG _IOW(PH_IOC_MAGIC, 6, struct phm_reg)
39#define PHN_GETREGS _IOWR(PH_IOC_MAGIC, 7, struct phm_regs)
40#define PHN_SETREGS _IOW(PH_IOC_MAGIC, 8, struct phm_regs)
38 41
39#define PHN_CONTROL 0x6 /* control byte in iaddr space */ 42#define PHN_CONTROL 0x6 /* control byte in iaddr space */
40#define PHN_CTL_AMP 0x1 /* switch after torques change */ 43#define PHN_CTL_AMP 0x1 /* switch after torques change */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 5e43ae751412..02df20f085fe 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -39,7 +39,8 @@
39 SUPPORTED_1000baseT_Half | \ 39 SUPPORTED_1000baseT_Half | \
40 SUPPORTED_1000baseT_Full) 40 SUPPORTED_1000baseT_Full)
41 41
42/* Set phydev->irq to PHY_POLL if interrupts are not supported, 42/*
43 * Set phydev->irq to PHY_POLL if interrupts are not supported,
43 * or not desired for this PHY. Set to PHY_IGNORE_INTERRUPT if 44 * or not desired for this PHY. Set to PHY_IGNORE_INTERRUPT if
44 * the attached driver handles the interrupt 45 * the attached driver handles the interrupt
45 */ 46 */
@@ -63,8 +64,6 @@ typedef enum {
63 PHY_INTERFACE_MODE_RTBI 64 PHY_INTERFACE_MODE_RTBI
64} phy_interface_t; 65} phy_interface_t;
65 66
66#define MII_BUS_MAX 4
67
68 67
69#define PHY_INIT_TIMEOUT 100000 68#define PHY_INIT_TIMEOUT 100000
70#define PHY_STATE_TIME 1 69#define PHY_STATE_TIME 1
@@ -74,20 +73,30 @@ typedef enum {
74#define PHY_MAX_ADDR 32 73#define PHY_MAX_ADDR 32
75 74
76/* Used when trying to connect to a specific phy (mii bus id:phy device id) */ 75/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
77#define PHY_ID_FMT "%x:%02x" 76#define PHY_ID_FMT "%s:%02x"
77
78/*
79 * Need to be a little smaller than phydev->dev.bus_id to leave room
80 * for the ":%02x"
81 */
82#define MII_BUS_ID_SIZE (BUS_ID_SIZE - 3)
78 83
79/* The Bus class for PHYs. Devices which provide access to 84/*
80 * PHYs should register using this structure */ 85 * The Bus class for PHYs. Devices which provide access to
86 * PHYs should register using this structure
87 */
81struct mii_bus { 88struct mii_bus {
82 const char *name; 89 const char *name;
83 int id; 90 char id[MII_BUS_ID_SIZE];
84 void *priv; 91 void *priv;
85 int (*read)(struct mii_bus *bus, int phy_id, int regnum); 92 int (*read)(struct mii_bus *bus, int phy_id, int regnum);
86 int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val); 93 int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val);
87 int (*reset)(struct mii_bus *bus); 94 int (*reset)(struct mii_bus *bus);
88 95
89 /* A lock to ensure that only one thing can read/write 96 /*
90 * the MDIO bus at a time */ 97 * A lock to ensure that only one thing can read/write
98 * the MDIO bus at a time
99 */
91 struct mutex mdio_lock; 100 struct mutex mdio_lock;
92 101
93 struct device *dev; 102 struct device *dev;
@@ -98,8 +107,10 @@ struct mii_bus {
98 /* Phy addresses to be ignored when probing */ 107 /* Phy addresses to be ignored when probing */
99 u32 phy_mask; 108 u32 phy_mask;
100 109
101 /* Pointer to an array of interrupts, each PHY's 110 /*
102 * interrupt at the index matching its address */ 111 * Pointer to an array of interrupts, each PHY's
112 * interrupt at the index matching its address
113 */
103 int *irq; 114 int *irq;
104}; 115};
105 116
@@ -251,7 +262,8 @@ struct phy_device {
251 /* Bus address of the PHY (0-32) */ 262 /* Bus address of the PHY (0-32) */
252 int addr; 263 int addr;
253 264
254 /* forced speed & duplex (no autoneg) 265 /*
266 * forced speed & duplex (no autoneg)
255 * partner speed & duplex & pause (autoneg) 267 * partner speed & duplex & pause (autoneg)
256 */ 268 */
257 int speed; 269 int speed;
@@ -274,8 +286,10 @@ struct phy_device {
274 286
275 int link_timeout; 287 int link_timeout;
276 288
277 /* Interrupt number for this PHY 289 /*
278 * -1 means no interrupt */ 290 * Interrupt number for this PHY
291 * -1 means no interrupt
292 */
279 int irq; 293 int irq;
280 294
281 /* private data pointer */ 295 /* private data pointer */
@@ -325,22 +339,28 @@ struct phy_driver {
325 u32 features; 339 u32 features;
326 u32 flags; 340 u32 flags;
327 341
328 /* Called to initialize the PHY, 342 /*
329 * including after a reset */ 343 * Called to initialize the PHY,
344 * including after a reset
345 */
330 int (*config_init)(struct phy_device *phydev); 346 int (*config_init)(struct phy_device *phydev);
331 347
332 /* Called during discovery. Used to set 348 /*
333 * up device-specific structures, if any */ 349 * Called during discovery. Used to set
350 * up device-specific structures, if any
351 */
334 int (*probe)(struct phy_device *phydev); 352 int (*probe)(struct phy_device *phydev);
335 353
336 /* PHY Power Management */ 354 /* PHY Power Management */
337 int (*suspend)(struct phy_device *phydev); 355 int (*suspend)(struct phy_device *phydev);
338 int (*resume)(struct phy_device *phydev); 356 int (*resume)(struct phy_device *phydev);
339 357
340 /* Configures the advertisement and resets 358 /*
359 * Configures the advertisement and resets
341 * autonegotiation if phydev->autoneg is on, 360 * autonegotiation if phydev->autoneg is on,
342 * forces the speed to the current settings in phydev 361 * forces the speed to the current settings in phydev
343 * if phydev->autoneg is off */ 362 * if phydev->autoneg is off
363 */
344 int (*config_aneg)(struct phy_device *phydev); 364 int (*config_aneg)(struct phy_device *phydev);
345 365
346 /* Determines the negotiated speed and duplex */ 366 /* Determines the negotiated speed and duplex */
@@ -359,14 +379,27 @@ struct phy_driver {
359}; 379};
360#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 380#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
361 381
382#define PHY_ANY_ID "MATCH ANY PHY"
383#define PHY_ANY_UID 0xffffffff
384
385/* A Structure for boards to register fixups with the PHY Lib */
386struct phy_fixup {
387 struct list_head list;
388 char bus_id[BUS_ID_SIZE];
389 u32 phy_uid;
390 u32 phy_uid_mask;
391 int (*run)(struct phy_device *phydev);
392};
393
362int phy_read(struct phy_device *phydev, u16 regnum); 394int phy_read(struct phy_device *phydev, u16 regnum);
363int phy_write(struct phy_device *phydev, u16 regnum, u16 val); 395int phy_write(struct phy_device *phydev, u16 regnum, u16 val);
396int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
364struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 397struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
365int phy_clear_interrupt(struct phy_device *phydev); 398int phy_clear_interrupt(struct phy_device *phydev);
366int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 399int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
367struct phy_device * phy_attach(struct net_device *dev, 400struct phy_device * phy_attach(struct net_device *dev,
368 const char *phy_id, u32 flags, phy_interface_t interface); 401 const char *bus_id, u32 flags, phy_interface_t interface);
369struct phy_device * phy_connect(struct net_device *dev, const char *phy_id, 402struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
370 void (*handler)(struct net_device *), u32 flags, 403 void (*handler)(struct net_device *), u32 flags,
371 phy_interface_t interface); 404 phy_interface_t interface);
372void phy_disconnect(struct phy_device *phydev); 405void phy_disconnect(struct phy_device *phydev);
@@ -406,5 +439,13 @@ void phy_print_status(struct phy_device *phydev);
406struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); 439struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
407void phy_device_free(struct phy_device *phydev); 440void phy_device_free(struct phy_device *phydev);
408 441
442int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
443 int (*run)(struct phy_device *));
444int phy_register_fixup_for_id(const char *bus_id,
445 int (*run)(struct phy_device *));
446int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
447 int (*run)(struct phy_device *));
448int phy_scan_fixups(struct phy_device *phydev);
449
409extern struct bus_type mdio_bus_type; 450extern struct bus_type mdio_bus_type;
410#endif /* __PHY_H */ 451#endif /* __PHY_H */
diff --git a/include/linux/pid.h b/include/linux/pid.h
index c7980810eb09..c21c7e8124a7 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -60,7 +60,7 @@ struct pid
60 /* lists of tasks that use this pid */ 60 /* lists of tasks that use this pid */
61 struct hlist_head tasks[PIDTYPE_MAX]; 61 struct hlist_head tasks[PIDTYPE_MAX];
62 struct rcu_head rcu; 62 struct rcu_head rcu;
63 int level; 63 unsigned int level;
64 struct upid numbers[1]; 64 struct upid numbers[1];
65}; 65};
66 66
@@ -89,9 +89,11 @@ extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);
89 * attach_pid() and detach_pid() must be called with the tasklist_lock 89 * attach_pid() and detach_pid() must be called with the tasklist_lock
90 * write-held. 90 * write-held.
91 */ 91 */
92extern int attach_pid(struct task_struct *task, enum pid_type type, 92extern void attach_pid(struct task_struct *task, enum pid_type type,
93 struct pid *pid); 93 struct pid *pid);
94extern void detach_pid(struct task_struct *task, enum pid_type); 94extern void detach_pid(struct task_struct *task, enum pid_type);
95extern void change_pid(struct task_struct *task, enum pid_type,
96 struct pid *pid);
95extern void transfer_pid(struct task_struct *old, struct task_struct *new, 97extern void transfer_pid(struct task_struct *old, struct task_struct *new,
96 enum pid_type); 98 enum pid_type);
97 99
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index fcd61fa2c833..caff5283d15c 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -20,7 +20,7 @@ struct pid_namespace {
20 int last_pid; 20 int last_pid;
21 struct task_struct *child_reaper; 21 struct task_struct *child_reaper;
22 struct kmem_cache *pid_cachep; 22 struct kmem_cache *pid_cachep;
23 int level; 23 unsigned int level;
24 struct pid_namespace *parent; 24 struct pid_namespace *parent;
25#ifdef CONFIG_PROC_FS 25#ifdef CONFIG_PROC_FS
26 struct vfsmount *proc_mnt; 26 struct vfsmount *proc_mnt;
diff --git a/include/linux/pim.h b/include/linux/pim.h
new file mode 100644
index 000000000000..236ffd317394
--- /dev/null
+++ b/include/linux/pim.h
@@ -0,0 +1,45 @@
1#ifndef __LINUX_PIM_H
2#define __LINUX_PIM_H
3
4#include <asm/byteorder.h>
5
6#ifndef __KERNEL__
7struct pim {
8#if defined(__LITTLE_ENDIAN_BITFIELD)
9 __u8 pim_type:4, /* PIM message type */
10 pim_ver:4; /* PIM version */
11#elif defined(__BIG_ENDIAN_BITFIELD)
12 __u8 pim_ver:4; /* PIM version */
13 pim_type:4; /* PIM message type */
14#endif
15 __u8 pim_rsv; /* Reserved */
16 __be16 pim_cksum; /* Checksum */
17};
18
19#define PIM_MINLEN 8
20#endif
21
22/* Message types - V1 */
23#define PIM_V1_VERSION __constant_htonl(0x10000000)
24#define PIM_V1_REGISTER 1
25
26/* Message types - V2 */
27#define PIM_VERSION 2
28#define PIM_REGISTER 1
29
30#if defined(__KERNEL__)
31#define PIM_NULL_REGISTER __constant_htonl(0x40000000)
32
33/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
34struct pimreghdr
35{
36 __u8 type;
37 __u8 reserved;
38 __be16 csum;
39 __be32 flags;
40};
41
42struct sk_buff;
43extern int pim_rcv_v1(struct sk_buff *);
44#endif
45#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 015b735811b4..39a7ee859b67 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -21,8 +21,6 @@
21#ifndef _LINUX_PM_H 21#ifndef _LINUX_PM_H
22#define _LINUX_PM_H 22#define _LINUX_PM_H
23 23
24#ifdef __KERNEL__
25
26#include <linux/list.h> 24#include <linux/list.h>
27#include <asm/atomic.h> 25#include <asm/atomic.h>
28#include <asm/errno.h> 26#include <asm/errno.h>
@@ -183,8 +181,9 @@ typedef struct pm_message {
183struct dev_pm_info { 181struct dev_pm_info {
184 pm_message_t power_state; 182 pm_message_t power_state;
185 unsigned can_wakeup:1; 183 unsigned can_wakeup:1;
186#ifdef CONFIG_PM_SLEEP
187 unsigned should_wakeup:1; 184 unsigned should_wakeup:1;
185 bool sleeping:1; /* Owned by the PM core */
186#ifdef CONFIG_PM_SLEEP
188 struct list_head entry; 187 struct list_head entry;
189#endif 188#endif
190}; 189};
@@ -197,11 +196,6 @@ extern void device_resume(void);
197extern int device_suspend(pm_message_t state); 196extern int device_suspend(pm_message_t state);
198extern int device_prepare_suspend(pm_message_t state); 197extern int device_prepare_suspend(pm_message_t state);
199 198
200#define device_set_wakeup_enable(dev,val) \
201 ((dev)->power.should_wakeup = !!(val))
202#define device_may_wakeup(dev) \
203 (device_can_wakeup(dev) && (dev)->power.should_wakeup)
204
205extern void __suspend_report_result(const char *function, void *fn, int ret); 199extern void __suspend_report_result(const char *function, void *fn, int ret);
206 200
207#define suspend_report_result(fn, ret) \ 201#define suspend_report_result(fn, ret) \
@@ -209,20 +203,6 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
209 __suspend_report_result(__FUNCTION__, fn, ret); \ 203 __suspend_report_result(__FUNCTION__, fn, ret); \
210 } while (0) 204 } while (0)
211 205
212/*
213 * Platform hook to activate device wakeup capability, if that's not already
214 * handled by enable_irq_wake() etc.
215 * Returns zero on success, else negative errno
216 */
217extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
218
219static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
220{
221 if (platform_enable_wakeup)
222 return (*platform_enable_wakeup)(dev, is_on);
223 return 0;
224}
225
226#else /* !CONFIG_PM_SLEEP */ 206#else /* !CONFIG_PM_SLEEP */
227 207
228static inline int device_suspend(pm_message_t state) 208static inline int device_suspend(pm_message_t state)
@@ -230,29 +210,10 @@ static inline int device_suspend(pm_message_t state)
230 return 0; 210 return 0;
231} 211}
232 212
233#define device_set_wakeup_enable(dev,val) do{}while(0) 213#define suspend_report_result(fn, ret) do {} while (0)
234#define device_may_wakeup(dev) (0)
235
236#define suspend_report_result(fn, ret) do { } while (0)
237
238static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
239{
240 return 0;
241}
242 214
243#endif /* !CONFIG_PM_SLEEP */ 215#endif /* !CONFIG_PM_SLEEP */
244 216
245/* changes to device_may_wakeup take effect on the next pm state change.
246 * by default, devices should wakeup if they can.
247 */
248#define device_can_wakeup(dev) \
249 ((dev)->power.can_wakeup)
250#define device_init_wakeup(dev,val) \
251 do { \
252 device_can_wakeup(dev) = !!(val); \
253 device_set_wakeup_enable(dev,val); \
254 } while(0)
255
256/* 217/*
257 * Global Power Management flags 218 * Global Power Management flags
258 * Used to keep APM and ACPI from both being active 219 * Used to keep APM and ACPI from both being active
@@ -262,6 +223,4 @@ extern unsigned int pm_flags;
262#define PM_APM 1 223#define PM_APM 1
263#define PM_ACPI 2 224#define PM_ACPI 2
264 225
265#endif /* __KERNEL__ */
266
267#endif /* _LINUX_PM_H */ 226#endif /* _LINUX_PM_H */
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
new file mode 100644
index 000000000000..f0d0b2cb8d20
--- /dev/null
+++ b/include/linux/pm_wakeup.h
@@ -0,0 +1,90 @@
1/*
2 * pm_wakeup.h - Power management wakeup interface
3 *
4 * Copyright (C) 2008 Alan Stern
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _LINUX_PM_WAKEUP_H
22#define _LINUX_PM_WAKEUP_H
23
24#ifndef _DEVICE_H_
25# error "please don't include this file directly"
26#endif
27
28#ifdef CONFIG_PM
29
30/* changes to device_may_wakeup take effect on the next pm state change.
31 * by default, devices should wakeup if they can.
32 */
33static inline void device_init_wakeup(struct device *dev, int val)
34{
35 dev->power.can_wakeup = dev->power.should_wakeup = !!val;
36}
37
38static inline int device_can_wakeup(struct device *dev)
39{
40 return dev->power.can_wakeup;
41}
42
43static inline void device_set_wakeup_enable(struct device *dev, int val)
44{
45 dev->power.should_wakeup = !!val;
46}
47
48static inline int device_may_wakeup(struct device *dev)
49{
50 return dev->power.can_wakeup & dev->power.should_wakeup;
51}
52
53/*
54 * Platform hook to activate device wakeup capability, if that's not already
55 * handled by enable_irq_wake() etc.
56 * Returns zero on success, else negative errno
57 */
58extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
59
60static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
61{
62 if (platform_enable_wakeup)
63 return (*platform_enable_wakeup)(dev, is_on);
64 return 0;
65}
66
67#else /* !CONFIG_PM */
68
69/* For some reason the next two routines work even without CONFIG_PM */
70static inline void device_init_wakeup(struct device *dev, int val)
71{
72 dev->power.can_wakeup = !!val;
73}
74
75static inline int device_can_wakeup(struct device *dev)
76{
77 return dev->power.can_wakeup;
78}
79
80#define device_set_wakeup_enable(dev, val) do {} while (0)
81#define device_may_wakeup(dev) 0
82
83static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
84{
85 return 0;
86}
87
88#endif /* !CONFIG_PM */
89
90#endif /* _LINUX_PM_WAKEUP_H */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index b2f05c230f4b..63b128d512fb 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -6,66 +6,127 @@
6#ifndef _LINUX_PNP_H 6#ifndef _LINUX_PNP_H
7#define _LINUX_PNP_H 7#define _LINUX_PNP_H
8 8
9#ifdef __KERNEL__
10
11#include <linux/device.h> 9#include <linux/device.h>
12#include <linux/list.h> 10#include <linux/list.h>
13#include <linux/errno.h> 11#include <linux/errno.h>
14#include <linux/mod_devicetable.h> 12#include <linux/mod_devicetable.h>
15 13
16#define PNP_MAX_PORT 40
17#define PNP_MAX_MEM 24
18#define PNP_MAX_IRQ 2
19#define PNP_MAX_DMA 2
20#define PNP_NAME_LEN 50 14#define PNP_NAME_LEN 50
21 15
22struct pnp_protocol; 16struct pnp_protocol;
23struct pnp_dev; 17struct pnp_dev;
18struct pnp_resource_table;
24 19
25/* 20/*
26 * Resource Management 21 * Resource Management
27 */ 22 */
23struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int);
24
25static inline int pnp_resource_valid(struct resource *res)
26{
27 if (res && !(res->flags & IORESOURCE_UNSET))
28 return 1;
29 return 0;
30}
31
32static inline resource_size_t pnp_resource_len(struct resource *res)
33{
34 if (res->start == 0 && res->end == 0)
35 return 0;
36 return res->end - res->start + 1;
37}
38
39
40static inline resource_size_t pnp_port_start(struct pnp_dev *dev,
41 unsigned int bar)
42{
43 return pnp_get_resource(dev, IORESOURCE_IO, bar)->start;
44}
45
46static inline resource_size_t pnp_port_end(struct pnp_dev *dev,
47 unsigned int bar)
48{
49 return pnp_get_resource(dev, IORESOURCE_IO, bar)->end;
50}
51
52static inline unsigned long pnp_port_flags(struct pnp_dev *dev,
53 unsigned int bar)
54{
55 return pnp_get_resource(dev, IORESOURCE_IO, bar)->flags;
56}
57
58static inline int pnp_port_valid(struct pnp_dev *dev, unsigned int bar)
59{
60 return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_IO, bar));
61}
62
63static inline resource_size_t pnp_port_len(struct pnp_dev *dev,
64 unsigned int bar)
65{
66 return pnp_resource_len(pnp_get_resource(dev, IORESOURCE_IO, bar));
67}
68
69
70static inline resource_size_t pnp_mem_start(struct pnp_dev *dev,
71 unsigned int bar)
72{
73 return pnp_get_resource(dev, IORESOURCE_MEM, bar)->start;
74}
75
76static inline resource_size_t pnp_mem_end(struct pnp_dev *dev,
77 unsigned int bar)
78{
79 return pnp_get_resource(dev, IORESOURCE_MEM, bar)->end;
80}
81
82static inline unsigned long pnp_mem_flags(struct pnp_dev *dev, unsigned int bar)
83{
84 return pnp_get_resource(dev, IORESOURCE_MEM, bar)->flags;
85}
86
87static inline int pnp_mem_valid(struct pnp_dev *dev, unsigned int bar)
88{
89 return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_MEM, bar));
90}
91
92static inline resource_size_t pnp_mem_len(struct pnp_dev *dev,
93 unsigned int bar)
94{
95 return pnp_resource_len(pnp_get_resource(dev, IORESOURCE_MEM, bar));
96}
97
98
99static inline resource_size_t pnp_irq(struct pnp_dev *dev, unsigned int bar)
100{
101 return pnp_get_resource(dev, IORESOURCE_IRQ, bar)->start;
102}
103
104static inline unsigned long pnp_irq_flags(struct pnp_dev *dev, unsigned int bar)
105{
106 return pnp_get_resource(dev, IORESOURCE_IRQ, bar)->flags;
107}
108
109static inline int pnp_irq_valid(struct pnp_dev *dev, unsigned int bar)
110{
111 return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_IRQ, bar));
112}
113
114
115static inline resource_size_t pnp_dma(struct pnp_dev *dev, unsigned int bar)
116{
117 return pnp_get_resource(dev, IORESOURCE_DMA, bar)->start;
118}
119
120static inline unsigned long pnp_dma_flags(struct pnp_dev *dev, unsigned int bar)
121{
122 return pnp_get_resource(dev, IORESOURCE_DMA, bar)->flags;
123}
124
125static inline int pnp_dma_valid(struct pnp_dev *dev, unsigned int bar)
126{
127 return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_DMA, bar));
128}
28 129
29/* Use these instead of directly reading pnp_dev to get resource information */
30#define pnp_port_start(dev,bar) ((dev)->res.port_resource[(bar)].start)
31#define pnp_port_end(dev,bar) ((dev)->res.port_resource[(bar)].end)
32#define pnp_port_flags(dev,bar) ((dev)->res.port_resource[(bar)].flags)
33#define pnp_port_valid(dev,bar) \
34 ((pnp_port_flags((dev),(bar)) & (IORESOURCE_IO | IORESOURCE_UNSET)) \
35 == IORESOURCE_IO)
36#define pnp_port_len(dev,bar) \
37 ((pnp_port_start((dev),(bar)) == 0 && \
38 pnp_port_end((dev),(bar)) == \
39 pnp_port_start((dev),(bar))) ? 0 : \
40 \
41 (pnp_port_end((dev),(bar)) - \
42 pnp_port_start((dev),(bar)) + 1))
43
44#define pnp_mem_start(dev,bar) ((dev)->res.mem_resource[(bar)].start)
45#define pnp_mem_end(dev,bar) ((dev)->res.mem_resource[(bar)].end)
46#define pnp_mem_flags(dev,bar) ((dev)->res.mem_resource[(bar)].flags)
47#define pnp_mem_valid(dev,bar) \
48 ((pnp_mem_flags((dev),(bar)) & (IORESOURCE_MEM | IORESOURCE_UNSET)) \
49 == IORESOURCE_MEM)
50#define pnp_mem_len(dev,bar) \
51 ((pnp_mem_start((dev),(bar)) == 0 && \
52 pnp_mem_end((dev),(bar)) == \
53 pnp_mem_start((dev),(bar))) ? 0 : \
54 \
55 (pnp_mem_end((dev),(bar)) - \
56 pnp_mem_start((dev),(bar)) + 1))
57
58#define pnp_irq(dev,bar) ((dev)->res.irq_resource[(bar)].start)
59#define pnp_irq_flags(dev,bar) ((dev)->res.irq_resource[(bar)].flags)
60#define pnp_irq_valid(dev,bar) \
61 ((pnp_irq_flags((dev),(bar)) & (IORESOURCE_IRQ | IORESOURCE_UNSET)) \
62 == IORESOURCE_IRQ)
63
64#define pnp_dma(dev,bar) ((dev)->res.dma_resource[(bar)].start)
65#define pnp_dma_flags(dev,bar) ((dev)->res.dma_resource[(bar)].flags)
66#define pnp_dma_valid(dev,bar) \
67 ((pnp_dma_flags((dev),(bar)) & (IORESOURCE_DMA | IORESOURCE_UNSET)) \
68 == IORESOURCE_DMA)
69 130
70#define PNP_PORT_FLAG_16BITADDR (1<<0) 131#define PNP_PORT_FLAG_16BITADDR (1<<0)
71#define PNP_PORT_FLAG_FIXED (1<<1) 132#define PNP_PORT_FLAG_FIXED (1<<1)
@@ -118,13 +179,6 @@ struct pnp_option {
118 struct pnp_option *next; /* used to chain dependent resources */ 179 struct pnp_option *next; /* used to chain dependent resources */
119}; 180};
120 181
121struct pnp_resource_table {
122 struct resource port_resource[PNP_MAX_PORT];
123 struct resource mem_resource[PNP_MAX_MEM];
124 struct resource dma_resource[PNP_MAX_DMA];
125 struct resource irq_resource[PNP_MAX_IRQ];
126};
127
128/* 182/*
129 * Device Management 183 * Device Management
130 */ 184 */
@@ -194,10 +248,9 @@ struct pnp_dev {
194 int capabilities; 248 int capabilities;
195 struct pnp_option *independent; 249 struct pnp_option *independent;
196 struct pnp_option *dependent; 250 struct pnp_option *dependent;
197 struct pnp_resource_table res; 251 struct pnp_resource_table *res;
198 252
199 char name[PNP_NAME_LEN]; /* contains a human-readable name */ 253 char name[PNP_NAME_LEN]; /* contains a human-readable name */
200 unsigned short regs; /* ISAPnP: supported registers */
201 int flags; /* used by protocols */ 254 int flags; /* used by protocols */
202 struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */ 255 struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */
203 void *data; 256 void *data;
@@ -328,8 +381,8 @@ struct pnp_protocol {
328 char *name; 381 char *name;
329 382
330 /* resource control functions */ 383 /* resource control functions */
331 int (*get) (struct pnp_dev *dev, struct pnp_resource_table *res); 384 int (*get) (struct pnp_dev *dev);
332 int (*set) (struct pnp_dev *dev, struct pnp_resource_table *res); 385 int (*set) (struct pnp_dev *dev);
333 int (*disable) (struct pnp_dev *dev); 386 int (*disable) (struct pnp_dev *dev);
334 387
335 /* protocol specific suspend/resume */ 388 /* protocol specific suspend/resume */
@@ -358,20 +411,12 @@ extern struct bus_type pnp_bus_type;
358#if defined(CONFIG_PNP) 411#if defined(CONFIG_PNP)
359 412
360/* device management */ 413/* device management */
361int pnp_register_protocol(struct pnp_protocol *protocol);
362void pnp_unregister_protocol(struct pnp_protocol *protocol);
363int pnp_add_device(struct pnp_dev *dev);
364int pnp_device_attach(struct pnp_dev *pnp_dev); 414int pnp_device_attach(struct pnp_dev *pnp_dev);
365void pnp_device_detach(struct pnp_dev *pnp_dev); 415void pnp_device_detach(struct pnp_dev *pnp_dev);
366extern struct list_head pnp_global; 416extern struct list_head pnp_global;
367extern int pnp_platform_devices; 417extern int pnp_platform_devices;
368 418
369/* multidevice card support */ 419/* multidevice card support */
370int pnp_add_card(struct pnp_card *card);
371void pnp_remove_card(struct pnp_card *card);
372int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev);
373void pnp_remove_card_device(struct pnp_dev *dev);
374int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card);
375struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, 420struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
376 const char *id, struct pnp_dev *from); 421 const char *id, struct pnp_dev *from);
377void pnp_release_card_device(struct pnp_dev *dev); 422void pnp_release_card_device(struct pnp_dev *dev);
@@ -380,77 +425,42 @@ void pnp_unregister_card_driver(struct pnp_card_driver *drv);
380extern struct list_head pnp_cards; 425extern struct list_head pnp_cards;
381 426
382/* resource management */ 427/* resource management */
383struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev);
384struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
385 int priority);
386int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data);
387int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data);
388int pnp_register_port_resource(struct pnp_option *option,
389 struct pnp_port *data);
390int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data);
391void pnp_init_resource_table(struct pnp_resource_table *table);
392int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
393 int mode);
394int pnp_auto_config_dev(struct pnp_dev *dev); 428int pnp_auto_config_dev(struct pnp_dev *dev);
395int pnp_validate_config(struct pnp_dev *dev);
396int pnp_start_dev(struct pnp_dev *dev); 429int pnp_start_dev(struct pnp_dev *dev);
397int pnp_stop_dev(struct pnp_dev *dev); 430int pnp_stop_dev(struct pnp_dev *dev);
398int pnp_activate_dev(struct pnp_dev *dev); 431int pnp_activate_dev(struct pnp_dev *dev);
399int pnp_disable_dev(struct pnp_dev *dev); 432int pnp_disable_dev(struct pnp_dev *dev);
400void pnp_resource_change(struct resource *resource, resource_size_t start,
401 resource_size_t size);
402 433
403/* protocol helpers */ 434/* protocol helpers */
404int pnp_is_active(struct pnp_dev *dev); 435int pnp_is_active(struct pnp_dev *dev);
405int compare_pnp_id(struct pnp_id *pos, const char *id); 436int compare_pnp_id(struct pnp_id *pos, const char *id);
406int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev);
407int pnp_register_driver(struct pnp_driver *drv); 437int pnp_register_driver(struct pnp_driver *drv);
408void pnp_unregister_driver(struct pnp_driver *drv); 438void pnp_unregister_driver(struct pnp_driver *drv);
409 439
410#else 440#else
411 441
412/* device management */ 442/* device management */
413static inline int pnp_register_protocol(struct pnp_protocol *protocol) { return -ENODEV; }
414static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { }
415static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; }
416static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; }
417static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } 443static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; }
418static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { } 444static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { }
419 445
420#define pnp_platform_devices 0 446#define pnp_platform_devices 0
421 447
422/* multidevice card support */ 448/* multidevice card support */
423static inline int pnp_add_card(struct pnp_card *card) { return -ENODEV; }
424static inline void pnp_remove_card(struct pnp_card *card) { }
425static inline int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; }
426static inline void pnp_remove_card_device(struct pnp_dev *dev) { }
427static inline int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; }
428static inline struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, const char *id, struct pnp_dev *from) { return NULL; } 449static inline struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, const char *id, struct pnp_dev *from) { return NULL; }
429static inline void pnp_release_card_device(struct pnp_dev *dev) { } 450static inline void pnp_release_card_device(struct pnp_dev *dev) { }
430static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return -ENODEV; } 451static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return -ENODEV; }
431static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { } 452static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { }
432 453
433/* resource management */ 454/* resource management */
434static inline struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) { return NULL; }
435static inline struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; }
436static inline int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) { return -ENODEV; }
437static inline int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; }
438static inline int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) { return -ENODEV; }
439static inline int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data) { return -ENODEV; }
440static inline void pnp_init_resource_table(struct pnp_resource_table *table) { }
441static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; }
442static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } 455static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; }
443static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; }
444static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; } 456static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
445static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } 457static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
446static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 458static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
447static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 459static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
448static inline void pnp_resource_change(struct resource *resource, resource_size_t start, resource_size_t size) { }
449 460
450/* protocol helpers */ 461/* protocol helpers */
451static inline int pnp_is_active(struct pnp_dev *dev) { return 0; } 462static inline int pnp_is_active(struct pnp_dev *dev) { return 0; }
452static inline int compare_pnp_id(struct pnp_id *pos, const char *id) { return -ENODEV; } 463static inline int compare_pnp_id(struct pnp_id *pos, const char *id) { return -ENODEV; }
453static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; }
454static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; } 464static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; }
455static inline void pnp_unregister_driver(struct pnp_driver *drv) { } 465static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
456 466
@@ -466,6 +476,4 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
466#define pnp_dbg(format, arg...) do {} while (0) 476#define pnp_dbg(format, arg...) do {} while (0)
467#endif 477#endif
468 478
469#endif /* __KERNEL__ */
470
471#endif /* _LINUX_PNP_H */ 479#endif /* _LINUX_PNP_H */
diff --git a/include/linux/pnpbios.h b/include/linux/pnpbios.h
deleted file mode 100644
index 329192adc9dd..000000000000
--- a/include/linux/pnpbios.h
+++ /dev/null
@@ -1,151 +0,0 @@
1/*
2 * Include file for the interface to a PnP BIOS
3 *
4 * Original BIOS code (C) 1998 Christian Schmidt (chr.schmidt@tu-bs.de)
5 * PnP handler parts (c) 1998 Tom Lees <tom@lpsg.demon.co.uk>
6 * Minor reorganizations by David Hinds <dahinds@users.sourceforge.net>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef _LINUX_PNPBIOS_H
24#define _LINUX_PNPBIOS_H
25
26#ifdef __KERNEL__
27
28#include <linux/types.h>
29#include <linux/pnp.h>
30
31/*
32 * Return codes
33 */
34#define PNP_SUCCESS 0x00
35#define PNP_NOT_SET_STATICALLY 0x7f
36#define PNP_UNKNOWN_FUNCTION 0x81
37#define PNP_FUNCTION_NOT_SUPPORTED 0x82
38#define PNP_INVALID_HANDLE 0x83
39#define PNP_BAD_PARAMETER 0x84
40#define PNP_SET_FAILED 0x85
41#define PNP_EVENTS_NOT_PENDING 0x86
42#define PNP_SYSTEM_NOT_DOCKED 0x87
43#define PNP_NO_ISA_PNP_CARDS 0x88
44#define PNP_UNABLE_TO_DETERMINE_DOCK_CAPABILITIES 0x89
45#define PNP_CONFIG_CHANGE_FAILED_NO_BATTERY 0x8a
46#define PNP_CONFIG_CHANGE_FAILED_RESOURCE_CONFLICT 0x8b
47#define PNP_BUFFER_TOO_SMALL 0x8c
48#define PNP_USE_ESCD_SUPPORT 0x8d
49#define PNP_MESSAGE_NOT_SUPPORTED 0x8e
50#define PNP_HARDWARE_ERROR 0x8f
51
52#define ESCD_SUCCESS 0x00
53#define ESCD_IO_ERROR_READING 0x55
54#define ESCD_INVALID 0x56
55#define ESCD_BUFFER_TOO_SMALL 0x59
56#define ESCD_NVRAM_TOO_SMALL 0x5a
57#define ESCD_FUNCTION_NOT_SUPPORTED 0x81
58
59/*
60 * Events that can be received by "get event"
61 */
62#define PNPEV_ABOUT_TO_CHANGE_CONFIG 0x0001
63#define PNPEV_DOCK_CHANGED 0x0002
64#define PNPEV_SYSTEM_DEVICE_CHANGED 0x0003
65#define PNPEV_CONFIG_CHANGED_FAILED 0x0004
66#define PNPEV_UNKNOWN_SYSTEM_EVENT 0xffff
67/* 0x8000 through 0xfffe are OEM defined */
68
69/*
70 * Messages that should be sent through "send message"
71 */
72#define PNPMSG_OK 0x00
73#define PNPMSG_ABORT 0x01
74#define PNPMSG_UNDOCK_DEFAULT_ACTION 0x40
75#define PNPMSG_POWER_OFF 0x41
76#define PNPMSG_PNP_OS_ACTIVE 0x42
77#define PNPMSG_PNP_OS_INACTIVE 0x43
78
79/*
80 * Plug and Play BIOS flags
81 */
82#define PNPBIOS_NO_DISABLE 0x0001
83#define PNPBIOS_NO_CONFIG 0x0002
84#define PNPBIOS_OUTPUT 0x0004
85#define PNPBIOS_INPUT 0x0008
86#define PNPBIOS_BOOTABLE 0x0010
87#define PNPBIOS_DOCK 0x0020
88#define PNPBIOS_REMOVABLE 0x0040
89#define pnpbios_is_static(x) (((x)->flags & 0x0100) == 0x0000)
90#define pnpbios_is_dynamic(x) ((x)->flags & 0x0080)
91
92/*
93 * Function Parameters
94 */
95#define PNPMODE_STATIC 1
96#define PNPMODE_DYNAMIC 0
97
98/* 0x8000 through 0xffff are OEM defined */
99
100#pragma pack(1)
101struct pnp_dev_node_info {
102 __u16 no_nodes;
103 __u16 max_node_size;
104};
105struct pnp_docking_station_info {
106 __u32 location_id;
107 __u32 serial;
108 __u16 capabilities;
109};
110struct pnp_isa_config_struc {
111 __u8 revision;
112 __u8 no_csns;
113 __u16 isa_rd_data_port;
114 __u16 reserved;
115};
116struct escd_info_struc {
117 __u16 min_escd_write_size;
118 __u16 escd_size;
119 __u32 nv_storage_base;
120};
121struct pnp_bios_node {
122 __u16 size;
123 __u8 handle;
124 __u32 eisa_id;
125 __u8 type_code[3];
126 __u16 flags;
127 __u8 data[0];
128};
129#pragma pack()
130
131#ifdef CONFIG_PNPBIOS
132
133/* non-exported */
134extern struct pnp_dev_node_info node_info;
135
136extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data);
137extern int pnp_bios_get_dev_node(u8 *nodenum, char config,
138 struct pnp_bios_node *data);
139extern int pnp_bios_set_dev_node(u8 nodenum, char config,
140 struct pnp_bios_node *data);
141extern int pnp_bios_get_stat_res(char *info);
142extern int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data);
143extern int pnp_bios_escd_info(struct escd_info_struc *data);
144extern int pnp_bios_read_escd(char *data, u32 nvram_base);
145extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data);
146
147#endif /* CONFIG_PNPBIOS */
148
149#endif /* __KERNEL__ */
150
151#endif /* _LINUX_PNPBIOS_H */
diff --git a/include/linux/poison.h b/include/linux/poison.h
index a9c31be7052c..9f31683728fd 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -10,6 +10,13 @@
10#define LIST_POISON1 ((void *) 0x00100100) 10#define LIST_POISON1 ((void *) 0x00100100)
11#define LIST_POISON2 ((void *) 0x00200200) 11#define LIST_POISON2 ((void *) 0x00200200)
12 12
13/********** include/linux/timer.h **********/
14/*
15 * Magic number "tsta" to indicate a static timer initializer
16 * for the object debugging code.
17 */
18#define TIMER_ENTRY_STATIC ((void *) 0x74737461)
19
13/********** mm/slab.c **********/ 20/********** mm/slab.c **********/
14/* 21/*
15 * Magic nums for obj red zoning. 22 * Magic nums for obj red zoning.
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index 3800639775ae..5ad79198d6f9 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -16,7 +16,8 @@
16# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */ 16# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */
17# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */ 17# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */
18 18
19/* Get/set whether or not to drop capabilities on setuid() away from uid 0 */ 19/* Get/set whether or not to drop capabilities on setuid() away from
20 * uid 0 (as per security/commoncap.c) */
20#define PR_GET_KEEPCAPS 7 21#define PR_GET_KEEPCAPS 7
21#define PR_SET_KEEPCAPS 8 22#define PR_SET_KEEPCAPS 8
22 23
@@ -63,8 +64,18 @@
63#define PR_GET_SECCOMP 21 64#define PR_GET_SECCOMP 21
64#define PR_SET_SECCOMP 22 65#define PR_SET_SECCOMP 22
65 66
66/* Get/set the capability bounding set */ 67/* Get/set the capability bounding set (as per security/commoncap.c) */
67#define PR_CAPBSET_READ 23 68#define PR_CAPBSET_READ 23
68#define PR_CAPBSET_DROP 24 69#define PR_CAPBSET_DROP 24
69 70
71/* Get/set the process' ability to use the timestamp counter instruction */
72#define PR_GET_TSC 25
73#define PR_SET_TSC 26
74# define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */
75# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */
76
77/* Get/set securebits (as per security/commoncap.c) */
78#define PR_GET_SECUREBITS 27
79#define PR_SET_SECUREBITS 28
80
70#endif /* _LINUX_PRCTL_H */ 81#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 9b6c935f69cf..9883bc942262 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -9,7 +9,6 @@
9 9
10struct net; 10struct net;
11struct completion; 11struct completion;
12
13/* 12/*
14 * The proc filesystem constants/structures 13 * The proc filesystem constants/structures
15 */ 14 */
@@ -41,7 +40,7 @@ enum {
41 * /proc file has a parent, but "subdir" is NULL for all 40 * /proc file has a parent, but "subdir" is NULL for all
42 * non-directory entries). 41 * non-directory entries).
43 * 42 *
44 * "get_info" is called at "read", while "owner" is used to protect module 43 * "owner" is used to protect module
45 * from unloading while proc_dir_entry is in use 44 * from unloading while proc_dir_entry is in use
46 */ 45 */
47 46
@@ -49,7 +48,6 @@ typedef int (read_proc_t)(char *page, char **start, off_t off,
49 int count, int *eof, void *data); 48 int count, int *eof, void *data);
50typedef int (write_proc_t)(struct file *file, const char __user *buffer, 49typedef int (write_proc_t)(struct file *file, const char __user *buffer,
51 unsigned long count, void *data); 50 unsigned long count, void *data);
52typedef int (get_info_t)(char *, char **, off_t, int);
53 51
54struct proc_dir_entry { 52struct proc_dir_entry {
55 unsigned int low_ino; 53 unsigned int low_ino;
@@ -70,7 +68,6 @@ struct proc_dir_entry {
70 * somewhere. 68 * somewhere.
71 */ 69 */
72 const struct file_operations *proc_fops; 70 const struct file_operations *proc_fops;
73 get_info_t *get_info;
74 struct module *owner; 71 struct module *owner;
75 struct proc_dir_entry *next, *parent, *subdir; 72 struct proc_dir_entry *next, *parent, *subdir;
76 void *data; 73 void *data;
@@ -97,10 +94,6 @@ struct vmcore {
97 94
98#ifdef CONFIG_PROC_FS 95#ifdef CONFIG_PROC_FS
99 96
100extern struct proc_dir_entry proc_root;
101extern struct proc_dir_entry *proc_root_fs;
102extern struct proc_dir_entry *proc_bus;
103extern struct proc_dir_entry *proc_root_driver;
104extern struct proc_dir_entry *proc_root_kcore; 97extern struct proc_dir_entry *proc_root_kcore;
105 98
106extern spinlock_t proc_subdir_lock; 99extern spinlock_t proc_subdir_lock;
@@ -123,9 +116,10 @@ void de_put(struct proc_dir_entry *de);
123 116
124extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 117extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
125 struct proc_dir_entry *parent); 118 struct proc_dir_entry *parent);
126struct proc_dir_entry *proc_create(const char *name, mode_t mode, 119struct proc_dir_entry *proc_create_data(const char *name, mode_t mode,
127 struct proc_dir_entry *parent, 120 struct proc_dir_entry *parent,
128 const struct file_operations *proc_fops); 121 const struct file_operations *proc_fops,
122 void *data);
129extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); 123extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
130 124
131extern struct vfsmount *proc_mnt; 125extern struct vfsmount *proc_mnt;
@@ -180,6 +174,12 @@ extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);
180extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, 174extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode,
181 struct proc_dir_entry *parent); 175 struct proc_dir_entry *parent);
182 176
177static inline struct proc_dir_entry *proc_create(const char *name, mode_t mode,
178 struct proc_dir_entry *parent, const struct file_operations *proc_fops)
179{
180 return proc_create_data(name, mode, parent, proc_fops, NULL);
181}
182
183static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 183static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
184 mode_t mode, struct proc_dir_entry *base, 184 mode_t mode, struct proc_dir_entry *base,
185 read_proc_t *read_proc, void * data) 185 read_proc_t *read_proc, void * data)
@@ -192,24 +192,19 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
192 return res; 192 return res;
193} 193}
194 194
195static inline struct proc_dir_entry *create_proc_info_entry(const char *name,
196 mode_t mode, struct proc_dir_entry *base, get_info_t *get_info)
197{
198 struct proc_dir_entry *res=create_proc_entry(name,mode,base);
199 if (res) res->get_info=get_info;
200 return res;
201}
202
203extern struct proc_dir_entry *proc_net_fops_create(struct net *net, 195extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
204 const char *name, mode_t mode, const struct file_operations *fops); 196 const char *name, mode_t mode, const struct file_operations *fops);
205extern void proc_net_remove(struct net *net, const char *name); 197extern void proc_net_remove(struct net *net, const char *name);
206extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, 198extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
207 struct proc_dir_entry *parent); 199 struct proc_dir_entry *parent);
208 200
209#else 201/* While the {get|set|dup}_mm_exe_file functions are for mm_structs, they are
202 * only needed to implement /proc/<pid>|self/exe so we define them here. */
203extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file);
204extern struct file *get_mm_exe_file(struct mm_struct *mm);
205extern void dup_mm_exe_file(struct mm_struct *oldmm, struct mm_struct *newmm);
210 206
211#define proc_root_driver NULL 207#else
212#define proc_bus NULL
213 208
214#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) 209#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
215static inline void proc_net_remove(struct net *net, const char *name) {} 210static inline void proc_net_remove(struct net *net, const char *name) {}
@@ -226,6 +221,12 @@ static inline struct proc_dir_entry *proc_create(const char *name,
226{ 221{
227 return NULL; 222 return NULL;
228} 223}
224static inline struct proc_dir_entry *proc_create_data(const char *name,
225 mode_t mode, struct proc_dir_entry *parent,
226 const struct file_operations *proc_fops, void *data)
227{
228 return NULL;
229}
229#define remove_proc_entry(name, parent) do {} while (0) 230#define remove_proc_entry(name, parent) do {} while (0)
230 231
231static inline struct proc_dir_entry *proc_symlink(const char *name, 232static inline struct proc_dir_entry *proc_symlink(const char *name,
@@ -236,16 +237,11 @@ static inline struct proc_dir_entry *proc_mkdir(const char *name,
236static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 237static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
237 mode_t mode, struct proc_dir_entry *base, 238 mode_t mode, struct proc_dir_entry *base,
238 read_proc_t *read_proc, void * data) { return NULL; } 239 read_proc_t *read_proc, void * data) { return NULL; }
239static inline struct proc_dir_entry *create_proc_info_entry(const char *name,
240 mode_t mode, struct proc_dir_entry *base, get_info_t *get_info)
241 { return NULL; }
242 240
243struct tty_driver; 241struct tty_driver;
244static inline void proc_tty_register_driver(struct tty_driver *driver) {}; 242static inline void proc_tty_register_driver(struct tty_driver *driver) {};
245static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; 243static inline void proc_tty_unregister_driver(struct tty_driver *driver) {};
246 244
247extern struct proc_dir_entry proc_root;
248
249static inline int pid_ns_prepare_proc(struct pid_namespace *ns) 245static inline int pid_ns_prepare_proc(struct pid_namespace *ns)
250{ 246{
251 return 0; 247 return 0;
@@ -255,6 +251,19 @@ static inline void pid_ns_release_proc(struct pid_namespace *ns)
255{ 251{
256} 252}
257 253
254static inline void set_mm_exe_file(struct mm_struct *mm,
255 struct file *new_exe_file)
256{}
257
258static inline struct file *get_mm_exe_file(struct mm_struct *mm)
259{
260 return NULL;
261}
262
263static inline void dup_mm_exe_file(struct mm_struct *oldmm,
264 struct mm_struct *newmm)
265{}
266
258#endif /* CONFIG_PROC_FS */ 267#endif /* CONFIG_PROC_FS */
259 268
260#if !defined(CONFIG_PROC_KCORE) 269#if !defined(CONFIG_PROC_KCORE)
diff --git a/include/linux/profile.h b/include/linux/profile.h
index ff576d1db67d..05c1cc736937 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -1,8 +1,6 @@
1#ifndef _LINUX_PROFILE_H 1#ifndef _LINUX_PROFILE_H
2#define _LINUX_PROFILE_H 2#define _LINUX_PROFILE_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/kernel.h> 4#include <linux/kernel.h>
7#include <linux/init.h> 5#include <linux/init.h>
8#include <linux/cpumask.h> 6#include <linux/cpumask.h>
@@ -118,6 +116,4 @@ static inline void unregister_timer_hook(int (*hook)(struct pt_regs *))
118 116
119#endif /* CONFIG_PROFILING */ 117#endif /* CONFIG_PROFILING */
120 118
121#endif /* __KERNEL__ */
122
123#endif /* _LINUX_PROFILE_H */ 119#endif /* _LINUX_PROFILE_H */
diff --git a/include/linux/proportions.h b/include/linux/proportions.h
index 2c3b3cad92be..5afc1b23346d 100644
--- a/include/linux/proportions.h
+++ b/include/linux/proportions.h
@@ -78,6 +78,19 @@ void prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl)
78} 78}
79 79
80/* 80/*
81 * Limit the time part in order to ensure there are some bits left for the
82 * cycle counter and fraction multiply.
83 */
84#define PROP_MAX_SHIFT (3*BITS_PER_LONG/4)
85
86#define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1)
87#define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT)
88
89void __prop_inc_percpu_max(struct prop_descriptor *pd,
90 struct prop_local_percpu *pl, long frac);
91
92
93/*
81 * ----- SINGLE ------ 94 * ----- SINGLE ------
82 */ 95 */
83 96
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index ebe0c17039cf..f98501ba557e 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -98,6 +98,10 @@ extern void ptrace_untrace(struct task_struct *child);
98extern int ptrace_may_attach(struct task_struct *task); 98extern int ptrace_may_attach(struct task_struct *task);
99extern int __ptrace_may_attach(struct task_struct *task); 99extern int __ptrace_may_attach(struct task_struct *task);
100 100
101static inline int ptrace_reparented(struct task_struct *child)
102{
103 return child->real_parent != child->parent;
104}
101static inline void ptrace_link(struct task_struct *child, 105static inline void ptrace_link(struct task_struct *child,
102 struct task_struct *new_parent) 106 struct task_struct *new_parent)
103{ 107{
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 6e0393a5b2ea..dcddfb200947 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -160,14 +160,18 @@ enum {
160 160
161 161
162#ifdef __KERNEL__ 162#ifdef __KERNEL__
163#include <linux/spinlock.h> 163#include <linux/list.h>
164#include <linux/rwsem.h>
165#include <linux/mutex.h> 164#include <linux/mutex.h>
165#include <linux/rwsem.h>
166#include <linux/spinlock.h>
167#include <linux/wait.h>
166 168
167#include <linux/dqblk_xfs.h> 169#include <linux/dqblk_xfs.h>
168#include <linux/dqblk_v1.h> 170#include <linux/dqblk_v1.h>
169#include <linux/dqblk_v2.h> 171#include <linux/dqblk_v2.h>
170 172
173#include <asm/atomic.h>
174
171extern spinlock_t dq_data_lock; 175extern spinlock_t dq_data_lock;
172 176
173/* Maximal numbers of writes for quota operation (insert/delete/update) 177/* Maximal numbers of writes for quota operation (insert/delete/update)
@@ -198,10 +202,14 @@ struct quota_format_type;
198 202
199struct mem_dqinfo { 203struct mem_dqinfo {
200 struct quota_format_type *dqi_format; 204 struct quota_format_type *dqi_format;
205 int dqi_fmt_id; /* Id of the dqi_format - used when turning
206 * quotas on after remount RW */
201 struct list_head dqi_dirty_list; /* List of dirty dquots */ 207 struct list_head dqi_dirty_list; /* List of dirty dquots */
202 unsigned long dqi_flags; 208 unsigned long dqi_flags;
203 unsigned int dqi_bgrace; 209 unsigned int dqi_bgrace;
204 unsigned int dqi_igrace; 210 unsigned int dqi_igrace;
211 qsize_t dqi_maxblimit;
212 qsize_t dqi_maxilimit;
205 union { 213 union {
206 struct v1_mem_dqinfo v1_i; 214 struct v1_mem_dqinfo v1_i;
207 struct v2_mem_dqinfo v2_i; 215 struct v2_mem_dqinfo v2_i;
@@ -292,8 +300,8 @@ struct dquot_operations {
292 300
293/* Operations handling requests from userspace */ 301/* Operations handling requests from userspace */
294struct quotactl_ops { 302struct quotactl_ops {
295 int (*quota_on)(struct super_block *, int, int, char *); 303 int (*quota_on)(struct super_block *, int, int, char *, int);
296 int (*quota_off)(struct super_block *, int); 304 int (*quota_off)(struct super_block *, int, int);
297 int (*quota_sync)(struct super_block *, int); 305 int (*quota_sync)(struct super_block *, int);
298 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 306 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
299 int (*set_info)(struct super_block *, int, struct if_dqinfo *); 307 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
@@ -314,6 +322,10 @@ struct quota_format_type {
314 322
315#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ 323#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */
316#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ 324#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */
325#define DQUOT_USR_SUSPENDED 0x04 /* User diskquotas are off, but
326 * we have necessary info in
327 * memory to turn them on */
328#define DQUOT_GRP_SUSPENDED 0x08 /* The same for group quotas */
317 329
318struct quota_info { 330struct quota_info {
319 unsigned int flags; /* Flags for diskquotas on this device */ 331 unsigned int flags; /* Flags for diskquotas on this device */
@@ -325,17 +337,19 @@ struct quota_info {
325 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ 337 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
326}; 338};
327 339
328/* Inline would be better but we need to dereference super_block which is not defined yet */
329int mark_dquot_dirty(struct dquot *dquot);
330
331#define dquot_dirty(dquot) test_bit(DQ_MOD_B, &(dquot)->dq_flags)
332
333#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \ 340#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
334 (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED)) 341 (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))
335 342
336#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \ 343#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \
337 sb_has_quota_enabled(sb, GRPQUOTA)) 344 sb_has_quota_enabled(sb, GRPQUOTA))
338 345
346#define sb_has_quota_suspended(sb, type) \
347 ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
348 (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
349
350#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \
351 sb_has_quota_suspended(sb, GRPQUOTA))
352
339int register_quota_format(struct quota_format_type *fmt); 353int register_quota_format(struct quota_format_type *fmt);
340void unregister_quota_format(struct quota_format_type *fmt); 354void unregister_quota_format(struct quota_format_type *fmt);
341 355
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 5110201a4159..f86702053853 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -37,11 +37,11 @@ extern int dquot_release(struct dquot *dquot);
37extern int dquot_commit_info(struct super_block *sb, int type); 37extern int dquot_commit_info(struct super_block *sb, int type);
38extern int dquot_mark_dquot_dirty(struct dquot *dquot); 38extern int dquot_mark_dquot_dirty(struct dquot *dquot);
39 39
40extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path); 40extern int vfs_quota_on(struct super_block *sb, int type, int format_id,
41 char *path, int remount);
41extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 42extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
42 int format_id, int type); 43 int format_id, int type);
43extern int vfs_quota_off(struct super_block *sb, int type); 44extern int vfs_quota_off(struct super_block *sb, int type, int remount);
44#define vfs_quota_off_mount(sb, type) vfs_quota_off(sb, type)
45extern int vfs_quota_sync(struct super_block *sb, int type); 45extern int vfs_quota_sync(struct super_block *sb, int type);
46extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 46extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
47extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 47extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
@@ -59,7 +59,7 @@ extern struct quotactl_ops vfs_quotactl_ops;
59 59
60/* It is better to call this function outside of any transaction as it might 60/* It is better to call this function outside of any transaction as it might
61 * need a lot of space in journal for dquot structure allocation. */ 61 * need a lot of space in journal for dquot structure allocation. */
62static __inline__ void DQUOT_INIT(struct inode *inode) 62static inline void DQUOT_INIT(struct inode *inode)
63{ 63{
64 BUG_ON(!inode->i_sb); 64 BUG_ON(!inode->i_sb);
65 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) 65 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode))
@@ -67,7 +67,7 @@ static __inline__ void DQUOT_INIT(struct inode *inode)
67} 67}
68 68
69/* The same as with DQUOT_INIT */ 69/* The same as with DQUOT_INIT */
70static __inline__ void DQUOT_DROP(struct inode *inode) 70static inline void DQUOT_DROP(struct inode *inode)
71{ 71{
72 /* Here we can get arbitrary inode from clear_inode() so we have 72 /* Here we can get arbitrary inode from clear_inode() so we have
73 * to be careful. OTOH we don't need locking as quota operations 73 * to be careful. OTOH we don't need locking as quota operations
@@ -90,7 +90,7 @@ static __inline__ void DQUOT_DROP(struct inode *inode)
90 90
91/* The following allocation/freeing/transfer functions *must* be called inside 91/* The following allocation/freeing/transfer functions *must* be called inside
92 * a transaction (deadlocks possible otherwise) */ 92 * a transaction (deadlocks possible otherwise) */
93static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 93static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
94{ 94{
95 if (sb_any_quota_enabled(inode->i_sb)) { 95 if (sb_any_quota_enabled(inode->i_sb)) {
96 /* Used space is updated in alloc_space() */ 96 /* Used space is updated in alloc_space() */
@@ -102,7 +102,7 @@ static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t
102 return 0; 102 return 0;
103} 103}
104 104
105static __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) 105static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
106{ 106{
107 int ret; 107 int ret;
108 if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr))) 108 if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr)))
@@ -110,7 +110,7 @@ static __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
110 return ret; 110 return ret;
111} 111}
112 112
113static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 113static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
114{ 114{
115 if (sb_any_quota_enabled(inode->i_sb)) { 115 if (sb_any_quota_enabled(inode->i_sb)) {
116 /* Used space is updated in alloc_space() */ 116 /* Used space is updated in alloc_space() */
@@ -122,7 +122,7 @@ static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
122 return 0; 122 return 0;
123} 123}
124 124
125static __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) 125static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
126{ 126{
127 int ret; 127 int ret;
128 if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr))) 128 if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr)))
@@ -130,7 +130,7 @@ static __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
130 return ret; 130 return ret;
131} 131}
132 132
133static __inline__ int DQUOT_ALLOC_INODE(struct inode *inode) 133static inline int DQUOT_ALLOC_INODE(struct inode *inode)
134{ 134{
135 if (sb_any_quota_enabled(inode->i_sb)) { 135 if (sb_any_quota_enabled(inode->i_sb)) {
136 DQUOT_INIT(inode); 136 DQUOT_INIT(inode);
@@ -140,7 +140,7 @@ static __inline__ int DQUOT_ALLOC_INODE(struct inode *inode)
140 return 0; 140 return 0;
141} 141}
142 142
143static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 143static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
144{ 144{
145 if (sb_any_quota_enabled(inode->i_sb)) 145 if (sb_any_quota_enabled(inode->i_sb))
146 inode->i_sb->dq_op->free_space(inode, nr); 146 inode->i_sb->dq_op->free_space(inode, nr);
@@ -148,19 +148,19 @@ static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
148 inode_sub_bytes(inode, nr); 148 inode_sub_bytes(inode, nr);
149} 149}
150 150
151static __inline__ void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) 151static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
152{ 152{
153 DQUOT_FREE_SPACE_NODIRTY(inode, nr); 153 DQUOT_FREE_SPACE_NODIRTY(inode, nr);
154 mark_inode_dirty(inode); 154 mark_inode_dirty(inode);
155} 155}
156 156
157static __inline__ void DQUOT_FREE_INODE(struct inode *inode) 157static inline void DQUOT_FREE_INODE(struct inode *inode)
158{ 158{
159 if (sb_any_quota_enabled(inode->i_sb)) 159 if (sb_any_quota_enabled(inode->i_sb))
160 inode->i_sb->dq_op->free_inode(inode, 1); 160 inode->i_sb->dq_op->free_inode(inode, 1);
161} 161}
162 162
163static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) 163static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
164{ 164{
165 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) { 165 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) {
166 DQUOT_INIT(inode); 166 DQUOT_INIT(inode);
@@ -171,14 +171,32 @@ static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
171} 171}
172 172
173/* The following two functions cannot be called inside a transaction */ 173/* The following two functions cannot be called inside a transaction */
174#define DQUOT_SYNC(sb) sync_dquots(sb, -1) 174static inline void DQUOT_SYNC(struct super_block *sb)
175{
176 sync_dquots(sb, -1);
177}
175 178
176static __inline__ int DQUOT_OFF(struct super_block *sb) 179static inline int DQUOT_OFF(struct super_block *sb, int remount)
177{ 180{
178 int ret = -ENOSYS; 181 int ret = -ENOSYS;
179 182
180 if (sb_any_quota_enabled(sb) && sb->s_qcop && sb->s_qcop->quota_off) 183 if (sb->s_qcop && sb->s_qcop->quota_off)
181 ret = sb->s_qcop->quota_off(sb, -1); 184 ret = sb->s_qcop->quota_off(sb, -1, remount);
185 return ret;
186}
187
188static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
189{
190 int cnt;
191 int ret = 0, err;
192
193 if (!sb->s_qcop || !sb->s_qcop->quota_on)
194 return -ENOSYS;
195 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
196 err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1);
197 if (err < 0 && !ret)
198 ret = err;
199 }
182 return ret; 200 return ret;
183} 201}
184 202
@@ -189,13 +207,43 @@ static __inline__ int DQUOT_OFF(struct super_block *sb)
189 */ 207 */
190#define sb_dquot_ops (NULL) 208#define sb_dquot_ops (NULL)
191#define sb_quotactl_ops (NULL) 209#define sb_quotactl_ops (NULL)
192#define DQUOT_INIT(inode) do { } while(0) 210
193#define DQUOT_DROP(inode) do { } while(0) 211static inline void DQUOT_INIT(struct inode *inode)
194#define DQUOT_ALLOC_INODE(inode) (0) 212{
195#define DQUOT_FREE_INODE(inode) do { } while(0) 213}
196#define DQUOT_SYNC(sb) do { } while(0) 214
197#define DQUOT_OFF(sb) do { } while(0) 215static inline void DQUOT_DROP(struct inode *inode)
198#define DQUOT_TRANSFER(inode, iattr) (0) 216{
217}
218
219static inline int DQUOT_ALLOC_INODE(struct inode *inode)
220{
221 return 0;
222}
223
224static inline void DQUOT_FREE_INODE(struct inode *inode)
225{
226}
227
228static inline void DQUOT_SYNC(struct super_block *sb)
229{
230}
231
232static inline int DQUOT_OFF(struct super_block *sb, int remount)
233{
234 return 0;
235}
236
237static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
238{
239 return 0;
240}
241
242static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
243{
244 return 0;
245}
246
199static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 247static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
200{ 248{
201 inode_add_bytes(inode, nr); 249 inode_add_bytes(inode, nr);
@@ -235,11 +283,38 @@ static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
235 283
236#endif /* CONFIG_QUOTA */ 284#endif /* CONFIG_QUOTA */
237 285
238#define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) DQUOT_PREALLOC_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 286static inline int DQUOT_PREALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
239#define DQUOT_PREALLOC_BLOCK(inode, nr) DQUOT_PREALLOC_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 287{
240#define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) DQUOT_ALLOC_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 288 return DQUOT_PREALLOC_SPACE_NODIRTY(inode,
241#define DQUOT_ALLOC_BLOCK(inode, nr) DQUOT_ALLOC_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 289 nr << inode->i_sb->s_blocksize_bits);
242#define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) DQUOT_FREE_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 290}
243#define DQUOT_FREE_BLOCK(inode, nr) DQUOT_FREE_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 291
292static inline int DQUOT_PREALLOC_BLOCK(struct inode *inode, qsize_t nr)
293{
294 return DQUOT_PREALLOC_SPACE(inode,
295 nr << inode->i_sb->s_blocksize_bits);
296}
297
298static inline int DQUOT_ALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
299{
300 return DQUOT_ALLOC_SPACE_NODIRTY(inode,
301 nr << inode->i_sb->s_blocksize_bits);
302}
303
304static inline int DQUOT_ALLOC_BLOCK(struct inode *inode, qsize_t nr)
305{
306 return DQUOT_ALLOC_SPACE(inode,
307 nr << inode->i_sb->s_blocksize_bits);
308}
309
310static inline void DQUOT_FREE_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
311{
312 DQUOT_FREE_SPACE_NODIRTY(inode, nr << inode->i_sb->s_blocksize_bits);
313}
314
315static inline void DQUOT_FREE_BLOCK(struct inode *inode, qsize_t nr)
316{
317 DQUOT_FREE_SPACE(inode, nr << inode->i_sb->s_blocksize_bits);
318}
244 319
245#endif /* _LINUX_QUOTAOPS_ */ 320#endif /* _LINUX_QUOTAOPS_ */
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index fbaeda79b2e9..81a1a02d4566 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -19,7 +19,6 @@
19#define _MD_H 19#define _MD_H
20 20
21#include <linux/blkdev.h> 21#include <linux/blkdev.h>
22#include <asm/semaphore.h>
23#include <linux/major.h> 22#include <linux/major.h>
24#include <linux/ioctl.h> 23#include <linux/ioctl.h>
25#include <linux/types.h> 24#include <linux/types.h>
@@ -95,6 +94,7 @@ extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
95extern void md_do_sync(mddev_t *mddev); 94extern void md_do_sync(mddev_t *mddev);
96extern void md_new_event(mddev_t *mddev); 95extern void md_new_event(mddev_t *mddev);
97extern void md_allow_write(mddev_t *mddev); 96extern void md_allow_write(mddev_t *mddev);
97extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
98 98
99#endif /* CONFIG_MD */ 99#endif /* CONFIG_MD */
100#endif 100#endif
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 7bb6d1abf71e..812ffa590cff 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -84,6 +84,10 @@ struct mdk_rdev_s
84#define AllReserved 6 /* If whole device is reserved for 84#define AllReserved 6 /* If whole device is reserved for
85 * one array */ 85 * one array */
86#define AutoDetected 7 /* added by auto-detect */ 86#define AutoDetected 7 /* added by auto-detect */
87#define Blocked 8 /* An error occured on an externally
88 * managed array, don't allow writes
89 * until it is cleared */
90 wait_queue_head_t blocked_wait;
87 91
88 int desc_nr; /* descriptor index in the superblock */ 92 int desc_nr; /* descriptor index in the superblock */
89 int raid_disk; /* role of device in array */ 93 int raid_disk; /* role of device in array */
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 93678f57ccbe..f0827d31ae6f 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -252,6 +252,8 @@ struct r6_state {
252#define STRIPE_EXPANDING 9 252#define STRIPE_EXPANDING 9
253#define STRIPE_EXPAND_SOURCE 10 253#define STRIPE_EXPAND_SOURCE 10
254#define STRIPE_EXPAND_READY 11 254#define STRIPE_EXPAND_READY 11
255#define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */
256#define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */
255/* 257/*
256 * Operations flags (in issue order) 258 * Operations flags (in issue order)
257 */ 259 */
@@ -316,12 +318,17 @@ struct raid5_private_data {
316 int previous_raid_disks; 318 int previous_raid_disks;
317 319
318 struct list_head handle_list; /* stripes needing handling */ 320 struct list_head handle_list; /* stripes needing handling */
321 struct list_head hold_list; /* preread ready stripes */
319 struct list_head delayed_list; /* stripes that have plugged requests */ 322 struct list_head delayed_list; /* stripes that have plugged requests */
320 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ 323 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */
321 struct bio *retry_read_aligned; /* currently retrying aligned bios */ 324 struct bio *retry_read_aligned; /* currently retrying aligned bios */
322 struct bio *retry_read_aligned_list; /* aligned bios retry list */ 325 struct bio *retry_read_aligned_list; /* aligned bios retry list */
323 atomic_t preread_active_stripes; /* stripes with scheduled io */ 326 atomic_t preread_active_stripes; /* stripes with scheduled io */
324 atomic_t active_aligned_reads; 327 atomic_t active_aligned_reads;
328 atomic_t pending_full_writes; /* full write backlog */
329 int bypass_count; /* bypassed prereads */
330 int bypass_threshold; /* preread nice */
331 struct list_head *last_hold; /* detect hold_list promotions */
325 332
326 atomic_t reshape_stripes; /* stripes with pending writes for reshape */ 333 atomic_t reshape_stripes; /* stripes with pending writes for reshape */
327 /* unfortunately we need two cache names as we temporarily have 334 /* unfortunately we need two cache names as we temporarily have
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h
index d22ad392242a..6b537f1ac96c 100644
--- a/include/linux/raid_class.h
+++ b/include/linux/raid_class.h
@@ -53,20 +53,20 @@ struct raid_data {
53#define DEFINE_RAID_ATTRIBUTE(type, attr) \ 53#define DEFINE_RAID_ATTRIBUTE(type, attr) \
54static inline void \ 54static inline void \
55raid_set_##attr(struct raid_template *r, struct device *dev, type value) { \ 55raid_set_##attr(struct raid_template *r, struct device *dev, type value) { \
56 struct class_device *cdev = \ 56 struct device *device = \
57 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\ 57 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
58 struct raid_data *rd; \ 58 struct raid_data *rd; \
59 BUG_ON(!cdev); \ 59 BUG_ON(!device); \
60 rd = class_get_devdata(cdev); \ 60 rd = dev_get_drvdata(device); \
61 rd->attr = value; \ 61 rd->attr = value; \
62} \ 62} \
63static inline type \ 63static inline type \
64raid_get_##attr(struct raid_template *r, struct device *dev) { \ 64raid_get_##attr(struct raid_template *r, struct device *dev) { \
65 struct class_device *cdev = \ 65 struct device *device = \
66 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\ 66 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
67 struct raid_data *rd; \ 67 struct raid_data *rd; \
68 BUG_ON(!cdev); \ 68 BUG_ON(!device); \
69 rd = class_get_devdata(cdev); \ 69 rd = dev_get_drvdata(device); \
70 return rd->attr; \ 70 return rd->attr; \
71} 71}
72 72
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
index b3dccd68629e..b3aa05baab8a 100644
--- a/include/linux/rcuclassic.h
+++ b/include/linux/rcuclassic.h
@@ -33,8 +33,6 @@
33#ifndef __LINUX_RCUCLASSIC_H 33#ifndef __LINUX_RCUCLASSIC_H
34#define __LINUX_RCUCLASSIC_H 34#define __LINUX_RCUCLASSIC_H
35 35
36#ifdef __KERNEL__
37
38#include <linux/cache.h> 36#include <linux/cache.h>
39#include <linux/spinlock.h> 37#include <linux/spinlock.h>
40#include <linux/threads.h> 38#include <linux/threads.h>
@@ -163,5 +161,4 @@ extern long rcu_batches_completed_bh(void);
163#define rcu_enter_nohz() do { } while (0) 161#define rcu_enter_nohz() do { } while (0)
164#define rcu_exit_nohz() do { } while (0) 162#define rcu_exit_nohz() do { } while (0)
165 163
166#endif /* __KERNEL__ */
167#endif /* __LINUX_RCUCLASSIC_H */ 164#endif /* __LINUX_RCUCLASSIC_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 37a642c54871..8082d6587a0f 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -33,8 +33,6 @@
33#ifndef __LINUX_RCUPDATE_H 33#ifndef __LINUX_RCUPDATE_H
34#define __LINUX_RCUPDATE_H 34#define __LINUX_RCUPDATE_H
35 35
36#ifdef __KERNEL__
37
38#include <linux/cache.h> 36#include <linux/cache.h>
39#include <linux/spinlock.h> 37#include <linux/spinlock.h>
40#include <linux/threads.h> 38#include <linux/threads.h>
@@ -245,5 +243,4 @@ extern long rcu_batches_completed_bh(void);
245extern void rcu_init(void); 243extern void rcu_init(void);
246extern int rcu_needs_cpu(int cpu); 244extern int rcu_needs_cpu(int cpu);
247 245
248#endif /* __KERNEL__ */
249#endif /* __LINUX_RCUPDATE_H */ 246#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
index d038aa6e5ee1..8a05c7e20bc4 100644
--- a/include/linux/rcupreempt.h
+++ b/include/linux/rcupreempt.h
@@ -33,8 +33,6 @@
33#ifndef __LINUX_RCUPREEMPT_H 33#ifndef __LINUX_RCUPREEMPT_H
34#define __LINUX_RCUPREEMPT_H 34#define __LINUX_RCUPREEMPT_H
35 35
36#ifdef __KERNEL__
37
38#include <linux/cache.h> 36#include <linux/cache.h>
39#include <linux/spinlock.h> 37#include <linux/spinlock.h>
40#include <linux/threads.h> 38#include <linux/threads.h>
@@ -104,5 +102,4 @@ static inline void rcu_exit_nohz(void)
104#define rcu_exit_nohz() do { } while (0) 102#define rcu_exit_nohz() do { } while (0)
105#endif /* CONFIG_NO_HZ */ 103#endif /* CONFIG_NO_HZ */
106 104
107#endif /* __KERNEL__ */
108#endif /* __LINUX_RCUPREEMPT_H */ 105#endif /* __LINUX_RCUPREEMPT_H */
diff --git a/include/linux/rcupreempt_trace.h b/include/linux/rcupreempt_trace.h
index 21cd6b2a5c42..b99ae073192a 100644
--- a/include/linux/rcupreempt_trace.h
+++ b/include/linux/rcupreempt_trace.h
@@ -32,7 +32,6 @@
32#ifndef __LINUX_RCUPREEMPT_TRACE_H 32#ifndef __LINUX_RCUPREEMPT_TRACE_H
33#define __LINUX_RCUPREEMPT_TRACE_H 33#define __LINUX_RCUPREEMPT_TRACE_H
34 34
35#ifdef __KERNEL__
36#include <linux/types.h> 35#include <linux/types.h>
37#include <linux/kernel.h> 36#include <linux/kernel.h>
38 37
@@ -95,5 +94,4 @@ extern void rcupreempt_trace_done_remove(struct rcupreempt_trace *trace);
95extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace); 94extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace);
96extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace); 95extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace);
97 96
98#endif /* __KERNEL__ */
99#endif /* __LINUX_RCUPREEMPT_TRACE_H */ 97#endif /* __LINUX_RCUPREEMPT_TRACE_H */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 8e7eff2cd0ab..4aacaeecb56f 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2176,6 +2176,7 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp,
2176 unsigned int cmd, unsigned long arg); 2176 unsigned int cmd, unsigned long arg);
2177long reiserfs_compat_ioctl(struct file *filp, 2177long reiserfs_compat_ioctl(struct file *filp,
2178 unsigned int cmd, unsigned long arg); 2178 unsigned int cmd, unsigned long arg);
2179int reiserfs_unpack(struct inode *inode, struct file *filp);
2179 2180
2180/* ioctl's command */ 2181/* ioctl's command */
2181#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) 2182#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index db5ef9b83c3f..336ee43ed7d8 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -177,7 +177,6 @@ struct reiserfs_journal {
177 struct reiserfs_journal_cnode *j_last; /* newest journal block */ 177 struct reiserfs_journal_cnode *j_last; /* newest journal block */
178 struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ 178 struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */
179 179
180 struct file *j_dev_file;
181 struct block_device *j_dev_bd; 180 struct block_device *j_dev_bd;
182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ 181 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
183 182
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 61363ce896d5..6d9e1fca098c 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -9,6 +9,8 @@
9 * 9 *
10 * Author: Pavel Emelianov <xemul@openvz.org> 10 * Author: Pavel Emelianov <xemul@openvz.org>
11 * 11 *
12 * See Documentation/controllers/resource_counter.txt for more
13 * info about what this counter is.
12 */ 14 */
13 15
14#include <linux/cgroup.h> 16#include <linux/cgroup.h>
@@ -25,6 +27,10 @@ struct res_counter {
25 */ 27 */
26 unsigned long long usage; 28 unsigned long long usage;
27 /* 29 /*
30 * the maximal value of the usage from the counter creation
31 */
32 unsigned long long max_usage;
33 /*
28 * the limit that usage cannot exceed 34 * the limit that usage cannot exceed
29 */ 35 */
30 unsigned long long limit; 36 unsigned long long limit;
@@ -39,8 +45,9 @@ struct res_counter {
39 spinlock_t lock; 45 spinlock_t lock;
40}; 46};
41 47
42/* 48/**
43 * Helpers to interact with userspace 49 * Helpers to interact with userspace
50 * res_counter_read_u64() - returns the value of the specified member.
44 * res_counter_read/_write - put/get the specified fields from the 51 * res_counter_read/_write - put/get the specified fields from the
45 * res_counter struct to/from the user 52 * res_counter struct to/from the user
46 * 53 *
@@ -51,6 +58,8 @@ struct res_counter {
51 * @pos: and the offset. 58 * @pos: and the offset.
52 */ 59 */
53 60
61u64 res_counter_read_u64(struct res_counter *counter, int member);
62
54ssize_t res_counter_read(struct res_counter *counter, int member, 63ssize_t res_counter_read(struct res_counter *counter, int member,
55 const char __user *buf, size_t nbytes, loff_t *pos, 64 const char __user *buf, size_t nbytes, loff_t *pos,
56 int (*read_strategy)(unsigned long long val, char *s)); 65 int (*read_strategy)(unsigned long long val, char *s));
@@ -64,6 +73,7 @@ ssize_t res_counter_write(struct res_counter *counter, int member,
64 73
65enum { 74enum {
66 RES_USAGE, 75 RES_USAGE,
76 RES_MAX_USAGE,
67 RES_LIMIT, 77 RES_LIMIT,
68 RES_FAILCNT, 78 RES_FAILCNT,
69}; 79};
@@ -124,4 +134,21 @@ static inline bool res_counter_check_under_limit(struct res_counter *cnt)
124 return ret; 134 return ret;
125} 135}
126 136
137static inline void res_counter_reset_max(struct res_counter *cnt)
138{
139 unsigned long flags;
140
141 spin_lock_irqsave(&cnt->lock, flags);
142 cnt->max_usage = cnt->usage;
143 spin_unlock_irqrestore(&cnt->lock, flags);
144}
145
146static inline void res_counter_reset_failcnt(struct res_counter *cnt)
147{
148 unsigned long flags;
149
150 spin_lock_irqsave(&cnt->lock, flags);
151 cnt->failcnt = 0;
152 spin_unlock_irqrestore(&cnt->lock, flags);
153}
127#endif 154#endif
diff --git a/include/linux/resource.h b/include/linux/resource.h
index ae13db714742..aaa423a6f3d9 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -19,6 +19,7 @@ struct task_struct;
19#define RUSAGE_SELF 0 19#define RUSAGE_SELF 0
20#define RUSAGE_CHILDREN (-1) 20#define RUSAGE_CHILDREN (-1)
21#define RUSAGE_BOTH (-2) /* sys_wait4() uses this */ 21#define RUSAGE_BOTH (-2) /* sys_wait4() uses this */
22#define RUSAGE_THREAD 1 /* only the calling thread */
22 23
23struct rusage { 24struct rusage {
24 struct timeval ru_utime; /* user time used */ 25 struct timeval ru_utime; /* user time used */
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 68e3f6853fa6..c1c99c9643d3 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -14,8 +14,6 @@
14#ifndef LINUX_RIO_H 14#ifndef LINUX_RIO_H
15#define LINUX_RIO_H 15#define LINUX_RIO_H
16 16
17#ifdef __KERNEL__
18
19#include <linux/types.h> 17#include <linux/types.h>
20#include <linux/ioport.h> 18#include <linux/ioport.h>
21#include <linux/list.h> 19#include <linux/list.h>
@@ -23,7 +21,6 @@
23#include <linux/device.h> 21#include <linux/device.h>
24#include <linux/rio_regs.h> 22#include <linux/rio_regs.h>
25 23
26#define RIO_ANY_DESTID 0xff
27#define RIO_NO_HOPCOUNT -1 24#define RIO_NO_HOPCOUNT -1
28#define RIO_INVALID_DESTID 0xffff 25#define RIO_INVALID_DESTID 0xffff
29 26
@@ -39,11 +36,8 @@
39 entry is invalid (no route 36 entry is invalid (no route
40 exists for the device ID) */ 37 exists for the device ID) */
41 38
42#ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT 39#define RIO_MAX_ROUTE_ENTRIES(size) (size ? (1 << 16) : (1 << 8))
43#define RIO_MAX_ROUTE_ENTRIES (1 << 8) 40#define RIO_ANY_DESTID(size) (size ? 0xffff : 0xff)
44#else
45#define RIO_MAX_ROUTE_ENTRIES (1 << 16)
46#endif
47 41
48#define RIO_MAX_MBOX 4 42#define RIO_MAX_MBOX 4
49#define RIO_MAX_MSG_SIZE 0x1000 43#define RIO_MAX_MSG_SIZE 0x1000
@@ -149,6 +143,11 @@ struct rio_dbell {
149 void *dev_id; 143 void *dev_id;
150}; 144};
151 145
146enum rio_phy_type {
147 RIO_PHY_PARALLEL,
148 RIO_PHY_SERIAL,
149};
150
152/** 151/**
153 * struct rio_mport - RIO master port info 152 * struct rio_mport - RIO master port info
154 * @dbells: List of doorbell events 153 * @dbells: List of doorbell events
@@ -163,6 +162,7 @@ struct rio_dbell {
163 * @id: Port ID, unique among all ports 162 * @id: Port ID, unique among all ports
164 * @index: Port index, unique among all port interfaces of the same type 163 * @index: Port index, unique among all port interfaces of the same type
165 * @name: Port name string 164 * @name: Port name string
165 * @priv: Master port private data
166 */ 166 */
167struct rio_mport { 167struct rio_mport {
168 struct list_head dbells; /* list of doorbell events */ 168 struct list_head dbells; /* list of doorbell events */
@@ -177,7 +177,13 @@ struct rio_mport {
177 unsigned char id; /* port ID, unique among all ports */ 177 unsigned char id; /* port ID, unique among all ports */
178 unsigned char index; /* port index, unique among all port 178 unsigned char index; /* port index, unique among all port
179 interfaces of the same type */ 179 interfaces of the same type */
180 unsigned int sys_size; /* RapidIO common transport system size.
181 * 0 - Small size. 256 devices.
182 * 1 - Large size, 65536 devices.
183 */
184 enum rio_phy_type phy_type; /* RapidIO phy type */
180 unsigned char name[40]; 185 unsigned char name[40];
186 void *priv; /* Master port private data */
181}; 187};
182 188
183/** 189/**
@@ -211,7 +217,7 @@ struct rio_switch {
211 u16 switchid; 217 u16 switchid;
212 u16 hopcount; 218 u16 hopcount;
213 u16 destid; 219 u16 destid;
214 u8 route_table[RIO_MAX_ROUTE_ENTRIES]; 220 u8 *route_table;
215 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, 221 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
216 u16 table, u16 route_destid, u8 route_port); 222 u16 table, u16 route_destid, u8 route_port);
217 int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, 223 int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
@@ -229,13 +235,15 @@ struct rio_switch {
229 * @dsend: Callback to send a doorbell message. 235 * @dsend: Callback to send a doorbell message.
230 */ 236 */
231struct rio_ops { 237struct rio_ops {
232 int (*lcread) (int index, u32 offset, int len, u32 * data); 238 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
233 int (*lcwrite) (int index, u32 offset, int len, u32 data); 239 u32 *data);
234 int (*cread) (int index, u16 destid, u8 hopcount, u32 offset, int len, 240 int (*lcwrite) (struct rio_mport *mport, int index, u32 offset, int len,
235 u32 * data); 241 u32 data);
236 int (*cwrite) (int index, u16 destid, u8 hopcount, u32 offset, int len, 242 int (*cread) (struct rio_mport *mport, int index, u16 destid,
237 u32 data); 243 u8 hopcount, u32 offset, int len, u32 *data);
238 int (*dsend) (int index, u16 destid, u16 data); 244 int (*cwrite) (struct rio_mport *mport, int index, u16 destid,
245 u8 hopcount, u32 offset, int len, u32 data);
246 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);
239}; 247};
240 248
241#define RIO_RESOURCE_MEM 0x00000100 249#define RIO_RESOURCE_MEM 0x00000100
@@ -321,5 +329,4 @@ extern void rio_close_inb_mbox(struct rio_mport *, int);
321extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); 329extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);
322extern void rio_close_outb_mbox(struct rio_mport *, int); 330extern void rio_close_outb_mbox(struct rio_mport *, int);
323 331
324#endif /* __KERNEL__ */
325#endif /* LINUX_RIO_H */ 332#endif /* LINUX_RIO_H */
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 7adb2a1aac92..90987b7bcc1b 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -13,8 +13,6 @@
13#ifndef LINUX_RIO_DRV_H 13#ifndef LINUX_RIO_DRV_H
14#define LINUX_RIO_DRV_H 14#define LINUX_RIO_DRV_H
15 15
16#ifdef __KERNEL__
17
18#include <linux/types.h> 16#include <linux/types.h>
19#include <linux/ioport.h> 17#include <linux/ioport.h>
20#include <linux/list.h> 18#include <linux/list.h>
@@ -465,5 +463,4 @@ extern struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from);
465extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did, 463extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did,
466 struct rio_dev *from); 464 struct rio_dev *from);
467 465
468#endif /* __KERNEL__ */
469#endif /* LINUX_RIO_DRV_H */ 466#endif /* LINUX_RIO_DRV_H */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index b9e174079002..44c81c744538 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -740,13 +740,13 @@ extern void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change);
740extern void rtnl_lock(void); 740extern void rtnl_lock(void);
741extern void rtnl_unlock(void); 741extern void rtnl_unlock(void);
742extern int rtnl_trylock(void); 742extern int rtnl_trylock(void);
743extern int rtnl_is_locked(void);
743 744
744extern void rtnetlink_init(void); 745extern void rtnetlink_init(void);
745extern void __rtnl_unlock(void); 746extern void __rtnl_unlock(void);
746 747
747#define ASSERT_RTNL() do { \ 748#define ASSERT_RTNL() do { \
748 if (unlikely(rtnl_trylock())) { \ 749 if (unlikely(!rtnl_is_locked())) { \
749 rtnl_unlock(); \
750 printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \ 750 printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \
751 __FILE__, __LINE__); \ 751 __FILE__, __LINE__); \
752 dump_stack(); \ 752 dump_stack(); \
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 7b524b4109a0..efd348fe8ca7 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#ifdef __KERNEL__
13
14#include <linux/types.h> 12#include <linux/types.h>
15#include <linux/kernel.h> 13#include <linux/kernel.h>
16#include <asm/system.h> 14#include <asm/system.h>
@@ -90,5 +88,4 @@ extern void up_read_non_owner(struct rw_semaphore *sem);
90# define up_read_non_owner(sem) up_read(sem) 88# define up_read_non_owner(sem) up_read(sem)
91#endif 89#endif
92 90
93#endif /* __KERNEL__ */
94#endif /* _LINUX_RWSEM_H */ 91#endif /* _LINUX_RWSEM_H */
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index a3d567a974e8..71fc81360048 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -213,6 +213,11 @@ int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, gfp_t,
213 sg_alloc_fn *); 213 sg_alloc_fn *);
214int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); 214int sg_alloc_table(struct sg_table *, unsigned int, gfp_t);
215 215
216size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents,
217 void *buf, size_t buflen);
218size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
219 void *buf, size_t buflen);
220
216/* 221/*
217 * Maximum number of entries that will be allocated in one piece, if 222 * Maximum number of entries that will be allocated in one piece, if
218 * a list larger than this is required then chaining will be utilized. 223 * a list larger than this is required then chaining will be utilized.
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6a1e7afb099b..03c238088aee 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -61,7 +61,6 @@ struct sched_param {
61#include <linux/mm_types.h> 61#include <linux/mm_types.h>
62 62
63#include <asm/system.h> 63#include <asm/system.h>
64#include <asm/semaphore.h>
65#include <asm/page.h> 64#include <asm/page.h>
66#include <asm/ptrace.h> 65#include <asm/ptrace.h>
67#include <asm/cputime.h> 66#include <asm/cputime.h>
@@ -69,7 +68,6 @@ struct sched_param {
69#include <linux/smp.h> 68#include <linux/smp.h>
70#include <linux/sem.h> 69#include <linux/sem.h>
71#include <linux/signal.h> 70#include <linux/signal.h>
72#include <linux/securebits.h>
73#include <linux/fs_struct.h> 71#include <linux/fs_struct.h>
74#include <linux/compiler.h> 72#include <linux/compiler.h>
75#include <linux/completion.h> 73#include <linux/completion.h>
@@ -556,6 +554,14 @@ struct signal_struct {
556#define SIGNAL_STOP_DEQUEUED 0x00000002 /* stop signal dequeued */ 554#define SIGNAL_STOP_DEQUEUED 0x00000002 /* stop signal dequeued */
557#define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */ 555#define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */
558#define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */ 556#define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */
557/*
558 * Pending notifications to parent.
559 */
560#define SIGNAL_CLD_STOPPED 0x00000010
561#define SIGNAL_CLD_CONTINUED 0x00000020
562#define SIGNAL_CLD_MASK (SIGNAL_CLD_STOPPED|SIGNAL_CLD_CONTINUED)
563
564#define SIGNAL_UNKILLABLE 0x00000040 /* for init: ignore fatal signals */
559 565
560/* If true, all threads except ->group_exit_task have pending SIGKILL */ 566/* If true, all threads except ->group_exit_task have pending SIGKILL */
561static inline int signal_group_exit(const struct signal_struct *sig) 567static inline int signal_group_exit(const struct signal_struct *sig)
@@ -704,6 +710,7 @@ enum cpu_idle_type {
704#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */ 710#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */
705#define SD_SHARE_PKG_RESOURCES 512 /* Domain members share cpu pkg resources */ 711#define SD_SHARE_PKG_RESOURCES 512 /* Domain members share cpu pkg resources */
706#define SD_SERIALIZE 1024 /* Only a single load balancing instance */ 712#define SD_SERIALIZE 1024 /* Only a single load balancing instance */
713#define SD_WAKE_IDLE_FAR 2048 /* Gain latency sacrificing cache hit */
707 714
708#define BALANCE_FOR_MC_POWER \ 715#define BALANCE_FOR_MC_POWER \
709 (sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0) 716 (sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0)
@@ -733,12 +740,31 @@ struct sched_group {
733 u32 reciprocal_cpu_power; 740 u32 reciprocal_cpu_power;
734}; 741};
735 742
743enum sched_domain_level {
744 SD_LV_NONE = 0,
745 SD_LV_SIBLING,
746 SD_LV_MC,
747 SD_LV_CPU,
748 SD_LV_NODE,
749 SD_LV_ALLNODES,
750 SD_LV_MAX
751};
752
753struct sched_domain_attr {
754 int relax_domain_level;
755};
756
757#define SD_ATTR_INIT (struct sched_domain_attr) { \
758 .relax_domain_level = -1, \
759}
760
736struct sched_domain { 761struct sched_domain {
737 /* These fields must be setup */ 762 /* These fields must be setup */
738 struct sched_domain *parent; /* top domain must be null terminated */ 763 struct sched_domain *parent; /* top domain must be null terminated */
739 struct sched_domain *child; /* bottom domain must be null terminated */ 764 struct sched_domain *child; /* bottom domain must be null terminated */
740 struct sched_group *groups; /* the balancing groups of the domain */ 765 struct sched_group *groups; /* the balancing groups of the domain */
741 cpumask_t span; /* span of all CPUs in this domain */ 766 cpumask_t span; /* span of all CPUs in this domain */
767 int first_cpu; /* cache of the first cpu in this domain */
742 unsigned long min_interval; /* Minimum balance interval ms */ 768 unsigned long min_interval; /* Minimum balance interval ms */
743 unsigned long max_interval; /* Maximum balance interval ms */ 769 unsigned long max_interval; /* Maximum balance interval ms */
744 unsigned int busy_factor; /* less balancing by factor if busy */ 770 unsigned int busy_factor; /* less balancing by factor if busy */
@@ -750,6 +776,7 @@ struct sched_domain {
750 unsigned int wake_idx; 776 unsigned int wake_idx;
751 unsigned int forkexec_idx; 777 unsigned int forkexec_idx;
752 int flags; /* See SD_* */ 778 int flags; /* See SD_* */
779 enum sched_domain_level level;
753 780
754 /* Runtime fields. */ 781 /* Runtime fields. */
755 unsigned long last_balance; /* init to jiffies. units in jiffies */ 782 unsigned long last_balance; /* init to jiffies. units in jiffies */
@@ -789,7 +816,8 @@ struct sched_domain {
789#endif 816#endif
790}; 817};
791 818
792extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new); 819extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
820 struct sched_domain_attr *dattr_new);
793extern int arch_reinit_sched_domains(void); 821extern int arch_reinit_sched_domains(void);
794 822
795#endif /* CONFIG_SMP */ 823#endif /* CONFIG_SMP */
@@ -889,7 +917,8 @@ struct sched_class {
889 void (*set_curr_task) (struct rq *rq); 917 void (*set_curr_task) (struct rq *rq);
890 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); 918 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
891 void (*task_new) (struct rq *rq, struct task_struct *p); 919 void (*task_new) (struct rq *rq, struct task_struct *p);
892 void (*set_cpus_allowed)(struct task_struct *p, cpumask_t *newmask); 920 void (*set_cpus_allowed)(struct task_struct *p,
921 const cpumask_t *newmask);
893 922
894 void (*join_domain)(struct rq *rq); 923 void (*join_domain)(struct rq *rq);
895 void (*leave_domain)(struct rq *rq); 924 void (*leave_domain)(struct rq *rq);
@@ -923,6 +952,7 @@ struct load_weight {
923struct sched_entity { 952struct sched_entity {
924 struct load_weight load; /* for load-balancing */ 953 struct load_weight load; /* for load-balancing */
925 struct rb_node run_node; 954 struct rb_node run_node;
955 struct list_head group_node;
926 unsigned int on_rq; 956 unsigned int on_rq;
927 957
928 u64 exec_start; 958 u64 exec_start;
@@ -982,6 +1012,7 @@ struct sched_rt_entity {
982 unsigned long timeout; 1012 unsigned long timeout;
983 int nr_cpus_allowed; 1013 int nr_cpus_allowed;
984 1014
1015 struct sched_rt_entity *back;
985#ifdef CONFIG_RT_GROUP_SCHED 1016#ifdef CONFIG_RT_GROUP_SCHED
986 struct sched_rt_entity *parent; 1017 struct sched_rt_entity *parent;
987 /* rq on which this entity is (to be) queued: */ 1018 /* rq on which this entity is (to be) queued: */
@@ -1109,7 +1140,7 @@ struct task_struct {
1109 gid_t gid,egid,sgid,fsgid; 1140 gid_t gid,egid,sgid,fsgid;
1110 struct group_info *group_info; 1141 struct group_info *group_info;
1111 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; 1142 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset;
1112 unsigned keep_capabilities:1; 1143 unsigned securebits;
1113 struct user_struct *user; 1144 struct user_struct *user;
1114#ifdef CONFIG_KEYS 1145#ifdef CONFIG_KEYS
1115 struct key *request_key_auth; /* assumed request_key authority */ 1146 struct key *request_key_auth; /* assumed request_key authority */
@@ -1144,7 +1175,7 @@ struct task_struct {
1144 struct sighand_struct *sighand; 1175 struct sighand_struct *sighand;
1145 1176
1146 sigset_t blocked, real_blocked; 1177 sigset_t blocked, real_blocked;
1147 sigset_t saved_sigmask; /* To be restored with TIF_RESTORE_SIGMASK */ 1178 sigset_t saved_sigmask; /* restored if set_restore_sigmask() was used */
1148 struct sigpending pending; 1179 struct sigpending pending;
1149 1180
1150 unsigned long sas_ss_sp; 1181 unsigned long sas_ss_sp;
@@ -1502,15 +1533,21 @@ static inline void put_task_struct(struct task_struct *t)
1502#define used_math() tsk_used_math(current) 1533#define used_math() tsk_used_math(current)
1503 1534
1504#ifdef CONFIG_SMP 1535#ifdef CONFIG_SMP
1505extern int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask); 1536extern int set_cpus_allowed_ptr(struct task_struct *p,
1537 const cpumask_t *new_mask);
1506#else 1538#else
1507static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) 1539static inline int set_cpus_allowed_ptr(struct task_struct *p,
1540 const cpumask_t *new_mask)
1508{ 1541{
1509 if (!cpu_isset(0, new_mask)) 1542 if (!cpu_isset(0, *new_mask))
1510 return -EINVAL; 1543 return -EINVAL;
1511 return 0; 1544 return 0;
1512} 1545}
1513#endif 1546#endif
1547static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1548{
1549 return set_cpus_allowed_ptr(p, &new_mask);
1550}
1514 1551
1515extern unsigned long long sched_clock(void); 1552extern unsigned long long sched_clock(void);
1516 1553
@@ -1551,7 +1588,6 @@ static inline void wake_up_idle_cpu(int cpu) { }
1551extern unsigned int sysctl_sched_latency; 1588extern unsigned int sysctl_sched_latency;
1552extern unsigned int sysctl_sched_min_granularity; 1589extern unsigned int sysctl_sched_min_granularity;
1553extern unsigned int sysctl_sched_wakeup_granularity; 1590extern unsigned int sysctl_sched_wakeup_granularity;
1554extern unsigned int sysctl_sched_batch_wakeup_granularity;
1555extern unsigned int sysctl_sched_child_runs_first; 1591extern unsigned int sysctl_sched_child_runs_first;
1556extern unsigned int sysctl_sched_features; 1592extern unsigned int sysctl_sched_features;
1557extern unsigned int sysctl_sched_migration_cost; 1593extern unsigned int sysctl_sched_migration_cost;
@@ -1564,6 +1600,10 @@ int sched_nr_latency_handler(struct ctl_table *table, int write,
1564extern unsigned int sysctl_sched_rt_period; 1600extern unsigned int sysctl_sched_rt_period;
1565extern int sysctl_sched_rt_runtime; 1601extern int sysctl_sched_rt_runtime;
1566 1602
1603int sched_rt_handler(struct ctl_table *table, int write,
1604 struct file *filp, void __user *buffer, size_t *lenp,
1605 loff_t *ppos);
1606
1567extern unsigned int sysctl_sched_compat_yield; 1607extern unsigned int sysctl_sched_compat_yield;
1568 1608
1569#ifdef CONFIG_RT_MUTEXES 1609#ifdef CONFIG_RT_MUTEXES
@@ -1637,7 +1677,10 @@ extern struct pid_namespace init_pid_ns;
1637extern struct task_struct *find_task_by_pid_type_ns(int type, int pid, 1677extern struct task_struct *find_task_by_pid_type_ns(int type, int pid,
1638 struct pid_namespace *ns); 1678 struct pid_namespace *ns);
1639 1679
1640extern struct task_struct *find_task_by_pid(pid_t nr); 1680static inline struct task_struct *__deprecated find_task_by_pid(pid_t nr)
1681{
1682 return find_task_by_pid_type_ns(PIDTYPE_PID, nr, &init_pid_ns);
1683}
1641extern struct task_struct *find_task_by_vpid(pid_t nr); 1684extern struct task_struct *find_task_by_vpid(pid_t nr);
1642extern struct task_struct *find_task_by_pid_ns(pid_t nr, 1685extern struct task_struct *find_task_by_pid_ns(pid_t nr,
1643 struct pid_namespace *ns); 1686 struct pid_namespace *ns);
@@ -1713,8 +1756,7 @@ extern void zap_other_threads(struct task_struct *p);
1713extern int kill_proc(pid_t, int, int); 1756extern int kill_proc(pid_t, int, int);
1714extern struct sigqueue *sigqueue_alloc(void); 1757extern struct sigqueue *sigqueue_alloc(void);
1715extern void sigqueue_free(struct sigqueue *); 1758extern void sigqueue_free(struct sigqueue *);
1716extern int send_sigqueue(int, struct sigqueue *, struct task_struct *); 1759extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group);
1717extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *);
1718extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); 1760extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
1719extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); 1761extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
1720 1762
@@ -1765,6 +1807,8 @@ extern void mmput(struct mm_struct *);
1765extern struct mm_struct *get_task_mm(struct task_struct *task); 1807extern struct mm_struct *get_task_mm(struct task_struct *task);
1766/* Remove the current tasks stale references to the old mm_struct */ 1808/* Remove the current tasks stale references to the old mm_struct */
1767extern void mm_release(struct task_struct *, struct mm_struct *); 1809extern void mm_release(struct task_struct *, struct mm_struct *);
1810/* Allocate a new mm structure and copy contents from tsk->mm */
1811extern struct mm_struct *dup_mm(struct task_struct *tsk);
1768 1812
1769extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); 1813extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *);
1770extern void flush_thread(void); 1814extern void flush_thread(void);
@@ -1893,6 +1937,8 @@ static inline unsigned long *end_of_stack(struct task_struct *p)
1893 1937
1894#endif 1938#endif
1895 1939
1940extern void thread_info_cache_init(void);
1941
1896/* set thread flags in other task's structures 1942/* set thread flags in other task's structures
1897 * - see asm/thread_info.h for TIF_xxxx flags available 1943 * - see asm/thread_info.h for TIF_xxxx flags available
1898 */ 1944 */
@@ -2031,7 +2077,7 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm)
2031} 2077}
2032#endif 2078#endif
2033 2079
2034extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); 2080extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask);
2035extern long sched_getaffinity(pid_t pid, cpumask_t *mask); 2081extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
2036 2082
2037extern int sched_mc_power_savings, sched_smt_power_savings; 2083extern int sched_mc_power_savings, sched_smt_power_savings;
@@ -2041,8 +2087,11 @@ extern void normalize_rt_tasks(void);
2041#ifdef CONFIG_GROUP_SCHED 2087#ifdef CONFIG_GROUP_SCHED
2042 2088
2043extern struct task_group init_task_group; 2089extern struct task_group init_task_group;
2090#ifdef CONFIG_USER_SCHED
2091extern struct task_group root_task_group;
2092#endif
2044 2093
2045extern struct task_group *sched_create_group(void); 2094extern struct task_group *sched_create_group(struct task_group *parent);
2046extern void sched_destroy_group(struct task_group *tg); 2095extern void sched_destroy_group(struct task_group *tg);
2047extern void sched_move_task(struct task_struct *tsk); 2096extern void sched_move_task(struct task_struct *tsk);
2048#ifdef CONFIG_FAIR_GROUP_SCHED 2097#ifdef CONFIG_FAIR_GROUP_SCHED
@@ -2053,6 +2102,9 @@ extern unsigned long sched_group_shares(struct task_group *tg);
2053extern int sched_group_set_rt_runtime(struct task_group *tg, 2102extern int sched_group_set_rt_runtime(struct task_group *tg,
2054 long rt_runtime_us); 2103 long rt_runtime_us);
2055extern long sched_group_rt_runtime(struct task_group *tg); 2104extern long sched_group_rt_runtime(struct task_group *tg);
2105extern int sched_group_set_rt_period(struct task_group *tg,
2106 long rt_period_us);
2107extern long sched_group_rt_period(struct task_group *tg);
2056#endif 2108#endif
2057#endif 2109#endif
2058 2110
@@ -2106,6 +2158,19 @@ static inline void migration_init(void)
2106#define TASK_SIZE_OF(tsk) TASK_SIZE 2158#define TASK_SIZE_OF(tsk) TASK_SIZE
2107#endif 2159#endif
2108 2160
2161#ifdef CONFIG_MM_OWNER
2162extern void mm_update_next_owner(struct mm_struct *mm);
2163extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
2164#else
2165static inline void mm_update_next_owner(struct mm_struct *mm)
2166{
2167}
2168
2169static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2170{
2171}
2172#endif /* CONFIG_MM_OWNER */
2173
2109#endif /* __KERNEL__ */ 2174#endif /* __KERNEL__ */
2110 2175
2111#endif 2176#endif
diff --git a/include/linux/securebits.h b/include/linux/securebits.h
index 5b0617840fa4..c1f19dbceb05 100644
--- a/include/linux/securebits.h
+++ b/include/linux/securebits.h
@@ -3,28 +3,39 @@
3 3
4#define SECUREBITS_DEFAULT 0x00000000 4#define SECUREBITS_DEFAULT 0x00000000
5 5
6extern unsigned securebits;
7
8/* When set UID 0 has no special privileges. When unset, we support 6/* When set UID 0 has no special privileges. When unset, we support
9 inheritance of root-permissions and suid-root executable under 7 inheritance of root-permissions and suid-root executable under
10 compatibility mode. We raise the effective and inheritable bitmasks 8 compatibility mode. We raise the effective and inheritable bitmasks
11 *of the executable file* if the effective uid of the new process is 9 *of the executable file* if the effective uid of the new process is
12 0. If the real uid is 0, we raise the inheritable bitmask of the 10 0. If the real uid is 0, we raise the inheritable bitmask of the
13 executable file. */ 11 executable file. */
14#define SECURE_NOROOT 0 12#define SECURE_NOROOT 0
13#define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */
15 14
16/* When set, setuid to/from uid 0 does not trigger capability-"fixes" 15/* When set, setuid to/from uid 0 does not trigger capability-"fixes"
17 to be compatible with old programs relying on set*uid to loose 16 to be compatible with old programs relying on set*uid to loose
18 privileges. When unset, setuid doesn't change privileges. */ 17 privileges. When unset, setuid doesn't change privileges. */
19#define SECURE_NO_SETUID_FIXUP 2 18#define SECURE_NO_SETUID_FIXUP 2
19#define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */
20
21/* When set, a process can retain its capabilities even after
22 transitioning to a non-root user (the set-uid fixup suppressed by
23 bit 2). Bit-4 is cleared when a process calls exec(); setting both
24 bit 4 and 5 will create a barrier through exec that no exec()'d
25 child can use this feature again. */
26#define SECURE_KEEP_CAPS 4
27#define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */
20 28
21/* Each securesetting is implemented using two bits. One bit specify 29/* Each securesetting is implemented using two bits. One bit specify
22 whether the setting is on or off. The other bit specify whether the 30 whether the setting is on or off. The other bit specify whether the
23 setting is fixed or not. A setting which is fixed cannot be changed 31 setting is fixed or not. A setting which is fixed cannot be changed
24 from user-level. */ 32 from user-level. */
33#define issecure_mask(X) (1 << (X))
34#define issecure(X) (issecure_mask(X) & current->securebits)
25 35
26#define issecure(X) ( (1 << (X+1)) & SECUREBITS_DEFAULT ? \ 36#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \
27 (1 << (X)) & SECUREBITS_DEFAULT : \ 37 issecure_mask(SECURE_NO_SETUID_FIXUP) | \
28 (1 << (X)) & securebits ) 38 issecure_mask(SECURE_KEEP_CAPS))
39#define SECURE_ALL_LOCKS (SECURE_ALL_BITS << 1)
29 40
30#endif /* !_LINUX_SECUREBITS_H */ 41#endif /* !_LINUX_SECUREBITS_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index c673dfd4dffc..50737c70e78e 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -34,33 +34,38 @@
34#include <linux/xfrm.h> 34#include <linux/xfrm.h>
35#include <net/flow.h> 35#include <net/flow.h>
36 36
37extern unsigned securebits; 37/* Maximum number of letters for an LSM name string */
38#define SECURITY_NAME_MAX 10
38 39
39struct ctl_table; 40struct ctl_table;
41struct audit_krule;
40 42
41/* 43/*
42 * These functions are in security/capability.c and are used 44 * These functions are in security/capability.c and are used
43 * as the default capabilities functions 45 * as the default capabilities functions
44 */ 46 */
45extern int cap_capable (struct task_struct *tsk, int cap); 47extern int cap_capable(struct task_struct *tsk, int cap);
46extern int cap_settime (struct timespec *ts, struct timezone *tz); 48extern int cap_settime(struct timespec *ts, struct timezone *tz);
47extern int cap_ptrace (struct task_struct *parent, struct task_struct *child); 49extern int cap_ptrace(struct task_struct *parent, struct task_struct *child);
48extern int cap_capget (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 50extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
49extern int cap_capset_check (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 51extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
50extern void cap_capset_set (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 52extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
51extern int cap_bprm_set_security (struct linux_binprm *bprm); 53extern int cap_bprm_set_security(struct linux_binprm *bprm);
52extern void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe); 54extern void cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
53extern int cap_bprm_secureexec(struct linux_binprm *bprm); 55extern int cap_bprm_secureexec(struct linux_binprm *bprm);
54extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags); 56extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
55extern int cap_inode_removexattr(struct dentry *dentry, char *name); 57 const void *value, size_t size, int flags);
58extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
56extern int cap_inode_need_killpriv(struct dentry *dentry); 59extern int cap_inode_need_killpriv(struct dentry *dentry);
57extern int cap_inode_killpriv(struct dentry *dentry); 60extern int cap_inode_killpriv(struct dentry *dentry);
58extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); 61extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
59extern void cap_task_reparent_to_init (struct task_struct *p); 62extern void cap_task_reparent_to_init(struct task_struct *p);
60extern int cap_task_setscheduler (struct task_struct *p, int policy, struct sched_param *lp); 63extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
61extern int cap_task_setioprio (struct task_struct *p, int ioprio); 64 unsigned long arg4, unsigned long arg5, long *rc_p);
62extern int cap_task_setnice (struct task_struct *p, int nice); 65extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp);
63extern int cap_syslog (int type); 66extern int cap_task_setioprio(struct task_struct *p, int ioprio);
67extern int cap_task_setnice(struct task_struct *p, int nice);
68extern int cap_syslog(int type);
64extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); 69extern int cap_vm_enough_memory(struct mm_struct *mm, long pages);
65 70
66struct msghdr; 71struct msghdr;
@@ -124,7 +129,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
124{ 129{
125 int i; 130 int i;
126 if (opts->mnt_opts) 131 if (opts->mnt_opts)
127 for(i = 0; i < opts->num_mnt_opts; i++) 132 for (i = 0; i < opts->num_mnt_opts; i++)
128 kfree(opts->mnt_opts[i]); 133 kfree(opts->mnt_opts[i]);
129 kfree(opts->mnt_opts); 134 kfree(opts->mnt_opts);
130 opts->mnt_opts = NULL; 135 opts->mnt_opts = NULL;
@@ -136,6 +141,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
136/** 141/**
137 * struct security_operations - main security structure 142 * struct security_operations - main security structure
138 * 143 *
144 * Security module identifier.
145 *
146 * @name:
147 * A string that acts as a unique identifeir for the LSM with max number
148 * of characters = SECURITY_NAME_MAX.
149 *
139 * Security hooks for program execution operations. 150 * Security hooks for program execution operations.
140 * 151 *
141 * @bprm_alloc_security: 152 * @bprm_alloc_security:
@@ -180,21 +191,21 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
180 * @bprm contains the linux_binprm structure. 191 * @bprm contains the linux_binprm structure.
181 * Return 0 if the hook is successful and permission is granted. 192 * Return 0 if the hook is successful and permission is granted.
182 * @bprm_check_security: 193 * @bprm_check_security:
183 * This hook mediates the point when a search for a binary handler will 194 * This hook mediates the point when a search for a binary handler will
184 * begin. It allows a check the @bprm->security value which is set in 195 * begin. It allows a check the @bprm->security value which is set in
185 * the preceding set_security call. The primary difference from 196 * the preceding set_security call. The primary difference from
186 * set_security is that the argv list and envp list are reliably 197 * set_security is that the argv list and envp list are reliably
187 * available in @bprm. This hook may be called multiple times 198 * available in @bprm. This hook may be called multiple times
188 * during a single execve; and in each pass set_security is called 199 * during a single execve; and in each pass set_security is called
189 * first. 200 * first.
190 * @bprm contains the linux_binprm structure. 201 * @bprm contains the linux_binprm structure.
191 * Return 0 if the hook is successful and permission is granted. 202 * Return 0 if the hook is successful and permission is granted.
192 * @bprm_secureexec: 203 * @bprm_secureexec:
193 * Return a boolean value (0 or 1) indicating whether a "secure exec" 204 * Return a boolean value (0 or 1) indicating whether a "secure exec"
194 * is required. The flag is passed in the auxiliary table 205 * is required. The flag is passed in the auxiliary table
195 * on the initial stack to the ELF interpreter to indicate whether libc 206 * on the initial stack to the ELF interpreter to indicate whether libc
196 * should enable secure mode. 207 * should enable secure mode.
197 * @bprm contains the linux_binprm structure. 208 * @bprm contains the linux_binprm structure.
198 * 209 *
199 * Security hooks for filesystem operations. 210 * Security hooks for filesystem operations.
200 * 211 *
@@ -211,7 +222,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
211 * Check permission before obtaining filesystem statistics for the @mnt 222 * Check permission before obtaining filesystem statistics for the @mnt
212 * mountpoint. 223 * mountpoint.
213 * @dentry is a handle on the superblock for the filesystem. 224 * @dentry is a handle on the superblock for the filesystem.
214 * Return 0 if permission is granted. 225 * Return 0 if permission is granted.
215 * @sb_mount: 226 * @sb_mount:
216 * Check permission before an object specified by @dev_name is mounted on 227 * Check permission before an object specified by @dev_name is mounted on
217 * the mount point named by @nd. For an ordinary mount, @dev_name 228 * the mount point named by @nd. For an ordinary mount, @dev_name
@@ -220,7 +231,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
220 * loopback/bind mount (@flags & MS_BIND), @dev_name identifies the 231 * loopback/bind mount (@flags & MS_BIND), @dev_name identifies the
221 * pathname of the object being mounted. 232 * pathname of the object being mounted.
222 * @dev_name contains the name for object being mounted. 233 * @dev_name contains the name for object being mounted.
223 * @nd contains the nameidata structure for mount point object. 234 * @path contains the path for mount point object.
224 * @type contains the filesystem type. 235 * @type contains the filesystem type.
225 * @flags contains the mount flags. 236 * @flags contains the mount flags.
226 * @data contains the filesystem-specific data. 237 * @data contains the filesystem-specific data.
@@ -239,7 +250,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
239 * Check permission before the device with superblock @mnt->sb is mounted 250 * Check permission before the device with superblock @mnt->sb is mounted
240 * on the mount point named by @nd. 251 * on the mount point named by @nd.
241 * @mnt contains the vfsmount for device being mounted. 252 * @mnt contains the vfsmount for device being mounted.
242 * @nd contains the nameidata object for the mount point. 253 * @path contains the path for the mount point.
243 * Return 0 if permission is granted. 254 * Return 0 if permission is granted.
244 * @sb_umount: 255 * @sb_umount:
245 * Check permission before the @mnt file system is unmounted. 256 * Check permission before the @mnt file system is unmounted.
@@ -268,16 +279,16 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
268 * This hook is called any time a mount is successfully grafetd to 279 * This hook is called any time a mount is successfully grafetd to
269 * the tree. 280 * the tree.
270 * @mnt contains the mounted filesystem. 281 * @mnt contains the mounted filesystem.
271 * @mountpoint_nd contains the nameidata structure for the mount point. 282 * @mountpoint contains the path for the mount point.
272 * @sb_pivotroot: 283 * @sb_pivotroot:
273 * Check permission before pivoting the root filesystem. 284 * Check permission before pivoting the root filesystem.
274 * @old_nd contains the nameidata structure for the new location of the current root (put_old). 285 * @old_path contains the path for the new location of the current root (put_old).
275 * @new_nd contains the nameidata structure for the new root (new_root). 286 * @new_path contains the path for the new root (new_root).
276 * Return 0 if permission is granted. 287 * Return 0 if permission is granted.
277 * @sb_post_pivotroot: 288 * @sb_post_pivotroot:
278 * Update module state after a successful pivot. 289 * Update module state after a successful pivot.
279 * @old_nd contains the nameidata structure for the old root. 290 * @old_path contains the path for the old root.
280 * @new_nd contains the nameidata structure for the new root. 291 * @new_path contains the path for the new root.
281 * @sb_get_mnt_opts: 292 * @sb_get_mnt_opts:
282 * Get the security relevant mount options used for a superblock 293 * Get the security relevant mount options used for a superblock
283 * @sb the superblock to get security mount options from 294 * @sb the superblock to get security mount options from
@@ -306,9 +317,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
306 * @inode_free_security: 317 * @inode_free_security:
307 * @inode contains the inode structure. 318 * @inode contains the inode structure.
308 * Deallocate the inode security structure and set @inode->i_security to 319 * Deallocate the inode security structure and set @inode->i_security to
309 * NULL. 320 * NULL.
310 * @inode_init_security: 321 * @inode_init_security:
311 * Obtain the security attribute name suffix and value to set on a newly 322 * Obtain the security attribute name suffix and value to set on a newly
312 * created inode and set up the incore security field for the new inode. 323 * created inode and set up the incore security field for the new inode.
313 * This hook is called by the fs code as part of the inode creation 324 * This hook is called by the fs code as part of the inode creation
314 * transaction and provides for atomic labeling of the inode, unlike 325 * transaction and provides for atomic labeling of the inode, unlike
@@ -339,7 +350,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
339 * @new_dentry contains the dentry structure for the new link. 350 * @new_dentry contains the dentry structure for the new link.
340 * Return 0 if permission is granted. 351 * Return 0 if permission is granted.
341 * @inode_unlink: 352 * @inode_unlink:
342 * Check the permission to remove a hard link to a file. 353 * Check the permission to remove a hard link to a file.
343 * @dir contains the inode structure of parent directory of the file. 354 * @dir contains the inode structure of parent directory of the file.
344 * @dentry contains the dentry structure for file to be unlinked. 355 * @dentry contains the dentry structure for file to be unlinked.
345 * Return 0 if permission is granted. 356 * Return 0 if permission is granted.
@@ -351,7 +362,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
351 * Return 0 if permission is granted. 362 * Return 0 if permission is granted.
352 * @inode_mkdir: 363 * @inode_mkdir:
353 * Check permissions to create a new directory in the existing directory 364 * Check permissions to create a new directory in the existing directory
354 * associated with inode strcture @dir. 365 * associated with inode strcture @dir.
355 * @dir containst the inode structure of parent of the directory to be created. 366 * @dir containst the inode structure of parent of the directory to be created.
356 * @dentry contains the dentry structure of new directory. 367 * @dentry contains the dentry structure of new directory.
357 * @mode contains the mode of new directory. 368 * @mode contains the mode of new directory.
@@ -396,7 +407,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
396 * called when the actual read/write operations are performed. 407 * called when the actual read/write operations are performed.
397 * @inode contains the inode structure to check. 408 * @inode contains the inode structure to check.
398 * @mask contains the permission mask. 409 * @mask contains the permission mask.
399 * @nd contains the nameidata (may be NULL). 410 * @nd contains the nameidata (may be NULL).
400 * Return 0 if permission is granted. 411 * Return 0 if permission is granted.
401 * @inode_setattr: 412 * @inode_setattr:
402 * Check permission before setting file attributes. Note that the kernel 413 * Check permission before setting file attributes. Note that the kernel
@@ -418,24 +429,24 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
418 * can use this hook to release any persistent label associated with the 429 * can use this hook to release any persistent label associated with the
419 * inode. 430 * inode.
420 * @inode_setxattr: 431 * @inode_setxattr:
421 * Check permission before setting the extended attributes 432 * Check permission before setting the extended attributes
422 * @value identified by @name for @dentry. 433 * @value identified by @name for @dentry.
423 * Return 0 if permission is granted. 434 * Return 0 if permission is granted.
424 * @inode_post_setxattr: 435 * @inode_post_setxattr:
425 * Update inode security field after successful setxattr operation. 436 * Update inode security field after successful setxattr operation.
426 * @value identified by @name for @dentry. 437 * @value identified by @name for @dentry.
427 * @inode_getxattr: 438 * @inode_getxattr:
428 * Check permission before obtaining the extended attributes 439 * Check permission before obtaining the extended attributes
429 * identified by @name for @dentry. 440 * identified by @name for @dentry.
430 * Return 0 if permission is granted. 441 * Return 0 if permission is granted.
431 * @inode_listxattr: 442 * @inode_listxattr:
432 * Check permission before obtaining the list of extended attribute 443 * Check permission before obtaining the list of extended attribute
433 * names for @dentry. 444 * names for @dentry.
434 * Return 0 if permission is granted. 445 * Return 0 if permission is granted.
435 * @inode_removexattr: 446 * @inode_removexattr:
436 * Check permission before removing the extended attribute 447 * Check permission before removing the extended attribute
437 * identified by @name for @dentry. 448 * identified by @name for @dentry.
438 * Return 0 if permission is granted. 449 * Return 0 if permission is granted.
439 * @inode_getsecurity: 450 * @inode_getsecurity:
440 * Retrieve a copy of the extended attribute representation of the 451 * Retrieve a copy of the extended attribute representation of the
441 * security label associated with @name for @inode via @buffer. Note that 452 * security label associated with @name for @inode via @buffer. Note that
@@ -447,7 +458,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
447 * Set the security label associated with @name for @inode from the 458 * Set the security label associated with @name for @inode from the
448 * extended attribute value @value. @size indicates the size of the 459 * extended attribute value @value. @size indicates the size of the
449 * @value in bytes. @flags may be XATTR_CREATE, XATTR_REPLACE, or 0. 460 * @value in bytes. @flags may be XATTR_CREATE, XATTR_REPLACE, or 0.
450 * Note that @name is the remainder of the attribute name after the 461 * Note that @name is the remainder of the attribute name after the
451 * security. prefix has been removed. 462 * security. prefix has been removed.
452 * Return 0 on success. 463 * Return 0 on success.
453 * @inode_listsecurity: 464 * @inode_listsecurity:
@@ -468,6 +479,11 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
468 * @dentry is the dentry being changed. 479 * @dentry is the dentry being changed.
469 * Return 0 on success. If error is returned, then the operation 480 * Return 0 on success. If error is returned, then the operation
470 * causing setuid bit removal is failed. 481 * causing setuid bit removal is failed.
482 * @inode_getsecid:
483 * Get the secid associated with the node.
484 * @inode contains a pointer to the inode.
485 * @secid contains a pointer to the location where result will be saved.
486 * In case of failure, @secid will be set to zero.
471 * 487 *
472 * Security hooks for file operations 488 * Security hooks for file operations
473 * 489 *
@@ -549,7 +565,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
549 * struct file, so the file structure (and associated security information) 565 * struct file, so the file structure (and associated security information)
550 * can always be obtained: 566 * can always be obtained:
551 * container_of(fown, struct file, f_owner) 567 * container_of(fown, struct file, f_owner)
552 * @tsk contains the structure of task receiving signal. 568 * @tsk contains the structure of task receiving signal.
553 * @fown contains the file owner information. 569 * @fown contains the file owner information.
554 * @sig is the signal that will be sent. When 0, kernel sends SIGIO. 570 * @sig is the signal that will be sent. When 0, kernel sends SIGIO.
555 * Return 0 if permission is granted. 571 * Return 0 if permission is granted.
@@ -636,6 +652,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
636 * @task_getsecid: 652 * @task_getsecid:
637 * Retrieve the security identifier of the process @p. 653 * Retrieve the security identifier of the process @p.
638 * @p contains the task_struct for the process and place is into @secid. 654 * @p contains the task_struct for the process and place is into @secid.
655 * In case of failure, @secid will be set to zero.
656 *
639 * @task_setgroups: 657 * @task_setgroups:
640 * Check permission before setting the supplementary group set of the 658 * Check permission before setting the supplementary group set of the
641 * current process. 659 * current process.
@@ -703,14 +721,16 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
703 * @arg3 contains a argument. 721 * @arg3 contains a argument.
704 * @arg4 contains a argument. 722 * @arg4 contains a argument.
705 * @arg5 contains a argument. 723 * @arg5 contains a argument.
706 * Return 0 if permission is granted. 724 * @rc_p contains a pointer to communicate back the forced return code
725 * Return 0 if permission is granted, and non-zero if the security module
726 * has taken responsibility (setting *rc_p) for the prctl call.
707 * @task_reparent_to_init: 727 * @task_reparent_to_init:
708 * Set the security attributes in @p->security for a kernel thread that 728 * Set the security attributes in @p->security for a kernel thread that
709 * is being reparented to the init task. 729 * is being reparented to the init task.
710 * @p contains the task_struct for the kernel thread. 730 * @p contains the task_struct for the kernel thread.
711 * @task_to_inode: 731 * @task_to_inode:
712 * Set the security attributes for an inode based on an associated task's 732 * Set the security attributes for an inode based on an associated task's
713 * security attributes, e.g. for /proc/pid inodes. 733 * security attributes, e.g. for /proc/pid inodes.
714 * @p contains the task_struct for the task. 734 * @p contains the task_struct for the task.
715 * @inode contains the inode structure for the inode. 735 * @inode contains the inode structure for the inode.
716 * 736 *
@@ -720,7 +740,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
720 * Save security information for a netlink message so that permission 740 * Save security information for a netlink message so that permission
721 * checking can be performed when the message is processed. The security 741 * checking can be performed when the message is processed. The security
722 * information can be saved using the eff_cap field of the 742 * information can be saved using the eff_cap field of the
723 * netlink_skb_parms structure. Also may be used to provide fine 743 * netlink_skb_parms structure. Also may be used to provide fine
724 * grained control over message transmission. 744 * grained control over message transmission.
725 * @sk associated sock of task sending the message., 745 * @sk associated sock of task sending the message.,
726 * @skb contains the sk_buff structure for the netlink message. 746 * @skb contains the sk_buff structure for the netlink message.
@@ -788,14 +808,14 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
788 * @sock contains the socket structure. 808 * @sock contains the socket structure.
789 * @address contains the address to bind to. 809 * @address contains the address to bind to.
790 * @addrlen contains the length of address. 810 * @addrlen contains the length of address.
791 * Return 0 if permission is granted. 811 * Return 0 if permission is granted.
792 * @socket_connect: 812 * @socket_connect:
793 * Check permission before socket protocol layer connect operation 813 * Check permission before socket protocol layer connect operation
794 * attempts to connect socket @sock to a remote address, @address. 814 * attempts to connect socket @sock to a remote address, @address.
795 * @sock contains the socket structure. 815 * @sock contains the socket structure.
796 * @address contains the address of remote endpoint. 816 * @address contains the address of remote endpoint.
797 * @addrlen contains the length of address. 817 * @addrlen contains the length of address.
798 * Return 0 if permission is granted. 818 * Return 0 if permission is granted.
799 * @socket_listen: 819 * @socket_listen:
800 * Check permission before socket protocol layer listen operation. 820 * Check permission before socket protocol layer listen operation.
801 * @sock contains the socket structure. 821 * @sock contains the socket structure.
@@ -825,7 +845,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
825 * @msg contains the message structure. 845 * @msg contains the message structure.
826 * @size contains the size of message structure. 846 * @size contains the size of message structure.
827 * @flags contains the operational flags. 847 * @flags contains the operational flags.
828 * Return 0 if permission is granted. 848 * Return 0 if permission is granted.
829 * @socket_getsockname: 849 * @socket_getsockname:
830 * Check permission before the local address (name) of the socket object 850 * Check permission before the local address (name) of the socket object
831 * @sock is retrieved. 851 * @sock is retrieved.
@@ -849,7 +869,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
849 * @sock contains the socket structure. 869 * @sock contains the socket structure.
850 * @level contains the protocol level to set options for. 870 * @level contains the protocol level to set options for.
851 * @optname contains the name of the option to set. 871 * @optname contains the name of the option to set.
852 * Return 0 if permission is granted. 872 * Return 0 if permission is granted.
853 * @socket_shutdown: 873 * @socket_shutdown:
854 * Checks permission before all or part of a connection on the socket 874 * Checks permission before all or part of a connection on the socket
855 * @sock is shut down. 875 * @sock is shut down.
@@ -876,19 +896,19 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
876 * Return 0 if all is well, otherwise, typical getsockopt return 896 * Return 0 if all is well, otherwise, typical getsockopt return
877 * values. 897 * values.
878 * @socket_getpeersec_dgram: 898 * @socket_getpeersec_dgram:
879 * This hook allows the security module to provide peer socket security 899 * This hook allows the security module to provide peer socket security
880 * state for udp sockets on a per-packet basis to userspace via 900 * state for udp sockets on a per-packet basis to userspace via
881 * getsockopt SO_GETPEERSEC. The application must first have indicated 901 * getsockopt SO_GETPEERSEC. The application must first have indicated
882 * the IP_PASSSEC option via getsockopt. It can then retrieve the 902 * the IP_PASSSEC option via getsockopt. It can then retrieve the
883 * security state returned by this hook for a packet via the SCM_SECURITY 903 * security state returned by this hook for a packet via the SCM_SECURITY
884 * ancillary message type. 904 * ancillary message type.
885 * @skb is the skbuff for the packet being queried 905 * @skb is the skbuff for the packet being queried
886 * @secdata is a pointer to a buffer in which to copy the security data 906 * @secdata is a pointer to a buffer in which to copy the security data
887 * @seclen is the maximum length for @secdata 907 * @seclen is the maximum length for @secdata
888 * Return 0 on success, error on failure. 908 * Return 0 on success, error on failure.
889 * @sk_alloc_security: 909 * @sk_alloc_security:
890 * Allocate and attach a security structure to the sk->sk_security field, 910 * Allocate and attach a security structure to the sk->sk_security field,
891 * which is used to copy security attributes between local stream sockets. 911 * which is used to copy security attributes between local stream sockets.
892 * @sk_free_security: 912 * @sk_free_security:
893 * Deallocate security structure. 913 * Deallocate security structure.
894 * @sk_clone_security: 914 * @sk_clone_security:
@@ -903,31 +923,31 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
903 * @inet_csk_clone: 923 * @inet_csk_clone:
904 * Sets the new child socket's sid to the openreq sid. 924 * Sets the new child socket's sid to the openreq sid.
905 * @inet_conn_established: 925 * @inet_conn_established:
906 * Sets the connection's peersid to the secmark on skb. 926 * Sets the connection's peersid to the secmark on skb.
907 * @req_classify_flow: 927 * @req_classify_flow:
908 * Sets the flow's sid to the openreq sid. 928 * Sets the flow's sid to the openreq sid.
909 * 929 *
910 * Security hooks for XFRM operations. 930 * Security hooks for XFRM operations.
911 * 931 *
912 * @xfrm_policy_alloc_security: 932 * @xfrm_policy_alloc_security:
913 * @xp contains the xfrm_policy being added to Security Policy Database 933 * @ctxp is a pointer to the xfrm_sec_ctx being added to Security Policy
914 * used by the XFRM system. 934 * Database used by the XFRM system.
915 * @sec_ctx contains the security context information being provided by 935 * @sec_ctx contains the security context information being provided by
916 * the user-level policy update program (e.g., setkey). 936 * the user-level policy update program (e.g., setkey).
917 * Allocate a security structure to the xp->security field; the security 937 * Allocate a security structure to the xp->security field; the security
918 * field is initialized to NULL when the xfrm_policy is allocated. 938 * field is initialized to NULL when the xfrm_policy is allocated.
919 * Return 0 if operation was successful (memory to allocate, legal context) 939 * Return 0 if operation was successful (memory to allocate, legal context)
920 * @xfrm_policy_clone_security: 940 * @xfrm_policy_clone_security:
921 * @old contains an existing xfrm_policy in the SPD. 941 * @old_ctx contains an existing xfrm_sec_ctx.
922 * @new contains a new xfrm_policy being cloned from old. 942 * @new_ctxp contains a new xfrm_sec_ctx being cloned from old.
923 * Allocate a security structure to the new->security field 943 * Allocate a security structure in new_ctxp that contains the
924 * that contains the information from the old->security field. 944 * information from the old_ctx structure.
925 * Return 0 if operation was successful (memory to allocate). 945 * Return 0 if operation was successful (memory to allocate).
926 * @xfrm_policy_free_security: 946 * @xfrm_policy_free_security:
927 * @xp contains the xfrm_policy 947 * @ctx contains the xfrm_sec_ctx
928 * Deallocate xp->security. 948 * Deallocate xp->security.
929 * @xfrm_policy_delete_security: 949 * @xfrm_policy_delete_security:
930 * @xp contains the xfrm_policy. 950 * @ctx contains the xfrm_sec_ctx.
931 * Authorize deletion of xp->security. 951 * Authorize deletion of xp->security.
932 * @xfrm_state_alloc_security: 952 * @xfrm_state_alloc_security:
933 * @x contains the xfrm_state being added to the Security Association 953 * @x contains the xfrm_state being added to the Security Association
@@ -947,7 +967,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
947 * @x contains the xfrm_state. 967 * @x contains the xfrm_state.
948 * Authorize deletion of x->security. 968 * Authorize deletion of x->security.
949 * @xfrm_policy_lookup: 969 * @xfrm_policy_lookup:
950 * @xp contains the xfrm_policy for which the access control is being 970 * @ctx contains the xfrm_sec_ctx for which the access control is being
951 * checked. 971 * checked.
952 * @fl_secid contains the flow security label that is used to authorize 972 * @fl_secid contains the flow security label that is used to authorize
953 * access to the policy xp. 973 * access to the policy xp.
@@ -982,13 +1002,24 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
982 * No return value. 1002 * No return value.
983 * @key_permission: 1003 * @key_permission:
984 * See whether a specific operational right is granted to a process on a 1004 * See whether a specific operational right is granted to a process on a
985 * key. 1005 * key.
986 * @key_ref refers to the key (key pointer + possession attribute bit). 1006 * @key_ref refers to the key (key pointer + possession attribute bit).
987 * @context points to the process to provide the context against which to 1007 * @context points to the process to provide the context against which to
988 * evaluate the security data on the key. 1008 * evaluate the security data on the key.
989 * @perm describes the combination of permissions required of this key. 1009 * @perm describes the combination of permissions required of this key.
990 * Return 1 if permission granted, 0 if permission denied and -ve it the 1010 * Return 1 if permission granted, 0 if permission denied and -ve it the
991 * normal permissions model should be effected. 1011 * normal permissions model should be effected.
1012 * @key_getsecurity:
1013 * Get a textual representation of the security context attached to a key
1014 * for the purposes of honouring KEYCTL_GETSECURITY. This function
1015 * allocates the storage for the NUL-terminated string and the caller
1016 * should free it.
1017 * @key points to the key to be queried.
1018 * @_buffer points to a pointer that should be set to point to the
1019 * resulting string (if no label or an error occurs).
1020 * Return the length of the string (including terminating NUL) or -ve if
1021 * an error.
1022 * May also return 0 (and a NULL buffer pointer) if there is no label.
992 * 1023 *
993 * Security hooks affecting all System V IPC operations. 1024 * Security hooks affecting all System V IPC operations.
994 * 1025 *
@@ -997,6 +1028,11 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
997 * @ipcp contains the kernel IPC permission structure 1028 * @ipcp contains the kernel IPC permission structure
998 * @flag contains the desired (requested) permission set 1029 * @flag contains the desired (requested) permission set
999 * Return 0 if permission is granted. 1030 * Return 0 if permission is granted.
1031 * @ipc_getsecid:
1032 * Get the secid associated with the ipc object.
1033 * @ipcp contains the kernel IPC permission structure.
1034 * @secid contains a pointer to the location where result will be saved.
1035 * In case of failure, @secid will be set to zero.
1000 * 1036 *
1001 * Security hooks for individual messages held in System V IPC message queues 1037 * Security hooks for individual messages held in System V IPC message queues
1002 * @msg_msg_alloc_security: 1038 * @msg_msg_alloc_security:
@@ -1034,7 +1070,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1034 * The @msq may be NULL, e.g. for IPC_INFO or MSG_INFO. 1070 * The @msq may be NULL, e.g. for IPC_INFO or MSG_INFO.
1035 * @msq contains the message queue to act upon. May be NULL. 1071 * @msq contains the message queue to act upon. May be NULL.
1036 * @cmd contains the operation to be performed. 1072 * @cmd contains the operation to be performed.
1037 * Return 0 if permission is granted. 1073 * Return 0 if permission is granted.
1038 * @msg_queue_msgsnd: 1074 * @msg_queue_msgsnd:
1039 * Check permission before a message, @msg, is enqueued on the message 1075 * Check permission before a message, @msg, is enqueued on the message
1040 * queue, @msq. 1076 * queue, @msq.
@@ -1044,8 +1080,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1044 * Return 0 if permission is granted. 1080 * Return 0 if permission is granted.
1045 * @msg_queue_msgrcv: 1081 * @msg_queue_msgrcv:
1046 * Check permission before a message, @msg, is removed from the message 1082 * Check permission before a message, @msg, is removed from the message
1047 * queue, @msq. The @target task structure contains a pointer to the 1083 * queue, @msq. The @target task structure contains a pointer to the
1048 * process that will be receiving the message (not equal to the current 1084 * process that will be receiving the message (not equal to the current
1049 * process when inline receives are being performed). 1085 * process when inline receives are being performed).
1050 * @msq contains the message queue to retrieve message from. 1086 * @msq contains the message queue to retrieve message from.
1051 * @msg contains the message destination. 1087 * @msg contains the message destination.
@@ -1110,15 +1146,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1110 * Return 0 if permission is granted. 1146 * Return 0 if permission is granted.
1111 * @sem_semctl: 1147 * @sem_semctl:
1112 * Check permission when a semaphore operation specified by @cmd is to be 1148 * Check permission when a semaphore operation specified by @cmd is to be
1113 * performed on the semaphore @sma. The @sma may be NULL, e.g. for 1149 * performed on the semaphore @sma. The @sma may be NULL, e.g. for
1114 * IPC_INFO or SEM_INFO. 1150 * IPC_INFO or SEM_INFO.
1115 * @sma contains the semaphore structure. May be NULL. 1151 * @sma contains the semaphore structure. May be NULL.
1116 * @cmd contains the operation to be performed. 1152 * @cmd contains the operation to be performed.
1117 * Return 0 if permission is granted. 1153 * Return 0 if permission is granted.
1118 * @sem_semop 1154 * @sem_semop
1119 * Check permissions before performing operations on members of the 1155 * Check permissions before performing operations on members of the
1120 * semaphore set @sma. If the @alter flag is nonzero, the semaphore set 1156 * semaphore set @sma. If the @alter flag is nonzero, the semaphore set
1121 * may be modified. 1157 * may be modified.
1122 * @sma contains the semaphore structure. 1158 * @sma contains the semaphore structure.
1123 * @sops contains the operations to perform. 1159 * @sops contains the operations to perform.
1124 * @nsops contains the number of operations to perform. 1160 * @nsops contains the number of operations to perform.
@@ -1189,7 +1225,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1189 * @syslog: 1225 * @syslog:
1190 * Check permission before accessing the kernel message ring or changing 1226 * Check permission before accessing the kernel message ring or changing
1191 * logging to the console. 1227 * logging to the console.
1192 * See the syslog(2) manual page for an explanation of the @type values. 1228 * See the syslog(2) manual page for an explanation of the @type values.
1193 * @type contains the type of action. 1229 * @type contains the type of action.
1194 * Return 0 if permission is granted. 1230 * Return 0 if permission is granted.
1195 * @settime: 1231 * @settime:
@@ -1201,79 +1237,112 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1201 * @vm_enough_memory: 1237 * @vm_enough_memory:
1202 * Check permissions for allocating a new virtual mapping. 1238 * Check permissions for allocating a new virtual mapping.
1203 * @mm contains the mm struct it is being added to. 1239 * @mm contains the mm struct it is being added to.
1204 * @pages contains the number of pages. 1240 * @pages contains the number of pages.
1205 * Return 0 if permission is granted. 1241 * Return 0 if permission is granted.
1206 * 1242 *
1207 * @register_security: 1243 * @register_security:
1208 * allow module stacking. 1244 * allow module stacking.
1209 * @name contains the name of the security module being stacked. 1245 * @name contains the name of the security module being stacked.
1210 * @ops contains a pointer to the struct security_operations of the module to stack. 1246 * @ops contains a pointer to the struct security_operations of the module to stack.
1211 * 1247 *
1212 * @secid_to_secctx: 1248 * @secid_to_secctx:
1213 * Convert secid to security context. 1249 * Convert secid to security context.
1214 * @secid contains the security ID. 1250 * @secid contains the security ID.
1215 * @secdata contains the pointer that stores the converted security context. 1251 * @secdata contains the pointer that stores the converted security context.
1216 * @secctx_to_secid: 1252 * @secctx_to_secid:
1217 * Convert security context to secid. 1253 * Convert security context to secid.
1218 * @secid contains the pointer to the generated security ID. 1254 * @secid contains the pointer to the generated security ID.
1219 * @secdata contains the security context. 1255 * @secdata contains the security context.
1220 * 1256 *
1221 * @release_secctx: 1257 * @release_secctx:
1222 * Release the security context. 1258 * Release the security context.
1223 * @secdata contains the security context. 1259 * @secdata contains the security context.
1224 * @seclen contains the length of the security context. 1260 * @seclen contains the length of the security context.
1225 * 1261 *
1262 * Security hooks for Audit
1263 *
1264 * @audit_rule_init:
1265 * Allocate and initialize an LSM audit rule structure.
1266 * @field contains the required Audit action. Fields flags are defined in include/linux/audit.h
1267 * @op contains the operator the rule uses.
1268 * @rulestr contains the context where the rule will be applied to.
1269 * @lsmrule contains a pointer to receive the result.
1270 * Return 0 if @lsmrule has been successfully set,
1271 * -EINVAL in case of an invalid rule.
1272 *
1273 * @audit_rule_known:
1274 * Specifies whether given @rule contains any fields related to current LSM.
1275 * @rule contains the audit rule of interest.
1276 * Return 1 in case of relation found, 0 otherwise.
1277 *
1278 * @audit_rule_match:
1279 * Determine if given @secid matches a rule previously approved
1280 * by @audit_rule_known.
1281 * @secid contains the security id in question.
1282 * @field contains the field which relates to current LSM.
1283 * @op contains the operator that will be used for matching.
1284 * @rule points to the audit rule that will be checked against.
1285 * @actx points to the audit context associated with the check.
1286 * Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure.
1287 *
1288 * @audit_rule_free:
1289 * Deallocate the LSM audit rule structure previously allocated by
1290 * audit_rule_init.
1291 * @rule contains the allocated rule
1292 *
1226 * This is the main security structure. 1293 * This is the main security structure.
1227 */ 1294 */
1228struct security_operations { 1295struct security_operations {
1229 int (*ptrace) (struct task_struct * parent, struct task_struct * child); 1296 char name[SECURITY_NAME_MAX + 1];
1230 int (*capget) (struct task_struct * target, 1297
1231 kernel_cap_t * effective, 1298 int (*ptrace) (struct task_struct *parent, struct task_struct *child);
1232 kernel_cap_t * inheritable, kernel_cap_t * permitted); 1299 int (*capget) (struct task_struct *target,
1233 int (*capset_check) (struct task_struct * target, 1300 kernel_cap_t *effective,
1234 kernel_cap_t * effective, 1301 kernel_cap_t *inheritable, kernel_cap_t *permitted);
1235 kernel_cap_t * inheritable, 1302 int (*capset_check) (struct task_struct *target,
1236 kernel_cap_t * permitted); 1303 kernel_cap_t *effective,
1237 void (*capset_set) (struct task_struct * target, 1304 kernel_cap_t *inheritable,
1238 kernel_cap_t * effective, 1305 kernel_cap_t *permitted);
1239 kernel_cap_t * inheritable, 1306 void (*capset_set) (struct task_struct *target,
1240 kernel_cap_t * permitted); 1307 kernel_cap_t *effective,
1241 int (*capable) (struct task_struct * tsk, int cap); 1308 kernel_cap_t *inheritable,
1242 int (*acct) (struct file * file); 1309 kernel_cap_t *permitted);
1243 int (*sysctl) (struct ctl_table * table, int op); 1310 int (*capable) (struct task_struct *tsk, int cap);
1244 int (*quotactl) (int cmds, int type, int id, struct super_block * sb); 1311 int (*acct) (struct file *file);
1245 int (*quota_on) (struct dentry * dentry); 1312 int (*sysctl) (struct ctl_table *table, int op);
1313 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1314 int (*quota_on) (struct dentry *dentry);
1246 int (*syslog) (int type); 1315 int (*syslog) (int type);
1247 int (*settime) (struct timespec *ts, struct timezone *tz); 1316 int (*settime) (struct timespec *ts, struct timezone *tz);
1248 int (*vm_enough_memory) (struct mm_struct *mm, long pages); 1317 int (*vm_enough_memory) (struct mm_struct *mm, long pages);
1249 1318
1250 int (*bprm_alloc_security) (struct linux_binprm * bprm); 1319 int (*bprm_alloc_security) (struct linux_binprm *bprm);
1251 void (*bprm_free_security) (struct linux_binprm * bprm); 1320 void (*bprm_free_security) (struct linux_binprm *bprm);
1252 void (*bprm_apply_creds) (struct linux_binprm * bprm, int unsafe); 1321 void (*bprm_apply_creds) (struct linux_binprm *bprm, int unsafe);
1253 void (*bprm_post_apply_creds) (struct linux_binprm * bprm); 1322 void (*bprm_post_apply_creds) (struct linux_binprm *bprm);
1254 int (*bprm_set_security) (struct linux_binprm * bprm); 1323 int (*bprm_set_security) (struct linux_binprm *bprm);
1255 int (*bprm_check_security) (struct linux_binprm * bprm); 1324 int (*bprm_check_security) (struct linux_binprm *bprm);
1256 int (*bprm_secureexec) (struct linux_binprm * bprm); 1325 int (*bprm_secureexec) (struct linux_binprm *bprm);
1257 1326
1258 int (*sb_alloc_security) (struct super_block * sb); 1327 int (*sb_alloc_security) (struct super_block *sb);
1259 void (*sb_free_security) (struct super_block * sb); 1328 void (*sb_free_security) (struct super_block *sb);
1260 int (*sb_copy_data)(char *orig, char *copy); 1329 int (*sb_copy_data) (char *orig, char *copy);
1261 int (*sb_kern_mount) (struct super_block *sb, void *data); 1330 int (*sb_kern_mount) (struct super_block *sb, void *data);
1262 int (*sb_statfs) (struct dentry *dentry); 1331 int (*sb_statfs) (struct dentry *dentry);
1263 int (*sb_mount) (char *dev_name, struct nameidata * nd, 1332 int (*sb_mount) (char *dev_name, struct path *path,
1264 char *type, unsigned long flags, void *data); 1333 char *type, unsigned long flags, void *data);
1265 int (*sb_check_sb) (struct vfsmount * mnt, struct nameidata * nd); 1334 int (*sb_check_sb) (struct vfsmount *mnt, struct path *path);
1266 int (*sb_umount) (struct vfsmount * mnt, int flags); 1335 int (*sb_umount) (struct vfsmount *mnt, int flags);
1267 void (*sb_umount_close) (struct vfsmount * mnt); 1336 void (*sb_umount_close) (struct vfsmount *mnt);
1268 void (*sb_umount_busy) (struct vfsmount * mnt); 1337 void (*sb_umount_busy) (struct vfsmount *mnt);
1269 void (*sb_post_remount) (struct vfsmount * mnt, 1338 void (*sb_post_remount) (struct vfsmount *mnt,
1270 unsigned long flags, void *data); 1339 unsigned long flags, void *data);
1271 void (*sb_post_addmount) (struct vfsmount * mnt, 1340 void (*sb_post_addmount) (struct vfsmount *mnt,
1272 struct nameidata * mountpoint_nd); 1341 struct path *mountpoint);
1273 int (*sb_pivotroot) (struct nameidata * old_nd, 1342 int (*sb_pivotroot) (struct path *old_path,
1274 struct nameidata * new_nd); 1343 struct path *new_path);
1275 void (*sb_post_pivotroot) (struct nameidata * old_nd, 1344 void (*sb_post_pivotroot) (struct path *old_path,
1276 struct nameidata * new_nd); 1345 struct path *new_path);
1277 int (*sb_get_mnt_opts) (const struct super_block *sb, 1346 int (*sb_get_mnt_opts) (const struct super_block *sb,
1278 struct security_mnt_opts *opts); 1347 struct security_mnt_opts *opts);
1279 int (*sb_set_mnt_opts) (struct super_block *sb, 1348 int (*sb_set_mnt_opts) (struct super_block *sb,
@@ -1282,231 +1351,241 @@ struct security_operations {
1282 struct super_block *newsb); 1351 struct super_block *newsb);
1283 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); 1352 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
1284 1353
1285 int (*inode_alloc_security) (struct inode *inode); 1354 int (*inode_alloc_security) (struct inode *inode);
1286 void (*inode_free_security) (struct inode *inode); 1355 void (*inode_free_security) (struct inode *inode);
1287 int (*inode_init_security) (struct inode *inode, struct inode *dir, 1356 int (*inode_init_security) (struct inode *inode, struct inode *dir,
1288 char **name, void **value, size_t *len); 1357 char **name, void **value, size_t *len);
1289 int (*inode_create) (struct inode *dir, 1358 int (*inode_create) (struct inode *dir,
1290 struct dentry *dentry, int mode); 1359 struct dentry *dentry, int mode);
1291 int (*inode_link) (struct dentry *old_dentry, 1360 int (*inode_link) (struct dentry *old_dentry,
1292 struct inode *dir, struct dentry *new_dentry); 1361 struct inode *dir, struct dentry *new_dentry);
1293 int (*inode_unlink) (struct inode *dir, struct dentry *dentry); 1362 int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
1294 int (*inode_symlink) (struct inode *dir, 1363 int (*inode_symlink) (struct inode *dir,
1295 struct dentry *dentry, const char *old_name); 1364 struct dentry *dentry, const char *old_name);
1296 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); 1365 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode);
1297 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); 1366 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
1298 int (*inode_mknod) (struct inode *dir, struct dentry *dentry, 1367 int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
1299 int mode, dev_t dev); 1368 int mode, dev_t dev);
1300 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, 1369 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
1301 struct inode *new_dir, struct dentry *new_dentry); 1370 struct inode *new_dir, struct dentry *new_dentry);
1302 int (*inode_readlink) (struct dentry *dentry); 1371 int (*inode_readlink) (struct dentry *dentry);
1303 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); 1372 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1304 int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); 1373 int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd);
1305 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1374 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1306 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1375 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1307 void (*inode_delete) (struct inode *inode); 1376 void (*inode_delete) (struct inode *inode);
1308 int (*inode_setxattr) (struct dentry *dentry, char *name, void *value, 1377 int (*inode_setxattr) (struct dentry *dentry, const char *name,
1309 size_t size, int flags); 1378 const void *value, size_t size, int flags);
1310 void (*inode_post_setxattr) (struct dentry *dentry, char *name, void *value, 1379 void (*inode_post_setxattr) (struct dentry *dentry, const char *name,
1311 size_t size, int flags); 1380 const void *value, size_t size, int flags);
1312 int (*inode_getxattr) (struct dentry *dentry, char *name); 1381 int (*inode_getxattr) (struct dentry *dentry, const char *name);
1313 int (*inode_listxattr) (struct dentry *dentry); 1382 int (*inode_listxattr) (struct dentry *dentry);
1314 int (*inode_removexattr) (struct dentry *dentry, char *name); 1383 int (*inode_removexattr) (struct dentry *dentry, const char *name);
1315 int (*inode_need_killpriv) (struct dentry *dentry); 1384 int (*inode_need_killpriv) (struct dentry *dentry);
1316 int (*inode_killpriv) (struct dentry *dentry); 1385 int (*inode_killpriv) (struct dentry *dentry);
1317 int (*inode_getsecurity)(const struct inode *inode, const char *name, void **buffer, bool alloc); 1386 int (*inode_getsecurity) (const struct inode *inode, const char *name, void **buffer, bool alloc);
1318 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1387 int (*inode_setsecurity) (struct inode *inode, const char *name, const void *value, size_t size, int flags);
1319 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size); 1388 int (*inode_listsecurity) (struct inode *inode, char *buffer, size_t buffer_size);
1320 1389 void (*inode_getsecid) (const struct inode *inode, u32 *secid);
1321 int (*file_permission) (struct file * file, int mask); 1390
1322 int (*file_alloc_security) (struct file * file); 1391 int (*file_permission) (struct file *file, int mask);
1323 void (*file_free_security) (struct file * file); 1392 int (*file_alloc_security) (struct file *file);
1324 int (*file_ioctl) (struct file * file, unsigned int cmd, 1393 void (*file_free_security) (struct file *file);
1394 int (*file_ioctl) (struct file *file, unsigned int cmd,
1325 unsigned long arg); 1395 unsigned long arg);
1326 int (*file_mmap) (struct file * file, 1396 int (*file_mmap) (struct file *file,
1327 unsigned long reqprot, unsigned long prot, 1397 unsigned long reqprot, unsigned long prot,
1328 unsigned long flags, unsigned long addr, 1398 unsigned long flags, unsigned long addr,
1329 unsigned long addr_only); 1399 unsigned long addr_only);
1330 int (*file_mprotect) (struct vm_area_struct * vma, 1400 int (*file_mprotect) (struct vm_area_struct *vma,
1331 unsigned long reqprot, 1401 unsigned long reqprot,
1332 unsigned long prot); 1402 unsigned long prot);
1333 int (*file_lock) (struct file * file, unsigned int cmd); 1403 int (*file_lock) (struct file *file, unsigned int cmd);
1334 int (*file_fcntl) (struct file * file, unsigned int cmd, 1404 int (*file_fcntl) (struct file *file, unsigned int cmd,
1335 unsigned long arg); 1405 unsigned long arg);
1336 int (*file_set_fowner) (struct file * file); 1406 int (*file_set_fowner) (struct file *file);
1337 int (*file_send_sigiotask) (struct task_struct * tsk, 1407 int (*file_send_sigiotask) (struct task_struct *tsk,
1338 struct fown_struct * fown, int sig); 1408 struct fown_struct *fown, int sig);
1339 int (*file_receive) (struct file * file); 1409 int (*file_receive) (struct file *file);
1340 int (*dentry_open) (struct file *file); 1410 int (*dentry_open) (struct file *file);
1341 1411
1342 int (*task_create) (unsigned long clone_flags); 1412 int (*task_create) (unsigned long clone_flags);
1343 int (*task_alloc_security) (struct task_struct * p); 1413 int (*task_alloc_security) (struct task_struct *p);
1344 void (*task_free_security) (struct task_struct * p); 1414 void (*task_free_security) (struct task_struct *p);
1345 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); 1415 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1346 int (*task_post_setuid) (uid_t old_ruid /* or fsuid */ , 1416 int (*task_post_setuid) (uid_t old_ruid /* or fsuid */ ,
1347 uid_t old_euid, uid_t old_suid, int flags); 1417 uid_t old_euid, uid_t old_suid, int flags);
1348 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags); 1418 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
1349 int (*task_setpgid) (struct task_struct * p, pid_t pgid); 1419 int (*task_setpgid) (struct task_struct *p, pid_t pgid);
1350 int (*task_getpgid) (struct task_struct * p); 1420 int (*task_getpgid) (struct task_struct *p);
1351 int (*task_getsid) (struct task_struct * p); 1421 int (*task_getsid) (struct task_struct *p);
1352 void (*task_getsecid) (struct task_struct * p, u32 * secid); 1422 void (*task_getsecid) (struct task_struct *p, u32 *secid);
1353 int (*task_setgroups) (struct group_info *group_info); 1423 int (*task_setgroups) (struct group_info *group_info);
1354 int (*task_setnice) (struct task_struct * p, int nice); 1424 int (*task_setnice) (struct task_struct *p, int nice);
1355 int (*task_setioprio) (struct task_struct * p, int ioprio); 1425 int (*task_setioprio) (struct task_struct *p, int ioprio);
1356 int (*task_getioprio) (struct task_struct * p); 1426 int (*task_getioprio) (struct task_struct *p);
1357 int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim); 1427 int (*task_setrlimit) (unsigned int resource, struct rlimit *new_rlim);
1358 int (*task_setscheduler) (struct task_struct * p, int policy, 1428 int (*task_setscheduler) (struct task_struct *p, int policy,
1359 struct sched_param * lp); 1429 struct sched_param *lp);
1360 int (*task_getscheduler) (struct task_struct * p); 1430 int (*task_getscheduler) (struct task_struct *p);
1361 int (*task_movememory) (struct task_struct * p); 1431 int (*task_movememory) (struct task_struct *p);
1362 int (*task_kill) (struct task_struct * p, 1432 int (*task_kill) (struct task_struct *p,
1363 struct siginfo * info, int sig, u32 secid); 1433 struct siginfo *info, int sig, u32 secid);
1364 int (*task_wait) (struct task_struct * p); 1434 int (*task_wait) (struct task_struct *p);
1365 int (*task_prctl) (int option, unsigned long arg2, 1435 int (*task_prctl) (int option, unsigned long arg2,
1366 unsigned long arg3, unsigned long arg4, 1436 unsigned long arg3, unsigned long arg4,
1367 unsigned long arg5); 1437 unsigned long arg5, long *rc_p);
1368 void (*task_reparent_to_init) (struct task_struct * p); 1438 void (*task_reparent_to_init) (struct task_struct *p);
1369 void (*task_to_inode)(struct task_struct *p, struct inode *inode); 1439 void (*task_to_inode) (struct task_struct *p, struct inode *inode);
1370 1440
1371 int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag); 1441 int (*ipc_permission) (struct kern_ipc_perm *ipcp, short flag);
1372 1442 void (*ipc_getsecid) (struct kern_ipc_perm *ipcp, u32 *secid);
1373 int (*msg_msg_alloc_security) (struct msg_msg * msg); 1443
1374 void (*msg_msg_free_security) (struct msg_msg * msg); 1444 int (*msg_msg_alloc_security) (struct msg_msg *msg);
1375 1445 void (*msg_msg_free_security) (struct msg_msg *msg);
1376 int (*msg_queue_alloc_security) (struct msg_queue * msq); 1446
1377 void (*msg_queue_free_security) (struct msg_queue * msq); 1447 int (*msg_queue_alloc_security) (struct msg_queue *msq);
1378 int (*msg_queue_associate) (struct msg_queue * msq, int msqflg); 1448 void (*msg_queue_free_security) (struct msg_queue *msq);
1379 int (*msg_queue_msgctl) (struct msg_queue * msq, int cmd); 1449 int (*msg_queue_associate) (struct msg_queue *msq, int msqflg);
1380 int (*msg_queue_msgsnd) (struct msg_queue * msq, 1450 int (*msg_queue_msgctl) (struct msg_queue *msq, int cmd);
1381 struct msg_msg * msg, int msqflg); 1451 int (*msg_queue_msgsnd) (struct msg_queue *msq,
1382 int (*msg_queue_msgrcv) (struct msg_queue * msq, 1452 struct msg_msg *msg, int msqflg);
1383 struct msg_msg * msg, 1453 int (*msg_queue_msgrcv) (struct msg_queue *msq,
1384 struct task_struct * target, 1454 struct msg_msg *msg,
1455 struct task_struct *target,
1385 long type, int mode); 1456 long type, int mode);
1386 1457
1387 int (*shm_alloc_security) (struct shmid_kernel * shp); 1458 int (*shm_alloc_security) (struct shmid_kernel *shp);
1388 void (*shm_free_security) (struct shmid_kernel * shp); 1459 void (*shm_free_security) (struct shmid_kernel *shp);
1389 int (*shm_associate) (struct shmid_kernel * shp, int shmflg); 1460 int (*shm_associate) (struct shmid_kernel *shp, int shmflg);
1390 int (*shm_shmctl) (struct shmid_kernel * shp, int cmd); 1461 int (*shm_shmctl) (struct shmid_kernel *shp, int cmd);
1391 int (*shm_shmat) (struct shmid_kernel * shp, 1462 int (*shm_shmat) (struct shmid_kernel *shp,
1392 char __user *shmaddr, int shmflg); 1463 char __user *shmaddr, int shmflg);
1393 1464
1394 int (*sem_alloc_security) (struct sem_array * sma); 1465 int (*sem_alloc_security) (struct sem_array *sma);
1395 void (*sem_free_security) (struct sem_array * sma); 1466 void (*sem_free_security) (struct sem_array *sma);
1396 int (*sem_associate) (struct sem_array * sma, int semflg); 1467 int (*sem_associate) (struct sem_array *sma, int semflg);
1397 int (*sem_semctl) (struct sem_array * sma, int cmd); 1468 int (*sem_semctl) (struct sem_array *sma, int cmd);
1398 int (*sem_semop) (struct sem_array * sma, 1469 int (*sem_semop) (struct sem_array *sma,
1399 struct sembuf * sops, unsigned nsops, int alter); 1470 struct sembuf *sops, unsigned nsops, int alter);
1400 1471
1401 int (*netlink_send) (struct sock * sk, struct sk_buff * skb); 1472 int (*netlink_send) (struct sock *sk, struct sk_buff *skb);
1402 int (*netlink_recv) (struct sk_buff * skb, int cap); 1473 int (*netlink_recv) (struct sk_buff *skb, int cap);
1403 1474
1404 /* allow module stacking */ 1475 /* allow module stacking */
1405 int (*register_security) (const char *name, 1476 int (*register_security) (const char *name,
1406 struct security_operations *ops); 1477 struct security_operations *ops);
1407 1478
1408 void (*d_instantiate) (struct dentry *dentry, struct inode *inode); 1479 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1409 1480
1410 int (*getprocattr)(struct task_struct *p, char *name, char **value); 1481 int (*getprocattr) (struct task_struct *p, char *name, char **value);
1411 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1482 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size);
1412 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen); 1483 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen);
1413 int (*secctx_to_secid)(char *secdata, u32 seclen, u32 *secid); 1484 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
1414 void (*release_secctx)(char *secdata, u32 seclen); 1485 void (*release_secctx) (char *secdata, u32 seclen);
1415 1486
1416#ifdef CONFIG_SECURITY_NETWORK 1487#ifdef CONFIG_SECURITY_NETWORK
1417 int (*unix_stream_connect) (struct socket * sock, 1488 int (*unix_stream_connect) (struct socket *sock,
1418 struct socket * other, struct sock * newsk); 1489 struct socket *other, struct sock *newsk);
1419 int (*unix_may_send) (struct socket * sock, struct socket * other); 1490 int (*unix_may_send) (struct socket *sock, struct socket *other);
1420 1491
1421 int (*socket_create) (int family, int type, int protocol, int kern); 1492 int (*socket_create) (int family, int type, int protocol, int kern);
1422 int (*socket_post_create) (struct socket * sock, int family, 1493 int (*socket_post_create) (struct socket *sock, int family,
1423 int type, int protocol, int kern); 1494 int type, int protocol, int kern);
1424 int (*socket_bind) (struct socket * sock, 1495 int (*socket_bind) (struct socket *sock,
1425 struct sockaddr * address, int addrlen); 1496 struct sockaddr *address, int addrlen);
1426 int (*socket_connect) (struct socket * sock, 1497 int (*socket_connect) (struct socket *sock,
1427 struct sockaddr * address, int addrlen); 1498 struct sockaddr *address, int addrlen);
1428 int (*socket_listen) (struct socket * sock, int backlog); 1499 int (*socket_listen) (struct socket *sock, int backlog);
1429 int (*socket_accept) (struct socket * sock, struct socket * newsock); 1500 int (*socket_accept) (struct socket *sock, struct socket *newsock);
1430 void (*socket_post_accept) (struct socket * sock, 1501 void (*socket_post_accept) (struct socket *sock,
1431 struct socket * newsock); 1502 struct socket *newsock);
1432 int (*socket_sendmsg) (struct socket * sock, 1503 int (*socket_sendmsg) (struct socket *sock,
1433 struct msghdr * msg, int size); 1504 struct msghdr *msg, int size);
1434 int (*socket_recvmsg) (struct socket * sock, 1505 int (*socket_recvmsg) (struct socket *sock,
1435 struct msghdr * msg, int size, int flags); 1506 struct msghdr *msg, int size, int flags);
1436 int (*socket_getsockname) (struct socket * sock); 1507 int (*socket_getsockname) (struct socket *sock);
1437 int (*socket_getpeername) (struct socket * sock); 1508 int (*socket_getpeername) (struct socket *sock);
1438 int (*socket_getsockopt) (struct socket * sock, int level, int optname); 1509 int (*socket_getsockopt) (struct socket *sock, int level, int optname);
1439 int (*socket_setsockopt) (struct socket * sock, int level, int optname); 1510 int (*socket_setsockopt) (struct socket *sock, int level, int optname);
1440 int (*socket_shutdown) (struct socket * sock, int how); 1511 int (*socket_shutdown) (struct socket *sock, int how);
1441 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb); 1512 int (*socket_sock_rcv_skb) (struct sock *sk, struct sk_buff *skb);
1442 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); 1513 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1443 int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid); 1514 int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid);
1444 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); 1515 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
1445 void (*sk_free_security) (struct sock *sk); 1516 void (*sk_free_security) (struct sock *sk);
1446 void (*sk_clone_security) (const struct sock *sk, struct sock *newsk); 1517 void (*sk_clone_security) (const struct sock *sk, struct sock *newsk);
1447 void (*sk_getsecid) (struct sock *sk, u32 *secid); 1518 void (*sk_getsecid) (struct sock *sk, u32 *secid);
1448 void (*sock_graft)(struct sock* sk, struct socket *parent); 1519 void (*sock_graft) (struct sock *sk, struct socket *parent);
1449 int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb, 1520 int (*inet_conn_request) (struct sock *sk, struct sk_buff *skb,
1450 struct request_sock *req); 1521 struct request_sock *req);
1451 void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req); 1522 void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req);
1452 void (*inet_conn_established)(struct sock *sk, struct sk_buff *skb); 1523 void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb);
1453 void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl); 1524 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl);
1454#endif /* CONFIG_SECURITY_NETWORK */ 1525#endif /* CONFIG_SECURITY_NETWORK */
1455 1526
1456#ifdef CONFIG_SECURITY_NETWORK_XFRM 1527#ifdef CONFIG_SECURITY_NETWORK_XFRM
1457 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, 1528 int (*xfrm_policy_alloc_security) (struct xfrm_sec_ctx **ctxp,
1458 struct xfrm_user_sec_ctx *sec_ctx); 1529 struct xfrm_user_sec_ctx *sec_ctx);
1459 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); 1530 int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx);
1460 void (*xfrm_policy_free_security) (struct xfrm_policy *xp); 1531 void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx);
1461 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); 1532 int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx);
1462 int (*xfrm_state_alloc_security) (struct xfrm_state *x, 1533 int (*xfrm_state_alloc_security) (struct xfrm_state *x,
1463 struct xfrm_user_sec_ctx *sec_ctx, 1534 struct xfrm_user_sec_ctx *sec_ctx,
1464 u32 secid); 1535 u32 secid);
1465 void (*xfrm_state_free_security) (struct xfrm_state *x); 1536 void (*xfrm_state_free_security) (struct xfrm_state *x);
1466 int (*xfrm_state_delete_security) (struct xfrm_state *x); 1537 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1467 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir); 1538 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
1468 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, 1539 int (*xfrm_state_pol_flow_match) (struct xfrm_state *x,
1469 struct xfrm_policy *xp, struct flowi *fl); 1540 struct xfrm_policy *xp,
1470 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); 1541 struct flowi *fl);
1542 int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall);
1471#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1543#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1472 1544
1473 /* key management security hooks */ 1545 /* key management security hooks */
1474#ifdef CONFIG_KEYS 1546#ifdef CONFIG_KEYS
1475 int (*key_alloc)(struct key *key, struct task_struct *tsk, unsigned long flags); 1547 int (*key_alloc) (struct key *key, struct task_struct *tsk, unsigned long flags);
1476 void (*key_free)(struct key *key); 1548 void (*key_free) (struct key *key);
1477 int (*key_permission)(key_ref_t key_ref, 1549 int (*key_permission) (key_ref_t key_ref,
1478 struct task_struct *context, 1550 struct task_struct *context,
1479 key_perm_t perm); 1551 key_perm_t perm);
1480 1552 int (*key_getsecurity)(struct key *key, char **_buffer);
1481#endif /* CONFIG_KEYS */ 1553#endif /* CONFIG_KEYS */
1482 1554
1555#ifdef CONFIG_AUDIT
1556 int (*audit_rule_init) (u32 field, u32 op, char *rulestr, void **lsmrule);
1557 int (*audit_rule_known) (struct audit_krule *krule);
1558 int (*audit_rule_match) (u32 secid, u32 field, u32 op, void *lsmrule,
1559 struct audit_context *actx);
1560 void (*audit_rule_free) (void *lsmrule);
1561#endif /* CONFIG_AUDIT */
1483}; 1562};
1484 1563
1485/* prototypes */ 1564/* prototypes */
1486extern int security_init (void); 1565extern int security_init(void);
1487extern int register_security (struct security_operations *ops); 1566extern int security_module_enable(struct security_operations *ops);
1488extern int mod_reg_security (const char *name, struct security_operations *ops); 1567extern int register_security(struct security_operations *ops);
1568extern int mod_reg_security(const char *name, struct security_operations *ops);
1489extern struct dentry *securityfs_create_file(const char *name, mode_t mode, 1569extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
1490 struct dentry *parent, void *data, 1570 struct dentry *parent, void *data,
1491 const struct file_operations *fops); 1571 const struct file_operations *fops);
1492extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); 1572extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
1493extern void securityfs_remove(struct dentry *dentry); 1573extern void securityfs_remove(struct dentry *dentry);
1494 1574
1495
1496/* Security operations */ 1575/* Security operations */
1497int security_ptrace(struct task_struct *parent, struct task_struct *child); 1576int security_ptrace(struct task_struct *parent, struct task_struct *child);
1498int security_capget(struct task_struct *target, 1577int security_capget(struct task_struct *target,
1499 kernel_cap_t *effective, 1578 kernel_cap_t *effective,
1500 kernel_cap_t *inheritable, 1579 kernel_cap_t *inheritable,
1501 kernel_cap_t *permitted); 1580 kernel_cap_t *permitted);
1502int security_capset_check(struct task_struct *target, 1581int security_capset_check(struct task_struct *target,
1503 kernel_cap_t *effective,
1504 kernel_cap_t *inheritable,
1505 kernel_cap_t *permitted);
1506void security_capset_set(struct task_struct *target,
1507 kernel_cap_t *effective, 1582 kernel_cap_t *effective,
1508 kernel_cap_t *inheritable, 1583 kernel_cap_t *inheritable,
1509 kernel_cap_t *permitted); 1584 kernel_cap_t *permitted);
1585void security_capset_set(struct task_struct *target,
1586 kernel_cap_t *effective,
1587 kernel_cap_t *inheritable,
1588 kernel_cap_t *permitted);
1510int security_capable(struct task_struct *tsk, int cap); 1589int security_capable(struct task_struct *tsk, int cap);
1511int security_acct(struct file *file); 1590int security_acct(struct file *file);
1512int security_sysctl(struct ctl_table *table, int op); 1591int security_sysctl(struct ctl_table *table, int op);
@@ -1528,16 +1607,16 @@ void security_sb_free(struct super_block *sb);
1528int security_sb_copy_data(char *orig, char *copy); 1607int security_sb_copy_data(char *orig, char *copy);
1529int security_sb_kern_mount(struct super_block *sb, void *data); 1608int security_sb_kern_mount(struct super_block *sb, void *data);
1530int security_sb_statfs(struct dentry *dentry); 1609int security_sb_statfs(struct dentry *dentry);
1531int security_sb_mount(char *dev_name, struct nameidata *nd, 1610int security_sb_mount(char *dev_name, struct path *path,
1532 char *type, unsigned long flags, void *data); 1611 char *type, unsigned long flags, void *data);
1533int security_sb_check_sb(struct vfsmount *mnt, struct nameidata *nd); 1612int security_sb_check_sb(struct vfsmount *mnt, struct path *path);
1534int security_sb_umount(struct vfsmount *mnt, int flags); 1613int security_sb_umount(struct vfsmount *mnt, int flags);
1535void security_sb_umount_close(struct vfsmount *mnt); 1614void security_sb_umount_close(struct vfsmount *mnt);
1536void security_sb_umount_busy(struct vfsmount *mnt); 1615void security_sb_umount_busy(struct vfsmount *mnt);
1537void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data); 1616void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
1538void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd); 1617void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint);
1539int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd); 1618int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1540void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd); 1619void security_sb_post_pivotroot(struct path *old_path, struct path *new_path);
1541int security_sb_get_mnt_opts(const struct super_block *sb, 1620int security_sb_get_mnt_opts(const struct super_block *sb,
1542 struct security_mnt_opts *opts); 1621 struct security_mnt_opts *opts);
1543int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1622int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
@@ -1554,30 +1633,31 @@ int security_inode_link(struct dentry *old_dentry, struct inode *dir,
1554 struct dentry *new_dentry); 1633 struct dentry *new_dentry);
1555int security_inode_unlink(struct inode *dir, struct dentry *dentry); 1634int security_inode_unlink(struct inode *dir, struct dentry *dentry);
1556int security_inode_symlink(struct inode *dir, struct dentry *dentry, 1635int security_inode_symlink(struct inode *dir, struct dentry *dentry,
1557 const char *old_name); 1636 const char *old_name);
1558int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode); 1637int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode);
1559int security_inode_rmdir(struct inode *dir, struct dentry *dentry); 1638int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
1560int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev); 1639int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev);
1561int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, 1640int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1562 struct inode *new_dir, struct dentry *new_dentry); 1641 struct inode *new_dir, struct dentry *new_dentry);
1563int security_inode_readlink(struct dentry *dentry); 1642int security_inode_readlink(struct dentry *dentry);
1564int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1643int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1565int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd); 1644int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd);
1566int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1645int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1567int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1646int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1568void security_inode_delete(struct inode *inode); 1647void security_inode_delete(struct inode *inode);
1569int security_inode_setxattr(struct dentry *dentry, char *name, 1648int security_inode_setxattr(struct dentry *dentry, const char *name,
1570 void *value, size_t size, int flags); 1649 const void *value, size_t size, int flags);
1571void security_inode_post_setxattr(struct dentry *dentry, char *name, 1650void security_inode_post_setxattr(struct dentry *dentry, const char *name,
1572 void *value, size_t size, int flags); 1651 const void *value, size_t size, int flags);
1573int security_inode_getxattr(struct dentry *dentry, char *name); 1652int security_inode_getxattr(struct dentry *dentry, const char *name);
1574int security_inode_listxattr(struct dentry *dentry); 1653int security_inode_listxattr(struct dentry *dentry);
1575int security_inode_removexattr(struct dentry *dentry, char *name); 1654int security_inode_removexattr(struct dentry *dentry, const char *name);
1576int security_inode_need_killpriv(struct dentry *dentry); 1655int security_inode_need_killpriv(struct dentry *dentry);
1577int security_inode_killpriv(struct dentry *dentry); 1656int security_inode_killpriv(struct dentry *dentry);
1578int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc); 1657int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc);
1579int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1658int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags);
1580int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size); 1659int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size);
1660void security_inode_getsecid(const struct inode *inode, u32 *secid);
1581int security_file_permission(struct file *file, int mask); 1661int security_file_permission(struct file *file, int mask);
1582int security_file_alloc(struct file *file); 1662int security_file_alloc(struct file *file);
1583void security_file_free(struct file *file); 1663void security_file_free(struct file *file);
@@ -1586,12 +1666,12 @@ int security_file_mmap(struct file *file, unsigned long reqprot,
1586 unsigned long prot, unsigned long flags, 1666 unsigned long prot, unsigned long flags,
1587 unsigned long addr, unsigned long addr_only); 1667 unsigned long addr, unsigned long addr_only);
1588int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, 1668int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
1589 unsigned long prot); 1669 unsigned long prot);
1590int security_file_lock(struct file *file, unsigned int cmd); 1670int security_file_lock(struct file *file, unsigned int cmd);
1591int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg); 1671int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
1592int security_file_set_fowner(struct file *file); 1672int security_file_set_fowner(struct file *file);
1593int security_file_send_sigiotask(struct task_struct *tsk, 1673int security_file_send_sigiotask(struct task_struct *tsk,
1594 struct fown_struct *fown, int sig); 1674 struct fown_struct *fown, int sig);
1595int security_file_receive(struct file *file); 1675int security_file_receive(struct file *file);
1596int security_dentry_open(struct file *file); 1676int security_dentry_open(struct file *file);
1597int security_task_create(unsigned long clone_flags); 1677int security_task_create(unsigned long clone_flags);
@@ -1599,7 +1679,7 @@ int security_task_alloc(struct task_struct *p);
1599void security_task_free(struct task_struct *p); 1679void security_task_free(struct task_struct *p);
1600int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); 1680int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1601int security_task_post_setuid(uid_t old_ruid, uid_t old_euid, 1681int security_task_post_setuid(uid_t old_ruid, uid_t old_euid,
1602 uid_t old_suid, int flags); 1682 uid_t old_suid, int flags);
1603int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags); 1683int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
1604int security_task_setpgid(struct task_struct *p, pid_t pgid); 1684int security_task_setpgid(struct task_struct *p, pid_t pgid);
1605int security_task_getpgid(struct task_struct *p); 1685int security_task_getpgid(struct task_struct *p);
@@ -1618,10 +1698,11 @@ int security_task_kill(struct task_struct *p, struct siginfo *info,
1618 int sig, u32 secid); 1698 int sig, u32 secid);
1619int security_task_wait(struct task_struct *p); 1699int security_task_wait(struct task_struct *p);
1620int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, 1700int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
1621 unsigned long arg4, unsigned long arg5); 1701 unsigned long arg4, unsigned long arg5, long *rc_p);
1622void security_task_reparent_to_init(struct task_struct *p); 1702void security_task_reparent_to_init(struct task_struct *p);
1623void security_task_to_inode(struct task_struct *p, struct inode *inode); 1703void security_task_to_inode(struct task_struct *p, struct inode *inode);
1624int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); 1704int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
1705void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid);
1625int security_msg_msg_alloc(struct msg_msg *msg); 1706int security_msg_msg_alloc(struct msg_msg *msg);
1626void security_msg_msg_free(struct msg_msg *msg); 1707void security_msg_msg_free(struct msg_msg *msg);
1627int security_msg_queue_alloc(struct msg_queue *msq); 1708int security_msg_queue_alloc(struct msg_queue *msq);
@@ -1629,9 +1710,9 @@ void security_msg_queue_free(struct msg_queue *msq);
1629int security_msg_queue_associate(struct msg_queue *msq, int msqflg); 1710int security_msg_queue_associate(struct msg_queue *msq, int msqflg);
1630int security_msg_queue_msgctl(struct msg_queue *msq, int cmd); 1711int security_msg_queue_msgctl(struct msg_queue *msq, int cmd);
1631int security_msg_queue_msgsnd(struct msg_queue *msq, 1712int security_msg_queue_msgsnd(struct msg_queue *msq,
1632 struct msg_msg *msg, int msqflg); 1713 struct msg_msg *msg, int msqflg);
1633int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg, 1714int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg,
1634 struct task_struct *target, long type, int mode); 1715 struct task_struct *target, long type, int mode);
1635int security_shm_alloc(struct shmid_kernel *shp); 1716int security_shm_alloc(struct shmid_kernel *shp);
1636void security_shm_free(struct shmid_kernel *shp); 1717void security_shm_free(struct shmid_kernel *shp);
1637int security_shm_associate(struct shmid_kernel *shp, int shmflg); 1718int security_shm_associate(struct shmid_kernel *shp, int shmflg);
@@ -1643,13 +1724,13 @@ int security_sem_associate(struct sem_array *sma, int semflg);
1643int security_sem_semctl(struct sem_array *sma, int cmd); 1724int security_sem_semctl(struct sem_array *sma, int cmd);
1644int security_sem_semop(struct sem_array *sma, struct sembuf *sops, 1725int security_sem_semop(struct sem_array *sma, struct sembuf *sops,
1645 unsigned nsops, int alter); 1726 unsigned nsops, int alter);
1646void security_d_instantiate (struct dentry *dentry, struct inode *inode); 1727void security_d_instantiate(struct dentry *dentry, struct inode *inode);
1647int security_getprocattr(struct task_struct *p, char *name, char **value); 1728int security_getprocattr(struct task_struct *p, char *name, char **value);
1648int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); 1729int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
1649int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1730int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1650int security_netlink_recv(struct sk_buff *skb, int cap); 1731int security_netlink_recv(struct sk_buff *skb, int cap);
1651int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1732int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1652int security_secctx_to_secid(char *secdata, u32 seclen, u32 *secid); 1733int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1653void security_release_secctx(char *secdata, u32 seclen); 1734void security_release_secctx(char *secdata, u32 seclen);
1654 1735
1655#else /* CONFIG_SECURITY */ 1736#else /* CONFIG_SECURITY */
@@ -1674,33 +1755,33 @@ static inline int security_init(void)
1674 return 0; 1755 return 0;
1675} 1756}
1676 1757
1677static inline int security_ptrace (struct task_struct *parent, struct task_struct * child) 1758static inline int security_ptrace(struct task_struct *parent, struct task_struct *child)
1678{ 1759{
1679 return cap_ptrace (parent, child); 1760 return cap_ptrace(parent, child);
1680} 1761}
1681 1762
1682static inline int security_capget (struct task_struct *target, 1763static inline int security_capget(struct task_struct *target,
1683 kernel_cap_t *effective, 1764 kernel_cap_t *effective,
1684 kernel_cap_t *inheritable, 1765 kernel_cap_t *inheritable,
1685 kernel_cap_t *permitted) 1766 kernel_cap_t *permitted)
1686{ 1767{
1687 return cap_capget (target, effective, inheritable, permitted); 1768 return cap_capget(target, effective, inheritable, permitted);
1688} 1769}
1689 1770
1690static inline int security_capset_check (struct task_struct *target, 1771static inline int security_capset_check(struct task_struct *target,
1691 kernel_cap_t *effective, 1772 kernel_cap_t *effective,
1692 kernel_cap_t *inheritable, 1773 kernel_cap_t *inheritable,
1693 kernel_cap_t *permitted) 1774 kernel_cap_t *permitted)
1694{ 1775{
1695 return cap_capset_check (target, effective, inheritable, permitted); 1776 return cap_capset_check(target, effective, inheritable, permitted);
1696} 1777}
1697 1778
1698static inline void security_capset_set (struct task_struct *target, 1779static inline void security_capset_set(struct task_struct *target,
1699 kernel_cap_t *effective, 1780 kernel_cap_t *effective,
1700 kernel_cap_t *inheritable, 1781 kernel_cap_t *inheritable,
1701 kernel_cap_t *permitted) 1782 kernel_cap_t *permitted)
1702{ 1783{
1703 cap_capset_set (target, effective, inheritable, permitted); 1784 cap_capset_set(target, effective, inheritable, permitted);
1704} 1785}
1705 1786
1706static inline int security_capable(struct task_struct *tsk, int cap) 1787static inline int security_capable(struct task_struct *tsk, int cap)
@@ -1708,7 +1789,7 @@ static inline int security_capable(struct task_struct *tsk, int cap)
1708 return cap_capable(tsk, cap); 1789 return cap_capable(tsk, cap);
1709} 1790}
1710 1791
1711static inline int security_acct (struct file *file) 1792static inline int security_acct(struct file *file)
1712{ 1793{
1713 return 0; 1794 return 0;
1714} 1795}
@@ -1718,13 +1799,13 @@ static inline int security_sysctl(struct ctl_table *table, int op)
1718 return 0; 1799 return 0;
1719} 1800}
1720 1801
1721static inline int security_quotactl (int cmds, int type, int id, 1802static inline int security_quotactl(int cmds, int type, int id,
1722 struct super_block * sb) 1803 struct super_block *sb)
1723{ 1804{
1724 return 0; 1805 return 0;
1725} 1806}
1726 1807
1727static inline int security_quota_on (struct dentry * dentry) 1808static inline int security_quota_on(struct dentry *dentry)
1728{ 1809{
1729 return 0; 1810 return 0;
1730} 1811}
@@ -1749,102 +1830,102 @@ static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
1749 return cap_vm_enough_memory(mm, pages); 1830 return cap_vm_enough_memory(mm, pages);
1750} 1831}
1751 1832
1752static inline int security_bprm_alloc (struct linux_binprm *bprm) 1833static inline int security_bprm_alloc(struct linux_binprm *bprm)
1753{ 1834{
1754 return 0; 1835 return 0;
1755} 1836}
1756 1837
1757static inline void security_bprm_free (struct linux_binprm *bprm) 1838static inline void security_bprm_free(struct linux_binprm *bprm)
1758{ } 1839{ }
1759 1840
1760static inline void security_bprm_apply_creds (struct linux_binprm *bprm, int unsafe) 1841static inline void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe)
1761{ 1842{
1762 cap_bprm_apply_creds (bprm, unsafe); 1843 cap_bprm_apply_creds(bprm, unsafe);
1763} 1844}
1764 1845
1765static inline void security_bprm_post_apply_creds (struct linux_binprm *bprm) 1846static inline void security_bprm_post_apply_creds(struct linux_binprm *bprm)
1766{ 1847{
1767 return; 1848 return;
1768} 1849}
1769 1850
1770static inline int security_bprm_set (struct linux_binprm *bprm) 1851static inline int security_bprm_set(struct linux_binprm *bprm)
1771{ 1852{
1772 return cap_bprm_set_security (bprm); 1853 return cap_bprm_set_security(bprm);
1773} 1854}
1774 1855
1775static inline int security_bprm_check (struct linux_binprm *bprm) 1856static inline int security_bprm_check(struct linux_binprm *bprm)
1776{ 1857{
1777 return 0; 1858 return 0;
1778} 1859}
1779 1860
1780static inline int security_bprm_secureexec (struct linux_binprm *bprm) 1861static inline int security_bprm_secureexec(struct linux_binprm *bprm)
1781{ 1862{
1782 return cap_bprm_secureexec(bprm); 1863 return cap_bprm_secureexec(bprm);
1783} 1864}
1784 1865
1785static inline int security_sb_alloc (struct super_block *sb) 1866static inline int security_sb_alloc(struct super_block *sb)
1786{ 1867{
1787 return 0; 1868 return 0;
1788} 1869}
1789 1870
1790static inline void security_sb_free (struct super_block *sb) 1871static inline void security_sb_free(struct super_block *sb)
1791{ } 1872{ }
1792 1873
1793static inline int security_sb_copy_data (char *orig, char *copy) 1874static inline int security_sb_copy_data(char *orig, char *copy)
1794{ 1875{
1795 return 0; 1876 return 0;
1796} 1877}
1797 1878
1798static inline int security_sb_kern_mount (struct super_block *sb, void *data) 1879static inline int security_sb_kern_mount(struct super_block *sb, void *data)
1799{ 1880{
1800 return 0; 1881 return 0;
1801} 1882}
1802 1883
1803static inline int security_sb_statfs (struct dentry *dentry) 1884static inline int security_sb_statfs(struct dentry *dentry)
1804{ 1885{
1805 return 0; 1886 return 0;
1806} 1887}
1807 1888
1808static inline int security_sb_mount (char *dev_name, struct nameidata *nd, 1889static inline int security_sb_mount(char *dev_name, struct path *path,
1809 char *type, unsigned long flags, 1890 char *type, unsigned long flags,
1810 void *data) 1891 void *data)
1811{ 1892{
1812 return 0; 1893 return 0;
1813} 1894}
1814 1895
1815static inline int security_sb_check_sb (struct vfsmount *mnt, 1896static inline int security_sb_check_sb(struct vfsmount *mnt,
1816 struct nameidata *nd) 1897 struct path *path)
1817{ 1898{
1818 return 0; 1899 return 0;
1819} 1900}
1820 1901
1821static inline int security_sb_umount (struct vfsmount *mnt, int flags) 1902static inline int security_sb_umount(struct vfsmount *mnt, int flags)
1822{ 1903{
1823 return 0; 1904 return 0;
1824} 1905}
1825 1906
1826static inline void security_sb_umount_close (struct vfsmount *mnt) 1907static inline void security_sb_umount_close(struct vfsmount *mnt)
1827{ } 1908{ }
1828 1909
1829static inline void security_sb_umount_busy (struct vfsmount *mnt) 1910static inline void security_sb_umount_busy(struct vfsmount *mnt)
1830{ } 1911{ }
1831 1912
1832static inline void security_sb_post_remount (struct vfsmount *mnt, 1913static inline void security_sb_post_remount(struct vfsmount *mnt,
1833 unsigned long flags, void *data) 1914 unsigned long flags, void *data)
1834{ } 1915{ }
1835 1916
1836static inline void security_sb_post_addmount (struct vfsmount *mnt, 1917static inline void security_sb_post_addmount(struct vfsmount *mnt,
1837 struct nameidata *mountpoint_nd) 1918 struct path *mountpoint)
1838{ } 1919{ }
1839 1920
1840static inline int security_sb_pivotroot (struct nameidata *old_nd, 1921static inline int security_sb_pivotroot(struct path *old_path,
1841 struct nameidata *new_nd) 1922 struct path *new_path)
1842{ 1923{
1843 return 0; 1924 return 0;
1844} 1925}
1845 1926
1846static inline void security_sb_post_pivotroot (struct nameidata *old_nd, 1927static inline void security_sb_post_pivotroot(struct path *old_path,
1847 struct nameidata *new_nd) 1928 struct path *new_path)
1848{ } 1929{ }
1849static inline int security_sb_get_mnt_opts(const struct super_block *sb, 1930static inline int security_sb_get_mnt_opts(const struct super_block *sb,
1850 struct security_mnt_opts *opts) 1931 struct security_mnt_opts *opts)
@@ -1868,15 +1949,15 @@ static inline int security_sb_parse_opts_str(char *options, struct security_mnt_
1868 return 0; 1949 return 0;
1869} 1950}
1870 1951
1871static inline int security_inode_alloc (struct inode *inode) 1952static inline int security_inode_alloc(struct inode *inode)
1872{ 1953{
1873 return 0; 1954 return 0;
1874} 1955}
1875 1956
1876static inline void security_inode_free (struct inode *inode) 1957static inline void security_inode_free(struct inode *inode)
1877{ } 1958{ }
1878 1959
1879static inline int security_inode_init_security (struct inode *inode, 1960static inline int security_inode_init_security(struct inode *inode,
1880 struct inode *dir, 1961 struct inode *dir,
1881 char **name, 1962 char **name,
1882 void **value, 1963 void **value,
@@ -1884,55 +1965,55 @@ static inline int security_inode_init_security (struct inode *inode,
1884{ 1965{
1885 return -EOPNOTSUPP; 1966 return -EOPNOTSUPP;
1886} 1967}
1887 1968
1888static inline int security_inode_create (struct inode *dir, 1969static inline int security_inode_create(struct inode *dir,
1889 struct dentry *dentry, 1970 struct dentry *dentry,
1890 int mode) 1971 int mode)
1891{ 1972{
1892 return 0; 1973 return 0;
1893} 1974}
1894 1975
1895static inline int security_inode_link (struct dentry *old_dentry, 1976static inline int security_inode_link(struct dentry *old_dentry,
1896 struct inode *dir, 1977 struct inode *dir,
1897 struct dentry *new_dentry) 1978 struct dentry *new_dentry)
1898{ 1979{
1899 return 0; 1980 return 0;
1900} 1981}
1901 1982
1902static inline int security_inode_unlink (struct inode *dir, 1983static inline int security_inode_unlink(struct inode *dir,
1903 struct dentry *dentry) 1984 struct dentry *dentry)
1904{ 1985{
1905 return 0; 1986 return 0;
1906} 1987}
1907 1988
1908static inline int security_inode_symlink (struct inode *dir, 1989static inline int security_inode_symlink(struct inode *dir,
1909 struct dentry *dentry, 1990 struct dentry *dentry,
1910 const char *old_name) 1991 const char *old_name)
1911{ 1992{
1912 return 0; 1993 return 0;
1913} 1994}
1914 1995
1915static inline int security_inode_mkdir (struct inode *dir, 1996static inline int security_inode_mkdir(struct inode *dir,
1916 struct dentry *dentry, 1997 struct dentry *dentry,
1917 int mode) 1998 int mode)
1918{ 1999{
1919 return 0; 2000 return 0;
1920} 2001}
1921 2002
1922static inline int security_inode_rmdir (struct inode *dir, 2003static inline int security_inode_rmdir(struct inode *dir,
1923 struct dentry *dentry) 2004 struct dentry *dentry)
1924{ 2005{
1925 return 0; 2006 return 0;
1926} 2007}
1927 2008
1928static inline int security_inode_mknod (struct inode *dir, 2009static inline int security_inode_mknod(struct inode *dir,
1929 struct dentry *dentry, 2010 struct dentry *dentry,
1930 int mode, dev_t dev) 2011 int mode, dev_t dev)
1931{ 2012{
1932 return 0; 2013 return 0;
1933} 2014}
1934 2015
1935static inline int security_inode_rename (struct inode *old_dir, 2016static inline int security_inode_rename(struct inode *old_dir,
1936 struct dentry *old_dentry, 2017 struct dentry *old_dentry,
1937 struct inode *new_dir, 2018 struct inode *new_dir,
1938 struct dentry *new_dentry) 2019 struct dentry *new_dentry)
@@ -1940,59 +2021,61 @@ static inline int security_inode_rename (struct inode *old_dir,
1940 return 0; 2021 return 0;
1941} 2022}
1942 2023
1943static inline int security_inode_readlink (struct dentry *dentry) 2024static inline int security_inode_readlink(struct dentry *dentry)
1944{ 2025{
1945 return 0; 2026 return 0;
1946} 2027}
1947 2028
1948static inline int security_inode_follow_link (struct dentry *dentry, 2029static inline int security_inode_follow_link(struct dentry *dentry,
1949 struct nameidata *nd) 2030 struct nameidata *nd)
1950{ 2031{
1951 return 0; 2032 return 0;
1952} 2033}
1953 2034
1954static inline int security_inode_permission (struct inode *inode, int mask, 2035static inline int security_inode_permission(struct inode *inode, int mask,
1955 struct nameidata *nd) 2036 struct nameidata *nd)
1956{ 2037{
1957 return 0; 2038 return 0;
1958} 2039}
1959 2040
1960static inline int security_inode_setattr (struct dentry *dentry, 2041static inline int security_inode_setattr(struct dentry *dentry,
1961 struct iattr *attr) 2042 struct iattr *attr)
1962{ 2043{
1963 return 0; 2044 return 0;
1964} 2045}
1965 2046
1966static inline int security_inode_getattr (struct vfsmount *mnt, 2047static inline int security_inode_getattr(struct vfsmount *mnt,
1967 struct dentry *dentry) 2048 struct dentry *dentry)
1968{ 2049{
1969 return 0; 2050 return 0;
1970} 2051}
1971 2052
1972static inline void security_inode_delete (struct inode *inode) 2053static inline void security_inode_delete(struct inode *inode)
1973{ } 2054{ }
1974 2055
1975static inline int security_inode_setxattr (struct dentry *dentry, char *name, 2056static inline int security_inode_setxattr(struct dentry *dentry,
1976 void *value, size_t size, int flags) 2057 const char *name, const void *value, size_t size, int flags)
1977{ 2058{
1978 return cap_inode_setxattr(dentry, name, value, size, flags); 2059 return cap_inode_setxattr(dentry, name, value, size, flags);
1979} 2060}
1980 2061
1981static inline void security_inode_post_setxattr (struct dentry *dentry, char *name, 2062static inline void security_inode_post_setxattr(struct dentry *dentry,
1982 void *value, size_t size, int flags) 2063 const char *name, const void *value, size_t size, int flags)
1983{ } 2064{ }
1984 2065
1985static inline int security_inode_getxattr (struct dentry *dentry, char *name) 2066static inline int security_inode_getxattr(struct dentry *dentry,
2067 const char *name)
1986{ 2068{
1987 return 0; 2069 return 0;
1988} 2070}
1989 2071
1990static inline int security_inode_listxattr (struct dentry *dentry) 2072static inline int security_inode_listxattr(struct dentry *dentry)
1991{ 2073{
1992 return 0; 2074 return 0;
1993} 2075}
1994 2076
1995static inline int security_inode_removexattr (struct dentry *dentry, char *name) 2077static inline int security_inode_removexattr(struct dentry *dentry,
2078 const char *name)
1996{ 2079{
1997 return cap_inode_removexattr(dentry, name); 2080 return cap_inode_removexattr(dentry, name);
1998} 2081}
@@ -2022,292 +2105,304 @@ static inline int security_inode_listsecurity(struct inode *inode, char *buffer,
2022 return 0; 2105 return 0;
2023} 2106}
2024 2107
2025static inline int security_file_permission (struct file *file, int mask) 2108static inline void security_inode_getsecid(const struct inode *inode, u32 *secid)
2109{
2110 *secid = 0;
2111}
2112
2113static inline int security_file_permission(struct file *file, int mask)
2026{ 2114{
2027 return 0; 2115 return 0;
2028} 2116}
2029 2117
2030static inline int security_file_alloc (struct file *file) 2118static inline int security_file_alloc(struct file *file)
2031{ 2119{
2032 return 0; 2120 return 0;
2033} 2121}
2034 2122
2035static inline void security_file_free (struct file *file) 2123static inline void security_file_free(struct file *file)
2036{ } 2124{ }
2037 2125
2038static inline int security_file_ioctl (struct file *file, unsigned int cmd, 2126static inline int security_file_ioctl(struct file *file, unsigned int cmd,
2039 unsigned long arg) 2127 unsigned long arg)
2040{ 2128{
2041 return 0; 2129 return 0;
2042} 2130}
2043 2131
2044static inline int security_file_mmap (struct file *file, unsigned long reqprot, 2132static inline int security_file_mmap(struct file *file, unsigned long reqprot,
2045 unsigned long prot, 2133 unsigned long prot,
2046 unsigned long flags, 2134 unsigned long flags,
2047 unsigned long addr, 2135 unsigned long addr,
2048 unsigned long addr_only) 2136 unsigned long addr_only)
2049{ 2137{
2050 return 0; 2138 return 0;
2051} 2139}
2052 2140
2053static inline int security_file_mprotect (struct vm_area_struct *vma, 2141static inline int security_file_mprotect(struct vm_area_struct *vma,
2054 unsigned long reqprot, 2142 unsigned long reqprot,
2055 unsigned long prot) 2143 unsigned long prot)
2056{ 2144{
2057 return 0; 2145 return 0;
2058} 2146}
2059 2147
2060static inline int security_file_lock (struct file *file, unsigned int cmd) 2148static inline int security_file_lock(struct file *file, unsigned int cmd)
2061{ 2149{
2062 return 0; 2150 return 0;
2063} 2151}
2064 2152
2065static inline int security_file_fcntl (struct file *file, unsigned int cmd, 2153static inline int security_file_fcntl(struct file *file, unsigned int cmd,
2066 unsigned long arg) 2154 unsigned long arg)
2067{ 2155{
2068 return 0; 2156 return 0;
2069} 2157}
2070 2158
2071static inline int security_file_set_fowner (struct file *file) 2159static inline int security_file_set_fowner(struct file *file)
2072{ 2160{
2073 return 0; 2161 return 0;
2074} 2162}
2075 2163
2076static inline int security_file_send_sigiotask (struct task_struct *tsk, 2164static inline int security_file_send_sigiotask(struct task_struct *tsk,
2077 struct fown_struct *fown, 2165 struct fown_struct *fown,
2078 int sig) 2166 int sig)
2079{ 2167{
2080 return 0; 2168 return 0;
2081} 2169}
2082 2170
2083static inline int security_file_receive (struct file *file) 2171static inline int security_file_receive(struct file *file)
2084{ 2172{
2085 return 0; 2173 return 0;
2086} 2174}
2087 2175
2088static inline int security_dentry_open (struct file *file) 2176static inline int security_dentry_open(struct file *file)
2089{ 2177{
2090 return 0; 2178 return 0;
2091} 2179}
2092 2180
2093static inline int security_task_create (unsigned long clone_flags) 2181static inline int security_task_create(unsigned long clone_flags)
2094{ 2182{
2095 return 0; 2183 return 0;
2096} 2184}
2097 2185
2098static inline int security_task_alloc (struct task_struct *p) 2186static inline int security_task_alloc(struct task_struct *p)
2099{ 2187{
2100 return 0; 2188 return 0;
2101} 2189}
2102 2190
2103static inline void security_task_free (struct task_struct *p) 2191static inline void security_task_free(struct task_struct *p)
2104{ } 2192{ }
2105 2193
2106static inline int security_task_setuid (uid_t id0, uid_t id1, uid_t id2, 2194static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2107 int flags) 2195 int flags)
2108{ 2196{
2109 return 0; 2197 return 0;
2110} 2198}
2111 2199
2112static inline int security_task_post_setuid (uid_t old_ruid, uid_t old_euid, 2200static inline int security_task_post_setuid(uid_t old_ruid, uid_t old_euid,
2113 uid_t old_suid, int flags) 2201 uid_t old_suid, int flags)
2114{ 2202{
2115 return cap_task_post_setuid (old_ruid, old_euid, old_suid, flags); 2203 return cap_task_post_setuid(old_ruid, old_euid, old_suid, flags);
2116} 2204}
2117 2205
2118static inline int security_task_setgid (gid_t id0, gid_t id1, gid_t id2, 2206static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2,
2119 int flags) 2207 int flags)
2120{ 2208{
2121 return 0; 2209 return 0;
2122} 2210}
2123 2211
2124static inline int security_task_setpgid (struct task_struct *p, pid_t pgid) 2212static inline int security_task_setpgid(struct task_struct *p, pid_t pgid)
2125{ 2213{
2126 return 0; 2214 return 0;
2127} 2215}
2128 2216
2129static inline int security_task_getpgid (struct task_struct *p) 2217static inline int security_task_getpgid(struct task_struct *p)
2130{ 2218{
2131 return 0; 2219 return 0;
2132} 2220}
2133 2221
2134static inline int security_task_getsid (struct task_struct *p) 2222static inline int security_task_getsid(struct task_struct *p)
2135{ 2223{
2136 return 0; 2224 return 0;
2137} 2225}
2138 2226
2139static inline void security_task_getsecid (struct task_struct *p, u32 *secid) 2227static inline void security_task_getsecid(struct task_struct *p, u32 *secid)
2140{ } 2228{
2229 *secid = 0;
2230}
2141 2231
2142static inline int security_task_setgroups (struct group_info *group_info) 2232static inline int security_task_setgroups(struct group_info *group_info)
2143{ 2233{
2144 return 0; 2234 return 0;
2145} 2235}
2146 2236
2147static inline int security_task_setnice (struct task_struct *p, int nice) 2237static inline int security_task_setnice(struct task_struct *p, int nice)
2148{ 2238{
2149 return cap_task_setnice(p, nice); 2239 return cap_task_setnice(p, nice);
2150} 2240}
2151 2241
2152static inline int security_task_setioprio (struct task_struct *p, int ioprio) 2242static inline int security_task_setioprio(struct task_struct *p, int ioprio)
2153{ 2243{
2154 return cap_task_setioprio(p, ioprio); 2244 return cap_task_setioprio(p, ioprio);
2155} 2245}
2156 2246
2157static inline int security_task_getioprio (struct task_struct *p) 2247static inline int security_task_getioprio(struct task_struct *p)
2158{ 2248{
2159 return 0; 2249 return 0;
2160} 2250}
2161 2251
2162static inline int security_task_setrlimit (unsigned int resource, 2252static inline int security_task_setrlimit(unsigned int resource,
2163 struct rlimit *new_rlim) 2253 struct rlimit *new_rlim)
2164{ 2254{
2165 return 0; 2255 return 0;
2166} 2256}
2167 2257
2168static inline int security_task_setscheduler (struct task_struct *p, 2258static inline int security_task_setscheduler(struct task_struct *p,
2169 int policy, 2259 int policy,
2170 struct sched_param *lp) 2260 struct sched_param *lp)
2171{ 2261{
2172 return cap_task_setscheduler(p, policy, lp); 2262 return cap_task_setscheduler(p, policy, lp);
2173} 2263}
2174 2264
2175static inline int security_task_getscheduler (struct task_struct *p) 2265static inline int security_task_getscheduler(struct task_struct *p)
2176{ 2266{
2177 return 0; 2267 return 0;
2178} 2268}
2179 2269
2180static inline int security_task_movememory (struct task_struct *p) 2270static inline int security_task_movememory(struct task_struct *p)
2181{ 2271{
2182 return 0; 2272 return 0;
2183} 2273}
2184 2274
2185static inline int security_task_kill (struct task_struct *p, 2275static inline int security_task_kill(struct task_struct *p,
2186 struct siginfo *info, int sig, 2276 struct siginfo *info, int sig,
2187 u32 secid) 2277 u32 secid)
2188{ 2278{
2189 return 0; 2279 return 0;
2190} 2280}
2191 2281
2192static inline int security_task_wait (struct task_struct *p) 2282static inline int security_task_wait(struct task_struct *p)
2193{ 2283{
2194 return 0; 2284 return 0;
2195} 2285}
2196 2286
2197static inline int security_task_prctl (int option, unsigned long arg2, 2287static inline int security_task_prctl(int option, unsigned long arg2,
2198 unsigned long arg3, 2288 unsigned long arg3,
2199 unsigned long arg4, 2289 unsigned long arg4,
2200 unsigned long arg5) 2290 unsigned long arg5, long *rc_p)
2201{ 2291{
2202 return 0; 2292 return cap_task_prctl(option, arg2, arg3, arg3, arg5, rc_p);
2203} 2293}
2204 2294
2205static inline void security_task_reparent_to_init (struct task_struct *p) 2295static inline void security_task_reparent_to_init(struct task_struct *p)
2206{ 2296{
2207 cap_task_reparent_to_init (p); 2297 cap_task_reparent_to_init(p);
2208} 2298}
2209 2299
2210static inline void security_task_to_inode(struct task_struct *p, struct inode *inode) 2300static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
2211{ } 2301{ }
2212 2302
2213static inline int security_ipc_permission (struct kern_ipc_perm *ipcp, 2303static inline int security_ipc_permission(struct kern_ipc_perm *ipcp,
2214 short flag) 2304 short flag)
2215{ 2305{
2216 return 0; 2306 return 0;
2217} 2307}
2218 2308
2219static inline int security_msg_msg_alloc (struct msg_msg * msg) 2309static inline void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid)
2310{
2311 *secid = 0;
2312}
2313
2314static inline int security_msg_msg_alloc(struct msg_msg *msg)
2220{ 2315{
2221 return 0; 2316 return 0;
2222} 2317}
2223 2318
2224static inline void security_msg_msg_free (struct msg_msg * msg) 2319static inline void security_msg_msg_free(struct msg_msg *msg)
2225{ } 2320{ }
2226 2321
2227static inline int security_msg_queue_alloc (struct msg_queue *msq) 2322static inline int security_msg_queue_alloc(struct msg_queue *msq)
2228{ 2323{
2229 return 0; 2324 return 0;
2230} 2325}
2231 2326
2232static inline void security_msg_queue_free (struct msg_queue *msq) 2327static inline void security_msg_queue_free(struct msg_queue *msq)
2233{ } 2328{ }
2234 2329
2235static inline int security_msg_queue_associate (struct msg_queue * msq, 2330static inline int security_msg_queue_associate(struct msg_queue *msq,
2236 int msqflg) 2331 int msqflg)
2237{ 2332{
2238 return 0; 2333 return 0;
2239} 2334}
2240 2335
2241static inline int security_msg_queue_msgctl (struct msg_queue * msq, int cmd) 2336static inline int security_msg_queue_msgctl(struct msg_queue *msq, int cmd)
2242{ 2337{
2243 return 0; 2338 return 0;
2244} 2339}
2245 2340
2246static inline int security_msg_queue_msgsnd (struct msg_queue * msq, 2341static inline int security_msg_queue_msgsnd(struct msg_queue *msq,
2247 struct msg_msg * msg, int msqflg) 2342 struct msg_msg *msg, int msqflg)
2248{ 2343{
2249 return 0; 2344 return 0;
2250} 2345}
2251 2346
2252static inline int security_msg_queue_msgrcv (struct msg_queue * msq, 2347static inline int security_msg_queue_msgrcv(struct msg_queue *msq,
2253 struct msg_msg * msg, 2348 struct msg_msg *msg,
2254 struct task_struct * target, 2349 struct task_struct *target,
2255 long type, int mode) 2350 long type, int mode)
2256{ 2351{
2257 return 0; 2352 return 0;
2258} 2353}
2259 2354
2260static inline int security_shm_alloc (struct shmid_kernel *shp) 2355static inline int security_shm_alloc(struct shmid_kernel *shp)
2261{ 2356{
2262 return 0; 2357 return 0;
2263} 2358}
2264 2359
2265static inline void security_shm_free (struct shmid_kernel *shp) 2360static inline void security_shm_free(struct shmid_kernel *shp)
2266{ } 2361{ }
2267 2362
2268static inline int security_shm_associate (struct shmid_kernel * shp, 2363static inline int security_shm_associate(struct shmid_kernel *shp,
2269 int shmflg) 2364 int shmflg)
2270{ 2365{
2271 return 0; 2366 return 0;
2272} 2367}
2273 2368
2274static inline int security_shm_shmctl (struct shmid_kernel * shp, int cmd) 2369static inline int security_shm_shmctl(struct shmid_kernel *shp, int cmd)
2275{ 2370{
2276 return 0; 2371 return 0;
2277} 2372}
2278 2373
2279static inline int security_shm_shmat (struct shmid_kernel * shp, 2374static inline int security_shm_shmat(struct shmid_kernel *shp,
2280 char __user *shmaddr, int shmflg) 2375 char __user *shmaddr, int shmflg)
2281{ 2376{
2282 return 0; 2377 return 0;
2283} 2378}
2284 2379
2285static inline int security_sem_alloc (struct sem_array *sma) 2380static inline int security_sem_alloc(struct sem_array *sma)
2286{ 2381{
2287 return 0; 2382 return 0;
2288} 2383}
2289 2384
2290static inline void security_sem_free (struct sem_array *sma) 2385static inline void security_sem_free(struct sem_array *sma)
2291{ } 2386{ }
2292 2387
2293static inline int security_sem_associate (struct sem_array * sma, int semflg) 2388static inline int security_sem_associate(struct sem_array *sma, int semflg)
2294{ 2389{
2295 return 0; 2390 return 0;
2296} 2391}
2297 2392
2298static inline int security_sem_semctl (struct sem_array * sma, int cmd) 2393static inline int security_sem_semctl(struct sem_array *sma, int cmd)
2299{ 2394{
2300 return 0; 2395 return 0;
2301} 2396}
2302 2397
2303static inline int security_sem_semop (struct sem_array * sma, 2398static inline int security_sem_semop(struct sem_array *sma,
2304 struct sembuf * sops, unsigned nsops, 2399 struct sembuf *sops, unsigned nsops,
2305 int alter) 2400 int alter)
2306{ 2401{
2307 return 0; 2402 return 0;
2308} 2403}
2309 2404
2310static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode) 2405static inline void security_d_instantiate(struct dentry *dentry, struct inode *inode)
2311{ } 2406{ }
2312 2407
2313static inline int security_getprocattr(struct task_struct *p, char *name, char **value) 2408static inline int security_getprocattr(struct task_struct *p, char *name, char **value)
@@ -2320,14 +2415,14 @@ static inline int security_setprocattr(struct task_struct *p, char *name, void *
2320 return -EINVAL; 2415 return -EINVAL;
2321} 2416}
2322 2417
2323static inline int security_netlink_send (struct sock *sk, struct sk_buff *skb) 2418static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
2324{ 2419{
2325 return cap_netlink_send (sk, skb); 2420 return cap_netlink_send(sk, skb);
2326} 2421}
2327 2422
2328static inline int security_netlink_recv (struct sk_buff *skb, int cap) 2423static inline int security_netlink_recv(struct sk_buff *skb, int cap)
2329{ 2424{
2330 return cap_netlink_recv (skb, cap); 2425 return cap_netlink_recv(skb, cap);
2331} 2426}
2332 2427
2333static inline struct dentry *securityfs_create_dir(const char *name, 2428static inline struct dentry *securityfs_create_dir(const char *name,
@@ -2354,7 +2449,7 @@ static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *secle
2354 return -EOPNOTSUPP; 2449 return -EOPNOTSUPP;
2355} 2450}
2356 2451
2357static inline int security_secctx_to_secid(char *secdata, 2452static inline int security_secctx_to_secid(const char *secdata,
2358 u32 seclen, 2453 u32 seclen,
2359 u32 *secid) 2454 u32 *secid)
2360{ 2455{
@@ -2405,26 +2500,26 @@ void security_inet_conn_established(struct sock *sk,
2405 struct sk_buff *skb); 2500 struct sk_buff *skb);
2406 2501
2407#else /* CONFIG_SECURITY_NETWORK */ 2502#else /* CONFIG_SECURITY_NETWORK */
2408static inline int security_unix_stream_connect(struct socket * sock, 2503static inline int security_unix_stream_connect(struct socket *sock,
2409 struct socket * other, 2504 struct socket *other,
2410 struct sock * newsk) 2505 struct sock *newsk)
2411{ 2506{
2412 return 0; 2507 return 0;
2413} 2508}
2414 2509
2415static inline int security_unix_may_send(struct socket * sock, 2510static inline int security_unix_may_send(struct socket *sock,
2416 struct socket * other) 2511 struct socket *other)
2417{ 2512{
2418 return 0; 2513 return 0;
2419} 2514}
2420 2515
2421static inline int security_socket_create (int family, int type, 2516static inline int security_socket_create(int family, int type,
2422 int protocol, int kern) 2517 int protocol, int kern)
2423{ 2518{
2424 return 0; 2519 return 0;
2425} 2520}
2426 2521
2427static inline int security_socket_post_create(struct socket * sock, 2522static inline int security_socket_post_create(struct socket *sock,
2428 int family, 2523 int family,
2429 int type, 2524 int type,
2430 int protocol, int kern) 2525 int protocol, int kern)
@@ -2432,77 +2527,77 @@ static inline int security_socket_post_create(struct socket * sock,
2432 return 0; 2527 return 0;
2433} 2528}
2434 2529
2435static inline int security_socket_bind(struct socket * sock, 2530static inline int security_socket_bind(struct socket *sock,
2436 struct sockaddr * address, 2531 struct sockaddr *address,
2437 int addrlen) 2532 int addrlen)
2438{ 2533{
2439 return 0; 2534 return 0;
2440} 2535}
2441 2536
2442static inline int security_socket_connect(struct socket * sock, 2537static inline int security_socket_connect(struct socket *sock,
2443 struct sockaddr * address, 2538 struct sockaddr *address,
2444 int addrlen) 2539 int addrlen)
2445{ 2540{
2446 return 0; 2541 return 0;
2447} 2542}
2448 2543
2449static inline int security_socket_listen(struct socket * sock, int backlog) 2544static inline int security_socket_listen(struct socket *sock, int backlog)
2450{ 2545{
2451 return 0; 2546 return 0;
2452} 2547}
2453 2548
2454static inline int security_socket_accept(struct socket * sock, 2549static inline int security_socket_accept(struct socket *sock,
2455 struct socket * newsock) 2550 struct socket *newsock)
2456{ 2551{
2457 return 0; 2552 return 0;
2458} 2553}
2459 2554
2460static inline void security_socket_post_accept(struct socket * sock, 2555static inline void security_socket_post_accept(struct socket *sock,
2461 struct socket * newsock) 2556 struct socket *newsock)
2462{ 2557{
2463} 2558}
2464 2559
2465static inline int security_socket_sendmsg(struct socket * sock, 2560static inline int security_socket_sendmsg(struct socket *sock,
2466 struct msghdr * msg, int size) 2561 struct msghdr *msg, int size)
2467{ 2562{
2468 return 0; 2563 return 0;
2469} 2564}
2470 2565
2471static inline int security_socket_recvmsg(struct socket * sock, 2566static inline int security_socket_recvmsg(struct socket *sock,
2472 struct msghdr * msg, int size, 2567 struct msghdr *msg, int size,
2473 int flags) 2568 int flags)
2474{ 2569{
2475 return 0; 2570 return 0;
2476} 2571}
2477 2572
2478static inline int security_socket_getsockname(struct socket * sock) 2573static inline int security_socket_getsockname(struct socket *sock)
2479{ 2574{
2480 return 0; 2575 return 0;
2481} 2576}
2482 2577
2483static inline int security_socket_getpeername(struct socket * sock) 2578static inline int security_socket_getpeername(struct socket *sock)
2484{ 2579{
2485 return 0; 2580 return 0;
2486} 2581}
2487 2582
2488static inline int security_socket_getsockopt(struct socket * sock, 2583static inline int security_socket_getsockopt(struct socket *sock,
2489 int level, int optname) 2584 int level, int optname)
2490{ 2585{
2491 return 0; 2586 return 0;
2492} 2587}
2493 2588
2494static inline int security_socket_setsockopt(struct socket * sock, 2589static inline int security_socket_setsockopt(struct socket *sock,
2495 int level, int optname) 2590 int level, int optname)
2496{ 2591{
2497 return 0; 2592 return 0;
2498} 2593}
2499 2594
2500static inline int security_socket_shutdown(struct socket * sock, int how) 2595static inline int security_socket_shutdown(struct socket *sock, int how)
2501{ 2596{
2502 return 0; 2597 return 0;
2503} 2598}
2504static inline int security_sock_rcv_skb (struct sock * sk, 2599static inline int security_sock_rcv_skb(struct sock *sk,
2505 struct sk_buff * skb) 2600 struct sk_buff *skb)
2506{ 2601{
2507 return 0; 2602 return 0;
2508} 2603}
@@ -2539,7 +2634,7 @@ static inline void security_req_classify_flow(const struct request_sock *req, st
2539{ 2634{
2540} 2635}
2541 2636
2542static inline void security_sock_graft(struct sock* sk, struct socket *parent) 2637static inline void security_sock_graft(struct sock *sk, struct socket *parent)
2543{ 2638{
2544} 2639}
2545 2640
@@ -2562,16 +2657,16 @@ static inline void security_inet_conn_established(struct sock *sk,
2562 2657
2563#ifdef CONFIG_SECURITY_NETWORK_XFRM 2658#ifdef CONFIG_SECURITY_NETWORK_XFRM
2564 2659
2565int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); 2660int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx);
2566int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new); 2661int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp);
2567void security_xfrm_policy_free(struct xfrm_policy *xp); 2662void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx);
2568int security_xfrm_policy_delete(struct xfrm_policy *xp); 2663int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx);
2569int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); 2664int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
2570int security_xfrm_state_alloc_acquire(struct xfrm_state *x, 2665int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
2571 struct xfrm_sec_ctx *polsec, u32 secid); 2666 struct xfrm_sec_ctx *polsec, u32 secid);
2572int security_xfrm_state_delete(struct xfrm_state *x); 2667int security_xfrm_state_delete(struct xfrm_state *x);
2573void security_xfrm_state_free(struct xfrm_state *x); 2668void security_xfrm_state_free(struct xfrm_state *x);
2574int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir); 2669int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
2575int security_xfrm_state_pol_flow_match(struct xfrm_state *x, 2670int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
2576 struct xfrm_policy *xp, struct flowi *fl); 2671 struct xfrm_policy *xp, struct flowi *fl);
2577int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); 2672int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
@@ -2579,21 +2674,21 @@ void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl);
2579 2674
2580#else /* CONFIG_SECURITY_NETWORK_XFRM */ 2675#else /* CONFIG_SECURITY_NETWORK_XFRM */
2581 2676
2582static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) 2677static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx)
2583{ 2678{
2584 return 0; 2679 return 0;
2585} 2680}
2586 2681
2587static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) 2682static inline int security_xfrm_policy_clone(struct xfrm_sec_ctx *old, struct xfrm_sec_ctx **new_ctxp)
2588{ 2683{
2589 return 0; 2684 return 0;
2590} 2685}
2591 2686
2592static inline void security_xfrm_policy_free(struct xfrm_policy *xp) 2687static inline void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx)
2593{ 2688{
2594} 2689}
2595 2690
2596static inline int security_xfrm_policy_delete(struct xfrm_policy *xp) 2691static inline int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
2597{ 2692{
2598 return 0; 2693 return 0;
2599} 2694}
@@ -2619,7 +2714,7 @@ static inline int security_xfrm_state_delete(struct xfrm_state *x)
2619 return 0; 2714 return 0;
2620} 2715}
2621 2716
2622static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir) 2717static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir)
2623{ 2718{
2624 return 0; 2719 return 0;
2625} 2720}
@@ -2648,6 +2743,7 @@ int security_key_alloc(struct key *key, struct task_struct *tsk, unsigned long f
2648void security_key_free(struct key *key); 2743void security_key_free(struct key *key);
2649int security_key_permission(key_ref_t key_ref, 2744int security_key_permission(key_ref_t key_ref,
2650 struct task_struct *context, key_perm_t perm); 2745 struct task_struct *context, key_perm_t perm);
2746int security_key_getsecurity(struct key *key, char **_buffer);
2651 2747
2652#else 2748#else
2653 2749
@@ -2669,8 +2765,47 @@ static inline int security_key_permission(key_ref_t key_ref,
2669 return 0; 2765 return 0;
2670} 2766}
2671 2767
2768static inline int security_key_getsecurity(struct key *key, char **_buffer)
2769{
2770 *_buffer = NULL;
2771 return 0;
2772}
2773
2672#endif 2774#endif
2673#endif /* CONFIG_KEYS */ 2775#endif /* CONFIG_KEYS */
2674 2776
2777#ifdef CONFIG_AUDIT
2778#ifdef CONFIG_SECURITY
2779int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule);
2780int security_audit_rule_known(struct audit_krule *krule);
2781int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule,
2782 struct audit_context *actx);
2783void security_audit_rule_free(void *lsmrule);
2784
2785#else
2786
2787static inline int security_audit_rule_init(u32 field, u32 op, char *rulestr,
2788 void **lsmrule)
2789{
2790 return 0;
2791}
2792
2793static inline int security_audit_rule_known(struct audit_krule *krule)
2794{
2795 return 0;
2796}
2797
2798static inline int security_audit_rule_match(u32 secid, u32 field, u32 op,
2799 void *lsmrule, struct audit_context *actx)
2800{
2801 return 0;
2802}
2803
2804static inline void security_audit_rule_free(void *lsmrule)
2805{ }
2806
2807#endif /* CONFIG_SECURITY */
2808#endif /* CONFIG_AUDIT */
2809
2675#endif /* ! __LINUX_SECURITY_H */ 2810#endif /* ! __LINUX_SECURITY_H */
2676 2811
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index 8c2cc4c02526..20f965d4b041 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -16,99 +16,11 @@
16 16
17struct selinux_audit_rule; 17struct selinux_audit_rule;
18struct audit_context; 18struct audit_context;
19struct inode;
20struct kern_ipc_perm; 19struct kern_ipc_perm;
21 20
22#ifdef CONFIG_SECURITY_SELINUX 21#ifdef CONFIG_SECURITY_SELINUX
23 22
24/** 23/**
25 * selinux_audit_rule_init - alloc/init an selinux audit rule structure.
26 * @field: the field this rule refers to
27 * @op: the operater the rule uses
28 * @rulestr: the text "target" of the rule
29 * @rule: pointer to the new rule structure returned via this
30 *
31 * Returns 0 if successful, -errno if not. On success, the rule structure
32 * will be allocated internally. The caller must free this structure with
33 * selinux_audit_rule_free() after use.
34 */
35int selinux_audit_rule_init(u32 field, u32 op, char *rulestr,
36 struct selinux_audit_rule **rule);
37
38/**
39 * selinux_audit_rule_free - free an selinux audit rule structure.
40 * @rule: pointer to the audit rule to be freed
41 *
42 * This will free all memory associated with the given rule.
43 * If @rule is NULL, no operation is performed.
44 */
45void selinux_audit_rule_free(struct selinux_audit_rule *rule);
46
47/**
48 * selinux_audit_rule_match - determine if a context ID matches a rule.
49 * @sid: the context ID to check
50 * @field: the field this rule refers to
51 * @op: the operater the rule uses
52 * @rule: pointer to the audit rule to check against
53 * @actx: the audit context (can be NULL) associated with the check
54 *
55 * Returns 1 if the context id matches the rule, 0 if it does not, and
56 * -errno on failure.
57 */
58int selinux_audit_rule_match(u32 sid, u32 field, u32 op,
59 struct selinux_audit_rule *rule,
60 struct audit_context *actx);
61
62/**
63 * selinux_audit_set_callback - set the callback for policy reloads.
64 * @callback: the function to call when the policy is reloaded
65 *
66 * This sets the function callback function that will update the rules
67 * upon policy reloads. This callback should rebuild all existing rules
68 * using selinux_audit_rule_init().
69 */
70void selinux_audit_set_callback(int (*callback)(void));
71
72/**
73 * selinux_sid_to_string - map a security context ID to a string
74 * @sid: security context ID to be converted.
75 * @ctx: address of context string to be returned
76 * @ctxlen: length of returned context string.
77 *
78 * Returns 0 if successful, -errno if not. On success, the context
79 * string will be allocated internally, and the caller must call
80 * kfree() on it after use.
81 */
82int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen);
83
84/**
85 * selinux_get_inode_sid - get the inode's security context ID
86 * @inode: inode structure to get the sid from.
87 * @sid: pointer to security context ID to be filled in.
88 *
89 * Returns nothing
90 */
91void selinux_get_inode_sid(const struct inode *inode, u32 *sid);
92
93/**
94 * selinux_get_ipc_sid - get the ipc security context ID
95 * @ipcp: ipc structure to get the sid from.
96 * @sid: pointer to security context ID to be filled in.
97 *
98 * Returns nothing
99 */
100void selinux_get_ipc_sid(const struct kern_ipc_perm *ipcp, u32 *sid);
101
102/**
103 * selinux_get_task_sid - return the SID of task
104 * @tsk: the task whose SID will be returned
105 * @sid: pointer to security context ID to be filled in.
106 *
107 * Returns nothing
108 */
109void selinux_get_task_sid(struct task_struct *tsk, u32 *sid);
110
111/**
112 * selinux_string_to_sid - map a security context string to a security ID 24 * selinux_string_to_sid - map a security context string to a security ID
113 * @str: the security context string to be mapped 25 * @str: the security context string to be mapped
114 * @sid: ID value returned via this. 26 * @sid: ID value returned via this.
@@ -151,52 +63,6 @@ void selinux_secmark_refcount_inc(void);
151void selinux_secmark_refcount_dec(void); 63void selinux_secmark_refcount_dec(void);
152#else 64#else
153 65
154static inline int selinux_audit_rule_init(u32 field, u32 op,
155 char *rulestr,
156 struct selinux_audit_rule **rule)
157{
158 return -EOPNOTSUPP;
159}
160
161static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule)
162{
163 return;
164}
165
166static inline int selinux_audit_rule_match(u32 sid, u32 field, u32 op,
167 struct selinux_audit_rule *rule,
168 struct audit_context *actx)
169{
170 return 0;
171}
172
173static inline void selinux_audit_set_callback(int (*callback)(void))
174{
175 return;
176}
177
178static inline int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen)
179{
180 *ctx = NULL;
181 *ctxlen = 0;
182 return 0;
183}
184
185static inline void selinux_get_inode_sid(const struct inode *inode, u32 *sid)
186{
187 *sid = 0;
188}
189
190static inline void selinux_get_ipc_sid(const struct kern_ipc_perm *ipcp, u32 *sid)
191{
192 *sid = 0;
193}
194
195static inline void selinux_get_task_sid(struct task_struct *tsk, u32 *sid)
196{
197 *sid = 0;
198}
199
200static inline int selinux_string_to_sid(const char *str, u32 *sid) 66static inline int selinux_string_to_sid(const char *str, u32 *sid)
201{ 67{
202 *sid = 0; 68 *sid = 0;
diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h
new file mode 100644
index 000000000000..9cae64b00d6b
--- /dev/null
+++ b/include/linux/semaphore.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (c) 2008 Intel Corporation
3 * Author: Matthew Wilcox <willy@linux.intel.com>
4 *
5 * Distributed under the terms of the GNU GPL, version 2
6 *
7 * Please see kernel/semaphore.c for documentation of these functions
8 */
9#ifndef __LINUX_SEMAPHORE_H
10#define __LINUX_SEMAPHORE_H
11
12#include <linux/list.h>
13#include <linux/spinlock.h>
14
15/* Please don't access any members of this structure directly */
16struct semaphore {
17 spinlock_t lock;
18 unsigned int count;
19 struct list_head wait_list;
20};
21
22#define __SEMAPHORE_INITIALIZER(name, n) \
23{ \
24 .lock = __SPIN_LOCK_UNLOCKED((name).lock), \
25 .count = n, \
26 .wait_list = LIST_HEAD_INIT((name).wait_list), \
27}
28
29#define __DECLARE_SEMAPHORE_GENERIC(name, count) \
30 struct semaphore name = __SEMAPHORE_INITIALIZER(name, count)
31
32#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1)
33
34static inline void sema_init(struct semaphore *sem, int val)
35{
36 static struct lock_class_key __key;
37 *sem = (struct semaphore) __SEMAPHORE_INITIALIZER(*sem, val);
38 lockdep_init_map(&sem->lock.dep_map, "semaphore->lock", &__key, 0);
39}
40
41#define init_MUTEX(sem) sema_init(sem, 1)
42#define init_MUTEX_LOCKED(sem) sema_init(sem, 0)
43
44extern void down(struct semaphore *sem);
45extern int __must_check down_interruptible(struct semaphore *sem);
46extern int __must_check down_killable(struct semaphore *sem);
47extern int __must_check down_trylock(struct semaphore *sem);
48extern int __must_check down_timeout(struct semaphore *sem, long jiffies);
49extern void up(struct semaphore *sem);
50
51#endif /* __LINUX_SEMAPHORE_H */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 67c2563961f3..a66304a09955 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -1,6 +1,5 @@
1#ifndef _LINUX_SEQ_FILE_H 1#ifndef _LINUX_SEQ_FILE_H
2#define _LINUX_SEQ_FILE_H 2#define _LINUX_SEQ_FILE_H
3#ifdef __KERNEL__
4 3
5#include <linux/types.h> 4#include <linux/types.h>
6#include <linux/string.h> 5#include <linux/string.h>
@@ -10,6 +9,7 @@ struct seq_operations;
10struct file; 9struct file;
11struct path; 10struct path;
12struct inode; 11struct inode;
12struct dentry;
13 13
14struct seq_file { 14struct seq_file {
15 char *buf; 15 char *buf;
@@ -30,6 +30,8 @@ struct seq_operations {
30 int (*show) (struct seq_file *m, void *v); 30 int (*show) (struct seq_file *m, void *v);
31}; 31};
32 32
33#define SEQ_SKIP 1
34
33int seq_open(struct file *, const struct seq_operations *); 35int seq_open(struct file *, const struct seq_operations *);
34ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); 36ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
35loff_t seq_lseek(struct file *, loff_t, int); 37loff_t seq_lseek(struct file *, loff_t, int);
@@ -42,6 +44,9 @@ int seq_printf(struct seq_file *, const char *, ...)
42 __attribute__ ((format (printf,2,3))); 44 __attribute__ ((format (printf,2,3)));
43 45
44int seq_path(struct seq_file *, struct path *, char *); 46int seq_path(struct seq_file *, struct path *, char *);
47int seq_dentry(struct seq_file *, struct dentry *, char *);
48int seq_path_root(struct seq_file *m, struct path *path, struct path *root,
49 char *esc);
45 50
46int single_open(struct file *, int (*)(struct seq_file *, void *), void *); 51int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
47int single_release(struct inode *, struct file *); 52int single_release(struct inode *, struct file *);
@@ -62,18 +67,4 @@ extern struct list_head *seq_list_start_head(struct list_head *head,
62extern struct list_head *seq_list_next(void *v, struct list_head *head, 67extern struct list_head *seq_list_next(void *v, struct list_head *head,
63 loff_t *ppos); 68 loff_t *ppos);
64 69
65struct net;
66struct seq_net_private {
67 struct net *net;
68};
69
70int seq_open_net(struct inode *, struct file *,
71 const struct seq_operations *, int);
72int seq_release_net(struct inode *, struct file *);
73static inline struct net *seq_file_net(struct seq_file *seq)
74{
75 return ((struct seq_net_private *)seq->private)->net;
76}
77
78#endif
79#endif 70#endif
diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h
new file mode 100644
index 000000000000..4ac52542a563
--- /dev/null
+++ b/include/linux/seq_file_net.h
@@ -0,0 +1,27 @@
1#ifndef __SEQ_FILE_NET_H__
2#define __SEQ_FILE_NET_H__
3
4#include <linux/seq_file.h>
5
6struct net;
7extern struct net init_net;
8
9struct seq_net_private {
10#ifdef CONFIG_NET_NS
11 struct net *net;
12#endif
13};
14
15int seq_open_net(struct inode *, struct file *,
16 const struct seq_operations *, int);
17int seq_release_net(struct inode *, struct file *);
18static inline struct net *seq_file_net(struct seq_file *seq)
19{
20#ifdef CONFIG_NET_NS
21 return ((struct seq_net_private *)seq->private)->net;
22#else
23 return &init_net;
24#endif
25}
26
27#endif
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 26e4925bc35b..632205ccc25d 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -85,23 +85,29 @@ static inline int write_tryseqlock(seqlock_t *sl)
85/* Start of read calculation -- fetch last complete writer token */ 85/* Start of read calculation -- fetch last complete writer token */
86static __always_inline unsigned read_seqbegin(const seqlock_t *sl) 86static __always_inline unsigned read_seqbegin(const seqlock_t *sl)
87{ 87{
88 unsigned ret = sl->sequence; 88 unsigned ret;
89
90repeat:
91 ret = sl->sequence;
89 smp_rmb(); 92 smp_rmb();
93 if (unlikely(ret & 1)) {
94 cpu_relax();
95 goto repeat;
96 }
97
90 return ret; 98 return ret;
91} 99}
92 100
93/* Test if reader processed invalid data. 101/*
94 * If initial values is odd, 102 * Test if reader processed invalid data.
95 * then writer had already started when section was entered 103 *
96 * If sequence value changed 104 * If sequence value changed then writer changed data while in section.
97 * then writer changed data while in section
98 *
99 * Using xor saves one conditional branch.
100 */ 105 */
101static __always_inline int read_seqretry(const seqlock_t *sl, unsigned iv) 106static __always_inline int read_seqretry(const seqlock_t *sl, unsigned start)
102{ 107{
103 smp_rmb(); 108 smp_rmb();
104 return (iv & 1) | (sl->sequence ^ iv); 109
110 return (sl->sequence != start);
105} 111}
106 112
107 113
@@ -122,20 +128,26 @@ typedef struct seqcount {
122/* Start of read using pointer to a sequence counter only. */ 128/* Start of read using pointer to a sequence counter only. */
123static inline unsigned read_seqcount_begin(const seqcount_t *s) 129static inline unsigned read_seqcount_begin(const seqcount_t *s)
124{ 130{
125 unsigned ret = s->sequence; 131 unsigned ret;
132
133repeat:
134 ret = s->sequence;
126 smp_rmb(); 135 smp_rmb();
136 if (unlikely(ret & 1)) {
137 cpu_relax();
138 goto repeat;
139 }
127 return ret; 140 return ret;
128} 141}
129 142
130/* Test if reader processed invalid data. 143/*
131 * Equivalent to: iv is odd or sequence number has changed. 144 * Test if reader processed invalid data because sequence number has changed.
132 * (iv & 1) || (*s != iv)
133 * Using xor saves one conditional branch.
134 */ 145 */
135static inline int read_seqcount_retry(const seqcount_t *s, unsigned iv) 146static inline int read_seqcount_retry(const seqcount_t *s, unsigned start)
136{ 147{
137 smp_rmb(); 148 smp_rmb();
138 return (iv & 1) | (s->sequence ^ iv); 149
150 return s->sequence != start;
139} 151}
140 152
141 153
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 00b65c0a82ca..3d37c94abbc8 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -46,6 +46,7 @@ enum {
46 PLAT8250_DEV_HUB6, 46 PLAT8250_DEV_HUB6,
47 PLAT8250_DEV_MCA, 47 PLAT8250_DEV_MCA,
48 PLAT8250_DEV_AU1X00, 48 PLAT8250_DEV_AU1X00,
49 PLAT8250_DEV_SM501,
49}; 50};
50 51
51/* 52/*
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 289942fc6655..d32123ae08ad 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -149,13 +149,15 @@
149/* Freescale ColdFire */ 149/* Freescale ColdFire */
150#define PORT_MCF 78 150#define PORT_MCF 78
151 151
152#define PORT_SC26XX 79 152/* Blackfin SPORT */
153 153#define PORT_BFIN_SPORT 79
154 154
155/* MN10300 on-chip UART numbers */ 155/* MN10300 on-chip UART numbers */
156#define PORT_MN10300 80 156#define PORT_MN10300 80
157#define PORT_MN10300_CTS 81 157#define PORT_MN10300_CTS 81
158 158
159#define PORT_SC26XX 82
160
159#ifdef __KERNEL__ 161#ifdef __KERNEL__
160 162
161#include <linux/compiler.h> 163#include <linux/compiler.h>
@@ -213,6 +215,10 @@ struct uart_ops {
213 void (*config_port)(struct uart_port *, int); 215 void (*config_port)(struct uart_port *, int);
214 int (*verify_port)(struct uart_port *, struct serial_struct *); 216 int (*verify_port)(struct uart_port *, struct serial_struct *);
215 int (*ioctl)(struct uart_port *, unsigned int, unsigned long); 217 int (*ioctl)(struct uart_port *, unsigned int, unsigned long);
218#ifdef CONFIG_CONSOLE_POLL
219 void (*poll_put_char)(struct uart_port *, unsigned char);
220 int (*poll_get_char)(struct uart_port *);
221#endif
216}; 222};
217 223
218#define UART_CONFIG_TYPE (1 << 0) 224#define UART_CONFIG_TYPE (1 << 0)
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 9f3825014674..95674d97dabd 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -211,5 +211,6 @@ static inline void serio_unpin_driver(struct serio *serio)
211#define SERIO_TOUCHWIN 0x33 211#define SERIO_TOUCHWIN 0x33
212#define SERIO_TAOSEVM 0x34 212#define SERIO_TAOSEVM 0x34
213#define SERIO_FUJITSU 0x35 213#define SERIO_FUJITSU 0x35
214#define SERIO_ZHENHUA 0x36
214 215
215#endif 216#endif
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 8d5fb36ea047..f2d12d5a21b8 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -34,8 +34,7 @@ struct shmem_sb_info {
34 uid_t uid; /* Mount uid for root directory */ 34 uid_t uid; /* Mount uid for root directory */
35 gid_t gid; /* Mount gid for root directory */ 35 gid_t gid; /* Mount gid for root directory */
36 mode_t mode; /* Mount mode for root directory */ 36 mode_t mode; /* Mount mode for root directory */
37 int policy; /* Default NUMA memory alloc policy */ 37 struct mempolicy *mpol; /* default memory policy for mappings */
38 nodemask_t policy_nodes; /* nodemask for preferred and bind */
39}; 38};
40 39
41static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) 40static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 42d2e0a948f4..84f997f8aa53 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -362,8 +362,6 @@ int unhandled_signal(struct task_struct *tsk, int sig);
362#define sig_kernel_stop(sig) \ 362#define sig_kernel_stop(sig) \
363 (((sig) < SIGRTMIN) && siginmask(sig, SIG_KERNEL_STOP_MASK)) 363 (((sig) < SIGRTMIN) && siginmask(sig, SIG_KERNEL_STOP_MASK))
364 364
365#define sig_needs_tasklist(sig) ((sig) == SIGCONT)
366
367#define sig_user_defined(t, signr) \ 365#define sig_user_defined(t, signr) \
368 (((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_DFL) && \ 366 (((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_DFL) && \
369 ((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_IGN)) 367 ((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_IGN))
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bbd8d0027e2f..299ec4b31412 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -242,6 +242,7 @@ typedef unsigned char *sk_buff_data_t;
242 * @queue_mapping: Queue mapping for multiqueue devices 242 * @queue_mapping: Queue mapping for multiqueue devices
243 * @tc_index: Traffic control index 243 * @tc_index: Traffic control index
244 * @tc_verd: traffic control verdict 244 * @tc_verd: traffic control verdict
245 * @ndisc_nodetype: router type (from link layer)
245 * @dma_cookie: a cookie to one of several possible DMA operations 246 * @dma_cookie: a cookie to one of several possible DMA operations
246 * done by skb DMA functions 247 * done by skb DMA functions
247 * @secmark: security marking 248 * @secmark: security marking
@@ -256,7 +257,10 @@ struct sk_buff {
256 ktime_t tstamp; 257 ktime_t tstamp;
257 struct net_device *dev; 258 struct net_device *dev;
258 259
259 struct dst_entry *dst; 260 union {
261 struct dst_entry *dst;
262 struct rtable *rtable;
263 };
260 struct sec_path *sp; 264 struct sec_path *sp;
261 265
262 /* 266 /*
@@ -310,7 +314,10 @@ struct sk_buff {
310 __u16 tc_verd; /* traffic control verdict */ 314 __u16 tc_verd; /* traffic control verdict */
311#endif 315#endif
312#endif 316#endif
313 /* 2 byte hole */ 317#ifdef CONFIG_IPV6_NDISC_NODETYPE
318 __u8 ndisc_nodetype:2;
319#endif
320 /* 14 bit hole */
314 321
315#ifdef CONFIG_NET_DMA 322#ifdef CONFIG_NET_DMA
316 dma_cookie_t dma_cookie; 323 dma_cookie_t dma_cookie;
@@ -657,11 +664,21 @@ static inline void skb_queue_head_init_class(struct sk_buff_head *list,
657} 664}
658 665
659/* 666/*
660 * Insert an sk_buff at the start of a list. 667 * Insert an sk_buff on a list.
661 * 668 *
662 * The "__skb_xxxx()" functions are the non-atomic ones that 669 * The "__skb_xxxx()" functions are the non-atomic ones that
663 * can only be called with interrupts disabled. 670 * can only be called with interrupts disabled.
664 */ 671 */
672extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
673static inline void __skb_insert(struct sk_buff *newsk,
674 struct sk_buff *prev, struct sk_buff *next,
675 struct sk_buff_head *list)
676{
677 newsk->next = next;
678 newsk->prev = prev;
679 next->prev = prev->next = newsk;
680 list->qlen++;
681}
665 682
666/** 683/**
667 * __skb_queue_after - queue a buffer at the list head 684 * __skb_queue_after - queue a buffer at the list head
@@ -678,13 +695,17 @@ static inline void __skb_queue_after(struct sk_buff_head *list,
678 struct sk_buff *prev, 695 struct sk_buff *prev,
679 struct sk_buff *newsk) 696 struct sk_buff *newsk)
680{ 697{
681 struct sk_buff *next; 698 __skb_insert(newsk, prev, prev->next, list);
682 list->qlen++; 699}
683 700
684 next = prev->next; 701extern void skb_append(struct sk_buff *old, struct sk_buff *newsk,
685 newsk->next = next; 702 struct sk_buff_head *list);
686 newsk->prev = prev; 703
687 next->prev = prev->next = newsk; 704static inline void __skb_queue_before(struct sk_buff_head *list,
705 struct sk_buff *next,
706 struct sk_buff *newsk)
707{
708 __skb_insert(newsk, next->prev, next, list);
688} 709}
689 710
690/** 711/**
@@ -718,66 +739,7 @@ extern void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk);
718static inline void __skb_queue_tail(struct sk_buff_head *list, 739static inline void __skb_queue_tail(struct sk_buff_head *list,
719 struct sk_buff *newsk) 740 struct sk_buff *newsk)
720{ 741{
721 struct sk_buff *prev, *next; 742 __skb_queue_before(list, (struct sk_buff *)list, newsk);
722
723 list->qlen++;
724 next = (struct sk_buff *)list;
725 prev = next->prev;
726 newsk->next = next;
727 newsk->prev = prev;
728 next->prev = prev->next = newsk;
729}
730
731
732/**
733 * __skb_dequeue - remove from the head of the queue
734 * @list: list to dequeue from
735 *
736 * Remove the head of the list. This function does not take any locks
737 * so must be used with appropriate locks held only. The head item is
738 * returned or %NULL if the list is empty.
739 */
740extern struct sk_buff *skb_dequeue(struct sk_buff_head *list);
741static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
742{
743 struct sk_buff *next, *prev, *result;
744
745 prev = (struct sk_buff *) list;
746 next = prev->next;
747 result = NULL;
748 if (next != prev) {
749 result = next;
750 next = next->next;
751 list->qlen--;
752 next->prev = prev;
753 prev->next = next;
754 result->next = result->prev = NULL;
755 }
756 return result;
757}
758
759
760/*
761 * Insert a packet on a list.
762 */
763extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
764static inline void __skb_insert(struct sk_buff *newsk,
765 struct sk_buff *prev, struct sk_buff *next,
766 struct sk_buff_head *list)
767{
768 newsk->next = next;
769 newsk->prev = prev;
770 next->prev = prev->next = newsk;
771 list->qlen++;
772}
773
774/*
775 * Place a packet after a given packet in a list.
776 */
777extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
778static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
779{
780 __skb_insert(newsk, old, old->next, list);
781} 743}
782 744
783/* 745/*
@@ -797,8 +759,22 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
797 prev->next = next; 759 prev->next = next;
798} 760}
799 761
800 762/**
801/* XXX: more streamlined implementation */ 763 * __skb_dequeue - remove from the head of the queue
764 * @list: list to dequeue from
765 *
766 * Remove the head of the list. This function does not take any locks
767 * so must be used with appropriate locks held only. The head item is
768 * returned or %NULL if the list is empty.
769 */
770extern struct sk_buff *skb_dequeue(struct sk_buff_head *list);
771static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
772{
773 struct sk_buff *skb = skb_peek(list);
774 if (skb)
775 __skb_unlink(skb, list);
776 return skb;
777}
802 778
803/** 779/**
804 * __skb_dequeue_tail - remove from the tail of the queue 780 * __skb_dequeue_tail - remove from the tail of the queue
@@ -889,6 +865,7 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
889/* 865/*
890 * Add data to an sk_buff 866 * Add data to an sk_buff
891 */ 867 */
868extern unsigned char *skb_put(struct sk_buff *skb, unsigned int len);
892static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) 869static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
893{ 870{
894 unsigned char *tmp = skb_tail_pointer(skb); 871 unsigned char *tmp = skb_tail_pointer(skb);
@@ -898,26 +875,7 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
898 return tmp; 875 return tmp;
899} 876}
900 877
901/** 878extern unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
902 * skb_put - add data to a buffer
903 * @skb: buffer to use
904 * @len: amount of data to add
905 *
906 * This function extends the used data area of the buffer. If this would
907 * exceed the total buffer size the kernel will panic. A pointer to the
908 * first byte of the extra data is returned.
909 */
910static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
911{
912 unsigned char *tmp = skb_tail_pointer(skb);
913 SKB_LINEAR_ASSERT(skb);
914 skb->tail += len;
915 skb->len += len;
916 if (unlikely(skb->tail > skb->end))
917 skb_over_panic(skb, len, current_text_addr());
918 return tmp;
919}
920
921static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) 879static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
922{ 880{
923 skb->data -= len; 881 skb->data -= len;
@@ -925,24 +883,7 @@ static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
925 return skb->data; 883 return skb->data;
926} 884}
927 885
928/** 886extern unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
929 * skb_push - add data to the start of a buffer
930 * @skb: buffer to use
931 * @len: amount of data to add
932 *
933 * This function extends the used data area of the buffer at the buffer
934 * start. If this would exceed the total buffer headroom the kernel will
935 * panic. A pointer to the first byte of the extra data is returned.
936 */
937static inline unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
938{
939 skb->data -= len;
940 skb->len += len;
941 if (unlikely(skb->data<skb->head))
942 skb_under_panic(skb, len, current_text_addr());
943 return skb->data;
944}
945
946static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) 887static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
947{ 888{
948 skb->len -= len; 889 skb->len -= len;
@@ -950,21 +891,6 @@ static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
950 return skb->data += len; 891 return skb->data += len;
951} 892}
952 893
953/**
954 * skb_pull - remove data from the start of a buffer
955 * @skb: buffer to use
956 * @len: amount of data to remove
957 *
958 * This function removes data from the start of a buffer, returning
959 * the memory to the headroom. A pointer to the next data in the buffer
960 * is returned. Once the data has been pulled future pushes will overwrite
961 * the old data.
962 */
963static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
964{
965 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
966}
967
968extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); 894extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
969 895
970static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) 896static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
@@ -1205,21 +1131,7 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
1205 skb_set_tail_pointer(skb, len); 1131 skb_set_tail_pointer(skb, len);
1206} 1132}
1207 1133
1208/** 1134extern void skb_trim(struct sk_buff *skb, unsigned int len);
1209 * skb_trim - remove end from a buffer
1210 * @skb: buffer to alter
1211 * @len: new length
1212 *
1213 * Cut the length of a buffer down by removing data from the tail. If
1214 * the buffer is already under the length specified it is not modified.
1215 * The skb must be linear.
1216 */
1217static inline void skb_trim(struct sk_buff *skb, unsigned int len)
1218{
1219 if (skb->len > len)
1220 __skb_trim(skb, len);
1221}
1222
1223 1135
1224static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) 1136static inline int __pskb_trim(struct sk_buff *skb, unsigned int len)
1225{ 1137{
@@ -1302,22 +1214,7 @@ static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1302 return skb; 1214 return skb;
1303} 1215}
1304 1216
1305/** 1217extern struct sk_buff *dev_alloc_skb(unsigned int length);
1306 * dev_alloc_skb - allocate an skbuff for receiving
1307 * @length: length to allocate
1308 *
1309 * Allocate a new &sk_buff and assign it a usage count of one. The
1310 * buffer has unspecified headroom built in. Users should allocate
1311 * the headroom they think they need without accounting for the
1312 * built in space. The built in space is used for optimisations.
1313 *
1314 * %NULL is returned if there is no free memory. Although this function
1315 * allocates memory it can be called from an interrupt.
1316 */
1317static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1318{
1319 return __dev_alloc_skb(length, GFP_ATOMIC);
1320}
1321 1218
1322extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 1219extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1323 unsigned int length, gfp_t gfp_mask); 1220 unsigned int length, gfp_t gfp_mask);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index f62caaad94e0..805ed4b92f9a 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -9,8 +9,6 @@
9#ifndef _LINUX_SLAB_H 9#ifndef _LINUX_SLAB_H
10#define _LINUX_SLAB_H 10#define _LINUX_SLAB_H
11 11
12#ifdef __KERNEL__
13
14#include <linux/gfp.h> 12#include <linux/gfp.h>
15#include <linux/types.h> 13#include <linux/types.h>
16 14
@@ -29,6 +27,13 @@
29#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ 27#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */
30#define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ 28#define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */
31 29
30/* Flag to prevent checks on free */
31#ifdef CONFIG_DEBUG_OBJECTS
32# define SLAB_DEBUG_OBJECTS 0x00400000UL
33#else
34# define SLAB_DEBUG_OBJECTS 0x00000000UL
35#endif
36
32/* The following flags affect the page allocator grouping pages by mobility */ 37/* The following flags affect the page allocator grouping pages by mobility */
33#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ 38#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */
34#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ 39#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */
@@ -276,5 +281,4 @@ extern const struct seq_operations slabinfo_op;
276ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); 281ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
277#endif 282#endif
278 283
279#endif /* __KERNEL__ */
280#endif /* _LINUX_SLAB_H */ 284#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index b00c1c73eb0a..71e43a12ebbb 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -29,6 +29,7 @@ enum stat_item {
29 DEACTIVATE_TO_HEAD, /* Cpu slab was moved to the head of partials */ 29 DEACTIVATE_TO_HEAD, /* Cpu slab was moved to the head of partials */
30 DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */ 30 DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */
31 DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */ 31 DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */
32 ORDER_FALLBACK, /* Number of times fallback was necessary */
32 NR_SLUB_STAT_ITEMS }; 33 NR_SLUB_STAT_ITEMS };
33 34
34struct kmem_cache_cpu { 35struct kmem_cache_cpu {
@@ -45,14 +46,24 @@ struct kmem_cache_cpu {
45struct kmem_cache_node { 46struct kmem_cache_node {
46 spinlock_t list_lock; /* Protect partial list and nr_partial */ 47 spinlock_t list_lock; /* Protect partial list and nr_partial */
47 unsigned long nr_partial; 48 unsigned long nr_partial;
48 atomic_long_t nr_slabs;
49 struct list_head partial; 49 struct list_head partial;
50#ifdef CONFIG_SLUB_DEBUG 50#ifdef CONFIG_SLUB_DEBUG
51 atomic_long_t nr_slabs;
52 atomic_long_t total_objects;
51 struct list_head full; 53 struct list_head full;
52#endif 54#endif
53}; 55};
54 56
55/* 57/*
58 * Word size structure that can be atomically updated or read and that
59 * contains both the order and the number of objects that a slab of the
60 * given order would contain.
61 */
62struct kmem_cache_order_objects {
63 unsigned long x;
64};
65
66/*
56 * Slab cache management. 67 * Slab cache management.
57 */ 68 */
58struct kmem_cache { 69struct kmem_cache {
@@ -61,7 +72,7 @@ struct kmem_cache {
61 int size; /* The size of an object including meta data */ 72 int size; /* The size of an object including meta data */
62 int objsize; /* The size of an object without meta data */ 73 int objsize; /* The size of an object without meta data */
63 int offset; /* Free pointer offset. */ 74 int offset; /* Free pointer offset. */
64 int order; /* Current preferred allocation order */ 75 struct kmem_cache_order_objects oo;
65 76
66 /* 77 /*
67 * Avoid an extra cache line for UP, SMP and for the node local to 78 * Avoid an extra cache line for UP, SMP and for the node local to
@@ -70,7 +81,8 @@ struct kmem_cache {
70 struct kmem_cache_node local_node; 81 struct kmem_cache_node local_node;
71 82
72 /* Allocation and freeing of slabs */ 83 /* Allocation and freeing of slabs */
73 int objects; /* Number of objects in slab */ 84 struct kmem_cache_order_objects max;
85 struct kmem_cache_order_objects min;
74 gfp_t allocflags; /* gfp flags to use on each alloc */ 86 gfp_t allocflags; /* gfp flags to use on each alloc */
75 int refcount; /* Refcount for slab cache destroy */ 87 int refcount; /* Refcount for slab cache destroy */
76 void (*ctor)(struct kmem_cache *, void *); 88 void (*ctor)(struct kmem_cache *, void *);
diff --git a/include/linux/smb.h b/include/linux/smb.h
index f098dff93f6b..caa43b2370cb 100644
--- a/include/linux/smb.h
+++ b/include/linux/smb.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/magic.h> 13#include <linux/magic.h>
14#include <linux/time.h>
14 15
15enum smb_protocol { 16enum smb_protocol {
16 SMB_PROTOCOL_NONE, 17 SMB_PROTOCOL_NONE,
diff --git a/include/linux/smb_fs_i.h b/include/linux/smb_fs_i.h
index 8516954a5141..8ccf4eca2c3d 100644
--- a/include/linux/smb_fs_i.h
+++ b/include/linux/smb_fs_i.h
@@ -9,7 +9,6 @@
9#ifndef _LINUX_SMB_FS_I 9#ifndef _LINUX_SMB_FS_I
10#define _LINUX_SMB_FS_I 10#define _LINUX_SMB_FS_I
11 11
12#ifdef __KERNEL__
13#include <linux/types.h> 12#include <linux/types.h>
14#include <linux/fs.h> 13#include <linux/fs.h>
15 14
@@ -36,4 +35,3 @@ struct smb_inode_info {
36}; 35};
37 36
38#endif 37#endif
39#endif
diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h
index 3aa97aa4277f..8a060a7040d8 100644
--- a/include/linux/smb_fs_sb.h
+++ b/include/linux/smb_fs_sb.h
@@ -9,8 +9,6 @@
9#ifndef _SMB_FS_SB 9#ifndef _SMB_FS_SB
10#define _SMB_FS_SB 10#define _SMB_FS_SB
11 11
12#ifdef __KERNEL__
13
14#include <linux/types.h> 12#include <linux/types.h>
15#include <linux/smb.h> 13#include <linux/smb.h>
16 14
@@ -96,6 +94,4 @@ smb_unlock_server(struct smb_sb_info *server)
96 up(&(server->sem)); 94 up(&(server->sem));
97} 95}
98 96
99#endif /* __KERNEL__ */
100
101#endif 97#endif
diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h
new file mode 100644
index 000000000000..8e0556b8781c
--- /dev/null
+++ b/include/linux/smc91x.h
@@ -0,0 +1,13 @@
1#ifndef __SMC91X_H__
2#define __SMC91X_H__
3
4#define SMC91X_USE_8BIT (1 << 0)
5#define SMC91X_USE_16BIT (1 << 1)
6#define SMC91X_USE_32BIT (1 << 2)
7
8struct smc91x_platdata {
9 unsigned long flags;
10 unsigned long irq_flags; /* IRQF_... */
11};
12
13#endif /* __SMC91X_H__ */
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index 334d31411629..daf744017a31 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -14,7 +14,8 @@ enum ads7846_filter {
14struct ads7846_platform_data { 14struct ads7846_platform_data {
15 u16 model; /* 7843, 7845, 7846. */ 15 u16 model; /* 7843, 7845, 7846. */
16 u16 vref_delay_usecs; /* 0 for external vref; etc */ 16 u16 vref_delay_usecs; /* 0 for external vref; etc */
17 int keep_vref_on:1; /* set to keep vref on for differential 17 u16 vref_mv; /* external vref value, milliVolts */
18 bool keep_vref_on; /* set to keep vref on for differential
18 * measurements as well */ 19 * measurements as well */
19 20
20 /* Settling time of the analog signals; a function of Vcc and the 21 /* Settling time of the analog signals; a function of Vcc and the
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 1129ee0a7180..d311a090fae7 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -296,43 +296,6 @@ do { \
296}) 296})
297 297
298/* 298/*
299 * Locks two spinlocks l1 and l2.
300 * l1_first indicates if spinlock l1 should be taken first.
301 */
302static inline void double_spin_lock(spinlock_t *l1, spinlock_t *l2,
303 bool l1_first)
304 __acquires(l1)
305 __acquires(l2)
306{
307 if (l1_first) {
308 spin_lock(l1);
309 spin_lock(l2);
310 } else {
311 spin_lock(l2);
312 spin_lock(l1);
313 }
314}
315
316/*
317 * Unlocks two spinlocks l1 and l2.
318 * l1_taken_first indicates if spinlock l1 was taken first and therefore
319 * should be released after spinlock l2.
320 */
321static inline void double_spin_unlock(spinlock_t *l1, spinlock_t *l2,
322 bool l1_taken_first)
323 __releases(l1)
324 __releases(l2)
325{
326 if (l1_taken_first) {
327 spin_unlock(l2);
328 spin_unlock(l1);
329 } else {
330 spin_unlock(l1);
331 spin_unlock(l2);
332 }
333}
334
335/*
336 * Pull the atomic_t declaration: 299 * Pull the atomic_t declaration:
337 * (asm-mips/atomic.h needs above definitions) 300 * (asm-mips/atomic.h needs above definitions)
338 */ 301 */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index db53defde5ee..50dfd0dc4093 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -72,10 +72,18 @@ struct ssb_device;
72/* Lowlevel read/write operations on the device MMIO. 72/* Lowlevel read/write operations on the device MMIO.
73 * Internal, don't use that outside of ssb. */ 73 * Internal, don't use that outside of ssb. */
74struct ssb_bus_ops { 74struct ssb_bus_ops {
75 u8 (*read8)(struct ssb_device *dev, u16 offset);
75 u16 (*read16)(struct ssb_device *dev, u16 offset); 76 u16 (*read16)(struct ssb_device *dev, u16 offset);
76 u32 (*read32)(struct ssb_device *dev, u16 offset); 77 u32 (*read32)(struct ssb_device *dev, u16 offset);
78 void (*write8)(struct ssb_device *dev, u16 offset, u8 value);
77 void (*write16)(struct ssb_device *dev, u16 offset, u16 value); 79 void (*write16)(struct ssb_device *dev, u16 offset, u16 value);
78 void (*write32)(struct ssb_device *dev, u16 offset, u32 value); 80 void (*write32)(struct ssb_device *dev, u16 offset, u32 value);
81#ifdef CONFIG_SSB_BLOCKIO
82 void (*block_read)(struct ssb_device *dev, void *buffer,
83 size_t count, u16 offset, u8 reg_width);
84 void (*block_write)(struct ssb_device *dev, const void *buffer,
85 size_t count, u16 offset, u8 reg_width);
86#endif
79}; 87};
80 88
81 89
@@ -247,9 +255,9 @@ struct ssb_bus {
247 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ 255 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */
248 struct pcmcia_device *host_pcmcia; 256 struct pcmcia_device *host_pcmcia;
249 257
250#ifdef CONFIG_SSB_PCIHOST 258#ifdef CONFIG_SSB_SPROM
251 /* Mutex to protect the SPROM writing. */ 259 /* Mutex to protect the SPROM writing. */
252 struct mutex pci_sprom_mutex; 260 struct mutex sprom_mutex;
253#endif 261#endif
254 262
255 /* ID information about the Chip. */ 263 /* ID information about the Chip. */
@@ -262,9 +270,6 @@ struct ssb_bus {
262 struct ssb_device devices[SSB_MAX_NR_CORES]; 270 struct ssb_device devices[SSB_MAX_NR_CORES];
263 u8 nr_devices; 271 u8 nr_devices;
264 272
265 /* Reference count. Number of suspended devices. */
266 u8 suspend_cnt;
267
268 /* Software ID number for this bus. */ 273 /* Software ID number for this bus. */
269 unsigned int busnumber; 274 unsigned int busnumber;
270 275
@@ -336,6 +341,13 @@ extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
336 341
337extern void ssb_bus_unregister(struct ssb_bus *bus); 342extern void ssb_bus_unregister(struct ssb_bus *bus);
338 343
344/* Suspend a SSB bus.
345 * Call this from the parent bus suspend routine. */
346extern int ssb_bus_suspend(struct ssb_bus *bus);
347/* Resume a SSB bus.
348 * Call this from the parent bus resume routine. */
349extern int ssb_bus_resume(struct ssb_bus *bus);
350
339extern u32 ssb_clockspeed(struct ssb_bus *bus); 351extern u32 ssb_clockspeed(struct ssb_bus *bus);
340 352
341/* Is the device enabled in hardware? */ 353/* Is the device enabled in hardware? */
@@ -348,6 +360,10 @@ void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags);
348 360
349 361
350/* Device MMIO register read/write functions. */ 362/* Device MMIO register read/write functions. */
363static inline u8 ssb_read8(struct ssb_device *dev, u16 offset)
364{
365 return dev->ops->read8(dev, offset);
366}
351static inline u16 ssb_read16(struct ssb_device *dev, u16 offset) 367static inline u16 ssb_read16(struct ssb_device *dev, u16 offset)
352{ 368{
353 return dev->ops->read16(dev, offset); 369 return dev->ops->read16(dev, offset);
@@ -356,6 +372,10 @@ static inline u32 ssb_read32(struct ssb_device *dev, u16 offset)
356{ 372{
357 return dev->ops->read32(dev, offset); 373 return dev->ops->read32(dev, offset);
358} 374}
375static inline void ssb_write8(struct ssb_device *dev, u16 offset, u8 value)
376{
377 dev->ops->write8(dev, offset, value);
378}
359static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value) 379static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value)
360{ 380{
361 dev->ops->write16(dev, offset, value); 381 dev->ops->write16(dev, offset, value);
@@ -364,6 +384,19 @@ static inline void ssb_write32(struct ssb_device *dev, u16 offset, u32 value)
364{ 384{
365 dev->ops->write32(dev, offset, value); 385 dev->ops->write32(dev, offset, value);
366} 386}
387#ifdef CONFIG_SSB_BLOCKIO
388static inline void ssb_block_read(struct ssb_device *dev, void *buffer,
389 size_t count, u16 offset, u8 reg_width)
390{
391 dev->ops->block_read(dev, buffer, count, offset, reg_width);
392}
393
394static inline void ssb_block_write(struct ssb_device *dev, const void *buffer,
395 size_t count, u16 offset, u8 reg_width)
396{
397 dev->ops->block_write(dev, buffer, count, offset, reg_width);
398}
399#endif /* CONFIG_SSB_BLOCKIO */
367 400
368 401
369/* Translation (routing) bits that need to be ORed to DMA 402/* Translation (routing) bits that need to be ORed to DMA
@@ -416,5 +449,12 @@ extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl);
416extern u32 ssb_admatch_base(u32 adm); 449extern u32 ssb_admatch_base(u32 adm);
417extern u32 ssb_admatch_size(u32 adm); 450extern u32 ssb_admatch_size(u32 adm);
418 451
452/* PCI device mapping and fixup routines.
453 * Called from the architecture pcibios init code.
454 * These are only available on SSB_EMBEDDED configurations. */
455#ifdef CONFIG_SSB_EMBEDDED
456int ssb_pcibios_plat_dev_init(struct pci_dev *dev);
457int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
458#endif /* CONFIG_SSB_EMBEDDED */
419 459
420#endif /* LINUX_SSB_H_ */ 460#endif /* LINUX_SSB_H_ */
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 536851b946f6..7d7e03dcf77c 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -367,8 +367,7 @@ static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
367 367
368extern void ssb_chipcommon_init(struct ssb_chipcommon *cc); 368extern void ssb_chipcommon_init(struct ssb_chipcommon *cc);
369 369
370#include <linux/pm.h> 370extern void ssb_chipco_suspend(struct ssb_chipcommon *cc);
371extern void ssb_chipco_suspend(struct ssb_chipcommon *cc, pm_message_t state);
372extern void ssb_chipco_resume(struct ssb_chipcommon *cc); 371extern void ssb_chipco_resume(struct ssb_chipcommon *cc);
373 372
374extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc, 373extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc,
@@ -390,6 +389,10 @@ extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
390extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, 389extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc,
391 u32 ticks); 390 u32 ticks);
392 391
392void ssb_chipco_irq_mask(struct ssb_chipcommon *cc, u32 mask, u32 value);
393
394u32 ssb_chipco_irq_status(struct ssb_chipcommon *cc, u32 mask);
395
393/* Chipcommon GPIO pin access. */ 396/* Chipcommon GPIO pin access. */
394u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask); 397u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
395u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value); 398u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
new file mode 100644
index 000000000000..01fbdf5fef22
--- /dev/null
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -0,0 +1,174 @@
1#ifndef LINUX_SSB_DRIVER_GIGE_H_
2#define LINUX_SSB_DRIVER_GIGE_H_
3
4#include <linux/ssb/ssb.h>
5#include <linux/pci.h>
6#include <linux/spinlock.h>
7
8
9#ifdef CONFIG_SSB_DRIVER_GIGE
10
11
12#define SSB_GIGE_PCIIO 0x0000 /* PCI I/O Registers (1024 bytes) */
13#define SSB_GIGE_RESERVED 0x0400 /* Reserved (1024 bytes) */
14#define SSB_GIGE_PCICFG 0x0800 /* PCI config space (256 bytes) */
15#define SSB_GIGE_SHIM_FLUSHSTAT 0x0C00 /* PCI to OCP: Flush status control (32bit) */
16#define SSB_GIGE_SHIM_FLUSHRDA 0x0C04 /* PCI to OCP: Flush read address (32bit) */
17#define SSB_GIGE_SHIM_FLUSHTO 0x0C08 /* PCI to OCP: Flush timeout counter (32bit) */
18#define SSB_GIGE_SHIM_BARRIER 0x0C0C /* PCI to OCP: Barrier register (32bit) */
19#define SSB_GIGE_SHIM_MAOCPSI 0x0C10 /* PCI to OCP: MaocpSI Control (32bit) */
20#define SSB_GIGE_SHIM_SIOCPMA 0x0C14 /* PCI to OCP: SiocpMa Control (32bit) */
21
22/* TM Status High flags */
23#define SSB_GIGE_TMSHIGH_RGMII 0x00010000 /* Have an RGMII PHY-bus */
24/* TM Status Low flags */
25#define SSB_GIGE_TMSLOW_TXBYPASS 0x00080000 /* TX bypass (no delay) */
26#define SSB_GIGE_TMSLOW_RXBYPASS 0x00100000 /* RX bypass (no delay) */
27#define SSB_GIGE_TMSLOW_DLLEN 0x01000000 /* Enable DLL controls */
28
29/* Boardflags (low) */
30#define SSB_GIGE_BFL_ROBOSWITCH 0x0010
31
32
33#define SSB_GIGE_MEM_RES_NAME "SSB Broadcom 47xx GigE memory"
34#define SSB_GIGE_IO_RES_NAME "SSB Broadcom 47xx GigE I/O"
35
36struct ssb_gige {
37 struct ssb_device *dev;
38
39 spinlock_t lock;
40
41 /* True, if the device has an RGMII bus.
42 * False, if the device has a GMII bus. */
43 bool has_rgmii;
44
45 /* The PCI controller device. */
46 struct pci_controller pci_controller;
47 struct pci_ops pci_ops;
48 struct resource mem_resource;
49 struct resource io_resource;
50};
51
52/* Check whether a PCI device is a SSB Gigabit Ethernet core. */
53extern bool pdev_is_ssb_gige_core(struct pci_dev *pdev);
54
55/* Convert a pci_dev pointer to a ssb_gige pointer. */
56static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev)
57{
58 if (!pdev_is_ssb_gige_core(pdev))
59 return NULL;
60 return container_of(pdev->bus->ops, struct ssb_gige, pci_ops);
61}
62
63/* Returns whether the PHY is connected by an RGMII bus. */
64static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev)
65{
66 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
67 return (dev ? dev->has_rgmii : 0);
68}
69
70/* Returns whether we have a Roboswitch. */
71static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev)
72{
73 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
74 if (dev)
75 return !!(dev->dev->bus->sprom.boardflags_lo &
76 SSB_GIGE_BFL_ROBOSWITCH);
77 return 0;
78}
79
80/* Returns whether we can only do one DMA at once. */
81static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev)
82{
83 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
84 if (dev)
85 return ((dev->dev->bus->chip_id == 0x4785) &&
86 (dev->dev->bus->chip_rev < 2));
87 return 0;
88}
89
90/* Returns whether we must flush posted writes. */
91static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
92{
93 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
94 if (dev)
95 return (dev->dev->bus->chip_id == 0x4785);
96 return 0;
97}
98
99extern char * nvram_get(const char *name);
100/* Get the device MAC address */
101static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
102{
103#ifdef CONFIG_BCM947XX
104 char *res = nvram_get("et0macaddr");
105 if (res)
106 memcpy(macaddr, res, 6);
107#endif
108}
109
110extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
111 struct pci_dev *pdev);
112extern int ssb_gige_map_irq(struct ssb_device *sdev,
113 const struct pci_dev *pdev);
114
115/* The GigE driver is not a standalone module, because we don't have support
116 * for unregistering the driver. So we could not unload the module anyway. */
117extern int ssb_gige_init(void);
118static inline void ssb_gige_exit(void)
119{
120 /* Currently we can not unregister the GigE driver,
121 * because we can not unregister the PCI bridge. */
122 BUG();
123}
124
125
126#else /* CONFIG_SSB_DRIVER_GIGE */
127/* Gigabit Ethernet driver disabled */
128
129
130static inline int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
131 struct pci_dev *pdev)
132{
133 return -ENOSYS;
134}
135static inline int ssb_gige_map_irq(struct ssb_device *sdev,
136 const struct pci_dev *pdev)
137{
138 return -ENOSYS;
139}
140static inline int ssb_gige_init(void)
141{
142 return 0;
143}
144static inline void ssb_gige_exit(void)
145{
146}
147
148static inline bool pdev_is_ssb_gige_core(struct pci_dev *pdev)
149{
150 return 0;
151}
152static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev)
153{
154 return NULL;
155}
156static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev)
157{
158 return 0;
159}
160static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev)
161{
162 return 0;
163}
164static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev)
165{
166 return 0;
167}
168static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
169{
170 return 0;
171}
172
173#endif /* CONFIG_SSB_DRIVER_GIGE */
174#endif /* LINUX_SSB_DRIVER_GIGE_H_ */
diff --git a/include/linux/ssb/ssb_driver_pci.h b/include/linux/ssb/ssb_driver_pci.h
index 5e25bac4ed31..41e330e51c2a 100644
--- a/include/linux/ssb/ssb_driver_pci.h
+++ b/include/linux/ssb/ssb_driver_pci.h
@@ -1,6 +1,11 @@
1#ifndef LINUX_SSB_PCICORE_H_ 1#ifndef LINUX_SSB_PCICORE_H_
2#define LINUX_SSB_PCICORE_H_ 2#define LINUX_SSB_PCICORE_H_
3 3
4#include <linux/types.h>
5
6struct pci_dev;
7
8
4#ifdef CONFIG_SSB_DRIVER_PCICORE 9#ifdef CONFIG_SSB_DRIVER_PCICORE
5 10
6/* PCI core registers. */ 11/* PCI core registers. */
@@ -88,6 +93,9 @@ extern void ssb_pcicore_init(struct ssb_pcicore *pc);
88extern int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc, 93extern int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
89 struct ssb_device *dev); 94 struct ssb_device *dev);
90 95
96int ssb_pcicore_plat_dev_init(struct pci_dev *d);
97int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
98
91 99
92#else /* CONFIG_SSB_DRIVER_PCICORE */ 100#else /* CONFIG_SSB_DRIVER_PCICORE */
93 101
@@ -107,5 +115,16 @@ int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
107 return 0; 115 return 0;
108} 116}
109 117
118static inline
119int ssb_pcicore_plat_dev_init(struct pci_dev *d)
120{
121 return -ENODEV;
122}
123static inline
124int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
125{
126 return -ENODEV;
127}
128
110#endif /* CONFIG_SSB_DRIVER_PCICORE */ 129#endif /* CONFIG_SSB_DRIVER_PCICORE */
111#endif /* LINUX_SSB_PCICORE_H_ */ 130#endif /* LINUX_SSB_PCICORE_H_ */
diff --git a/include/linux/string.h b/include/linux/string.h
index c5d3fcad7b57..efdc44593b52 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -109,5 +109,7 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
109extern char **argv_split(gfp_t gfp, const char *str, int *argcp); 109extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
110extern void argv_free(char **argv); 110extern void argv_free(char **argv);
111 111
112extern bool sysfs_streq(const char *s1, const char *s2);
113
112#endif 114#endif
113#endif /* _LINUX_STRING_H_ */ 115#endif /* _LINUX_STRING_H_ */
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 7a69ca3bebaf..3f632182d8eb 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -26,6 +26,7 @@ struct auth_cred {
26 uid_t uid; 26 uid_t uid;
27 gid_t gid; 27 gid_t gid;
28 struct group_info *group_info; 28 struct group_info *group_info;
29 unsigned char machine_cred : 1;
29}; 30};
30 31
31/* 32/*
@@ -59,8 +60,8 @@ struct rpc_cred {
59/* 60/*
60 * Client authentication handle 61 * Client authentication handle
61 */ 62 */
62#define RPC_CREDCACHE_NR 8 63#define RPC_CREDCACHE_HASHBITS 4
63#define RPC_CREDCACHE_MASK (RPC_CREDCACHE_NR - 1) 64#define RPC_CREDCACHE_NR (1 << RPC_CREDCACHE_HASHBITS)
64struct rpc_cred_cache { 65struct rpc_cred_cache {
65 struct hlist_head hashtable[RPC_CREDCACHE_NR]; 66 struct hlist_head hashtable[RPC_CREDCACHE_NR];
66 spinlock_t lock; 67 spinlock_t lock;
@@ -89,7 +90,6 @@ struct rpc_auth {
89 90
90/* Flags for rpcauth_lookupcred() */ 91/* Flags for rpcauth_lookupcred() */
91#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */ 92#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */
92#define RPCAUTH_LOOKUP_ROOTCREDS 0x02 /* This really ought to go! */
93 93
94/* 94/*
95 * Client authentication ops 95 * Client authentication ops
@@ -97,9 +97,7 @@ struct rpc_auth {
97struct rpc_authops { 97struct rpc_authops {
98 struct module *owner; 98 struct module *owner;
99 rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */ 99 rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */
100#ifdef RPC_DEBUG
101 char * au_name; 100 char * au_name;
102#endif
103 struct rpc_auth * (*create)(struct rpc_clnt *, rpc_authflavor_t); 101 struct rpc_auth * (*create)(struct rpc_clnt *, rpc_authflavor_t);
104 void (*destroy)(struct rpc_auth *); 102 void (*destroy)(struct rpc_auth *);
105 103
@@ -113,6 +111,7 @@ struct rpc_credops {
113 void (*crdestroy)(struct rpc_cred *); 111 void (*crdestroy)(struct rpc_cred *);
114 112
115 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); 113 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
114 void (*crbind)(struct rpc_task *, struct rpc_cred *);
116 __be32 * (*crmarshal)(struct rpc_task *, __be32 *); 115 __be32 * (*crmarshal)(struct rpc_task *, __be32 *);
117 int (*crrefresh)(struct rpc_task *); 116 int (*crrefresh)(struct rpc_task *);
118 __be32 * (*crvalidate)(struct rpc_task *, __be32 *); 117 __be32 * (*crvalidate)(struct rpc_task *, __be32 *);
@@ -126,9 +125,13 @@ extern const struct rpc_authops authunix_ops;
126extern const struct rpc_authops authnull_ops; 125extern const struct rpc_authops authnull_ops;
127 126
128void __init rpc_init_authunix(void); 127void __init rpc_init_authunix(void);
128void __init rpc_init_generic_auth(void);
129void __init rpcauth_init_module(void); 129void __init rpcauth_init_module(void);
130void __exit rpcauth_remove_module(void); 130void __exit rpcauth_remove_module(void);
131void __exit rpc_destroy_generic_auth(void);
131 132
133struct rpc_cred * rpc_lookup_cred(void);
134struct rpc_cred * rpc_lookup_machine_cred(void);
132int rpcauth_register(const struct rpc_authops *); 135int rpcauth_register(const struct rpc_authops *);
133int rpcauth_unregister(const struct rpc_authops *); 136int rpcauth_unregister(const struct rpc_authops *);
134struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); 137struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *);
@@ -136,8 +139,8 @@ void rpcauth_release(struct rpc_auth *);
136struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int); 139struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int);
137void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); 140void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *);
138struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); 141struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int);
139struct rpc_cred * rpcauth_bindcred(struct rpc_task *); 142void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int);
140void rpcauth_holdcred(struct rpc_task *); 143void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *);
141void put_rpccred(struct rpc_cred *); 144void put_rpccred(struct rpc_cred *);
142void rpcauth_unbindcred(struct rpc_task *); 145void rpcauth_unbindcred(struct rpc_task *);
143__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); 146__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index 67658e17a375..fec6899bf355 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -84,6 +84,7 @@ struct gss_cred {
84 enum rpc_gss_svc gc_service; 84 enum rpc_gss_svc gc_service;
85 struct gss_cl_ctx *gc_ctx; 85 struct gss_cl_ctx *gc_ctx;
86 struct gss_upcall_msg *gc_upcall; 86 struct gss_upcall_msg *gc_upcall;
87 unsigned char gc_machine_cred : 1;
87}; 88};
88 89
89#endif /* __KERNEL__ */ 90#endif /* __KERNEL__ */
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 03547d6abee5..2d8b211b9324 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -120,7 +120,6 @@ struct cache_deferred_req {
120 struct list_head hash; /* on hash chain */ 120 struct list_head hash; /* on hash chain */
121 struct list_head recent; /* on fifo */ 121 struct list_head recent; /* on fifo */
122 struct cache_head *item; /* cache item we wait on */ 122 struct cache_head *item; /* cache item we wait on */
123 time_t recv_time;
124 void *owner; /* we might need to discard all defered requests 123 void *owner; /* we might need to discard all defered requests
125 * owned by someone */ 124 * owned by someone */
126 void (*revisit)(struct cache_deferred_req *req, 125 void (*revisit)(struct cache_deferred_req *req,
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 129a86e25d29..6fff7f82ef12 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -127,11 +127,12 @@ int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int);
127void rpcb_getport_async(struct rpc_task *); 127void rpcb_getport_async(struct rpc_task *);
128 128
129void rpc_call_start(struct rpc_task *); 129void rpc_call_start(struct rpc_task *);
130int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 130int rpc_call_async(struct rpc_clnt *clnt,
131 int flags, const struct rpc_call_ops *tk_ops, 131 const struct rpc_message *msg, int flags,
132 const struct rpc_call_ops *tk_ops,
132 void *calldata); 133 void *calldata);
133int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, 134int rpc_call_sync(struct rpc_clnt *clnt,
134 int flags); 135 const struct rpc_message *msg, int flags);
135struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, 136struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
136 int flags); 137 int flags);
137void rpc_restart_call(struct rpc_task *); 138void rpc_restart_call(struct rpc_task *);
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index 5a4b1e0206e3..a10f1fb0bf7c 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -70,8 +70,6 @@ enum seal_alg {
70 SEAL_ALG_DES3KD = 0x0002 70 SEAL_ALG_DES3KD = 0x0002
71}; 71};
72 72
73#define KRB5_CKSUM_LENGTH 8
74
75#define CKSUMTYPE_CRC32 0x0001 73#define CKSUMTYPE_CRC32 0x0001
76#define CKSUMTYPE_RSA_MD4 0x0002 74#define CKSUMTYPE_RSA_MD4 0x0002
77#define CKSUMTYPE_RSA_MD4_DES 0x0003 75#define CKSUMTYPE_RSA_MD4_DES 0x0003
@@ -150,9 +148,9 @@ gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *inbuf,
150s32 148s32
151krb5_make_seq_num(struct crypto_blkcipher *key, 149krb5_make_seq_num(struct crypto_blkcipher *key,
152 int direction, 150 int direction,
153 s32 seqnum, unsigned char *cksum, unsigned char *buf); 151 u32 seqnum, unsigned char *cksum, unsigned char *buf);
154 152
155s32 153s32
156krb5_get_seq_num(struct crypto_blkcipher *key, 154krb5_get_seq_num(struct crypto_blkcipher *key,
157 unsigned char *cksum, 155 unsigned char *cksum,
158 unsigned char *buf, int *direction, s32 * seqnum); 156 unsigned char *buf, int *direction, u32 *seqnum);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index f689f02e6793..d1a5c8c1a0f1 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -11,7 +11,6 @@
11 11
12#include <linux/timer.h> 12#include <linux/timer.h>
13#include <linux/sunrpc/types.h> 13#include <linux/sunrpc/types.h>
14#include <linux/rcupdate.h>
15#include <linux/spinlock.h> 14#include <linux/spinlock.h>
16#include <linux/wait.h> 15#include <linux/wait.h>
17#include <linux/workqueue.h> 16#include <linux/workqueue.h>
@@ -33,7 +32,8 @@ struct rpc_wait_queue;
33struct rpc_wait { 32struct rpc_wait {
34 struct list_head list; /* wait queue links */ 33 struct list_head list; /* wait queue links */
35 struct list_head links; /* Links to related tasks */ 34 struct list_head links; /* Links to related tasks */
36 struct rpc_wait_queue * rpc_waitq; /* RPC wait queue we're on */ 35 struct list_head timer_list; /* Timer list */
36 unsigned long expires;
37}; 37};
38 38
39/* 39/*
@@ -57,33 +57,25 @@ struct rpc_task {
57 __u8 tk_cred_retry; 57 __u8 tk_cred_retry;
58 58
59 /* 59 /*
60 * timeout_fn to be executed by timer bottom half
61 * callback to be executed after waking up 60 * callback to be executed after waking up
62 * action next procedure for async tasks 61 * action next procedure for async tasks
63 * tk_ops caller callbacks 62 * tk_ops caller callbacks
64 */ 63 */
65 void (*tk_timeout_fn)(struct rpc_task *);
66 void (*tk_callback)(struct rpc_task *); 64 void (*tk_callback)(struct rpc_task *);
67 void (*tk_action)(struct rpc_task *); 65 void (*tk_action)(struct rpc_task *);
68 const struct rpc_call_ops *tk_ops; 66 const struct rpc_call_ops *tk_ops;
69 void * tk_calldata; 67 void * tk_calldata;
70 68
71 /*
72 * tk_timer is used for async processing by the RPC scheduling
73 * primitives. You should not access this directly unless
74 * you have a pathological interest in kernel oopses.
75 */
76 struct timer_list tk_timer; /* kernel timer */
77 unsigned long tk_timeout; /* timeout for rpc_sleep() */ 69 unsigned long tk_timeout; /* timeout for rpc_sleep() */
78 unsigned short tk_flags; /* misc flags */ 70 unsigned short tk_flags; /* misc flags */
79 unsigned long tk_runstate; /* Task run status */ 71 unsigned long tk_runstate; /* Task run status */
80 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could 72 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
81 * be any workqueue 73 * be any workqueue
82 */ 74 */
75 struct rpc_wait_queue *tk_waitqueue; /* RPC wait queue we're on */
83 union { 76 union {
84 struct work_struct tk_work; /* Async task work queue */ 77 struct work_struct tk_work; /* Async task work queue */
85 struct rpc_wait tk_wait; /* RPC wait */ 78 struct rpc_wait tk_wait; /* RPC wait */
86 struct rcu_head tk_rcu; /* for task deletion */
87 } u; 79 } u;
88 80
89 unsigned short tk_timeouts; /* maj timeouts */ 81 unsigned short tk_timeouts; /* maj timeouts */
@@ -123,6 +115,7 @@ struct rpc_task_setup {
123 const struct rpc_message *rpc_message; 115 const struct rpc_message *rpc_message;
124 const struct rpc_call_ops *callback_ops; 116 const struct rpc_call_ops *callback_ops;
125 void *callback_data; 117 void *callback_data;
118 struct workqueue_struct *workqueue;
126 unsigned short flags; 119 unsigned short flags;
127 signed char priority; 120 signed char priority;
128}; 121};
@@ -147,9 +140,7 @@ struct rpc_task_setup {
147 140
148#define RPC_TASK_RUNNING 0 141#define RPC_TASK_RUNNING 0
149#define RPC_TASK_QUEUED 1 142#define RPC_TASK_QUEUED 1
150#define RPC_TASK_WAKEUP 2 143#define RPC_TASK_ACTIVE 2
151#define RPC_TASK_HAS_TIMER 3
152#define RPC_TASK_ACTIVE 4
153 144
154#define RPC_IS_RUNNING(t) test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) 145#define RPC_IS_RUNNING(t) test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
155#define rpc_set_running(t) set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) 146#define rpc_set_running(t) set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
@@ -171,15 +162,6 @@ struct rpc_task_setup {
171 smp_mb__after_clear_bit(); \ 162 smp_mb__after_clear_bit(); \
172 } while (0) 163 } while (0)
173 164
174#define rpc_start_wakeup(t) \
175 (test_and_set_bit(RPC_TASK_WAKEUP, &(t)->tk_runstate) == 0)
176#define rpc_finish_wakeup(t) \
177 do { \
178 smp_mb__before_clear_bit(); \
179 clear_bit(RPC_TASK_WAKEUP, &(t)->tk_runstate); \
180 smp_mb__after_clear_bit(); \
181 } while (0)
182
183#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) 165#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)
184 166
185/* 167/*
@@ -192,6 +174,12 @@ struct rpc_task_setup {
192#define RPC_PRIORITY_HIGH (1) 174#define RPC_PRIORITY_HIGH (1)
193#define RPC_NR_PRIORITY (1 + RPC_PRIORITY_HIGH - RPC_PRIORITY_LOW) 175#define RPC_NR_PRIORITY (1 + RPC_PRIORITY_HIGH - RPC_PRIORITY_LOW)
194 176
177struct rpc_timer {
178 struct timer_list timer;
179 struct list_head list;
180 unsigned long expires;
181};
182
195/* 183/*
196 * RPC synchronization objects 184 * RPC synchronization objects
197 */ 185 */
@@ -204,6 +192,7 @@ struct rpc_wait_queue {
204 unsigned char count; /* # task groups remaining serviced so far */ 192 unsigned char count; /* # task groups remaining serviced so far */
205 unsigned char nr; /* # tasks remaining for cookie */ 193 unsigned char nr; /* # tasks remaining for cookie */
206 unsigned short qlen; /* total # tasks waiting in queue */ 194 unsigned short qlen; /* total # tasks waiting in queue */
195 struct rpc_timer timer_list;
207#ifdef RPC_DEBUG 196#ifdef RPC_DEBUG
208 const char * name; 197 const char * name;
209#endif 198#endif
@@ -229,9 +218,11 @@ void rpc_killall_tasks(struct rpc_clnt *);
229void rpc_execute(struct rpc_task *); 218void rpc_execute(struct rpc_task *);
230void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); 219void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
231void rpc_init_wait_queue(struct rpc_wait_queue *, const char *); 220void rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
221void rpc_destroy_wait_queue(struct rpc_wait_queue *);
232void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, 222void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *,
233 rpc_action action, rpc_action timer); 223 rpc_action action);
234void rpc_wake_up_task(struct rpc_task *); 224void rpc_wake_up_queued_task(struct rpc_wait_queue *,
225 struct rpc_task *);
235void rpc_wake_up(struct rpc_wait_queue *); 226void rpc_wake_up(struct rpc_wait_queue *);
236struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); 227struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
237void rpc_wake_up_status(struct rpc_wait_queue *, int); 228void rpc_wake_up_status(struct rpc_wait_queue *, int);
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 64c97552964a..4b54c5fdcfd9 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -386,7 +386,6 @@ struct svc_serv * svc_create(struct svc_program *, unsigned int,
386 void (*shutdown)(struct svc_serv*)); 386 void (*shutdown)(struct svc_serv*));
387struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, 387struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
388 struct svc_pool *pool); 388 struct svc_pool *pool);
389int svc_create_thread(svc_thread_fn, struct svc_serv *);
390void svc_exit_thread(struct svc_rqst *); 389void svc_exit_thread(struct svc_rqst *);
391struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 390struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
392 void (*shutdown)(struct svc_serv*), 391 void (*shutdown)(struct svc_serv*),
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index 22e1ef8e200e..d39dbdc7b10f 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -24,6 +24,7 @@ struct svc_cred {
24}; 24};
25 25
26struct svc_rqst; /* forward decl */ 26struct svc_rqst; /* forward decl */
27struct in6_addr;
27 28
28/* Authentication is done in the context of a domain. 29/* Authentication is done in the context of a domain.
29 * 30 *
@@ -120,10 +121,10 @@ extern void svc_auth_unregister(rpc_authflavor_t flavor);
120 121
121extern struct auth_domain *unix_domain_find(char *name); 122extern struct auth_domain *unix_domain_find(char *name);
122extern void auth_domain_put(struct auth_domain *item); 123extern void auth_domain_put(struct auth_domain *item);
123extern int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom); 124extern int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom);
124extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new); 125extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new);
125extern struct auth_domain *auth_domain_find(char *name); 126extern struct auth_domain *auth_domain_find(char *name);
126extern struct auth_domain *auth_unix_lookup(struct in_addr addr); 127extern struct auth_domain *auth_unix_lookup(struct in6_addr *addr);
127extern int auth_unix_forget_old(struct auth_domain *dom); 128extern int auth_unix_forget_old(struct auth_domain *dom);
128extern void svcauth_unix_purge(void); 129extern void svcauth_unix_purge(void);
129extern void svcauth_unix_info_release(void *); 130extern void svcauth_unix_info_release(void *);
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 206f092ad4c7..8cff696dedf5 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -26,8 +26,8 @@ struct svc_sock {
26 void (*sk_owspace)(struct sock *); 26 void (*sk_owspace)(struct sock *);
27 27
28 /* private TCP part */ 28 /* private TCP part */
29 int sk_reclen; /* length of record */ 29 u32 sk_reclen; /* length of record */
30 int sk_tcplen; /* current read length */ 30 u32 sk_tcplen; /* current read length */
31}; 31};
32 32
33/* 33/*
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index b3ff9a815e6f..4d80a118d538 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -86,6 +86,10 @@ struct rpc_rqst {
86 unsigned long rq_majortimeo; /* major timeout alarm */ 86 unsigned long rq_majortimeo; /* major timeout alarm */
87 unsigned long rq_timeout; /* Current timeout value */ 87 unsigned long rq_timeout; /* Current timeout value */
88 unsigned int rq_retries; /* # of retries */ 88 unsigned int rq_retries; /* # of retries */
89 unsigned int rq_connect_cookie;
90 /* A cookie used to track the
91 state of the transport
92 connection */
89 93
90 /* 94 /*
91 * Partial send handling 95 * Partial send handling
@@ -152,6 +156,9 @@ struct rpc_xprt {
152 unsigned long connect_timeout, 156 unsigned long connect_timeout,
153 bind_timeout, 157 bind_timeout,
154 reestablish_timeout; 158 reestablish_timeout;
159 unsigned int connect_cookie; /* A cookie that gets bumped
160 every time the transport
161 is reconnected */
155 162
156 /* 163 /*
157 * Disconnection of idle transports 164 * Disconnection of idle transports
@@ -232,7 +239,7 @@ int xprt_unregister_transport(struct xprt_class *type);
232void xprt_set_retrans_timeout_def(struct rpc_task *task); 239void xprt_set_retrans_timeout_def(struct rpc_task *task);
233void xprt_set_retrans_timeout_rtt(struct rpc_task *task); 240void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
234void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); 241void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
235void xprt_wait_for_buffer_space(struct rpc_task *task); 242void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action);
236void xprt_write_space(struct rpc_xprt *xprt); 243void xprt_write_space(struct rpc_xprt *xprt);
237void xprt_update_rtt(struct rpc_task *task); 244void xprt_update_rtt(struct rpc_task *task);
238void xprt_adjust_cwnd(struct rpc_task *task, int result); 245void xprt_adjust_cwnd(struct rpc_task *task, int result);
@@ -241,6 +248,7 @@ void xprt_complete_rqst(struct rpc_task *task, int copied);
241void xprt_release_rqst_cong(struct rpc_task *task); 248void xprt_release_rqst_cong(struct rpc_task *task);
242void xprt_disconnect_done(struct rpc_xprt *xprt); 249void xprt_disconnect_done(struct rpc_xprt *xprt);
243void xprt_force_disconnect(struct rpc_xprt *xprt); 250void xprt_force_disconnect(struct rpc_xprt *xprt);
251void xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie);
244 252
245/* 253/*
246 * Reserved bit positions in xprt->state 254 * Reserved bit positions in xprt->state
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 1d7d4c5797ee..a6977423baf7 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -12,11 +12,22 @@
12#include <asm/errno.h> 12#include <asm/errno.h>
13 13
14#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) 14#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
15extern void pm_set_vt_switch(int);
15extern int pm_prepare_console(void); 16extern int pm_prepare_console(void);
16extern void pm_restore_console(void); 17extern void pm_restore_console(void);
17#else 18#else
18static inline int pm_prepare_console(void) { return 0; } 19static inline void pm_set_vt_switch(int do_switch)
19static inline void pm_restore_console(void) {} 20{
21}
22
23static inline int pm_prepare_console(void)
24{
25 return 0;
26}
27
28static inline void pm_restore_console(void)
29{
30}
20#endif 31#endif
21 32
22typedef int __bitwise suspend_state_t; 33typedef int __bitwise suspend_state_t;
diff --git a/include/linux/svga.h b/include/linux/svga.h
index 13ad0b82ac28..c59a51a2b0e7 100644
--- a/include/linux/svga.h
+++ b/include/linux/svga.h
@@ -1,8 +1,6 @@
1#ifndef _LINUX_SVGA_H 1#ifndef _LINUX_SVGA_H
2#define _LINUX_SVGA_H 2#define _LINUX_SVGA_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/pci.h> 4#include <linux/pci.h>
7#include <video/vga.h> 5#include <video/vga.h>
8 6
@@ -122,6 +120,5 @@ void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninf
122 120
123int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix); 121int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix);
124 122
125#endif /* __KERNEL__ */
126#endif /* _LINUX_SVGA_H */ 123#endif /* _LINUX_SVGA_H */
127 124
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 878459ae0454..0b3377650c85 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -177,11 +177,11 @@ extern void activate_page(struct page *);
177extern void mark_page_accessed(struct page *); 177extern void mark_page_accessed(struct page *);
178extern void lru_add_drain(void); 178extern void lru_add_drain(void);
179extern int lru_add_drain_all(void); 179extern int lru_add_drain_all(void);
180extern int rotate_reclaimable_page(struct page *page); 180extern void rotate_reclaimable_page(struct page *page);
181extern void swap_setup(void); 181extern void swap_setup(void);
182 182
183/* linux/mm/vmscan.c */ 183/* linux/mm/vmscan.c */
184extern unsigned long try_to_free_pages(struct zone **zones, int order, 184extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
185 gfp_t gfp_mask); 185 gfp_t gfp_mask);
186extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 186extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
187 gfp_t gfp_mask); 187 gfp_t gfp_mask);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 5562fbf72095..45f6bc82d317 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -13,10 +13,6 @@
13#define _SYNCLINK_H_ 13#define _SYNCLINK_H_
14#define SYNCLINK_H_VERSION 3.6 14#define SYNCLINK_H_VERSION 3.6
15 15
16#define BOOLEAN int
17#define TRUE 1
18#define FALSE 0
19
20#define BIT0 0x0001 16#define BIT0 0x0001
21#define BIT1 0x0002 17#define BIT1 0x0002
22#define BIT2 0x0004 18#define BIT2 0x0004
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 4c2577bd1c85..0522f368f9d7 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -60,7 +60,6 @@ struct getcpu_cache;
60#include <linux/capability.h> 60#include <linux/capability.h>
61#include <linux/list.h> 61#include <linux/list.h>
62#include <linux/sem.h> 62#include <linux/sem.h>
63#include <asm/semaphore.h>
64#include <asm/siginfo.h> 63#include <asm/siginfo.h>
65#include <asm/signal.h> 64#include <asm/signal.h>
66#include <linux/quota.h> 65#include <linux/quota.h>
@@ -241,26 +240,28 @@ asmlinkage long sys_truncate64(const char __user *path, loff_t length);
241asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length); 240asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
242#endif 241#endif
243 242
244asmlinkage long sys_setxattr(char __user *path, char __user *name, 243asmlinkage long sys_setxattr(const char __user *path, const char __user *name,
245 void __user *value, size_t size, int flags); 244 const void __user *value, size_t size, int flags);
246asmlinkage long sys_lsetxattr(char __user *path, char __user *name, 245asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name,
247 void __user *value, size_t size, int flags); 246 const void __user *value, size_t size, int flags);
248asmlinkage long sys_fsetxattr(int fd, char __user *name, void __user *value, 247asmlinkage long sys_fsetxattr(int fd, const char __user *name,
249 size_t size, int flags); 248 const void __user *value, size_t size, int flags);
250asmlinkage ssize_t sys_getxattr(char __user *path, char __user *name, 249asmlinkage ssize_t sys_getxattr(const char __user *path, const char __user *name,
251 void __user *value, size_t size); 250 void __user *value, size_t size);
252asmlinkage ssize_t sys_lgetxattr(char __user *path, char __user *name, 251asmlinkage ssize_t sys_lgetxattr(const char __user *path, const char __user *name,
253 void __user *value, size_t size); 252 void __user *value, size_t size);
254asmlinkage ssize_t sys_fgetxattr(int fd, char __user *name, 253asmlinkage ssize_t sys_fgetxattr(int fd, const char __user *name,
255 void __user *value, size_t size); 254 void __user *value, size_t size);
256asmlinkage ssize_t sys_listxattr(char __user *path, char __user *list, 255asmlinkage ssize_t sys_listxattr(const char __user *path, char __user *list,
257 size_t size); 256 size_t size);
258asmlinkage ssize_t sys_llistxattr(char __user *path, char __user *list, 257asmlinkage ssize_t sys_llistxattr(const char __user *path, char __user *list,
259 size_t size); 258 size_t size);
260asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size); 259asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size);
261asmlinkage long sys_removexattr(char __user *path, char __user *name); 260asmlinkage long sys_removexattr(const char __user *path,
262asmlinkage long sys_lremovexattr(char __user *path, char __user *name); 261 const char __user *name);
263asmlinkage long sys_fremovexattr(int fd, char __user *name); 262asmlinkage long sys_lremovexattr(const char __user *path,
263 const char __user *name);
264asmlinkage long sys_fremovexattr(int fd, const char __user *name);
264 265
265asmlinkage unsigned long sys_brk(unsigned long brk); 266asmlinkage unsigned long sys_brk(unsigned long brk);
266asmlinkage long sys_mprotect(unsigned long start, size_t len, 267asmlinkage long sys_mprotect(unsigned long start, size_t len,
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 571f01d20a86..24141b4d1a11 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -945,11 +945,14 @@ enum
945/* For the /proc/sys support */ 945/* For the /proc/sys support */
946struct ctl_table; 946struct ctl_table;
947struct nsproxy; 947struct nsproxy;
948struct ctl_table_root;
949
948extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); 950extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
949extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, 951extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
950 struct ctl_table_header *prev); 952 struct ctl_table_header *prev);
951extern void sysctl_head_finish(struct ctl_table_header *prev); 953extern void sysctl_head_finish(struct ctl_table_header *prev);
952extern int sysctl_perm(struct ctl_table *table, int op); 954extern int sysctl_perm(struct ctl_table_root *root,
955 struct ctl_table *table, int op);
953 956
954typedef struct ctl_table ctl_table; 957typedef struct ctl_table ctl_table;
955 958
@@ -981,11 +984,6 @@ extern int do_sysctl (int __user *name, int nlen,
981 void __user *oldval, size_t __user *oldlenp, 984 void __user *oldval, size_t __user *oldlenp,
982 void __user *newval, size_t newlen); 985 void __user *newval, size_t newlen);
983 986
984extern int do_sysctl_strategy (struct ctl_table *table,
985 int __user *name, int nlen,
986 void __user *oldval, size_t __user *oldlenp,
987 void __user *newval, size_t newlen);
988
989extern ctl_handler sysctl_data; 987extern ctl_handler sysctl_data;
990extern ctl_handler sysctl_string; 988extern ctl_handler sysctl_string;
991extern ctl_handler sysctl_intvec; 989extern ctl_handler sysctl_intvec;
@@ -1054,6 +1052,8 @@ struct ctl_table_root {
1054 struct list_head header_list; 1052 struct list_head header_list;
1055 struct list_head *(*lookup)(struct ctl_table_root *root, 1053 struct list_head *(*lookup)(struct ctl_table_root *root,
1056 struct nsproxy *namespaces); 1054 struct nsproxy *namespaces);
1055 int (*permissions)(struct ctl_table_root *root,
1056 struct nsproxy *namespaces, struct ctl_table *table);
1057}; 1057};
1058 1058
1059/* struct ctl_table_header is used to maintain dynamic lists of 1059/* struct ctl_table_header is used to maintain dynamic lists of
@@ -1085,8 +1085,6 @@ struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1085void unregister_sysctl_table(struct ctl_table_header * table); 1085void unregister_sysctl_table(struct ctl_table_header * table);
1086int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); 1086int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table);
1087 1087
1088#else /* __KERNEL__ */
1089
1090#endif /* __KERNEL__ */ 1088#endif /* __KERNEL__ */
1091 1089
1092#endif /* _LINUX_SYSCTL_H */ 1090#endif /* _LINUX_SYSCTL_H */
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index f752e73bf977..f2767bc6b735 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -45,12 +45,16 @@ struct sysdev_class_attribute {
45 ssize_t (*store)(struct sysdev_class *, const char *, size_t); 45 ssize_t (*store)(struct sysdev_class *, const char *, size_t);
46}; 46};
47 47
48#define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \ 48#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
49struct sysdev_class_attribute attr_##_name = { \ 49{ \
50 .attr = {.name = __stringify(_name), .mode = _mode }, \ 50 .attr = {.name = __stringify(_name), .mode = _mode }, \
51 .show = _show, \ 51 .show = _show, \
52 .store = _store, \ 52 .store = _store, \
53}; 53}
54
55#define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
56 struct sysdev_class_attribute attr_##_name = \
57 _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store)
54 58
55 59
56extern int sysdev_class_register(struct sysdev_class *); 60extern int sysdev_class_register(struct sysdev_class *);
@@ -100,15 +104,16 @@ struct sysdev_attribute {
100}; 104};
101 105
102 106
103#define _SYSDEV_ATTR(_name,_mode,_show,_store) \ 107#define _SYSDEV_ATTR(_name, _mode, _show, _store) \
104{ \ 108{ \
105 .attr = { .name = __stringify(_name), .mode = _mode }, \ 109 .attr = { .name = __stringify(_name), .mode = _mode }, \
106 .show = _show, \ 110 .show = _show, \
107 .store = _store, \ 111 .store = _store, \
108} 112}
109 113
110#define SYSDEV_ATTR(_name,_mode,_show,_store) \ 114#define SYSDEV_ATTR(_name, _mode, _show, _store) \
111struct sysdev_attribute attr_##_name = _SYSDEV_ATTR(_name,_mode,_show,_store); 115 struct sysdev_attribute attr_##_name = \
116 _SYSDEV_ATTR(_name, _mode, _show, _store);
112 117
113extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); 118extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
114extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); 119extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 802710438a9e..27bad59dae79 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -32,7 +32,7 @@ struct attribute {
32 32
33struct attribute_group { 33struct attribute_group {
34 const char *name; 34 const char *name;
35 int (*is_visible)(struct kobject *, 35 mode_t (*is_visible)(struct kobject *,
36 struct attribute *, int); 36 struct attribute *, int);
37 struct attribute **attrs; 37 struct attribute **attrs;
38}; 38};
@@ -105,6 +105,8 @@ void sysfs_remove_link(struct kobject *kobj, const char *name);
105 105
106int __must_check sysfs_create_group(struct kobject *kobj, 106int __must_check sysfs_create_group(struct kobject *kobj,
107 const struct attribute_group *grp); 107 const struct attribute_group *grp);
108int sysfs_update_group(struct kobject *kobj,
109 const struct attribute_group *grp);
108void sysfs_remove_group(struct kobject *kobj, 110void sysfs_remove_group(struct kobject *kobj,
109 const struct attribute_group *grp); 111 const struct attribute_group *grp);
110int sysfs_add_file_to_group(struct kobject *kobj, 112int sysfs_add_file_to_group(struct kobject *kobj,
@@ -131,7 +133,6 @@ static inline int sysfs_create_dir(struct kobject *kobj)
131 133
132static inline void sysfs_remove_dir(struct kobject *kobj) 134static inline void sysfs_remove_dir(struct kobject *kobj)
133{ 135{
134 ;
135} 136}
136 137
137static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name) 138static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name)
@@ -160,7 +161,6 @@ static inline int sysfs_chmod_file(struct kobject *kobj,
160static inline void sysfs_remove_file(struct kobject *kobj, 161static inline void sysfs_remove_file(struct kobject *kobj,
161 const struct attribute *attr) 162 const struct attribute *attr)
162{ 163{
163 ;
164} 164}
165 165
166static inline int sysfs_create_bin_file(struct kobject *kobj, 166static inline int sysfs_create_bin_file(struct kobject *kobj,
@@ -169,10 +169,9 @@ static inline int sysfs_create_bin_file(struct kobject *kobj,
169 return 0; 169 return 0;
170} 170}
171 171
172static inline int sysfs_remove_bin_file(struct kobject *kobj, 172static inline void sysfs_remove_bin_file(struct kobject *kobj,
173 struct bin_attribute *attr) 173 struct bin_attribute *attr)
174{ 174{
175 return 0;
176} 175}
177 176
178static inline int sysfs_create_link(struct kobject *kobj, 177static inline int sysfs_create_link(struct kobject *kobj,
@@ -183,7 +182,6 @@ static inline int sysfs_create_link(struct kobject *kobj,
183 182
184static inline void sysfs_remove_link(struct kobject *kobj, const char *name) 183static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
185{ 184{
186 ;
187} 185}
188 186
189static inline int sysfs_create_group(struct kobject *kobj, 187static inline int sysfs_create_group(struct kobject *kobj,
@@ -192,10 +190,21 @@ static inline int sysfs_create_group(struct kobject *kobj,
192 return 0; 190 return 0;
193} 191}
194 192
193static inline int sysfs_update_group(struct kobject *kobj,
194 const struct attribute_group *grp)
195{
196 return 0;
197}
198
199static inline int sysfs_update_group(struct kobject *kobj,
200 const struct attribute_group *grp)
201{
202 return 0;
203}
204
195static inline void sysfs_remove_group(struct kobject *kobj, 205static inline void sysfs_remove_group(struct kobject *kobj,
196 const struct attribute_group *grp) 206 const struct attribute_group *grp)
197{ 207{
198 ;
199} 208}
200 209
201static inline int sysfs_add_file_to_group(struct kobject *kobj, 210static inline int sysfs_add_file_to_group(struct kobject *kobj,
diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h
index e0248631e461..96411306eec6 100644
--- a/include/linux/sysv_fs.h
+++ b/include/linux/sysv_fs.h
@@ -1,11 +1,7 @@
1#ifndef _LINUX_SYSV_FS_H 1#ifndef _LINUX_SYSV_FS_H
2#define _LINUX_SYSV_FS_H 2#define _LINUX_SYSV_FS_H
3 3
4#if defined(__GNUC__) 4#define __packed2__ __attribute__((packed, aligned(2)))
5# define __packed2__ __attribute__((packed, aligned(2)))
6#else
7>> I want to scream! <<
8#endif
9 5
10 6
11#ifndef __KERNEL__ 7#ifndef __KERNEL__
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 08027f1d7f31..d96d9b122304 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -239,6 +239,11 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
239 return (struct tcp_request_sock *)req; 239 return (struct tcp_request_sock *)req;
240} 240}
241 241
242struct tcp_deferred_accept_info {
243 struct sock *listen_sk;
244 struct request_sock *request;
245};
246
242struct tcp_sock { 247struct tcp_sock {
243 /* inet_connection_sock has to be the first member of tcp_sock */ 248 /* inet_connection_sock has to be the first member of tcp_sock */
244 struct inet_connection_sock inet_conn; 249 struct inet_connection_sock inet_conn;
@@ -374,6 +379,8 @@ struct tcp_sock {
374 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 379 unsigned int keepalive_intvl; /* time interval between keep alive probes */
375 int linger2; 380 int linger2;
376 381
382 struct tcp_deferred_accept_info defer_tcp_accept;
383
377 unsigned long last_synq_overflow; 384 unsigned long last_synq_overflow;
378 385
379 u32 tso_deferred; 386 u32 tso_deferred;
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h
index 004808a6df1d..6f371f24160b 100644
--- a/include/linux/textsearch.h
+++ b/include/linux/textsearch.h
@@ -1,8 +1,6 @@
1#ifndef __LINUX_TEXTSEARCH_H 1#ifndef __LINUX_TEXTSEARCH_H
2#define __LINUX_TEXTSEARCH_H 2#define __LINUX_TEXTSEARCH_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/types.h> 4#include <linux/types.h>
7#include <linux/list.h> 5#include <linux/list.h>
8#include <linux/kernel.h> 6#include <linux/kernel.h>
@@ -177,6 +175,4 @@ static inline void *ts_config_priv(struct ts_config *conf)
177 return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config))); 175 return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config)));
178} 176}
179 177
180#endif /* __KERNEL__ */
181
182#endif 178#endif
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 90c1c191ea69..06d3e6eb9ca8 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -41,6 +41,7 @@ struct thermal_zone_device_ops {
41 int (*set_mode) (struct thermal_zone_device *, const char *); 41 int (*set_mode) (struct thermal_zone_device *, const char *);
42 int (*get_trip_type) (struct thermal_zone_device *, int, char *); 42 int (*get_trip_type) (struct thermal_zone_device *, int, char *);
43 int (*get_trip_temp) (struct thermal_zone_device *, int, char *); 43 int (*get_trip_temp) (struct thermal_zone_device *, int, char *);
44 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
44}; 45};
45 46
46struct thermal_cooling_device_ops { 47struct thermal_cooling_device_ops {
@@ -65,6 +66,23 @@ struct thermal_cooling_device {
65 ((long)t-2732+5)/10 : ((long)t-2732-5)/10) 66 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
66#define CELSIUS_TO_KELVIN(t) ((t)*10+2732) 67#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
67 68
69#if defined(CONFIG_HWMON) || \
70 (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE))
71/* thermal zone devices with the same type share one hwmon device */
72struct thermal_hwmon_device {
73 char type[THERMAL_NAME_LENGTH];
74 struct device *device;
75 int count;
76 struct list_head tz_list;
77 struct list_head node;
78};
79
80struct thermal_hwmon_attr {
81 struct device_attribute attr;
82 char name[16];
83};
84#endif
85
68struct thermal_zone_device { 86struct thermal_zone_device {
69 int id; 87 int id;
70 char type[THERMAL_NAME_LENGTH]; 88 char type[THERMAL_NAME_LENGTH];
@@ -76,6 +94,13 @@ struct thermal_zone_device {
76 struct idr idr; 94 struct idr idr;
77 struct mutex lock; /* protect cooling devices list */ 95 struct mutex lock; /* protect cooling devices list */
78 struct list_head node; 96 struct list_head node;
97#if defined(CONFIG_HWMON) || \
98 (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE))
99 struct list_head hwmon_node;
100 struct thermal_hwmon_device *hwmon;
101 struct thermal_hwmon_attr temp_input; /* hwmon sys attr */
102 struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */
103#endif
79}; 104};
80 105
81struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, 106struct thermal_zone_device *thermal_zone_device_register(char *, int, void *,
@@ -88,24 +113,10 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
88 struct thermal_cooling_device *); 113 struct thermal_cooling_device *);
89int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, 114int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
90 struct thermal_cooling_device *); 115 struct thermal_cooling_device *);
91
92#ifdef CONFIG_THERMAL
93struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, 116struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
94 struct 117 struct
95 thermal_cooling_device_ops 118 thermal_cooling_device_ops
96 *); 119 *);
97void thermal_cooling_device_unregister(struct thermal_cooling_device *); 120void thermal_cooling_device_unregister(struct thermal_cooling_device *);
98#else
99static inline struct thermal_cooling_device
100*thermal_cooling_device_register(char *c, void *v,
101 struct thermal_cooling_device_ops *t)
102{
103 return NULL;
104}
105static inline
106 void thermal_cooling_device_unregister(struct thermal_cooling_device *t)
107{
108};
109#endif
110 121
111#endif /* __THERMAL_H__ */ 122#endif /* __THERMAL_H__ */
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 421323e5a2d6..38a56477f27a 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -9,6 +9,9 @@
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11 11
12struct timespec;
13struct compat_timespec;
14
12/* 15/*
13 * System call restart block. 16 * System call restart block.
14 */ 17 */
@@ -26,6 +29,15 @@ struct restart_block {
26 u32 bitset; 29 u32 bitset;
27 u64 time; 30 u64 time;
28 } futex; 31 } futex;
32 /* For nanosleep */
33 struct {
34 clockid_t index;
35 struct timespec __user *rmtp;
36#ifdef CONFIG_COMPAT
37 struct compat_timespec __user *compat_rmtp;
38#endif
39 u64 expires;
40 } nanosleep;
29 }; 41 };
30}; 42};
31 43
@@ -80,6 +92,31 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
80#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) 92#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED)
81#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) 93#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED)
82 94
83#endif 95#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK
96/*
97 * An arch can define its own version of set_restore_sigmask() to get the
98 * job done however works, with or without TIF_RESTORE_SIGMASK.
99 */
100#define HAVE_SET_RESTORE_SIGMASK 1
101
102/**
103 * set_restore_sigmask() - make sure saved_sigmask processing gets done
104 *
105 * This sets TIF_RESTORE_SIGMASK and ensures that the arch signal code
106 * will run before returning to user mode, to process the flag. For
107 * all callers, TIF_SIGPENDING is already set or it's no harm to set
108 * it. TIF_RESTORE_SIGMASK need not be in the set of bits that the
109 * arch code will notice on return to user mode, in case those bits
110 * are scarce. We set TIF_SIGPENDING here to ensure that the arch
111 * signal code always gets run when TIF_RESTORE_SIGMASK is set.
112 */
113static inline void set_restore_sigmask(void)
114{
115 set_thread_flag(TIF_RESTORE_SIGMASK);
116 set_thread_flag(TIF_SIGPENDING);
117}
118#endif /* TIF_RESTORE_SIGMASK && !HAVE_SET_RESTORE_SIGMASK */
119
120#endif /* __KERNEL__ */
84 121
85#endif /* _LINUX_THREAD_INFO_H */ 122#endif /* _LINUX_THREAD_INFO_H */
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 979fefdeb862..d4ba79248a27 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -4,6 +4,7 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/ktime.h> 5#include <linux/ktime.h>
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7#include <linux/debugobjects.h>
7 8
8struct tvec_base; 9struct tvec_base;
9 10
@@ -25,6 +26,7 @@ struct timer_list {
25extern struct tvec_base boot_tvec_bases; 26extern struct tvec_base boot_tvec_bases;
26 27
27#define TIMER_INITIALIZER(_function, _expires, _data) { \ 28#define TIMER_INITIALIZER(_function, _expires, _data) { \
29 .entry = { .prev = TIMER_ENTRY_STATIC }, \
28 .function = (_function), \ 30 .function = (_function), \
29 .expires = (_expires), \ 31 .expires = (_expires), \
30 .data = (_data), \ 32 .data = (_data), \
@@ -38,6 +40,17 @@ extern struct tvec_base boot_tvec_bases;
38void init_timer(struct timer_list *timer); 40void init_timer(struct timer_list *timer);
39void init_timer_deferrable(struct timer_list *timer); 41void init_timer_deferrable(struct timer_list *timer);
40 42
43#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
44extern void init_timer_on_stack(struct timer_list *timer);
45extern void destroy_timer_on_stack(struct timer_list *timer);
46#else
47static inline void destroy_timer_on_stack(struct timer_list *timer) { }
48static inline void init_timer_on_stack(struct timer_list *timer)
49{
50 init_timer(timer);
51}
52#endif
53
41static inline void setup_timer(struct timer_list * timer, 54static inline void setup_timer(struct timer_list * timer,
42 void (*function)(unsigned long), 55 void (*function)(unsigned long),
43 unsigned long data) 56 unsigned long data)
@@ -47,6 +60,15 @@ static inline void setup_timer(struct timer_list * timer,
47 init_timer(timer); 60 init_timer(timer);
48} 61}
49 62
63static inline void setup_timer_on_stack(struct timer_list *timer,
64 void (*function)(unsigned long),
65 unsigned long data)
66{
67 timer->function = function;
68 timer->data = data;
69 init_timer_on_stack(timer);
70}
71
50/** 72/**
51 * timer_pending - is a timer pending? 73 * timer_pending - is a timer pending?
52 * @timer: the timer in question 74 * @timer: the timer in question
@@ -164,5 +186,4 @@ unsigned long __round_jiffies_relative(unsigned long j, int cpu);
164unsigned long round_jiffies(unsigned long j); 186unsigned long round_jiffies(unsigned long j);
165unsigned long round_jiffies_relative(unsigned long j); 187unsigned long round_jiffies_relative(unsigned long j);
166 188
167
168#endif 189#endif
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 8ea3e71ba7fa..fc6035d29d56 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -58,6 +58,8 @@
58 58
59#include <asm/param.h> 59#include <asm/param.h>
60 60
61#define NTP_API 4 /* NTP API version */
62
61/* 63/*
62 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen 64 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen
63 * for a slightly underdamped convergence characteristic. SHIFT_KH 65 * for a slightly underdamped convergence characteristic. SHIFT_KH
@@ -74,24 +76,22 @@
74#define MAXTC 10 /* maximum time constant (shift) */ 76#define MAXTC 10 /* maximum time constant (shift) */
75 77
76/* 78/*
77 * The SHIFT_UPDATE define establishes the decimal point of the
78 * time_offset variable which represents the current offset with
79 * respect to standard time.
80 *
81 * SHIFT_USEC defines the scaling (shift) of the time_freq and 79 * SHIFT_USEC defines the scaling (shift) of the time_freq and
82 * time_tolerance variables, which represent the current frequency 80 * time_tolerance variables, which represent the current frequency
83 * offset and maximum frequency tolerance. 81 * offset and maximum frequency tolerance.
84 */ 82 */
85#define SHIFT_UPDATE (SHIFT_HZ + 1) /* time offset scale (shift) */
86#define SHIFT_USEC 16 /* frequency offset scale (shift) */ 83#define SHIFT_USEC 16 /* frequency offset scale (shift) */
87#define SHIFT_NSEC 12 /* kernel frequency offset scale */ 84#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
88 85#define PPM_SCALE_INV_SHIFT 20
89#define MAXPHASE 512000L /* max phase error (us) */ 86#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
90#define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ 87 PPM_SCALE + 1)
91#define MAXFREQ_NSEC (512000L << SHIFT_NSEC) /* max frequency error (ppb) */ 88
89#define MAXPHASE 500000000l /* max phase error (ns) */
90#define MAXFREQ 500000 /* max frequency error (ns/s) */
91#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT)
92#define MINSEC 256 /* min interval between updates (s) */ 92#define MINSEC 256 /* min interval between updates (s) */
93#define MAXSEC 2048 /* max interval between updates (s) */ 93#define MAXSEC 2048 /* max interval between updates (s) */
94#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ 94#define NTP_PHASE_LIMIT ((MAXPHASE / NSEC_PER_USEC) << 5) /* beyond max. dispersion */
95 95
96/* 96/*
97 * syscall interface - used (mainly by NTP daemon) 97 * syscall interface - used (mainly by NTP daemon)
@@ -121,9 +121,11 @@ struct timex {
121 long errcnt; /* calibration errors (ro) */ 121 long errcnt; /* calibration errors (ro) */
122 long stbcnt; /* stability limit exceeded (ro) */ 122 long stbcnt; /* stability limit exceeded (ro) */
123 123
124 int tai; /* TAI offset (ro) */
125
124 int :32; int :32; int :32; int :32; 126 int :32; int :32; int :32; int :32;
125 int :32; int :32; int :32; int :32; 127 int :32; int :32; int :32; int :32;
126 int :32; int :32; int :32; int :32; 128 int :32; int :32; int :32;
127}; 129};
128 130
129/* 131/*
@@ -135,6 +137,9 @@ struct timex {
135#define ADJ_ESTERROR 0x0008 /* estimated time error */ 137#define ADJ_ESTERROR 0x0008 /* estimated time error */
136#define ADJ_STATUS 0x0010 /* clock status */ 138#define ADJ_STATUS 0x0010 /* clock status */
137#define ADJ_TIMECONST 0x0020 /* pll time constant */ 139#define ADJ_TIMECONST 0x0020 /* pll time constant */
140#define ADJ_TAI 0x0080 /* set TAI offset */
141#define ADJ_MICRO 0x1000 /* select microsecond resolution */
142#define ADJ_NANO 0x2000 /* select nanosecond resolution */
138#define ADJ_TICK 0x4000 /* tick value */ 143#define ADJ_TICK 0x4000 /* tick value */
139#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ 144#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
140#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ 145#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
@@ -146,8 +151,6 @@ struct timex {
146#define MOD_ESTERROR ADJ_ESTERROR 151#define MOD_ESTERROR ADJ_ESTERROR
147#define MOD_STATUS ADJ_STATUS 152#define MOD_STATUS ADJ_STATUS
148#define MOD_TIMECONST ADJ_TIMECONST 153#define MOD_TIMECONST ADJ_TIMECONST
149#define MOD_CLKB ADJ_TICK
150#define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */
151 154
152 155
153/* 156/*
@@ -169,9 +172,13 @@ struct timex {
169#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ 172#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
170 173
171#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ 174#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
175#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */
176#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */
177#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
172 178
179/* read-only bits */
173#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ 180#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
174 STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ 181 STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
175 182
176/* 183/*
177 * Clock states (time_state) 184 * Clock states (time_state)
@@ -203,10 +210,9 @@ extern int time_status; /* clock synchronization status bits */
203extern long time_maxerror; /* maximum error */ 210extern long time_maxerror; /* maximum error */
204extern long time_esterror; /* estimated error */ 211extern long time_esterror; /* estimated error */
205 212
206extern long time_freq; /* frequency offset (scaled ppm) */
207
208extern long time_adjust; /* The amount of adjtime left */ 213extern long time_adjust; /* The amount of adjtime left */
209 214
215extern void ntp_init(void);
210extern void ntp_clear(void); 216extern void ntp_clear(void);
211 217
212/** 218/**
@@ -225,7 +231,7 @@ static inline int ntp_synced(void)
225 __x < 0 ? -(-__x >> __s) : __x >> __s; \ 231 __x < 0 ? -(-__x >> __s) : __x >> __s; \
226}) 232})
227 233
228#define TICK_LENGTH_SHIFT 32 234#define NTP_SCALE_SHIFT 32
229 235
230#ifdef CONFIG_NO_HZ 236#ifdef CONFIG_NO_HZ
231#define NTP_INTERVAL_FREQ (2) 237#define NTP_INTERVAL_FREQ (2)
@@ -234,8 +240,8 @@ static inline int ntp_synced(void)
234#endif 240#endif
235#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) 241#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
236 242
237/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 243/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
238extern u64 current_tick_length(void); 244extern u64 tick_length;
239 245
240extern void second_overflow(void); 246extern void second_overflow(void);
241extern void update_ntp_one_tick(void); 247extern void update_ntp_one_tick(void);
diff --git a/include/linux/topology.h b/include/linux/topology.h
index bd14f8b30f09..4bb7074a2c3a 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -38,16 +38,15 @@
38#endif 38#endif
39 39
40#ifndef nr_cpus_node 40#ifndef nr_cpus_node
41#define nr_cpus_node(node) \ 41#define nr_cpus_node(node) \
42 ({ \ 42 ({ \
43 cpumask_t __tmp__; \ 43 node_to_cpumask_ptr(__tmp__, node); \
44 __tmp__ = node_to_cpumask(node); \ 44 cpus_weight(*__tmp__); \
45 cpus_weight(__tmp__); \
46 }) 45 })
47#endif 46#endif
48 47
49#define for_each_node_with_cpus(node) \ 48#define for_each_node_with_cpus(node) \
50 for_each_online_node(node) \ 49 for_each_online_node(node) \
51 if (nr_cpus_node(node)) 50 if (nr_cpus_node(node))
52 51
53void arch_update_cpu_topology(void); 52void arch_update_cpu_topology(void);
@@ -80,7 +79,9 @@ void arch_update_cpu_topology(void);
80 * by defining their own arch-specific initializer in include/asm/topology.h. 79 * by defining their own arch-specific initializer in include/asm/topology.h.
81 * A definition there will automagically override these default initializers 80 * A definition there will automagically override these default initializers
82 * and allow arch-specific performance tuning of sched_domains. 81 * and allow arch-specific performance tuning of sched_domains.
82 * (Only non-zero and non-null fields need be specified.)
83 */ 83 */
84
84#ifdef CONFIG_SCHED_SMT 85#ifdef CONFIG_SCHED_SMT
85/* MCD - Do we really need this? It is always on if CONFIG_SCHED_SMT is, 86/* MCD - Do we really need this? It is always on if CONFIG_SCHED_SMT is,
86 * so can't we drop this in favor of CONFIG_SCHED_SMT? 87 * so can't we drop this in favor of CONFIG_SCHED_SMT?
@@ -89,20 +90,10 @@ void arch_update_cpu_topology(void);
89/* Common values for SMT siblings */ 90/* Common values for SMT siblings */
90#ifndef SD_SIBLING_INIT 91#ifndef SD_SIBLING_INIT
91#define SD_SIBLING_INIT (struct sched_domain) { \ 92#define SD_SIBLING_INIT (struct sched_domain) { \
92 .span = CPU_MASK_NONE, \
93 .parent = NULL, \
94 .child = NULL, \
95 .groups = NULL, \
96 .min_interval = 1, \ 93 .min_interval = 1, \
97 .max_interval = 2, \ 94 .max_interval = 2, \
98 .busy_factor = 64, \ 95 .busy_factor = 64, \
99 .imbalance_pct = 110, \ 96 .imbalance_pct = 110, \
100 .cache_nice_tries = 0, \
101 .busy_idx = 0, \
102 .idle_idx = 0, \
103 .newidle_idx = 0, \
104 .wake_idx = 0, \
105 .forkexec_idx = 0, \
106 .flags = SD_LOAD_BALANCE \ 97 .flags = SD_LOAD_BALANCE \
107 | SD_BALANCE_NEWIDLE \ 98 | SD_BALANCE_NEWIDLE \
108 | SD_BALANCE_FORK \ 99 | SD_BALANCE_FORK \
@@ -112,7 +103,6 @@ void arch_update_cpu_topology(void);
112 | SD_SHARE_CPUPOWER, \ 103 | SD_SHARE_CPUPOWER, \
113 .last_balance = jiffies, \ 104 .last_balance = jiffies, \
114 .balance_interval = 1, \ 105 .balance_interval = 1, \
115 .nr_balance_failed = 0, \
116} 106}
117#endif 107#endif
118#endif /* CONFIG_SCHED_SMT */ 108#endif /* CONFIG_SCHED_SMT */
@@ -121,18 +111,12 @@ void arch_update_cpu_topology(void);
121/* Common values for MC siblings. for now mostly derived from SD_CPU_INIT */ 111/* Common values for MC siblings. for now mostly derived from SD_CPU_INIT */
122#ifndef SD_MC_INIT 112#ifndef SD_MC_INIT
123#define SD_MC_INIT (struct sched_domain) { \ 113#define SD_MC_INIT (struct sched_domain) { \
124 .span = CPU_MASK_NONE, \
125 .parent = NULL, \
126 .child = NULL, \
127 .groups = NULL, \
128 .min_interval = 1, \ 114 .min_interval = 1, \
129 .max_interval = 4, \ 115 .max_interval = 4, \
130 .busy_factor = 64, \ 116 .busy_factor = 64, \
131 .imbalance_pct = 125, \ 117 .imbalance_pct = 125, \
132 .cache_nice_tries = 1, \ 118 .cache_nice_tries = 1, \
133 .busy_idx = 2, \ 119 .busy_idx = 2, \
134 .idle_idx = 0, \
135 .newidle_idx = 0, \
136 .wake_idx = 1, \ 120 .wake_idx = 1, \
137 .forkexec_idx = 1, \ 121 .forkexec_idx = 1, \
138 .flags = SD_LOAD_BALANCE \ 122 .flags = SD_LOAD_BALANCE \
@@ -144,7 +128,6 @@ void arch_update_cpu_topology(void);
144 | BALANCE_FOR_MC_POWER, \ 128 | BALANCE_FOR_MC_POWER, \
145 .last_balance = jiffies, \ 129 .last_balance = jiffies, \
146 .balance_interval = 1, \ 130 .balance_interval = 1, \
147 .nr_balance_failed = 0, \
148} 131}
149#endif 132#endif
150#endif /* CONFIG_SCHED_MC */ 133#endif /* CONFIG_SCHED_MC */
@@ -152,10 +135,6 @@ void arch_update_cpu_topology(void);
152/* Common values for CPUs */ 135/* Common values for CPUs */
153#ifndef SD_CPU_INIT 136#ifndef SD_CPU_INIT
154#define SD_CPU_INIT (struct sched_domain) { \ 137#define SD_CPU_INIT (struct sched_domain) { \
155 .span = CPU_MASK_NONE, \
156 .parent = NULL, \
157 .child = NULL, \
158 .groups = NULL, \
159 .min_interval = 1, \ 138 .min_interval = 1, \
160 .max_interval = 4, \ 139 .max_interval = 4, \
161 .busy_factor = 64, \ 140 .busy_factor = 64, \
@@ -174,16 +153,11 @@ void arch_update_cpu_topology(void);
174 | BALANCE_FOR_PKG_POWER,\ 153 | BALANCE_FOR_PKG_POWER,\
175 .last_balance = jiffies, \ 154 .last_balance = jiffies, \
176 .balance_interval = 1, \ 155 .balance_interval = 1, \
177 .nr_balance_failed = 0, \
178} 156}
179#endif 157#endif
180 158
181/* sched_domains SD_ALLNODES_INIT for NUMA machines */ 159/* sched_domains SD_ALLNODES_INIT for NUMA machines */
182#define SD_ALLNODES_INIT (struct sched_domain) { \ 160#define SD_ALLNODES_INIT (struct sched_domain) { \
183 .span = CPU_MASK_NONE, \
184 .parent = NULL, \
185 .child = NULL, \
186 .groups = NULL, \
187 .min_interval = 64, \ 161 .min_interval = 64, \
188 .max_interval = 64*num_online_cpus(), \ 162 .max_interval = 64*num_online_cpus(), \
189 .busy_factor = 128, \ 163 .busy_factor = 128, \
@@ -191,14 +165,10 @@ void arch_update_cpu_topology(void);
191 .cache_nice_tries = 1, \ 165 .cache_nice_tries = 1, \
192 .busy_idx = 3, \ 166 .busy_idx = 3, \
193 .idle_idx = 3, \ 167 .idle_idx = 3, \
194 .newidle_idx = 0, /* unused */ \
195 .wake_idx = 0, /* unused */ \
196 .forkexec_idx = 0, /* unused */ \
197 .flags = SD_LOAD_BALANCE \ 168 .flags = SD_LOAD_BALANCE \
198 | SD_SERIALIZE, \ 169 | SD_SERIALIZE, \
199 .last_balance = jiffies, \ 170 .last_balance = jiffies, \
200 .balance_interval = 64, \ 171 .balance_interval = 64, \
201 .nr_balance_failed = 0, \
202} 172}
203 173
204#ifdef CONFIG_NUMA 174#ifdef CONFIG_NUMA
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h
index 1d6cc22e5f42..eaec1ea9558e 100644
--- a/include/linux/transport_class.h
+++ b/include/linux/transport_class.h
@@ -17,11 +17,11 @@ struct transport_container;
17struct transport_class { 17struct transport_class {
18 struct class class; 18 struct class class;
19 int (*setup)(struct transport_container *, struct device *, 19 int (*setup)(struct transport_container *, struct device *,
20 struct class_device *); 20 struct device *);
21 int (*configure)(struct transport_container *, struct device *, 21 int (*configure)(struct transport_container *, struct device *,
22 struct class_device *); 22 struct device *);
23 int (*remove)(struct transport_container *, struct device *, 23 int (*remove)(struct transport_container *, struct device *,
24 struct class_device *); 24 struct device *);
25}; 25};
26 26
27#define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \ 27#define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \
@@ -86,9 +86,10 @@ static inline int transport_container_register(struct transport_container *tc)
86 return attribute_container_register(&tc->ac); 86 return attribute_container_register(&tc->ac);
87} 87}
88 88
89static inline int transport_container_unregister(struct transport_container *tc) 89static inline void transport_container_unregister(struct transport_container *tc)
90{ 90{
91 return attribute_container_unregister(&tc->ac); 91 if (unlikely(attribute_container_unregister(&tc->ac)))
92 BUG();
92} 93}
93 94
94int transport_class_register(struct transport_class *); 95int transport_class_register(struct transport_class *);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index dd8e08fe8855..7f7121f9c968 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -177,27 +177,33 @@ struct signal_struct;
177 * size each time the window is created or resized anyway. 177 * size each time the window is created or resized anyway.
178 * - TYT, 9/14/92 178 * - TYT, 9/14/92
179 */ 179 */
180
181struct tty_operations;
182
180struct tty_struct { 183struct tty_struct {
181 int magic; 184 int magic;
182 struct tty_driver *driver; 185 struct tty_driver *driver;
186 const struct tty_operations *ops;
183 int index; 187 int index;
184 struct tty_ldisc ldisc; 188 struct tty_ldisc ldisc;
185 struct mutex termios_mutex; 189 struct mutex termios_mutex;
190 spinlock_t ctrl_lock;
191 /* Termios values are protected by the termios mutex */
186 struct ktermios *termios, *termios_locked; 192 struct ktermios *termios, *termios_locked;
187 char name[64]; 193 char name[64];
188 struct pid *pgrp; 194 struct pid *pgrp; /* Protected by ctrl lock */
189 struct pid *session; 195 struct pid *session;
190 unsigned long flags; 196 unsigned long flags;
191 int count; 197 int count;
192 struct winsize winsize; 198 struct winsize winsize; /* termios mutex */
193 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 199 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
194 unsigned char low_latency:1, warned:1; 200 unsigned char low_latency:1, warned:1;
195 unsigned char ctrl_status; 201 unsigned char ctrl_status; /* ctrl_lock */
196 unsigned int receive_room; /* Bytes free for queue */ 202 unsigned int receive_room; /* Bytes free for queue */
197 203
198 struct tty_struct *link; 204 struct tty_struct *link;
199 struct fasync_struct *fasync; 205 struct fasync_struct *fasync;
200 struct tty_bufhead buf; 206 struct tty_bufhead buf; /* Locked internally */
201 int alt_speed; /* For magic substitution of 38400 bps */ 207 int alt_speed; /* For magic substitution of 38400 bps */
202 wait_queue_head_t write_wait; 208 wait_queue_head_t write_wait;
203 wait_queue_head_t read_wait; 209 wait_queue_head_t read_wait;
@@ -211,6 +217,7 @@ struct tty_struct {
211 /* 217 /*
212 * The following is data for the N_TTY line discipline. For 218 * The following is data for the N_TTY line discipline. For
213 * historical reasons, this is included in the tty structure. 219 * historical reasons, this is included in the tty structure.
220 * Mostly locked by the BKL.
214 */ 221 */
215 unsigned int column; 222 unsigned int column;
216 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1; 223 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
@@ -292,15 +299,21 @@ extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
292extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, 299extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
293 int buflen); 300 int buflen);
294extern void tty_write_message(struct tty_struct *tty, char *msg); 301extern void tty_write_message(struct tty_struct *tty, char *msg);
302extern int tty_put_char(struct tty_struct *tty, unsigned char c);
303extern int tty_chars_in_buffer(struct tty_struct *tty);
304extern int tty_write_room(struct tty_struct *tty);
305extern void tty_driver_flush_buffer(struct tty_struct *tty);
306extern void tty_throttle(struct tty_struct *tty);
307extern void tty_unthrottle(struct tty_struct *tty);
295 308
296extern int is_current_pgrp_orphaned(void); 309extern int is_current_pgrp_orphaned(void);
310extern struct pid *tty_get_pgrp(struct tty_struct *tty);
297extern int is_ignored(int sig); 311extern int is_ignored(int sig);
298extern int tty_signal(int sig, struct tty_struct *tty); 312extern int tty_signal(int sig, struct tty_struct *tty);
299extern void tty_hangup(struct tty_struct * tty); 313extern void tty_hangup(struct tty_struct * tty);
300extern void tty_vhangup(struct tty_struct * tty); 314extern void tty_vhangup(struct tty_struct * tty);
301extern void tty_unhangup(struct file *filp); 315extern void tty_unhangup(struct file *filp);
302extern int tty_hung_up_p(struct file * filp); 316extern int tty_hung_up_p(struct file * filp);
303extern int is_tty(struct file *filp);
304extern void do_SAK(struct tty_struct *tty); 317extern void do_SAK(struct tty_struct *tty);
305extern void __do_SAK(struct tty_struct *tty); 318extern void __do_SAK(struct tty_struct *tty);
306extern void disassociate_ctty(int priv); 319extern void disassociate_ctty(int priv);
@@ -324,8 +337,7 @@ extern void tty_ldisc_put(int);
324extern void tty_wakeup(struct tty_struct *tty); 337extern void tty_wakeup(struct tty_struct *tty);
325extern void tty_ldisc_flush(struct tty_struct *tty); 338extern void tty_ldisc_flush(struct tty_struct *tty);
326 339
327extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 340extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
328 unsigned long arg);
329extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, 341extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
330 unsigned int cmd, unsigned long arg); 342 unsigned int cmd, unsigned long arg);
331extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); 343extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
@@ -351,8 +363,7 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
351extern void tty_audit_exit(void); 363extern void tty_audit_exit(void);
352extern void tty_audit_fork(struct signal_struct *sig); 364extern void tty_audit_fork(struct signal_struct *sig);
353extern void tty_audit_push(struct tty_struct *tty); 365extern void tty_audit_push(struct tty_struct *tty);
354extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid); 366extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid);
355extern void tty_audit_opening(void);
356#else 367#else
357static inline void tty_audit_add_data(struct tty_struct *tty, 368static inline void tty_audit_add_data(struct tty_struct *tty,
358 unsigned char *data, size_t size) 369 unsigned char *data, size_t size)
@@ -367,10 +378,7 @@ static inline void tty_audit_fork(struct signal_struct *sig)
367static inline void tty_audit_push(struct tty_struct *tty) 378static inline void tty_audit_push(struct tty_struct *tty)
368{ 379{
369} 380}
370static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid) 381static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid)
371{
372}
373static inline void tty_audit_opening(void)
374{ 382{
375} 383}
376#endif 384#endif
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 85c95cd39bc3..59f1c0bd8f9c 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -12,11 +12,15 @@
12 * This routine is called when a particular tty device is opened. 12 * This routine is called when a particular tty device is opened.
13 * This routine is mandatory; if this routine is not filled in, 13 * This routine is mandatory; if this routine is not filled in,
14 * the attempted open will fail with ENODEV. 14 * the attempted open will fail with ENODEV.
15 *
16 * Required method.
15 * 17 *
16 * void (*close)(struct tty_struct * tty, struct file * filp); 18 * void (*close)(struct tty_struct * tty, struct file * filp);
17 * 19 *
18 * This routine is called when a particular tty device is closed. 20 * This routine is called when a particular tty device is closed.
19 * 21 *
22 * Required method.
23 *
20 * int (*write)(struct tty_struct * tty, 24 * int (*write)(struct tty_struct * tty,
21 * const unsigned char *buf, int count); 25 * const unsigned char *buf, int count);
22 * 26 *
@@ -26,7 +30,9 @@
26 * number of characters actually accepted for writing. This 30 * number of characters actually accepted for writing. This
27 * routine is mandatory. 31 * routine is mandatory.
28 * 32 *
29 * void (*put_char)(struct tty_struct *tty, unsigned char ch); 33 * Optional: Required for writable devices.
34 *
35 * int (*put_char)(struct tty_struct *tty, unsigned char ch);
30 * 36 *
31 * This routine is called by the kernel to write a single 37 * This routine is called by the kernel to write a single
32 * character to the tty device. If the kernel uses this routine, 38 * character to the tty device. If the kernel uses this routine,
@@ -34,10 +40,18 @@
34 * done stuffing characters into the driver. If there is no room 40 * done stuffing characters into the driver. If there is no room
35 * in the queue, the character is ignored. 41 * in the queue, the character is ignored.
36 * 42 *
43 * Optional: Kernel will use the write method if not provided.
44 *
45 * Note: Do not call this function directly, call tty_put_char
46 *
37 * void (*flush_chars)(struct tty_struct *tty); 47 * void (*flush_chars)(struct tty_struct *tty);
38 * 48 *
39 * This routine is called by the kernel after it has written a 49 * This routine is called by the kernel after it has written a
40 * series of characters to the tty device using put_char(). 50 * series of characters to the tty device using put_char().
51 *
52 * Optional:
53 *
54 * Note: Do not call this function directly, call tty_driver_flush_chars
41 * 55 *
42 * int (*write_room)(struct tty_struct *tty); 56 * int (*write_room)(struct tty_struct *tty);
43 * 57 *
@@ -45,6 +59,10 @@
45 * will accept for queuing to be written. This number is subject 59 * will accept for queuing to be written. This number is subject
46 * to change as output buffers get emptied, or if the output flow 60 * to change as output buffers get emptied, or if the output flow
47 * control is acted. 61 * control is acted.
62 *
63 * Required if write method is provided else not needed.
64 *
65 * Note: Do not call this function directly, call tty_write_room
48 * 66 *
49 * int (*ioctl)(struct tty_struct *tty, struct file * file, 67 * int (*ioctl)(struct tty_struct *tty, struct file * file,
50 * unsigned int cmd, unsigned long arg); 68 * unsigned int cmd, unsigned long arg);
@@ -53,28 +71,37 @@
53 * device-specific ioctl's. If the ioctl number passed in cmd 71 * device-specific ioctl's. If the ioctl number passed in cmd
54 * is not recognized by the driver, it should return ENOIOCTLCMD. 72 * is not recognized by the driver, it should return ENOIOCTLCMD.
55 * 73 *
74 * Optional
75 *
56 * long (*compat_ioctl)(struct tty_struct *tty, struct file * file, 76 * long (*compat_ioctl)(struct tty_struct *tty, struct file * file,
57 * unsigned int cmd, unsigned long arg); 77 * unsigned int cmd, unsigned long arg);
58 * 78 *
59 * implement ioctl processing for 32 bit process on 64 bit system 79 * implement ioctl processing for 32 bit process on 64 bit system
80 *
81 * Optional
60 * 82 *
61 * void (*set_termios)(struct tty_struct *tty, struct ktermios * old); 83 * void (*set_termios)(struct tty_struct *tty, struct ktermios * old);
62 * 84 *
63 * This routine allows the tty driver to be notified when 85 * This routine allows the tty driver to be notified when
64 * device's termios settings have changed. Note that a 86 * device's termios settings have changed.
65 * well-designed tty driver should be prepared to accept the case 87 *
66 * where old == NULL, and try to do something rational. 88 * Optional: Called under the termios lock
89 *
67 * 90 *
68 * void (*set_ldisc)(struct tty_struct *tty); 91 * void (*set_ldisc)(struct tty_struct *tty);
69 * 92 *
70 * This routine allows the tty driver to be notified when the 93 * This routine allows the tty driver to be notified when the
71 * device's termios settings have changed. 94 * device's termios settings have changed.
95 *
96 * Optional: Called under BKL (currently)
72 * 97 *
73 * void (*throttle)(struct tty_struct * tty); 98 * void (*throttle)(struct tty_struct * tty);
74 * 99 *
75 * This routine notifies the tty driver that input buffers for 100 * This routine notifies the tty driver that input buffers for
76 * the line discipline are close to full, and it should somehow 101 * the line discipline are close to full, and it should somehow
77 * signal that no more characters should be sent to the tty. 102 * signal that no more characters should be sent to the tty.
103 *
104 * Optional: Always invoke via tty_throttle();
78 * 105 *
79 * void (*unthrottle)(struct tty_struct * tty); 106 * void (*unthrottle)(struct tty_struct * tty);
80 * 107 *
@@ -82,21 +109,33 @@
82 * that characters can now be sent to the tty without fear of 109 * that characters can now be sent to the tty without fear of
83 * overrunning the input buffers of the line disciplines. 110 * overrunning the input buffers of the line disciplines.
84 * 111 *
112 * Optional: Always invoke via tty_unthrottle();
113 *
85 * void (*stop)(struct tty_struct *tty); 114 * void (*stop)(struct tty_struct *tty);
86 * 115 *
87 * This routine notifies the tty driver that it should stop 116 * This routine notifies the tty driver that it should stop
88 * outputting characters to the tty device. 117 * outputting characters to the tty device.
118 *
119 * Optional:
120 *
121 * Note: Call stop_tty not this method.
89 * 122 *
90 * void (*start)(struct tty_struct *tty); 123 * void (*start)(struct tty_struct *tty);
91 * 124 *
92 * This routine notifies the tty driver that it resume sending 125 * This routine notifies the tty driver that it resume sending
93 * characters to the tty device. 126 * characters to the tty device.
127 *
128 * Optional:
129 *
130 * Note: Call start_tty not this method.
94 * 131 *
95 * void (*hangup)(struct tty_struct *tty); 132 * void (*hangup)(struct tty_struct *tty);
96 * 133 *
97 * This routine notifies the tty driver that it should hangup the 134 * This routine notifies the tty driver that it should hangup the
98 * tty device. 135 * tty device.
99 * 136 *
137 * Required:
138 *
100 * void (*break_ctl)(struct tty_stuct *tty, int state); 139 * void (*break_ctl)(struct tty_stuct *tty, int state);
101 * 140 *
102 * This optional routine requests the tty driver to turn on or 141 * This optional routine requests the tty driver to turn on or
@@ -106,18 +145,26 @@
106 * 145 *
107 * If this routine is implemented, the high-level tty driver will 146 * If this routine is implemented, the high-level tty driver will
108 * handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK, 147 * handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK,
109 * TIOCCBRK. Otherwise, these ioctls will be passed down to the 148 * TIOCCBRK.
110 * driver to handle. 149 *
150 * Optional: Required for TCSBRK/BRKP/etc handling.
111 * 151 *
112 * void (*wait_until_sent)(struct tty_struct *tty, int timeout); 152 * void (*wait_until_sent)(struct tty_struct *tty, int timeout);
113 * 153 *
114 * This routine waits until the device has written out all of the 154 * This routine waits until the device has written out all of the
115 * characters in its transmitter FIFO. 155 * characters in its transmitter FIFO.
116 * 156 *
157 * Optional: If not provided the device is assumed to have no FIFO
158 *
159 * Note: Usually correct to call tty_wait_until_sent
160 *
117 * void (*send_xchar)(struct tty_struct *tty, char ch); 161 * void (*send_xchar)(struct tty_struct *tty, char ch);
118 * 162 *
119 * This routine is used to send a high-priority XON/XOFF 163 * This routine is used to send a high-priority XON/XOFF
120 * character to the device. 164 * character to the device.
165 *
166 * Optional: If not provided then the write method is called under
167 * the atomic write lock to keep it serialized with the ldisc.
121 */ 168 */
122 169
123#include <linux/fs.h> 170#include <linux/fs.h>
@@ -125,13 +172,14 @@
125#include <linux/cdev.h> 172#include <linux/cdev.h>
126 173
127struct tty_struct; 174struct tty_struct;
175struct tty_driver;
128 176
129struct tty_operations { 177struct tty_operations {
130 int (*open)(struct tty_struct * tty, struct file * filp); 178 int (*open)(struct tty_struct * tty, struct file * filp);
131 void (*close)(struct tty_struct * tty, struct file * filp); 179 void (*close)(struct tty_struct * tty, struct file * filp);
132 int (*write)(struct tty_struct * tty, 180 int (*write)(struct tty_struct * tty,
133 const unsigned char *buf, int count); 181 const unsigned char *buf, int count);
134 void (*put_char)(struct tty_struct *tty, unsigned char ch); 182 int (*put_char)(struct tty_struct *tty, unsigned char ch);
135 void (*flush_chars)(struct tty_struct *tty); 183 void (*flush_chars)(struct tty_struct *tty);
136 int (*write_room)(struct tty_struct *tty); 184 int (*write_room)(struct tty_struct *tty);
137 int (*chars_in_buffer)(struct tty_struct *tty); 185 int (*chars_in_buffer)(struct tty_struct *tty);
@@ -152,11 +200,14 @@ struct tty_operations {
152 void (*send_xchar)(struct tty_struct *tty, char ch); 200 void (*send_xchar)(struct tty_struct *tty, char ch);
153 int (*read_proc)(char *page, char **start, off_t off, 201 int (*read_proc)(char *page, char **start, off_t off,
154 int count, int *eof, void *data); 202 int count, int *eof, void *data);
155 int (*write_proc)(struct file *file, const char __user *buffer,
156 unsigned long count, void *data);
157 int (*tiocmget)(struct tty_struct *tty, struct file *file); 203 int (*tiocmget)(struct tty_struct *tty, struct file *file);
158 int (*tiocmset)(struct tty_struct *tty, struct file *file, 204 int (*tiocmset)(struct tty_struct *tty, struct file *file,
159 unsigned int set, unsigned int clear); 205 unsigned int set, unsigned int clear);
206#ifdef CONFIG_CONSOLE_POLL
207 int (*poll_init)(struct tty_driver *driver, int line, char *options);
208 int (*poll_get_char)(struct tty_driver *driver, int line);
209 void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
210#endif
160}; 211};
161 212
162struct tty_driver { 213struct tty_driver {
@@ -184,43 +235,13 @@ struct tty_driver {
184 struct tty_struct **ttys; 235 struct tty_struct **ttys;
185 struct ktermios **termios; 236 struct ktermios **termios;
186 struct ktermios **termios_locked; 237 struct ktermios **termios_locked;
187 void *driver_state; /* only used for the PTY driver */ 238 void *driver_state;
188 239
189 /* 240 /*
190 * Interface routines from the upper tty layer to the tty 241 * Driver methods
191 * driver. Will be replaced with struct tty_operations.
192 */ 242 */
193 int (*open)(struct tty_struct * tty, struct file * filp);
194 void (*close)(struct tty_struct * tty, struct file * filp);
195 int (*write)(struct tty_struct * tty,
196 const unsigned char *buf, int count);
197 void (*put_char)(struct tty_struct *tty, unsigned char ch);
198 void (*flush_chars)(struct tty_struct *tty);
199 int (*write_room)(struct tty_struct *tty);
200 int (*chars_in_buffer)(struct tty_struct *tty);
201 int (*ioctl)(struct tty_struct *tty, struct file * file,
202 unsigned int cmd, unsigned long arg);
203 long (*compat_ioctl)(struct tty_struct *tty, struct file * file,
204 unsigned int cmd, unsigned long arg);
205 void (*set_termios)(struct tty_struct *tty, struct ktermios * old);
206 void (*throttle)(struct tty_struct * tty);
207 void (*unthrottle)(struct tty_struct * tty);
208 void (*stop)(struct tty_struct *tty);
209 void (*start)(struct tty_struct *tty);
210 void (*hangup)(struct tty_struct *tty);
211 void (*break_ctl)(struct tty_struct *tty, int state);
212 void (*flush_buffer)(struct tty_struct *tty);
213 void (*set_ldisc)(struct tty_struct *tty);
214 void (*wait_until_sent)(struct tty_struct *tty, int timeout);
215 void (*send_xchar)(struct tty_struct *tty, char ch);
216 int (*read_proc)(char *page, char **start, off_t off,
217 int count, int *eof, void *data);
218 int (*write_proc)(struct file *file, const char __user *buffer,
219 unsigned long count, void *data);
220 int (*tiocmget)(struct tty_struct *tty, struct file *file);
221 int (*tiocmset)(struct tty_struct *tty, struct file *file,
222 unsigned int set, unsigned int clear);
223 243
244 const struct tty_operations *ops;
224 struct list_head tty_drivers; 245 struct list_head tty_drivers;
225}; 246};
226 247
@@ -230,6 +251,7 @@ struct tty_driver *alloc_tty_driver(int lines);
230void put_tty_driver(struct tty_driver *driver); 251void put_tty_driver(struct tty_driver *driver);
231void tty_set_operations(struct tty_driver *driver, 252void tty_set_operations(struct tty_driver *driver,
232 const struct tty_operations *op); 253 const struct tty_operations *op);
254extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
233 255
234/* tty driver magic number */ 256/* tty driver magic number */
235#define TTY_DRIVER_MAGIC 0x5402 257#define TTY_DRIVER_MAGIC 0x5402
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 975c963e5789..fec6decfb983 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -84,4 +84,26 @@ static inline unsigned long __copy_from_user_nocache(void *to,
84 ret; \ 84 ret; \
85 }) 85 })
86 86
87/*
88 * probe_kernel_read(): safely attempt to read from a location
89 * @dst: pointer to the buffer that shall take the data
90 * @src: address to read from
91 * @size: size of the data chunk
92 *
93 * Safely read from address @src to the buffer at @dst. If a kernel fault
94 * happens, handle that and return -EFAULT.
95 */
96extern long probe_kernel_read(void *dst, void *src, size_t size);
97
98/*
99 * probe_kernel_write(): safely attempt to write to a location
100 * @dst: address to write to
101 * @src: pointer to the data that shall be written
102 * @size: size of the data chunk
103 *
104 * Safely write to address @dst from the buffer at @src. If a kernel fault
105 * happens, handle that and return -EFAULT.
106 */
107extern long probe_kernel_write(void *dst, void *src, size_t size);
108
87#endif /* __LINUX_UACCESS_H__ */ 109#endif /* __LINUX_UACCESS_H__ */
diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h
deleted file mode 100644
index aa88654eb76b..000000000000
--- a/include/linux/udf_fs.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * udf_fs.h
3 *
4 * PURPOSE
5 * Included by fs/filesystems.c
6 *
7 * DESCRIPTION
8 * OSTA-UDF(tm) = Optical Storage Technology Association
9 * Universal Disk Format.
10 *
11 * This code is based on version 2.50 of the UDF specification,
12 * and revision 3 of the ECMA 167 standard [equivalent to ISO 13346].
13 * http://www.osta.org/ * http://www.ecma.ch/
14 * http://www.iso.org/
15 *
16 * COPYRIGHT
17 * This file is distributed under the terms of the GNU General Public
18 * License (GPL). Copies of the GPL can be obtained from:
19 * ftp://prep.ai.mit.edu/pub/gnu/GPL
20 * Each contributing author retains all rights to their own work.
21 *
22 * (C) 1999-2004 Ben Fennema
23 * (C) 1999-2000 Stelias Computing Inc
24 *
25 * HISTORY
26 *
27 */
28
29#ifndef _UDF_FS_H
30#define _UDF_FS_H 1
31
32#define UDF_PREALLOCATE
33#define UDF_DEFAULT_PREALLOC_BLOCKS 8
34
35#undef UDFFS_DEBUG
36
37#ifdef UDFFS_DEBUG
38#define udf_debug(f, a...) \
39 do { \
40 printk (KERN_DEBUG "UDF-fs DEBUG %s:%d:%s: ", \
41 __FILE__, __LINE__, __FUNCTION__); \
42 printk (f, ##a); \
43 } while (0)
44#else
45#define udf_debug(f, a...) /**/
46#endif
47
48#define udf_info(f, a...) \
49 printk (KERN_INFO "UDF-fs INFO " f, ##a);
50
51#endif /* _UDF_FS_H */
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
index ffaf05679ffb..3536965913b0 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/linux/udf_fs_i.h
@@ -9,41 +9,10 @@
9 * ftp://prep.ai.mit.edu/pub/gnu/GPL 9 * ftp://prep.ai.mit.edu/pub/gnu/GPL
10 * Each contributing author retains all rights to their own work. 10 * Each contributing author retains all rights to their own work.
11 */ 11 */
12
13#ifndef _UDF_FS_I_H 12#ifndef _UDF_FS_I_H
14#define _UDF_FS_I_H 1 13#define _UDF_FS_I_H 1
15 14
16#ifdef __KERNEL__
17
18struct udf_inode_info
19{
20 struct timespec i_crtime;
21 /* Physical address of inode */
22 kernel_lb_addr i_location;
23 __u64 i_unique;
24 __u32 i_lenEAttr;
25 __u32 i_lenAlloc;
26 __u64 i_lenExtents;
27 __u32 i_next_alloc_block;
28 __u32 i_next_alloc_goal;
29 unsigned i_alloc_type : 3;
30 unsigned i_efe : 1;
31 unsigned i_use : 1;
32 unsigned i_strat4096 : 1;
33 unsigned reserved : 26;
34 union
35 {
36 short_ad *i_sad;
37 long_ad *i_lad;
38 __u8 *i_data;
39 } i_ext;
40 struct inode vfs_inode;
41};
42
43#endif
44
45/* exported IOCTLs, we have 'l', 0x40-0x7f */ 15/* exported IOCTLs, we have 'l', 0x40-0x7f */
46
47#define UDF_GETEASIZE _IOR('l', 0x40, int) 16#define UDF_GETEASIZE _IOR('l', 0x40, int)
48#define UDF_GETEABLOCK _IOR('l', 0x41, void *) 17#define UDF_GETEABLOCK _IOR('l', 0x41, void *)
49#define UDF_GETVOLIDENT _IOR('l', 0x42, void *) 18#define UDF_GETVOLIDENT _IOR('l', 0x42, void *)
diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
deleted file mode 100644
index 9bc47352b6b4..000000000000
--- a/include/linux/udf_fs_sb.h
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 * udf_fs_sb.h
3 *
4 * This include file is for the Linux kernel/module.
5 *
6 * COPYRIGHT
7 * This file is distributed under the terms of the GNU General Public
8 * License (GPL). Copies of the GPL can be obtained from:
9 * ftp://prep.ai.mit.edu/pub/gnu/GPL
10 * Each contributing author retains all rights to their own work.
11 */
12
13#ifndef _UDF_FS_SB_H
14#define _UDF_FS_SB_H 1
15
16#include <linux/mutex.h>
17
18#pragma pack(1)
19
20#define UDF_MAX_BLOCK_LOADED 8
21
22#define UDF_TYPE1_MAP15 0x1511U
23#define UDF_VIRTUAL_MAP15 0x1512U
24#define UDF_VIRTUAL_MAP20 0x2012U
25#define UDF_SPARABLE_MAP15 0x1522U
26
27struct udf_sparing_data
28{
29 __u16 s_packet_len;
30 struct buffer_head *s_spar_map[4];
31};
32
33struct udf_virtual_data
34{
35 __u32 s_num_entries;
36 __u16 s_start_offset;
37};
38
39struct udf_bitmap
40{
41 __u32 s_extLength;
42 __u32 s_extPosition;
43 __u16 s_nr_groups;
44 struct buffer_head **s_block_bitmap;
45};
46
47struct udf_part_map
48{
49 union
50 {
51 struct udf_bitmap *s_bitmap;
52 struct inode *s_table;
53 } s_uspace;
54 union
55 {
56 struct udf_bitmap *s_bitmap;
57 struct inode *s_table;
58 } s_fspace;
59 __u32 s_partition_root;
60 __u32 s_partition_len;
61 __u16 s_partition_type;
62 __u16 s_partition_num;
63 union
64 {
65 struct udf_sparing_data s_sparing;
66 struct udf_virtual_data s_virtual;
67 } s_type_specific;
68 __u32 (*s_partition_func)(struct super_block *, __u32, __u16, __u32);
69 __u16 s_volumeseqnum;
70 __u16 s_partition_flags;
71};
72
73#pragma pack()
74
75struct udf_sb_info
76{
77 struct udf_part_map *s_partmaps;
78 __u8 s_volume_ident[32];
79
80 /* Overall info */
81 __u16 s_partitions;
82 __u16 s_partition;
83
84 /* Sector headers */
85 __s32 s_session;
86 __u32 s_anchor[4];
87 __u32 s_last_block;
88
89 struct buffer_head *s_lvid_bh;
90
91 /* Default permissions */
92 mode_t s_umask;
93 gid_t s_gid;
94 uid_t s_uid;
95
96 /* Root Info */
97 struct timespec s_record_time;
98
99 /* Fileset Info */
100 __u16 s_serial_number;
101
102 /* highest UDF revision we have recorded to this media */
103 __u16 s_udfrev;
104
105 /* Miscellaneous flags */
106 __u32 s_flags;
107
108 /* Encoding info */
109 struct nls_table *s_nls_map;
110
111 /* VAT inode */
112 struct inode *s_vat_inode;
113
114 struct mutex s_alloc_mutex;
115};
116
117#endif /* _UDF_FS_SB_H */
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 8ec703f462da..581ca2c14c52 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -26,15 +26,6 @@ struct udphdr {
26 __sum16 check; 26 __sum16 check;
27}; 27};
28 28
29#ifdef __KERNEL__
30#include <linux/skbuff.h>
31
32static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
33{
34 return (struct udphdr *)skb_transport_header(skb);
35}
36#endif
37
38/* UDP socket options */ 29/* UDP socket options */
39#define UDP_CORK 1 /* Never send partially complete segments */ 30#define UDP_CORK 1 /* Never send partially complete segments */
40#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ 31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
@@ -45,9 +36,14 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
45#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ 36#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */
46 37
47#ifdef __KERNEL__ 38#ifdef __KERNEL__
48#include <linux/types.h>
49
50#include <net/inet_sock.h> 39#include <net/inet_sock.h>
40#include <linux/skbuff.h>
41
42static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
43{
44 return (struct udphdr *)skb_transport_header(skb);
45}
46
51#define UDP_HTABLE_SIZE 128 47#define UDP_HTABLE_SIZE 128
52 48
53struct udp_sock { 49struct udp_sock {
@@ -82,6 +78,7 @@ static inline struct udp_sock *udp_sk(const struct sock *sk)
82{ 78{
83 return (struct udp_sock *)sk; 79 return (struct udp_sock *)sk;
84} 80}
81
85#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag) 82#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag)
86 83
87#endif 84#endif
diff --git a/include/linux/unaligned/access_ok.h b/include/linux/unaligned/access_ok.h
new file mode 100644
index 000000000000..99c1b4d20b0f
--- /dev/null
+++ b/include/linux/unaligned/access_ok.h
@@ -0,0 +1,67 @@
1#ifndef _LINUX_UNALIGNED_ACCESS_OK_H
2#define _LINUX_UNALIGNED_ACCESS_OK_H
3
4#include <linux/kernel.h>
5#include <asm/byteorder.h>
6
7static inline u16 get_unaligned_le16(const void *p)
8{
9 return le16_to_cpup((__le16 *)p);
10}
11
12static inline u32 get_unaligned_le32(const void *p)
13{
14 return le32_to_cpup((__le32 *)p);
15}
16
17static inline u64 get_unaligned_le64(const void *p)
18{
19 return le64_to_cpup((__le64 *)p);
20}
21
22static inline u16 get_unaligned_be16(const void *p)
23{
24 return be16_to_cpup((__be16 *)p);
25}
26
27static inline u32 get_unaligned_be32(const void *p)
28{
29 return be32_to_cpup((__be32 *)p);
30}
31
32static inline u64 get_unaligned_be64(const void *p)
33{
34 return be64_to_cpup((__be64 *)p);
35}
36
37static inline void put_unaligned_le16(u16 val, void *p)
38{
39 *((__le16 *)p) = cpu_to_le16(val);
40}
41
42static inline void put_unaligned_le32(u32 val, void *p)
43{
44 *((__le32 *)p) = cpu_to_le32(val);
45}
46
47static inline void put_unaligned_le64(u64 val, void *p)
48{
49 *((__le64 *)p) = cpu_to_le64(val);
50}
51
52static inline void put_unaligned_be16(u16 val, void *p)
53{
54 *((__be16 *)p) = cpu_to_be16(val);
55}
56
57static inline void put_unaligned_be32(u32 val, void *p)
58{
59 *((__be32 *)p) = cpu_to_be32(val);
60}
61
62static inline void put_unaligned_be64(u64 val, void *p)
63{
64 *((__be64 *)p) = cpu_to_be64(val);
65}
66
67#endif /* _LINUX_UNALIGNED_ACCESS_OK_H */
diff --git a/include/linux/unaligned/be_byteshift.h b/include/linux/unaligned/be_byteshift.h
new file mode 100644
index 000000000000..46dd12c5709e
--- /dev/null
+++ b/include/linux/unaligned/be_byteshift.h
@@ -0,0 +1,70 @@
1#ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H
2#define _LINUX_UNALIGNED_BE_BYTESHIFT_H
3
4#include <linux/kernel.h>
5
6static inline u16 __get_unaligned_be16(const u8 *p)
7{
8 return p[0] << 8 | p[1];
9}
10
11static inline u32 __get_unaligned_be32(const u8 *p)
12{
13 return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
14}
15
16static inline u64 __get_unaligned_be64(const u8 *p)
17{
18 return (u64)__get_unaligned_be32(p) << 32 |
19 __get_unaligned_be32(p + 4);
20}
21
22static inline void __put_unaligned_be16(u16 val, u8 *p)
23{
24 *p++ = val >> 8;
25 *p++ = val;
26}
27
28static inline void __put_unaligned_be32(u32 val, u8 *p)
29{
30 __put_unaligned_be16(val >> 16, p);
31 __put_unaligned_be16(val, p + 2);
32}
33
34static inline void __put_unaligned_be64(u64 val, u8 *p)
35{
36 __put_unaligned_be32(val >> 32, p);
37 __put_unaligned_be32(val, p + 4);
38}
39
40static inline u16 get_unaligned_be16(const void *p)
41{
42 return __get_unaligned_be16((const u8 *)p);
43}
44
45static inline u32 get_unaligned_be32(const void *p)
46{
47 return __get_unaligned_be32((const u8 *)p);
48}
49
50static inline u64 get_unaligned_be64(const void *p)
51{
52 return __get_unaligned_be64((const u8 *)p);
53}
54
55static inline void put_unaligned_be16(u16 val, void *p)
56{
57 __put_unaligned_be16(val, p);
58}
59
60static inline void put_unaligned_be32(u32 val, void *p)
61{
62 __put_unaligned_be32(val, p);
63}
64
65static inline void put_unaligned_be64(u64 val, void *p)
66{
67 __put_unaligned_be64(val, p);
68}
69
70#endif /* _LINUX_UNALIGNED_BE_BYTESHIFT_H */
diff --git a/include/linux/unaligned/be_memmove.h b/include/linux/unaligned/be_memmove.h
new file mode 100644
index 000000000000..c2a76c5c9ed0
--- /dev/null
+++ b/include/linux/unaligned/be_memmove.h
@@ -0,0 +1,36 @@
1#ifndef _LINUX_UNALIGNED_BE_MEMMOVE_H
2#define _LINUX_UNALIGNED_BE_MEMMOVE_H
3
4#include <linux/unaligned/memmove.h>
5
6static inline u16 get_unaligned_be16(const void *p)
7{
8 return __get_unaligned_memmove16((const u8 *)p);
9}
10
11static inline u32 get_unaligned_be32(const void *p)
12{
13 return __get_unaligned_memmove32((const u8 *)p);
14}
15
16static inline u64 get_unaligned_be64(const void *p)
17{
18 return __get_unaligned_memmove64((const u8 *)p);
19}
20
21static inline void put_unaligned_be16(u16 val, void *p)
22{
23 __put_unaligned_memmove16(val, p);
24}
25
26static inline void put_unaligned_be32(u32 val, void *p)
27{
28 __put_unaligned_memmove32(val, p);
29}
30
31static inline void put_unaligned_be64(u64 val, void *p)
32{
33 __put_unaligned_memmove64(val, p);
34}
35
36#endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */
diff --git a/include/linux/unaligned/be_struct.h b/include/linux/unaligned/be_struct.h
new file mode 100644
index 000000000000..132415836c50
--- /dev/null
+++ b/include/linux/unaligned/be_struct.h
@@ -0,0 +1,36 @@
1#ifndef _LINUX_UNALIGNED_BE_STRUCT_H
2#define _LINUX_UNALIGNED_BE_STRUCT_H
3
4#include <linux/unaligned/packed_struct.h>
5
6static inline u16 get_unaligned_be16(const void *p)
7{
8 return __get_unaligned_cpu16((const u8 *)p);
9}
10
11static inline u32 get_unaligned_be32(const void *p)
12{
13 return __get_unaligned_cpu32((const u8 *)p);
14}
15
16static inline u64 get_unaligned_be64(const void *p)
17{
18 return __get_unaligned_cpu64((const u8 *)p);
19}
20
21static inline void put_unaligned_be16(u16 val, void *p)
22{
23 __put_unaligned_cpu16(val, p);
24}
25
26static inline void put_unaligned_be32(u32 val, void *p)
27{
28 __put_unaligned_cpu32(val, p);
29}
30
31static inline void put_unaligned_be64(u64 val, void *p)
32{
33 __put_unaligned_cpu64(val, p);
34}
35
36#endif /* _LINUX_UNALIGNED_BE_STRUCT_H */
diff --git a/include/linux/unaligned/generic.h b/include/linux/unaligned/generic.h
new file mode 100644
index 000000000000..02d97ff3df70
--- /dev/null
+++ b/include/linux/unaligned/generic.h
@@ -0,0 +1,68 @@
1#ifndef _LINUX_UNALIGNED_GENERIC_H
2#define _LINUX_UNALIGNED_GENERIC_H
3
4/*
5 * Cause a link-time error if we try an unaligned access other than
6 * 1,2,4 or 8 bytes long
7 */
8extern void __bad_unaligned_access_size(void);
9
10#define __get_unaligned_le(ptr) ((__force typeof(*(ptr)))({ \
11 __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \
12 __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_le16((ptr)), \
13 __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_le32((ptr)), \
14 __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_le64((ptr)), \
15 __bad_unaligned_access_size())))); \
16 }))
17
18#define __get_unaligned_be(ptr) ((__force typeof(*(ptr)))({ \
19 __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \
20 __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_be16((ptr)), \
21 __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_be32((ptr)), \
22 __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_be64((ptr)), \
23 __bad_unaligned_access_size())))); \
24 }))
25
26#define __put_unaligned_le(val, ptr) ({ \
27 void *__gu_p = (ptr); \
28 switch (sizeof(*(ptr))) { \
29 case 1: \
30 *(u8 *)__gu_p = (__force u8)(val); \
31 break; \
32 case 2: \
33 put_unaligned_le16((__force u16)(val), __gu_p); \
34 break; \
35 case 4: \
36 put_unaligned_le32((__force u32)(val), __gu_p); \
37 break; \
38 case 8: \
39 put_unaligned_le64((__force u64)(val), __gu_p); \
40 break; \
41 default: \
42 __bad_unaligned_access_size(); \
43 break; \
44 } \
45 (void)0; })
46
47#define __put_unaligned_be(val, ptr) ({ \
48 void *__gu_p = (ptr); \
49 switch (sizeof(*(ptr))) { \
50 case 1: \
51 *(u8 *)__gu_p = (__force u8)(val); \
52 break; \
53 case 2: \
54 put_unaligned_be16((__force u16)(val), __gu_p); \
55 break; \
56 case 4: \
57 put_unaligned_be32((__force u32)(val), __gu_p); \
58 break; \
59 case 8: \
60 put_unaligned_be64((__force u64)(val), __gu_p); \
61 break; \
62 default: \
63 __bad_unaligned_access_size(); \
64 break; \
65 } \
66 (void)0; })
67
68#endif /* _LINUX_UNALIGNED_GENERIC_H */
diff --git a/include/linux/unaligned/le_byteshift.h b/include/linux/unaligned/le_byteshift.h
new file mode 100644
index 000000000000..59777e951baf
--- /dev/null
+++ b/include/linux/unaligned/le_byteshift.h
@@ -0,0 +1,70 @@
1#ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H
2#define _LINUX_UNALIGNED_LE_BYTESHIFT_H
3
4#include <linux/kernel.h>
5
6static inline u16 __get_unaligned_le16(const u8 *p)
7{
8 return p[0] | p[1] << 8;
9}
10
11static inline u32 __get_unaligned_le32(const u8 *p)
12{
13 return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
14}
15
16static inline u64 __get_unaligned_le64(const u8 *p)
17{
18 return (u64)__get_unaligned_le32(p + 4) << 32 |
19 __get_unaligned_le32(p);
20}
21
22static inline void __put_unaligned_le16(u16 val, u8 *p)
23{
24 *p++ = val;
25 *p++ = val >> 8;
26}
27
28static inline void __put_unaligned_le32(u32 val, u8 *p)
29{
30 __put_unaligned_le16(val >> 16, p + 2);
31 __put_unaligned_le16(val, p);
32}
33
34static inline void __put_unaligned_le64(u64 val, u8 *p)
35{
36 __put_unaligned_le32(val >> 32, p + 4);
37 __put_unaligned_le32(val, p);
38}
39
40static inline u16 get_unaligned_le16(const void *p)
41{
42 return __get_unaligned_le16((const u8 *)p);
43}
44
45static inline u32 get_unaligned_le32(const void *p)
46{
47 return __get_unaligned_le32((const u8 *)p);
48}
49
50static inline u64 get_unaligned_le64(const void *p)
51{
52 return __get_unaligned_le64((const u8 *)p);
53}
54
55static inline void put_unaligned_le16(u16 val, void *p)
56{
57 __put_unaligned_le16(val, p);
58}
59
60static inline void put_unaligned_le32(u32 val, void *p)
61{
62 __put_unaligned_le32(val, p);
63}
64
65static inline void put_unaligned_le64(u64 val, void *p)
66{
67 __put_unaligned_le64(val, p);
68}
69
70#endif /* _LINUX_UNALIGNED_LE_BYTESHIFT_H */
diff --git a/include/linux/unaligned/le_memmove.h b/include/linux/unaligned/le_memmove.h
new file mode 100644
index 000000000000..269849bee4ec
--- /dev/null
+++ b/include/linux/unaligned/le_memmove.h
@@ -0,0 +1,36 @@
1#ifndef _LINUX_UNALIGNED_LE_MEMMOVE_H
2#define _LINUX_UNALIGNED_LE_MEMMOVE_H
3
4#include <linux/unaligned/memmove.h>
5
6static inline u16 get_unaligned_le16(const void *p)
7{
8 return __get_unaligned_memmove16((const u8 *)p);
9}
10
11static inline u32 get_unaligned_le32(const void *p)
12{
13 return __get_unaligned_memmove32((const u8 *)p);
14}
15
16static inline u64 get_unaligned_le64(const void *p)
17{
18 return __get_unaligned_memmove64((const u8 *)p);
19}
20
21static inline void put_unaligned_le16(u16 val, void *p)
22{
23 __put_unaligned_memmove16(val, p);
24}
25
26static inline void put_unaligned_le32(u32 val, void *p)
27{
28 __put_unaligned_memmove32(val, p);
29}
30
31static inline void put_unaligned_le64(u64 val, void *p)
32{
33 __put_unaligned_memmove64(val, p);
34}
35
36#endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */
diff --git a/include/linux/unaligned/le_struct.h b/include/linux/unaligned/le_struct.h
new file mode 100644
index 000000000000..088c4572faa8
--- /dev/null
+++ b/include/linux/unaligned/le_struct.h
@@ -0,0 +1,36 @@
1#ifndef _LINUX_UNALIGNED_LE_STRUCT_H
2#define _LINUX_UNALIGNED_LE_STRUCT_H
3
4#include <linux/unaligned/packed_struct.h>
5
6static inline u16 get_unaligned_le16(const void *p)
7{
8 return __get_unaligned_cpu16((const u8 *)p);
9}
10
11static inline u32 get_unaligned_le32(const void *p)
12{
13 return __get_unaligned_cpu32((const u8 *)p);
14}
15
16static inline u64 get_unaligned_le64(const void *p)
17{
18 return __get_unaligned_cpu64((const u8 *)p);
19}
20
21static inline void put_unaligned_le16(u16 val, void *p)
22{
23 __put_unaligned_cpu16(val, p);
24}
25
26static inline void put_unaligned_le32(u32 val, void *p)
27{
28 __put_unaligned_cpu32(val, p);
29}
30
31static inline void put_unaligned_le64(u64 val, void *p)
32{
33 __put_unaligned_cpu64(val, p);
34}
35
36#endif /* _LINUX_UNALIGNED_LE_STRUCT_H */
diff --git a/include/linux/unaligned/memmove.h b/include/linux/unaligned/memmove.h
new file mode 100644
index 000000000000..eeb5a779a4fd
--- /dev/null
+++ b/include/linux/unaligned/memmove.h
@@ -0,0 +1,45 @@
1#ifndef _LINUX_UNALIGNED_MEMMOVE_H
2#define _LINUX_UNALIGNED_MEMMOVE_H
3
4#include <linux/kernel.h>
5#include <linux/string.h>
6
7/* Use memmove here, so gcc does not insert a __builtin_memcpy. */
8
9static inline u16 __get_unaligned_memmove16(const void *p)
10{
11 u16 tmp;
12 memmove(&tmp, p, 2);
13 return tmp;
14}
15
16static inline u32 __get_unaligned_memmove32(const void *p)
17{
18 u32 tmp;
19 memmove(&tmp, p, 4);
20 return tmp;
21}
22
23static inline u64 __get_unaligned_memmove64(const void *p)
24{
25 u64 tmp;
26 memmove(&tmp, p, 8);
27 return tmp;
28}
29
30static inline void __put_unaligned_memmove16(u16 val, void *p)
31{
32 memmove(p, &val, 2);
33}
34
35static inline void __put_unaligned_memmove32(u32 val, void *p)
36{
37 memmove(p, &val, 4);
38}
39
40static inline void __put_unaligned_memmove64(u64 val, void *p)
41{
42 memmove(p, &val, 8);
43}
44
45#endif /* _LINUX_UNALIGNED_MEMMOVE_H */
diff --git a/include/linux/unaligned/packed_struct.h b/include/linux/unaligned/packed_struct.h
new file mode 100644
index 000000000000..2498bb9fe002
--- /dev/null
+++ b/include/linux/unaligned/packed_struct.h
@@ -0,0 +1,46 @@
1#ifndef _LINUX_UNALIGNED_PACKED_STRUCT_H
2#define _LINUX_UNALIGNED_PACKED_STRUCT_H
3
4#include <linux/kernel.h>
5
6struct __una_u16 { u16 x __attribute__((packed)); };
7struct __una_u32 { u32 x __attribute__((packed)); };
8struct __una_u64 { u64 x __attribute__((packed)); };
9
10static inline u16 __get_unaligned_cpu16(const void *p)
11{
12 const struct __una_u16 *ptr = (const struct __una_u16 *)p;
13 return ptr->x;
14}
15
16static inline u32 __get_unaligned_cpu32(const void *p)
17{
18 const struct __una_u32 *ptr = (const struct __una_u32 *)p;
19 return ptr->x;
20}
21
22static inline u64 __get_unaligned_cpu64(const void *p)
23{
24 const struct __una_u64 *ptr = (const struct __una_u64 *)p;
25 return ptr->x;
26}
27
28static inline void __put_unaligned_cpu16(u16 val, void *p)
29{
30 struct __una_u16 *ptr = (struct __una_u16 *)p;
31 ptr->x = val;
32}
33
34static inline void __put_unaligned_cpu32(u32 val, void *p)
35{
36 struct __una_u32 *ptr = (struct __una_u32 *)p;
37 ptr->x = val;
38}
39
40static inline void __put_unaligned_cpu64(u64 val, void *p)
41{
42 struct __una_u64 *ptr = (struct __una_u64 *)p;
43 ptr->x = val;
44}
45
46#endif /* _LINUX_UNALIGNED_PACKED_STRUCT_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 583e0481dfa0..c08689ea9b4b 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -23,6 +23,7 @@
23 23
24struct usb_device; 24struct usb_device;
25struct usb_driver; 25struct usb_driver;
26struct wusb_dev;
26 27
27/*-------------------------------------------------------------------------*/ 28/*-------------------------------------------------------------------------*/
28 29
@@ -341,103 +342,146 @@ struct usb_bus {
341 342
342struct usb_tt; 343struct usb_tt;
343 344
344/* 345/**
345 * struct usb_device - kernel's representation of a USB device 346 * struct usb_device - kernel's representation of a USB device
346 * 347 * @devnum: device number; address on a USB bus
347 * FIXME: Write the kerneldoc! 348 * @devpath: device ID string for use in messages (e.g., /port/...)
348 * 349 * @state: device state: configured, not attached, etc.
350 * @speed: device speed: high/full/low (or error)
351 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub
352 * @ttport: device port on that tt hub
353 * @toggle: one bit for each endpoint, with ([0] = IN, [1] = OUT) endpoints
354 * @parent: our hub, unless we're the root
355 * @bus: bus we're part of
356 * @ep0: endpoint 0 data (default control pipe)
357 * @dev: generic device interface
358 * @descriptor: USB device descriptor
359 * @config: all of the device's configs
360 * @actconfig: the active configuration
361 * @ep_in: array of IN endpoints
362 * @ep_out: array of OUT endpoints
363 * @rawdescriptors: raw descriptors for each config
364 * @bus_mA: Current available from the bus
365 * @portnum: parent port number (origin 1)
366 * @level: number of USB hub ancestors
367 * @can_submit: URBs may be submitted
368 * @discon_suspended: disconnected while suspended
369 * @persist_enabled: USB_PERSIST enabled for this device
370 * @have_langid: whether string_langid is valid
371 * @authorized: policy has said we can use it;
372 * (user space) policy determines if we authorize this device to be
373 * used or not. By default, wired USB devices are authorized.
374 * WUSB devices are not, until we authorize them from user space.
375 * FIXME -- complete doc
376 * @authenticated: Crypto authentication passed
377 * @wusb: device is Wireless USB
378 * @string_langid: language ID for strings
379 * @product: iProduct string, if present (static)
380 * @manufacturer: iManufacturer string, if present (static)
381 * @serial: iSerialNumber string, if present (static)
382 * @filelist: usbfs files that are open to this device
383 * @usb_classdev: USB class device that was created for usbfs device
384 * access from userspace
385 * @usbfs_dentry: usbfs dentry entry for the device
386 * @maxchild: number of ports if hub
387 * @children: child devices - USB devices that are attached to this hub
388 * @pm_usage_cnt: usage counter for autosuspend
389 * @quirks: quirks of the whole device
390 * @urbnum: number of URBs submitted for the whole device
391 * @active_duration: total time device is not suspended
392 * @autosuspend: for delayed autosuspends
393 * @pm_mutex: protects PM operations
394 * @last_busy: time of last use
395 * @autosuspend_delay: in jiffies
396 * @connect_time: time device was first connected
397 * @auto_pm: autosuspend/resume in progress
398 * @do_remote_wakeup: remote wakeup should be enabled
399 * @reset_resume: needs reset instead of resume
400 * @autosuspend_disabled: autosuspend disabled by the user
401 * @autoresume_disabled: autoresume disabled by the user
402 * @skip_sys_resume: skip the next system resume
403 *
404 * Notes:
349 * Usbcore drivers should not set usbdev->state directly. Instead use 405 * Usbcore drivers should not set usbdev->state directly. Instead use
350 * usb_set_device_state(). 406 * usb_set_device_state().
351 *
352 * @authorized: (user space) policy determines if we authorize this
353 * device to be used or not. By default, wired USB
354 * devices are authorized. WUSB devices are not, until we
355 * authorize them from user space. FIXME -- complete doc
356 */ 407 */
357struct usb_device { 408struct usb_device {
358 int devnum; /* Address on USB bus */ 409 int devnum;
359 char devpath [16]; /* Use in messages: /port/port/... */ 410 char devpath [16];
360 enum usb_device_state state; /* configured, not attached, etc */ 411 enum usb_device_state state;
361 enum usb_device_speed speed; /* high/full/low (or error) */ 412 enum usb_device_speed speed;
362 413
363 struct usb_tt *tt; /* low/full speed dev, highspeed hub */ 414 struct usb_tt *tt;
364 int ttport; /* device port on that tt hub */ 415 int ttport;
365 416
366 unsigned int toggle[2]; /* one bit for each endpoint 417 unsigned int toggle[2];
367 * ([0] = IN, [1] = OUT) */
368 418
369 struct usb_device *parent; /* our hub, unless we're the root */ 419 struct usb_device *parent;
370 struct usb_bus *bus; /* Bus we're part of */ 420 struct usb_bus *bus;
371 struct usb_host_endpoint ep0; 421 struct usb_host_endpoint ep0;
372 422
373 struct device dev; /* Generic device interface */ 423 struct device dev;
374 424
375 struct usb_device_descriptor descriptor;/* Descriptor */ 425 struct usb_device_descriptor descriptor;
376 struct usb_host_config *config; /* All of the configs */ 426 struct usb_host_config *config;
377 427
378 struct usb_host_config *actconfig;/* the active configuration */ 428 struct usb_host_config *actconfig;
379 struct usb_host_endpoint *ep_in[16]; 429 struct usb_host_endpoint *ep_in[16];
380 struct usb_host_endpoint *ep_out[16]; 430 struct usb_host_endpoint *ep_out[16];
381 431
382 char **rawdescriptors; /* Raw descriptors for each config */ 432 char **rawdescriptors;
383 433
384 unsigned short bus_mA; /* Current available from the bus */ 434 unsigned short bus_mA;
385 u8 portnum; /* Parent port number (origin 1) */ 435 u8 portnum;
386 u8 level; /* Number of USB hub ancestors */ 436 u8 level;
387 437
388 unsigned can_submit:1; /* URBs may be submitted */ 438 unsigned can_submit:1;
389 unsigned discon_suspended:1; /* Disconnected while suspended */ 439 unsigned discon_suspended:1;
390 unsigned have_langid:1; /* whether string_langid is valid */ 440 unsigned persist_enabled:1;
391 unsigned authorized:1; /* Policy has said we can use it */ 441 unsigned have_langid:1;
392 unsigned wusb:1; /* Device is Wireless USB */ 442 unsigned authorized:1;
393 int string_langid; /* language ID for strings */ 443 unsigned authenticated:1;
444 unsigned wusb:1;
445 int string_langid;
394 446
395 /* static strings from the device */ 447 /* static strings from the device */
396 char *product; /* iProduct string, if present */ 448 char *product;
397 char *manufacturer; /* iManufacturer string, if present */ 449 char *manufacturer;
398 char *serial; /* iSerialNumber string, if present */ 450 char *serial;
399 451
400 struct list_head filelist; 452 struct list_head filelist;
401#ifdef CONFIG_USB_DEVICE_CLASS 453#ifdef CONFIG_USB_DEVICE_CLASS
402 struct device *usb_classdev; 454 struct device *usb_classdev;
403#endif 455#endif
404#ifdef CONFIG_USB_DEVICEFS 456#ifdef CONFIG_USB_DEVICEFS
405 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 457 struct dentry *usbfs_dentry;
406#endif 458#endif
407 /*
408 * Child devices - these can be either new devices
409 * (if this is a hub device), or different instances
410 * of this same device.
411 *
412 * Each instance needs its own set of data structures.
413 */
414 459
415 int maxchild; /* Number of ports if hub */ 460 int maxchild;
416 struct usb_device *children[USB_MAXCHILDREN]; 461 struct usb_device *children[USB_MAXCHILDREN];
417 462
418 int pm_usage_cnt; /* usage counter for autosuspend */ 463 int pm_usage_cnt;
419 u32 quirks; /* quirks of the whole device */ 464 u32 quirks;
420 atomic_t urbnum; /* number of URBs submitted for 465 atomic_t urbnum;
421 the whole device */
422 466
423 unsigned long active_duration; /* total time device is not suspended */ 467 unsigned long active_duration;
424 468
425#ifdef CONFIG_PM 469#ifdef CONFIG_PM
426 struct delayed_work autosuspend; /* for delayed autosuspends */ 470 struct delayed_work autosuspend;
427 struct mutex pm_mutex; /* protects PM operations */ 471 struct mutex pm_mutex;
428 472
429 unsigned long last_busy; /* time of last use */ 473 unsigned long last_busy;
430 int autosuspend_delay; /* in jiffies */ 474 int autosuspend_delay;
431 unsigned long connect_time; /* time device was first connected */ 475 unsigned long connect_time;
432 476
433 unsigned auto_pm:1; /* autosuspend/resume in progress */ 477 unsigned auto_pm:1;
434 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ 478 unsigned do_remote_wakeup:1;
435 unsigned reset_resume:1; /* needs reset instead of resume */ 479 unsigned reset_resume:1;
436 unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */ 480 unsigned autosuspend_disabled:1;
437 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ 481 unsigned autoresume_disabled:1;
438 unsigned autoresume_disabled:1; /* disabled by the user */ 482 unsigned skip_sys_resume:1;
439 unsigned skip_sys_resume:1; /* skip the next system resume */
440#endif 483#endif
484 struct wusb_dev *wusb_dev;
441}; 485};
442#define to_usb_device(d) container_of(d, struct usb_device, dev) 486#define to_usb_device(d) container_of(d, struct usb_device, dev)
443 487
@@ -898,10 +942,11 @@ struct usbdrv_wrap {
898 * and should normally be the same as the module name. 942 * and should normally be the same as the module name.
899 * @probe: Called to see if the driver is willing to manage a particular 943 * @probe: Called to see if the driver is willing to manage a particular
900 * interface on a device. If it is, probe returns zero and uses 944 * interface on a device. If it is, probe returns zero and uses
901 * dev_set_drvdata() to associate driver-specific data with the 945 * usb_set_intfdata() to associate driver-specific data with the
902 * interface. It may also use usb_set_interface() to specify the 946 * interface. It may also use usb_set_interface() to specify the
903 * appropriate altsetting. If unwilling to manage the interface, 947 * appropriate altsetting. If unwilling to manage the interface,
904 * return a negative errno value. 948 * return -ENODEV, if genuine IO errors occured, an appropriate
949 * negative errno value.
905 * @disconnect: Called when the interface is no longer accessible, usually 950 * @disconnect: Called when the interface is no longer accessible, usually
906 * because its device has been (or is being) disconnected or the 951 * because its device has been (or is being) disconnected or the
907 * driver module is being unloaded. 952 * driver module is being unloaded.
@@ -916,10 +961,7 @@ struct usbdrv_wrap {
916 * @pre_reset: Called by usb_reset_composite_device() when the device 961 * @pre_reset: Called by usb_reset_composite_device() when the device
917 * is about to be reset. 962 * is about to be reset.
918 * @post_reset: Called by usb_reset_composite_device() after the device 963 * @post_reset: Called by usb_reset_composite_device() after the device
919 * has been reset, or in lieu of @resume following a reset-resume 964 * has been reset
920 * (i.e., the device is reset instead of being resumed, as might
921 * happen if power was lost). The second argument tells which is
922 * the reason.
923 * @id_table: USB drivers use ID table to support hotplugging. 965 * @id_table: USB drivers use ID table to support hotplugging.
924 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set 966 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
925 * or your driver's probe function will never get called. 967 * or your driver's probe function will never get called.
@@ -1411,6 +1453,7 @@ extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
1411extern int usb_unlink_urb(struct urb *urb); 1453extern int usb_unlink_urb(struct urb *urb);
1412extern void usb_kill_urb(struct urb *urb); 1454extern void usb_kill_urb(struct urb *urb);
1413extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1455extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1456extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1414extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1457extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1415extern void usb_unanchor_urb(struct urb *urb); 1458extern void usb_unanchor_urb(struct urb *urb);
1416extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, 1459extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
@@ -1661,13 +1704,12 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1661#define dbg(format, arg...) do {} while (0) 1704#define dbg(format, arg...) do {} while (0)
1662#endif 1705#endif
1663 1706
1664#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ 1707#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
1665 __FILE__ , ## arg) 1708 format "\n" , ## arg)
1666#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , \ 1709#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \
1667 __FILE__ , ## arg) 1710 format "\n" , ## arg)
1668#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , \ 1711#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \
1669 __FILE__ , ## arg) 1712 format "\n" , ## arg)
1670
1671 1713
1672#endif /* __KERNEL__ */ 1714#endif /* __KERNEL__ */
1673 1715
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h
new file mode 100644
index 000000000000..6311fa2d9f82
--- /dev/null
+++ b/include/linux/usb/atmel_usba_udc.h
@@ -0,0 +1,22 @@
1/*
2 * Platform data definitions for Atmel USBA gadget driver.
3 */
4#ifndef __LINUX_USB_USBA_H
5#define __LINUX_USB_USBA_H
6
7struct usba_ep_data {
8 char *name;
9 int index;
10 int fifo_size;
11 int nr_banks;
12 int can_dma;
13 int can_isoc;
14};
15
16struct usba_platform_data {
17 int vbus_pin;
18 int num_ep;
19 struct usba_ep_data ep[0];
20};
21
22#endif /* __LINUX_USB_USBA_H */
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index 2dfeef16b221..8cb025fef634 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -50,4 +50,4 @@ struct usb_ac_header_descriptor_##n { \
50 __u8 baInterfaceNr[n]; \ 50 __u8 baInterfaceNr[n]; \
51} __attribute__ ((packed)) 51} __attribute__ ((packed))
52 52
53#endif 53#endif /* __LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 94ee4ecf0564..71e52f2f6a38 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -6,6 +6,9 @@
6 * firmware based USB peripherals. 6 * firmware based USB peripherals.
7 */ 7 */
8 8
9#ifndef __LINUX_USB_CDC_H
10#define __LINUX_USB_CDC_H
11
9#define USB_CDC_SUBCLASS_ACM 0x02 12#define USB_CDC_SUBCLASS_ACM 0x02
10#define USB_CDC_SUBCLASS_ETHERNET 0x06 13#define USB_CDC_SUBCLASS_ETHERNET 0x06
11#define USB_CDC_SUBCLASS_WHCM 0x08 14#define USB_CDC_SUBCLASS_WHCM 0x08
@@ -221,3 +224,4 @@ struct usb_cdc_notification {
221 __le16 wLength; 224 __le16 wLength;
222} __attribute__ ((packed)); 225} __attribute__ ((packed));
223 226
227#endif /* __LINUX_USB_CDC_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 6169438ec5a2..7e0d3084f76c 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -66,8 +66,8 @@
66#define USB_RECIP_ENDPOINT 0x02 66#define USB_RECIP_ENDPOINT 0x02
67#define USB_RECIP_OTHER 0x03 67#define USB_RECIP_OTHER 0x03
68/* From Wireless USB 1.0 */ 68/* From Wireless USB 1.0 */
69#define USB_RECIP_PORT 0x04 69#define USB_RECIP_PORT 0x04
70#define USB_RECIP_RPIPE 0x05 70#define USB_RECIP_RPIPE 0x05
71 71
72/* 72/*
73 * Standard requests, for the bRequest field of a SETUP packet. 73 * Standard requests, for the bRequest field of a SETUP packet.
@@ -102,10 +102,16 @@
102#define USB_REQ_LOOPBACK_DATA_READ 0x16 102#define USB_REQ_LOOPBACK_DATA_READ 0x16
103#define USB_REQ_SET_INTERFACE_DS 0x17 103#define USB_REQ_SET_INTERFACE_DS 0x17
104 104
105/* The Link Power Mangement (LPM) ECN defines USB_REQ_TEST_AND_SET command,
106 * used by hubs to put ports into a new L1 suspend state, except that it
107 * forgot to define its number ...
108 */
109
105/* 110/*
106 * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and 111 * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
107 * are read as a bit array returned by USB_REQ_GET_STATUS. (So there 112 * are read as a bit array returned by USB_REQ_GET_STATUS. (So there
108 * are at most sixteen features of each type.) 113 * are at most sixteen features of each type.) Hubs may also support a
114 * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
109 */ 115 */
110#define USB_DEVICE_SELF_POWERED 0 /* (read only) */ 116#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
111#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */ 117#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
@@ -180,6 +186,7 @@ struct usb_ctrlrequest {
180#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 186#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
181#define USB_DT_WIRE_ADAPTER 0x21 187#define USB_DT_WIRE_ADAPTER 0x21
182#define USB_DT_RPIPE 0x22 188#define USB_DT_RPIPE 0x22
189#define USB_DT_CS_RADIO_CONTROL 0x23
183 190
184/* Conventional codes for class-specific descriptors. The convention is 191/* Conventional codes for class-specific descriptors. The convention is
185 * defined in the USB "Common Class" Spec (3.11). Individual class specs 192 * defined in the USB "Common Class" Spec (3.11). Individual class specs
@@ -574,7 +581,9 @@ enum usb_device_state {
574 /* NOTE: there are actually four different SUSPENDED 581 /* NOTE: there are actually four different SUSPENDED
575 * states, returning to POWERED, DEFAULT, ADDRESS, or 582 * states, returning to POWERED, DEFAULT, ADDRESS, or
576 * CONFIGURED respectively when SOF tokens flow again. 583 * CONFIGURED respectively when SOF tokens flow again.
584 * At this level there's no difference between L1 and L2
585 * suspend states. (L2 being original USB 1.1 suspend.)
577 */ 586 */
578}; 587};
579 588
580#endif /* __LINUX_USB_CH9_H */ 589#endif /* __LINUX_USB_CH9_H */
diff --git a/include/linux/usb/g_printer.h b/include/linux/usb/g_printer.h
index 0c5ea1e3eb98..6178fde50f74 100644
--- a/include/linux/usb/g_printer.h
+++ b/include/linux/usb/g_printer.h
@@ -18,6 +18,8 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21#ifndef __LINUX_USB_G_PRINTER_H
22#define __LINUX_USB_G_PRINTER_H
21 23
22#define PRINTER_NOT_ERROR 0x08 24#define PRINTER_NOT_ERROR 0x08
23#define PRINTER_SELECTED 0x10 25#define PRINTER_SELECTED 0x10
@@ -29,3 +31,5 @@
29 */ 31 */
30#define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char) 32#define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char)
31#define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char) 33#define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char)
34
35#endif /* __LINUX_USB_G_PRINTER_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index f3295296b435..d8128f7102c9 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -846,4 +846,4 @@ extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
846 846
847extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit; 847extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit;
848 848
849#endif /* __LINUX_USB_GADGET_H */ 849#endif /* __LINUX_USB_GADGET_H */
diff --git a/include/linux/usb/gadgetfs.h b/include/linux/usb/gadgetfs.h
index c291ab1af747..ea45f265ec05 100644
--- a/include/linux/usb/gadgetfs.h
+++ b/include/linux/usb/gadgetfs.h
@@ -1,11 +1,3 @@
1#ifndef __LINUX_USB_GADGETFS_H
2#define __LINUX_USB_GADGETFS_H
3
4#include <asm/types.h>
5#include <asm/ioctl.h>
6
7#include <linux/usb/ch9.h>
8
9/* 1/*
10 * Filesystem based user-mode API to USB Gadget controller hardware 2 * Filesystem based user-mode API to USB Gadget controller hardware
11 * 3 *
@@ -23,6 +15,14 @@
23 * then performing data transfers by reading or writing. 15 * then performing data transfers by reading or writing.
24 */ 16 */
25 17
18#ifndef __LINUX_USB_GADGETFS_H
19#define __LINUX_USB_GADGETFS_H
20
21#include <asm/types.h>
22#include <asm/ioctl.h>
23
24#include <linux/usb/ch9.h>
25
26/* 26/*
27 * Events are delivered on the ep0 file descriptor, when the user mode driver 27 * Events are delivered on the ep0 file descriptor, when the user mode driver
28 * reads from this file descriptor after writing the descriptors. Don't 28 * reads from this file descriptor after writing the descriptors. Don't
diff --git a/include/linux/usb/input.h b/include/linux/usb/input.h
index 716e0cc16043..0e010b220e85 100644
--- a/include/linux/usb/input.h
+++ b/include/linux/usb/input.h
@@ -1,6 +1,3 @@
1#ifndef __USB_INPUT_H
2#define __USB_INPUT_H
3
4/* 1/*
5 * Copyright (C) 2005 Dmitry Torokhov 2 * Copyright (C) 2005 Dmitry Torokhov
6 * 3 *
@@ -9,6 +6,9 @@
9 * the Free Software Foundation. 6 * the Free Software Foundation.
10 */ 7 */
11 8
9#ifndef __LINUX_USB_INPUT_H
10#define __LINUX_USB_INPUT_H
11
12#include <linux/usb.h> 12#include <linux/usb.h>
13#include <linux/input.h> 13#include <linux/input.h>
14#include <asm/byteorder.h> 14#include <asm/byteorder.h>
@@ -22,4 +22,4 @@ usb_to_input_id(const struct usb_device *dev, struct input_id *id)
22 id->version = le16_to_cpu(dev->descriptor.bcdDevice); 22 id->version = le16_to_cpu(dev->descriptor.bcdDevice);
23} 23}
24 24
25#endif 25#endif /* __LINUX_USB_INPUT_H */
diff --git a/include/linux/usb/iowarrior.h b/include/linux/usb/iowarrior.h
index de6f380e17a2..4fd6513d564c 100644
--- a/include/linux/usb/iowarrior.h
+++ b/include/linux/usb/iowarrior.h
@@ -1,5 +1,5 @@
1#ifndef _IOWARRIOR_H_ 1#ifndef __LINUX_USB_IOWARRIOR_H
2#define _IOWARRIOR_H_ 2#define __LINUX_USB_IOWARRIOR_H
3 3
4#define CODEMERCS_MAGIC_NUMBER 0xC0 /* like COde Mercenaries */ 4#define CODEMERCS_MAGIC_NUMBER 0xC0 /* like COde Mercenaries */
5 5
@@ -39,4 +39,4 @@ struct iowarrior_info {
39*/ 39*/
40#define IOW_GETINFO _IOR(CODEMERCS_MAGIC_NUMBER, 3, struct iowarrior_info) 40#define IOW_GETINFO _IOR(CODEMERCS_MAGIC_NUMBER, 3, struct iowarrior_info)
41 41
42#endif /* _IOWARRIOR_H_ */ 42#endif /* __LINUX_USB_IOWARRIOR_H */
diff --git a/include/linux/usb/isp116x.h b/include/linux/usb/isp116x.h
index 67d2826f34fe..96ca114e88d0 100644
--- a/include/linux/usb/isp116x.h
+++ b/include/linux/usb/isp116x.h
@@ -1,9 +1,11 @@
1
2/* 1/*
3 * Board initialization code should put one of these into dev->platform_data 2 * Board initialization code should put one of these into dev->platform_data
4 * and place the isp116x onto platform_bus. 3 * and place the isp116x onto platform_bus.
5 */ 4 */
6 5
6#ifndef __LINUX_USB_ISP116X_H
7#define __LINUX_USB_ISP116X_H
8
7struct isp116x_platform_data { 9struct isp116x_platform_data {
8 /* Enable internal resistors on downstream ports */ 10 /* Enable internal resistors on downstream ports */
9 unsigned sel15Kres:1; 11 unsigned sel15Kres:1;
@@ -27,3 +29,5 @@ struct isp116x_platform_data {
27 */ 29 */
28 void (*delay) (struct device *dev, int delay); 30 void (*delay) (struct device *dev, int delay);
29}; 31};
32
33#endif /* __LINUX_USB_ISP116X_H */
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h
index 80624c562921..1d1040865661 100644
--- a/include/linux/usb/midi.h
+++ b/include/linux/usb/midi.h
@@ -109,4 +109,4 @@ struct usb_ms_endpoint_descriptor_##n { \
109 __u8 baAssocJackID[n]; \ 109 __u8 baAssocJackID[n]; \
110} __attribute__ ((packed)) 110} __attribute__ ((packed))
111 111
112#endif 112#endif /* __LINUX_USB_MIDI_H */
diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h
index ec897cb844ab..96ca549a778d 100644
--- a/include/linux/usb/net2280.h
+++ b/include/linux/usb/net2280.h
@@ -1,11 +1,7 @@
1/* 1/*
2 * NetChip 2280 high/full speed USB device controller. 2 * NetChip 2280 high/full speed USB device controller.
3 * Unlike many such controllers, this one talks PCI. 3 * Unlike many such controllers, this one talks PCI.
4 */ 4 *
5#ifndef __LINUX_USB_NET2280_H
6#define __LINUX_USB_NET2280_H
7
8/*
9 * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com) 5 * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
10 * Copyright (C) 2003 David Brownell 6 * Copyright (C) 2003 David Brownell
11 * 7 *
@@ -24,6 +20,9 @@
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */ 21 */
26 22
23#ifndef __LINUX_USB_NET2280_H
24#define __LINUX_USB_NET2280_H
25
27/*-------------------------------------------------------------------------*/ 26/*-------------------------------------------------------------------------*/
28 27
29/* NET2280 MEMORY MAPPED REGISTERS 28/* NET2280 MEMORY MAPPED REGISTERS
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index e007074ebe41..1db25d152ad8 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -1,11 +1,13 @@
1/* USB OTG (On The Go) defines */ 1/* USB OTG (On The Go) defines */
2
3/* 2/*
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
5 * (for either host or peripheral roles) don't use these calls; they 5 * (for either host or peripheral roles) don't use these calls; they
6 * continue to use just usb_device and usb_gadget. 6 * continue to use just usb_device and usb_gadget.
7 */ 7 */
8 8
9#ifndef __LINUX_USB_OTG_H
10#define __LINUX_USB_OTG_H
9 11
10/* OTG defines lots of enumeration states before device reset */ 12/* OTG defines lots of enumeration states before device reset */
11enum usb_otg_state { 13enum usb_otg_state {
@@ -129,3 +131,5 @@ otg_start_srp(struct otg_transceiver *otg)
129 131
130/* for OTG controller drivers (and maybe other stuff) */ 132/* for OTG controller drivers (and maybe other stuff) */
131extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 133extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
134
135#endif /* __LINUX_USB_OTG_H */
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 1f999ec8d08c..7f6c603db654 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -4,6 +4,9 @@
4 * belong here. 4 * belong here.
5 */ 5 */
6 6
7#ifndef __LINUX_USB_QUIRKS_H
8#define __LINUX_USB_QUIRKS_H
9
7/* string descriptors must not be fetched using a 255-byte read */ 10/* string descriptors must not be fetched using a 255-byte read */
8#define USB_QUIRK_STRING_FETCH_255 0x00000001 11#define USB_QUIRK_STRING_FETCH_255 0x00000001
9 12
@@ -12,3 +15,5 @@
12 15
13/* device can't handle Set-Interface requests */ 16/* device can't handle Set-Interface requests */
14#define USB_QUIRK_NO_SET_INTF 0x00000004 17#define USB_QUIRK_NO_SET_INTF 0x00000004
18
19#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index edc1d4a0e272..29d6458ecb8d 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -17,10 +17,8 @@
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19 19
20 20#ifndef __LINUX_USB_RNDIS_HOST_H
21#ifndef __RNDIS_HOST_H 21#define __LINUX_USB_RNDIS_HOST_H
22#define __RNDIS_HOST_H
23
24 22
25/* 23/*
26 * CONTROL uses CDC "encapsulated commands" with funky notifications. 24 * CONTROL uses CDC "encapsulated commands" with funky notifications.
@@ -270,5 +268,4 @@ extern int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb);
270extern struct sk_buff * 268extern struct sk_buff *
271rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags); 269rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
272 270
273#endif /* __RNDIS_HOST_H */ 271#endif /* __LINUX_USB_RNDIS_HOST_H */
274
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 21b4a1c6f585..8f891cbaf9ab 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -10,7 +10,6 @@
10 * 10 *
11 */ 11 */
12 12
13
14#ifndef __LINUX_USB_SERIAL_H 13#ifndef __LINUX_USB_SERIAL_H
15#define __LINUX_USB_SERIAL_H 14#define __LINUX_USB_SERIAL_H
16 15
@@ -146,8 +145,6 @@ struct usb_serial {
146}; 145};
147#define to_usb_serial(d) container_of(d, struct usb_serial, kref) 146#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
148 147
149#define NUM_DONT_CARE 99
150
151/* get and set the serial private data pointer helper functions */ 148/* get and set the serial private data pointer helper functions */
152static inline void *usb_get_serial_data(struct usb_serial *serial) 149static inline void *usb_get_serial_data(struct usb_serial *serial)
153{ 150{
@@ -165,18 +162,6 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
165 * used in the syslog messages when a device is inserted or removed. 162 * used in the syslog messages when a device is inserted or removed.
166 * @id_table: pointer to a list of usb_device_id structures that define all 163 * @id_table: pointer to a list of usb_device_id structures that define all
167 * of the devices this structure can support. 164 * of the devices this structure can support.
168 * @num_interrupt_in: If a device doesn't have this many interrupt-in
169 * endpoints, it won't be sent to the driver's attach() method.
170 * (But it might still be sent to the probe() method.)
171 * @num_interrupt_out: If a device doesn't have this many interrupt-out
172 * endpoints, it won't be sent to the driver's attach() method.
173 * (But it might still be sent to the probe() method.)
174 * @num_bulk_in: If a device doesn't have this many bulk-in
175 * endpoints, it won't be sent to the driver's attach() method.
176 * (But it might still be sent to the probe() method.)
177 * @num_bulk_out: If a device doesn't have this many bulk-out
178 * endpoints, it won't be sent to the driver's attach() method.
179 * (But it might still be sent to the probe() method.)
180 * @num_ports: the number of different ports this device will have. 165 * @num_ports: the number of different ports this device will have.
181 * @calc_num_ports: pointer to a function to determine how many ports this 166 * @calc_num_ports: pointer to a function to determine how many ports this
182 * device has dynamically. It will be called after the probe() 167 * device has dynamically. It will be called after the probe()
@@ -212,10 +197,6 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
212struct usb_serial_driver { 197struct usb_serial_driver {
213 const char *description; 198 const char *description;
214 const struct usb_device_id *id_table; 199 const struct usb_device_id *id_table;
215 char num_interrupt_in;
216 char num_interrupt_out;
217 char num_bulk_in;
218 char num_bulk_out;
219 char num_ports; 200 char num_ports;
220 201
221 struct list_head driver_list; 202 struct list_head driver_list;
@@ -340,5 +321,5 @@ static inline void usb_serial_debug_data(int debug,
340 321
341 322
342 323
343#endif /* ifdef __LINUX_USB_SERIAL_H */ 324#endif /* __LINUX_USB_SERIAL_H */
344 325
diff --git a/include/linux/usb/sl811.h b/include/linux/usb/sl811.h
index 877373da410d..3afe4d16fcef 100644
--- a/include/linux/usb/sl811.h
+++ b/include/linux/usb/sl811.h
@@ -1,9 +1,11 @@
1
2/* 1/*
3 * board initialization should put one of these into dev->platform_data 2 * board initialization should put one of these into dev->platform_data
4 * and place the sl811hs onto platform_bus named "sl811-hcd". 3 * and place the sl811hs onto platform_bus named "sl811-hcd".
5 */ 4 */
6 5
6#ifndef __LINUX_USB_SL811_H
7#define __LINUX_USB_SL811_H
8
7struct sl811_platform_data { 9struct sl811_platform_data {
8 unsigned can_wakeup:1; 10 unsigned can_wakeup:1;
9 11
@@ -24,3 +26,4 @@ struct sl811_platform_data {
24 /* void (*clock_enable)(struct device *dev, int is_on); */ 26 /* void (*clock_enable)(struct device *dev, int is_on); */
25}; 27};
26 28
29#endif /* __LINUX_USB_SL811_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index e0501da3dd11..ba09fe88adda 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -19,10 +19,8 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22 22#ifndef __LINUX_USB_USBNET_H
23#ifndef __USBNET_H 23#define __LINUX_USB_USBNET_H
24#define __USBNET_H
25
26 24
27/* interface from usbnet core to each USB networking link we handle */ 25/* interface from usbnet core to each USB networking link we handle */
28struct usbnet { 26struct usbnet {
@@ -211,4 +209,4 @@ extern int usbnet_nway_reset(struct net_device *net);
211 printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg); \ 209 printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg); \
212 210
213 211
214#endif /* __USBNET_H */ 212#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 0a40dfa44c9f..d9a3bbe38e6b 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -85,6 +85,7 @@ enum { US_DO_ALL_FLAGS };
85#define US_SC_LOCKABLE 0x07 /* Password-protected */ 85#define US_SC_LOCKABLE 0x07 /* Password-protected */
86 86
87#define US_SC_ISD200 0xf0 /* ISD200 ATA */ 87#define US_SC_ISD200 0xf0 /* ISD200 ATA */
88#define US_SC_CYP_ATACB 0xf1 /* Cypress ATACB */
88#define US_SC_DEVICE 0xff /* Use device's value */ 89#define US_SC_DEVICE 0xff /* Use device's value */
89 90
90/* Protocols */ 91/* Protocols */
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 17cb108b7db0..3118ede2c67b 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -77,8 +77,11 @@ struct usbdevfs_connectinfo {
77 unsigned char slow; 77 unsigned char slow;
78}; 78};
79 79
80#define USBDEVFS_URB_SHORT_NOT_OK 1 80#define USBDEVFS_URB_SHORT_NOT_OK 0x01
81#define USBDEVFS_URB_ISO_ASAP 2 81#define USBDEVFS_URB_ISO_ASAP 0x02
82#define USBDEVFS_URB_NO_FSBR 0x20
83#define USBDEVFS_URB_ZERO_PACKET 0x40
84#define USBDEVFS_URB_NO_INTERRUPT 0x80
82 85
83#define USBDEVFS_URB_TYPE_ISO 0 86#define USBDEVFS_URB_TYPE_ISO 0
84#define USBDEVFS_URB_TYPE_INTERRUPT 1 87#define USBDEVFS_URB_TYPE_INTERRUPT 1
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 17a80177a674..c1411189ba6c 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -282,6 +282,7 @@ struct v4l2_pix_format
282#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */ 282#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */
283#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */ 283#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */
284#define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */ 284#define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */
285#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y','1','6',' ') /* 16 Greyscale */
285#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P','A','L','8') /* 8 8-bit palette */ 286#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P','A','L','8') /* 8 8-bit palette */
286#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ 287#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */
287#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ 288#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */
@@ -308,6 +309,7 @@ struct v4l2_pix_format
308 309
309/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 310/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
310#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ 311#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */
312#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B','Y','R','2') /* 16 BGBG.. GRGR.. */
311 313
312/* compressed formats */ 314/* compressed formats */
313#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */ 315#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */
@@ -793,6 +795,7 @@ struct v4l2_ext_controls
793/* Values for ctrl_class field */ 795/* Values for ctrl_class field */
794#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ 796#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
795#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ 797#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
798#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
796 799
797#define V4L2_CTRL_ID_MASK (0x0fffffff) 800#define V4L2_CTRL_ID_MASK (0x0fffffff)
798#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 801#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -849,21 +852,37 @@ struct v4l2_querymenu
849#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) 852#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8)
850#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) 853#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9)
851#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) 854#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10)
852#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) 855#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */
853#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) 856#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12)
854#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) 857#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13)
855#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) 858#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14)
856#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) 859#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15)
857#define V4L2_CID_GAMMA (V4L2_CID_BASE+16) 860#define V4L2_CID_GAMMA (V4L2_CID_BASE+16)
858#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* ? Not sure */ 861#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */
859#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) 862#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17)
860#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) 863#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18)
861#define V4L2_CID_GAIN (V4L2_CID_BASE+19) 864#define V4L2_CID_GAIN (V4L2_CID_BASE+19)
862#define V4L2_CID_HFLIP (V4L2_CID_BASE+20) 865#define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
863#define V4L2_CID_VFLIP (V4L2_CID_BASE+21) 866#define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
864#define V4L2_CID_HCENTER (V4L2_CID_BASE+22) 867
865#define V4L2_CID_VCENTER (V4L2_CID_BASE+23) 868/* Deprecated, use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
866#define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */ 869#define V4L2_CID_HCENTER_DEPRECATED (V4L2_CID_BASE+22)
870#define V4L2_CID_VCENTER_DEPRECATED (V4L2_CID_BASE+23)
871
872#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
873enum v4l2_power_line_frequency {
874 V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0,
875 V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1,
876 V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2,
877};
878#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25)
879#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26)
880#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
881#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
882#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
883#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
884/* last CID + 1 */
885#define V4L2_CID_LASTP1 (V4L2_CID_BASE+31)
867 886
868/* MPEG-class control IDs defined by V4L2 */ 887/* MPEG-class control IDs defined by V4L2 */
869#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 888#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1051,6 +1070,32 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type {
1051#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) 1070#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
1052#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) 1071#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
1053 1072
1073/* Camera class control IDs */
1074#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
1075#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
1076
1077#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1)
1078enum v4l2_exposure_auto_type {
1079 V4L2_EXPOSURE_AUTO = 0,
1080 V4L2_EXPOSURE_MANUAL = 1,
1081 V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
1082 V4L2_EXPOSURE_APERTURE_PRIORITY = 3
1083};
1084#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2)
1085#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3)
1086
1087#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4)
1088#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5)
1089#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6)
1090#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7)
1091
1092#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8)
1093#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9)
1094
1095#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10)
1096#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
1097#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
1098
1054/* 1099/*
1055 * T U N I N G 1100 * T U N I N G
1056 */ 1101 */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index ce8e7da05807..364789aae9f3 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -31,6 +31,7 @@ struct vm_struct {
31 struct page **pages; 31 struct page **pages;
32 unsigned int nr_pages; 32 unsigned int nr_pages;
33 unsigned long phys_addr; 33 unsigned long phys_addr;
34 void *caller;
34}; 35};
35 36
36/* 37/*
@@ -66,6 +67,8 @@ static inline size_t get_vm_area_size(const struct vm_struct *area)
66} 67}
67 68
68extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags); 69extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
70extern struct vm_struct *get_vm_area_caller(unsigned long size,
71 unsigned long flags, void *caller);
69extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 72extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
70 unsigned long start, unsigned long end); 73 unsigned long start, unsigned long end);
71extern struct vm_struct *get_vm_area_node(unsigned long size, 74extern struct vm_struct *get_vm_area_node(unsigned long size,
@@ -87,4 +90,6 @@ extern void free_vm_area(struct vm_struct *area);
87extern rwlock_t vmlist_lock; 90extern rwlock_t vmlist_lock;
88extern struct vm_struct *vmlist; 91extern struct vm_struct *vmlist;
89 92
93extern const struct seq_operations vmalloc_op;
94
90#endif /* _LINUX_VMALLOC_H */ 95#endif /* _LINUX_VMALLOC_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 9f1b4b46151e..e83b69346d23 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -25,6 +25,7 @@
25#define HIGHMEM_ZONE(xx) 25#define HIGHMEM_ZONE(xx)
26#endif 26#endif
27 27
28
28#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) , xx##_MOVABLE 29#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) , xx##_MOVABLE
29 30
30enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, 31enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
@@ -37,6 +38,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
37 FOR_ALL_ZONES(PGSCAN_DIRECT), 38 FOR_ALL_ZONES(PGSCAN_DIRECT),
38 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, 39 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
39 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 40 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
41#ifdef CONFIG_HUGETLB_PAGE
42 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
43#endif
40 NR_VM_EVENT_ITEMS 44 NR_VM_EVENT_ITEMS
41}; 45};
42 46
@@ -174,7 +178,7 @@ static inline unsigned long node_page_state(int node,
174 zone_page_state(&zones[ZONE_MOVABLE], item); 178 zone_page_state(&zones[ZONE_MOVABLE], item);
175} 179}
176 180
177extern void zone_statistics(struct zonelist *, struct zone *); 181extern void zone_statistics(struct zone *, struct zone *);
178 182
179#else 183#else
180 184
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 3160dfed73ca..2864b1699ecc 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -455,6 +455,7 @@
455#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ 455#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */
456#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ 456#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */
457#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ 457#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */
458#define IW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */
458 459
459/* Statistics flags (bitmask in updated) */ 460/* Statistics flags (bitmask in updated) */
460#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */ 461#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */
diff --git a/include/linux/wm97xx.h b/include/linux/wm97xx.h
new file mode 100644
index 000000000000..4d13732e9cf0
--- /dev/null
+++ b/include/linux/wm97xx.h
@@ -0,0 +1,314 @@
1
2/*
3 * Register bits and API for Wolfson WM97xx series of codecs
4 */
5
6#ifndef _LINUX_WM97XX_H
7#define _LINUX_WM97XX_H
8
9#include <sound/core.h>
10#include <sound/pcm.h>
11#include <sound/ac97_codec.h>
12#include <sound/initval.h>
13#include <linux/types.h>
14#include <linux/list.h>
15#include <linux/input.h> /* Input device layer */
16#include <linux/platform_device.h>
17
18/*
19 * WM97xx AC97 Touchscreen registers
20 */
21#define AC97_WM97XX_DIGITISER1 0x76
22#define AC97_WM97XX_DIGITISER2 0x78
23#define AC97_WM97XX_DIGITISER_RD 0x7a
24#define AC97_WM9713_DIG1 0x74
25#define AC97_WM9713_DIG2 AC97_WM97XX_DIGITISER1
26#define AC97_WM9713_DIG3 AC97_WM97XX_DIGITISER2
27
28/*
29 * WM97xx register bits
30 */
31#define WM97XX_POLL 0x8000 /* initiate a polling measurement */
32#define WM97XX_ADCSEL_X 0x1000 /* x coord measurement */
33#define WM97XX_ADCSEL_Y 0x2000 /* y coord measurement */
34#define WM97XX_ADCSEL_PRES 0x3000 /* pressure measurement */
35#define WM97XX_ADCSEL_MASK 0x7000
36#define WM97XX_COO 0x0800 /* enable coordinate mode */
37#define WM97XX_CTC 0x0400 /* enable continuous mode */
38#define WM97XX_CM_RATE_93 0x0000 /* 93.75Hz continuous rate */
39#define WM97XX_CM_RATE_187 0x0100 /* 187.5Hz continuous rate */
40#define WM97XX_CM_RATE_375 0x0200 /* 375Hz continuous rate */
41#define WM97XX_CM_RATE_750 0x0300 /* 750Hz continuous rate */
42#define WM97XX_CM_RATE_8K 0x00f0 /* 8kHz continuous rate */
43#define WM97XX_CM_RATE_12K 0x01f0 /* 12kHz continuous rate */
44#define WM97XX_CM_RATE_24K 0x02f0 /* 24kHz continuous rate */
45#define WM97XX_CM_RATE_48K 0x03f0 /* 48kHz continuous rate */
46#define WM97XX_CM_RATE_MASK 0x03f0
47#define WM97XX_RATE(i) (((i & 3) << 8) | ((i & 4) ? 0xf0 : 0))
48#define WM97XX_DELAY(i) ((i << 4) & 0x00f0) /* sample delay times */
49#define WM97XX_DELAY_MASK 0x00f0
50#define WM97XX_SLEN 0x0008 /* slot read back enable */
51#define WM97XX_SLT(i) ((i - 5) & 0x7) /* panel slot (5-11) */
52#define WM97XX_SLT_MASK 0x0007
53#define WM97XX_PRP_DETW 0x4000 /* detect on, digitise off, wake */
54#define WM97XX_PRP_DET 0x8000 /* detect on, digitise off, no wake */
55#define WM97XX_PRP_DET_DIG 0xc000 /* setect on, digitise on */
56#define WM97XX_RPR 0x2000 /* wake up on pen down */
57#define WM97XX_PEN_DOWN 0x8000 /* pen is down */
58#define WM97XX_ADCSRC_MASK 0x7000 /* ADC source mask */
59
60#define WM97XX_AUX_ID1 0x8001
61#define WM97XX_AUX_ID2 0x8002
62#define WM97XX_AUX_ID3 0x8003
63#define WM97XX_AUX_ID4 0x8004
64
65
66/* WM9712 Bits */
67#define WM9712_45W 0x1000 /* set for 5-wire touchscreen */
68#define WM9712_PDEN 0x0800 /* measure only when pen down */
69#define WM9712_WAIT 0x0200 /* wait until adc is read before next sample */
70#define WM9712_PIL 0x0100 /* current used for pressure measurement. set 400uA else 200uA */
71#define WM9712_MASK_HI 0x0040 /* hi on mask pin (47) stops conversions */
72#define WM9712_MASK_EDGE 0x0080 /* rising/falling edge on pin delays sample */
73#define WM9712_MASK_SYNC 0x00c0 /* rising/falling edge on mask initiates sample */
74#define WM9712_RPU(i) (i&0x3f) /* internal pull up on pen detect (64k / rpu) */
75#define WM9712_PD(i) (0x1 << i) /* power management */
76
77/* WM9712 Registers */
78#define AC97_WM9712_POWER 0x24
79#define AC97_WM9712_REV 0x58
80
81/* WM9705 Bits */
82#define WM9705_PDEN 0x1000 /* measure only when pen is down */
83#define WM9705_PINV 0x0800 /* inverts sense of pen down output */
84#define WM9705_BSEN 0x0400 /* BUSY flag enable, pin47 is 1 when busy */
85#define WM9705_BINV 0x0200 /* invert BUSY (pin47) output */
86#define WM9705_WAIT 0x0100 /* wait until adc is read before next sample */
87#define WM9705_PIL 0x0080 /* current used for pressure measurement. set 400uA else 200uA */
88#define WM9705_PHIZ 0x0040 /* set PHONE and PCBEEP inputs to high impedance */
89#define WM9705_MASK_HI 0x0010 /* hi on mask stops conversions */
90#define WM9705_MASK_EDGE 0x0020 /* rising/falling edge on pin delays sample */
91#define WM9705_MASK_SYNC 0x0030 /* rising/falling edge on mask initiates sample */
92#define WM9705_PDD(i) (i & 0x000f) /* pen detect comparator threshold */
93
94
95/* WM9713 Bits */
96#define WM9713_PDPOL 0x0400 /* Pen down polarity */
97#define WM9713_POLL 0x0200 /* initiate a polling measurement */
98#define WM9713_CTC 0x0100 /* enable continuous mode */
99#define WM9713_ADCSEL_X 0x0002 /* X measurement */
100#define WM9713_ADCSEL_Y 0x0004 /* Y measurement */
101#define WM9713_ADCSEL_PRES 0x0008 /* Pressure measurement */
102#define WM9713_COO 0x0001 /* enable coordinate mode */
103#define WM9713_PDEN 0x0800 /* measure only when pen down */
104#define WM9713_ADCSEL_MASK 0x00fe /* ADC selection mask */
105#define WM9713_WAIT 0x0200 /* coordinate wait */
106
107/* AUX ADC ID's */
108#define TS_COMP1 0x0
109#define TS_COMP2 0x1
110#define TS_BMON 0x2
111#define TS_WIPER 0x3
112
113/* ID numbers */
114#define WM97XX_ID1 0x574d
115#define WM9712_ID2 0x4c12
116#define WM9705_ID2 0x4c05
117#define WM9713_ID2 0x4c13
118
119/* Codec GPIO's */
120#define WM97XX_MAX_GPIO 16
121#define WM97XX_GPIO_1 (1 << 1)
122#define WM97XX_GPIO_2 (1 << 2)
123#define WM97XX_GPIO_3 (1 << 3)
124#define WM97XX_GPIO_4 (1 << 4)
125#define WM97XX_GPIO_5 (1 << 5)
126#define WM97XX_GPIO_6 (1 << 6)
127#define WM97XX_GPIO_7 (1 << 7)
128#define WM97XX_GPIO_8 (1 << 8)
129#define WM97XX_GPIO_9 (1 << 9)
130#define WM97XX_GPIO_10 (1 << 10)
131#define WM97XX_GPIO_11 (1 << 11)
132#define WM97XX_GPIO_12 (1 << 12)
133#define WM97XX_GPIO_13 (1 << 13)
134#define WM97XX_GPIO_14 (1 << 14)
135#define WM97XX_GPIO_15 (1 << 15)
136
137
138#define AC97_LINK_FRAME 21 /* time in uS for AC97 link frame */
139
140
141/*---------------- Return codes from sample reading functions ---------------*/
142
143/* More data is available; call the sample gathering function again */
144#define RC_AGAIN 0x00000001
145/* The returned sample is valid */
146#define RC_VALID 0x00000002
147/* The pen is up (the first RC_VALID without RC_PENUP means pen is down) */
148#define RC_PENUP 0x00000004
149/* The pen is down (RC_VALID implies RC_PENDOWN, but sometimes it is helpful
150 to tell the handler that the pen is down but we don't know yet his coords,
151 so the handler should not sleep or wait for pendown irq) */
152#define RC_PENDOWN 0x00000008
153
154/*
155 * The wm97xx driver provides a private API for writing platform-specific
156 * drivers.
157 */
158
159/* The structure used to return arch specific sampled data into */
160struct wm97xx_data {
161 int x;
162 int y;
163 int p;
164};
165
166/*
167 * Codec GPIO status
168 */
169enum wm97xx_gpio_status {
170 WM97XX_GPIO_HIGH,
171 WM97XX_GPIO_LOW
172};
173
174/*
175 * Codec GPIO direction
176 */
177enum wm97xx_gpio_dir {
178 WM97XX_GPIO_IN,
179 WM97XX_GPIO_OUT
180};
181
182/*
183 * Codec GPIO polarity
184 */
185enum wm97xx_gpio_pol {
186 WM97XX_GPIO_POL_HIGH,
187 WM97XX_GPIO_POL_LOW
188};
189
190/*
191 * Codec GPIO sticky
192 */
193enum wm97xx_gpio_sticky {
194 WM97XX_GPIO_STICKY,
195 WM97XX_GPIO_NOTSTICKY
196};
197
198/*
199 * Codec GPIO wake
200 */
201enum wm97xx_gpio_wake {
202 WM97XX_GPIO_WAKE,
203 WM97XX_GPIO_NOWAKE
204};
205
206/*
207 * Digitiser ioctl commands
208 */
209#define WM97XX_DIG_START 0x1
210#define WM97XX_DIG_STOP 0x2
211#define WM97XX_PHY_INIT 0x3
212#define WM97XX_AUX_PREPARE 0x4
213#define WM97XX_DIG_RESTORE 0x5
214
215struct wm97xx;
216
217extern struct wm97xx_codec_drv wm9705_codec;
218extern struct wm97xx_codec_drv wm9712_codec;
219extern struct wm97xx_codec_drv wm9713_codec;
220
221/*
222 * Codec driver interface - allows mapping to WM9705/12/13 and newer codecs
223 */
224struct wm97xx_codec_drv {
225 u16 id;
226 char *name;
227
228 /* read 1 sample */
229 int (*poll_sample) (struct wm97xx *, int adcsel, int *sample);
230
231 /* read X,Y,[P] in poll */
232 int (*poll_touch) (struct wm97xx *, struct wm97xx_data *);
233
234 int (*acc_enable) (struct wm97xx *, int enable);
235 void (*phy_init) (struct wm97xx *);
236 void (*dig_enable) (struct wm97xx *, int enable);
237 void (*dig_restore) (struct wm97xx *);
238 void (*aux_prepare) (struct wm97xx *);
239};
240
241
242/* Machine specific and accelerated touch operations */
243struct wm97xx_mach_ops {
244
245 /* accelerated touch readback - coords are transmited on AC97 link */
246 int acc_enabled;
247 void (*acc_pen_up) (struct wm97xx *);
248 int (*acc_pen_down) (struct wm97xx *);
249 int (*acc_startup) (struct wm97xx *);
250 void (*acc_shutdown) (struct wm97xx *);
251
252 /* interrupt mask control - required for accelerated operation */
253 void (*irq_enable) (struct wm97xx *, int enable);
254
255 /* GPIO pin used for accelerated operation */
256 int irq_gpio;
257
258 /* pre and post sample - can be used to minimise any analog noise */
259 void (*pre_sample) (int); /* function to run before sampling */
260 void (*post_sample) (int); /* function to run after sampling */
261};
262
263struct wm97xx {
264 u16 dig[3], id, gpio[6], misc; /* Cached codec registers */
265 u16 dig_save[3]; /* saved during aux reading */
266 struct wm97xx_codec_drv *codec; /* attached codec driver*/
267 struct input_dev *input_dev; /* touchscreen input device */
268 struct snd_ac97 *ac97; /* ALSA codec access */
269 struct device *dev; /* ALSA device */
270 struct platform_device *battery_dev;
271 struct platform_device *touch_dev;
272 struct wm97xx_mach_ops *mach_ops;
273 struct mutex codec_mutex;
274 struct delayed_work ts_reader; /* Used to poll touchscreen */
275 unsigned long ts_reader_interval; /* Current interval for timer */
276 unsigned long ts_reader_min_interval; /* Minimum interval */
277 unsigned int pen_irq; /* Pen IRQ number in use */
278 struct workqueue_struct *ts_workq;
279 struct work_struct pen_event_work;
280 u16 acc_slot; /* AC97 slot used for acc touch data */
281 u16 acc_rate; /* acc touch data rate */
282 unsigned pen_is_down:1; /* Pen is down */
283 unsigned aux_waiting:1; /* aux measurement waiting */
284 unsigned pen_probably_down:1; /* used in polling mode */
285 u16 suspend_mode; /* PRP in suspend mode */
286};
287
288/*
289 * Codec GPIO access (not supported on WM9705)
290 * This can be used to set/get codec GPIO and Virtual GPIO status.
291 */
292enum wm97xx_gpio_status wm97xx_get_gpio(struct wm97xx *wm, u32 gpio);
293void wm97xx_set_gpio(struct wm97xx *wm, u32 gpio,
294 enum wm97xx_gpio_status status);
295void wm97xx_config_gpio(struct wm97xx *wm, u32 gpio,
296 enum wm97xx_gpio_dir dir,
297 enum wm97xx_gpio_pol pol,
298 enum wm97xx_gpio_sticky sticky,
299 enum wm97xx_gpio_wake wake);
300
301void wm97xx_set_suspend_mode(struct wm97xx *wm, u16 mode);
302
303/* codec AC97 IO access */
304int wm97xx_reg_read(struct wm97xx *wm, u16 reg);
305void wm97xx_reg_write(struct wm97xx *wm, u16 reg, u16 val);
306
307/* aux adc readback */
308int wm97xx_read_aux_adc(struct wm97xx *wm, u16 adcsel);
309
310/* machine ops */
311int wm97xx_register_mach_ops(struct wm97xx *, struct wm97xx_mach_ops *);
312void wm97xx_unregister_mach_ops(struct wm97xx *);
313
314#endif
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index b7b3362f7717..f462439cc288 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -114,6 +114,9 @@ struct file;
114int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *, 114int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
115 void __user *, size_t *, loff_t *); 115 void __user *, size_t *, loff_t *);
116 116
117void get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty,
118 struct backing_dev_info *bdi);
119
117void page_writeback_init(void); 120void page_writeback_init(void);
118void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, 121void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
119 unsigned long nr_pages_dirtied); 122 unsigned long nr_pages_dirtied);
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index df6b95d2218e..d131e352cfe1 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -47,10 +47,10 @@ struct xattr_handler {
47}; 47};
48 48
49ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); 49ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
50ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t); 50ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
51ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size); 51ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
52int vfs_setxattr(struct dentry *, char *, void *, size_t, int); 52int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
53int vfs_removexattr(struct dentry *, char *); 53int vfs_removexattr(struct dentry *, const char *);
54 54
55ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size); 55ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);
56ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); 56ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index e31b8c84f2c9..2ca6bae88721 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -97,10 +97,10 @@ struct xfrm_algo {
97}; 97};
98 98
99struct xfrm_algo_aead { 99struct xfrm_algo_aead {
100 char alg_name[64]; 100 char alg_name[64];
101 int alg_key_len; /* in bits */ 101 unsigned int alg_key_len; /* in bits */
102 int alg_icv_len; /* in bits */ 102 unsigned int alg_icv_len; /* in bits */
103 char alg_key[0]; 103 char alg_key[0];
104}; 104};
105 105
106struct xfrm_stats { 106struct xfrm_stats {
@@ -113,7 +113,8 @@ enum
113{ 113{
114 XFRM_POLICY_TYPE_MAIN = 0, 114 XFRM_POLICY_TYPE_MAIN = 0,
115 XFRM_POLICY_TYPE_SUB = 1, 115 XFRM_POLICY_TYPE_SUB = 1,
116 XFRM_POLICY_TYPE_MAX = 2 116 XFRM_POLICY_TYPE_MAX = 2,
117 XFRM_POLICY_TYPE_ANY = 255
117}; 118};
118 119
119enum 120enum